This commit is contained in:
ammarahm-ed
2020-03-14 13:54:16 +05:00
parent e07b70032e
commit a2a6e645e7
32 changed files with 67 additions and 86 deletions

View File

@@ -1,4 +1,3 @@
import Storage from 'notes-core/api/index';
import React, {useEffect, useState} from 'react';
import {Platform, StatusBar, View, Text} from 'react-native';
import * as Animatable from 'react-native-animatable';
@@ -30,16 +29,12 @@ import {
import NavigationService, {
AppContainer,
} from './src/services/NavigationService';
import {DeviceDetectionService} from './src/utils/deviceDetection';
import StorageInterface from './src/utils/storage';
import {w} from './src/utils/utils';
import {w, DDS, db} from './src/utils/utils';
import Editor from './src/views/Editor';
import Animated from 'react-native-reanimated';
import MMKV from 'react-native-mmkv-storage';
import {defaultState} from './src/provider/defaultState';
import {EditorPosition} from './src/utils/animations';
export const DDS = new DeviceDetectionService();
export const db = new Storage(StorageInterface);
let sideMenuRef;
let editorRef;

View File

@@ -10,7 +10,6 @@ import {
import MMKV from 'react-native-mmkv-storage';
import Share from 'react-native-share';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {db, DDS} from '../../../App';
import {
ACCENT,
COLOR_SCHEME,
@@ -26,7 +25,7 @@ import {
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import NavigationService from '../../services/NavigationService';
import {timeConverter, ToastEvent} from '../../utils/utils';
import {timeConverter, ToastEvent, DDS, db} from '../../utils/utils';
import {openVault} from '../../services/eventManager';
const w = Dimensions.get('window').width;

View File

@@ -9,10 +9,10 @@ import {
} from 'react-native';
import {FlatList, TextInput} from 'react-native-gesture-handler';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {db, DDS} from '../../../App';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
import {ACTIONS} from '../../provider/actions';
import {getElevation, ToastEvent} from '../../utils/utils';
import {getElevation, ToastEvent, db, DDS} from '../../utils/utils';
import {updateEvent} from '../DialogManager/recievers';
let refs = [];

View File

@@ -4,8 +4,8 @@ import {TextInput} from 'react-native-gesture-handler';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
import {getElevation, ToastEvent} from '../../utils/utils';
import {db} from '../../../App';
import {getElevation, ToastEvent, db} from '../../utils/utils';
import {eSendEvent} from '../../services/eventManager';
import {eOnNewTopicAdded} from '../../services/events';

View File

@@ -12,14 +12,14 @@ import * as Animatable from 'react-native-animatable';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {br, opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
import {eScrollEvent, eOpenLoginDialog} from '../../services/events';
import {getElevation, h, w, ToastEvent} from '../../utils/utils';
import {eScrollEvent} from '../../services/events';
import {db, getElevation, ToastEvent} from '../../utils/utils';
import {Header} from '../header';
import {Search} from '../SearchInput';
import SelectionHeader from '../SelectionHeader';
import {DDS, db} from '../../../App';
import {ACTIONS} from '../../provider/actions';
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(
SafeAreaView,
);

View File

@@ -1,7 +1,6 @@
import React, {Component} from 'react';
import {Modal, Text, TouchableOpacity, View} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {db, DDS} from '../../../App';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
@@ -12,7 +11,14 @@ import {
} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {exitEditorAnimation} from '../../utils/animations';
import {editing, getElevation, history, ToastEvent} from '../../utils/utils';
import {
editing,
getElevation,
history,
ToastEvent,
db,
DDS,
} from '../../utils/utils';
import {updateEvent} from '../DialogManager/recievers';
import {dialogActions} from '../DialogManager/dialogActions';

View File

@@ -1,5 +1,4 @@
import React, {Component} from 'react';
import {DDS} from '../../../App';
import {
eSubscribeEvent,
eUnSubscribeEvent,
@@ -28,7 +27,7 @@ import {Dialog} from '../Dialog';
import LoginDialog from '../LoginDialog';
import MoveNoteDialog from '../MoveNoteDialog';
import {VaultDialog} from '../VaultDialog';
import {hexToRGBA} from '../../utils/utils';
import {hexToRGBA, DDS} from '../../utils/utils';
import {Platform} from 'react-native';
import {TEMPLATE_DELETE, TEMPLATE_PERMANANT_DELETE} from './templates';
import {moveNoteEvent} from './recievers';

View File

@@ -23,8 +23,7 @@ import {
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {AnimatedSafeAreaView} from '../../views/Home';
import {db} from '../../../App';
import {w, hexToRGBA} from '../../utils/utils';
import {w, hexToRGBA, db} from '../../utils/utils';
let tagsInputRef;
let tagsList;

View File

@@ -3,12 +3,11 @@ import {Modal, TouchableOpacity, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import {DDS} from '../../../App';
import {normalize} from '../../common/common';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eLoginDialogNavigateBack} from '../../services/events';
import {getElevation} from '../../utils/utils';
import {getElevation, DDS} from '../../utils/utils';
import ForgotPassword from '../../views/ForgotPassword';
import Login from '../../views/Login';
import Signup from '../../views/Signup';

View File

@@ -10,7 +10,6 @@ import {
} from 'react-native';
import MMKV from 'react-native-mmkv-storage';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DDS, db} from '../../../App';
import {
ACCENT,
COLOR_SCHEME,
@@ -29,7 +28,7 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eOpenModalMenu, eSendSideMenuOverlayRef} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {timeSince, getElevation, hexToRGBA} from '../../utils/utils';
import {timeSince, getElevation, hexToRGBA, db, DDS} from '../../utils/utils';
import {inputRef} from '../SearchInput';
export const Menu = ({

View File

@@ -3,11 +3,10 @@ import {Modal, TouchableOpacity, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {createAppContainer} from 'react-navigation';
import {createStackNavigator} from 'react-navigation-stack';
import {DDS} from '../../../App';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eMoveNoteDialogNavigateBack} from '../../services/events';
import {getElevation} from '../../utils/utils';
import {getElevation, DDS} from '../../utils/utils';
import Folders from '../../views/Folders';
import Notebook from '../../views/Notebook';
import Notes from '../../views/Notes';

View File

@@ -1,12 +1,11 @@
import React from 'react';
import {Dimensions, Text, TouchableOpacity, View} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DDS} from '../../../App';
import {ph, pv, SIZE, WEIGHT} from '../../common/common';
import {eSendEvent, openVault} from '../../services/eventManager';
import {eOnLoadNote} from '../../services/events';
import {openEditorAnimation} from '../../utils/animations';
import {getElevation, timeSince} from '../../utils/utils';
import {getElevation, timeSince, DDS} from '../../utils/utils';
import {ActionSheetEvent, simpleDialogEvent} from '../DialogManager/recievers';
import {TEMPLATE_TRASH} from '../DialogManager/templates';

View File

@@ -4,9 +4,9 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {opacity, ph, pv, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import NavigationService from '../../services/NavigationService';
import {ToastEvent, w, getElevation} from '../../utils/utils';
import {ToastEvent, w, getElevation, db, DDS} from '../../utils/utils';
import {ActionSheetEvent, moveNoteHideEvent} from '../DialogManager';
import {db} from '../../../App';
import {ACTIONS} from '../../provider/actions';
export const NotebookItem = ({

View File

@@ -13,11 +13,11 @@ import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eScrollEvent} from '../../services/events';
import {ToastEvent, hexToRGBA} from '../../utils/utils';
import {ToastEvent, hexToRGBA, DDS, db} from '../../utils/utils';
import {NotesPlaceHolder} from '../ListPlaceholders';
import NoteItem from '../NoteItem';
import SelectionWrapper from '../SelectionWrapper';
import {db, DDS} from '../../../App';
import {inputRef} from '../SearchInput';
import {useIsFocused} from 'react-navigation-hooks';

View File

@@ -2,9 +2,10 @@ import React, {createRef, useEffect, useState} from 'react';
import {TextInput} from 'react-native';
import Animated, {Easing} from 'react-native-reanimated';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DDS} from '../../../App';
import {br, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {DDS} from '../../utils/utils';
const {Value, timing, block} = Animated;

View File

@@ -12,10 +12,10 @@ import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {w, ToastEvent} from '../../utils/utils';
import {w, ToastEvent, db} from '../../utils/utils';
import {eSendEvent} from '../../services/eventManager';
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../services/events';
import {db} from '../../../App';
import {TEMPLATE_DELETE} from '../DialogManager';
export const AnimatedSafeAreaView = Animatable.createAnimatableComponent(

View File

@@ -5,9 +5,8 @@ import {opacity, ph, SIZE, WEIGHT, normalize, pv} from '../../common/common';
import {useTracked} from '../../provider';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';
import {eHideToast, eShowToast} from '../../services/events';
import {h, w} from '../../utils/utils';
import {h, w, DDS} from '../../utils/utils';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DDS} from '../../../App';
const AnimatedTouchableOpacity = Animatable.createAnimatableComponent(
TouchableOpacity,

View File

@@ -3,8 +3,8 @@ import {View, Text, TouchableOpacity, Modal, ToastAndroid} from 'react-native';
import {SIZE, ph, pv, opacity, WEIGHT} from '../../common/common';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {TextInput} from 'react-native-gesture-handler';
import {db, DDS} from '../../../App';
import {getElevation, ToastEvent, editing} from '../../utils/utils';
import {getElevation, ToastEvent, db, DDS} from '../../utils/utils';
import Share from 'react-native-share';
import {
eSendEvent,

View File

@@ -1,13 +1,13 @@
import React, {createRef} from 'react';
import {Platform, StatusBar, Text, TouchableOpacity, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {DDS} from '../../../App';
import {SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {eSendEvent} from '../../services/eventManager';
import {eCloseLoginDialog} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {SideMenuEvent} from '../../utils/utils';
import {SideMenuEvent, DDS} from '../../utils/utils';
import {moveNoteHideEvent} from '../DialogManager';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import Menu, {MenuItem, MenuDivider} from 'react-native-material-menu';

View File

@@ -1,5 +1,4 @@
import {db} from '../../App';
import {SideMenuEvent, history} from '../utils/utils';
import {SideMenuEvent, history, db} from '../utils/utils';
import {ACTIONS} from './actions';
export const reducer = (state, action) => {

View File

@@ -1,4 +1,5 @@
import {DeviceEventEmitter, Dimensions} from 'react-native';
import Storage from 'notes-core/api/index';
import {Dimensions} from 'react-native';
import {eSendEvent} from '../services/eventManager';
import {
eOpenSideMenu,
@@ -8,6 +9,11 @@ import {
eShowToast,
eHideToast,
} from '../services/events';
import {DeviceDetectionService} from './deviceDetection';
import StorageInterface from './storage';
export const DDS = new DeviceDetectionService();
export const db = new Storage(StorageInterface);
export const getElevation = elevation => {
return {
elevation,

View File

@@ -12,7 +12,7 @@ import {
} from 'react-native';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import WebView from 'react-native-webview';
import {db, DDS} from '../../../App';
import {normalize, SIZE, WEIGHT} from '../../common/common';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
@@ -33,6 +33,8 @@ import {
SideMenuEvent,
timeConverter,
ToastEvent,
DDS,
db,
} from '../../utils/utils';
import {
ActionSheetEvent,

View File

@@ -7,7 +7,7 @@ import NoteItem from '../../components/NoteItem';
import SelectionWrapper from '../../components/SelectionWrapper';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {ToastEvent, w} from '../../utils/utils';
import {ToastEvent, w, db} from '../../utils/utils';
import SimpleList from '../../components/SimpleList';
export const Favorites = ({navigation}) => {

View File

@@ -11,7 +11,7 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eScrollEvent} from '../../services/events';
import {slideLeft, slideRight} from '../../utils/animations';
import {ToastEvent, w} from '../../utils/utils';
import {ToastEvent, w, db} from '../../utils/utils';
import {AddNotebookEvent} from '../../components/DialogManager/recievers';
export const Folders = ({navigation}) => {

View File

@@ -2,8 +2,7 @@ import React, {createRef, useEffect} from 'react';
import {SafeAreaView, Text, TouchableOpacity, View} from 'react-native';
import {TextInput} from 'react-native-gesture-handler';
import {useIsFocused} from 'react-navigation-hooks';
import {DDS} from '../../../App';
import {opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {opacity, pv, SIZE, WEIGHT, DDS} from '../../common/common';
import {Header} from '../../components/header';
import {useTracked} from '../../provider';
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/eventManager';

View File

@@ -2,15 +2,13 @@ import React, {useEffect} from 'react';
import {SafeAreaView} from 'react-native';
import * as Animatable from 'react-native-animatable';
import {useIsFocused} from 'react-navigation-hooks';
import {DDS, db} from '../../../App';
import Container from '../../components/Container';
import {NotesList} from '../../components/NotesList';
import SelectionHeader from '../../components/SelectionHeader';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import NavigationService from '../../services/NavigationService';
import {SideMenuEvent} from '../../utils/utils';
import {SideMenuEvent, DDS} from '../../utils/utils';
import {eScrollEvent, eOnLoadNote} from '../../services/events';
import {openEditorAnimation} from '../../utils/animations';
let count = 0;

View File

@@ -9,7 +9,7 @@ import {
} from 'react-native';
import {TextInput} from 'react-native-gesture-handler';
import {useIsFocused} from 'react-navigation-hooks';
import {DDS, db} from '../../../App';
import {opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
import {useTracked} from '../../provider';
@@ -22,7 +22,7 @@ import {
validateUsername,
} from '../../services/validation';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {ToastEvent} from '../../utils/utils';
import {ToastEvent, db, DDS} from '../../utils/utils';
import {ACTIONS} from '../../provider/actions';
export const Login = ({navigation}) => {

View File

@@ -1,6 +1,5 @@
import React, {useEffect, useState} from 'react';
import {useIsFocused} from 'react-navigation-hooks';
import {db} from '../../../App';
import Container from '../../components/Container';
import {NotebookItem} from '../../components/NotebookItem';
import SelectionWrapper from '../../components/SelectionWrapper';
@@ -16,7 +15,7 @@ import {
eOnNewTopicAdded,
eScrollEvent,
} from '../../services/events';
import {ToastEvent, w} from '../../utils/utils';
import {ToastEvent, w, db} from '../../utils/utils';
import SimpleList from '../../components/SimpleList';
import {NotebookPlaceHolder} from '../../components/ListPlaceholders';
import {AddTopicEvent} from '../../components/DialogManager/recievers';

View File

@@ -1,35 +1,24 @@
import React, {useEffect, useState} from 'react';
import {
FlatList,
Text,
View,
Platform,
RefreshControl,
ActivityIndicator,
} from 'react-native';
import {db, DDS} from '../../../App';
import {useIsFocused} from 'react-navigation-hooks';
import Container from '../../components/Container';
import {NotesPlaceHolder} from '../../components/ListPlaceholders';
import NoteItem from '../../components/NoteItem';
import SelectionWrapper from '../../components/SelectionWrapper';
import SimpleList from '../../components/SimpleList';
import {useTracked} from '../../provider';
import {SIZE, WEIGHT} from '../../common/common';
import {ACTIONS} from '../../provider/actions';
import {ToastEvent, editing, SideMenuEvent} from '../../utils/utils';
import {
eSendEvent,
eSubscribeEvent,
eUnSubscribeEvent,
} from '../../services/eventManager';
import {
eOnLoadNote,
eScrollEvent,
refreshNotesPage,
eOnLoadNote,
} from '../../services/events';
import {NotesPlaceHolder} from '../../components/ListPlaceholders';
import {useIsFocused} from 'react-navigation-hooks';
import {openEditorAnimation} from '../../utils/animations';
import {inputRef} from '../../components/SearchInput';
import SimpleList from '../../components/SimpleList';
import {db, DDS, editing, SideMenuEvent, ToastEvent} from '../../utils/utils';
export const Notes = ({navigation}) => {
const [state, dispatch] = useTracked();

View File

@@ -9,7 +9,6 @@ import {
} from 'react-native';
import MMKV from 'react-native-mmkv-storage';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {DDS} from '../../../App';
import {
ACCENT,
COLOR_SCHEME,
@@ -28,7 +27,7 @@ import {ACTIONS} from '../../provider/actions';
import {eSendEvent} from '../../services/eventManager';
import {eOpenLoginDialog} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {hexToRGBA, w} from '../../utils/utils';
import {hexToRGBA, w, DDS} from '../../utils/utils';
export async function setSetting(settings, name, value) {
let s = {...settings};

View File

@@ -2,7 +2,6 @@ import React, {createRef, useEffect, useState} from 'react';
import {SafeAreaView, Text, TouchableOpacity, View} from 'react-native';
import {TextInput} from 'react-native-gesture-handler';
import {useIsFocused} from 'react-navigation-hooks';
import {DDS, db} from '../../../App';
import {opacity, pv, SIZE, WEIGHT} from '../../common/common';
import {Header} from '../../components/header';
import {useTracked} from '../../provider';
@@ -12,15 +11,15 @@ import * as Animatable from 'react-native-animatable';
const _email = createRef();
const _pass = createRef();
const _username = createRef();
import {
validateUsername,
validateEmail,
validatePass,
} from '../../services/validation';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import {ToastEvent} from '../../utils/utils';
import {ToastEvent, db, DDS} from '../../utils/utils';
import {ACTIONS} from '../../provider/actions';
export const Signup = ({navigation}) => {
const [state, dispatch] = useTracked();
const {colors, isLoginNavigator} = state;

View File

@@ -1,6 +1,5 @@
import React, {useEffect, useState} from 'react';
import {FlatList, Text, View, RefreshControl} from 'react-native';
import {SIZE, WEIGHT} from '../../common/common';
import {useIsFocused} from 'react-navigation-hooks';
import Container from '../../components/Container';
import {
simpleDialogEvent,
@@ -9,13 +8,11 @@ import {
import {TrashPlaceHolder} from '../../components/ListPlaceholders';
import {NotebookItem} from '../../components/NotebookItem';
import NoteItem from '../../components/NoteItem';
import SelectionWrapper from '../../components/SelectionWrapper';
import SimpleList from '../../components/SimpleList';
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {w, ToastEvent} from '../../utils/utils';
import SelectionWrapper from '../../components/SelectionWrapper';
import {useIsFocused} from 'react-navigation-hooks';
import {inputRef} from '../../components/SearchInput';
import SimpleList from '../../components/SimpleList';
import {db, ToastEvent, w} from '../../utils/utils';
export const Trash = ({navigation}) => {
const [state, dispatch] = useTracked();