mobile: fix settings module related issues

This commit is contained in:
Ammar Ahmed
2026-08-05 11:08:39 +05:00
parent 050d76ab99
commit 394226d46b
25 changed files with 175 additions and 67 deletions

View File

@@ -143,15 +143,16 @@ const SheetProvider = ({ context = "global" }) => {
borderRadius: Radius.XS,
alignItems: "center",
justifyContent: "center",
backgroundColor: colors.secondary.background
backgroundColor:
data.iconBackground || colors.secondary.background
}}
>
{data.icon ? (
<AppIcon
name="clock"
name={data.icon}
iconFamily="notesnook"
size={16}
color={colors.primary.icon}
color={data.iconColor}
/>
) : (
<ActivityIndicator
@@ -169,7 +170,7 @@ const SheetProvider = ({ context = "global" }) => {
<View
style={{
flex: 1,
gap: Spacing.LEVEL_1
gap: Spacing.LEVEL_0
}}
>
{data.title ? (

View File

@@ -139,7 +139,9 @@ function AppLockTimeout({ close }: AppLockTimeoutProps) {
padding: Spacing.LEVEL_2,
borderRadius: Radius.XS,
borderWidth: selected ? 0 : 1,
borderColor: colors.primary.border
borderColor: selected
? colors.selected.border
: colors.secondary.border
}}
>
<Heading

View File

@@ -149,7 +149,9 @@ function LockVaultTimer({ close }: LockVaultTimerProps) {
padding: Spacing.LEVEL_2,
borderRadius: Radius.XS,
borderWidth: selected ? 0 : 1,
borderColor: colors.primary.border
borderColor: selected
? colors.selected.border
: colors.secondary.border
}}
>
<Heading

View File

@@ -150,7 +150,9 @@ function TrashInterval({ close }: TrashIntervalProps) {
padding: Spacing.LEVEL_2,
borderRadius: Radius.XS,
borderWidth: selected ? 0 : 1,
borderColor: colors.primary.border
borderColor: selected
? colors.selected.border
: colors.secondary.border
}}
>
<Heading

View File

@@ -145,6 +145,7 @@ export function MenuItem({
width: "100%",
alignSelf: "center",
borderRadius: Radius.XS,
borderWidth: 0,
flexDirection: "row",
paddingHorizontal: Spacing.LEVEL_1,
justifyContent: "space-between",

View File

@@ -80,7 +80,7 @@ export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
flexDirection: "row",
justifyContent: "space-between",
alignItems: "center",
paddingHorizontal: Spacing.LEVEL_3,
paddingHorizontal: Spacing.LEVEL_3
}}
>
<View
@@ -109,7 +109,7 @@ export const SideMenuHeader = (props: { rightButtons?: IconButtonProps[] }) => {
style={{
flexDirection: "row",
alignItems: "center",
gap: DefaultAppStyles.GAP_SMALL
gap: Spacing.LEVEL_2
}}
>
{props.rightButtons?.map((button, index) => (

View File

@@ -30,7 +30,6 @@ import { useMenuStore } from "../../stores/use-menu-store";
import { useSettingStore } from "../../stores/use-setting-store";
import { useUserStore } from "../../stores/use-user-store";
import { MenuItemsList } from "../../utils/menu-items";
import { DefaultAppStyles } from "../../utils/styles";
import ReorderableList from "../list/reorderable-list";
import { MenuItemProperties } from "../sheets/menu-item-properties";
import { Button } from "../ui/button";
@@ -68,7 +67,6 @@ export function SideMenuHome() {
const colorNotes = useMenuStore((state) => state.colorNotes);
const menuPins = useMenuStore((state) => state.menuPins);
return (
<View
style={{
@@ -103,7 +101,7 @@ export function SideMenuHome() {
alwaysBounceVertical={false}
data={MenuItemsList}
style={{
width: "100%",
width: "100%"
}}
disableDefaultDrag
showsVerticalScrollIndicator={false}
@@ -128,21 +126,25 @@ export function SideMenuHome() {
}}
/>
{colorNotes.length > 0 && (
<View style={{
marginTop: Spacing.LEVEL_2,
borderTopWidth: 1,
borderTopColor: colors.primary.separator,
marginBottom: Spacing.LEVEL_2
}} />
<View
style={{
marginTop: Spacing.LEVEL_2,
borderTopWidth: 1,
borderTopColor: colors.primary.separator,
marginBottom: Spacing.LEVEL_2
}}
/>
)}
<ColorSection />
{menuPins.length > 0 && (
<View style={{
marginTop: Spacing.LEVEL_2,
borderTopWidth: 1,
borderTopColor: colors.primary.separator,
marginBottom: Spacing.LEVEL_2
}} />
<View
style={{
marginTop: Spacing.LEVEL_2,
borderTopWidth: 1,
borderTopColor: colors.primary.separator,
marginBottom: Spacing.LEVEL_2
}}
/>
)}
{menuPins.length > 0 && <PinnedSection />}
</>
@@ -167,7 +169,7 @@ export function SideMenuHome() {
{(subscriptionType === SubscriptionPlan.FREE ||
!subscriptionType ||
!user) &&
!SettingsService.getProperty("serverUrls") ? (
!SettingsService.getProperty("serverUrls") ? (
<Button
title={pro.title}
style={{

View File

@@ -36,6 +36,12 @@ import { AppFontSize } from "../../utils/size";
import NativeTooltip from "../../utils/tooltip";
import AppIcon from "../ui/AppIcon";
import { IconButton } from "../ui/icon-button";
import {
eSendEvent,
presentSheet,
ToastManager
} from "../../services/event-manager";
import { eCloseSheet } from "../../utils/events";
const SyncStatusButton = () => {
const { colors } = useThemeColors();
@@ -99,6 +105,37 @@ const SyncStatusButton = () => {
const onPress = () => {
if (syncing) return;
if (isOffline) {
ToastManager.show({
type: "warning",
heading: strings.youAreOffline(),
context: "global"
});
return;
}
if (isFailed) {
presentSheet({
icon: "warning-circle",
iconColor: colors.error.accent,
iconBackground: colors.error.shade,
title: strings.anErrorOccured(),
paragraph: strings.anErrorOccuredDuringSync(),
actionsArray: [
{
action: () => {
Sync.run();
eSendEvent(eCloseSheet);
},
actionText: strings.tryAgain(),
type: "accent"
}
]
});
return;
}
Sync.run();
};
@@ -125,12 +162,18 @@ const SyncStatusButton = () => {
}}
>
<Animated.View style={rotationStyle}>
<AppIcon name="sync" size={AppFontSize.lg} color={getIconColor()} />
<AppIcon
name="user-sheet-sync"
iconFamily="notesnook"
size={AppFontSize.lg}
color={getIconColor()}
/>
</Animated.View>
</View>
) : (
<IconButton
name="sync"
name="user-sheet-sync"
iconFamily="notesnook"
onPress={onPress}
tooltipText={tooltipText}
tooltipPosition={NativeTooltip.POSITIONS.BOTTOM}
@@ -148,10 +191,11 @@ const SyncStatusButton = () => {
{!syncing && (isFailed || isOffline) ? (
<AppIcon
name="information"
color={isOffline ? colors.static.yellow : colors.error.icon}
size={AppFontSize.xxs}
style={{ position: "absolute", bottom: -3, right: -3 }}
name="warning-circle-filled"
iconFamily="notesnook"
color={isOffline ? colors.static.orange : colors.error.icon}
size={16}
style={{ position: "absolute", bottom: -5, right: -5 }}
/>
) : null}
</View>

View File

@@ -134,9 +134,9 @@ const buttonTypes = (
text: colors.selected.buttonForeground,
selected: colors.selected.background,
borderWidth: 0.8,
borderColor: getColorLinearShade(colors.selected.background, 0.05, isDark),
borderColor: colors.selected.border,
borderSelectedColor: getColorLinearShade(
colors.selected.background,
colors.selected.border,
0.05,
isDark
)

View File

@@ -52,6 +52,10 @@ export const ConfigureToolbar = () => {
const _data = data ? data.slice() : [];
_data.push([]);
useDragState.getState().setData(_data);
ToastManager.show({
message: strings.groupCreated(),
type: "success"
});
};
const renderGroups = () => {

View File

@@ -26,7 +26,6 @@ import { presentDialog } from "../../../../components/dialog/functions";
import AppIcon from "../../../../components/ui/AppIcon";
import { IconButton } from "../../../../components/ui/icon-button";
import Heading from "../../../../components/ui/typography/heading";
import { getElevationStyle } from "../../../../utils/elevation";
import { renderTool } from "./common";
import { DraggableItem, useDragState } from "./state";
import ToolSheet from "./tool-sheet";
@@ -34,9 +33,9 @@ import ToolSheet from "./tool-sheet";
import { isFeatureAvailable, useIsFeatureAvailable } from "@notesnook/common";
import type { ToolId } from "@notesnook/editor";
import { strings } from "@notesnook/intl";
import { Radius, Spacing } from "../../../../common/design/spacing";
import { ToastManager } from "../../../../services/event-manager";
import { DefaultAppStyles } from "../../../../utils/styles";
import { Radius, Spacing } from "../../../../common/design/spacing";
export const Group = ({
item,
@@ -152,16 +151,19 @@ export const Group = ({
}
presentDialog({
context: "global",
positiveType: "error-shade-outline",
title: strings.deleteGroup(),
positiveText: strings.delete(),
paragraph: strings.deleteGroupDesc(),
positivePress: async () => {
if (groupIndex === undefined) return;
const _data = useDragState.getState().data.slice();
_data.splice(groupIndex, 1);
setData(_data);
ToastManager.show({
type: "success",
heading: strings.groupDeleted()
});
}
});
}

View File

@@ -31,7 +31,6 @@ import { SvgView } from "../../../../components/ui/svg";
import Heading from "../../../../components/ui/typography/heading";
import Paragraph from "../../../../components/ui/typography/paragraph";
import { presentSheet } from "../../../../services/event-manager";
import { DefaultAppStyles } from "../../../../utils/styles";
import { DraggableItem, useDragState } from "./state";
import {
findToolById,
@@ -210,12 +209,14 @@ function ToolSheet({
</ScrollView>
)}
<Button
title={strings.add()}
type="accent"
style={{ width: "100%" }}
onPress={onDone}
/>
{ungrouped.length === 0 ? null : (
<Button
title={strings.add()}
type="accent"
style={{ width: "100%" }}
onPress={onDone}
/>
)}
</View>
);
}

View File

@@ -104,23 +104,21 @@ export function SettingsPicker<T>({
fontSize={AppFontSize.sm}
fontFamily="REGULAR"
type={
compareValue(currentValue, item)
? "shade-plain"
: "plain-outline"
compareValue(currentValue, item) ? "selected" : "plain-outline"
}
onPress={() => {
onChange(item);
}}
textStyle={{
color: compareValue(currentValue, item)
? colors.primary.heading
? colors.selected.heading
: colors.primary.paragraph
}}
style={{
paddingVertical: Spacing.LEVEL_1,
paddingHorizontal: Spacing.LEVEL_1,
borderRadius: Radius.XS,
borderWidth: 1,
borderWidth: compareValue(currentValue, item) ? 0 : 1,
borderColor: compareValue(currentValue, item)
? "transparent"
: colors.primary.border

View File

@@ -39,7 +39,7 @@ import { strings } from "@notesnook/intl";
import { isFeatureAvailable } from "@notesnook/common";
import PaywallSheet from "../../../../components/sheets/paywall";
const DAY_FORMATS = ["short", "long"];
const DAY_FORMATS = ["long", "short"];
const DayFormatFormats = {
short: "ddd",
long: "dddd"
@@ -137,7 +137,7 @@ export const DayFormatPicker = createSettingsPicker({
});
},
formatValue: (item) => {
return `${strings.dayFormat()} (${dayjs().format(DayFormatFormats[item])})`;
return `${strings.dayFormat()} (${item === "long" ? "full" : "short"})`;
},
getItemKey: (item) => item,
options: DAY_FORMATS as DayFormat[],
@@ -178,7 +178,7 @@ export const TimeFormatPicker = createSettingsPicker({
});
},
formatValue: (item) => {
return `${strings[item]()} (${dayjs().format(TimeFormats[item])})`;
return `${strings[item]()}`;
},
getItemKey: (item) => item,
options: TIME_FORMATS as TimeFormat[],

View File

@@ -504,7 +504,7 @@ function ThemeSelector() {
style={{
borderRadius: Radius.XXL,
paddingHorizontal: 14,
paddingVertical: 10
paddingVertical: Spacing.LEVEL_1
}}
type={
colorScheme === "all" || !colorScheme
@@ -527,7 +527,7 @@ function ThemeSelector() {
style={{
borderRadius: Radius.XXL,
paddingHorizontal: 14,
paddingVertical: 10
paddingVertical: Spacing.LEVEL_1
}}
type={colorScheme === "dark" ? "selected" : "plain-outline"}
textStyle={{
@@ -546,7 +546,7 @@ function ThemeSelector() {
style={{
borderRadius: Radius.XXL,
paddingHorizontal: 14,
paddingVertical: 10
paddingVertical: Spacing.LEVEL_1
}}
fontSize={AppFontSize.sm}
type={colorScheme === "light" ? "selected" : "plain-outline"}
@@ -568,7 +568,7 @@ function ThemeSelector() {
style={{
borderRadius: Radius.XS,
paddingHorizontal: Spacing.LEVEL_2,
paddingVertical: Spacing.LEVEL_2,
paddingVertical: Spacing.LEVEL_1,
minWidth: 123
}}
type={"accent-outline"}

View File

@@ -151,6 +151,7 @@ export type PresentSheetOptions = {
action: () => void;
actionText: string;
iconColor?: string;
iconBackground?: string;
actionsArray: SheetAction[];
learnMore: string;
learnMorePress: () => void;

View File

@@ -108,6 +108,9 @@ const run = async (
false,
error ? SyncStatus.Failed : SyncStatus.Passed
);
useUserStore.setState({
lastSyncError: error ? error : undefined
});
onCompleted?.(error ? SyncStatus.Failed : SyncStatus.Passed);
if (pendingSync)
Sync.run(

View File

@@ -38,6 +38,7 @@ export interface UserStore {
premium: boolean;
lastSynced: string | number;
syncing: boolean;
lastSyncError: Error | undefined;
lastSyncStatus: SyncStatus;
setUser: (user: User | null | undefined) => void;
setPremium: (premium: boolean) => void;
@@ -56,6 +57,7 @@ export const useUserStore = create<UserStore>((set) => ({
user: null,
premium: false,
lastSynced: "Never",
lastSyncError: undefined,
syncing: false,
appLocked: false,
setUser: (user) => set({ user: user }),

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,3 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.9373 1.48822C6.66181 1.48822 5.41496 1.86645 4.35442 2.57508C3.29388 3.2837 2.4673 4.2909 1.97919 5.46931C1.49108 6.64771 1.36336 7.94439 1.6122 9.19538C1.86104 10.4464 2.47525 11.5955 3.37716 12.4974C4.27907 13.3993 5.42817 14.0135 6.67916 14.2623C7.93015 14.5112 9.22683 14.3835 10.4052 13.8954C11.5836 13.4072 12.5908 12.5807 13.2995 11.5201C14.0081 10.4596 14.3863 9.21273 14.3863 7.93724C14.3845 6.22741 13.7045 4.58812 12.4955 3.37909C11.2864 2.17005 9.64713 1.49003 7.9373 1.48822ZM7.44122 4.96077C7.44122 4.8292 7.49349 4.70302 7.58652 4.60999C7.67955 4.51696 7.80573 4.46469 7.9373 4.46469C8.06887 4.46469 8.19505 4.51696 8.28808 4.60999C8.38112 4.70302 8.43338 4.8292 8.43338 4.96077V8.43332C8.43338 8.56489 8.38112 8.69106 8.28808 8.7841C8.19505 8.87713 8.06887 8.9294 7.9373 8.9294C7.80573 8.9294 7.67955 8.87713 7.58652 8.7841C7.49349 8.69106 7.44122 8.56489 7.44122 8.43332V4.96077ZM7.9373 11.4098C7.79013 11.4098 7.64626 11.3661 7.52389 11.2844C7.40152 11.2026 7.30615 11.0864 7.24983 10.9504C7.19351 10.8145 7.17877 10.6648 7.20748 10.5205C7.2362 10.3762 7.30707 10.2436 7.41113 10.1395C7.5152 10.0354 7.64779 9.96456 7.79213 9.93585C7.93648 9.90714 8.08609 9.92187 8.22206 9.9782C8.35803 10.0345 8.47425 10.1299 8.55601 10.2523C8.63778 10.3746 8.68142 10.5185 8.68142 10.6657C8.68142 10.863 8.60302 11.0523 8.46347 11.1918C8.32392 11.3314 8.13465 11.4098 7.9373 11.4098Z" fill="#F23E46"/>
</svg>

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

@@ -953,6 +953,14 @@ msgstr "Always ask"
msgid "Amount"
msgstr "Amount"
#: src/strings.ts:3064
msgid "An error occured"
msgstr "An error occured"
#: src/strings.ts:3066
msgid "An error occured during sync. please try again in a moment."
msgstr "An error occured during sync. please try again in a moment."
#: src/strings.ts:249
msgid "An error occurred while migrating your data. You can logout of your account and try to relogin. However this is not recommended as it may result in some data loss if your data was not synced."
msgstr "An error occurred while migrating your data. You can logout of your account and try to relogin. However this is not recommended as it may result in some data loss if your data was not synced."
@@ -3761,6 +3769,14 @@ msgstr "Group added successfully"
msgid "Group by"
msgstr "Group by"
#: src/strings.ts:3068
msgid "Group created"
msgstr "Group created"
#: src/strings.ts:3069
msgid "Group deleted"
msgstr "Group deleted"
#: src/strings.ts:785
msgid "Hash copied"
msgstr "Hash copied"
@@ -7448,10 +7464,6 @@ msgstr "Tap to deselect"
msgid "Tap to stop reordering"
msgstr "Tap to stop reordering"
#: src/strings.ts:1408
msgid "Tap to try again"
msgstr "Tap to try again"
#: src/strings.ts:290
msgid "Tap twice to confirm you have saved the recovery key."
msgstr "Tap twice to confirm you have saved the recovery key."
@@ -7809,6 +7821,7 @@ msgstr "Trusted partners who share our commitment to privacy, transparency, and
msgid "Try {plan} for free"
msgstr "Try {plan} for free"
#: src/strings.ts:1408
#: src/strings.ts:2996
msgid "Try again"
msgstr "Try again"
@@ -8550,6 +8563,10 @@ msgstr "You are logging into the beta version of Notesnook. Switching between be
msgid "You are not logged in"
msgstr "You are not logged in"
#: src/strings.ts:3067
msgid "You are offline"
msgstr "You are offline"
#: src/strings.ts:933
msgid "You are renaming color {color}"
msgstr "You are renaming color {color}"

View File

@@ -953,6 +953,14 @@ msgstr ""
msgid "Amount"
msgstr ""
#: src/strings.ts:3064
msgid "An error occured"
msgstr ""
#: src/strings.ts:3066
msgid "An error occured during sync. please try again in a moment."
msgstr ""
#: src/strings.ts:249
msgid "An error occurred while migrating your data. You can logout of your account and try to relogin. However this is not recommended as it may result in some data loss if your data was not synced."
msgstr ""
@@ -3743,6 +3751,14 @@ msgstr ""
msgid "Group by"
msgstr ""
#: src/strings.ts:3068
msgid "Group created"
msgstr ""
#: src/strings.ts:3069
msgid "Group deleted"
msgstr ""
#: src/strings.ts:785
msgid "Hash copied"
msgstr "<<<<<<< HEAD<<<<<<< HEAD<<<<<<< HEAD<<<<<<< HEAD"
@@ -7414,10 +7430,6 @@ msgstr ""
msgid "Tap to stop reordering"
msgstr ""
#: src/strings.ts:1408
msgid "Tap to try again"
msgstr ""
#: src/strings.ts:290
msgid "Tap twice to confirm you have saved the recovery key."
msgstr ""
@@ -7768,6 +7780,7 @@ msgstr ""
msgid "Try {plan} for free"
msgstr "<<<<<<< HEAD<<<<<<< HEAD<<<<<<< HEAD<<<<<<< HEAD"
#: src/strings.ts:1408
#: src/strings.ts:2996
msgid "Try again"
msgstr ""
@@ -8500,6 +8513,10 @@ msgstr ""
msgid "You are not logged in"
msgstr ""
#: src/strings.ts:3067
msgid "You are offline"
msgstr ""
#: src/strings.ts:933
msgid "You are renaming color {color}"
msgstr ""

View File

@@ -1405,7 +1405,7 @@ $day$: Current day (eg. Monday)`,
biometricsAuthFailedDesc: () => t`Wait 30 seconds to try again`,
biometricsAuthCancelled: () => t`Authentication cancelled by user`,
biometricsAuthError: () => t`Authentication failed`,
tryAgain: () => t`Tap to try again`,
tryAgain: () => t`Try again`,
rateAppMessage: () => t`We would love to know what you think!`,
rateAppActionText: (platform: string) =>
platform === "ios"
@@ -3060,5 +3060,11 @@ Continue without attachments?`,
disableSync: () => t`Disable sync`,
disableSyncDesc: () =>
t`Turns off syncing completely on this device. Any changes made will remain local only and new changes from your other devices won't sync to this device.`,
noNotesToExport: () => t`No notes to export`
noNotesToExport: () => t`No notes to export`,
anErrorOccured: () => t`An error occured`,
anErrorOccuredDuringSync: () =>
t`An error occured during sync. please try again in a moment.`,
youAreOffline: () => t`You are offline`,
groupCreated: () => t`Group created`,
groupDeleted: () => t`Group deleted`
};