mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-29 00:20:04 +01:00
mobile: enable encrypted backups on login
This commit is contained in:
committed by
Abdullah Atta
parent
4195150005
commit
53b545f84c
@@ -439,10 +439,13 @@ export const useAppEvents = () => {
|
||||
|
||||
clearMessage();
|
||||
subscribeToIAPListeners();
|
||||
|
||||
if (!login) {
|
||||
user = await db.user.fetchUser();
|
||||
setUser(user);
|
||||
} else {
|
||||
SettingsService.set({
|
||||
encryptedBackup: true
|
||||
});
|
||||
}
|
||||
|
||||
await PremiumService.setPremiumStatus();
|
||||
|
||||
@@ -23,9 +23,10 @@ import Menu, { MenuItem } from "react-native-reanimated-material-menu";
|
||||
import Icon from "react-native-vector-icons/MaterialCommunityIcons";
|
||||
import { PressableButton } from "../../../components/ui/pressable";
|
||||
import Paragraph from "../../../components/ui/typography/paragraph";
|
||||
import PremiumService from "../../../services/premium";
|
||||
import { useThemeStore } from "../../../stores/use-theme-store";
|
||||
import { SIZE } from "../../../utils/size";
|
||||
import PremiumService from "../../../services/premium";
|
||||
import { sleep } from "../../../utils/time";
|
||||
|
||||
interface PickerOptions<T> {
|
||||
getValue: () => T;
|
||||
@@ -55,11 +56,18 @@ export function SettingsPicker<T>({
|
||||
|
||||
const onChange = async (item: T) => {
|
||||
if (premium && onCheckOptionIsPremium?.(item)) {
|
||||
await PremiumService.verify(async () => {
|
||||
menuRef.current?.hide();
|
||||
await updateValue(item);
|
||||
setCurrentValue(item);
|
||||
});
|
||||
await PremiumService.verify(
|
||||
async () => {
|
||||
menuRef.current?.hide();
|
||||
await updateValue(item);
|
||||
setCurrentValue(item);
|
||||
},
|
||||
async () => {
|
||||
menuRef.current?.hide();
|
||||
await sleep(300);
|
||||
PremiumService.sheet();
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -126,5 +126,7 @@ export const BackupReminderPicker = createSettingsPicker({
|
||||
options: ["useroff", "daily", "weekly", "monthly"],
|
||||
compareValue: (current, item) => current === item,
|
||||
premium: true,
|
||||
onCheckOptionIsPremium: (item) => item !== "useroff"
|
||||
onCheckOptionIsPremium: (item) => {
|
||||
return item !== "useroff";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -119,7 +119,7 @@ export const defaultSettings: SettingStore["settings"] = {
|
||||
forcePortraitOnTablet: false,
|
||||
useSystemTheme: true,
|
||||
reminder: "off",
|
||||
encryptedBackup: true,
|
||||
encryptedBackup: false,
|
||||
homepage: "Notes",
|
||||
sort: "default",
|
||||
sortOrder: "desc",
|
||||
|
||||
Reference in New Issue
Block a user