mirror of
https://github.com/standardnotes/mobile.git
synced 2026-05-24 22:44:41 -04:00
More accurate saving status, disable editor change on locked notes and SNJS upgrade (#409)
* fix: more accurate saving status * fix: disallow changing editor on locked note * chore(version-snjs): 2.0.75 * refactor: support snjs session history refactor
This commit is contained in:
committed by
GitHub
parent
b9483dcef1
commit
0f7322af38
@@ -26,7 +26,7 @@
|
||||
"@react-navigation/native": "^5.9.3",
|
||||
"@react-navigation/stack": "^5.14.3",
|
||||
"@standardnotes/sncrypto-common": "1.2.9",
|
||||
"@standardnotes/snjs": "2.0.72",
|
||||
"@standardnotes/snjs": "2.0.75",
|
||||
"js-base64": "^3.5.2",
|
||||
"moment": "^2.29.1",
|
||||
"react": "16.13.1",
|
||||
|
||||
@@ -87,7 +87,12 @@ export class Compose extends React.Component<{}, State> {
|
||||
{
|
||||
title: newNote.title,
|
||||
},
|
||||
() => this.reloadComponentEditorState()
|
||||
() => {
|
||||
this.reloadComponentEditorState();
|
||||
if (newNote.dirty) {
|
||||
this.showSavingStatus();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
@@ -103,14 +108,15 @@ export class Compose extends React.Component<{}, State> {
|
||||
this.setState({ title: newNote.title });
|
||||
}
|
||||
|
||||
if (newNote.lastSyncBegan) {
|
||||
if (newNote.lastSyncBegan || newNote.dirty) {
|
||||
if (newNote.lastSyncEnd) {
|
||||
if (
|
||||
newNote.lastSyncBegan?.getTime() > newNote.lastSyncEnd.getTime()
|
||||
newNote.dirty ||
|
||||
newNote.lastSyncBegan!.getTime() > newNote.lastSyncEnd.getTime()
|
||||
) {
|
||||
this.showSavingStatus();
|
||||
} else if (
|
||||
newNote.lastSyncEnd.getTime() > newNote.lastSyncBegan.getTime()
|
||||
newNote.lastSyncEnd.getTime() > newNote.lastSyncBegan!.getTime()
|
||||
) {
|
||||
this.showAllChangesSavedStatus();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { ApplicationContext } from '@Root/ApplicationContext';
|
||||
import { ItemSessionHistory, SNNote } from '@standardnotes/snjs';
|
||||
import { HistoryEntry, SNNote } from '@standardnotes/snjs';
|
||||
import { NoteHistoryEntry } from '@standardnotes/snjs/dist/@types/services/history/entries/note_history_entry';
|
||||
import React, { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { FlatList, ListRenderItem } from 'react-native';
|
||||
@@ -16,7 +16,7 @@ export const SessionHistory: React.FC<Props> = ({ note, onPress }) => {
|
||||
const insets = useSafeAreaInsets();
|
||||
|
||||
// State
|
||||
const [sessionHistory, setSessionHistory] = useState<ItemSessionHistory>();
|
||||
const [sessionHistory, setSessionHistory] = useState<HistoryEntry[]>();
|
||||
|
||||
useEffect(() => {
|
||||
if (note) {
|
||||
@@ -52,7 +52,7 @@ export const SessionHistory: React.FC<Props> = ({ note, onPress }) => {
|
||||
initialNumToRender={10}
|
||||
windowSize={10}
|
||||
keyboardShouldPersistTaps={'never'}
|
||||
data={sessionHistory?.entries as NoteHistoryEntry[]}
|
||||
data={sessionHistory as NoteHistoryEntry[]}
|
||||
renderItem={RenderItem}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -235,6 +235,12 @@ export const NoteSideMenu = React.memo((props: Props) => {
|
||||
|
||||
const onEditorPress = useCallback(
|
||||
async (selectedComponent?: SNComponent) => {
|
||||
if (note?.locked) {
|
||||
application?.alertService.alert(
|
||||
"This note is locked. If you'd like to edit its options, unlock it, and try again."
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (editor?.isTemplateNote) {
|
||||
await editor?.insertTemplatedNote();
|
||||
}
|
||||
|
||||
@@ -1390,10 +1390,10 @@
|
||||
resolved "https://registry.yarnpkg.com/@standardnotes/sncrypto-common/-/sncrypto-common-1.2.9.tgz#5212a959e4ec563584e42480bfd39ef129c3cbdf"
|
||||
integrity sha512-xJ5IUGOZztjSgNP/6XL+Ut5+q9UgSTv6xMtKkcQC5aJxCOkJy9u6RamPLdF00WQgwibxx2tu0e43bKUjTgzMig==
|
||||
|
||||
"@standardnotes/snjs@2.0.72":
|
||||
version "2.0.72"
|
||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.72.tgz#1ff7d691f0d907a1513ec88e6b5d5ae0691f2947"
|
||||
integrity sha512-OL1jeb0sEz4SZwGHeceoKttVcBmcKAh5y/96TELJxM1ZHL2Ayf6DxAXCz3KZBoD7JZllbJ9QWR37/bp+E4y2TA==
|
||||
"@standardnotes/snjs@2.0.75":
|
||||
version "2.0.75"
|
||||
resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.0.75.tgz#aeb0ead927da63dc85e28f78da2362126bb16602"
|
||||
integrity sha512-QL5YgDT0aN9t95gxgURqNudXr5dteVsc1ylsKKSw0DpEGiq0bACPxbI+sUFppoWTFmprxmDh3+vc+FFcFg7Lyw==
|
||||
dependencies:
|
||||
"@standardnotes/auth" "^2.0.0"
|
||||
"@standardnotes/sncrypto-common" "^1.2.9"
|
||||
|
||||
Reference in New Issue
Block a user