Skip to content

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

add sharing notes from app.

ammarahm-edbcb3d5b6dd81
diff --git a/apps/mobile/src/components/ActionSheetComponent/index.js b/apps/mobile/src/components/ActionSheetComponent/index.js
index c78a1d911..aeba91fe0 100644
--- a/apps/mobile/src/components/ActionSheetComponent/index.js
+++ b/apps/mobile/src/components/ActionSheetComponent/index.js
@@ -24,6 +24,7 @@ import {
import {useTracked} from '../../provider';
import {ACTIONS} from '../../provider/actions';
import {moveNoteEvent} from '../DialogManager';
+import Share from 'react-native-share';
const w = Dimensions.get('window').width;
const h = Dimensions.get('window').height;
@@ -180,7 +181,18 @@ export const ActionSheetComponent = ({
name: 'Share',
icon: 'share-2',
func: () => {
- close();
+ if (note.locked) {
+ close('unlock_share');
+ } else {
+ close();
+ let m = `${note.title}\n \n ${note.content.text}`;
+
+ Share.open({
+ title: 'Share note to',
+ failOnCancel: false,
+ message: m,
+ });
+ }
},
},
{
@@ -233,7 +245,7 @@ export const ActionSheetComponent = ({
},
];
- columnItemsData = [
+ const columnItemsData = [
{
name: 'Dark Mode',
icon: 'moon',
diff --git a/apps/mobile/src/components/DialogManager/index.js b/apps/mobile/src/components/DialogManager/index.js
index 8f20490ed..62cb5e9da 100644
--- a/apps/mobile/src/components/DialogManager/index.js
+++ b/apps/mobile/src/components/DialogManager/index.js
@@ -154,6 +154,7 @@ export class DialogManager extends Component {
icon: '',
},
isPerm: false,
+ shareAfterUnlock: false,
};
}
@@ -318,6 +319,14 @@ export class DialogManager extends Component {
this._showVaultDialog();
break;
}
+ case 'unlock_share': {
+ this.setState({
+ isPerm: false,
+ shareAfterUnlock: true,
+ });
+ this._showVaultDialog();
+ break;
+ }
case 'notebook': {
this.showAddNotebook({item: this.state.item});
break;
@@ -340,6 +349,7 @@ export class DialogManager extends Component {
isPerm,
vaultDialog,
unlock,
+ shareAfterUnlock,
} = this.state;
return (
<>
@@ -404,6 +414,7 @@ export class DialogManager extends Component {
colors={colors}
note={item}
perm={isPerm}
+ shareAfterUnlock={shareAfterUnlock}
openedToUnlock={false}
visible={vaultDialog}
/>
diff --git a/apps/mobile/src/components/ListPlaceholders/index.js b/apps/mobile/src/components/ListPlaceholders/index.js
index c9a0e7b26..aa37dc2f8 100644
--- a/apps/mobile/src/components/ListPlaceholders/index.js
+++ b/apps/mobile/src/components/ListPlaceholders/index.js
@@ -2,7 +2,7 @@ import React from 'react';
import {Text, View} from 'react-native';
import * as Animatable from 'react-native-animatable';
import Icon from 'react-native-vector-icons/Feather';
-import {SIZE, WEIGHT} from '../../common/common';
+import {SIZE, WEIGHT, normalize} from '../../common/common';
import {
deleteItems,
opacity,
@@ -150,12 +150,12 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
opacity: 0.5,
elevation: 5,
position: 'absolute',
- left: -50,
- top: -50,
+ left: -normalize(50),
+ top: -normalize(50),
}}>
<View
style={{
- width: 10,
+ width: normalize(10),
height: '100%',
opacity: 1,
elevation: 1,
@@ -169,9 +169,9 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
style={{
backgroundColor: colors.nav,
borderRadius: 5,
- padding: 5,
- paddingBottom: 10,
- paddingLeft: 15,
+ padding: normalize(5),
+ paddingBottom: normalize(10),
+ paddingLeft: normalize(15),
}}>
<Text
style={{
@@ -185,51 +185,51 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
- width: '70%',
- height: 8,
+ width: '100%',
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
@@ -239,7 +239,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '15%',
- height: 8,
+ height: normalize(8),
borderRadius: 5,
backgroundColor: colors.icon,
marginRight: '5%',
@@ -248,7 +248,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '15%',
- height: 8,
+ height: normalize(8),
borderRadius: 5,
backgroundColor: colors.icon,
}}
@@ -273,7 +273,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
}}>
<View
style={{
- width: 10,
+ width: normalize(10),
height: '100%',
opacity: 1,
elevation: 1,
@@ -287,9 +287,9 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
style={{
backgroundColor: colors.nav,
borderRadius: 5,
- padding: 5,
- paddingBottom: 10,
- paddingLeft: 15,
+ padding: normalize(5),
+ paddingBottom: normalize(10),
+ paddingLeft: normalize(15),
}}>
<Text
style={{
@@ -303,51 +303,51 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
width: '100%',
- height: 8,
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
style={{
- width: '70%',
- height: 8,
+ width: '100%',
+ height: normalize(8),
opacity: 0.5,
borderRadius: 5,
backgroundColor: colors.accent,
- marginBottom: 8,
+ marginBottom: normalize(8),
}}
/>
<View
@@ -357,7 +357,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '15%',
- height: 8,
+ height: normalize(8),
borderRadius: 5,
backgroundColor: colors.icon,
marginRight: '5%',
@@ -366,7 +366,7 @@ export const NotesPlaceHolder = ({colors, animation, right, top}) => {
<View
style={{
width: '15%',
- height: 8,
+ height: normalize(8),
borderRadius: 5,
backgroundColor: colors.icon,
}}
diff --git a/apps/mobile/src/components/VaultDialog/index.js b/apps/mobile/src/components/VaultDialog/index.js
index 6094e420a..d0f691b69 100644
--- a/apps/mobile/src/components/VaultDialog/index.js
+++ b/apps/mobile/src/components/VaultDialog/index.js
@@ -23,12 +23,22 @@ export class VaultDialog extends Component {
visible: true,
});
};
- close = () => {
+ close = (share = false, item = null) => {
this.setState(
{
visible: false,
},
+
() => {
+ if (share && note) {
+ let m = `${item.title}\n \n ${item.content.text}`;
+
+ Share.open({
+ title: 'Share note to',
+ failOnCancel: false,
+ message: m,
+ });
+ }
updateEvent({type: this.props.note.type});
},
);
@@ -53,7 +63,7 @@ export class VaultDialog extends Component {
});
}
- this.close();
+ this.close(this.props.shareAfterUnlock, item);
} else {
await db.lockNote(this.props.note.dateCreated, 'password');
this.close();