Skip to content

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

fix login flow

ammarahm-edda35ee06aed7
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index e56ecf8dd..ee645b0d6 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -7,6 +7,7 @@ import {
TextInput,
TouchableOpacity,
View,
+ Clipboard,
} from 'react-native';
import Share from 'react-native-share';
import Icon from 'react-native-vector-icons/MaterialCommunityIcons';
@@ -26,7 +27,7 @@ import {
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {eSendEvent, openVault} from '../../services/eventManager';
-import {refreshNotesPage} from '../../services/events';
+import {eOpenLoginDialog, refreshNotesPage} from '../../services/events';
import NavigationService from '../../services/NavigationService';
import {MMKV} from '../../utils/storage';
import {
@@ -39,6 +40,7 @@ import {
} from '../../utils/utils';
import {PremiumTag} from '../Premium/PremiumTag';
import {PressableButton} from '../PressableButton';
+import {Toast} from '../Toast';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -83,7 +85,6 @@ export const ActionSheetComponent = ({
useEffect(() => {
if (item.dateCreated !== null) {
setNote({...item});
- console.log(item);
}
}, [item]);
@@ -259,20 +260,18 @@ export const ActionSheetComponent = ({
},
},
{
- name: 'Open',
- icon: 'open-in-app',
- func: () => {
- NavigationService.navigate('Editor', {
- note: item,
- });
- close();
+ name: 'Copy',
+ icon: 'content-copy',
+ func: async () => {
+ let text = await db.notes.note(note.id).text();
+ Clipboard.setString(text);
+ ToastEvent.show('Note copied to clipboard', 'success', 'local');
},
},
{
name: 'Restore',
icon: 'delete-restore',
func: async () => {
- console.log(await db.trash.restore(note.id),"RESULT");
dispatch({type: ACTIONS.TRASH});
localRefresh(note.type);
ToastEvent.show(
@@ -437,7 +436,6 @@ export const ActionSheetComponent = ({
);
const _renderColor = (c) => {
- console.log(COLORS_NOTE[c]);
const color = {
name: c,
value: COLORS_NOTE[c],
@@ -589,10 +587,19 @@ export const ActionSheetComponent = ({
const onPressSync = async () => {
if (!user) {
- NavigationService.navigate('Login', {
- root: true,
- });
- close();
+ ToastEvent.show(
+ 'You must login to sync',
+ 'error',
+ 'local',
+ 5000,
+ () => {
+ close();
+ setTimeout(() => {
+ eSendEvent(eOpenLoginDialog);
+ }, 500);
+ },
+ 'Login',
+ );
return;
}
if (user?.lastSynced < note?.dateEdited) {
@@ -604,7 +611,7 @@ export const ActionSheetComponent = ({
localRefresh();
setRefreshing(false);
- ToastEvent.show('Sync Complete', 'success', 'local');
+ ToastEvent.show('Note synced', 'success', 'local');
} catch (e) {
setRefreshing(false);
ToastEvent.show(e.message, 'error', 'local');
@@ -955,6 +962,7 @@ export const ActionSheetComponent = ({
}}
/>
) : null}
+ <Toast context="local" />
</View>
);
};
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 58c2c274f..30c54fcfb 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -181,11 +181,11 @@ export class DialogManager extends Component {
showLoginDialog = () => {
- this.loginDialog.open();
+ //this.loginDialog.open();
};
hideLoginDialog = () => {
- this.loginDialog.close();
+ //this.loginDialog.close();
};
showAddNotebook = data => {
diff --git a/apps/mobile/src/components/Menu/UserSection.js b/apps/mobile/src/components/Menu/UserSection.js
index c44408d7b..3951061a3 100644
--- a/apps/mobile/src/components/Menu/UserSection.js
+++ b/apps/mobile/src/components/Menu/UserSection.js
@@ -140,12 +140,7 @@ export const UserSection = ({noTextMode}) => {
) : (
<PressableButton
onPress={() => {
- DDS.isTab
- ? eSendEvent(eOpenLoginDialog)
- : NavigationService.navigate('Login', {
- root: true,
- });
- sideMenuRef.current?.closeDrawer();
+ eSendEvent(eOpenLoginDialog);
}}
color={colors.shade}
selectedColor={colors.accent}
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 5c1d81828..77410d4c0 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -227,7 +227,7 @@ export default class NoteItem extends React.Component {
isTrash ? false : true,
isTrash
? ['Remove', 'Restore']
- : ['Add to', 'Share', 'Export', 'Delete', 'Open'],
+ : ['Add to', 'Share', 'Export', 'Delete', 'Copy'],
isTrash ? [] : ['Pin', 'Favorite', 'Add to Vault'],
);
}}>