Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

improve app launch

ammarahm-edae6a92c0e27d
diff --git a/apps/mobile/App.js b/apps/mobile/App.js
index 26a77068b..fb456b9bb 100644
--- a/apps/mobile/App.js
+++ b/apps/mobile/App.js
@@ -4,16 +4,9 @@ import { SafeAreaProvider } from 'react-native-safe-area-context';
import AppLoader from './src/components/AppLoader';
import { RootView } from './src/navigation/RootView';
import { useTracked } from './src/provider';
-import {
- initialize, useSettingStore,
- useUserStore
-} from './src/provider/stores';
+import { initialize, useSettingStore, useUserStore } from './src/provider/stores';
import { DDS } from './src/services/DeviceDetection';
-import {
- eSendEvent,
- eSubscribeEvent,
- eUnSubscribeEvent
-} from './src/services/EventManager';
+import { eSendEvent, eSubscribeEvent, eUnSubscribeEvent } from './src/services/EventManager';
import Notifications from './src/services/Notifications';
import SettingsService from './src/services/SettingsService';
import { Tracker } from './src/utils';
@@ -21,20 +14,19 @@ import { db } from './src/utils/database';
import { eDispatchAction } from './src/utils/Events';
import { MMKV } from './src/utils/mmkv';
import { useAppEvents } from './src/utils/use-app-events';
-import RNBootSplash from "react-native-bootsplash";
let databaseHasLoaded = false;
const loadDatabase = async () => {
- RNBootSplash.hide({fade:true})
+ let requireIntro = await MMKV.getItem('introCompleted');
+ useSettingStore.getState().setIntroCompleted(requireIntro ? true : false);
await db.init();
Notifications.get();
await checkFirstLaunch();
};
async function checkFirstLaunch() {
- let requireIntro = await MMKV.getItem('introCompleted');
- useSettingStore.getState().setIntroCompleted(requireIntro ? true : false);
+ let requireIntro = useSettingStore.getState().isIntroCompleted;
if (!requireIntro) {
await MMKV.setItem(
'askForRating',
@@ -54,18 +46,10 @@ async function checkFirstLaunch() {
function checkOrientation() {
Orientation.getOrientation((e, r) => {
DDS.checkSmallTab(r);
+ useSettingStore.getState().setDimensions({ width: DDS.width, height: DDS.height });
useSettingStore
.getState()
- .setDimensions({width: DDS.width, height: DDS.height});
- useSettingStore
- .getState()
- .setDeviceMode(
- DDS.isLargeTablet()
- ? 'tablet'
- : DDS.isSmallTab
- ? 'smallTablet'
- : 'mobile'
- );
+ .setDeviceMode(DDS.isLargeTablet() ? 'tablet' : DDS.isSmallTab ? 'smallTablet' : 'mobile');
});
}
@@ -87,10 +71,7 @@ const App = () => {
(async () => {
try {
await SettingsService.init();
- if (
- SettingsService.get().appLockMode &&
- SettingsService.get().appLockMode !== 'none'
- ) {
+ if (SettingsService.get().appLockMode && SettingsService.get().appLockMode !== 'none') {
setVerifyUser(true);
}
await loadDatabase();
diff --git a/apps/mobile/src/components/AppLoader/index.js b/apps/mobile/src/components/AppLoader/index.js
index 9ac736126..ce39e191b 100644
--- a/apps/mobile/src/components/AppLoader/index.js
+++ b/apps/mobile/src/components/AppLoader/index.js
@@ -1,7 +1,8 @@
import React, { useEffect, useRef, useState } from 'react';
-import { Appearance, Linking, Platform, SafeAreaView, View } from 'react-native';
-import Animated, { Easing } from 'react-native-reanimated';
-import AnimatedProgress from 'react-native-reanimated-progress-bar';
+import { Appearance, NativeModules, Platform, SafeAreaView } from 'react-native';
+import RNBootSplash from 'react-native-bootsplash';
+import { checkVersion } from 'react-native-check-version';
+import Animated from 'react-native-reanimated';
import { useTracked } from '../../provider';
import {
useFavoriteStore,
@@ -20,11 +21,12 @@ import {
presentSheet,
ToastEvent
} from '../../services/EventManager';
+import { setRateAppMessage } from '../../services/Message';
import PremiumService from '../../services/PremiumService';
-import { editing, STORE_LINK } from '../../utils';
-import { COLOR_SCHEME_DARK, COLOR_SCHEME_LIGHT } from '../../utils/Colors';
+import { editing } from '../../utils';
+import { COLOR_SCHEME_DARK } from '../../utils/Colors';
import { db } from '../../utils/database';
-import { eOpenAnnouncementDialog, eOpenLoginDialog, eOpenRateDialog } from '../../utils/Events';
+import { eOpenAnnouncementDialog, eOpenLoginDialog } from '../../utils/Events';
import { MMKV } from '../../utils/mmkv';
import { tabBarRef } from '../../utils/Refs';
import { SIZE } from '../../utils/SizeUtils';
@@ -36,18 +38,14 @@ import Seperator from '../Seperator';
import SplashScreen from '../SplashScreen';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
-import { checkVersion } from 'react-native-check-version';
-import { Placeholder, SvgToPngView } from '../ListPlaceholders';
import { Update } from '../Update';
-import { setRateAppMessage } from '../../services/Message';
let passwordValue = null;
let didVerifyUser = false;
-const opacityV = new Animated.Value(1);
+
const AppLoader = ({ onLoad }) => {
const [state] = useTracked();
const colors = state.colors;
- const [loading, setLoading] = useState(true);
const setNotes = useNoteStore(state => state.setNotes);
const setFavorites = useFavoriteStore(state => state.setFavorites);
const _setLoading = useNoteStore(state => state.setLoading);
@@ -56,35 +54,47 @@ const AppLoader = ({ onLoad }) => {
const verifyUser = useUserStore(state => state.verifyUser);
const setVerifyUser = useUserStore(state => state.setVerifyUser);
const deviceMode = useSettingStore(state => state.deviceMode);
- const isIntroCompleted = useSettingStore(state => state.isIntroCompleted);
const pwdInput = useRef();
+ const [requireIntro, setRequireIntro] = useState({
+ updated: false,
+ value: false
+ });
- const load = async value => {
- if (verifyUser) return;
- if (value === 'hide') {
- setLoading(true);
- opacityV.setValue(1);
+ const load = async () => {
+ if (verifyUser) {
return;
}
await restoreEditorState();
- if (value === 'show') {
- opacityV.setValue(0);
- setLoading(false);
- return;
- }
- Animated.timing(opacityV, {
- toValue: 0,
- duration: 100,
- easing: Easing.out(Easing.ease)
- }).start();
- setLoading(false);
await db.notes.init();
setNotes();
setFavorites();
_setLoading(false);
};
+ const hideSplashScreen = async () => {
+ await sleep(requireIntro.value ? 500 : 0);
+ await RNBootSplash.hide({ fade: true });
+ setTimeout(async () => {
+ NativeModules.RNBars.setStatusBarStyle(!colors.night ? 'light-content' : 'dark-content');
+ await sleep(5);
+ NativeModules.RNBars.setStatusBarStyle(colors.night ? 'light-content' : 'dark-content');
+ }, 500);
+ };
+
useEffect(() => {
+ if (requireIntro.updated) {
+ hideSplashScreen();
+ }
+ }, [requireIntro, verifyUser]);
+
+ useEffect(() => {
+ (async () => {
+ let introCompleted = await MMKV.getItem('introCompleted');
+ setRequireIntro({
+ updated: true,
+ value: !introCompleted
+ });
+ })();
if (!_loading) {
(async () => {
await sleep(500);
@@ -105,7 +115,7 @@ const AppLoader = ({ onLoad }) => {
if (await PremiumService.getRemainingTrialDaysStatus()) return;
await useMessageStore.getState().setAnnouncement();
- if (isIntroCompleted) {
+ if (!requireIntro) {
let dialogs = useMessageStore.getState().dialogs;
if (dialogs.length > 0) {
eSendEvent(eOpenAnnouncementDialog, dialogs[0]);
@@ -119,7 +129,6 @@ const AppLoader = ({ onLoad }) => {
try {
const version = await checkVersion();
if (!version.needsUpdate) return false;
-
presentSheet({
component: ref => <Update version={version} fwdRef={ref} />
});
@@ -228,7 +237,7 @@ const AppLoader = ({ onLoad }) => {
} catch (e) {}
};
- return loading ? (
+ return verifyUser ? (
<Animated.View
style={{
backgroundColor: Appearance.getColorScheme() === 'dark' ? COLOR_SCHEME_DARK.bg : colors.bg,
@@ -247,105 +256,82 @@ const AppLoader = ({ onLoad }) => {
height: '100%',
justifyContent: 'center',
alignItems: 'center',
- borderRadius: 10,
- opacity: opacityV
+ borderRadius: 10
}}
>
- {verifyUser ? (
- <SafeAreaView
+ <SafeAreaView
+ style={{
+ flex: 1,
+ justifyContent: 'center',
+ width: deviceMode !== 'mobile' ? '50%' : Platform.OS == 'ios' ? '95%' : '100%',
+ paddingHorizontal: 12
+ }}
+ >
+ <Heading
style={{
- flex: 1,
- justifyContent: 'center',
- width: deviceMode !== 'mobile' ? '50%' : Platform.OS == 'ios' ? '95%' : '100%',
- paddingHorizontal: 12
+ alignSelf: 'center'
}}
>
- <Heading
- style={{
- alignSelf: 'center'
- }}
- >
- Verify your identity
- </Heading>
+ Verify your identity
+ </Heading>
- {user ? (
- <>
- <Paragraph
- style={{
- alignSelf: 'center'
- }}
- >
- To keep your notes secure, please enter password of the account you are logged in
- to.
- </Paragraph>
- <Seperator />
- <Input
- fwdRef={pwdInput}
- secureTextEntry
- placeholder="Enter account password"
- onChangeText={v => (passwordValue = v)}
- onSubmit={onSubmit}
- />
- <Seperator half />
- <Button
- title="Unlock"
- type="accent"
- onPress={onSubmit}
- width="100%"
- height={50}
- fontSize={SIZE.md}
- />
- <Seperator />
- </>
- ) : (
- <>
- <Paragraph
- style={{
- alignSelf: 'center'
- }}
- >
- To keep your notes secure, please unlock app the with biometrics.
- </Paragraph>
- <Seperator />
- </>
- )}
+ {user ? (
+ <>
+ <Paragraph
+ style={{
+ alignSelf: 'center'
+ }}
+ >
+ To keep your notes secure, please enter password of the account you are logged in
+ to.
+ </Paragraph>
+ <Seperator />
+ <Input
+ fwdRef={pwdInput}
+ secureTextEntry
+ placeholder="Enter account password"
+ onChangeText={v => (passwordValue = v)}
+ onSubmit={onSubmit}
+ />
+ <Seperator half />
+ <Button
+ title="Unlock"
+ type="accent"
+ onPress={onSubmit}
+ width="100%"
+ height={50}
+ fontSize={SIZE.md}
+ />
+ <Seperator />
+ </>
+ ) : (
+ <>
+ <Paragraph
+ style={{
+ alignSelf: 'center'
+ }}
+ >
+ To keep your notes secure, please unlock app the with biometrics.
+ </Paragraph>
+ <Seperator />
+ </>
+ )}
- <Button
- title="Unlock with Biometrics"
- width="100%"
- height={50}
- onPress={onUnlockBiometrics}
- icon={'fingerprint'}
- type={!user ? 'accent' : 'transparent'}
- fontSize={SIZE.md}
- />
- </SafeAreaView>
- ) : (
- <View
- style={{
- height: 10,
- flexDirection: 'row',
- width: 100
- }}
- >
- <AnimatedProgress
- style={{
- backgroundColor:
- Appearance.getColorScheme() === 'dark'
- ? COLOR_SCHEME_DARK.nav
- : COLOR_SCHEME_LIGHT.nav
- }}
- fill={colors.accent}
- current={4}
- total={4}
- />
- </View>
- )}
+ <Button
+ title="Unlock with Biometrics"
+ width="100%"
+ height={50}
+ onPress={onUnlockBiometrics}
+ icon={'fingerprint'}
+ type={!user ? 'accent' : 'transparent'}
+ fontSize={SIZE.md}
+ />
+ </SafeAreaView>
</Animated.View>
</Animated.View>
- ) : (
+ ) : requireIntro.value && !_loading ? (
<SplashScreen />
- );
+ ) : null;
};
export default AppLoader;
diff --git a/apps/mobile/src/components/SplashScreen/index.js b/apps/mobile/src/components/SplashScreen/index.js
index fe1338703..3b43ff88e 100644
--- a/apps/mobile/src/components/SplashScreen/index.js
+++ b/apps/mobile/src/components/SplashScreen/index.js
@@ -1,4 +1,4 @@
-import React, { useEffect, useRef, useState } from 'react';
+import React, { useEffect } from 'react';
import { Dimensions, Image, View } from 'react-native';
import Animated, { Easing, timing, useValue } from 'react-native-reanimated';
import { SafeAreaView } from 'react-native-safe-area-context';
@@ -11,7 +11,7 @@ import { sleep } from '../../utils/TimeUtils';
import umami from '../../utils/umami';
import { Button } from '../Button';
import { SvgToPngView } from '../ListPlaceholders';
-import MovableView from '../Transitions/movableview';
+import { BouncingView } from '../Transitions/bouncing-view';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -22,10 +22,10 @@ const SVG_Z = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245.487 113.
const SplashScreen = () => {
const [state] = useTracked();
const { colors } = state;
- const isIntroCompleted = false; //useSettingStore(state => state.isIntroCompleted);
+ const isIntroCompleted = useSettingStore(state => state.isIntroCompleted);
const setIntroCompleted = useSettingStore(state => state.setIntroCompleted);
const opacity = useValue(0);
- const translateY = useValue(20);
+ const translateY = useValue(5);
const translateY2 = useValue(0);
useEffect(() => {
@@ -34,12 +34,12 @@ const SplashScreen = () => {
setTimeout(() => {
timing(opacity, {
toValue: 1,
- duration: 300,
+ duration: 600,
easing: Easing.in(Easing.ease)
}).start();
timing(translateY, {
toValue: 0,
- duration: 500,
+ duration: 1000,
easing: Easing.in(Easing.ease)
}).start();
}, 15);
@@ -80,12 +80,18 @@ const SplashScreen = () => {
marginTop: 25
}}
>
- <View
+ <Animated.View
style={{
width: '100%',
height: '100%',
justifyContent: 'center',
- alignItems: 'center'
+ alignItems: 'center',
+ opacity: opacity,
+ transform: [
+ {
+ translateY: translateY
+ }
+ ]
}}
>
<Image
@@ -149,20 +155,21 @@ const SplashScreen = () => {
/>
</View>
- <View
+ <BouncingView
style={{
position: 'absolute',
bottom: -100,
zIndex: -1
}}
+ duration={3000}
>
<SvgToPngView
width={Dimensions.get('window').width}
height={Dimensions.get('window').width}
src={SVG_Z}
/>
- </View>
- </View>
+ </BouncingView>
+ </Animated.View>
</SafeAreaView>
</Animated.View>
)
diff --git a/apps/mobile/src/navigation/RootView.js b/apps/mobile/src/navigation/RootView.js
index e5a5637e5..afed5295f 100644
--- a/apps/mobile/src/navigation/RootView.js
+++ b/apps/mobile/src/navigation/RootView.js
@@ -339,7 +339,7 @@ const NativeStack = React.memo(
backgroundColor: colors.bg
}}
>
- <StatusBar animated="true" barStyle={colors.night ? 'light-content' : 'dark-content'} />
+ <StatusBar animated={true} barStyle={colors.night ? 'light-content' : 'dark-content'} />
{deviceMode ? (
<CustomTabs
ref={tabBarRef}
diff --git a/apps/mobile/src/services/PremiumService.js b/apps/mobile/src/services/PremiumService.js
index 06464a719..c3e51e9ab 100644
--- a/apps/mobile/src/services/PremiumService.js
+++ b/apps/mobile/src/services/PremiumService.js
@@ -67,7 +67,7 @@ async function getProducts() {
}
function get() {
- if (__DEV__) return true;
+ // if (__DEV__) return true;
return SUBSCRIPTION_STATUS.BASIC !== premiumStatus;
}
diff --git a/apps/mobile/src/utils/Colors.js b/apps/mobile/src/utils/Colors.js
index 9b3a3a4ab..24ca50d08 100644
--- a/apps/mobile/src/utils/Colors.js
+++ b/apps/mobile/src/utils/Colors.js
@@ -2,6 +2,7 @@ import { eSendEvent } from '../services/EventManager';
import { eThemeUpdated } from './Events';
import { NativeModules, Platform, StatusBar } from 'react-native';
import { AndroidModule } from '.';
+import { StatusBar as Sbar } from 'react-native-bars';
export const ACCENT = {
color: '#008837',
@@ -106,6 +107,10 @@ export function setColorScheme(colors = COLOR_SCHEME, accent = ACCENT) {
COLOR_SCHEME = { ...colors, accent: accent.color, shade: accent.shade };
StatusBar.setBarStyle(COLOR_SCHEME.night ? 'light-content' : 'dark-content', true);
+ // Sbar.pushStackEntry({
+ // barStyle: COLOR_SCHEME.night ? 'light-content' : 'dark-content',
+ // animated: true
+ // });
if (Platform.OS === 'android') {
AndroidModule.setBackgroundColor(COLOR_SCHEME.bg);
@@ -126,6 +131,10 @@ export function setAccentColor(color) {
export function updateStatusBarColor() {
StatusBar.setBarStyle(COLOR_SCHEME.night ? 'light-content' : 'dark-content', true);
+ // Sbar.pushStackEntry({
+ // barStyle: COLOR_SCHEME.night ? 'light-content' : 'dark-content',
+ // animated: true
+ // });
if (Platform.OS === 'android') {
StatusBar.setBackgroundColor('transparent', true);
StatusBar.setTranslucent(true, true);
diff --git a/apps/mobile/src/utils/useAppEvents.js b/apps/mobile/src/utils/useAppEvents.js
index 4ff6bd5ed..c6f7e3b9f 100644
--- a/apps/mobile/src/utils/useAppEvents.js
+++ b/apps/mobile/src/utils/useAppEvents.js
@@ -423,11 +423,11 @@ export const useAppEvents = () => {
if (refValues.current?.prevState === 'background' && !refValues.current?.showingDialog) {
refValues.current.showingDialog = true;
refValues.current.prevState = 'active';
- eSendEvent('load_overlay', 'hide');
+ useUserStore.getState().setVerifyUser(true);
+
let result = await BiometricService.validateUser('Unlock to access your notes');
if (result) {
refValues.current.showingDialog = false;
- eSendEvent('load_overlay', 'show');
} else {
RNExitApp.exitApp();
return;
diff --git a/apps/mobile/src/views/Editor/useEditorTags.js b/apps/mobile/src/views/Editor/useEditorTags.js
index 50946f3ed..e263b726d 100644
--- a/apps/mobile/src/views/Editor/useEditorTags.js
+++ b/apps/mobile/src/views/Editor/useEditorTags.js
@@ -51,13 +51,13 @@ export const useEditorTags = () => {
load();
}, [noteTags]);
- const hideTagBar = `
- toggleNode(".tag-bar-parent","hide");
- clearNode(".tag-bar")`;
- const showTagBar = `
- toggleNode(".tag-bar-parent","show");
- clearNode(".tag-bar")`;
- const clearNode = `clearNode(".tag-bar")`;
+ // const hideTagBar = `
+ // toggleNode(".tag-bar-parent","hide");
+ // clearNode(".tag-bar")`;
+ // const showTagBar = `
+ // toggleNode(".tag-bar-parent","show");
+ // clearNode(".tag-bar")`;
+ // const clearNode = `clearNode(".tag-bar")`;
const renderTags = tags => `(function() {
clearNode(".tag-bar");
toggleNode(".tag-bar-parent","show")
diff --git a/apps/mobile/src/views/Favorites/index.js b/apps/mobile/src/views/Favorites/index.js
index b8f71844b..5aa64c040 100644
--- a/apps/mobile/src/views/Favorites/index.js
+++ b/apps/mobile/src/views/Favorites/index.js
@@ -4,17 +4,12 @@ import { Header } from '../../components/Header';
import { Placeholder } from '../../components/ListPlaceholders';
import SelectionHeader from '../../components/SelectionHeader';
import SimpleList from '../../components/SimpleList';
-import { useTracked } from '../../provider';
-import { Actions } from '../../provider/Actions';
import { useFavoriteStore, useNoteStore } from '../../provider/stores';
-import { DDS } from '../../services/DeviceDetection';
-import { eSendEvent } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import SearchService from '../../services/SearchService';
import { InteractionManager } from '../../utils';
-import { eScrollEvent } from '../../utils/Events';
-export const Favorites = ({ route, navigation }) => {
+export const Favorites = ({ navigation }) => {
const favorites = useFavoriteStore(state => state.favorites);
const setFavorites = useFavoriteStore(state => state.setFavorites);
const loading = useNoteStore(state => state.loading);
diff --git a/apps/mobile/src/views/Home/index.js b/apps/mobile/src/views/Home/index.js
index 6f57c69eb..47fc74f84 100755
--- a/apps/mobile/src/views/Home/index.js
+++ b/apps/mobile/src/views/Home/index.js
@@ -1,4 +1,5 @@
import React, { useCallback, useEffect } from 'react';
+import { StatusBar } from 'react-native-bars';
import { ContainerBottomButton } from '../../components/Container/ContainerBottomButton';
import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
import { Header } from '../../components/Header/index';
diff --git a/apps/mobile/src/views/Search/index.js b/apps/mobile/src/views/Search/index.js
index 6586aac3b..278331f92 100644
--- a/apps/mobile/src/views/Search/index.js
+++ b/apps/mobile/src/views/Search/index.js
@@ -2,16 +2,13 @@ import React, { useCallback, useEffect } from 'react';
import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
import SelectionHeader from '../../components/SelectionHeader';
import SimpleList from '../../components/SimpleList';
-import { useTracked } from '../../provider';
import { useSearchStore } from '../../provider/stores';
import SearchService from '../../services/SearchService';
import { inputRef } from '../../utils/Refs';
import { sleep } from '../../utils/TimeUtils';
import { SearchBar } from './search-bar';
-export const Search = ({ route, navigation }) => {
- const [state, dispatch] = useTracked();
-
+export const Search = ({ navigation }) => {
const searchResults = useSearchStore(state => state.searchResults);
const searching = useSearchStore(state => state.searching);
const searchStatus = useSearchStore(state => state.searchStatus);
diff --git a/apps/mobile/src/views/Settings/appearance.js b/apps/mobile/src/views/Settings/appearance.js
index 526dae71d..68f4d634b 100644
--- a/apps/mobile/src/views/Settings/appearance.js
+++ b/apps/mobile/src/views/Settings/appearance.js
@@ -80,12 +80,12 @@ const SettingsAppearanceSection = () => {
}
};
- const reduceAnimations = async () => {
- await SettingsService.set(
- 'reduceAnimations',
- SettingsService.get().reduceAnimations ? false : true
- );
- };
+ // const reduceAnimations = async () => {
+ // await SettingsService.set(
+ // 'reduceAnimations',
+ // SettingsService.get().reduceAnimations ? false : true
+ // );
+ // };
return (
<>
@@ -262,7 +262,7 @@ const SettingsAppearanceSection = () => {
offColor={colors.icon}
size="small"
animationSpeed={150}
- onToggle={async isOn => {
+ onToggle={async () => {
if (!colors.night) {
await MMKV.setStringAsync('theme', JSON.stringify({ night: true }));
changeColorScheme(COLOR_SCHEME_DARK);
@@ -305,7 +305,7 @@ const SettingsAppearanceSection = () => {
</TouchableOpacity>
}
>
- {MenuItemsList.slice(0, MenuItemsList.length - 1).map((item, index) => (
+ {MenuItemsList.slice(0, MenuItemsList.length - 1).map(item => (
<MenuItem
key={item.name}
onPress={async () => {
diff --git a/apps/mobile/src/views/Settings/button.js b/apps/mobile/src/views/Settings/button.js
index 5fbb698fc..81eab559d 100644
--- a/apps/mobile/src/views/Settings/button.js
+++ b/apps/mobile/src/views/Settings/button.js
@@ -5,14 +5,7 @@ import Paragraph from '../../components/Typography/Paragraph';
import { useTracked } from '../../provider';
import { SIZE } from '../../utils/SizeUtils';
-export const CustomButton = ({
- title,
- tagline,
- customComponent,
- onPress,
- maxWidth = '100%',
- color = null
-}) => {
+export const CustomButton = ({ title, tagline, customComponent, onPress, color = null }) => {
const [state] = useTracked();
const { colors } = state;
return (
diff --git a/apps/mobile/src/views/Settings/index.js b/apps/mobile/src/views/Settings/index.js
index 52af81bad..e57926505 100644
--- a/apps/mobile/src/views/Settings/index.js
+++ b/apps/mobile/src/views/Settings/index.js
@@ -1,5 +1,6 @@
import React, { useCallback, useEffect, useState } from 'react';
import { Linking, Platform, ScrollView, View } from 'react-native';
+import { APP_VERSION } from '../../../version';
import { Button as MButton } from '../../components/Button/index';
import { ContainerTopSection } from '../../components/Container/ContainerTopSection';
import { Issue } from '../../components/Github/issue';
@@ -7,11 +8,9 @@ import { Header as TopHeader } from '../../components/Header/index';
import Seperator from '../../components/Seperator';
import Paragraph from '../../components/Typography/Paragraph';
import { useTracked } from '../../provider';
-import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
+import { eSendEvent, presentSheet } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import { InteractionManager, STORE_LINK } from '../../utils';
-import { APP_VERSION } from '../../../version';
-import { db } from '../../utils/database';
import { eScrollEvent, eUpdateSearchState } from '../../utils/Events';
import { openLinkInBrowser } from '../../utils/functions';
import SettingsAppearanceSection from './appearance';
@@ -23,19 +22,16 @@ import AccoutLogoutSection from './logout';
import SettingsPrivacyAndSecurity from './privacy';
import SectionHeader from './section-header';
import SettingsUserSection from './user-section';
-import { Update } from '../../components/Update';
-import { checkVersion } from 'react-native-check-version';
const format = ver => {
let parts = ver.toString().split('');
-
return `v${parts[0]}.${parts[1]}.${parts[2]?.startsWith('0') ? parts[2]?.slice(1) : parts[2]}${
- parts[3] === '0' ? '' : parts[3]
+ !parts[3] || parts[2] === '0' ? '' : parts[3]
} `;
};
export const Settings = ({ navigation }) => {
- const [state, dispatch] = useTracked();
+ const [state] = useTracked();
const { colors } = state;
const [collapsed, setCollapsed] = useState(false);
diff --git a/apps/mobile/src/views/Settings/logout.js b/apps/mobile/src/views/Settings/logout.js
index 565991897..8146f24aa 100644
--- a/apps/mobile/src/views/Settings/logout.js
+++ b/apps/mobile/src/views/Settings/logout.js
@@ -1,15 +1,9 @@
-import React, { useRef, useState } from 'react';
+import React, { useState } from 'react';
import { View } from 'react-native';
import AnimatedProgress from 'react-native-reanimated-progress-bar';
import BaseDialog from '../../components/Dialog/base-dialog';
-import DialogButtons from '../../components/Dialog/dialog-buttons';
-import DialogContainer from '../../components/Dialog/dialog-container';
-import DialogHeader from '../../components/Dialog/dialog-header';
import { presentDialog } from '../../components/Dialog/functions';
-import Input from '../../components/Input';
import { PressableButton } from '../../components/PressableButton';
-import Seperator from '../../components/Seperator';
-import { Toast } from '../../components/Toast';
import Heading from '../../components/Typography/Heading';
import Paragraph from '../../components/Typography/Paragraph';
import { useTracked } from '../../provider';
@@ -22,11 +16,10 @@ import Storage from '../../utils/storage';
import { sleep } from '../../utils/TimeUtils';
const AccoutLogoutSection = () => {
- const [state, dispatch] = useTracked();
+ const [state] = useTracked();
const { colors } = state;
const user = useUserStore(state => state.user);
const [loading, setLoading] = useState(false);
- const passwordValue = useRef();
return !user ? null : (
<>
diff --git a/apps/mobile/src/views/Settings/usersection.js b/apps/mobile/src/views/Settings/usersection.js
index 889d9e799..3dbf41cd1 100644
--- a/apps/mobile/src/views/Settings/usersection.js
+++ b/apps/mobile/src/views/Settings/usersection.js
@@ -5,11 +5,10 @@ import * as RNIap from 'react-native-iap';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
import { Button } from '../../components/Button';
import Seperator from '../../components/Seperator';
-import { Card } from '../../components/SimpleList/card';
import Heading from '../../components/Typography/Heading';
import Paragraph from '../../components/Typography/Paragraph';
import { useTracked } from '../../provider';
-import { useMessageStore, useUserStore } from '../../provider/stores';
+import { useUserStore } from '../../provider/stores';
import { eSendEvent, presentSheet, ToastEvent } from '../../services/EventManager';
import PremiumService from '../../services/PremiumService';
import Sync from '../../services/Sync';
@@ -42,7 +41,6 @@ const SettingsUserSection = () => {
const { colors } = state;
const user = useUserStore(state => state.user);
- const messageBoardState = useMessageStore(state => state.message);
const subscriptionDaysLeft = user && getTimeLeft(parseInt(user.subscription?.expiry));
const isExpired = user && subscriptionDaysLeft.time < 0;
const expiryDate = dayjs(user?.subscription?.expiry).format('MMMM D, YYYY');
diff --git a/apps/mobile/src/views/Tags/index.js b/apps/mobile/src/views/Tags/index.js
index d97d4c1c8..3568af361 100644
--- a/apps/mobile/src/views/Tags/index.js
+++ b/apps/mobile/src/views/Tags/index.js
@@ -5,13 +5,11 @@ import { Placeholder } from '../../components/ListPlaceholders';
import SelectionHeader from '../../components/SelectionHeader';
import SimpleList from '../../components/SimpleList';
import { useTagStore } from '../../provider/stores';
-import { eSendEvent } from '../../services/EventManager';
import Navigation from '../../services/Navigation';
import SearchService from '../../services/SearchService';
import { InteractionManager } from '../../utils';
-import { eScrollEvent } from '../../utils/Events';
-export const Tags = ({ route, navigation }) => {
+export const Tags = ({ navigation }) => {
const tags = useTagStore(state => state.tags);
const setTags = useTagStore(state => state.setTags);
let ranAfterInteractions = false;
diff --git a/apps/mobile/src/views/Trash/index.js b/apps/mobile/src/views/Trash/index.js
index 2293c9df2..af3798d0a 100644
--- a/apps/mobile/src/views/Trash/index.js
+++ b/apps/mobile/src/views/Trash/index.js
@@ -13,7 +13,7 @@ import SearchService from '../../services/SearchService';
import { InteractionManager } from '../../utils';
import { db } from '../../utils/database';
-export const Trash = ({ route, navigation }) => {
+export const Trash = ({ navigation }) => {
const trash = useTrashStore(state => state.trash);
const setTrash = useTrashStore(state => state.setTrash);
let pageIsLoaded = false;