A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix merge dialog applyChanges not working
ammarahm-edc0cbf32a57d3
diff --git a/apps/mobile/src/components/MergeEditor/index.js b/apps/mobile/src/components/MergeEditor/index.jsindex bdfe58b69..947a9e307 100644--- a/apps/mobile/src/components/MergeEditor/index.js+++ b/apps/mobile/src/components/MergeEditor/index.js@@ -12,17 +12,20 @@ import {eSubscribeEvent,eUnSubscribeEvent,} from '../../services/EventManager';-import {dHeight} from '../../utils';+import {dHeight, getElevation} from '../../utils';import {db} from '../../utils/DB';import {eApplyChanges,eShowMergeDialog,refreshNotesPage,} from '../../utils/Events';-import {normalize, SIZE} from '../../utils/SizeUtils';+import {normalize, ph, pv, SIZE} from '../../utils/SizeUtils';import {Button} from '../Button';-import {simpleDialogEvent, updateEvent} from '../DialogManager/recievers';-import {TEMPLATE_APPLY_CHANGES} from '../DialogManager/Templates';+import BaseDialog from '../Dialog/base-dialog';+import DialogButtons from '../Dialog/dialog-buttons';+import DialogContainer from '../Dialog/dialog-container';+import DialogHeader from '../Dialog/dialog-header';+import {updateEvent} from '../DialogManager/recievers';import Paragraph from '../Typography/Paragraph';const {Value, timing} = Animated;@@ -90,6 +93,7 @@ const MergeEditor = () => {const [keepContentFrom, setKeepContentFrom] = useState(null);const [copyToSave, setCopyToSave] = useState(null);const [disardedContent, setDiscardedContent] = useState(null);+ const [dialogVisible, setDialogVisible] = useState(false);const insets = useSafeAreaInsets();const postMessageToPrimaryWebView = (message) =>@@ -157,6 +161,7 @@ const MergeEditor = () => {};const applyChanges = async () => {+ console.log(keepContentFrom, copyToSave);if (keepContentFrom === 'primary') {await db.notes.add({content: {@@ -205,15 +210,15 @@ const MergeEditor = () => {const show = async (item) => {note = item;db.content;- let note = await db.content.raw(note.contentId);- switch (note.type) {+ let noteData = await db.content.raw(note.contentId);+ switch (noteData.type) {case 'delta':- primaryData = note;- secondaryData = note;+ primaryData = noteData;+ secondaryData = noteData;}setVisible(true);- firstWebViewHeight.setValue((dHeight / 2) - (50 + insets.top / 2));- secondWebViewHeight.setValue((dHeight / 2) - (50 + insets.top / 2));+ firstWebViewHeight.setValue(dHeight / 2 - (50 + insets.top / 2));+ secondWebViewHeight.setValue(dHeight / 2 - (50 + insets.top / 2));openEditorAnimation(firstWebViewHeight, secondWebViewHeight, true, insets);};@@ -243,7 +248,7 @@ const MergeEditor = () => {const onPressSaveCopyFromPrimaryWebView = () => {setCopyToSave('primary');- simpleDialogEvent(TEMPLATE_APPLY_CHANGES);+ setDialogVisible(true);};const onPressKeepFromSecondaryWebView = () => {@@ -263,17 +268,17 @@ const MergeEditor = () => {const onPressSaveCopyFromSecondaryWebView = () => {setCopyToSave('secondary');- simpleDialogEvent(TEMPLATE_APPLY_CHANGES);+ setDialogVisible(true);};const onPressDiscardFromPrimaryWebView = () => {setDiscardedContent('primary');- simpleDialogEvent(TEMPLATE_APPLY_CHANGES);+ setDialogVisible(true);};const onPressDiscardFromSecondaryWebView = () => {setDiscardedContent('secondary');- simpleDialogEvent(TEMPLATE_APPLY_CHANGES);+ setDialogVisible(true);};const close = () => {@@ -312,6 +317,23 @@ const MergeEditor = () => {backgroundColor: colors.nav,paddingTop: insets.top,}}>+ {dialogVisible && (+ <BaseDialog visible={true}>+ <DialogContainer>+ <DialogHeader+ title="Apply Changes"+ paragraph="Apply selected changes to note?"+ />+ <DialogButtons+ positiveTitle="Apply"+ negativeTitle="Cancel"+ onPressNegative={() => setDialogVisible(false)}+ onPressPositive={applyChanges}+ />+ </DialogContainer>+ </BaseDialog>+ )}+<Viewstyle={{height: '100%',diff --git a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js b/apps/mobile/src/components/SimpleList/NoteItemWrapper.jsindex e3701ac80..680a8b999 100644--- a/apps/mobile/src/components/SimpleList/NoteItemWrapper.js+++ b/apps/mobile/src/components/SimpleList/NoteItemWrapper.js@@ -35,6 +35,7 @@ export const NoteItemWrapper = ({item, index, isTrash = false}) => {newNote.title === note.title &&newNote.headline === note.headline) {+ console.log('returning from here',newNote.headline,note.headline);return;}setNote(newNote);@@ -59,6 +60,9 @@ export const NoteItemWrapper = ({item, index, isTrash = false}) => {};const onPress = async (event) => {++ eSendEvent(eShowMergeDialog, note);+ return;if (note.conflicted) {eSendEvent(eShowMergeDialog, note);return;