Locking support for web editors, disable webview model dismiss animation, v2.1.33

This commit is contained in:
Mo Bitar
2018-05-03 19:32:51 -05:00
parent 81e3e48587
commit b39bfe89c8
5 changed files with 27 additions and 8 deletions

View File

@@ -97,8 +97,8 @@ android {
applicationId "com.standardnotes"
minSdkVersion 21
targetSdkVersion 25
versionCode 2010320
versionName "2.1.32"
versionCode 2010330
versionName "2.1.33"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"

View File

@@ -19,11 +19,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.1.32</string>
<string>2.1.33</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>2</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>

View File

@@ -1,8 +1,8 @@
{
"name": "StandardNotes",
"version": "2.1.32",
"versionIOS": "2.1.32",
"versionAndroid": "2.1.32",
"version": "2.1.33",
"versionIOS": "2.1.33",
"versionAndroid": "2.1.33",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",

View File

@@ -167,6 +167,12 @@ export default class ComponentManager {
return _.find(this.components, {sessionKey: key});
}
isReadOnlyMessage(message) {
let writeActions = ["save-items", "delete-items", "create-item"]
// Ensure the message action is not one of the writeActions
return !writeActions.includes(message.action);
}
handleMessage(component, message) {
if(!component) {

View File

@@ -97,7 +97,10 @@ export default class Webview extends Abstract {
}
dismiss() {
this.props.navigator.dismissModal({animationType: "slide-down"})
// There is an issue on iOS where if this modal is dismissed with an animation, and the user presses "Manage" too quickly, the navigation stack will go into an invalid state.
// So, no animation on iOS, but slide-down on Android
let animationType = App.isIOS ? "none" : "slide-down";
this.props.navigator.dismissModal({animationType: animationType})
}
configureNavBar() {
@@ -115,7 +118,17 @@ export default class Webview extends Abstract {
}
onMessage = (message) => {
// Ignore any incoming events (like save events) if the note is locked. Allow messages that are required for component setup (administrative)
let data = JSON.parse(message.nativeEvent.data);
if(this.note.locked && !ComponentManager.get().isReadOnlyMessage(data)) {
if(!this.didShowLockAlert) {
Alert.alert('Note Locked', "This note is locked. Changes you make in the web editor will not be saved. Please unlock this note to make changes.", [{text: 'OK'}])
this.didShowLockAlert = true;
}
this.setNavBarSubtitle("Note Locked");
return;
}
ComponentManager.get().handleMessage(this.editor, data);
}