From 08ffbfdcb911ddee0780d1c06babb175aeb66803 Mon Sep 17 00:00:00 2001 From: Radek Czemerys Date: Mon, 5 Oct 2020 16:27:37 +0200 Subject: [PATCH] refactor: better file naming --- index.js | 2 +- src/App.tsx | 6 ++--- src/AppStack.tsx | 8 +++---- src/ModalStack.tsx | 2 +- src/lib/{AlertService.ts => alert_service.ts} | 2 +- src/lib/application.ts | 22 +++++++++---------- ...plicationGroup.ts => application_group.ts} | 10 ++++----- ...plicationState.ts => application_state.ts} | 2 +- .../{BackupsService.ts => backups_service.ts} | 0 .../{componentGroup.ts => component_group.ts} | 0 ...mponentManager.ts => component_manager.ts} | 6 ++--- src/lib/{EditorGroup.ts => editor_group.ts} | 2 +- ...tionService.ts => installation_service.ts} | 0 ...gationService.ts => navigation_service.ts} | 0 ...encesManager.ts => preferences_manager.ts} | 0 ...NativeCrypto.ts => react_native_crypto.ts} | 0 .../{reviewService.ts => review_service.ts} | 0 .../{snjsHooks.ts => snjs_helper_hooks.ts} | 2 +- src/screens/Authenticate/Authenticate.tsx | 4 ++-- .../Authenticate/AuthenticatePrivileges.tsx | 4 ++-- src/screens/Compose/ComponentView.styled.ts | 2 +- src/screens/Compose/ComponentView.tsx | 2 +- src/screens/Compose/Compose.tsx | 6 ++--- src/screens/InputModal/PasscodeInputModal.tsx | 4 ++-- src/screens/InputModal/TagInputModal.tsx | 2 +- src/screens/NoteHistory/NoteHistory.tsx | 2 +- .../NoteHistory/NoteHistoryPreview.tsx | 2 +- src/screens/Notes/NoteCell.tsx | 2 +- src/screens/Notes/NoteList.tsx | 6 ++--- src/screens/Notes/Notes.tsx | 8 +++---- src/screens/Notes/OfflineBanner.tsx | 2 +- src/screens/Root.tsx | 6 ++--- src/screens/Settings/Sections/AuthSection.tsx | 2 +- .../Settings/Sections/CompanySection.tsx | 2 +- .../Settings/Sections/EncryptionSection.tsx | 2 +- .../Settings/Sections/OptionsSection.tsx | 4 ++-- .../Settings/Sections/PasscodeSection.tsx | 2 +- .../Settings/Sections/PreferencesSection.tsx | 2 +- src/screens/Settings/Settings.tsx | 2 +- src/screens/SideMenu/MainSideMenu.tsx | 4 ++-- src/screens/SideMenu/NoteSideMenu.tsx | 6 ++--- src/screens/SideMenu/SideMenuHero.tsx | 2 +- src/style/StyleKit.ts | 4 ++-- src/style/Util/getDefaultDrawerWidth.ts | 16 -------------- ...{AndroidTextFix.js => android_text_fix.js} | 0 .../{Util/CSSParser.ts => css_parser.ts} | 0 src/style/utils.ts | 18 ++++++++++++++- 47 files changed, 91 insertions(+), 91 deletions(-) rename src/lib/{AlertService.ts => alert_service.ts} (96%) rename src/lib/{applicationGroup.ts => application_group.ts} (81%) rename src/lib/{ApplicationState.ts => application_state.ts} (99%) rename src/lib/{BackupsService.ts => backups_service.ts} (100%) rename src/lib/{componentGroup.ts => component_group.ts} (100%) rename src/lib/{ComponentManager.ts => component_manager.ts} (88%) rename src/lib/{EditorGroup.ts => editor_group.ts} (97%) rename src/lib/{InstallationService.ts => installation_service.ts} (100%) rename src/lib/{NavigationService.ts => navigation_service.ts} (100%) rename src/lib/{PreferencesManager.ts => preferences_manager.ts} (100%) rename src/lib/{SNReactNativeCrypto.ts => react_native_crypto.ts} (100%) rename src/lib/{reviewService.ts => review_service.ts} (100%) rename src/lib/{snjsHooks.ts => snjs_helper_hooks.ts} (99%) delete mode 100644 src/style/Util/getDefaultDrawerWidth.ts rename src/style/{AndroidTextFix.js => android_text_fix.js} (100%) rename src/style/{Util/CSSParser.ts => css_parser.ts} (100%) diff --git a/index.js b/index.js index 74cadcd1..8fe28387 100644 --- a/index.js +++ b/index.js @@ -5,7 +5,7 @@ import { enableScreens } from 'react-native-screens'; import { AppRegistry, YellowBox } from 'react-native'; import { App } from './src/App'; import { name as appName } from './app.json'; -import { enableAndroidFontFix } from './src/style/AndroidTextFix'; +import { enableAndroidFontFix } from './src/style/android_text_fix'; require('react-native').unstable_enableLogBox(); diff --git a/src/App.tsx b/src/App.tsx index bff0990c..2b1677bf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,9 +1,9 @@ import { ActionSheetProvider } from '@expo/react-native-action-sheet'; import { MobileApplication } from '@Lib/application'; -import { ApplicationGroup } from '@Lib/applicationGroup'; -import { navigationRef } from '@Lib/NavigationService'; +import { ApplicationGroup } from '@Lib/application_group'; +import { navigationRef } from '@Lib/navigation_service'; import { DefaultTheme, NavigationContainer } from '@react-navigation/native'; -import { StyleKit, StyleKitContext } from '@Style/StyleKit'; +import { StyleKit, StyleKitContext } from '@Style/stylekit'; import { StyleKitTheme } from '@Style/Themes/styled-components'; import React, { useCallback, useEffect, useRef, useState } from 'react'; import { StatusBar } from 'react-native'; diff --git a/src/AppStack.tsx b/src/AppStack.tsx index 4f1e2df9..044796bf 100644 --- a/src/AppStack.tsx +++ b/src/AppStack.tsx @@ -4,8 +4,8 @@ import { AppStateEventType, AppStateType, TabletModeChangeData, -} from '@Lib/ApplicationState'; -import { useHasEditor, useIsLocked } from '@Lib/snjsHooks'; +} from '@Lib/application_state'; +import { useHasEditor, useIsLocked } from '@Lib/snjs_helper_hooks'; import { CompositeNavigationProp, RouteProp } from '@react-navigation/native'; import { createStackNavigator, @@ -24,8 +24,8 @@ import { import { MainSideMenu } from '@Screens/SideMenu/MainSideMenu'; import { NoteSideMenu } from '@Screens/SideMenu/NoteSideMenu'; import { ICON_MENU } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; -import { getDefaultDrawerWidth } from '@Style/Util/getDefaultDrawerWidth'; +import { StyleKit } from '@Style/stylekit'; +import { getDefaultDrawerWidth } from '@Style/utils'; import React, { useCallback, useContext, diff --git a/src/ModalStack.tsx b/src/ModalStack.tsx index 412de849..5d0226b8 100644 --- a/src/ModalStack.tsx +++ b/src/ModalStack.tsx @@ -22,7 +22,7 @@ import { import { ManagePrivileges } from '@Screens/Settings/ManagePrivileges'; import { Settings } from '@Screens/Settings/Settings'; import { ICON_CHECKMARK, ICON_CLOSE } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import React, { useContext } from 'react'; import { Platform } from 'react-native'; import { HeaderButtons, Item } from 'react-navigation-header-buttons'; diff --git a/src/lib/AlertService.ts b/src/lib/alert_service.ts similarity index 96% rename from src/lib/AlertService.ts rename to src/lib/alert_service.ts index 2f34a1dc..bf677d43 100644 --- a/src/lib/AlertService.ts +++ b/src/lib/alert_service.ts @@ -1,7 +1,7 @@ import { MODAL_BLOCKING_ALERT } from '@Screens/screens'; import { Alert, AlertButton } from 'react-native'; import { ButtonType, DismissBlockingDialog, SNAlertService } from 'snjs'; -import { goBack, navigate } from './NavigationService'; +import { goBack, navigate } from './navigation_service'; export class AlertService implements SNAlertService { blockingDialog( diff --git a/src/lib/application.ts b/src/lib/application.ts index 91be4e46..f5adce6a 100644 --- a/src/lib/application.ts +++ b/src/lib/application.ts @@ -9,18 +9,18 @@ import { SNComponentManager, } from 'snjs'; import { DeinitSource } from 'snjs/dist/@types/types'; -import { AlertService } from './AlertService'; -import { ApplicationState } from './ApplicationState'; -import { BackupsService } from './BackupsService'; -import { ComponentGroup } from './componentGroup'; -import ComponentManager from './ComponentManager'; -import { EditorGroup } from './EditorGroup'; -import { InstallationService } from './InstallationService'; +import { AlertService } from './alert_service'; +import { ApplicationState } from './application_state'; +import { BackupsService } from './backups_service'; +import { ComponentGroup } from './component_group'; +import { ComponentManager } from './component_manager'; +import { EditorGroup } from './editor_group'; +import { InstallationService } from './installation_service'; import { MobileDeviceInterface } from './interface'; -import { push } from './NavigationService'; -import { PreferencesManager } from './PreferencesManager'; -import { ReviewService } from './reviewService'; -import { SNReactNativeCrypto } from './SNReactNativeCrypto'; +import { push } from './navigation_service'; +import { PreferencesManager } from './preferences_manager'; +import { SNReactNativeCrypto } from './react_native_crypto'; +import { ReviewService } from './review_service'; type MobileServices = { applicationState: ApplicationState; diff --git a/src/lib/applicationGroup.ts b/src/lib/application_group.ts similarity index 81% rename from src/lib/applicationGroup.ts rename to src/lib/application_group.ts index 39619777..49e9f491 100644 --- a/src/lib/applicationGroup.ts +++ b/src/lib/application_group.ts @@ -4,12 +4,12 @@ import { SNApplicationGroup, } from 'snjs'; import { MobileApplication } from './application'; -import { ApplicationState } from './ApplicationState'; -import { BackupsService } from './BackupsService'; -import { InstallationService } from './InstallationService'; +import { ApplicationState } from './application_state'; +import { BackupsService } from './backups_service'; +import { InstallationService } from './installation_service'; import { MobileDeviceInterface } from './interface'; -import { PreferencesManager } from './PreferencesManager'; -import { ReviewService } from './reviewService'; +import { PreferencesManager } from './preferences_manager'; +import { ReviewService } from './review_service'; export class ApplicationGroup extends SNApplicationGroup { constructor() { diff --git a/src/lib/ApplicationState.ts b/src/lib/application_state.ts similarity index 99% rename from src/lib/ApplicationState.ts rename to src/lib/application_state.ts index 998d7882..dd423bf2 100644 --- a/src/lib/ApplicationState.ts +++ b/src/lib/application_state.ts @@ -28,7 +28,7 @@ import { StorageValueModes, } from 'snjs'; import { MobileApplication } from './application'; -import { Editor } from './Editor'; +import { Editor } from './editor'; const pjson = require('../../package.json'); const { PlatformConstants } = NativeModules; diff --git a/src/lib/BackupsService.ts b/src/lib/backups_service.ts similarity index 100% rename from src/lib/BackupsService.ts rename to src/lib/backups_service.ts diff --git a/src/lib/componentGroup.ts b/src/lib/component_group.ts similarity index 100% rename from src/lib/componentGroup.ts rename to src/lib/component_group.ts diff --git a/src/lib/ComponentManager.ts b/src/lib/component_manager.ts similarity index 88% rename from src/lib/ComponentManager.ts rename to src/lib/component_manager.ts index 4b0b01ca..8dbbc647 100644 --- a/src/lib/ComponentManager.ts +++ b/src/lib/component_manager.ts @@ -1,10 +1,10 @@ -import { MobileTheme } from '@Style/StyleKit'; -import { objectToCss } from '@Style/Util/CSSParser'; +import { objectToCss } from '@Style/css_parser'; +import { MobileTheme } from '@Style/stylekit'; import { Base64 } from 'js-base64'; import { SNAlertService, SNComponent, SNComponentManager } from 'snjs'; import { PermissionDialog } from 'snjs/dist/@types/services/component_manager'; -export default class ComponentManager extends SNComponentManager { +export class ComponentManager extends SNComponentManager { private mobileActiveTheme?: MobileTheme; async presentPermissionsDialog(dialog: PermissionDialog) { diff --git a/src/lib/EditorGroup.ts b/src/lib/editor_group.ts similarity index 97% rename from src/lib/EditorGroup.ts rename to src/lib/editor_group.ts index 1ea2e427..c45b8c98 100644 --- a/src/lib/EditorGroup.ts +++ b/src/lib/editor_group.ts @@ -1,6 +1,6 @@ import { removeFromArray } from 'snjs'; import { MobileApplication } from './application'; -import { Editor } from './Editor'; +import { Editor } from './editor'; type EditorGroupChangeCallback = (editor?: Editor) => void; diff --git a/src/lib/InstallationService.ts b/src/lib/installation_service.ts similarity index 100% rename from src/lib/InstallationService.ts rename to src/lib/installation_service.ts diff --git a/src/lib/NavigationService.ts b/src/lib/navigation_service.ts similarity index 100% rename from src/lib/NavigationService.ts rename to src/lib/navigation_service.ts diff --git a/src/lib/PreferencesManager.ts b/src/lib/preferences_manager.ts similarity index 100% rename from src/lib/PreferencesManager.ts rename to src/lib/preferences_manager.ts diff --git a/src/lib/SNReactNativeCrypto.ts b/src/lib/react_native_crypto.ts similarity index 100% rename from src/lib/SNReactNativeCrypto.ts rename to src/lib/react_native_crypto.ts diff --git a/src/lib/reviewService.ts b/src/lib/review_service.ts similarity index 100% rename from src/lib/reviewService.ts rename to src/lib/review_service.ts diff --git a/src/lib/snjsHooks.ts b/src/lib/snjs_helper_hooks.ts similarity index 99% rename from src/lib/snjsHooks.ts rename to src/lib/snjs_helper_hooks.ts index 3a0014af..cf3915c3 100644 --- a/src/lib/snjsHooks.ts +++ b/src/lib/snjs_helper_hooks.ts @@ -9,7 +9,7 @@ import { } from '@Screens/screens'; import React, { useCallback, useEffect } from 'react'; import { ApplicationEvent, ButtonType, ProtectedAction, SNNote } from 'snjs'; -import { Editor } from './Editor'; +import { Editor } from './editor'; export const useSignedIn = ( signedInCallback?: () => void, diff --git a/src/screens/Authenticate/Authenticate.tsx b/src/screens/Authenticate/Authenticate.tsx index 1194af35..d23528fe 100644 --- a/src/screens/Authenticate/Authenticate.tsx +++ b/src/screens/Authenticate/Authenticate.tsx @@ -3,14 +3,14 @@ import { IoniconsHeaderButton } from '@Components/IoniconsHeaderButton'; import { SectionedAccessoryTableCell } from '@Components/SectionedAccessoryTableCell'; import { SectionedTableCell } from '@Components/SectionedTableCell'; import { SectionHeader } from '@Components/SectionHeader'; -import { AppStateType, PasscodeKeyboardType } from '@Lib/ApplicationState'; +import { AppStateType, PasscodeKeyboardType } from '@Lib/application_state'; import { MobileDeviceInterface } from '@Lib/interface'; import { useFocusEffect } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; import { SCREEN_AUTHENTICATE } from '@Screens/screens'; import { ICON_CLOSE } from '@Style/icons'; -import { StyleKit, StyleKitContext } from '@Style/StyleKit'; +import { StyleKit, StyleKitContext } from '@Style/stylekit'; import React, { useCallback, useContext, diff --git a/src/screens/Authenticate/AuthenticatePrivileges.tsx b/src/screens/Authenticate/AuthenticatePrivileges.tsx index 8bc18a38..01cd7734 100644 --- a/src/screens/Authenticate/AuthenticatePrivileges.tsx +++ b/src/screens/Authenticate/AuthenticatePrivileges.tsx @@ -2,11 +2,11 @@ import { ButtonCell } from '@Components/ButtonCell'; import { SectionedAccessoryTableCell } from '@Components/SectionedAccessoryTableCell'; import { SectionedTableCell } from '@Components/SectionedTableCell'; import { SectionHeader } from '@Components/SectionHeader'; -import { AppStateType, PasscodeKeyboardType } from '@Lib/ApplicationState'; +import { AppStateType, PasscodeKeyboardType } from '@Lib/application_state'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; import { SCREEN_AUTHENTICATE_PRIVILEGES } from '@Screens/screens'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useCallback, useContext, diff --git a/src/screens/Compose/ComponentView.styled.ts b/src/screens/Compose/ComponentView.styled.ts index 44b30130..681c3a5d 100644 --- a/src/screens/Compose/ComponentView.styled.ts +++ b/src/screens/Compose/ComponentView.styled.ts @@ -1,5 +1,5 @@ import { ICON_LOCK } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import { SafeAreaView } from 'react-native-safe-area-context'; import Icon from 'react-native-vector-icons/Ionicons'; import WebView from 'react-native-webview'; diff --git a/src/screens/Compose/ComponentView.tsx b/src/screens/Compose/ComponentView.tsx index ceca6d93..07afa80f 100644 --- a/src/screens/Compose/ComponentView.tsx +++ b/src/screens/Compose/ComponentView.tsx @@ -1,4 +1,4 @@ -import { PrefKey } from '@Lib/PreferencesManager'; +import { PrefKey } from '@Lib/preferences_manager'; import { ApplicationContext } from '@Root/ApplicationContext'; import React, { useCallback, diff --git a/src/screens/Compose/Compose.tsx b/src/screens/Compose/Compose.tsx index 83389c4b..d12baa37 100644 --- a/src/screens/Compose/Compose.tsx +++ b/src/screens/Compose/Compose.tsx @@ -1,11 +1,11 @@ -import { AppStateEventType } from '@Lib/ApplicationState'; -import { Editor } from '@Lib/Editor'; +import { AppStateEventType } from '@Lib/application_state'; +import { Editor } from '@Lib/editor'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { AppStackNavigationProp } from '@Root/AppStack'; import { SCREEN_COMPOSE } from '@Screens/screens'; import { ICON_ALERT, ICON_LOCK } from '@Style/icons'; -import { StyleKit, StyleKitContext } from '@Style/StyleKit'; +import { StyleKit, StyleKitContext } from '@Style/stylekit'; import { lighten } from '@Style/utils'; import React, { useCallback, diff --git a/src/screens/InputModal/PasscodeInputModal.tsx b/src/screens/InputModal/PasscodeInputModal.tsx index 23045e20..46756e57 100644 --- a/src/screens/InputModal/PasscodeInputModal.tsx +++ b/src/screens/InputModal/PasscodeInputModal.tsx @@ -5,11 +5,11 @@ import { } from '@Components/SectionedOptionsTableCell'; import { SectionedTableCell } from '@Components/SectionedTableCell'; import { TableSection } from '@Components/TableSection'; -import { PasscodeKeyboardType, UnlockTiming } from '@Lib/ApplicationState'; +import { PasscodeKeyboardType, UnlockTiming } from '@Lib/application_state'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; import { SCREEN_INPUT_MODAL_PASSCODE } from '@Screens/screens'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useContext, useMemo, useRef, useState } from 'react'; import { Keyboard, KeyboardType, Platform, TextInput } from 'react-native'; import { Container, Input } from './InputModal.styled'; diff --git a/src/screens/InputModal/TagInputModal.tsx b/src/screens/InputModal/TagInputModal.tsx index b00c629b..61f1690d 100644 --- a/src/screens/InputModal/TagInputModal.tsx +++ b/src/screens/InputModal/TagInputModal.tsx @@ -5,7 +5,7 @@ import { useFocusEffect } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; import { SCREEN_INPUT_MODAL_TAG } from '@Screens/screens'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useCallback, useContext, diff --git a/src/screens/NoteHistory/NoteHistory.tsx b/src/screens/NoteHistory/NoteHistory.tsx index 761898b4..d9c7f6a2 100644 --- a/src/screens/NoteHistory/NoteHistory.tsx +++ b/src/screens/NoteHistory/NoteHistory.tsx @@ -5,7 +5,7 @@ import { SCREEN_NOTE_HISTORY, SCREEN_NOTE_HISTORY_PREVIEW, } from '@Screens/screens'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useContext, useState } from 'react'; import { Dimensions, Platform } from 'react-native'; import { diff --git a/src/screens/NoteHistory/NoteHistoryPreview.tsx b/src/screens/NoteHistory/NoteHistoryPreview.tsx index 08e1c9bc..424e8ddd 100644 --- a/src/screens/NoteHistory/NoteHistoryPreview.tsx +++ b/src/screens/NoteHistory/NoteHistoryPreview.tsx @@ -3,7 +3,7 @@ import { ApplicationContext } from '@Root/ApplicationContext'; import { AppStackNavigationProp } from '@Root/AppStack'; import { SCREEN_NOTE_HISTORY_PREVIEW } from '@Screens/screens'; import { ELIPSIS } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import { useCustomActionSheet } from '@Style/useCustomActionSheet'; import React, { useCallback, useContext, useLayoutEffect } from 'react'; import { YellowBox } from 'react-native'; diff --git a/src/screens/Notes/NoteCell.tsx b/src/screens/Notes/NoteCell.tsx index af78316e..96443c0e 100644 --- a/src/screens/Notes/NoteCell.tsx +++ b/src/screens/Notes/NoteCell.tsx @@ -1,4 +1,4 @@ -import { useDeleteNoteWithPrivileges } from '@Lib/snjsHooks'; +import { useDeleteNoteWithPrivileges } from '@Lib/snjs_helper_hooks'; import { ApplicationContext } from '@Root/ApplicationContext'; import { CustomActionSheetOption, diff --git a/src/screens/Notes/NoteList.tsx b/src/screens/Notes/NoteList.tsx index a67f1ef9..5bedeb5d 100644 --- a/src/screens/Notes/NoteList.tsx +++ b/src/screens/Notes/NoteList.tsx @@ -1,8 +1,8 @@ -import { AppStateEventType } from '@Lib/ApplicationState'; -import { useSignedIn } from '@Lib/snjsHooks'; +import { AppStateEventType } from '@Lib/application_state'; +import { useSignedIn } from '@Lib/snjs_helper_hooks'; import { useFocusEffect } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useCallback, useContext, diff --git a/src/screens/Notes/Notes.tsx b/src/screens/Notes/Notes.tsx index 59034ae1..751992b5 100644 --- a/src/screens/Notes/Notes.tsx +++ b/src/screens/Notes/Notes.tsx @@ -1,12 +1,12 @@ -import { AppStateType } from '@Lib/ApplicationState'; -import { PrefKey } from '@Lib/PreferencesManager'; -import { useSignedIn, useSyncStatus } from '@Lib/snjsHooks'; +import { AppStateType } from '@Lib/application_state'; +import { PrefKey } from '@Lib/preferences_manager'; +import { useSignedIn, useSyncStatus } from '@Lib/snjs_helper_hooks'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { AppStackNavigationProp } from '@Root/AppStack'; import { SCREEN_NOTES } from '@Screens/screens'; import { ICON_ADD } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import React, { useCallback, useContext, useRef, useState } from 'react'; import FAB from 'react-native-fab'; import { CollectionSort, ContentType, Platform, SNNote } from 'snjs'; diff --git a/src/screens/Notes/OfflineBanner.tsx b/src/screens/Notes/OfflineBanner.tsx index c21be3e3..932a38d1 100644 --- a/src/screens/Notes/OfflineBanner.tsx +++ b/src/screens/Notes/OfflineBanner.tsx @@ -1,7 +1,7 @@ import { useNavigation } from '@react-navigation/native'; import { SCREEN_SETTINGS } from '@Screens/screens'; import { ICON_FORWARD, ICON_USER } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import React from 'react'; import { BoldText, diff --git a/src/screens/Root.tsx b/src/screens/Root.tsx index 3c344956..30dc1deb 100644 --- a/src/screens/Root.tsx +++ b/src/screens/Root.tsx @@ -2,8 +2,8 @@ import { AppStateEventType, AppStateType, TabletModeChangeData, -} from '@Lib/ApplicationState'; -import { useHasEditor, useIsLocked } from '@Lib/snjsHooks'; +} from '@Lib/application_state'; +import { useHasEditor, useIsLocked } from '@Lib/snjs_helper_hooks'; import { useFocusEffect } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { AppStackNavigationProp } from '@Root/AppStack'; @@ -12,7 +12,7 @@ import { SCREEN_COMPOSE, SCREEN_NOTES, } from '@Screens/screens'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import { hexToRGBA } from '@Style/utils'; import React, { useCallback, diff --git a/src/screens/Settings/Sections/AuthSection.tsx b/src/screens/Settings/Sections/AuthSection.tsx index 3ef66957..752b6f5c 100644 --- a/src/screens/Settings/Sections/AuthSection.tsx +++ b/src/screens/Settings/Sections/AuthSection.tsx @@ -4,7 +4,7 @@ import { SectionedTableCell } from '@Components/SectionedTableCell'; import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; import { ApplicationContext } from '@Root/ApplicationContext'; -import { StyleKitContext } from '@Style/StyleKit'; +import { StyleKitContext } from '@Style/stylekit'; import React, { useCallback, useContext, useEffect, useState } from 'react'; import { Keyboard } from 'react-native'; import { diff --git a/src/screens/Settings/Sections/CompanySection.tsx b/src/screens/Settings/Sections/CompanySection.tsx index a7fc6a20..bc643b61 100644 --- a/src/screens/Settings/Sections/CompanySection.tsx +++ b/src/screens/Settings/Sections/CompanySection.tsx @@ -1,7 +1,7 @@ import { ButtonCell } from '@Components/ButtonCell'; import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; -import { ApplicationState } from '@Lib/ApplicationState'; +import { ApplicationState } from '@Lib/application_state'; import { ApplicationContext } from '@Root/ApplicationContext'; import React, { useContext } from 'react'; import { Platform, Share } from 'react-native'; diff --git a/src/screens/Settings/Sections/EncryptionSection.tsx b/src/screens/Settings/Sections/EncryptionSection.tsx index ad3fc592..d19edc3f 100644 --- a/src/screens/Settings/Sections/EncryptionSection.tsx +++ b/src/screens/Settings/Sections/EncryptionSection.tsx @@ -1,6 +1,6 @@ import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; -import { useIsLocked } from '@Lib/snjsHooks'; +import { useIsLocked } from '@Lib/snjs_helper_hooks'; import { ApplicationContext } from '@Root/ApplicationContext'; import React, { useContext, useMemo } from 'react'; import { ContentType, StorageEncryptionPolicies } from 'snjs'; diff --git a/src/screens/Settings/Sections/OptionsSection.tsx b/src/screens/Settings/Sections/OptionsSection.tsx index a5f29d4f..8cf03dcc 100644 --- a/src/screens/Settings/Sections/OptionsSection.tsx +++ b/src/screens/Settings/Sections/OptionsSection.tsx @@ -3,8 +3,8 @@ import { SectionedAccessoryTableCell } from '@Components/SectionedAccessoryTable import { SectionedOptionsTableCell } from '@Components/SectionedOptionsTableCell'; import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; -import { PrefKey } from '@Lib/PreferencesManager'; -import { useSignedIn } from '@Lib/snjsHooks'; +import { PrefKey } from '@Lib/preferences_manager'; +import { useSignedIn } from '@Lib/snjs_helper_hooks'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; diff --git a/src/screens/Settings/Sections/PasscodeSection.tsx b/src/screens/Settings/Sections/PasscodeSection.tsx index 375be152..f515bbb0 100644 --- a/src/screens/Settings/Sections/PasscodeSection.tsx +++ b/src/screens/Settings/Sections/PasscodeSection.tsx @@ -5,7 +5,7 @@ import { } from '@Components/SectionedOptionsTableCell'; import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; -import { UnlockTiming } from '@Lib/ApplicationState'; +import { UnlockTiming } from '@Lib/application_state'; import { MobileDeviceInterface } from '@Lib/interface'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; diff --git a/src/screens/Settings/Sections/PreferencesSection.tsx b/src/screens/Settings/Sections/PreferencesSection.tsx index 5c0d4b34..627c4bc3 100644 --- a/src/screens/Settings/Sections/PreferencesSection.tsx +++ b/src/screens/Settings/Sections/PreferencesSection.tsx @@ -1,7 +1,7 @@ import { SectionedAccessoryTableCell } from '@Components/SectionedAccessoryTableCell'; import { SectionHeader } from '@Components/SectionHeader'; import { TableSection } from '@Components/TableSection'; -import { PrefKey } from '@Lib/PreferencesManager'; +import { PrefKey } from '@Lib/preferences_manager'; import { ApplicationContext } from '@Root/ApplicationContext'; import React, { useContext, useMemo, useState } from 'react'; import { CollectionSort } from 'snjs'; diff --git a/src/screens/Settings/Settings.tsx b/src/screens/Settings/Settings.tsx index 1f32a780..201785eb 100644 --- a/src/screens/Settings/Settings.tsx +++ b/src/screens/Settings/Settings.tsx @@ -1,4 +1,4 @@ -import { useSignedIn } from '@Lib/snjsHooks'; +import { useSignedIn } from '@Lib/snjs_helper_hooks'; import { ApplicationContext } from '@Root/ApplicationContext'; import { ModalStackNavigationProp } from '@Root/ModalStack'; import { SCREEN_SETTINGS } from '@Screens/screens'; diff --git a/src/screens/SideMenu/MainSideMenu.tsx b/src/screens/SideMenu/MainSideMenu.tsx index 83030f7d..81726cde 100644 --- a/src/screens/SideMenu/MainSideMenu.tsx +++ b/src/screens/SideMenu/MainSideMenu.tsx @@ -1,9 +1,9 @@ -import { AppStateType } from '@Lib/ApplicationState'; +import { AppStateType } from '@Lib/application_state'; import { useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { SCREEN_SETTINGS } from '@Screens/screens'; import { ICON_BRUSH, ICON_SETTINGS } from '@Style/icons'; -import { MobileTheme, StyleKit, StyleKitContext } from '@Style/StyleKit'; +import { MobileTheme, StyleKit, StyleKitContext } from '@Style/stylekit'; import { CustomActionSheetOption, useCustomActionSheet, diff --git a/src/screens/SideMenu/NoteSideMenu.tsx b/src/screens/SideMenu/NoteSideMenu.tsx index 774a7e7f..c2eccb7b 100644 --- a/src/screens/SideMenu/NoteSideMenu.tsx +++ b/src/screens/SideMenu/NoteSideMenu.tsx @@ -1,5 +1,5 @@ -import { Editor } from '@Lib/Editor'; -import { useDeleteNoteWithPrivileges } from '@Lib/snjsHooks'; +import { Editor } from '@Lib/editor'; +import { useDeleteNoteWithPrivileges } from '@Lib/snjs_helper_hooks'; import { useFocusEffect, useNavigation } from '@react-navigation/native'; import { ApplicationContext } from '@Root/ApplicationContext'; import { AppStackNavigationProp } from '@Root/AppStack'; @@ -19,7 +19,7 @@ import { ICON_SHARE, ICON_TRASH, } from '@Style/icons'; -import { StyleKit } from '@Style/StyleKit'; +import { StyleKit } from '@Style/stylekit'; import { useCustomActionSheet } from '@Style/useCustomActionSheet'; import React, { useCallback, diff --git a/src/screens/SideMenu/SideMenuHero.tsx b/src/screens/SideMenu/SideMenuHero.tsx index a854e40f..853e5be7 100644 --- a/src/screens/SideMenu/SideMenuHero.tsx +++ b/src/screens/SideMenu/SideMenuHero.tsx @@ -1,5 +1,5 @@ import { Circle } from '@Components/Circle'; -import { useOutOfSync, useSignedIn } from '@Lib/snjsHooks'; +import { useOutOfSync, useSignedIn } from '@Lib/snjs_helper_hooks'; import { ApplicationContext } from '@Root/ApplicationContext'; import React, { useContext, useEffect, useMemo, useState } from 'react'; import { ViewProps } from 'react-native'; diff --git a/src/style/StyleKit.ts b/src/style/StyleKit.ts index 064b99b4..9923dd3b 100644 --- a/src/style/StyleKit.ts +++ b/src/style/StyleKit.ts @@ -1,6 +1,6 @@ import { MobileApplication } from '@Lib/application'; -import ComponentManager from '@Lib/ComponentManager'; -import CSSParser from '@Style/Util/CSSParser'; +import { ComponentManager } from '@Lib/component_manager'; +import CSSParser from '@Style/css_parser'; import { DARK_CONTENT, getColorLuminosity, diff --git a/src/style/Util/getDefaultDrawerWidth.ts b/src/style/Util/getDefaultDrawerWidth.ts deleted file mode 100644 index 147c2aa1..00000000 --- a/src/style/Util/getDefaultDrawerWidth.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Platform, ScaledSize } from 'react-native'; - -export const getDefaultDrawerWidth = ({ height, width }: ScaledSize) => { - /* - * Default drawer width is screen width - header height - * with a max width of 280 on mobile and 320 on tablet - * https://material.io/guidelines/patterns/navigation-drawer.html - */ - const smallerAxisSize = Math.min(height, width); - const isLandscape = width > height; - const isTablet = smallerAxisSize >= 600; - const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56; - const maxWidth = isTablet ? 320 : 280; - - return Math.min(smallerAxisSize - appBarHeight, maxWidth); -}; diff --git a/src/style/AndroidTextFix.js b/src/style/android_text_fix.js similarity index 100% rename from src/style/AndroidTextFix.js rename to src/style/android_text_fix.js diff --git a/src/style/Util/CSSParser.ts b/src/style/css_parser.ts similarity index 100% rename from src/style/Util/CSSParser.ts rename to src/style/css_parser.ts diff --git a/src/style/utils.ts b/src/style/utils.ts index 7c3a7dd5..a0e765b0 100644 --- a/src/style/utils.ts +++ b/src/style/utils.ts @@ -1,11 +1,27 @@ +import { Platform, ScaledSize } from 'react-native'; import { isNullOrUndefined } from 'snjs'; -import { MobileTheme } from './StyleKit'; +import { MobileTheme } from './stylekit'; /* eslint-disable no-bitwise */ export const LIGHT_MODE_KEY = 'light'; export const DARK_MODE_KEY = 'dark'; export const LIGHT_CONTENT = 'light-content'; export const DARK_CONTENT = 'dark-content'; +export const getDefaultDrawerWidth = ({ height, width }: ScaledSize) => { + /* + * Default drawer width is screen width - header height + * with a max width of 280 on mobile and 320 on tablet + * https://material.io/guidelines/patterns/navigation-drawer.html + */ + const smallerAxisSize = Math.min(height, width); + const isLandscape = width > height; + const isTablet = smallerAxisSize >= 600; + const appBarHeight = Platform.OS === 'ios' ? (isLandscape ? 32 : 44) : 56; + const maxWidth = isTablet ? 320 : 280; + + return Math.min(smallerAxisSize - appBarHeight, maxWidth); +}; + export function statusBarColorForTheme(theme: MobileTheme) { if (isNullOrUndefined(theme.mobileContent.luminosity)) { throw Error('Theme luminocity should not be null');