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 <kashafansari3108@gmail.com>

* mobile: default Keep Screen On to true and clarify description

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>

---------

Signed-off-by: kashaf-ansari-dev <kashafansari3108@gmail.com>
This commit is contained in:
Kashaf Ansari
2026-07-09 09:49:38 +05:00
committed by GitHub
parent a4cbe83211
commit 4a7aa27bd9
8 changed files with 43 additions and 11 deletions

View File

@@ -72,6 +72,7 @@ const MergeConflicts = () => {
const insets = useGlobalSafeAreaInsets();
const content = useRef<UnencryptedContentItem>(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
}}
>
<KeepAwake />
{keepScreenOn && <KeepAwake />}
{dialogVisible && (
<BaseDialog visible={true}>
<DialogContainer>

View File

@@ -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 (

View File

@@ -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",

View File

@@ -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<SettingStore>((set, get) => ({

View File

@@ -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"

View File

@@ -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 ""

View File

@@ -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.`
};