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
load default note on app load
ammarahm-edd88aa96c95a3
diff --git a/apps/mobile/App.js b/apps/mobile/App.jsindex ee7abeaa3..7a328e18e 100644--- a/apps/mobile/App.js+++ b/apps/mobile/App.js@@ -1,3 +1,4 @@+import http from 'notes-core/utils/http';import React, {useEffect} from 'react';import RNExitApp from 'react-native-exit-app';import Orientation from 'react-native-orientation';@@ -18,6 +19,7 @@ import {import SettingsService from './src/services/SettingsService';import {db} from './src/utils/DB';import {eDispatchAction, eOpenSideMenu} from './src/utils/Events';+import {MMKV} from './src/utils/mmkv';import EditorRoot from './src/views/Editor/EditorRoot';let initStatus = false;@@ -43,10 +45,18 @@ const App = () => {eSendEvent(eOpenSideMenu);SplashScreen.hide();await db.init();+ let requireIntro = await MMKV.getItem('introCompleted');+ if (!requireIntro) {+ console.log('loading default notes')+ await loadDefaultNotes();+ }};await SettingsService.init();- if (SettingsService.get().appLockMode && SettingsService.get().appLockMode !== 'none') {+ if (+ SettingsService.get().appLockMode &&+ SettingsService.get().appLockMode !== 'none'+ ) {let result = await BiometricService.validateUser('Unlock to access your notes','',@@ -87,6 +97,26 @@ const App = () => {}};+ async function loadDefaultNotes() {+ try {+ const notes = await http.get(+ 'https://app.notesnook.com/notes/index.json',+ );+ if (!notes) return;+ for (let note of notes) {+ const content = await http.get(note.mobileContent);+ await db.notes.add({+ title: note.title,+ headline: note.headline,+ localOnly: true,+ content: {type: 'tiny', data: content},+ });+ }+ } catch (e) {+ console.log(e);+ }+ }+return (<SafeAreaProvider><RootView />