From 5cc8c736e7441acab137052d0810f3091750d68b Mon Sep 17 00:00:00 2001 From: Garrett Mills Date: Sat, 21 Mar 2026 17:04:05 -0500 Subject: [PATCH] Add user preference to disable sidebar swipe-to-open on mobile; cleanup migrations + README in prep for long-term fork maintenance --- README-fork.md | 6 ++++++ commafeed-client/src/app/types.ts | 1 + commafeed-client/src/app/user/slice.ts | 6 ++++++ commafeed-client/src/app/user/thunks.ts | 6 ++++++ .../src/components/settings/DisplaySettings.tsx | 8 ++++++++ commafeed-client/src/locales/en/messages.po | 4 ++++ commafeed-client/src/pages/app/Layout.tsx | 4 ++++ .../java/com/commafeed/backend/model/UserSettings.java | 1 + .../main/java/com/commafeed/frontend/model/Settings.java | 3 +++ .../java/com/commafeed/frontend/resource/UserREST.java | 3 +++ .../{db.changelog-7.1.xml => db.changelog-gmfork.xml} | 8 ++++++++ commafeed-server/src/main/resources/migrations.xml | 2 +- 12 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 README-fork.md rename commafeed-server/src/main/resources/changelogs/{db.changelog-7.1.xml => db.changelog-gmfork.xml} (70%) diff --git a/README-fork.md b/README-fork.md new file mode 100644 index 00000000..45311d80 --- /dev/null +++ b/README-fork.md @@ -0,0 +1,6 @@ +# `garrettmills/commafeed` + +This is my personal fork of `Athou/commafeed` with some tweaks: + +- "Infrequent" tab - like "All" but limits to blogs w/ an average post interval greater than a user-configurable number of days +- User preference to disable the swipe-to-open-menu gesture on mobile diff --git a/commafeed-client/src/app/types.ts b/commafeed-client/src/app/types.ts index 68a71379..514406c0 100644 --- a/commafeed-client/src/app/types.ts +++ b/commafeed-client/src/app/types.ts @@ -285,6 +285,7 @@ export interface Settings { unreadCountTitle: boolean unreadCountFavicon: boolean disablePullToRefresh: boolean + disableMobileSwipe: boolean infrequentThresholdDays: number primaryColor?: string sharingSettings: SharingSettings diff --git a/commafeed-client/src/app/user/slice.ts b/commafeed-client/src/app/user/slice.ts index 7ee9ef1b..d3b8afb1 100644 --- a/commafeed-client/src/app/user/slice.ts +++ b/commafeed-client/src/app/user/slice.ts @@ -4,6 +4,7 @@ import { createSlice, isAnyOf, type PayloadAction } from "@reduxjs/toolkit" import type { LocalSettings, Settings, UserModel, ViewMode } from "@/app/types" import { changeCustomContextMenu, + changeDisableMobileSwipe, changeDisablePullToRefresh, changeEntriesToKeepOnTopWhenScrolling, changeExternalLinkIconDisplayMode, @@ -142,6 +143,10 @@ export const userSlice = createSlice({ if (!state.settings) return state.settings.disablePullToRefresh = action.meta.arg }) + builder.addCase(changeDisableMobileSwipe.pending, (state, action) => { + if (!state.settings) return + state.settings.disableMobileSwipe = action.meta.arg + }) builder.addCase(changeInfrequentThresholdDays.pending, (state, action) => { if (!state.settings) return state.settings.infrequentThresholdDays = action.meta.arg @@ -176,6 +181,7 @@ export const userSlice = createSlice({ changeUnreadCountTitle.fulfilled, changeUnreadCountFavicon.fulfilled, changeDisablePullToRefresh.fulfilled, + changeDisableMobileSwipe.fulfilled, changeInfrequentThresholdDays.fulfilled, changePrimaryColor.fulfilled, changeSharingSetting.fulfilled, diff --git a/commafeed-client/src/app/user/thunks.ts b/commafeed-client/src/app/user/thunks.ts index d55449eb..f48b8a2d 100644 --- a/commafeed-client/src/app/user/thunks.ts +++ b/commafeed-client/src/app/user/thunks.ts @@ -131,6 +131,12 @@ export const changeDisablePullToRefresh = createAppAsyncThunk( } ) +export const changeDisableMobileSwipe = createAppAsyncThunk("settings/disableMobileSwipe", (disableMobileSwipe: boolean, thunkApi) => { + const { settings } = thunkApi.getState().user + if (!settings) return + client.user.saveSettings({ ...settings, disableMobileSwipe }) +}) + export const changePrimaryColor = createAppAsyncThunk("settings/primaryColor", (primaryColor: string, thunkApi) => { const { settings } = thunkApi.getState().user if (!settings) return diff --git a/commafeed-client/src/components/settings/DisplaySettings.tsx b/commafeed-client/src/components/settings/DisplaySettings.tsx index 7b0b5651..192876c9 100644 --- a/commafeed-client/src/components/settings/DisplaySettings.tsx +++ b/commafeed-client/src/components/settings/DisplaySettings.tsx @@ -9,6 +9,7 @@ import { useAppDispatch, useAppSelector } from "@/app/store" import type { IconDisplayMode, ScrollMode, SharingSettings } from "@/app/types" import { changeCustomContextMenu, + changeDisableMobileSwipe, changeDisablePullToRefresh, changeEntriesToKeepOnTopWhenScrolling, changeExternalLinkIconDisplayMode, @@ -45,6 +46,7 @@ export function DisplaySettings() { const unreadCountTitle = useAppSelector(state => state.user.settings?.unreadCountTitle) const unreadCountFavicon = useAppSelector(state => state.user.settings?.unreadCountFavicon) const disablePullToRefresh = useAppSelector(state => state.user.settings?.disablePullToRefresh) + const disableMobileSwipe = useAppSelector(state => state.user.settings?.disableMobileSwipe) const infrequentThresholdDays = useAppSelector(state => state.user.settings?.infrequentThresholdDays) const sharingSettings = useAppSelector(state => state.user.settings?.sharingSettings) const primaryColor = useAppSelector(state => state.user.settings?.primaryColor) || Constants.theme.defaultPrimaryColor @@ -145,6 +147,12 @@ export function DisplaySettings() { onChange={async e => await dispatch(changeMobileFooter(e.currentTarget.checked))} /> + On mobile, disable swipe gesture to open the menu} + checked={disableMobileSwipe} + onChange={async e => await dispatch(changeDisableMobileSwipe(e.currentTarget.checked))} + /> + Infrequent posts threshold (days)} description={Feeds posting less often than this (on average) will appear in the Infrequent view} diff --git a/commafeed-client/src/locales/en/messages.po b/commafeed-client/src/locales/en/messages.po index 0adbb721..c076cf1b 100644 --- a/commafeed-client/src/locales/en/messages.po +++ b/commafeed-client/src/locales/en/messages.po @@ -715,6 +715,10 @@ msgstr "On desktop" msgid "On mobile" msgstr "On mobile" +#: src/components/settings/DisplaySettings.tsx +msgid "On mobile, disable swipe gesture to open the menu" +msgstr "On mobile, disable swipe gesture to open the menu" + #: src/components/settings/DisplaySettings.tsx msgid "On mobile, show action buttons at the bottom of the screen" msgstr "On mobile, show action buttons at the bottom of the screen" diff --git a/commafeed-client/src/pages/app/Layout.tsx b/commafeed-client/src/pages/app/Layout.tsx index 48846e4d..6944cac0 100644 --- a/commafeed-client/src/pages/app/Layout.tsx +++ b/commafeed-client/src/pages/app/Layout.tsx @@ -79,6 +79,7 @@ export default function Layout(props: Readonly) { const webSocketConnected = useAppSelector(state => state.server.webSocketConnected) const treeReloadInterval = useAppSelector(state => state.server.serverInfos?.treeReloadInterval) const mobileFooter = useAppSelector(state => state.user.settings?.mobileFooter) + const disableMobileSwipe = useAppSelector(state => state.user.settings?.disableMobileSwipe) const sidebarWidth = useAppSelector(state => state.user.localSettings.sidebarWidth) const headerInFooter = mobile && !isBrowserExtensionPopup && mobileFooter const dispatch = useAppDispatch() @@ -164,6 +165,9 @@ export default function Layout(props: Readonly) { const swipeHandlers = useSwipeable({ onSwiping: e => { + if (disableMobileSwipe) { + return + } const threshold = document.documentElement.clientWidth / 6 if (e.absX > threshold) { dispatch(setMobileMenuOpen(e.dir === "Right")) diff --git a/commafeed-server/src/main/java/com/commafeed/backend/model/UserSettings.java b/commafeed-server/src/main/java/com/commafeed/backend/model/UserSettings.java index e1fa5a02..289ec2b8 100644 --- a/commafeed-server/src/main/java/com/commafeed/backend/model/UserSettings.java +++ b/commafeed-server/src/main/java/com/commafeed/backend/model/UserSettings.java @@ -145,6 +145,7 @@ public class UserSettings extends AbstractModel { private boolean unreadCountTitle; private boolean unreadCountFavicon; private boolean disablePullToRefresh; + private boolean disableMobileSwipe; private int infrequentThresholdDays; diff --git a/commafeed-server/src/main/java/com/commafeed/frontend/model/Settings.java b/commafeed-server/src/main/java/com/commafeed/frontend/model/Settings.java index 2f4ee7d6..147763ba 100644 --- a/commafeed-server/src/main/java/com/commafeed/frontend/model/Settings.java +++ b/commafeed-server/src/main/java/com/commafeed/frontend/model/Settings.java @@ -76,6 +76,9 @@ public class Settings implements Serializable { @Schema(description = "disable pull to refresh", required = true) private boolean disablePullToRefresh; + @Schema(description = "disable swipe gesture to open mobile menu", required = true) + private boolean disableMobileSwipe; + @Schema(description = "threshold in days for the infrequent view", required = true) private int infrequentThresholdDays; diff --git a/commafeed-server/src/main/java/com/commafeed/frontend/resource/UserREST.java b/commafeed-server/src/main/java/com/commafeed/frontend/resource/UserREST.java index 7cab26d2..9729df54 100644 --- a/commafeed-server/src/main/java/com/commafeed/frontend/resource/UserREST.java +++ b/commafeed-server/src/main/java/com/commafeed/frontend/resource/UserREST.java @@ -132,6 +132,7 @@ public class UserREST { s.setUnreadCountTitle(settings.isUnreadCountTitle()); s.setUnreadCountFavicon(settings.isUnreadCountFavicon()); s.setDisablePullToRefresh(settings.isDisablePullToRefresh()); + s.setDisableMobileSwipe(settings.isDisableMobileSwipe()); s.setPrimaryColor(settings.getPrimaryColor()); s.setInfrequentThresholdDays(settings.getInfrequentThresholdDays()); @@ -169,6 +170,7 @@ public class UserREST { s.setUnreadCountTitle(false); s.setUnreadCountFavicon(true); s.setDisablePullToRefresh(false); + s.setDisableMobileSwipe(false); s.setInfrequentThresholdDays(7); } return s; @@ -206,6 +208,7 @@ public class UserREST { s.setUnreadCountTitle(settings.isUnreadCountTitle()); s.setUnreadCountFavicon(settings.isUnreadCountFavicon()); s.setDisablePullToRefresh(settings.isDisablePullToRefresh()); + s.setDisableMobileSwipe(settings.isDisableMobileSwipe()); s.setPrimaryColor(settings.getPrimaryColor()); s.setInfrequentThresholdDays(settings.getInfrequentThresholdDays()); diff --git a/commafeed-server/src/main/resources/changelogs/db.changelog-7.1.xml b/commafeed-server/src/main/resources/changelogs/db.changelog-gmfork.xml similarity index 70% rename from commafeed-server/src/main/resources/changelogs/db.changelog-7.1.xml rename to commafeed-server/src/main/resources/changelogs/db.changelog-gmfork.xml index 52eccabd..09ebcbf5 100644 --- a/commafeed-server/src/main/resources/changelogs/db.changelog-7.1.xml +++ b/commafeed-server/src/main/resources/changelogs/db.changelog-gmfork.xml @@ -11,4 +11,12 @@ + + + + + + + + diff --git a/commafeed-server/src/main/resources/migrations.xml b/commafeed-server/src/main/resources/migrations.xml index eab37a0f..af8bdd11 100644 --- a/commafeed-server/src/main/resources/migrations.xml +++ b/commafeed-server/src/main/resources/migrations.xml @@ -38,6 +38,6 @@ - + \ No newline at end of file