From ce7a59f4733ac3b13e65587756dc9aa317c34830 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 15 Jun 2021 15:44:01 -0300 Subject: [PATCH 1/7] fix: change backup destination to document directory --- src/lib/backups_service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/backups_service.ts b/src/lib/backups_service.ts index d7bdac8a..1eec328a 100644 --- a/src/lib/backups_service.ts +++ b/src/lib/backups_service.ts @@ -92,7 +92,7 @@ export class BackupsService extends ApplicationService { } private async _exportAndroid(filename: string, data: string) { - const filepath = `${RNFS.ExternalDirectoryPath}/${filename}`; + const filepath = `${RNFS.DocumentDirectoryPath}/${filename}`; return RNFS.writeFile(filepath, data).then(() => { return filepath; }); From e44171c6188c8d9c5d2e34d2046e91e44a786703 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 15 Jun 2021 15:44:34 -0300 Subject: [PATCH 2/7] chore(version): 3.6.11 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9ed37b0b..139c1374 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "StandardNotes", - "version": "3.6.10", - "user-version": "3.6.10", + "version": "3.6.11", + "user-version": "3.6.11", "private": true, "license": "AGPL-3.0-or-later", "scripts": { From 567c76bdbd1b678714dcad9004a47a26997c7f27 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Wed, 16 Jun 2021 17:44:41 -0300 Subject: [PATCH 3/7] fix: save backups to downloads directory --- android/app/src/main/AndroidManifest.xml | 2 +- src/lib/backups_service.ts | 28 ++++++++++++++++++------ 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index a5faa587..46aadb4a 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -8,9 +8,9 @@ android:protectionLevel="signature" /> - + diff --git a/src/lib/backups_service.ts b/src/lib/backups_service.ts index 1eec328a..d5c44894 100644 --- a/src/lib/backups_service.ts +++ b/src/lib/backups_service.ts @@ -5,7 +5,7 @@ import { Platform, } from '@standardnotes/snjs'; import { Base64 } from 'js-base64'; -import { Alert, Share } from 'react-native'; +import { Alert, PermissionsAndroid, Share } from 'react-native'; import FileViewer from 'react-native-file-viewer'; import RNFS from 'react-native-fs'; import Mailer from 'react-native-mail'; @@ -44,8 +44,7 @@ export class BackupsService extends ApplicationService { filename ); } else if (result === 'save') { - let filepath = await this._exportAndroid(filename, stringifiedData); - return this._showFileSavePromptAndroid(filepath); + await this._exportAndroid(filename, stringifiedData); } else { return; } @@ -92,10 +91,25 @@ export class BackupsService extends ApplicationService { } private async _exportAndroid(filename: string, data: string) { - const filepath = `${RNFS.DocumentDirectoryPath}/${filename}`; - return RNFS.writeFile(filepath, data).then(() => { - return filepath; - }); + const filepath = `${RNFS.DownloadDirectoryPath}/${filename}`; + try { + const granted = await PermissionsAndroid.request( + PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE + ); + if (granted === PermissionsAndroid.RESULTS.GRANTED) { + await RNFS.writeFile(filepath, data); + this._showFileSavePromptAndroid(filepath); + } else { + this.application.alertService.alert( + 'We need permission to write to the external storage in order to save your backup file.' + ); + } + } catch (err) { + console.log('Error exporting backup', err); + this.application.alertService.alert( + 'There was an issue exporting your backup.' + ); + } } private async _openFileAndroid(filepath: string) { From 3c949135710bc1cc52fd61aa7402031754623704 Mon Sep 17 00:00:00 2001 From: Johnny A <5891646+johnny243@users.noreply.github.com> Date: Mon, 21 Jun 2021 14:37:30 -0400 Subject: [PATCH 4/7] fix: import file on iOS (#449) * fix: decode selected file uri on iOS * fix: remove exception from alert Co-authored-by: Johnny Almonte --- src/screens/Settings/Sections/OptionsSection.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/screens/Settings/Sections/OptionsSection.tsx b/src/screens/Settings/Sections/OptionsSection.tsx index 07e966bb..2591ea28 100644 --- a/src/screens/Settings/Sections/OptionsSection.tsx +++ b/src/screens/Settings/Sections/OptionsSection.tsx @@ -12,6 +12,7 @@ import { SCREEN_MANAGE_SESSIONS, SCREEN_SETTINGS } from '@Screens/screens'; import { ButtonType } from '@standardnotes/snjs'; import moment from 'moment'; import React, { useCallback, useContext, useMemo, useState } from 'react'; +import { Platform } from 'react-native'; import DocumentPicker from 'react-native-document-picker'; import RNFS from 'react-native-fs'; @@ -139,7 +140,11 @@ export const OptionsSection = ({ title, encryptionAvailable }: Props) => { const selectedFile = await DocumentPicker.pick({ type: [DocumentPicker.types.plainText], }); - const data = await readImportFile(selectedFile.uri); + const selectedFileURI = + Platform.OS === 'ios' + ? decodeURIComponent(selectedFile.uri) + : selectedFile.uri; + const data = await readImportFile(selectedFileURI); if (!data) { return; } From 0088d93ef33445f548ac39fd2124c9c5aa268e08 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Mon, 21 Jun 2021 16:33:15 -0300 Subject: [PATCH 5/7] chore(version-snjs): 2.7.4 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 31728ba4..3c416331 100644 --- a/package.json +++ b/package.json @@ -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.7.3", + "@standardnotes/snjs": "2.7.4", "js-base64": "^3.5.2", "moment": "^2.29.1", "react": "17.0.1", diff --git a/yarn.lock b/yarn.lock index c991ad73..b17ea982 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1630,10 +1630,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.7.3": - version "2.7.3" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.3.tgz#3b8d4bbcb0d841e02726193c4540d1b11d772249" - integrity sha512-YzD9/lxUS4nn922gR03/UHL9shqsyqikx+4Ud9v4IqtGEwKpusny4ecKPtvdbot/nedqEKpMZzrqT7xeNiRKqQ== +"@standardnotes/snjs@2.7.4": + version "2.7.4" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.4.tgz#0da670ab2cb76918fb6e75d57e5c00dfe82da196" + integrity sha512-UUNcXEdjX63YU0yBezwVVlvJ5HTic8l/CLqgjWrbsVAfPPJ8WC8FmGcv3yBOc+d56qgp+Tg1LMySYaOs67JRCw== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9" From 33195934d8b097ce4543669b5cbf8c12dc2a9dbf Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 22 Jun 2021 13:46:17 -0300 Subject: [PATCH 6/7] chore(version-snjs): 2.7.5 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 74a25dbb..b5459a28 100644 --- a/package.json +++ b/package.json @@ -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.7.4", + "@standardnotes/snjs": "2.7.5", "js-base64": "^3.5.2", "moment": "^2.29.1", "react": "17.0.1", diff --git a/yarn.lock b/yarn.lock index b17ea982..e4fcfab6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1630,10 +1630,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.7.4": - version "2.7.4" - resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.4.tgz#0da670ab2cb76918fb6e75d57e5c00dfe82da196" - integrity sha512-UUNcXEdjX63YU0yBezwVVlvJ5HTic8l/CLqgjWrbsVAfPPJ8WC8FmGcv3yBOc+d56qgp+Tg1LMySYaOs67JRCw== +"@standardnotes/snjs@2.7.5": + version "2.7.5" + resolved "https://registry.yarnpkg.com/@standardnotes/snjs/-/snjs-2.7.5.tgz#5ac5d071912a974acda73bb0720fa66bc5c14448" + integrity sha512-I15S2pwh+7w7pExnXJAUkLmhTySgMdnpUDEpKceufH9uUVvgdsZdz+Kfapv5/pFGOMBL3iDrY30anUSJWSsO1Q== dependencies: "@standardnotes/auth" "^2.0.0" "@standardnotes/sncrypto-common" "^1.2.9" From 092a0915ff41e5120ab547363be6193c56a919d2 Mon Sep 17 00:00:00 2001 From: Antonella Sgarlatta Date: Tue, 22 Jun 2021 13:46:49 -0300 Subject: [PATCH 7/7] chore(version): 3.6.14 --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b5459a28..3c56f3c6 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "StandardNotes", - "version": "3.6.13", - "user-version": "3.6.13", + "version": "3.6.14", + "user-version": "3.6.14", "private": true, "license": "AGPL-3.0-or-later", "scripts": {