Skip to content

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

minor refactor

ammarahm-ed0925b2b59289
diff --git a/apps/mobile/src/components/LoginDialog/index.js b/apps/mobile/src/components/LoginDialog/index.js
index 97a7f3e98..c08303089 100644
--- a/apps/mobile/src/components/LoginDialog/index.js
+++ b/apps/mobile/src/components/LoginDialog/index.js
@@ -188,6 +188,7 @@ const LoginDialog = () => {
setMode(mode ? mode : MODES.login);
if (mode === MODES.sessionExpired) {
try {
+ console.log('TOKEN EXPIRED');
await db.user.tokenManager.getToken();
await MMKV.removeItem('loginSessionHasExpired');
Sync.run();
diff --git a/apps/mobile/src/components/Toast/index.js b/apps/mobile/src/components/Toast/index.js
index 9fe96288e..367cf8367 100644
--- a/apps/mobile/src/components/Toast/index.js
+++ b/apps/mobile/src/components/Toast/index.js
@@ -1,4 +1,4 @@
-import React, {useEffect, useState} from 'react';
+import React, {useEffect, useRef, useState} from 'react';
import {Keyboard, View} from 'react-native';
import Animated, {Easing, useValue} from 'react-native-reanimated';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
@@ -26,12 +26,12 @@ export const Toast = ({context = 'global'}) => {
color: colors.errorText
});
const insets = useSafeAreaInsets();
-
+ const hideTimeout = useRef();
let toastTranslate = useValue(-dHeight);
let toastOpacity = useValue(0);
const showToastFunc = async data => {
- console.log('toast show',data.message);
+ console.log('toast show', data.message);
if (!data) return;
if (data.context !== context) return;
if (toastMessages.findIndex(m => m.message === data.message) >= 0) {
@@ -59,14 +59,14 @@ export const Toast = ({context = 'global'}) => {
easing: Easing.ease
}).start();
- setTimeout(() => {
+ hideTimeout.current = setTimeout(() => {
hideToastFunc();
}, data.duration);
};
const showNext = data => {
if (!data) {
- hideToastFunc()
+ hideToastFunc();
return;
}
setData(data);
@@ -79,7 +79,7 @@ export const Toast = ({context = 'global'}) => {
color: colors.errorText
});
}
- setTimeout(() => {
+ hideTimeout.current = setTimeout(() => {
hideToastFunc();
}, data?.duration);
};
@@ -127,11 +127,15 @@ export const Toast = ({context = 'global'}) => {
toastMessages = [];
toastTranslate.setValue(-dHeight);
toastOpacity.setValue(0);
- let sub1 = Keyboard.addListener('keyboardDidShow', _onKeyboardShow);
+ let sub1 = Keyboard.addListener('keyboardDidShow', _onKeyboardShow);
let sub2 = Keyboard.addListener('keyboardDidHide', _onKeyboardHide);
eSubscribeEvent(eShowToast, showToastFunc);
eSubscribeEvent(eHideToast, hideToastFunc);
return () => {
+ if (hideTimeout.current) {
+ clearTimeout(hideTimeout.current);
+ }
+
toastMessages = [];
sub1?.remove();
sub2?.remove();
diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.js
index 47cb5c8d0..3107cf0e1 100755
--- a/apps/mobile/src/utils/index.js
+++ b/apps/mobile/src/utils/index.js
@@ -16,7 +16,7 @@ import {MMKV} from './mmkv';
import {tabBarRef} from './Refs';
import {SIZE} from './SizeUtils';
-export const APP_VERSION = 1550;
+export const APP_VERSION = 1600;
export const Tracker = ackeeTracker.create('https://sa.streetwriters.co', {
ignoreLocalhost: true