From 4a7aa27bd9d60cda034c1a0d149ade5aa0e686a5 Mon Sep 17 00:00:00 2001 From: Kashaf Ansari Date: Thu, 9 Jul 2026 09:49:38 +0500 Subject: [PATCH] mobile: add keep-screen-on preference in settings-behaviour (#10043) * mobile: add keep-screen-on preference in settings-behaviour Signed-off-by: kashaf-ansari-dev * mobile: default Keep Screen On to true and clarify description Signed-off-by: kashaf-ansari-dev --------- Signed-off-by: kashaf-ansari-dev --- .../app/components/merge-conflicts/index.tsx | 15 ++++++++------- .../app/navigation/fluid-panels-view.tsx | 4 +++- .../app/screens/settings/settings-data.tsx | 10 +++++++++- apps/mobile/app/stores/use-setting-store.ts | 4 +++- apps/mobile/fonts/MaterialCommunityIcons.ttf | Bin 27084 -> 27224 bytes packages/intl/locale/en.po | 8 ++++++++ packages/intl/locale/pseudo-LOCALE.po | 8 ++++++++ packages/intl/src/strings.ts | 5 ++++- 8 files changed, 43 insertions(+), 11 deletions(-) diff --git a/apps/mobile/app/components/merge-conflicts/index.tsx b/apps/mobile/app/components/merge-conflicts/index.tsx index c1003aef2..808019001 100644 --- a/apps/mobile/app/components/merge-conflicts/index.tsx +++ b/apps/mobile/app/components/merge-conflicts/index.tsx @@ -72,6 +72,7 @@ const MergeConflicts = () => { const insets = useGlobalSafeAreaInsets(); const content = useRef(null); const { height } = useSettingStore((state) => state.dimensions); + const keepScreenOn = useSettingStore((state) => state.settings.keepScreenOn); const applyChanges = async () => { const contentToSave = selectedContent; @@ -155,9 +156,9 @@ const MergeConflicts = () => { ...item.content, conflicted: currentContent?.conflicted ? await db.vault.decryptContent( - currentContent?.conflicted as EncryptedContentItem, - password - ) + currentContent?.conflicted as EncryptedContentItem, + password + ) : undefined } as UnencryptedContentItem; @@ -182,9 +183,9 @@ const MergeConflicts = () => { ...item.content, conflicted: currentContent?.conflicted ? await db.vault.decryptContent( - currentContent?.conflicted as EncryptedContentItem, - password - ) + currentContent?.conflicted as EncryptedContentItem, + password + ) : undefined } as UnencryptedContentItem; @@ -385,7 +386,7 @@ const MergeConflicts = () => { paddingTop: insets.top }} > - + {keepScreenOn && } {dialogVisible && ( diff --git a/apps/mobile/app/navigation/fluid-panels-view.tsx b/apps/mobile/app/navigation/fluid-panels-view.tsx index 41eafeac7..2ef17c040 100644 --- a/apps/mobile/app/navigation/fluid-panels-view.tsx +++ b/apps/mobile/app/navigation/fluid-panels-view.tsx @@ -447,7 +447,9 @@ const onChangeTab = async (event: { i: number; from: number }) => { if (event.i === 2) { editorState().movedAway = false; editorState().isFocused = true; - activateKeepAwake(); + if (useSettingStore.getState().settings.keepScreenOn) { + activateKeepAwake(); + } eSendEvent(eOnEnterEditor); if ( diff --git a/apps/mobile/app/screens/settings/settings-data.tsx b/apps/mobile/app/screens/settings/settings-data.tsx index e073562b1..6e89479c0 100644 --- a/apps/mobile/app/screens/settings/settings-data.tsx +++ b/apps/mobile/app/screens/settings/settings-data.tsx @@ -210,7 +210,7 @@ export const settingsGroups: SettingSection[] = [ : status === SubscriptionStatus.ACTIVE ? strings.subRenewOn(expiryDate) : status === SubscriptionStatus.CANCELED || - status === SubscriptionStatus.PAUSED + status === SubscriptionStatus.PAUSED ? strings.subEndsOn(expiryDate) : status === SubscriptionStatus.EXPIRED ? subscriptionDaysLeft.time < -3 @@ -965,6 +965,14 @@ export const settingsGroups: SettingSection[] = [ property: "checkForUpdates", icon: "update" }, + { + id: "keep-screen-on", + type: "switch", + name: strings.keepScreenOn(), + description: strings.keepScreenOnDesc(), + property: "keepScreenOn", + icon: "cellphone-screenshot", + }, { id: "image-compression", type: "component", diff --git a/apps/mobile/app/stores/use-setting-store.ts b/apps/mobile/app/stores/use-setting-store.ts index b398149ee..6fc0f67f7 100644 --- a/apps/mobile/app/stores/use-setting-store.ts +++ b/apps/mobile/app/stores/use-setting-store.ts @@ -104,6 +104,7 @@ export type Settings = { checkForUpdates?: boolean; defaultLineHeight: number; imageCompression: "ask-every-time" | "enabled" | "disabled"; + keepScreenOn?: boolean; }; type DimensionsType = { @@ -213,7 +214,8 @@ export const defaultSettings: SettingStore["settings"] = { lastFullBackupDate: 0, checkForUpdates: true, defaultLineHeight: EDITOR_LINE_HEIGHT.DEFAULT, - imageCompression: "ask-every-time" + imageCompression: "ask-every-time", + keepScreenOn: true }; export const useSettingStore = create((set, get) => ({ diff --git a/apps/mobile/fonts/MaterialCommunityIcons.ttf b/apps/mobile/fonts/MaterialCommunityIcons.ttf index 7bfc48b133fc67007bdf66bb70f975f5369200ea..e863c181fb9d5486deaea24892c6e6fcb806e210 100644 GIT binary patch delta 797 zcmW;IT}V@59LMqBGegs9&t9B%K=SOxGtz?4ju&;2gcMx`ft1s{XM}%RAliIXr*UB?G5%A;n>&Dz;PNa>1ZTY60h7b-Vd~= zfuht*IwcB6=-&U|Ewjxc^OHJckxt_^>LmtTr#@rA2=yHUZa`Y|7%)ohWWY`8DUzUl z#;5}fxJ`Y)fIE=IM;I_pZDUB{E?t~tzyxGTmI3!5w=^gvOhd{U z2BfLq8E~Kaivjd9whN38V0(e2qy=~gX%`H51nG=2fHrgvGvG0Gi2){L>3IgsLYCPW zFh_MT;0a{;Sq40X+)9Te0DW0yKLehdD}~0smMenZ9!@Bz1e~6Hm%X%Xuc)op?YlK^ zL7m;}bk*r~db!I>9kwfqJ z>FA%ioVlxcTwGoXY&ZV~YQ@1-Ra3jvRdwB6;cj%t-3y*-&oR%aXUVI1&v`%jRNn#L zpzn?EM^#1DkY>{~Eual*Z~fc+t^NuBG95&ajM>-v&61a)i$Hsyu!xMgc*0uXD(x`B Z;bha%EzTS4}q2qJ=_B&x*}uBy-P!tegicRBZR&)Zk#=}VLKW}33AAA>1} z74ruYNB8G8Y)^vcBkZk@cg8wm8|(TY>Hu5f@}T&Mk^RvYnVoodDsBGBis&)<#^FSA zUu^K#gv?EgGN-y@=^pc%IcQ19L+`;@cW0va(|eiwp(x*z?5#-EZQVTzZQG#q)Kq@l zc(Sr}=^Aodi|n$@0Jd~M#&gnX1?QzN6y&gF#R@J+I}}`$9uaAI_mZ?v!DZ>Bf?;fV zgMus4Rs|!{c14D(*orp_u3=Z!D;SjyDj1VKP%tk2tKd4;PAQm>epQf{{#0-STiLJl z0F|?{o|T`LpIl|gEZyKHwz@~bE$LYW^6~0<1-G#^Clt8YHI)kPNUIdw#jZWB;2w6J zoKnDj?D~j;X_-p|X2Nv2e>~A0uDj=(Etz}t?wLCj9WkeOHHY1<=329};H~vedLMch zd{w@P@1$?hAMz*sL;gabAutyB;nX;d&KYOgSqQcVKLiV*O`*n6F7!RTIh+a)vvjZ- a_e;y?qT(4@Ja0Q>+(@i!x!WH9ZT t`The password for decrypting the Colornote backup file.`, - deleteItem: () => t`Delete item` + deleteItem: () => t`Delete item`, + keepScreenOn: () => t`Keep screen on`, + keepScreenOnDesc: () => + t`Prevent the screen from turning off while the editor is focused.` };