A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix dialogs
ammarahm-edbd913bc1f497
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex 229110bc0..0039bb521 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -21,11 +21,13 @@ import {db} from './src/utils/DB';import {eDispatchAction, eOnLoadNote, eStartSyncer} from './src/utils/Events';import {MMKV} from './src/utils/mmkv';import {tabBarRef} from './src/utils/Refs';+import { sleep } from './src/utils/TimeUtils';import {getNote, setIntentNote} from './src/views/Editor/Functions';let AppRootView = require('./initializer.intent').IntentView;let SettingsService = null;let Sentry = null;+let appInit = false;const onAppStateChanged = async (state) => {console.log('app state', state);@@ -41,16 +43,18 @@ const onAppStateChanged = async (state) => {if (SettingsService.get().privacyScreen) {enabled(false);}- MMKV.removeItem('appState');+ console.log('clearing state', await MMKV.getItem('appState'));+ if (appInit) {+ await MMKV.removeItem('appState');+ }} else {if (editing.currentlyEditing) {- MMKV.setItem(- 'appState',- JSON.stringify({- editing: editing.currentlyEditing,- note: getNote(),- }),- );+ let state = JSON.stringify({+ editing: editing.currentlyEditing,+ note: getNote(),+ });+ console.log('putting items in state', state);+ await MMKV.setItem('appState', state);}if (SettingsService.get().privacyScreen) {@@ -123,6 +127,7 @@ const App = () => {AppRootView = require('./initializer.root').RootView;setInit(true);backupData().then((r) => r);+ sleep(300).then(() => (appInit = true));Sentry = require('@sentry/react-native');Sentry.init({dsn:diff --git a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/OnClearFromRecentService.java b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/OnClearFromRecentService.javaindex cb3c36ac5..f51ad3584 100644--- a/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/OnClearFromRecentService.java+++ b/apps/mobile/android/app/src/main/java/com/streetwriters/notesnook/OnClearFromRecentService.java@@ -1,11 +1,9 @@package com.streetwriters.notesnook;-- import android.app.Service;- import android.content.Intent;- import android.os.IBinder;- import android.util.Log;-- import com.tencent.mmkv.MMKV;+import android.app.Service;+import android.content.Intent;+import android.os.IBinder;+import android.util.Log;+import com.tencent.mmkv.MMKV;public class OnClearFromRecentService extends Service {diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.jsindex 051f78c00..634c86757 100644--- a/apps/mobile/src/components/AddNotebookDialog/index.js+++ b/apps/mobile/src/components/AddNotebookDialog/index.js@@ -6,23 +6,21 @@ import {Platform,SafeAreaView,StyleSheet,- Text,TouchableOpacity,View,} from 'react-native';import {FlatList, TextInput} from 'react-native-gesture-handler';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {Actions} from '../../provider/Actions';-import {Button} from '../Button';-import {updateEvent} from '../DialogManager/recievers';-import {Toast} from '../Toast';+import {DDS} from '../../services/DeviceDetection';import {ToastEvent} from '../../services/EventManager';-import {ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';import {db} from '../../utils/DB';-import {DDS} from '../../services/DeviceDetection';+import {ph, pv, SIZE, WEIGHT} from '../../utils/SizeUtils';import {ActionIcon} from '../ActionIcon';import DialogButtons from '../Dialog/dialog-buttons';import DialogHeader from '../Dialog/dialog-header';+import {updateEvent} from '../DialogManager/recievers';+import {Toast} from '../Toast';import Paragraph from '../Typography/Paragraph';let refs = [];@@ -104,7 +102,7 @@ export class AddNotebookDialog extends React.Component {let edit = this.props.toEdit;if (edit && edit.id) {let topicToDelete = edit.topics[index + 1];-+if (topicToDelete) {this.topicsToDelete.push(topicToDelete.id);}@@ -279,7 +277,7 @@ export class AddNotebookDialog extends React.Component {paragraph={toEdit && toEdit.dateCreated? 'Edit your notebook'- : 'Add a new notebook to your notebooks.'+ : 'Add a new notebook'}/>@@ -417,7 +415,6 @@ export class AddNotebookDialog extends React.Component {<TopicItemitem={item}onPress={(item, index) => {-this.prevIndex = index;this.prevItem = item;this.topicInputRef.setNativeProps({@@ -533,9 +530,9 @@ const styles = StyleSheet.create({alignItems: 'center',},container: {- width: DDS.isTab ? 500 : '80%',- height: DDS.isTab ? 600 : null,- maxHeight: DDS.isTab ? 600 :"90%",+ width: DDS.isTab ? 500 : '100%',+ height: DDS.isTab ? 600 : '100%',+ maxHeight: DDS.isTab ? 600 : '100%',borderRadius: 5,paddingHorizontal: 12,paddingVertical: pv,diff --git a/apps/mobile/src/components/Button/index.js b/apps/mobile/src/components/Button/index.jsindex 5079d39e2..1b1c0a5ad 100644--- a/apps/mobile/src/components/Button/index.js+++ b/apps/mobile/src/components/Button/index.js@@ -18,6 +18,11 @@ const BUTTON_TYPES = {text: 'icon',selected: 'nav',},+ grayBg: {+ primary: 'nav',+ text: 'icon',+ selected: 'nav',+ },accent: {primary: 'accent',text: 'light',@@ -87,7 +92,9 @@ export const Button = ({<Headingcolor={colors[BUTTON_TYPES[type].text]}size={fontSize}- style={styles.buttonText}>+ style={{+ marginLeft: icon || loading ? 5 : 0,+ }}>{title}</Heading>)}@@ -104,7 +111,4 @@ const styles = StyleSheet.create({alignItems: 'center',justifyContent: 'center',},- buttonText: {- marginLeft: 5,- },});diff --git a/apps/mobile/src/components/Dialog/DialogButtons.js b/apps/mobile/src/components/Dialog/DialogButtons.jsindex a2de38767..b0aabc4c9 100644--- a/apps/mobile/src/components/Dialog/DialogButtons.js+++ b/apps/mobile/src/components/Dialog/DialogButtons.js@@ -15,14 +15,17 @@ const DialogButtons = ({onPress={onPressNegative}fontSize={SIZE.md}type="gray"- width="30%"+ width="25%"title={negativeTitle}/>{onPressPositive && (<ButtononPress={onPressPositive}fontSize={SIZE.md}- width="30%"+ style={{+ marginLeft:10+ }}+ width="25%"type="transparent"title={positiveTitle}/>diff --git a/apps/mobile/src/components/Dialog/DialogHeader.js b/apps/mobile/src/components/Dialog/DialogHeader.jsindex d81a33884..2f32d3641 100644--- a/apps/mobile/src/components/Dialog/DialogHeader.js+++ b/apps/mobile/src/components/Dialog/DialogHeader.js@@ -1,12 +1,12 @@import React from 'react';-import {Text, View} from 'react-native';-import Icon from 'react-native-vector-icons/MaterialCommunityIcons';+import {View} from 'react-native';import {useTracked} from '../../provider';-import {SIZE, WEIGHT} from '../../utils/SizeUtils';+import {SIZE} from '../../utils/SizeUtils';+import {Button} from '../Button';import Heading from '../Typography/Heading';import Paragraph from '../Typography/Paragraph';-const DialogHeader = ({icon, title, paragraph}) => {+const DialogHeader = ({icon, title, paragraph, button}) => {const [state, dispatch] = useTracked();const colors = state.colors;@@ -16,16 +16,25 @@ const DialogHeader = ({icon, title, paragraph}) => {style={{flexDirection: 'row',alignItems: 'center',+ justifyContent: 'space-between',+ height: 50,}}>- {/* {icon ? (- <Icon name={icon} color={colors.accent} size={SIZE.lg} />- ) : null} */}- <Heading size={SIZE.xl}>{title}</Heading>- </View>+ <View>+ <Heading size={SIZE.xl}>{title}</Heading>+ {paragraph ? (+ <Paragraph color={colors.icon}>{paragraph}</Paragraph>+ ) : null}+ </View>- {paragraph ? (- <Paragraph color={colors.icon}>{paragraph}</Paragraph>- ) : null}+ {button && (+ <Button+ onPress={button.onPress}+ title={button.title}+ type="grayBg"+ fontSize={SIZE.md}+ />+ )}+ </View></>);};diff --git a/apps/mobile/src/components/MoveNoteDialog/index.js b/apps/mobile/src/components/MoveNoteDialog/index.jsindex ac334ab4e..948480a1a 100644--- a/apps/mobile/src/components/MoveNoteDialog/index.js+++ b/apps/mobile/src/components/MoveNoteDialog/index.js@@ -1,5 +1,13 @@import React, {createRef, useEffect, useState} from 'react';-import {FlatList, Modal, TextInput, TouchableOpacity, View} from 'react-native';+import {+ FlatList,+ KeyboardAvoidingView,+ Modal,+ SafeAreaView,+ TextInput,+ TouchableOpacity,+ View,+} from 'react-native';import {useSafeAreaInsets} from 'react-native-safe-area-context';import Icon from 'react-native-vector-icons/MaterialCommunityIcons';import {useTracked} from '../../provider';@@ -14,6 +22,8 @@ import {getElevation} from '../../utils';import {db} from '../../utils/DB';import {eOpenMoveNoteDialog} from '../../utils/Events';import {pv, SIZE, WEIGHT} from '../../utils/SizeUtils';+import DialogButtons from '../Dialog/dialog-buttons';+import DialogHeader from '../Dialog/dialog-header';import {PressableButton} from '../PressableButton';import {Toast} from '../Toast';import Heading from '../Typography/Heading';@@ -31,7 +41,6 @@ const MoveNoteDialog = () => {const [expanded, setExpanded] = useState('');const [notebookInputFocused, setNotebookInputFocused] = useState(false);const [topicInputFocused, setTopicInputFocused] = useState(false);- const insets = useSafeAreaInsets();function open() {setVisible(true);@@ -87,312 +96,310 @@ const MoveNoteDialog = () => {animationType="slide"onRequestClose={close}visible={true}- statusBarTranslucent={true}transparent={true}>- <View+ <SafeAreaViewstyle={{- flex: 1,- paddingTop: insets.top,- backgroundColor: DDS.isTab ? 'rgba(0,0,0,0.3)' : colors.bg,- width: '100%',height: '100%',- alignSelf: 'center',- justifyContent: 'center',- alignItems: 'center',+ width: '100%',}}>- <TouchableOpacity- onPress={close}+ <KeyboardAvoidingView+ behavior={Platform.OS === 'ios' ? 'padding' : null}style={{+ flex: 1,+ backgroundColor: DDS.isTab ? 'rgba(0,0,0,0.3)' : colors.bg,width: '100%',height: '100%',- position: 'absolute',- zIndex: 1,- }}- />-- <View- style={{- ...getElevation(DDS.isTab ? 10 : 0),- width: DDS.isTab ? 500 : '100%',- height: DDS.isTab ? 500 : '100%',- flex: 1,- borderRadius: DDS.isTab ? 5 : 0,- backgroundColor: colors.bg,- padding: DDS.isTab ? 8 : 0,- zIndex: 10,+ alignSelf: 'center',+ justifyContent: 'center',+ alignItems: 'center',}}>+ <TouchableOpacity+ onPress={close}+ style={{+ width: '100%',+ height: '100%',+ position: 'absolute',+ zIndex: 1,+ }}+ />+<Viewstyle={{- flexDirection: 'row',- justifyContent: 'center',- alignItems: 'center',- height: 50,+ ...getElevation(DDS.isTab ? 10 : 0),+ width: DDS.isTab ? 500 : '100%',+ height: DDS.isTab ? 500 : '100%',+ flex: 1,+ borderRadius: DDS.isTab ? 5 : 0,+ backgroundColor: colors.bg,+ padding: DDS.isTab ? 8 : 0,+ zIndex: 10,+ paddingVertical: 12,}}>- <Icon- name="close"- size={SIZE.xxl}- onPress={close}+ <Viewstyle={{- width: 50,- height: 50,- marginLeft: 12,- position: 'absolute',- textAlignVertical: 'center',- left: 0,- marginBottom: 15,- }}- color={colors.heading}- />- <Heading color={colors.accent}>- {selectedItemsList.length > 1- ? 'Add notes to notebook'- : 'Add note to notebook'}- </Heading>- </View>+ paddingHorizontal: 12,+ }}>+ <DialogHeader+ title="Add to notebook"+ paragraph={`Organize your notes to find them easily.`}+ />+ </View>- <FlatList- data={state.notebooks}- ListHeaderComponent={- <View- style={{- paddingHorizontal: 12,- }}>+ <FlatList+ data={state.notebooks}+ keyboardShouldPersistTaps="always"+ keyboardDismissMode="none"+ ListHeaderComponent={<Viewstyle={{- flexDirection: 'row',- justifyContent: 'space-between',- alignItems: 'center',- paddingHorizontal: 0,- marginBottom: 10,- width: '100%',- borderBottomWidth: 1,- borderColor: notebookInputFocused- ? colors.accent- : colors.nav,- }}>- <TextInput- ref={notebookInput}- onChangeText={(value) => {- newNotebookTitle = value;- }}- blurOnSubmit={false}- onFocus={() => {- setNotebookInputFocused(true);- }}- onBlur={() => {- setNotebookInputFocused(false);- }}- onSubmitEditing={addNewNotebook}- style={[- {- color: colors.pri,- width: '85%',- maxWidth: '85%',- paddingHorizontal: 0,- borderRadius: 5,- minHeight: 45,- fontSize: SIZE.md,- fontFamily: WEIGHT.regular,- padding: pv - 2,- },- ]}- placeholder="Create a new notebook"- placeholderTextColor={colors.icon}- />- <TouchableOpacity- onPress={addNewNotebook}- style={[- {- borderRadius: 5,- width: '12%',- minHeight: 45,- justifyContent: 'center',- alignItems: 'center',- },- ]}>- <Icon- name="plus"- size={SIZE.lg}- color={notebookInputFocused ? colors.accent : colors.nav}- />- </TouchableOpacity>- </View>- </View>- }- renderItem={({item, index}) => (- <View>- <PressableButton- onPress={() => {- setExpanded(item.id === expanded ? null : item.id);- }}- color={expanded === item.id ? colors.shade : 'transparent'}- selectedColor={- expanded === item.id ? colors.accent : colors.nav- }- alpha={colors.night ? 0.02 : -0.02}- opacity={expanded === item.id ? 0.12 : 1}- customStyle={{- height: 50,- width: '100%',- borderRadius: 0,- alignItems: 'flex-start',paddingHorizontal: 12,- marginBottom: 5,}}><Viewstyle={{- borderBottomWidth: 1,+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ paddingHorizontal: 0,+ marginBottom: 10,width: '100%',- height: 50,- justifyContent: 'center',- borderBottomColor:- expanded === item.id ? 'transparent' : colors.nav,+ borderBottomWidth: 1,+ borderColor: notebookInputFocused+ ? colors.accent+ : colors.nav,}}>- <Heading size={SIZE.md}>- {item.title}- {'\n'}- <Paragraph size={SIZE.xs} color={colors.icon}>- {item.totalNotes +- ' notes' +- ' & ' +- item.topics.length +- ' topics'}- </Paragraph>- </Heading>+ <TextInput+ ref={notebookInput}+ onChangeText={(value) => {+ newNotebookTitle = value;+ }}+ blurOnSubmit={false}+ onFocus={() => {+ setNotebookInputFocused(true);+ }}+ onBlur={() => {+ setNotebookInputFocused(false);+ }}+ onSubmitEditing={addNewNotebook}+ style={[+ {+ color: colors.pri,+ width: '85%',+ maxWidth: '85%',+ paddingHorizontal: 0,+ borderRadius: 5,+ minHeight: 45,+ fontSize: SIZE.md,+ fontFamily: WEIGHT.regular,+ padding: pv - 2,+ },+ ]}+ placeholder="Add a notebook"+ placeholderTextColor={colors.icon}+ />+ <TouchableOpacity+ onPress={addNewNotebook}+ style={[+ {+ borderRadius: 5,+ width: '12%',+ minHeight: 45,+ justifyContent: 'center',+ alignItems: 'center',+ },+ ]}>+ <Icon+ name="plus"+ size={SIZE.lg}+ color={+ notebookInputFocused ? colors.accent : colors.icon+ }+ />+ </TouchableOpacity></View>- </PressableButton>+ </View>+ }+ renderItem={({item, index}) => (+ <View>+ <PressableButton+ onPress={() => {+ setExpanded(item.id === expanded ? null : item.id);+ }}+ color={expanded === item.id ? colors.shade : 'transparent'}+ selectedColor={+ expanded === item.id ? colors.accent : colors.nav+ }+ alpha={colors.night ? 0.02 : -0.02}+ opacity={expanded === item.id ? 0.12 : 1}+ customStyle={{+ height: 50,+ width: '100%',+ borderRadius: 0,+ alignItems: 'flex-start',+ paddingHorizontal: 12,+ marginBottom: 5,+ }}>+ <View+ style={{+ borderBottomWidth: 1,+ width: '100%',+ height: 50,+ justifyContent: 'center',+ borderBottomColor:+ expanded === item.id ? 'transparent' : colors.nav,+ }}>+ <Heading size={SIZE.md}>+ {item.title}+ {'\n'}+ <Paragraph size={SIZE.xs} color={colors.icon}>+ {item.totalNotes ++ ' notes' ++ ' & ' ++ item.topics.length ++ ' topics'}+ </Paragraph>+ </Heading>+ </View>+ </PressableButton>- {expanded === item.id ? (- <FlatList- data={item.topics}- ListHeaderComponent={- <View- style={{- paddingRight: 12,- }}>+ {expanded === item.id ? (+ <FlatList+ data={item.topics}+ keyboardShouldPersistTaps="always"+ keyboardDismissMode="none"+ ListHeaderComponent={<Viewstyle={{- flexDirection: 'row',- justifyContent: 'space-between',- alignItems: 'center',- width: '90%',- alignSelf: 'flex-end',- marginBottom: 5,- marginTop: 5,- borderBottomWidth: 1,- borderColor: topicInputFocused- ? colors.accent- : colors.nav,+ paddingRight: 12,}}>- <TextInput- ref={topicInput}- onChangeText={(value) => {- newTopicTitle = value;- }}- blurOnSubmit={false}- onFocus={() => {- setTopicInputFocused(true);- }}- onBlur={() => {- setTopicInputFocused(false);- }}- onSubmitEditing={addNewTopic}- style={[- {- color: colors.pri,- width: '85%',- maxWidth: '85%',- paddingHorizontal: 0,- borderRadius: 5,- height: 40,- fontSize: SIZE.sm,- fontFamily: WEIGHT.regular,- padding: pv - 2,- },- ]}- placeholder="Create a new topic"- placeholderTextColor={colors.icon}- />- <TouchableOpacity- onPress={addNewTopic}- style={[- {- borderRadius: 5,- width: 40,- minHeight: 40,- justifyContent: 'center',- alignItems: 'center',- },- ]}>- <Icon- name="plus"- size={SIZE.lg}- color={- topicInputFocused ? colors.accent : colors.nav- }+ <View+ style={{+ flexDirection: 'row',+ justifyContent: 'space-between',+ alignItems: 'center',+ width: '90%',+ alignSelf: 'flex-end',+ marginBottom: 5,+ marginTop: 5,+ borderBottomWidth: 1,+ borderColor: topicInputFocused+ ? colors.accent+ : colors.nav,+ }}>+ <TextInput+ ref={topicInput}+ onChangeText={(value) => {+ newTopicTitle = value;+ }}+ blurOnSubmit={false}+ onFocus={() => {+ setTopicInputFocused(true);+ }}+ onBlur={() => {+ setTopicInputFocused(false);+ }}+ onSubmitEditing={addNewTopic}+ style={[+ {+ color: colors.pri,+ width: '85%',+ maxWidth: '85%',+ paddingHorizontal: 0,+ borderRadius: 5,+ height: 40,+ fontSize: SIZE.sm,+ fontFamily: WEIGHT.regular,+ padding: pv - 2,+ },+ ]}+ placeholder="Add a Topic"+ placeholderTextColor={colors.icon}/>- </TouchableOpacity>+ <TouchableOpacity+ onPress={addNewTopic}+ style={[+ {+ borderRadius: 5,+ width: 40,+ minHeight: 40,+ justifyContent: 'center',+ alignItems: 'center',+ },+ ]}>+ <Icon+ name="plus"+ size={SIZE.lg}+ color={+ topicInputFocused+ ? colors.accent+ : colors.icon+ }+ />+ </TouchableOpacity>+ </View></View>- </View>- }- renderItem={({item, index}) => (- <PressableButton- onPress={async () => {- let noteIds = [];- selectedItemsList.forEach((i) => noteIds.push(i.id));+ }+ renderItem={({item, index}) => (+ <PressableButton+ onPress={async () => {+ let noteIds = [];+ selectedItemsList.forEach((i) =>+ noteIds.push(i.id),+ );- let res = await db.notes.move(- {- topic: item.title,- id: item.notebookId,- },- ...noteIds,- );- dispatch({type: Actions.CLEAR_SELECTION});- dispatch({type: Actions.NOTEBOOKS});- dispatch({type: Actions.PINNED});- close();- let notebookName = db.notebooks.notebook(- item.notebookId,- ).title;- ToastEvent.show(- `Note moved to ${item.title} in ${notebookName}`,- 'success',- );- }}- color="transparent"- selectedColor={colors.nav}- alpha={colors.night ? 0.02 : -0.02}- customStyle={{- height: 50,- borderTopWidth: index === 0 ? 0 : 1,- borderTopColor: colors.nav,- width: '87%',- alignSelf: 'flex-end',- borderRadius: 0,- alignItems: 'center',- marginRight: 12,- flexDirection: 'row',- justifyContent: 'space-between',- }}>- <Paragraph color={colors.heading}>- {item.title}- {'\n'}- <Paragraph color={colors.icon} size={SIZE.xs}>- {item.totalNotes + ' notes'}+ let res = await db.notes.move(+ {+ topic: item.title,+ id: item.notebookId,+ },+ ...noteIds,+ );+ dispatch({type: Actions.CLEAR_SELECTION});+ dispatch({type: Actions.NOTEBOOKS});+ dispatch({type: Actions.PINNED});+ close();+ let notebookName = db.notebooks.notebook(+ item.notebookId,+ ).title;+ ToastEvent.show(+ `Note moved to ${item.title} in ${notebookName}`,+ 'success',+ );+ }}+ color="transparent"+ selectedColor={colors.nav}+ alpha={colors.night ? 0.02 : -0.02}+ customStyle={{+ height: 50,+ borderTopWidth: index === 0 ? 0 : 1,+ borderTopColor: colors.nav,+ width: '87%',+ alignSelf: 'flex-end',+ borderRadius: 0,+ alignItems: 'center',+ marginRight: 12,+ flexDirection: 'row',+ justifyContent: 'space-between',+ }}>+ <Paragraph color={colors.heading}>+ {item.title}+ {'\n'}+ <Paragraph color={colors.icon} size={SIZE.xs}>+ {item.totalNotes + ' notes'}+ </Paragraph></Paragraph>- </Paragraph>- <Paragraph color={colors.accent}>Move</Paragraph>- </PressableButton>- )}- />- ) : null}- </View>- )}- />- </View>- <Toast context="local" />- </View>+ </PressableButton>+ )}+ />+ ) : null}+ </View>+ )}+ />++ <DialogButtons negativeTitle="Cancel" onPressNegative={close} />+ </View>+ <Toast context="local" />+ </KeyboardAvoidingView>+ </SafeAreaView></Modal>);};diff --git a/apps/mobile/src/components/Premium/PremiumDialog.js b/apps/mobile/src/components/Premium/PremiumDialog.jsindex a8a612ad2..9758a1210 100644--- a/apps/mobile/src/components/Premium/PremiumDialog.js+++ b/apps/mobile/src/components/Premium/PremiumDialog.js@@ -185,7 +185,7 @@ class PremiumDialog extends React.Component {/><Heading- SIZE={SIZE.md}+ size={SIZE.md}style={{marginLeft: 10,maxWidth: '85%',diff --git a/apps/mobile/src/components/ProgressDialog/index.js b/apps/mobile/src/components/ProgressDialog/index.jsindex 88f762e63..403e0d050 100644--- a/apps/mobile/src/components/ProgressDialog/index.js+++ b/apps/mobile/src/components/ProgressDialog/index.js@@ -1,13 +1,13 @@-import React, {useEffect, useState} from 'react';-import {Text, View} from 'react-native';-import {useTracked} from '../../provider';-import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';-import {eOpenProgressDialog, eCloseProgressDialog} from '../../utils/Events';-import {getElevation} from '../../utils';+import React, { useEffect, useState } from 'react';+import { View } from 'react-native';+import { useTracked } from '../../provider';+import { DDS } from '../../services/DeviceDetection';+import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';+import { getElevation } from '../../utils';+import { eCloseProgressDialog, eOpenProgressDialog } from '../../utils/Events';+import { ph } from '../../utils/SizeUtils';import BaseDialog from '../Dialog/base-dialog';-import {Loading} from '../Loading';-import {ph, SIZE, WEIGHT} from '../../utils/SizeUtils';-import {DDS} from '../../services/DeviceDetection';+import { Loading } from '../Loading';import Paragraph from '../Typography/Paragraph';const ProgressDialog = () => {diff --git a/apps/mobile/src/components/RestoreDialog/index.js b/apps/mobile/src/components/RestoreDialog/index.jsindex af7ad5dbc..4103583da 100644--- a/apps/mobile/src/components/RestoreDialog/index.js+++ b/apps/mobile/src/components/RestoreDialog/index.js@@ -1,36 +1,35 @@-import React, { useEffect, useState } from 'react';-import { FlatList, Platform, View } from 'react-native';-import { useSafeAreaInsets } from 'react-native-safe-area-context';+import React, {useEffect, useState} from 'react';+import {FlatList, Platform, View} from 'react-native';+import {useSafeAreaInsets} from 'react-native-safe-area-context';import RNFetchBlob from 'rn-fetch-blob';-import { useTracked } from '../../provider';-import { Actions } from '../../provider/Actions';-import { DDS } from '../../services/DeviceDetection';+import {useTracked} from '../../provider';+import {Actions} from '../../provider/Actions';+import {DDS} from '../../services/DeviceDetection';import {eSubscribeEvent,eUnSubscribeEvent,- ToastEvent+ ToastEvent,} from '../../services/EventManager';-import { getElevation } from '../../utils';-import { db } from '../../utils/DB';-import { eCloseRestoreDialog, eOpenRestoreDialog } from '../../utils/Events';-import { ph, SIZE } from '../../utils/SizeUtils';+import {getElevation} from '../../utils';+import {db} from '../../utils/DB';+import {eCloseRestoreDialog, eOpenRestoreDialog} from '../../utils/Events';+import {SIZE} from '../../utils/SizeUtils';import storage from '../../utils/storage';-import { sleep } from '../../utils/TimeUtils';-import { Button } from '../Button';+import {sleep} from '../../utils/TimeUtils';+import {Button} from '../Button';import BaseDialog from '../Dialog/base-dialog';import DialogButtons from '../Dialog/dialog-buttons';import DialogHeader from '../Dialog/dialog-header';-import { Loading } from '../Loading';+import {Loading} from '../Loading';import Paragraph from '../Typography/Paragraph';const RestoreDialog = () => {const [state, dispatch] = useTracked();- const {colors, tags, premiumUser} = state;+ const {colors} = state;const [visible, setVisible] = useState(false);const [files, setFiles] = useState([]);const [restoring, setRestoring] = useState(false);const insets = useSafeAreaInsets();-useEffect(() => {eSubscribeEvent(eOpenRestoreDialog, open);eSubscribeEvent(eCloseRestoreDialog, close);@@ -70,7 +69,10 @@ const RestoreDialog = () => {if (Platform.OS === 'android') {let granted = await storage.requestPermission();if (!granted) {- ToastEvent.show('Storage permission required to check for backups.');+ ToastEvent.show(+ 'Storage permission required to check for backups.',+ 'error',+ );return;}}@@ -80,7 +82,7 @@ const RestoreDialog = () => {setFiles(files);};- return !visible? null : (+ return !visible ? null : (<BaseDialoganimation="slide"visible={true}@@ -89,9 +91,10 @@ const RestoreDialog = () => {<Viewstyle={{...getElevation(5),- width: DDS.isTab ? 500 : '80%',- height: DDS.isTab ? 500 : null,- maxHeight: '90%',+ paddingTop: insets.top + 10,+ width: DDS.isTab ? 500 : '100%',+ height: DDS.isTab ? 500 : '100%',+ maxHeight: DDS.isTab ? '90%' : '100%',borderRadius: 5,backgroundColor: colors.bg,padding: 12,@@ -104,8 +107,6 @@ const RestoreDialog = () => {maxHeight: 350,borderRadius: 5,backgroundColor: colors.bg,- paddingHorizontal: ph,- paddingVertical: 20,}}><Loading height={40} tagline="Resoring your data" /><Paragraph@@ -121,47 +122,55 @@ const RestoreDialog = () => {</BaseDialog><DialogHeader- title="Choose a Backup"- paragraph="All backups are stored in 'Phone Storage/Notesnook/backups'- folder."+ title="Your Backups"+ paragraph="All backups stored in 'Phone Storage/Notesnook/backups'"/>- <View+ <FlatList+ data={files}style={{- maxHeight: '85%',- }}>- <FlatList-- data={files}- keyExtractor={(item, index) => item.filename}- renderItem={({item, index}) => (- <View- style={{- minHeight: 50,- justifyContent: 'space-between',- alignItems: 'center',- width: '100%',- borderRadius: 0,- flexDirection: 'row',- borderBottomWidth: 0.5,- borderBottomColor: colors.nav,- }}>- <Paragraph size={SIZE.xs}>- {item.filename- .replace('notesnook_backup_', '')- .replace('.nnbackup', '')}- </Paragraph>+ flexGrow: 1,+ }}+ keyExtractor={(item, index) => item.filename}+ ListEmptyComponent={+ <View+ style={{+ height: '100%',+ width: '100%',+ justifyContent: 'center',+ alignItems: 'center',+ }}>+ <Paragraph color={colors.icon}>No backups found.</Paragraph>+ </View>+ }+ renderItem={({item, index}) => (+ <View+ style={{+ minHeight: 50,+ justifyContent: 'space-between',+ alignItems: 'center',+ width: '100%',+ borderRadius: 0,+ flexDirection: 'row',+ borderBottomWidth: 0.5,+ borderBottomColor: colors.nav,+ }}>+ <Paragraph size={SIZE.sm}>+ {item.filename+ .replace('notesnook_backup_', '')+ .replace('.nnbackup', '')}+ </Paragraph>++ <Button+ title="Restore"+ width={80}+ height={30}+ onPress={() => restore(item, index)}+ />+ </View>+ )}+ />- <Button- title="Restore"- width={80}- height={30}- onPress={() => restore(item, index)}- />- </View>- )}- />- </View><DialogButtons onPressNegative={close} /></View></BaseDialog>diff --git a/apps/mobile/src/services/Backup.js b/apps/mobile/src/services/Backup.jsindex d7f48e529..e84fafdaa 100644--- a/apps/mobile/src/services/Backup.js+++ b/apps/mobile/src/services/Backup.js@@ -64,14 +64,14 @@ async function checkBackupRequired(type) {} else {return false;}- } else if (type === "weekly") {+ } else if (type === 'weekly') {if (lastBackupDate + MS_WEEK < now) {return true;} else {false;}} else {- console.log("Backups are disabled");+ console.log('Backups are disabled');}}diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.jsindex 1ef207266..3dd71b69f 100644--- a/apps/mobile/src/views/Editor/Functions.js+++ b/apps/mobile/src/views/Editor/Functions.js@@ -388,12 +388,15 @@ export async function onWebViewLoad(premium, colors, event) {}async function loadEditorState() {if (sideMenuRef.current !== null) {+if (intent) {+ console.log('clearing here');MMKV.removeItem('appState');return;}- console.log('checking for app state');+let appState = await MMKV.getItem('appState');+ console.log('checking for app state',appState);if (appState) {appState = JSON.parse(appState);if (appState.editing && appState.note.id !== null) {