From 87bc08bef5dadae10bf790cb4f49f4a7919579b0 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Wed, 14 Feb 2018 15:28:56 +0000 Subject: [PATCH 1/2] iOS: Fixed resource decryption issue, log page crash and text input rendering issue --- ReactNativeClient/ios/Joplin/Info.plist | 4 ++-- .../lib/components/screens/encryption-config.js | 11 +++++++++-- ReactNativeClient/lib/components/screens/log.js | 7 +++++-- ReactNativeClient/lib/fs-driver-rn.js | 4 ++-- ReactNativeClient/lib/services/DecryptionWorker.js | 3 ++- 5 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ReactNativeClient/ios/Joplin/Info.plist b/ReactNativeClient/ios/Joplin/Info.plist index fc213d9d9..863083c08 100644 --- a/ReactNativeClient/ios/Joplin/Info.plist +++ b/ReactNativeClient/ios/Joplin/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.10.9 + 1.0.11 CFBundleSignature ???? CFBundleVersion - 9 + 11 LSRequiresIPhoneOS NSAppTransportSecurity diff --git a/ReactNativeClient/lib/components/screens/encryption-config.js b/ReactNativeClient/lib/components/screens/encryption-config.js index e7b7f6348..cfd51da21 100644 --- a/ReactNativeClient/lib/components/screens/encryption-config.js +++ b/ReactNativeClient/lib/components/screens/encryption-config.js @@ -1,5 +1,5 @@ const React = require('react'); const Component = React.Component; -const { TextInput, TouchableOpacity, Linking, View, Switch, Slider, StyleSheet, Text, Button, ScrollView } = require('react-native'); +const { TextInput, TouchableOpacity, Linking, View, Switch, Slider, StyleSheet, Text, Button, ScrollView, Platform } = require('react-native'); const EncryptionService = require('lib/services/EncryptionService'); const { connect } = require('react-redux'); const { ScreenHeader } = require('lib/components/screen-header.js'); @@ -109,13 +109,20 @@ class EncryptionConfigScreenComponent extends BaseScreenComponent { const passwordOk = this.state.passwordChecks[mk.id] === true ? '✔' : '❌'; const active = this.props.activeMasterKeyId === mk.id ? '✔' : ''; + const inputStyle = {flex:1, marginRight: 10, color: theme.color}; + + if (Platform.OS === 'ios') { + inputStyle.borderBottomWidth = 1; + inputStyle.borderBottomColor = theme.dividerColor; + } + return ( {_('Master Key %s', mk.id.substr(0,6))} {_('Created: %s', time.formatMsToLocal(mk.created_time))} {_('Password:')} - onPasswordChange(text)} style={{flex:1, marginRight: 10, color: theme.color}}> + onPasswordChange(text)} style={inputStyle}> {passwordOk} diff --git a/ReactNativeClient/lib/components/screens/log.js b/ReactNativeClient/lib/components/screens/log.js index f8cd0e1e1..cf737e146 100644 --- a/ReactNativeClient/lib/components/screens/log.js +++ b/ReactNativeClient/lib/components/screens/log.js @@ -1,5 +1,5 @@ const React = require('react'); const Component = React.Component; -const { ListView, View, Text, Button, StyleSheet } = require('react-native'); +const { ListView, View, Text, Button, StyleSheet, Platform } = require('react-native'); const { connect } = require('react-redux'); const { Log } = require('lib/log.js'); const { reg } = require('lib/registry.js'); @@ -43,12 +43,15 @@ class LogScreenComponent extends BaseScreenComponent { paddingBottom:0, }, rowText: { - fontFamily: 'monospace', fontSize: 10, color: theme.color, }, }; + if (Platform.OS !== 'ios') { // Crashes on iOS with error "Unrecognized font family 'monospace'" + styles.rowText.fontFamily = 'monospace'; + } + styles.rowTextError = Object.assign({}, styles.rowText); styles.rowTextError.color = theme.colorError; diff --git a/ReactNativeClient/lib/fs-driver-rn.js b/ReactNativeClient/lib/fs-driver-rn.js index e987d9f5f..2543e11b4 100644 --- a/ReactNativeClient/lib/fs-driver-rn.js +++ b/ReactNativeClient/lib/fs-driver-rn.js @@ -62,7 +62,7 @@ class FsDriverRN { const r = await RNFS.stat(path); return this.rnfsStatToStd_(r, path); } catch (error) { - if (error && error.message && error.message.indexOf('exist') >= 0) { + if (error && ((error.message && error.message.indexOf('exist') >= 0) || error.code === 'ENOENT')) { // Probably { [Error: File does not exist] framesToPop: 1, code: 'EUNSPECIFIED' } // which unfortunately does not have a proper error code. Can be ignored. return null; @@ -120,7 +120,7 @@ class FsDriverRN { try { await RNFS.unlink(path); } catch (error) { - if (error && error.message && error.message.indexOf('exist') >= 0) { + if (error && ((error.message && error.message.indexOf('exist') >= 0) || error.code === 'ENOENT')) { // Probably { [Error: File does not exist] framesToPop: 1, code: 'EUNSPECIFIED' } // which unfortunately does not have a proper error code. Can be ignored. } else { diff --git a/ReactNativeClient/lib/services/DecryptionWorker.js b/ReactNativeClient/lib/services/DecryptionWorker.js index 46ee3a719..c1ef325e6 100644 --- a/ReactNativeClient/lib/services/DecryptionWorker.js +++ b/ReactNativeClient/lib/services/DecryptionWorker.js @@ -84,8 +84,9 @@ class DecryptionWorker { try { await ItemClass.decrypt(item); } catch (error) { + excludedIds.push(item.id); + if (error.code === 'masterKeyNotLoaded' && options.materKeyNotLoadedHandler === 'dispatch') { - excludedIds.push(item.id); if (notLoadedMasterKeyDisptaches.indexOf(error.masterKeyId) < 0) { this.dispatch({ type: 'MASTERKEY_ADD_NOT_LOADED', From a37b599a6b55f2f2a58cccc3a583a3a0640af618 Mon Sep 17 00:00:00 2001 From: Laurent Cozic Date: Thu, 15 Feb 2018 18:19:00 +0000 Subject: [PATCH 2/2] macOS: Allow copy and paste from config and encryption screen --- ElectronClient/app/app.js | 6 +++--- ReactNativeClient/ios/Joplin/Info.plist | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ElectronClient/app/app.js b/ElectronClient/app/app.js index 6ab188bde..f0c8a85d3 100644 --- a/ElectronClient/app/app.js +++ b/ElectronClient/app/app.js @@ -239,17 +239,17 @@ class Application extends BaseApplication { label: _('Edit'), submenu: [{ label: _('Copy'), - screens: ['Main', 'OneDriveLogin'], + screens: ['Main', 'OneDriveLogin', 'Config', 'EncryptionConfig'], role: 'copy', accelerator: 'CommandOrControl+C', }, { label: _('Cut'), - screens: ['Main', 'OneDriveLogin'], + screens: ['Main', 'OneDriveLogin', 'Config', 'EncryptionConfig'], role: 'cut', accelerator: 'CommandOrControl+X', }, { label: _('Paste'), - screens: ['Main', 'OneDriveLogin'], + screens: ['Main', 'OneDriveLogin', 'Config', 'EncryptionConfig'], role: 'paste', accelerator: 'CommandOrControl+V', }, { diff --git a/ReactNativeClient/ios/Joplin/Info.plist b/ReactNativeClient/ios/Joplin/Info.plist index 863083c08..1399af50e 100644 --- a/ReactNativeClient/ios/Joplin/Info.plist +++ b/ReactNativeClient/ios/Joplin/Info.plist @@ -17,11 +17,11 @@ CFBundlePackageType APPL CFBundleShortVersionString - 1.0.11 + 1.0.12 CFBundleSignature ???? CFBundleVersion - 11 + 12 LSRequiresIPhoneOS NSAppTransportSecurity