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 7bfc48b13..e863c181f 100644 Binary files a/apps/mobile/fonts/MaterialCommunityIcons.ttf and b/apps/mobile/fonts/MaterialCommunityIcons.ttf differ diff --git a/packages/intl/locale/en.po b/packages/intl/locale/en.po index f02a9fe27..b4c6d71cd 100644 --- a/packages/intl/locale/en.po +++ b/packages/intl/locale/en.po @@ -3821,6 +3821,10 @@ msgstr "Keep" msgid "Keep open" msgstr "Keep open" +#: src/strings.ts:2800 +msgid "Keep screen on" +msgstr "Keep screen on" + #: src/strings.ts:1361 msgid "Keep your data safe" msgstr "Keep your data safe" @@ -5191,6 +5195,10 @@ msgstr "Pressing \"X\" will hide the app in your system tray." msgid "Prevent note title from appearing in tab/window title." msgstr "Prevent note title from appearing in tab/window title." +#: src/strings.ts:2802 +msgid "Prevent the screen from turning off while the editor is focused." +msgstr "Prevent the screen from turning off while the editor is focused." + #: src/strings.ts:2325 msgid "Preview attachment" msgstr "Preview attachment" diff --git a/packages/intl/locale/pseudo-LOCALE.po b/packages/intl/locale/pseudo-LOCALE.po index ca323cf1d..ac07060d5 100644 --- a/packages/intl/locale/pseudo-LOCALE.po +++ b/packages/intl/locale/pseudo-LOCALE.po @@ -3801,6 +3801,10 @@ msgstr "" msgid "Keep open" msgstr "" +#: src/strings.ts:2800 +msgid "Keep screen on" +msgstr "" + #: src/strings.ts:1361 msgid "Keep your data safe" msgstr "" @@ -5165,6 +5169,10 @@ msgstr "" msgid "Prevent note title from appearing in tab/window title." msgstr "" +#: src/strings.ts:2802 +msgid "Prevent the screen from turning off while the editor is focused." +msgstr "" + #: src/strings.ts:2325 msgid "Preview attachment" msgstr "" diff --git a/packages/intl/src/strings.ts b/packages/intl/src/strings.ts index 4be3ad090..b4871f2a8 100644 --- a/packages/intl/src/strings.ts +++ b/packages/intl/src/strings.ts @@ -2796,5 +2796,8 @@ Continue without attachments?`, t`Colornote password for ${filename}`, colorNotPasswordForDesc: () => 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.` };