mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
improve navigation performance
This commit is contained in:
11
apps/mobile/android/app/proguard-rules.pro
vendored
11
apps/mobile/android/app/proguard-rules.pro
vendored
@@ -28,4 +28,13 @@
|
|||||||
# Samsung Fingerprint
|
# Samsung Fingerprint
|
||||||
|
|
||||||
-keep class com.samsung.android.sdk.** { *; }
|
-keep class com.samsung.android.sdk.** { *; }
|
||||||
-dontwarn com.samsung.android.sdk.**
|
-dontwarn com.samsung.android.sdk.**
|
||||||
|
|
||||||
|
-keep public class com.dylanvann.fastimage.* {*;}
|
||||||
|
-keep public class com.dylanvann.fastimage.** {*;}
|
||||||
|
-keep public class * implements com.bumptech.glide.module.GlideModule
|
||||||
|
-keep public class * extends com.bumptech.glide.module.AppGlideModule
|
||||||
|
-keep public enum com.bumptech.glide.load.ImageHeaderParser$** {
|
||||||
|
**[] $VALUES;
|
||||||
|
public *;
|
||||||
|
}
|
||||||
@@ -2,7 +2,8 @@ import 'react-native-gesture-handler';
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {AppRegistry} from 'react-native';
|
import {AppRegistry} from 'react-native';
|
||||||
import {name as appName} from './app.json';
|
import {name as appName} from './app.json';
|
||||||
|
import { enableScreens } from 'react-native-screens';
|
||||||
|
enableScreens(true);
|
||||||
let Provider;
|
let Provider;
|
||||||
let App;
|
let App;
|
||||||
let NotesnookShare;
|
let NotesnookShare;
|
||||||
|
|||||||
@@ -1147,8 +1147,8 @@
|
|||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CODE_SIGN_ENTITLEMENTS = Notesnook/Notesnook.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Notesnook/Notesnook.entitlements;
|
||||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
CURRENT_PROJECT_VERSION = 1340;
|
CURRENT_PROJECT_VERSION = 1340;
|
||||||
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
DEVELOPMENT_TEAM = 53CWBG3QUC;
|
||||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||||
@@ -1228,7 +1228,7 @@
|
|||||||
);
|
);
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook;
|
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook;
|
||||||
PRODUCT_NAME = Notesnook;
|
PRODUCT_NAME = Notesnook;
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "Notesnook iOS Distribution";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Notesnook-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Notesnook-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
TARGETED_DEVICE_FAMILY = "1,2";
|
TARGETED_DEVICE_FAMILY = "1,2";
|
||||||
@@ -1476,8 +1476,8 @@
|
|||||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||||
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
|
||||||
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
|
CODE_SIGN_ENTITLEMENTS = "Make Note/Make Note.entitlements";
|
||||||
CODE_SIGN_IDENTITY = "iPhone Distribution";
|
CODE_SIGN_IDENTITY = "Apple Development";
|
||||||
CODE_SIGN_STYLE = Manual;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COPY_PHASE_STRIP = NO;
|
COPY_PHASE_STRIP = NO;
|
||||||
CURRENT_PROJECT_VERSION = 1340;
|
CURRENT_PROJECT_VERSION = 1340;
|
||||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||||
@@ -1556,7 +1556,7 @@
|
|||||||
MTL_FAST_MATH = YES;
|
MTL_FAST_MATH = YES;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
PRODUCT_BUNDLE_IDENTIFIER = org.streetwriters.notesnook.share;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "Notesnook Extension iOS Distribution 2";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Make Note/Make Note-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Make Note/Make Note-Bridging-Header.h";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { View } from 'react-native';
|
|||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { Header } from '../Header';
|
import { Header } from '../Header';
|
||||||
|
|
||||||
export const ContainerTopSection = ({root}) => {
|
export const ContainerTopSection = ({children}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors, selectionMode} = state;
|
const {colors, selectionMode} = state;
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ export const ContainerTopSection = ({root}) => {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
}}>
|
}}>
|
||||||
<Header root={root} />
|
{children}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {KeyboardAvoidingView, Platform, SafeAreaView} from 'react-native';
|
import { KeyboardAvoidingView, Platform, SafeAreaView } from 'react-native';
|
||||||
import Animated from 'react-native-reanimated';
|
import Animated from 'react-native-reanimated';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { getElevation } from '../../utils';
|
|
||||||
import { ContainerScale } from '../../utils/Animations';
|
import { ContainerScale } from '../../utils/Animations';
|
||||||
import SelectionHeader from '../SelectionHeader';
|
import SelectionHeader from '../SelectionHeader';
|
||||||
import {ContainerTopSection} from './ContainerTopSection';
|
import { ContainerTopSection } from './ContainerTopSection';
|
||||||
const AnimatedView = Animated.createAnimatedComponent(SafeAreaView);
|
const AnimatedView = Animated.createAnimatedComponent(SafeAreaView);
|
||||||
export const Container = ({children, root}) => {
|
export const Container = ({children, root}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
@@ -30,8 +29,7 @@ export const Container = ({children, root}) => {
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}}>
|
}}>
|
||||||
<SelectionHeader />
|
|
||||||
<ContainerTopSection root={root} />
|
|
||||||
{children}
|
{children}
|
||||||
</AnimatedView>
|
</AnimatedView>
|
||||||
</KeyboardAvoidingView>
|
</KeyboardAvoidingView>
|
||||||
|
|||||||
@@ -379,7 +379,7 @@ export class DialogManager extends Component {
|
|||||||
<VaultDialog colors={colors} />
|
<VaultDialog colors={colors} />
|
||||||
<MoveNoteDialog colors={colors} />
|
<MoveNoteDialog colors={colors} />
|
||||||
<SortDialog colors={colors} />
|
<SortDialog colors={colors} />
|
||||||
<JumpToDialog />
|
|
||||||
<UpdateDialog />
|
<UpdateDialog />
|
||||||
<RateDialog/>
|
<RateDialog/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React from 'react';
|
||||||
import {notesnook} from '../../../e2e/test.ids';
|
import { notesnook } from '../../../e2e/test.ids';
|
||||||
import {useTracked} from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import {SIZE} from '../../utils/SizeUtils';
|
import { SIZE } from '../../utils/SizeUtils';
|
||||||
import {ActionIcon} from '../ActionIcon';
|
import { ActionIcon } from '../ActionIcon';
|
||||||
|
|
||||||
export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {
|
export const HeaderLeftMenu = ({currentScreen,headerMenuState}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
|
|||||||
@@ -1,19 +1,17 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React from 'react';
|
||||||
import {ActivityIndicator, StyleSheet, View} from 'react-native';
|
import { ActivityIndicator, StyleSheet, View } from 'react-native';
|
||||||
import {notesnook} from '../../../e2e/test.ids';
|
import { notesnook } from '../../../e2e/test.ids';
|
||||||
import {useTracked} from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import {dWidth} from '../../utils';
|
import { SIZE } from '../../utils/SizeUtils';
|
||||||
import {SIZE} from '../../utils/SizeUtils';
|
import { ActionIcon } from '../ActionIcon';
|
||||||
import {ActionIcon} from '../ActionIcon';
|
import { Button } from '../Button';
|
||||||
import {Button} from '../Button';
|
|
||||||
|
|
||||||
export const HeaderRightMenu = ({currentScreen}) => {
|
export const HeaderRightMenu = ({currentScreen}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors, containerBottomButton, syncing} = state;
|
const {colors, syncing} = state;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={styles.rightBtnContainer}>
|
<View style={styles.rightBtnContainer}>
|
||||||
{syncing && <ActivityIndicator size={SIZE.xl} color={colors.accent} />}
|
{syncing && <ActivityIndicator size={SIZE.xl} color={colors.accent} />}
|
||||||
@@ -33,11 +31,9 @@ export const HeaderRightMenu = ({currentScreen}) => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{DDS.isLargeTablet() && containerBottomButton.onPress ? (
|
{DDS.isLargeTablet() ? (
|
||||||
<Button
|
<Button
|
||||||
onPress={() => {
|
onPress={action}
|
||||||
containerBottomButton.onPress();
|
|
||||||
}}
|
|
||||||
testID={notesnook.ids.default.addBtn}
|
testID={notesnook.ids.default.addBtn}
|
||||||
icon={currentScreen === 'Trash' ? 'delete' : 'plus'}
|
icon={currentScreen === 'Trash' ? 'delete' : 'plus'}
|
||||||
iconSize={SIZE.xl}
|
iconSize={SIZE.xl}
|
||||||
|
|||||||
@@ -1,50 +1,27 @@
|
|||||||
import React, { useEffect, useState } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import Animated from 'react-native-reanimated';
|
import Animated, { useValue } from 'react-native-reanimated';
|
||||||
import { useTracked } from '../../provider';
|
import { useTracked } from '../../provider';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import { DDS } from '../../services/DeviceDetection';
|
||||||
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
import { eSubscribeEvent, eUnSubscribeEvent } from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
|
||||||
import { eScrollEvent } from '../../utils/Events';
|
import { eScrollEvent } from '../../utils/Events';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
|
|
||||||
const opacity = new Animated.Value(DDS.isLargeTablet() ? 1 : 0);
|
|
||||||
|
|
||||||
let scrollPostions = {};
|
export const HeaderTitle = ({heading,headerColor,screen}) => {
|
||||||
|
|
||||||
export const HeaderTitle = ({heading,headerColor}) => {
|
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
|
const opacity = useValue(DDS.isLargeTablet() ? 1 : 0)
|
||||||
|
|
||||||
const onScroll = async (y) => {
|
const onScroll = async (data) => {
|
||||||
|
if (data.screen !== screen) return;
|
||||||
if (DDS.isTab) return;
|
if (DDS.isTab) return;
|
||||||
if (typeof y !== 'number') {
|
if (data.y > 75) {
|
||||||
if (y.type === 'back') {
|
let yVal = data.y - 75;
|
||||||
scrollPostions[y.name] = null;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (scrollPostions[y.name]) {
|
|
||||||
if (scrollPostions[y.name] > 200) {
|
|
||||||
opacity.setValue(1);
|
|
||||||
} else {
|
|
||||||
scrollPostions[y.name] = 0;
|
|
||||||
opacity.setValue(0);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
scrollPostions[y.name] = 0;
|
|
||||||
opacity.setValue(0);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (y > 75) {
|
|
||||||
let yVal = y - 75;
|
|
||||||
o = yVal / 75;
|
o = yVal / 75;
|
||||||
opacity.setValue(o);
|
opacity.setValue(o);
|
||||||
} else {
|
} else {
|
||||||
opacity.setValue(0);
|
opacity.setValue(0);
|
||||||
}
|
}
|
||||||
scrollPostions[heading] = y;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import {Platform, StyleSheet, View} from 'react-native';
|
|||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import {dWidth} from '../../utils';
|
import {dWidth} from '../../utils';
|
||||||
import {eScrollEvent} from '../../utils/Events';
|
import {eScrollEvent} from '../../utils/Events';
|
||||||
@@ -14,109 +13,92 @@ import {HeaderLeftMenu} from './HeaderLeftMenu';
|
|||||||
import {HeaderRightMenu} from './HeaderRightMenu';
|
import {HeaderRightMenu} from './HeaderRightMenu';
|
||||||
import {HeaderTitle} from './HeaderTitle';
|
import {HeaderTitle} from './HeaderTitle';
|
||||||
|
|
||||||
export const Header = ({root}) => {
|
export const Header = React.memo(
|
||||||
const [state] = useTracked();
|
({root, title, screen, isBack, color, action}) => {
|
||||||
const {colors} = state;
|
const [state] = useTracked();
|
||||||
const insets = useSafeAreaInsets();
|
const {colors} = state;
|
||||||
const [hide, setHide] = useState(true);
|
const insets = useSafeAreaInsets();
|
||||||
const [headerTextState, setHeaderTextState] = useState(
|
const [hide, setHide] = useState(true);
|
||||||
Navigation.getHeaderState(),
|
|
||||||
);
|
|
||||||
const currentScreen = headerTextState.currentScreen;
|
|
||||||
|
|
||||||
const onHeaderStateChange = event => {
|
const onScroll = data => {
|
||||||
if (!event) return;
|
if (data.screen !== screen) return;
|
||||||
setHeaderTextState(event);
|
if (data.y > 150) {
|
||||||
};
|
setHide(false);
|
||||||
|
} else {
|
||||||
useEffect(() => {
|
setHide(true);
|
||||||
eSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
}
|
||||||
return () => {
|
|
||||||
eUnSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
|
||||||
};
|
};
|
||||||
}, []);
|
|
||||||
|
|
||||||
const onScroll = y => {
|
useEffect(() => {
|
||||||
if (y > 150) {
|
eSubscribeEvent(eScrollEvent, onScroll);
|
||||||
setHide(false);
|
return () => {
|
||||||
} else {
|
eUnSubscribeEvent(eScrollEvent, onScroll);
|
||||||
setHide(true);
|
};
|
||||||
}
|
}, []);
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
return (
|
||||||
eSubscribeEvent(eScrollEvent, onScroll);
|
<View
|
||||||
return () => {
|
style={[
|
||||||
eUnSubscribeEvent(eScrollEvent, onScroll);
|
styles.container,
|
||||||
};
|
{
|
||||||
}, []);
|
marginTop: Platform.OS === 'android' ? insets.top : null,
|
||||||
|
backgroundColor: colors.bg,
|
||||||
|
overflow: 'hidden',
|
||||||
|
borderBottomWidth: 1,
|
||||||
|
borderBottomColor: hide ? 'transparent' : colors.nav,
|
||||||
|
justifyContent: 'center',
|
||||||
|
},
|
||||||
|
]}>
|
||||||
|
<View style={styles.leftBtnContainer}>
|
||||||
|
<HeaderLeftMenu headerMenuState={!isBack} currentScreen={screen} />
|
||||||
|
|
||||||
return (
|
{(Platform.OS === 'android' || Platform.isPad) &&
|
||||||
<View
|
screen !== 'Search' ? (
|
||||||
style={[
|
<HeaderTitle
|
||||||
styles.container,
|
headerColor={color}
|
||||||
{
|
heading={title}
|
||||||
marginTop: Platform.OS === 'android' ? insets.top : null,
|
screen={screen}
|
||||||
backgroundColor: colors.bg,
|
root={root}
|
||||||
overflow: 'hidden',
|
/>
|
||||||
borderBottomWidth: 1,
|
) : null}
|
||||||
borderBottomColor: hide ? 'transparent' : colors.nav,
|
</View>
|
||||||
justifyContent: 'center',
|
{Platform.OS !== 'android' && !Platform.isPad && screen !== 'Search' ? (
|
||||||
},
|
|
||||||
]}>
|
|
||||||
<View style={styles.leftBtnContainer}>
|
|
||||||
<HeaderLeftMenu
|
|
||||||
headerMenuState={headerTextState.verticalMenu}
|
|
||||||
currentScreen={currentScreen}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{(Platform.OS === 'android' || Platform.isPad) &&
|
|
||||||
currentScreen !== 'Search' ? (
|
|
||||||
<HeaderTitle
|
<HeaderTitle
|
||||||
headerColor={headerTextState.color}
|
headerColor={color}
|
||||||
heading={headerTextState.heading}
|
heading={title}
|
||||||
currentScreen={currentScreen}
|
screen={screen}
|
||||||
root={root}
|
root={root}
|
||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
|
||||||
{Platform.OS !== 'android' &&
|
|
||||||
!Platform.isPad &&
|
|
||||||
currentScreen !== 'Search' ? (
|
|
||||||
<HeaderTitle
|
|
||||||
headerColor={headerTextState.color}
|
|
||||||
heading={headerTextState.heading}
|
|
||||||
currentScreen={currentScreen}
|
|
||||||
root={root}
|
|
||||||
/>
|
|
||||||
) : null}
|
|
||||||
|
|
||||||
{currentScreen === 'Search' ? (
|
{screen === 'Search' ? (
|
||||||
<>
|
<>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: '80%',
|
width: '80%',
|
||||||
}}>
|
}}>
|
||||||
<SearchInput />
|
<SearchInput />
|
||||||
</View>
|
</View>
|
||||||
<View style={[styles.rightBtnContainer, {right: 6}]}>
|
<View style={[styles.rightBtnContainer, {right: 6}]}>
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
onPress={() => {
|
onPress={() => {
|
||||||
SearchService.search();
|
SearchService.search();
|
||||||
}}
|
}}
|
||||||
name="magnify"
|
name="magnify"
|
||||||
size={SIZE.xxxl}
|
size={SIZE.xxxl}
|
||||||
color={colors.pri}
|
color={colors.pri}
|
||||||
style={styles.rightBtn}
|
style={styles.rightBtn}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</>
|
</>
|
||||||
) : (
|
) : (
|
||||||
<HeaderRightMenu currentScreen={currentScreen} />
|
<HeaderRightMenu action={action} currentScreen={screen} />
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
},
|
||||||
|
(prev, next) => prev.title === next.title,
|
||||||
|
);
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
const styles = StyleSheet.create({
|
||||||
container: {
|
container: {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import Seperator from '../../components/Seperator';
|
|||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
||||||
import {getElevation, scrollRef} from '../../utils';
|
import {getElevation, } from '../../utils';
|
||||||
import {
|
import {
|
||||||
eCloseJumpToDialog,
|
eCloseJumpToDialog,
|
||||||
eOpenJumpToDialog,
|
eOpenJumpToDialog,
|
||||||
@@ -17,7 +17,7 @@ import Heading from '../Typography/Heading';
|
|||||||
|
|
||||||
const offsets = [];
|
const offsets = [];
|
||||||
let timeout = null;
|
let timeout = null;
|
||||||
const JumpToDialog = () => {
|
const JumpToDialog = ({scrollRef}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {notes, colors, settings} = state;
|
const {notes, colors, settings} = state;
|
||||||
const [visible, setVisible] = useState(false);
|
const [visible, setVisible] = useState(false);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import {
|
|||||||
TRASH_SVG,
|
TRASH_SVG,
|
||||||
} from '../../assets/images/assets';
|
} from '../../assets/images/assets';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
|
import FastImage from 'react-native-fast-image'
|
||||||
export const Placeholder = ({type, w, h, color}) => {
|
export const Placeholder = ({type, w, h, color}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
@@ -66,7 +66,7 @@ export const SvgToPngView = ({width, height, src, color, img}) => {
|
|||||||
{error ? (
|
{error ? (
|
||||||
<SvgXml xml={src} width="100%" height="100%" />
|
<SvgXml xml={src} width="100%" height="100%" />
|
||||||
) : (
|
) : (
|
||||||
<Image
|
<FastImage
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
@@ -74,11 +74,12 @@ export const SvgToPngView = ({width, height, src, color, img}) => {
|
|||||||
onError={() => {
|
onError={() => {
|
||||||
setError(true);
|
setError(true);
|
||||||
}}
|
}}
|
||||||
|
|
||||||
source={{
|
source={{
|
||||||
uri: `https://github.com/ammarahm-ed/notesnook/raw/main/assets/${img}-${color.replace(
|
uri: `https://github.com/ammarahm-ed/notesnook/raw/main/assets/${img}-${color.replace(
|
||||||
'#',
|
'#',
|
||||||
'%23',
|
'%23',
|
||||||
)}.png`,
|
)}.png`, cache:"immutable",priority:"high"
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|||||||
@@ -1,15 +1,9 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React from 'react';
|
||||||
import {View} from 'react-native';
|
import {View} from 'react-native';
|
||||||
import Animated, {Easing, useValue} from 'react-native-reanimated';
|
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
import {
|
import {eSendEvent, ToastEvent} from '../../services/EventManager';
|
||||||
eSendEvent,
|
|
||||||
eSubscribeEvent,
|
|
||||||
eUnSubscribeEvent,
|
|
||||||
ToastEvent,
|
|
||||||
} from '../../services/EventManager';
|
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import {db} from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../utils/Events';
|
import {eOpenMoveNoteDialog, eOpenSimpleDialog} from '../../utils/Events';
|
||||||
@@ -19,43 +13,14 @@ import {ActionIcon} from '../ActionIcon';
|
|||||||
import {TEMPLATE_DELETE} from '../DialogManager/Templates';
|
import {TEMPLATE_DELETE} from '../DialogManager/Templates';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
|
|
||||||
export const SelectionHeader = () => {
|
export const SelectionHeader = ({screen}) => {
|
||||||
// State
|
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors, selectionMode, selectedItemsList} = state;
|
const {colors, selectionMode, selectedItemsList} = state;
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const translateY = useValue(-150);
|
|
||||||
const opacity = useValue(0);
|
|
||||||
|
|
||||||
const [headerTextState, setHeaderTextState] = useState(
|
|
||||||
Navigation.getHeaderState(),
|
|
||||||
);
|
|
||||||
const currentScreen = headerTextState.currentScreen;
|
|
||||||
|
|
||||||
const onHeaderStateChange = (event) => {
|
|
||||||
if (!event) return;
|
|
||||||
setHeaderTextState(event);
|
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
eSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
|
||||||
return () => {
|
|
||||||
eUnSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
translateY.setValue(selectionMode ? 0 : -150);
|
|
||||||
Animated.timing(opacity, {
|
|
||||||
duration: 200,
|
|
||||||
toValue: selectionMode ? 1 : 0,
|
|
||||||
easing: Easing.in(Easing.ease),
|
|
||||||
}).start();
|
|
||||||
}, [selectionMode]);
|
|
||||||
|
|
||||||
const addToFavorite = async () => {
|
const addToFavorite = async () => {
|
||||||
if (selectedItemsList.length > 0) {
|
if (selectedItemsList.length > 0) {
|
||||||
selectedItemsList.forEach((item) => {
|
selectedItemsList.forEach(item => {
|
||||||
db.notes.note(item.id).favorite();
|
db.notes.note(item.id).favorite();
|
||||||
});
|
});
|
||||||
Navigation.setRoutesToUpdate([
|
Navigation.setRoutesToUpdate([
|
||||||
@@ -71,7 +36,7 @@ export const SelectionHeader = () => {
|
|||||||
const restoreItem = async () => {
|
const restoreItem = async () => {
|
||||||
if (selectedItemsList.length > 0) {
|
if (selectedItemsList.length > 0) {
|
||||||
let noteIds = [];
|
let noteIds = [];
|
||||||
selectedItemsList.forEach((item) => {
|
selectedItemsList.forEach(item => {
|
||||||
noteIds.push(item.id);
|
noteIds.push(item.id);
|
||||||
});
|
});
|
||||||
await db.trash.restore(...noteIds);
|
await db.trash.restore(...noteIds);
|
||||||
@@ -92,8 +57,8 @@ export const SelectionHeader = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return !selectionMode ? null : (
|
||||||
<Animated.View
|
<View
|
||||||
style={{
|
style={{
|
||||||
width: '100%',
|
width: '100%',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@@ -104,13 +69,7 @@ export const SelectionHeader = () => {
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
zIndex: 999,
|
zIndex: 999,
|
||||||
opacity: opacity,
|
|
||||||
paddingHorizontal: 12,
|
paddingHorizontal: 12,
|
||||||
transform: [
|
|
||||||
{
|
|
||||||
translateY: translateY,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}}>
|
}}>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -162,9 +121,9 @@ export const SelectionHeader = () => {
|
|||||||
right: 12,
|
right: 12,
|
||||||
paddingTop: insets.top,
|
paddingTop: insets.top,
|
||||||
}}>
|
}}>
|
||||||
{currentScreen === 'Trash' ||
|
{screen === 'Trash' ||
|
||||||
currentScreen === 'Notebooks' ||
|
screen === 'Notebooks' ||
|
||||||
currentScreen === 'Notebook' ? null : (
|
screen === 'Notebook' ? null : (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
//dispatch({type: Actions.SELECTION_MODE, enabled: false});
|
//dispatch({type: Actions.SELECTION_MODE, enabled: false});
|
||||||
@@ -180,7 +139,7 @@ export const SelectionHeader = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{currentScreen === 'Favorites' ? (
|
{screen === 'Favorites' ? (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
onPress={addToFavorite}
|
onPress={addToFavorite}
|
||||||
customStyle={{
|
customStyle={{
|
||||||
@@ -192,7 +151,7 @@ export const SelectionHeader = () => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
{currentScreen === 'Trash' ? null : (
|
{screen === 'Trash' ? null : (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
customStyle={{
|
customStyle={{
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
@@ -207,7 +166,7 @@ export const SelectionHeader = () => {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{currentScreen === 'Trash' ? (
|
{screen === 'Trash' ? (
|
||||||
<ActionIcon
|
<ActionIcon
|
||||||
customStyle={{
|
customStyle={{
|
||||||
marginLeft: 10,
|
marginLeft: 10,
|
||||||
@@ -219,7 +178,7 @@ export const SelectionHeader = () => {
|
|||||||
/>
|
/>
|
||||||
) : null}
|
) : null}
|
||||||
</View>
|
</View>
|
||||||
</Animated.View>
|
</View>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,34 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React from 'react';
|
||||||
import {ActivityIndicator, useWindowDimensions, View} from 'react-native';
|
import { ActivityIndicator, useWindowDimensions, View } from 'react-native';
|
||||||
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import { useTracked } from '../../provider';
|
||||||
import {useTracked} from '../../provider';
|
import { COLORS_NOTE } from '../../utils/Colors';
|
||||||
import {eSubscribeEvent, eUnSubscribeEvent} from '../../services/EventManager';
|
import { SIZE } from '../../utils/SizeUtils';
|
||||||
import Navigation from '../../services/Navigation';
|
import { Button } from '../Button';
|
||||||
import {COLORS_NOTE} from '../../utils/Colors';
|
|
||||||
import {SIZE} from '../../utils/SizeUtils';
|
|
||||||
import {Button} from '../Button';
|
|
||||||
import Seperator from '../Seperator';
|
import Seperator from '../Seperator';
|
||||||
import Heading from '../Typography/Heading';
|
import Heading from '../Typography/Heading';
|
||||||
import Paragraph from '../Typography/Paragraph';
|
import Paragraph from '../Typography/Paragraph';
|
||||||
|
|
||||||
export const Empty = ({loading = true, placeholderData,absolute}) => {
|
|
||||||
|
export const Empty = ({
|
||||||
|
loading = true,
|
||||||
|
placeholderData,
|
||||||
|
absolute,
|
||||||
|
headerProps,
|
||||||
|
}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
const [headerTextState, setHeaderTextState] = useState(
|
|
||||||
Navigation.getHeaderState(),
|
|
||||||
);
|
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const {height} = useWindowDimensions();
|
const {height} = useWindowDimensions();
|
||||||
|
|
||||||
const onHeaderStateChange = (event) => {
|
|
||||||
if (!event) return;
|
|
||||||
setHeaderTextState(event);
|
|
||||||
};
|
|
||||||
useEffect(() => {
|
|
||||||
eSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
|
||||||
return () => {
|
|
||||||
eUnSubscribeEvent('onHeaderStateChange', onHeaderStateChange);
|
|
||||||
};
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<View
|
||||||
style={[
|
style={[
|
||||||
{
|
{
|
||||||
backgroundColor: colors.bg,
|
backgroundColor: colors.bg,
|
||||||
position: absolute? "absolute" : 'relative',
|
position: absolute ? 'absolute' : 'relative',
|
||||||
zIndex:absolute? 10 : null,
|
zIndex: absolute ? 10 : null,
|
||||||
height: (height - 250) - insets.top,
|
height: height - 250 - insets.top,
|
||||||
width: '100%',
|
width: '100%',
|
||||||
},
|
},
|
||||||
]}>
|
]}>
|
||||||
@@ -69,16 +58,16 @@ export const Empty = ({loading = true, placeholderData,absolute}) => {
|
|||||||
fontSize={SIZE.md}
|
fontSize={SIZE.md}
|
||||||
accentColor="bg"
|
accentColor="bg"
|
||||||
accentText={
|
accentText={
|
||||||
COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
|
COLORS_NOTE[headerProps?.heading?.toLowerCase()]
|
||||||
? headerTextState.heading?.toLowerCase()
|
? headerProps.heading?.toLowerCase()
|
||||||
: 'accent'
|
: 'accent'
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
) : loading ? (
|
) : loading ? (
|
||||||
<ActivityIndicator
|
<ActivityIndicator
|
||||||
color={
|
color={
|
||||||
COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
|
COLORS_NOTE[headerProps?.heading?.toLowerCase()]
|
||||||
? COLORS_NOTE[headerTextState?.heading?.toLowerCase()]
|
? COLORS_NOTE[headerProps?.heading?.toLowerCase()]
|
||||||
: colors.accent
|
: colors.accent
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -1,18 +1,15 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React, {useEffect, useRef, useState} from 'react';
|
||||||
import {View} from 'react-native';
|
|
||||||
import {RefreshControl, useWindowDimensions} from 'react-native';
|
import {RefreshControl, useWindowDimensions} from 'react-native';
|
||||||
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
import {useSafeAreaInsets} from 'react-native-safe-area-context';
|
||||||
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
import {DataProvider, LayoutProvider, RecyclerListView} from 'recyclerlistview';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import {eSendEvent} from '../../services/EventManager';
|
import {eSendEvent} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
|
||||||
import SettingsService from '../../services/SettingsService';
|
|
||||||
import Sync from '../../services/Sync';
|
import Sync from '../../services/Sync';
|
||||||
import {dHeight} from '../../utils';
|
import {dHeight} from '../../utils';
|
||||||
import {COLORS_NOTE} from '../../utils/Colors';
|
import {COLORS_NOTE} from '../../utils/Colors';
|
||||||
import {eScrollEvent} from '../../utils/Events';
|
import {eScrollEvent} from '../../utils/Events';
|
||||||
import {sleep} from '../../utils/TimeUtils';
|
import JumpToDialog from '../JumpToDialog';
|
||||||
import {NotebookWrapper} from '../NotebookItem/wrapper';
|
import {NotebookWrapper} from '../NotebookItem/wrapper';
|
||||||
import {NoteWrapper} from '../NoteItem/wrapper';
|
import {NoteWrapper} from '../NoteItem/wrapper';
|
||||||
import TagItem from '../TagItem';
|
import TagItem from '../TagItem';
|
||||||
@@ -26,6 +23,10 @@ const header = {
|
|||||||
type: 'MAIN_HEADER',
|
type: 'MAIN_HEADER',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const empty = {
|
||||||
|
type: 'empty',
|
||||||
|
};
|
||||||
|
|
||||||
const SimpleList = ({
|
const SimpleList = ({
|
||||||
listData,
|
listData,
|
||||||
type,
|
type,
|
||||||
@@ -33,23 +34,23 @@ const SimpleList = ({
|
|||||||
customRefreshing,
|
customRefreshing,
|
||||||
refreshCallback,
|
refreshCallback,
|
||||||
sortMenuButton,
|
sortMenuButton,
|
||||||
scrollRef,
|
|
||||||
jumpToDialog,
|
jumpToDialog,
|
||||||
placeholderData,
|
placeholderData,
|
||||||
loading,
|
loading,
|
||||||
headerProps = {
|
headerProps = {
|
||||||
heading: 'Home',
|
heading: 'Home',
|
||||||
},
|
},
|
||||||
|
screen
|
||||||
}) => {
|
}) => {
|
||||||
const [state] = useTracked();
|
const [state] = useTracked();
|
||||||
const {colors, deviceMode, messageBoardState} = state;
|
const {colors, deviceMode, messageBoardState} = state;
|
||||||
const [_loading, setLoading] = useState(true);
|
const [_loading, _setLoading] = useState(true);
|
||||||
const [loaded, setLoaded] = useState(false);
|
|
||||||
const [dataProvider, setDataProvider] = useState(
|
const [dataProvider, setDataProvider] = useState(
|
||||||
new DataProvider((r1, r2) => {
|
new DataProvider((r1, r2) => {
|
||||||
return r1 !== r2;
|
return r1 !== r2;
|
||||||
}),
|
}).cloneWithRows([header, empty]),
|
||||||
);
|
);
|
||||||
|
const scrollRef = useRef();
|
||||||
|
|
||||||
const insets = useSafeAreaInsets();
|
const insets = useSafeAreaInsets();
|
||||||
const {width, fontScale} = useWindowDimensions();
|
const {width, fontScale} = useWindowDimensions();
|
||||||
@@ -57,28 +58,20 @@ const SimpleList = ({
|
|||||||
const dataType = type;
|
const dataType = type;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (loading) {
|
|
||||||
setDataProvider(dataProvider.cloneWithRows([header, {type: 'empty'}]));
|
|
||||||
setLoaded(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!loading) {
|
if (!loading) {
|
||||||
setDataProvider(
|
setDataProvider(
|
||||||
dataProvider.cloneWithRows(
|
dataProvider.cloneWithRows(
|
||||||
!listData || listData.length === 0
|
!listData || listData.length === 0
|
||||||
? [header, {type: 'empty'}]
|
? [header, empty]
|
||||||
: [header].concat(listData),
|
: [header].concat(listData),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
setLoading(false);
|
setTimeout(() => {
|
||||||
setTimeout(
|
_setLoading(false);
|
||||||
() => {
|
}, 500);
|
||||||
setLoaded(true);
|
} else {
|
||||||
},
|
_setLoading(true);
|
||||||
Navigation.getCurrentScreen() === SettingsService.get().homepage
|
setDataProvider(dataProvider.cloneWithRows([header, empty]));
|
||||||
? 1000
|
|
||||||
: 150,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}, [listData, deviceMode, loading]);
|
}, [listData, deviceMode, loading]);
|
||||||
|
|
||||||
@@ -92,7 +85,10 @@ const SimpleList = ({
|
|||||||
const _onScroll = event => {
|
const _onScroll = event => {
|
||||||
if (!event) return;
|
if (!event) return;
|
||||||
let y = event.nativeEvent.contentOffset.y;
|
let y = event.nativeEvent.contentOffset.y;
|
||||||
eSendEvent(eScrollEvent, y);
|
eSendEvent(eScrollEvent, {
|
||||||
|
y,
|
||||||
|
screen
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const _layoutProvider = new LayoutProvider(
|
const _layoutProvider = new LayoutProvider(
|
||||||
@@ -199,6 +195,7 @@ const SimpleList = ({
|
|||||||
<Empty
|
<Empty
|
||||||
loading={loading || _loading}
|
loading={loading || _loading}
|
||||||
placeholderData={placeholderData}
|
placeholderData={placeholderData}
|
||||||
|
headerProps={headerProps}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -237,49 +234,25 @@ const SimpleList = ({
|
|||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{loaded && !loading ? null : (
|
{!loading && (
|
||||||
<>
|
<Announcement
|
||||||
<View
|
color={
|
||||||
style={{
|
COLORS_NOTE[headerProps.heading?.toLowerCase()] || colors.accent
|
||||||
position: 'absolute',
|
}
|
||||||
width: '100%',
|
/>
|
||||||
height: '100%',
|
|
||||||
backgroundColor: colors.bg,
|
|
||||||
zIndex: 999,
|
|
||||||
}}>
|
|
||||||
<Header
|
|
||||||
title={headerProps.heading}
|
|
||||||
paragraph={headerProps.paragraph}
|
|
||||||
onPress={headerProps.onPress}
|
|
||||||
icon={headerProps.icon}
|
|
||||||
type={dataType}
|
|
||||||
index={0}
|
|
||||||
/>
|
|
||||||
<Empty loading={true} placeholderData={placeholderData} />
|
|
||||||
</View>
|
|
||||||
</>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{_loading ? null : (
|
|
||||||
<>
|
|
||||||
<Announcement
|
|
||||||
color={
|
|
||||||
COLORS_NOTE[headerProps.heading?.toLowerCase()] || colors.accent
|
|
||||||
}
|
|
||||||
/>
|
|
||||||
<RecyclerListView
|
|
||||||
ref={scrollRef}
|
|
||||||
layoutProvider={_layoutProvider}
|
|
||||||
dataProvider={dataProvider}
|
|
||||||
rowRenderer={_renderRow}
|
|
||||||
onScroll={_onScroll}
|
|
||||||
canChangeSize={true}
|
|
||||||
renderFooter={listData.length === 0 ? null : Footer}
|
|
||||||
scrollViewProps={scrollProps}
|
|
||||||
style={styles}
|
|
||||||
/>
|
|
||||||
</>
|
|
||||||
)}
|
)}
|
||||||
|
<RecyclerListView
|
||||||
|
ref={scrollRef}
|
||||||
|
layoutProvider={_layoutProvider}
|
||||||
|
dataProvider={dataProvider}
|
||||||
|
rowRenderer={_renderRow}
|
||||||
|
onScroll={_onScroll}
|
||||||
|
canChangeSize={true}
|
||||||
|
renderFooter={listData.length === 0 ? null : Footer}
|
||||||
|
scrollViewProps={scrollProps}
|
||||||
|
style={styles}
|
||||||
|
/>
|
||||||
|
<JumpToDialog scrollRef={scrollRef} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ const SplashScreen = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
Storage.read('introCompleted').then(async r => {
|
Storage.read('introCompleted').then(async r => {
|
||||||
requestAnimationFrame(() => {
|
requestAnimationFrame(() => {
|
||||||
if (r) {
|
if (!r) {
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
timing(opacity, {
|
timing(opacity, {
|
||||||
toValue: 1,
|
toValue: 1,
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
} from '../services/EventManager';
|
} from '../services/EventManager';
|
||||||
import Navigation from '../services/Navigation';
|
import Navigation from '../services/Navigation';
|
||||||
import SettingsService from '../services/SettingsService';
|
import SettingsService from '../services/SettingsService';
|
||||||
|
import {editing, history} from '../utils';
|
||||||
import {eOpenSideMenu} from '../utils/Events';
|
import {eOpenSideMenu} from '../utils/Events';
|
||||||
import {rootNavigatorRef} from '../utils/Refs';
|
import {rootNavigatorRef} from '../utils/Refs';
|
||||||
import {sleep} from '../utils/TimeUtils';
|
import {sleep} from '../utils/TimeUtils';
|
||||||
@@ -74,8 +75,8 @@ const forSlide = ({current, next, inverted, layouts: {screen}}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const screenOptionsForAnimation = {
|
const screenOptionsForAnimation = {
|
||||||
animationEnabled: false,
|
animationEnabled: true,
|
||||||
cardStyleInterpolator: forSlide,
|
cardStyleInterpolator: forFade,
|
||||||
gestureEnabled: true,
|
gestureEnabled: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -84,8 +85,10 @@ export const NavigatorStack = React.memo(
|
|||||||
const [, dispatch] = useTracked();
|
const [, dispatch] = useTracked();
|
||||||
const [render, setRender] = React.useState(false);
|
const [render, setRender] = React.useState(false);
|
||||||
const onStateChange = React.useCallback(() => {
|
const onStateChange = React.useCallback(() => {
|
||||||
dispatch({type: Actions.SELECTION_MODE, enabled: false});
|
if (history.selectionMode) {
|
||||||
dispatch({type: Actions.CLEAR_SELECTION});
|
dispatch({type: Actions.SELECTION_MODE, enabled: false});
|
||||||
|
dispatch({type: Actions.CLEAR_SELECTION});
|
||||||
|
}
|
||||||
eSendEvent('navigate');
|
eSendEvent('navigate');
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -102,7 +105,6 @@ export const NavigatorStack = React.memo(
|
|||||||
id: SettingsService.get().homepage.toLowerCase() + '_navigation',
|
id: SettingsService.get().homepage.toLowerCase() + '_navigation',
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -126,6 +128,7 @@ export const NavigatorStack = React.memo(
|
|||||||
headerShown: false,
|
headerShown: false,
|
||||||
animationEnabled: false,
|
animationEnabled: false,
|
||||||
gestureEnabled: false,
|
gestureEnabled: false,
|
||||||
|
|
||||||
}}>
|
}}>
|
||||||
<Stack.Screen name="Notes" component={Home} />
|
<Stack.Screen name="Notes" component={Home} />
|
||||||
<Stack.Screen name="Notebooks" component={Folders} />
|
<Stack.Screen name="Notebooks" component={Folders} />
|
||||||
|
|||||||
@@ -8,14 +8,10 @@ import {defaultState} from './DefaultState';
|
|||||||
|
|
||||||
export const reducer = (state, action) => {
|
export const reducer = (state, action) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
|
|
||||||
case Actions.ALL: {
|
case Actions.ALL: {
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
notes: db.notes.group(
|
notes: db.notes.group(SORT[sortSettings.sort], sortSettings.sortOrder),
|
||||||
SORT[sortSettings.sort],
|
|
||||||
sortSettings.sortOrder,
|
|
||||||
),
|
|
||||||
notebooks: db.notebooks.all,
|
notebooks: db.notebooks.all,
|
||||||
trash: db.trash.all,
|
trash: db.trash.all,
|
||||||
tags: db.tags.all,
|
tags: db.tags.all,
|
||||||
@@ -56,10 +52,7 @@ export const reducer = (state, action) => {
|
|||||||
case Actions.NOTES:
|
case Actions.NOTES:
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
notes: db.notes.group(
|
notes: db.notes.group(SORT[sortSettings.sort], sortSettings.sortOrder),
|
||||||
SORT[sortSettings.sort],
|
|
||||||
sortSettings.sortOrder,
|
|
||||||
)
|
|
||||||
};
|
};
|
||||||
case Actions.THEME: {
|
case Actions.THEME: {
|
||||||
return {
|
return {
|
||||||
@@ -134,7 +127,7 @@ export const reducer = (state, action) => {
|
|||||||
} else {
|
} else {
|
||||||
eSendEvent(eOpenSideMenu);
|
eSendEvent(eOpenSideMenu);
|
||||||
}
|
}
|
||||||
|
history.selectionMode = action.enabled;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
selectionMode: action.enabled,
|
selectionMode: action.enabled,
|
||||||
@@ -157,15 +150,18 @@ export const reducer = (state, action) => {
|
|||||||
if (selectedItems.length === 0) {
|
if (selectedItems.length === 0) {
|
||||||
eSendEvent(eOpenSideMenu);
|
eSendEvent(eOpenSideMenu);
|
||||||
}
|
}
|
||||||
|
history.selectionMode =
|
||||||
|
selectedItems.length > 0 ? state.selectionMode : false;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
selectedItemsList: selectedItems,
|
selectedItemsList: selectedItems,
|
||||||
selectionMode: selectedItems.length > 0 ? state.selectionMode : false,
|
selectionMode: history.selectionMode,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case Actions.CLEAR_SELECTION: {
|
case Actions.CLEAR_SELECTION: {
|
||||||
history.selectedItemsList = [];
|
history.selectedItemsList = [];
|
||||||
eSendEvent(eOpenSideMenu);
|
eSendEvent(eOpenSideMenu);
|
||||||
|
history.selectionMode = false;
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
selectedItemsList: [],
|
selectedItemsList: [],
|
||||||
@@ -280,7 +276,7 @@ export const reducer = (state, action) => {
|
|||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
searching: action.searching.isSearching,
|
searching: action.searching.isSearching,
|
||||||
searchStatus:action.searching.status
|
searchStatus: action.searching.status,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case Actions.PREMIUM: {
|
case Actions.PREMIUM: {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import SettingsService from './SettingsService';
|
|||||||
let currentScreen = 'Notes';
|
let currentScreen = 'Notes';
|
||||||
let homeLoaded = false;
|
let homeLoaded = false;
|
||||||
|
|
||||||
|
|
||||||
function getHomeLoaded() {
|
function getHomeLoaded() {
|
||||||
return homeLoaded;
|
return homeLoaded;
|
||||||
}
|
}
|
||||||
@@ -47,8 +46,8 @@ function getHeaderState() {
|
|||||||
|
|
||||||
function clearRouteFromUpdates(routeName) {
|
function clearRouteFromUpdates(routeName) {
|
||||||
if (routesToUpdate.indexOf(routeName) !== -1) {
|
if (routesToUpdate.indexOf(routeName) !== -1) {
|
||||||
routesToUpdate = [...new Set(routesToUpdate)]
|
routesToUpdate = [...new Set(routesToUpdate)];
|
||||||
routesToUpdate.splice(routesToUpdate.indexOf(routeName), 1);
|
routesToUpdate.splice(routesToUpdate.indexOf(routeName), 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,19 +59,18 @@ function routeNeedsUpdate(routeName, callback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {array} routes
|
* @param {array} routes
|
||||||
*/
|
*/
|
||||||
function setRoutesToUpdate(routes) {
|
function setRoutesToUpdate(routes) {
|
||||||
|
console.log(currentScreen, 'current');
|
||||||
console.log(currentScreen, "current");
|
|
||||||
if (routes.indexOf(currentScreen) > -1) {
|
if (routes.indexOf(currentScreen) > -1) {
|
||||||
console.log('updating screen', currentScreen);
|
console.log('updating screen', currentScreen);
|
||||||
if (
|
if (
|
||||||
currentScreen === routeNames.NotesPage||
|
currentScreen === routeNames.NotesPage ||
|
||||||
currentScreen === routeNames.Notebook
|
currentScreen === routeNames.Notebook
|
||||||
) {
|
) {
|
||||||
console.log(currentScreen ,"CURRENT");
|
console.log(currentScreen, 'CURRENT');
|
||||||
eSendEvent(
|
eSendEvent(
|
||||||
currentScreen === routeNames.NotesPage
|
currentScreen === routeNames.NotesPage
|
||||||
? refreshNotesPage
|
? refreshNotesPage
|
||||||
@@ -124,7 +122,7 @@ function setHeaderState(name, params, item) {
|
|||||||
headerState.currentScreen = name;
|
headerState.currentScreen = name;
|
||||||
headerState.verticalMenu = params.menu;
|
headerState.verticalMenu = params.menu;
|
||||||
if (headerState) {
|
if (headerState) {
|
||||||
eSendEvent('onHeaderStateChange', {...headerState});
|
eSendEvent('onHeaderStateChange', {id: headerState.id});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,15 +131,13 @@ function goBack() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function push(name, params, item) {
|
function push(name, params, item) {
|
||||||
currentScreen = name;
|
|
||||||
setHeaderState(name, params, item);
|
setHeaderState(name, params, item);
|
||||||
rootNavigatorRef.current?.dispatch(StackActions.push(name, params));
|
rootNavigatorRef.current?.dispatch(StackActions.push(name, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
function replace(name, params, item) {
|
function replace(name, params, item) {
|
||||||
currentScreen = name;
|
|
||||||
setHeaderState(name, params, item);
|
setHeaderState(name, params, item);
|
||||||
rootNavigatorRef.current?.dispatch(StackActions.replace(name,params));
|
rootNavigatorRef.current?.dispatch(StackActions.replace(name, params));
|
||||||
}
|
}
|
||||||
|
|
||||||
function popToTop() {
|
function popToTop() {
|
||||||
@@ -181,5 +177,5 @@ export default {
|
|||||||
routeNeedsUpdate,
|
routeNeedsUpdate,
|
||||||
routeNames,
|
routeNames,
|
||||||
getHomeLoaded,
|
getHomeLoaded,
|
||||||
setHomeLoaded
|
setHomeLoaded,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ const run = async (context = 'global') => {
|
|||||||
context: context,
|
context: context,
|
||||||
});
|
});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
|
||||||
if (e.message === 'You need to login to sync.') {
|
if (e.message === 'You need to login to sync.') {
|
||||||
ToastEvent.show({
|
ToastEvent.show({
|
||||||
heading:"Enable sync",
|
heading:"Enable sync",
|
||||||
|
|||||||
@@ -16,9 +16,9 @@ export const db = new Database(
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
db.host( __DEV__ ? {
|
db.host( __DEV__ ? {
|
||||||
API_HOST: 'https://api.notesnook.com',
|
API_HOST: 'http://192.168.10.3:5264',
|
||||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
AUTH_HOST: 'http://192.168.10.3:8264',
|
||||||
SSE_HOST: 'https://events.streetwriters.co',
|
SSE_HOST: 'http://192.168.10.3:7264',
|
||||||
} : {
|
} : {
|
||||||
API_HOST: 'https://api.notesnook.com',
|
API_HOST: 'https://api.notesnook.com',
|
||||||
AUTH_HOST: 'https://auth.streetwriters.co',
|
AUTH_HOST: 'https://auth.streetwriters.co',
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import {createRef} from 'react';
|
import {createRef} from 'react';
|
||||||
import {Dimensions, NativeModules, Platform} from 'react-native';
|
import {
|
||||||
|
Dimensions,
|
||||||
|
NativeModules,
|
||||||
|
Platform,
|
||||||
|
} from 'react-native';
|
||||||
import RNTooltips from 'react-native-tooltips';
|
import RNTooltips from 'react-native-tooltips';
|
||||||
import {updateEvent} from '../components/DialogManager/recievers';
|
import {updateEvent} from '../components/DialogManager/recievers';
|
||||||
import {dummyRef} from '../components/DummyText';
|
import {dummyRef} from '../components/DummyText';
|
||||||
@@ -11,7 +15,7 @@ import {tabBarRef} from './Refs';
|
|||||||
import {SIZE} from './SizeUtils';
|
import {SIZE} from './SizeUtils';
|
||||||
|
|
||||||
export const InteractionManager = {
|
export const InteractionManager = {
|
||||||
runAfterInteractions: (func, time = 150) => setTimeout(func, time),
|
runAfterInteractions: (func, time = 400) => setTimeout(func, time),
|
||||||
};
|
};
|
||||||
|
|
||||||
export const APP_VERSION = 1350;
|
export const APP_VERSION = 1350;
|
||||||
@@ -68,6 +72,7 @@ export const selection = {
|
|||||||
|
|
||||||
export const history = {
|
export const history = {
|
||||||
selectedItemsList: [],
|
selectedItemsList: [],
|
||||||
|
selectionMode: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function showContext(event, title) {
|
export async function showContext(event, title) {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import React, {useCallback, useEffect} from 'react';
|
import React, {useCallback, useEffect} from 'react';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
|
import {Header} from '../../components/Header';
|
||||||
import {Placeholder} from '../../components/ListPlaceholders';
|
import {Placeholder} from '../../components/ListPlaceholders';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
@@ -7,7 +10,7 @@ import {DDS} from '../../services/DeviceDetection';
|
|||||||
import {eSendEvent} from '../../services/EventManager';
|
import {eSendEvent} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import { InteractionManager } from '../../utils';
|
import {InteractionManager} from '../../utils';
|
||||||
import {eScrollEvent} from '../../utils/Events';
|
import {eScrollEvent} from '../../utils/Events';
|
||||||
export const Favorites = ({route, navigation}) => {
|
export const Favorites = ({route, navigation}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -17,16 +20,16 @@ export const Favorites = ({route, navigation}) => {
|
|||||||
let pageIsLoaded = false;
|
let pageIsLoaded = false;
|
||||||
|
|
||||||
let ranAfterInteractions = false;
|
let ranAfterInteractions = false;
|
||||||
|
|
||||||
const runAfterInteractions = () => {
|
const runAfterInteractions = () => {
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
if (localLoad) {
|
if (localLoad) {
|
||||||
setLocalLoad(false);
|
setLocalLoad(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigation.routeNeedsUpdate('Favorites',() => {
|
Navigation.routeNeedsUpdate('Favorites', () => {
|
||||||
dispatch({type:Actions.FAVORITES})
|
dispatch({type: Actions.FAVORITES});
|
||||||
})
|
});
|
||||||
|
|
||||||
eSendEvent(eScrollEvent, {name: 'Favorites', type: 'in'});
|
eSendEvent(eScrollEvent, {name: 'Favorites', type: 'in'});
|
||||||
updateSearch();
|
updateSearch();
|
||||||
@@ -94,26 +97,33 @@ export const Favorites = ({route, navigation}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleList
|
<>
|
||||||
listData={favorites}
|
<ContainerTopSection>
|
||||||
type="notes"
|
<SelectionHeader screen="Favorites" />
|
||||||
refreshCallback={() => {
|
<Header title="Favorites" isBack={false} screen="Favorites" />
|
||||||
dispatch({type: Actions.FAVORITES});
|
</ContainerTopSection>
|
||||||
}}
|
<SimpleList
|
||||||
loading={loading || localLoad}
|
listData={favorites}
|
||||||
placeholderData={{
|
type="notes"
|
||||||
heading: 'Your favorites',
|
refreshCallback={() => {
|
||||||
paragraph: 'You have not added any notes to favorites yet.',
|
dispatch({type: Actions.FAVORITES});
|
||||||
button: null,
|
}}
|
||||||
loading: 'Loading your favorites',
|
screen="Favorites"
|
||||||
}}
|
loading={loading || localLoad}
|
||||||
headerProps={{
|
placeholderData={{
|
||||||
heading: 'Favorites',
|
heading: 'Your favorites',
|
||||||
}}
|
paragraph: 'You have not added any notes to favorites yet.',
|
||||||
focused={() => navigation.isFocused()}
|
button: null,
|
||||||
placeholder={<Placeholder type="favorites" />}
|
loading: 'Loading your favorites',
|
||||||
placeholderText="Notes you favorite appear here"
|
}}
|
||||||
/>
|
headerProps={{
|
||||||
|
heading: 'Favorites',
|
||||||
|
}}
|
||||||
|
focused={() => navigation.isFocused()}
|
||||||
|
placeholder={<Placeholder type="favorites" />}
|
||||||
|
placeholderText="Notes you favorite appear here"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,9 @@ import {eScrollEvent} from '../../utils/Events';
|
|||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import {DDS} from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import {InteractionManager} from '../../utils';
|
import {InteractionManager} from '../../utils';
|
||||||
|
import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
|
||||||
|
import { Header } from '../../components/Header';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
|
|
||||||
export const Folders = ({route, navigation}) => {
|
export const Folders = ({route, navigation}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
@@ -97,9 +100,19 @@ export const Folders = ({route, navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="Notebooks" />
|
||||||
|
<Header
|
||||||
|
title="Notebooks"
|
||||||
|
isBack={false}
|
||||||
|
screen="Notesbooks"
|
||||||
|
action={_onPressBottomButton}
|
||||||
|
/>
|
||||||
|
</ContainerTopSection>
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={notebooks}
|
listData={notebooks}
|
||||||
type="notebooks"
|
type="notebooks"
|
||||||
|
screen="Notebooks"
|
||||||
focused={() => navigation.isFocused()}
|
focused={() => navigation.isFocused()}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
placeholderData={{
|
placeholderData={{
|
||||||
|
|||||||
@@ -1,16 +1,19 @@
|
|||||||
import React, { useCallback, useEffect, useState } from 'react';
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';
|
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import { useTracked } from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import { Actions } from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
import { DDS } from '../../services/DeviceDetection';
|
import {DDS} from '../../services/DeviceDetection';
|
||||||
import { eSendEvent } from '../../services/EventManager';
|
import {eSendEvent} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import { InteractionManager, scrollRef } from '../../utils';
|
import {InteractionManager, scrollRef} from '../../utils';
|
||||||
import { db } from '../../utils/DB';
|
import {db} from '../../utils/DB';
|
||||||
import { eOnLoadNote, eScrollEvent } from '../../utils/Events';
|
import {eOnLoadNote, eScrollEvent} from '../../utils/Events';
|
||||||
import { tabBarRef } from '../../utils/Refs';
|
import {tabBarRef} from '../../utils/Refs';
|
||||||
|
import {Header} from '../../components/Header/index';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
export const Home = ({route, navigation}) => {
|
export const Home = ({route, navigation}) => {
|
||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {loading} = state;
|
const {loading} = state;
|
||||||
@@ -93,8 +96,6 @@ export const Home = ({route, navigation}) => {
|
|||||||
}, [notes]);
|
}, [notes]);
|
||||||
|
|
||||||
const updateSearch = () => {
|
const updateSearch = () => {
|
||||||
|
|
||||||
|
|
||||||
SearchService.update({
|
SearchService.update({
|
||||||
placeholder: 'Type a keyword to search in notes',
|
placeholder: 'Type a keyword to search in notes',
|
||||||
data: db?.notes?.all,
|
data: db?.notes?.all,
|
||||||
@@ -104,7 +105,6 @@ export const Home = ({route, navigation}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const _onPressBottomButton = async () => {
|
const _onPressBottomButton = async () => {
|
||||||
|
|
||||||
if (!DDS.isLargeTablet()) {
|
if (!DDS.isLargeTablet()) {
|
||||||
tabBarRef.current?.goToPage(1);
|
tabBarRef.current?.goToPage(1);
|
||||||
} else {
|
} else {
|
||||||
@@ -114,12 +114,23 @@ export const Home = ({route, navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="Notes" />
|
||||||
|
<Header
|
||||||
|
title="Notes"
|
||||||
|
isBack={false}
|
||||||
|
screen="Notes"
|
||||||
|
action={_onPressBottomButton}
|
||||||
|
/>
|
||||||
|
</ContainerTopSection>
|
||||||
|
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={notes}
|
listData={notes}
|
||||||
scrollRef={scrollRef}
|
scrollRef={scrollRef}
|
||||||
type="notes"
|
type="notes"
|
||||||
isHome={true}
|
isHome={true}
|
||||||
pinned={true}
|
pinned={true}
|
||||||
|
screen="Notes"
|
||||||
loading={loading || localLoad}
|
loading={loading || localLoad}
|
||||||
sortMenuButton={true}
|
sortMenuButton={true}
|
||||||
headerProps={{
|
headerProps={{
|
||||||
|
|||||||
@@ -1,32 +1,33 @@
|
|||||||
import React, {useEffect, useState} from 'react';
|
import React, { useEffect, useState } from 'react';
|
||||||
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';
|
||||||
|
import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
|
||||||
|
import { Header } from '../../components/Header';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {
|
import {
|
||||||
eSendEvent,
|
eSendEvent,
|
||||||
eSubscribeEvent,
|
eSubscribeEvent,
|
||||||
eUnSubscribeEvent,
|
eUnSubscribeEvent
|
||||||
} from '../../services/EventManager';
|
} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import {InteractionManager} from '../../utils';
|
import { InteractionManager } from '../../utils';
|
||||||
import {db} from '../../utils/DB';
|
import { db } from '../../utils/DB';
|
||||||
import {
|
import {
|
||||||
eOnNewTopicAdded,
|
eOnNewTopicAdded,
|
||||||
eOpenAddNotebookDialog,
|
eOpenAddNotebookDialog,
|
||||||
eOpenAddTopicDialog,
|
eOpenAddTopicDialog,
|
||||||
eScrollEvent,
|
eScrollEvent
|
||||||
} from '../../utils/Events';
|
} from '../../utils/Events';
|
||||||
import {sleep} from '../../utils/TimeUtils';
|
|
||||||
|
|
||||||
export const Notebook = ({route, navigation}) => {
|
export const Notebook = ({route, navigation}) => {
|
||||||
const [topics, setTopics] = useState(route.params.notebook.topics);
|
const [topics, setTopics] = useState(route.params.notebook.topics);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
let params = route.params;
|
let params = route.params;
|
||||||
let pageIsLoaded = false;
|
let pageIsLoaded = false;
|
||||||
|
|
||||||
let ranAfterInteractions = false;
|
let ranAfterInteractions = false;
|
||||||
|
|
||||||
const runAfterInteractions = (time = 150) => {
|
const runAfterInteractions = (time = 400) => {
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
let notebook = db.notebooks.notebook(params.notebook?.id).data;
|
let notebook = db.notebooks.notebook(params.notebook?.id).data;
|
||||||
params.notebook = notebook;
|
params.notebook = notebook;
|
||||||
@@ -36,14 +37,14 @@ export const Notebook = ({route, navigation}) => {
|
|||||||
if (loading) {
|
if (loading) {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
},10)
|
}, 10);
|
||||||
Navigation.routeNeedsUpdate('Notebook', () => {
|
Navigation.routeNeedsUpdate('Notebook', () => {
|
||||||
onLoad();
|
onLoad();
|
||||||
});
|
});
|
||||||
eSendEvent(eScrollEvent, {name: params.title, type: 'in'});
|
eSendEvent(eScrollEvent, {name: params.title, type: 'in'});
|
||||||
if (params.menu) {
|
if (params.menu) {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
animationEnabled: false,
|
animationEnabled: true,
|
||||||
gestureEnabled: false,
|
gestureEnabled: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -56,13 +57,13 @@ export const Notebook = ({route, navigation}) => {
|
|||||||
ranAfterInteractions = false;
|
ranAfterInteractions = false;
|
||||||
}, time);
|
}, time);
|
||||||
};
|
};
|
||||||
const onLoad = (data) => {
|
const onLoad = data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
params = data;
|
params = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
runAfterInteractions(data ? 150 : 1);
|
runAfterInteractions(data ? 400 : 1);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -125,12 +126,22 @@ export const Notebook = ({route, navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="Notebook" />
|
||||||
|
<Header
|
||||||
|
title={params.title}
|
||||||
|
isBack={!params.menu}
|
||||||
|
screen="Notebook"
|
||||||
|
action={_onPressBottomButton}
|
||||||
|
/>
|
||||||
|
</ContainerTopSection>
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={topics}
|
listData={topics}
|
||||||
type="topics"
|
type="topics"
|
||||||
refreshCallback={() => {
|
refreshCallback={() => {
|
||||||
onLoad();
|
onLoad();
|
||||||
}}
|
}}
|
||||||
|
screen="Notebook"
|
||||||
headerProps={{
|
headerProps={{
|
||||||
heading: params.title,
|
heading: params.title,
|
||||||
paragraph: 'Edit notebook',
|
paragraph: 'Edit notebook',
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
import React, {useCallback, useEffect, useState} from 'react';
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
import {Platform} from 'react-native';
|
import {Platform} from 'react-native';
|
||||||
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
|
import {Header} from '../../components/Header';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
@@ -32,7 +35,7 @@ export const Notes = ({route, navigation}) => {
|
|||||||
let pageIsLoaded = false;
|
let pageIsLoaded = false;
|
||||||
let ranAfterInteractions = false;
|
let ranAfterInteractions = false;
|
||||||
|
|
||||||
const runAfterInteractions = (time = 150) => {
|
const runAfterInteractions = (time = 400) => {
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
Navigation.routeNeedsUpdate('NotesPage', () => {
|
Navigation.routeNeedsUpdate('NotesPage', () => {
|
||||||
init();
|
init();
|
||||||
@@ -61,7 +64,7 @@ export const Notes = ({route, navigation}) => {
|
|||||||
}
|
}
|
||||||
if (params.menu) {
|
if (params.menu) {
|
||||||
navigation.setOptions({
|
navigation.setOptions({
|
||||||
animationEnabled: false,
|
animationEnabled: true,
|
||||||
gestureEnabled: false,
|
gestureEnabled: false,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@@ -128,7 +131,7 @@ export const Notes = ({route, navigation}) => {
|
|||||||
setActionAfterFirstSave();
|
setActionAfterFirstSave();
|
||||||
if (!ranAfterInteractions) {
|
if (!ranAfterInteractions) {
|
||||||
ranAfterInteractions = true;
|
ranAfterInteractions = true;
|
||||||
runAfterInteractions(data ? 150 : 1);
|
runAfterInteractions(data ? 400 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pageIsLoaded) {
|
if (!pageIsLoaded) {
|
||||||
@@ -257,9 +260,19 @@ export const Notes = ({route, navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="NotesPage" />
|
||||||
|
<Header
|
||||||
|
title={headerProps.heading}
|
||||||
|
isBack={!params.menu}
|
||||||
|
screen="NotesPage"
|
||||||
|
action={_onPressBottomButton}
|
||||||
|
/>
|
||||||
|
</ContainerTopSection>
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={notes}
|
listData={notes}
|
||||||
type="notes"
|
type="notes"
|
||||||
|
screen="NotesPage"
|
||||||
refreshCallback={_refreshCallback}
|
refreshCallback={_refreshCallback}
|
||||||
headerProps={headerProps}
|
headerProps={headerProps}
|
||||||
loading={loading || localLoad}
|
loading={loading || localLoad}
|
||||||
|
|||||||
@@ -1,4 +1,7 @@
|
|||||||
import React, {useCallback, useEffect} from 'react';
|
import React, {useCallback, useEffect} from 'react';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
|
import {Header} from '../../components/Header';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
@@ -48,13 +51,16 @@ export const Search = ({route, navigation}) => {
|
|||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="Search" />
|
||||||
|
<Header title="Search" isBack={true} screen="Search" />
|
||||||
|
</ContainerTopSection>
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={searchResults}
|
listData={searchResults}
|
||||||
type="search"
|
type="search"
|
||||||
|
screen="Search"
|
||||||
focused={() => navigation.isFocused()}
|
focused={() => navigation.isFocused()}
|
||||||
placeholderText={`Notes you write appear here`}
|
placeholderText={`Notes you write appear here`}
|
||||||
jumpToDialog={true}
|
jumpToDialog={true}
|
||||||
@@ -68,7 +74,7 @@ export const Search = ({route, navigation}) => {
|
|||||||
SearchService.getSearchInformation().title
|
SearchService.getSearchInformation().title
|
||||||
}`,
|
}`,
|
||||||
button: null,
|
button: null,
|
||||||
loading:"Searching..."
|
loading: 'Searching...',
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
import React, {createRef, useCallback, useEffect, useState} from 'react';
|
import React, {createRef, useCallback, useEffect, useState} from 'react';
|
||||||
import {Linking} from 'react-native';
|
|
||||||
import {
|
import {
|
||||||
Appearance,
|
Appearance,
|
||||||
InteractionManager,
|
Linking,
|
||||||
Platform,
|
Platform,
|
||||||
ScrollView,
|
ScrollView,
|
||||||
TouchableOpacity,
|
TouchableOpacity,
|
||||||
@@ -13,10 +12,12 @@ import Menu, {MenuItem} from 'react-native-reanimated-material-menu';
|
|||||||
import AnimatedProgress from 'react-native-reanimated-progress-bar';
|
import AnimatedProgress from 'react-native-reanimated-progress-bar';
|
||||||
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
|
||||||
import {Button} from '../../components/Button';
|
import {Button} from '../../components/Button';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
import BaseDialog from '../../components/Dialog/base-dialog';
|
import BaseDialog from '../../components/Dialog/base-dialog';
|
||||||
import DialogButtons from '../../components/Dialog/dialog-buttons';
|
import DialogButtons from '../../components/Dialog/dialog-buttons';
|
||||||
import DialogContainer from '../../components/Dialog/dialog-container';
|
import DialogContainer from '../../components/Dialog/dialog-container';
|
||||||
import DialogHeader from '../../components/Dialog/dialog-header';
|
import DialogHeader from '../../components/Dialog/dialog-header';
|
||||||
|
import {Header as TopHeader} from '../../components/Header/index';
|
||||||
import Input from '../../components/Input';
|
import Input from '../../components/Input';
|
||||||
import {PressableButton} from '../../components/PressableButton';
|
import {PressableButton} from '../../components/PressableButton';
|
||||||
import Seperator from '../../components/Seperator';
|
import Seperator from '../../components/Seperator';
|
||||||
@@ -42,10 +43,8 @@ import SettingsService from '../../services/SettingsService';
|
|||||||
import {
|
import {
|
||||||
AndroidModule,
|
AndroidModule,
|
||||||
APP_VERSION,
|
APP_VERSION,
|
||||||
dWidth,
|
InteractionManager,
|
||||||
getElevation,
|
|
||||||
MenuItemsList,
|
MenuItemsList,
|
||||||
setSetting,
|
|
||||||
SUBSCRIPTION_PROVIDER,
|
SUBSCRIPTION_PROVIDER,
|
||||||
SUBSCRIPTION_STATUS_STRINGS,
|
SUBSCRIPTION_STATUS_STRINGS,
|
||||||
} from '../../utils';
|
} from '../../utils';
|
||||||
@@ -75,7 +74,7 @@ import {sleep, timeConverter} from '../../utils/TimeUtils';
|
|||||||
|
|
||||||
let menuRef = createRef();
|
let menuRef = createRef();
|
||||||
|
|
||||||
const format = (ver) => {
|
const format = ver => {
|
||||||
let parts = ver.toString().split('');
|
let parts = ver.toString().split('');
|
||||||
return `v${parts[0]}.${parts[1]}.${parts[2]}${
|
return `v${parts[0]}.${parts[1]}.${parts[2]}${
|
||||||
parts[3] === '0' ? '' : parts[3]
|
parts[3] === '0' ? '' : parts[3]
|
||||||
@@ -86,20 +85,11 @@ export const Settings = ({navigation}) => {
|
|||||||
const [state, dispatch] = useTracked();
|
const [state, dispatch] = useTracked();
|
||||||
const {colors} = state;
|
const {colors} = state;
|
||||||
const [version, setVersion] = useState(null);
|
const [version, setVersion] = useState(null);
|
||||||
|
const [loading, setLoading] = useState(true);
|
||||||
let pageIsLoaded = false;
|
let pageIsLoaded = false;
|
||||||
|
|
||||||
const onFocus = useCallback(() => {
|
const onFocus = useCallback(() => {
|
||||||
eSendEvent(eScrollEvent, {name: 'Settings', type: 'in'});
|
eSendEvent(eScrollEvent, {name: 'Settings', type: 'in'});
|
||||||
if (DDS.isLargeTablet()) {
|
|
||||||
dispatch({
|
|
||||||
type: Actions.CONTAINER_BOTTOM_BUTTON,
|
|
||||||
state: {
|
|
||||||
onPress: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
eSendEvent(eUpdateSearchState, {
|
eSendEvent(eUpdateSearchState, {
|
||||||
placeholder: '',
|
placeholder: '',
|
||||||
data: [],
|
data: [],
|
||||||
@@ -125,13 +115,16 @@ export const Settings = ({navigation}) => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
navigation.addListener('focus', onFocus);
|
InteractionManager.runAfterInteractions(() => {
|
||||||
db.version()
|
setLoading(false);
|
||||||
.then((ver) => {
|
navigation.addListener('focus', onFocus);
|
||||||
console.log(ver, 'VERSION');
|
db.version()
|
||||||
setVersion(ver);
|
.then(ver => {
|
||||||
})
|
console.log(ver, 'VERSION');
|
||||||
.catch((e) => console.log(e, 'VER'));
|
setVersion(ver);
|
||||||
|
})
|
||||||
|
.catch(e => console.log(e, 'VER'));
|
||||||
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
pageIsLoaded = false;
|
pageIsLoaded = false;
|
||||||
@@ -243,47 +236,61 @@ export const Settings = ({navigation}) => {
|
|||||||
];
|
];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View
|
<>
|
||||||
style={{
|
<ContainerTopSection>
|
||||||
height: '100%',
|
<TopHeader title="Settings" isBack={false} screen="Settings" />
|
||||||
backgroundColor: colors.bg,
|
</ContainerTopSection>
|
||||||
}}>
|
<View
|
||||||
<ScrollView
|
|
||||||
onScroll={(e) =>
|
|
||||||
eSendEvent(eScrollEvent, e.nativeEvent.contentOffset.y)
|
|
||||||
}
|
|
||||||
scrollEventThrottle={1}
|
|
||||||
style={{
|
style={{
|
||||||
paddingHorizontal: 0,
|
height: '100%',
|
||||||
|
backgroundColor: colors.bg,
|
||||||
}}>
|
}}>
|
||||||
{!DDS.isLargeTablet() && (
|
<ScrollView
|
||||||
<Header title="Settings" type="settings" messageCard={false} />
|
onScroll={e =>
|
||||||
)}
|
eSendEvent(eScrollEvent, {
|
||||||
<SettingsUserSection />
|
y:e.nativeEvent.contentOffset.y,
|
||||||
<SettingsAppearanceSection />
|
screen:"Settings"
|
||||||
<SettingsPrivacyAndSecurity />
|
})
|
||||||
<SettingsBackupAndRestore />
|
}
|
||||||
|
scrollEventThrottle={1}
|
||||||
<SectionHeader title="Other" />
|
|
||||||
|
|
||||||
{otherItems.map((item) => (
|
|
||||||
<CustomButton
|
|
||||||
key={item.name}
|
|
||||||
title={item.name}
|
|
||||||
tagline={item.desc}
|
|
||||||
onPress={item.func}
|
|
||||||
/>
|
|
||||||
))}
|
|
||||||
|
|
||||||
<AccoutLogoutSection />
|
|
||||||
|
|
||||||
<View
|
|
||||||
style={{
|
style={{
|
||||||
height: 400,
|
paddingHorizontal: 0,
|
||||||
}}
|
}}>
|
||||||
/>
|
{!DDS.isLargeTablet() && (
|
||||||
</ScrollView>
|
<Header title="Settings" type="settings" messageCard={false} />
|
||||||
</View>
|
)}
|
||||||
|
|
||||||
|
<SettingsUserSection />
|
||||||
|
<SettingsAppearanceSection />
|
||||||
|
|
||||||
|
{!loading && (
|
||||||
|
<>
|
||||||
|
<SettingsPrivacyAndSecurity />
|
||||||
|
<SettingsBackupAndRestore />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<SectionHeader title="Other" />
|
||||||
|
|
||||||
|
{otherItems.map(item => (
|
||||||
|
<CustomButton
|
||||||
|
key={item.name}
|
||||||
|
title={item.name}
|
||||||
|
tagline={item.desc}
|
||||||
|
onPress={item.func}
|
||||||
|
/>
|
||||||
|
))}
|
||||||
|
|
||||||
|
<AccoutLogoutSection />
|
||||||
|
|
||||||
|
<View
|
||||||
|
style={{
|
||||||
|
height: 400,
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</ScrollView>
|
||||||
|
</View>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -386,7 +393,7 @@ const AccoutLogoutSection = () => {
|
|||||||
|
|
||||||
<Input
|
<Input
|
||||||
placeholder="Enter account password"
|
placeholder="Enter account password"
|
||||||
onChangeText={(v) => {
|
onChangeText={v => {
|
||||||
passwordValue = v;
|
passwordValue = v;
|
||||||
}}
|
}}
|
||||||
secureTextEntry={true}
|
secureTextEntry={true}
|
||||||
@@ -543,7 +550,7 @@ const SettingsUserSection = () => {
|
|||||||
type: 5,
|
type: 5,
|
||||||
},
|
},
|
||||||
}; */
|
}; */
|
||||||
const getTimeLeft = (t2) => {
|
const getTimeLeft = t2 => {
|
||||||
let d1 = new Date(Date.now());
|
let d1 = new Date(Date.now());
|
||||||
let d2 = new Date(t2);
|
let d2 = new Date(t2);
|
||||||
let diff = d2.getTime() - d1.getTime();
|
let diff = d2.getTime() - d1.getTime();
|
||||||
@@ -816,7 +823,7 @@ const SettingsUserSection = () => {
|
|||||||
},
|
},
|
||||||
desc: 'Setup a new password for your account.',
|
desc: 'Setup a new password for your account.',
|
||||||
},
|
},
|
||||||
].map((item) => (
|
].map(item => (
|
||||||
<CustomButton
|
<CustomButton
|
||||||
key={item.name}
|
key={item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
@@ -920,7 +927,7 @@ const SettingsAppearanceSection = () => {
|
|||||||
'#FF1744',
|
'#FF1744',
|
||||||
'#B71C1C',
|
'#B71C1C',
|
||||||
'#ffadad',
|
'#ffadad',
|
||||||
].map((item) => (
|
].map(item => (
|
||||||
<PressableButton
|
<PressableButton
|
||||||
key={item}
|
key={item}
|
||||||
customColor={
|
customColor={
|
||||||
@@ -1078,7 +1085,7 @@ const SettingsPrivacyAndSecurity = () => {
|
|||||||
|
|
||||||
const checkVaultStatus = useCallback(() => {
|
const checkVaultStatus = useCallback(() => {
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
db.vault.exists().then(async (r) => {
|
db.vault.exists().then(async r => {
|
||||||
let available = await BiometricService.isBiometryAvailable();
|
let available = await BiometricService.isBiometryAvailable();
|
||||||
let fingerprint = await BiometricService.hasInternetCredentials();
|
let fingerprint = await BiometricService.hasInternetCredentials();
|
||||||
|
|
||||||
@@ -1134,7 +1141,7 @@ const SettingsPrivacyAndSecurity = () => {
|
|||||||
paragraph="Select the level of security you want to enable."
|
paragraph="Select the level of security you want to enable."
|
||||||
/>
|
/>
|
||||||
<Seperator />
|
<Seperator />
|
||||||
{modes.map((item) => (
|
{modes.map(item => (
|
||||||
<PressableButton
|
<PressableButton
|
||||||
type={
|
type={
|
||||||
settings.appLockMode === item.value ? 'accent' : 'transparent'
|
settings.appLockMode === item.value ? 'accent' : 'transparent'
|
||||||
@@ -1316,7 +1323,7 @@ const SettingsBackupAndRestore = () => {
|
|||||||
<>
|
<>
|
||||||
<SectionHeader title="Backup & restore" />
|
<SectionHeader title="Backup & restore" />
|
||||||
|
|
||||||
{backupItemsList.map((item) => (
|
{backupItemsList.map(item => (
|
||||||
<CustomButton
|
<CustomButton
|
||||||
key={item.name}
|
key={item.name}
|
||||||
title={item.name}
|
title={item.name}
|
||||||
@@ -1373,7 +1380,7 @@ const SettingsBackupAndRestore = () => {
|
|||||||
title: 'Weekly',
|
title: 'Weekly',
|
||||||
value: 'weekly',
|
value: 'weekly',
|
||||||
},
|
},
|
||||||
].map((item) => (
|
].map(item => (
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
activeOpacity={1}
|
activeOpacity={1}
|
||||||
onPress={async () => {
|
onPress={async () => {
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import React, {useCallback, useEffect, useState} from 'react';
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
|
import {Header} from '../../components/Header';
|
||||||
import {Placeholder} from '../../components/ListPlaceholders';
|
import {Placeholder} from '../../components/ListPlaceholders';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
@@ -7,7 +10,7 @@ import {DDS} from '../../services/DeviceDetection';
|
|||||||
import {eSendEvent} from '../../services/EventManager';
|
import {eSendEvent} from '../../services/EventManager';
|
||||||
import Navigation from '../../services/Navigation';
|
import Navigation from '../../services/Navigation';
|
||||||
import SearchService from '../../services/SearchService';
|
import SearchService from '../../services/SearchService';
|
||||||
import { InteractionManager } from '../../utils';
|
import {InteractionManager} from '../../utils';
|
||||||
import {eScrollEvent} from '../../utils/Events';
|
import {eScrollEvent} from '../../utils/Events';
|
||||||
|
|
||||||
export const Tags = ({route, navigation}) => {
|
export const Tags = ({route, navigation}) => {
|
||||||
@@ -17,7 +20,6 @@ export const Tags = ({route, navigation}) => {
|
|||||||
let pageIsLoaded = false;
|
let pageIsLoaded = false;
|
||||||
|
|
||||||
let ranAfterInteractions = false;
|
let ranAfterInteractions = false;
|
||||||
|
|
||||||
|
|
||||||
const runAfterInteractions = () => {
|
const runAfterInteractions = () => {
|
||||||
InteractionManager.runAfterInteractions(() => {
|
InteractionManager.runAfterInteractions(() => {
|
||||||
@@ -25,33 +27,23 @@ export const Tags = ({route, navigation}) => {
|
|||||||
setLoading(false);
|
setLoading(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Navigation.routeNeedsUpdate('Tags',() => {
|
Navigation.routeNeedsUpdate('Tags', () => {
|
||||||
dispatch({type:Actions.TAGS})
|
dispatch({type: Actions.TAGS});
|
||||||
})
|
});
|
||||||
|
|
||||||
eSendEvent(eScrollEvent, {name: 'Tags', type: 'in'});
|
eSendEvent(eScrollEvent, {name: 'Tags', type: 'in'});
|
||||||
if (DDS.isLargeTablet()) {
|
|
||||||
dispatch({
|
|
||||||
type: Actions.CONTAINER_BOTTOM_BUTTON,
|
|
||||||
state: {
|
|
||||||
onPress: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateSearch();
|
updateSearch();
|
||||||
ranAfterInteractions = false;
|
ranAfterInteractions = false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const onFocus = useCallback(() => {
|
const onFocus = useCallback(() => {
|
||||||
if (!ranAfterInteractions) {
|
if (!ranAfterInteractions) {
|
||||||
|
|
||||||
ranAfterInteractions = true;
|
ranAfterInteractions = true;
|
||||||
runAfterInteractions();
|
runAfterInteractions();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pageIsLoaded) {
|
if (!pageIsLoaded) {
|
||||||
pageIsLoaded = true;
|
pageIsLoaded = true;
|
||||||
return;
|
return;
|
||||||
@@ -75,7 +67,7 @@ export const Tags = ({route, navigation}) => {
|
|||||||
}
|
}
|
||||||
navigation.addListener('focus', onFocus);
|
navigation.addListener('focus', onFocus);
|
||||||
return () => {
|
return () => {
|
||||||
pageIsLoaded = false;
|
pageIsLoaded = false;
|
||||||
ranAfterInteractions = false;
|
ranAfterInteractions = false;
|
||||||
eSendEvent(eScrollEvent, {name: 'Tags', type: 'back'});
|
eSendEvent(eScrollEvent, {name: 'Tags', type: 'back'});
|
||||||
navigation.removeListener('focus', onFocus);
|
navigation.removeListener('focus', onFocus);
|
||||||
@@ -93,28 +85,35 @@ export const Tags = ({route, navigation}) => {
|
|||||||
placeholder: 'Search in tags',
|
placeholder: 'Search in tags',
|
||||||
data: tags,
|
data: tags,
|
||||||
type: 'tags',
|
type: 'tags',
|
||||||
title:"Tags"
|
title: 'Tags',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SimpleList
|
<>
|
||||||
listData={tags}
|
<ContainerTopSection>
|
||||||
type="tags"
|
<SelectionHeader screen="Tags" />
|
||||||
headerProps={{
|
<Header title="Tags" isBack={false} screen="Tags" />
|
||||||
heading: 'Tags',
|
</ContainerTopSection>
|
||||||
}}
|
<SimpleList
|
||||||
loading={loading}
|
listData={tags}
|
||||||
focused={() => navigation.isFocused()}
|
type="tags"
|
||||||
placeholderData={{
|
headerProps={{
|
||||||
heading: 'Your tags',
|
heading: 'Tags',
|
||||||
paragraph: 'You have not created any tags for your notes yet.',
|
}}
|
||||||
button: null,
|
screen="Tags"
|
||||||
loading: 'Loading your tags.',
|
loading={loading}
|
||||||
}}
|
focused={() => navigation.isFocused()}
|
||||||
placeholder={<Placeholder type="tags" />}
|
placeholderData={{
|
||||||
placeholderText="Tags added to notes appear here"
|
heading: 'Your tags',
|
||||||
/>
|
paragraph: 'You have not created any tags for your notes yet.',
|
||||||
|
button: null,
|
||||||
|
loading: 'Loading your tags.',
|
||||||
|
}}
|
||||||
|
placeholder={<Placeholder type="tags" />}
|
||||||
|
placeholderText="Tags added to notes appear here"
|
||||||
|
/>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
import React, {useCallback, useEffect, useState} from 'react';
|
import React, {useCallback, useEffect, useState} from 'react';
|
||||||
|
|
||||||
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
import {ContainerBottomButton} from '../../components/Container/ContainerBottomButton';
|
||||||
|
import {ContainerTopSection} from '../../components/Container/ContainerTopSection';
|
||||||
import {simpleDialogEvent} from '../../components/DialogManager/recievers';
|
import {simpleDialogEvent} from '../../components/DialogManager/recievers';
|
||||||
import {TEMPLATE_EMPTY_TRASH} from '../../components/DialogManager/Templates';
|
import {TEMPLATE_EMPTY_TRASH} from '../../components/DialogManager/Templates';
|
||||||
|
import {Header} from '../../components/Header';
|
||||||
import {Placeholder} from '../../components/ListPlaceholders';
|
import {Placeholder} from '../../components/ListPlaceholders';
|
||||||
|
import SelectionHeader from '../../components/SelectionHeader';
|
||||||
import SimpleList from '../../components/SimpleList';
|
import SimpleList from '../../components/SimpleList';
|
||||||
import {useTracked} from '../../provider';
|
import {useTracked} from '../../provider';
|
||||||
import {Actions} from '../../provider/Actions';
|
import {Actions} from '../../provider/Actions';
|
||||||
@@ -33,14 +36,7 @@ export const Trash = ({route, navigation}) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
eSendEvent(eScrollEvent, {name: 'Trash', type: 'in'});
|
eSendEvent(eScrollEvent, {name: 'Trash', type: 'in'});
|
||||||
if (DDS.isLargeTablet()) {
|
|
||||||
dispatch({
|
|
||||||
type: Actions.CONTAINER_BOTTOM_BUTTON,
|
|
||||||
state: {
|
|
||||||
onPress: null,
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
updateSearch();
|
updateSearch();
|
||||||
ranAfterInteractions = false;
|
ranAfterInteractions = false;
|
||||||
});
|
});
|
||||||
@@ -101,9 +97,19 @@ export const Trash = ({route, navigation}) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
<ContainerTopSection>
|
||||||
|
<SelectionHeader screen="Trash" />
|
||||||
|
<Header
|
||||||
|
title="Trash"
|
||||||
|
isBack={false}
|
||||||
|
screen="Trash"
|
||||||
|
action={_onPressBottomButton}
|
||||||
|
/>
|
||||||
|
</ContainerTopSection>
|
||||||
<SimpleList
|
<SimpleList
|
||||||
listData={trash}
|
listData={trash}
|
||||||
type="trash"
|
type="trash"
|
||||||
|
screen="Trash"
|
||||||
focused={() => navigation.isFocused()}
|
focused={() => navigation.isFocused()}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
placeholderData={{
|
placeholderData={{
|
||||||
|
|||||||
Reference in New Issue
Block a user