From 2e3059e4ce919926450b48e7a0a5a3460d81fe0c Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Mon, 28 Feb 2022 13:48:59 +0500 Subject: [PATCH] refactor --- apps/mobile/.vscode/settings.json | 1 + apps/mobile/App.js | 14 +- apps/mobile/share/index.js | 4 +- apps/mobile/share/quick-note.js | 2 +- apps/mobile/share/store.js | 4 +- .../mobile/src/components/ActionIcon/index.js | 65 -- .../src/components/AddNotebookDialog/index.js | 24 +- .../src/components/AddTopicDialog/index.js | 18 +- .../components/Announcements/announcement.js | 2 +- .../src/components/Announcements/body.js | 2 +- .../src/components/Announcements/cta.js | 14 +- .../components/Announcements/description.js | 4 +- .../src/components/Announcements/index.js | 4 +- .../src/components/Announcements/list.js | 2 +- .../components/Announcements/subheading.js | 4 +- .../src/components/Announcements/title.js | 2 +- .../AttachmentDialog/attachmentitem.js | 186 ++++ .../src/components/AttachmentDialog/index.js | 194 +---- .../src/components/DialogManager/index.js | 83 -- .../src/components/ExportDialog/index.js | 20 +- .../src/components/ExportDialog/share.js | 4 +- apps/mobile/src/components/Github/issue.js | 16 +- .../src/components/JumpToDialog/index.js | 14 +- .../src/components/ListPlaceholders/index.js | 69 -- apps/mobile/src/components/Loading/index.js | 80 -- .../src/components/Menu/ColorSection.js | 14 +- apps/mobile/src/components/Menu/TimeSince.js | 22 - .../src/components/MergeEditor/index.js | 24 +- .../src/components/MoveNoteDialog/index.js | 26 +- .../components/MoveNoteDialog/movenote.tsx | 36 +- .../src/components/NoteHistory/index.js | 16 +- .../src/components/NoteHistory/preview.js | 12 +- apps/mobile/src/components/NoteItem/index.js | 20 +- .../src/components/Properties/useActions.js | 10 +- .../src/components/PublishNoteDialog/index.js | 26 +- .../mobile/src/components/RateDialog/index.js | 18 +- .../src/components/RecoveryKeyDialog/index.js | 38 +- .../src/components/RestoreDialog/index.js | 26 +- .../components/ResultDialog/ProFeatures.js | 8 +- .../src/components/ResultDialog/index.js | 14 +- apps/mobile/src/components/Shapes/index.js | 258 ------ .../mobile/src/components/SimpleList/empty.js | 14 +- .../src/components/SimpleList/header.js | 117 --- .../components/SimpleList/sectionheader.js | 18 +- .../mobile/src/components/TagsDialog/index.js | 16 +- .../src/components/VaultDialog/index.js | 30 +- .../components/{Auth => auth}/background.js | 0 .../{Auth => auth}/changepassword.js | 16 +- .../{Auth => auth}/forgotpassword.js | 20 +- .../src/components/{Auth => auth}/index.js | 8 +- .../src/components/{Auth => auth}/login.js | 32 +- .../{Auth => auth}/sessionexpired.js | 26 +- .../src/components/{Auth => auth}/signup.js | 34 +- .../containerheader.js} | 2 +- .../floatingbutton.js} | 6 +- .../{Container => container}/index.js | 2 +- .../{Dialog => dialog}/BaseDialog.js | 4 +- .../{Dialog => dialog}/DialogButtons.js | 6 +- .../{Dialog => dialog}/DialogContainer.js | 0 .../{Dialog => dialog}/DialogHeader.js | 8 +- .../{Dialog => dialog}/functions.ts | 2 +- .../components/{Dialog => dialog}/index.js | 126 ++- .../Recievers.js | 2 +- .../src/components/dialogprovider/index.js | 58 ++ .../components/{Header => header}/index.js | 12 +- .../HeaderLeftMenu.js => header/leftmenus.js} | 7 +- .../rightmenus.js} | 16 +- .../components/{Header => header}/title.js | 8 +- .../{ImagePreview => imagepreview}/index.js | 8 +- .../{SplashScreen => intro}/index.js | 36 +- .../{SplashScreen => intro}/welcome.js | 18 +- .../{AppLoader => launcher}/index.js | 40 +- .../components/{SimpleList => list}/card.js | 8 +- apps/mobile/src/components/list/empty.js | 130 +++ .../components/{SimpleList => list}/index.js | 16 +- .../footer.js => listitems/footer/index.js} | 0 .../components/listitems/headers/header.js | 39 + .../headers}/notebookheader.js | 12 +- .../listitems/headers/sectionheader.js | 145 ++++ .../src/components/listitems/note/index.js | 303 +++++++ .../{NoteItem => listitems/note}/wrapper.js | 22 +- .../notebook}/index.js | 28 +- .../notebook}/wrapper.js | 12 +- .../selectionwrapper}/actionstrip.js | 22 +- .../selectionwrapper}/backfill.js | 6 +- .../selectionwrapper}/index.js | 10 +- .../selectionwrapper}/selection.js | 8 +- .../{TagItem => listitems/tag}/index.js | 26 +- .../{Premium => premium}/compactfeatures.js | 0 .../{Premium => premium}/component.js | 34 +- .../{Premium => premium}/expiring.js | 18 +- .../{Premium => premium}/feature.js | 4 +- .../{Premium => premium}/features.js | 0 .../components/{Premium => premium}/group.js | 6 +- .../components/{Premium => premium}/index.js | 4 +- .../components/{Premium => premium}/offer.js | 4 +- .../{Premium => premium}/premiumtoast.js | 12 +- .../{Premium => premium}/pricingitem.js | 8 +- .../{Premium => premium}/pricingplans.js | 22 +- .../components/{Premium => premium}/protag.js | 2 +- .../{Properties => properties}/colortags.js | 9 +- .../{Properties => properties}/datemeta.js | 6 +- .../{Properties => properties}/devmode.js | 4 +- .../{Properties => properties}/index.js | 6 +- .../{Properties => properties}/items.js | 10 +- .../{Properties => properties}/notebooks.js | 10 +- .../{Properties => properties}/synced.js | 10 +- .../{Properties => properties}/tags.js | 8 +- .../{Properties => properties}/topics.js | 6 +- .../index.js | 27 +- .../{GeneralSheet => sheetprovider}/index.js | 18 +- .../src/components/sidemenu/colorsection.js | 158 ++++ .../components/{Menu => sidemenu}/index.js | 28 +- .../MenuListItem.js => sidemenu/menuitem.js} | 12 +- .../pinnedsection.js} | 20 +- .../UserSection.js => sidemenu/userstatus.js} | 12 +- .../src/components/{Sort => sort}/index.js | 12 +- .../components/{CustomTabs => tabs}/index.js | 4 +- .../src/components/{Tip => tip}/index.tsx | 19 +- .../src/components/{Toast => toast}/index.js | 12 +- .../{Button/index.js => ui/button/index.tsx} | 72 +- .../src/components/ui/iconbutton/index.tsx | 80 ++ .../{Input/index.js => ui/input/index.tsx} | 149 ++-- .../components/{Notice => ui/notice}/index.js | 10 +- .../index.js => ui/pressable/index.tsx} | 50 +- .../index.js => ui/seperator/index.tsx} | 0 .../components/{Sheet => ui/sheet}/index.js | 12 +- apps/mobile/src/components/ui/svg/index.tsx | 24 + .../src/components/ui/timesince/index.tsx | 28 + .../transitions}/bouncingview.js | 0 .../transitions}/movableview.js | 0 .../Heading.js => ui/typography/heading.js} | 4 +- .../typography/paragraph.js} | 4 +- .../components/{Update => update}/index.js | 16 +- .../{Walkthrough => walkthroughs}/index.tsx | 14 +- .../walkthroughs.tsx | 28 +- apps/mobile/src/navigation/NavigatorStack.js | 8 +- apps/mobile/src/navigation/RootView.js | 24 +- apps/mobile/src/provider/DefaultState.js | 2 +- apps/mobile/src/provider/stores.ts | 38 +- apps/mobile/src/services/Backup.js | 12 +- apps/mobile/src/services/BiometricService.js | 4 +- apps/mobile/src/services/EventManager.js | 2 +- apps/mobile/src/services/Exporter.js | 5 +- apps/mobile/src/services/Message.js | 6 +- apps/mobile/src/services/Navigation.js | 4 +- apps/mobile/src/services/Notifications.ts | 19 +- apps/mobile/src/services/PremiumService.js | 14 +- apps/mobile/src/services/SettingsService.js | 8 +- apps/mobile/src/services/Validation.js | 4 - apps/mobile/src/services/tipmanager.ts | 2 +- apps/mobile/src/utils/Animations.js | 101 --- apps/mobile/src/utils/Refs.js | 8 - apps/mobile/src/utils/Storage.js | 192 ----- apps/mobile/src/utils/ackee.js | 353 -------- .../utils/{umami.js => analytics/index.js} | 4 +- .../utils/{Colors.js => colorscheme/index.js} | 18 +- .../{ColorUtils.js => colorscheme/utils.js} | 40 +- apps/mobile/src/utils/constants.js | 196 +++++ apps/mobile/src/utils/{ => database}/MMKV.js | 0 apps/mobile/src/utils/database/Storage.js | 103 +++ apps/mobile/src/utils/database/encryption.js | 96 +++ .../utils/{database.js => database/index.js} | 10 +- apps/mobile/src/utils/differ.js | 811 ------------------ .../mobile/src/utils/{Events.js => events.js} | 0 apps/mobile/src/utils/filesystem.js | 327 ------- apps/mobile/src/utils/filesystem/download.js | 140 +++ apps/mobile/src/utils/filesystem/index.js | 15 + apps/mobile/src/utils/filesystem/io.js | 87 ++ apps/mobile/src/utils/filesystem/upload.js | 56 ++ apps/mobile/src/utils/filesystem/utils.js | 43 + apps/mobile/src/utils/functions.js | 4 +- apps/mobile/src/utils/globalrefs.ts | 9 + apps/mobile/src/utils/hooks/useActions.js | 680 +++++++++++++++ .../src/utils/{ => hooks}/useAppEvents.js | 44 +- .../hooks/useEditorTags.ts} | 25 +- .../src/utils/hooks/useIsFloatingKeyboard.ts | 27 + .../src/utils/{ => hooks}/useKeyboard.ts | 2 +- .../src/utils/{ => hooks}/useRotator.ts | 4 + .../src/utils/{ => hooks}/useTooltip.ts | 22 +- apps/mobile/src/utils/index.js | 304 +------ apps/mobile/src/utils/layoutmanager.js | 34 - .../utils/{filename.js => sanitizer/index.js} | 0 .../src/utils/{SizeUtils.js => size/index.js} | 2 +- .../src/utils/{ => sse}/EvenSourceIos.js | 2 + .../mobile/src/utils/{ => sse}/EventSource.js | 0 .../src/utils/{TimeUtils.js => time/index.ts} | 9 +- apps/mobile/src/utils/useAnnouncement.js | 80 -- .../mobile/src/utils/useIsFloatingKeyboard.js | 23 - apps/mobile/src/views/Editor/EditorHeader.js | 38 +- apps/mobile/src/views/Editor/EditorOverlay.js | 12 +- .../mobile/src/views/Editor/EditorSettings.js | 24 +- apps/mobile/src/views/Editor/EditorTitle.js | 4 +- apps/mobile/src/views/Editor/EditorWrapper.js | 6 +- apps/mobile/src/views/Editor/Functions.js | 18 +- .../src/views/Editor/HistoryComponent.js | 12 +- .../mobile/src/views/Editor/ProgressCircle.js | 2 +- .../src/views/Editor/TableCellProperties.js | 14 +- .../src/views/Editor/TableRowProperties.js | 6 +- apps/mobile/src/views/Editor/index.js | 8 +- .../views/Editor/tiny/toolbar/coloritem.js | 4 +- .../views/Editor/tiny/toolbar/constants.js | 2 +- .../src/views/Editor/tiny/toolbar/index.js | 6 +- .../src/views/Editor/tiny/toolbar/item.js | 12 +- .../src/views/Editor/tiny/toolbar/itempin.js | 2 +- .../views/Editor/tiny/toolbar/linkinput.js | 6 +- .../views/Editor/tiny/toolbar/linkpreview.js | 12 +- .../views/Editor/tiny/toolbar/listformat.js | 4 +- .../src/views/Editor/tiny/toolbar/picker.js | 8 +- .../Editor/tiny/toolbar/searchreplace.js | 9 +- .../src/views/Editor/tiny/toolbar/table.js | 10 +- .../src/views/Editor/tiny/toolbar/tooltip.js | 2 +- apps/mobile/src/views/Favorites/index.js | 17 +- apps/mobile/src/views/Folders/index.js | 23 +- apps/mobile/src/views/Home/index.js | 29 +- apps/mobile/src/views/Notebook/index.js | 22 +- apps/mobile/src/views/Notes/index.js | 22 +- apps/mobile/src/views/Search/index.js | 16 +- apps/mobile/src/views/Search/searchbar.js | 12 +- apps/mobile/src/views/Settings/appearance.js | 16 +- apps/mobile/src/views/Settings/applock.js | 16 +- .../src/views/Settings/backuprestore.js | 12 +- apps/mobile/src/views/Settings/button.js | 6 +- apps/mobile/src/views/Settings/functions.js | 4 +- apps/mobile/src/views/Settings/index.js | 19 +- apps/mobile/src/views/Settings/logout.js | 16 +- .../src/views/Settings/sectionheader.js | 6 +- apps/mobile/src/views/Settings/usersection.js | 18 +- apps/mobile/src/views/Tags/index.js | 17 +- apps/mobile/src/views/Trash/index.js | 27 +- 230 files changed, 3996 insertions(+), 4421 deletions(-) create mode 100644 apps/mobile/.vscode/settings.json delete mode 100644 apps/mobile/src/components/ActionIcon/index.js create mode 100644 apps/mobile/src/components/AttachmentDialog/attachmentitem.js delete mode 100644 apps/mobile/src/components/DialogManager/index.js delete mode 100644 apps/mobile/src/components/ListPlaceholders/index.js delete mode 100644 apps/mobile/src/components/Loading/index.js delete mode 100644 apps/mobile/src/components/Menu/TimeSince.js delete mode 100644 apps/mobile/src/components/Shapes/index.js delete mode 100644 apps/mobile/src/components/SimpleList/header.js rename apps/mobile/src/components/{Auth => auth}/background.js (100%) rename apps/mobile/src/components/{Auth => auth}/changepassword.js (91%) rename apps/mobile/src/components/{Auth => auth}/forgotpassword.js (91%) rename apps/mobile/src/components/{Auth => auth}/index.js (93%) rename apps/mobile/src/components/{Auth => auth}/login.js (90%) rename apps/mobile/src/components/{Auth => auth}/sessionexpired.js (91%) rename apps/mobile/src/components/{Auth => auth}/signup.js (91%) rename apps/mobile/src/components/{Container/ContainerTopSection.js => container/containerheader.js} (90%) rename apps/mobile/src/components/{Container/ContainerBottomButton.js => container/floatingbutton.js} (93%) rename apps/mobile/src/components/{Container => container}/index.js (90%) rename apps/mobile/src/components/{Dialog => dialog}/BaseDialog.js (94%) rename apps/mobile/src/components/{Dialog => dialog}/DialogButtons.js (94%) rename apps/mobile/src/components/{Dialog => dialog}/DialogContainer.js (100%) rename apps/mobile/src/components/{Dialog => dialog}/DialogHeader.js (91%) rename apps/mobile/src/components/{Dialog => dialog}/functions.ts (98%) rename apps/mobile/src/components/{Dialog => dialog}/index.js (52%) rename apps/mobile/src/components/{DialogManager => dialogprovider}/Recievers.js (97%) create mode 100644 apps/mobile/src/components/dialogprovider/index.js rename apps/mobile/src/components/{Header => header}/index.js (86%) rename apps/mobile/src/components/{Header/HeaderLeftMenu.js => header/leftmenus.js} (88%) rename apps/mobile/src/components/{Header/HeaderRightMenu.js => header/rightmenus.js} (86%) rename apps/mobile/src/components/{Header => header}/title.js (90%) rename apps/mobile/src/components/{ImagePreview => imagepreview}/index.js (92%) rename apps/mobile/src/components/{SplashScreen => intro}/index.js (96%) rename apps/mobile/src/components/{SplashScreen => intro}/welcome.js (96%) rename apps/mobile/src/components/{AppLoader => launcher}/index.js (91%) rename apps/mobile/src/components/{SimpleList => list}/card.js (92%) create mode 100644 apps/mobile/src/components/list/empty.js rename apps/mobile/src/components/{SimpleList => list}/index.js (92%) rename apps/mobile/src/components/{SimpleList/footer.js => listitems/footer/index.js} (100%) create mode 100644 apps/mobile/src/components/listitems/headers/header.js rename apps/mobile/src/components/{SimpleList => listitems/headers}/notebookheader.js (93%) create mode 100644 apps/mobile/src/components/listitems/headers/sectionheader.js create mode 100644 apps/mobile/src/components/listitems/note/index.js rename apps/mobile/src/components/{NoteItem => listitems/note}/wrapper.js (83%) rename apps/mobile/src/components/{NotebookItem => listitems/notebook}/index.js (88%) rename apps/mobile/src/components/{NotebookItem => listitems/notebook}/wrapper.js (83%) rename apps/mobile/src/components/{SelectionWrapper => listitems/selectionwrapper}/actionstrip.js (93%) rename apps/mobile/src/components/{SelectionWrapper => listitems/selectionwrapper}/backfill.js (80%) rename apps/mobile/src/components/{SelectionWrapper => listitems/selectionwrapper}/index.js (87%) rename apps/mobile/src/components/{SelectionWrapper => listitems/selectionwrapper}/selection.js (89%) rename apps/mobile/src/components/{TagItem => listitems/tag}/index.js (79%) rename apps/mobile/src/components/{Premium => premium}/compactfeatures.js (100%) rename apps/mobile/src/components/{Premium => premium}/component.js (89%) rename apps/mobile/src/components/{Premium => premium}/expiring.js (92%) rename apps/mobile/src/components/{Premium => premium}/feature.js (94%) rename apps/mobile/src/components/{Premium => premium}/features.js (100%) rename apps/mobile/src/components/{Premium => premium}/group.js (91%) rename apps/mobile/src/components/{Premium => premium}/index.js (95%) rename apps/mobile/src/components/{Premium => premium}/offer.js (85%) rename apps/mobile/src/components/{Premium => premium}/premiumtoast.js (93%) rename apps/mobile/src/components/{Premium => premium}/pricingitem.js (86%) rename apps/mobile/src/components/{Premium => premium}/pricingplans.js (97%) rename apps/mobile/src/components/{Premium => premium}/protag.js (94%) rename apps/mobile/src/components/{Properties => properties}/colortags.js (90%) rename apps/mobile/src/components/{Properties => properties}/datemeta.js (89%) rename apps/mobile/src/components/{Properties => properties}/devmode.js (94%) rename apps/mobile/src/components/{Properties => properties}/index.js (97%) rename apps/mobile/src/components/{Properties => properties}/items.js (93%) rename apps/mobile/src/components/{Properties => properties}/notebooks.js (95%) rename apps/mobile/src/components/{Properties => properties}/synced.js (89%) rename apps/mobile/src/components/{Properties => properties}/tags.js (91%) rename apps/mobile/src/components/{Properties => properties}/topics.js (90%) rename apps/mobile/src/components/{SelectionHeader => selectionheader}/index.js (93%) rename apps/mobile/src/components/{GeneralSheet => sheetprovider}/index.js (94%) create mode 100644 apps/mobile/src/components/sidemenu/colorsection.js rename apps/mobile/src/components/{Menu => sidemenu}/index.js (86%) rename apps/mobile/src/components/{Menu/MenuListItem.js => sidemenu/menuitem.js} (92%) rename apps/mobile/src/components/{Menu/TagsSection.js => sidemenu/pinnedsection.js} (94%) rename apps/mobile/src/components/{Menu/UserSection.js => sidemenu/userstatus.js} (91%) rename apps/mobile/src/components/{Sort => sort}/index.js (95%) rename apps/mobile/src/components/{CustomTabs => tabs}/index.js (99%) rename apps/mobile/src/components/{Tip => tip}/index.tsx (87%) rename apps/mobile/src/components/{Toast => toast}/index.js (96%) rename apps/mobile/src/components/{Button/index.js => ui/button/index.tsx} (62%) create mode 100644 apps/mobile/src/components/ui/iconbutton/index.tsx rename apps/mobile/src/components/{Input/index.js => ui/input/index.tsx} (69%) rename apps/mobile/src/components/{Notice => ui/notice}/index.js (80%) rename apps/mobile/src/components/{PressableButton/index.js => ui/pressable/index.tsx} (59%) rename apps/mobile/src/components/{Seperator/index.js => ui/seperator/index.tsx} (100%) rename apps/mobile/src/components/{Sheet => ui/sheet}/index.js (89%) create mode 100644 apps/mobile/src/components/ui/svg/index.tsx create mode 100644 apps/mobile/src/components/ui/timesince/index.tsx rename apps/mobile/src/components/{Transitions => ui/transitions}/bouncingview.js (100%) rename apps/mobile/src/components/{Transitions => ui/transitions}/movableview.js (100%) rename apps/mobile/src/components/{Typography/Heading.js => ui/typography/heading.js} (90%) rename apps/mobile/src/components/{Typography/Paragraph.js => ui/typography/paragraph.js} (89%) rename apps/mobile/src/components/{Update => update}/index.js (95%) rename apps/mobile/src/components/{Walkthrough => walkthroughs}/index.tsx (91%) rename apps/mobile/src/components/{Walkthrough => walkthroughs}/walkthroughs.tsx (92%) delete mode 100644 apps/mobile/src/utils/Animations.js delete mode 100644 apps/mobile/src/utils/Refs.js delete mode 100644 apps/mobile/src/utils/Storage.js delete mode 100644 apps/mobile/src/utils/ackee.js rename apps/mobile/src/utils/{umami.js => analytics/index.js} (97%) rename apps/mobile/src/utils/{Colors.js => colorscheme/index.js} (83%) rename apps/mobile/src/utils/{ColorUtils.js => colorscheme/utils.js} (80%) create mode 100644 apps/mobile/src/utils/constants.js rename apps/mobile/src/utils/{ => database}/MMKV.js (100%) create mode 100644 apps/mobile/src/utils/database/Storage.js create mode 100644 apps/mobile/src/utils/database/encryption.js rename apps/mobile/src/utils/{database.js => database/index.js} (88%) delete mode 100644 apps/mobile/src/utils/differ.js rename apps/mobile/src/utils/{Events.js => events.js} (100%) delete mode 100644 apps/mobile/src/utils/filesystem.js create mode 100644 apps/mobile/src/utils/filesystem/download.js create mode 100644 apps/mobile/src/utils/filesystem/index.js create mode 100644 apps/mobile/src/utils/filesystem/io.js create mode 100644 apps/mobile/src/utils/filesystem/upload.js create mode 100644 apps/mobile/src/utils/filesystem/utils.js create mode 100644 apps/mobile/src/utils/globalrefs.ts create mode 100644 apps/mobile/src/utils/hooks/useActions.js rename apps/mobile/src/utils/{ => hooks}/useAppEvents.js (93%) rename apps/mobile/src/{views/Editor/useEditorTags.js => utils/hooks/useEditorTags.ts} (73%) create mode 100644 apps/mobile/src/utils/hooks/useIsFloatingKeyboard.ts rename apps/mobile/src/utils/{ => hooks}/useKeyboard.ts (97%) rename apps/mobile/src/utils/{ => hooks}/useRotator.ts (81%) rename apps/mobile/src/utils/{ => hooks}/useTooltip.ts (82%) rename apps/mobile/src/utils/{filename.js => sanitizer/index.js} (100%) rename apps/mobile/src/utils/{SizeUtils.js => size/index.js} (98%) rename apps/mobile/src/utils/{ => sse}/EvenSourceIos.js (99%) rename apps/mobile/src/utils/{ => sse}/EventSource.js (100%) rename apps/mobile/src/utils/{TimeUtils.js => time/index.ts} (87%) delete mode 100644 apps/mobile/src/utils/useAnnouncement.js delete mode 100644 apps/mobile/src/utils/useIsFloatingKeyboard.js diff --git a/apps/mobile/.vscode/settings.json b/apps/mobile/.vscode/settings.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/apps/mobile/.vscode/settings.json @@ -0,0 +1 @@ +{} diff --git a/apps/mobile/App.js b/apps/mobile/App.js index de7fcb507..4263ed49e 100644 --- a/apps/mobile/App.js +++ b/apps/mobile/App.js @@ -1,7 +1,7 @@ import React, { useEffect } from 'react'; import Orientation from 'react-native-orientation'; import { SafeAreaProvider } from 'react-native-safe-area-context'; -import AppLoader from './src/components/AppLoader'; +import Launcher from './src/components/launcher'; import { RootView } from './src/navigation/RootView'; import { useTracked } from './src/provider'; import { initialize, useSettingStore, useUserStore } from './src/provider/stores'; @@ -10,11 +10,10 @@ import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from './src/services/E import Notifications from './src/services/Notifications'; import SettingsService from './src/services/SettingsService'; import { TipManager } from './src/services/tip-manager'; -import { Tracker } from './src/utils'; import { db } from './src/utils/database'; -import { eDispatchAction } from './src/utils/Events'; -import { MMKV } from './src/utils/mmkv'; -import { useAppEvents } from './src/utils/use-app-events'; +import { eDispatchAction } from './src/utils/events'; +import { useAppEvents } from './src/utils/hooks/use-app-events'; +import { MMKV } from './src/utils/database/mmkv'; let databaseHasLoaded = false; @@ -78,9 +77,6 @@ const App = () => { await TipManager.init(); await loadDatabase(); useUserStore.getState().setUser(await db.user.getUser()); - if (SettingsService.get().telemetry) { - Tracker.record('3c6890ce-8410-49d5-8831-15fb2eb28a21'); - } } catch (e) { } finally { databaseHasLoaded = true; @@ -103,7 +99,7 @@ const App = () => { return ( - + ); }; diff --git a/apps/mobile/share/index.js b/apps/mobile/share/index.js index 5826465d8..a7d86a336 100644 --- a/apps/mobile/share/index.js +++ b/apps/mobile/share/index.js @@ -28,8 +28,8 @@ import isURL from 'validator/lib/isURL'; import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from '../src/services/EventManager'; import { getElevation } from '../src/utils'; import { db } from '../src/utils/database'; -import Storage from '../src/utils/storage'; -import { sleep } from '../src/utils/TimeUtils'; +import Storage from '../src/utils/database/storage'; +import { sleep } from '../src/utils/time'; import { Search } from './search'; import { useShareStore } from './store'; diff --git a/apps/mobile/share/quick-note.js b/apps/mobile/share/quick-note.js index a2262215b..f47762ed2 100644 --- a/apps/mobile/share/quick-note.js +++ b/apps/mobile/share/quick-note.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import { Appearance, SafeAreaView } from 'react-native'; import RNBootSplash from 'react-native-bootsplash'; -import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/Colors'; +import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/color-scheme'; import NotesnookShare from './index'; export default class QuickNoteIOS extends Component { diff --git a/apps/mobile/share/store.js b/apps/mobile/share/store.js index 1c9d13499..3de7b6525 100644 --- a/apps/mobile/share/store.js +++ b/apps/mobile/share/store.js @@ -1,7 +1,7 @@ import { Appearance } from 'react-native'; import create from 'zustand'; -import { ACCENT, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT, setAccentColor } from '../src/utils/Colors'; -import { MMKV } from '../src/utils/mmkv'; +import { ACCENT, COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../src/utils/color-scheme'; +import { MMKV } from '../src/utils/database/mmkv'; export const useShareStore = create((set, get) => ({ colors: Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK : COLOR_SCHEME_LIGHT, diff --git a/apps/mobile/src/components/ActionIcon/index.js b/apps/mobile/src/components/ActionIcon/index.js deleted file mode 100644 index d429aa2eb..000000000 --- a/apps/mobile/src/components/ActionIcon/index.js +++ /dev/null @@ -1,65 +0,0 @@ -import React from 'react'; -import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; -import { useTracked } from '../../provider'; -import { PressableButton } from '../PressableButton'; -import { SIZE } from '../../utils/SizeUtils'; -import { hexToRGBA, RGB_Linear_Shade } from '../../utils/ColorUtils'; -import { showTooltip, TOOLTIP_POSITIONS } from '../../utils'; - -export const ActionIcon = ({ - onPress, - name, - color, - customStyle, - size = SIZE.xxl, - iconStyle = {}, - left = 10, - right = 10, - top = 30, - bottom = 10, - testID, - disabled, - onLongPress, - tooltipText, - type = 'gray', - fwdRef, - tooltipPosition = TOOLTIP_POSITIONS.TOP -}) => { - const [state, dispatch] = useTracked(); - const { colors } = state; - - return ( - { - if (onLongPress) { - onLongPress(); - return; - } - if (tooltipText) { - showTooltip(event, tooltipText, tooltipPosition); - } - }} - disabled={disabled} - type={type} - customStyle={{ - width: 40, - height: 40, - justifyContent: 'center', - alignItems: 'center', - borderRadius: 100, - ...customStyle - }} - > - - - ); -}; diff --git a/apps/mobile/src/components/AddNotebookDialog/index.js b/apps/mobile/src/components/AddNotebookDialog/index.js index 84aa49b63..d80146c73 100644 --- a/apps/mobile/src/components/AddNotebookDialog/index.js +++ b/apps/mobile/src/components/AddNotebookDialog/index.js @@ -7,17 +7,17 @@ import { DDS } from '../../services/DeviceDetection'; import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager'; import Navigation from '../../services/Navigation'; import { db } from '../../utils/database'; -import { eCloseAddNotebookDialog, eOpenAddNotebookDialog } from '../../utils/Events'; -import { ph, pv, SIZE } from '../../utils/SizeUtils'; -import { sleep } from '../../utils/TimeUtils'; -import { ActionIcon } from '../ActionIcon'; -import { Button } from '../Button'; -import DialogHeader from '../Dialog/dialog-header'; -import Input from '../Input'; +import { eCloseAddNotebookDialog, eOpenAddNotebookDialog } from '../../utils/events'; +import { ph, pv, SIZE } from '../../utils/size'; +import { sleep } from '../../utils/time'; +import { IconButton } from '../ui/icon-button'; +import { Button } from '../ui/button'; +import DialogHeader from '../dialog/dialog-header'; +import Input from '../ui/input'; import { MoveNotes } from '../MoveNoteDialog/movenote'; -import Seperator from '../Seperator'; -import SheetWrapper from '../Sheet'; -import { Toast } from '../Toast'; +import Seperator from '../ui/seperator'; +import SheetWrapper from '../ui/sheet'; +import { Toast } from '../toast'; let refs = []; @@ -477,7 +477,7 @@ const TopicItem = ({ item, index, colors, onPress, onDelete }) => { justifyContent: 'flex-end' }} > - { onPress(item, index); }} @@ -485,7 +485,7 @@ const TopicItem = ({ item, index, colors, onPress, onDelete }) => { size={SIZE.lg - 5} color={colors.icon} /> - { onDelete(index); }} diff --git a/apps/mobile/src/components/AddTopicDialog/index.js b/apps/mobile/src/components/AddTopicDialog/index.js index bedfe4777..6e7662903 100644 --- a/apps/mobile/src/components/AddTopicDialog/index.js +++ b/apps/mobile/src/components/AddTopicDialog/index.js @@ -5,15 +5,15 @@ import { useMenuStore } from '../../provider/stores'; import { eSubscribeEvent, eUnSubscribeEvent, ToastEvent } from '../../services/EventManager'; import Navigation from '../../services/Navigation'; import { db } from '../../utils/database'; -import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../utils/Events'; -import { sleep } from '../../utils/TimeUtils'; -import BaseDialog from '../Dialog/base-dialog'; -import DialogButtons from '../Dialog/dialog-buttons'; -import DialogContainer from '../Dialog/dialog-container'; -import DialogHeader from '../Dialog/dialog-header'; -import Input from '../Input'; -import Seperator from '../Seperator'; -import { Toast } from '../Toast'; +import { eCloseAddTopicDialog, eOpenAddTopicDialog } from '../../utils/events'; +import { sleep } from '../../utils/time'; +import BaseDialog from '../dialog/base-dialog'; +import DialogButtons from '../dialog/dialog-buttons'; +import DialogContainer from '../dialog/dialog-container'; +import DialogHeader from '../dialog/dialog-header'; +import Input from '../ui/input'; +import Seperator from '../ui/seperator'; +import { Toast } from '../toast'; export class AddTopicDialog extends React.Component { constructor(props) { diff --git a/apps/mobile/src/components/Announcements/announcement.js b/apps/mobile/src/components/Announcements/announcement.js index 9850de779..29a2c408e 100644 --- a/apps/mobile/src/components/Announcements/announcement.js +++ b/apps/mobile/src/components/Announcements/announcement.js @@ -2,7 +2,7 @@ import React from 'react'; import { FlatList, View } from 'react-native'; import { useTracked } from '../../provider'; import { useMessageStore, useSelectionStore } from '../../provider/stores'; -import { Button } from '../Button'; +import { Button } from '../ui/button'; import { allowedOnPlatform, renderItem } from './functions'; export const Announcement = ({ color }) => { diff --git a/apps/mobile/src/components/Announcements/body.js b/apps/mobile/src/components/Announcements/body.js index 1941527b8..ea2a4b1e0 100644 --- a/apps/mobile/src/components/Announcements/body.js +++ b/apps/mobile/src/components/Announcements/body.js @@ -1,6 +1,6 @@ import React from 'react'; import { useTracked } from '../../provider'; -import Paragraph from '../Typography/Paragraph'; +import Paragraph from '../ui/typography/paragraph'; import { getStyle } from './functions'; export const Body = ({ text, style = {} }) => { diff --git a/apps/mobile/src/components/Announcements/cta.js b/apps/mobile/src/components/Announcements/cta.js index 3e7dfa0fa..049155c65 100644 --- a/apps/mobile/src/components/Announcements/cta.js +++ b/apps/mobile/src/components/Announcements/cta.js @@ -2,14 +2,14 @@ import React from 'react'; import { View } from 'react-native'; import { useTracked } from '../../provider'; import { eSendEvent, presentSheet } from '../../services/EventManager'; -import { eCloseAnnouncementDialog } from '../../utils/Events'; +import { eCloseAnnouncementDialog } from '../../utils/events'; import { openLinkInBrowser } from '../../utils/functions'; -import { SIZE } from '../../utils/SizeUtils'; -import { sleep } from '../../utils/TimeUtils'; +import { SIZE } from '../../utils/size'; +import { sleep } from '../../utils/time'; import SettingsBackupAndRestore from '../../views/Settings/backup-restore'; -import { Button } from '../Button'; -import GeneralSheet from '../GeneralSheet'; -import { PricingPlans } from '../Premium/pricing-plans'; +import { Button } from '../ui/button'; +import SheetProvider from '../sheet-provider'; +import { PricingPlans } from '../premium/pricing-plans'; import { allowedOnPlatform, getStyle } from './functions'; export const Cta = ({ actions, style = {}, color, inline }) => { @@ -53,7 +53,7 @@ export const Cta = ({ actions, style = {}, color, inline }) => { ...getStyle(style) }} > - + {buttons.length > 0 && buttons.slice(0, 1).map(item => (