Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

Commit

Permalink
Merge branch 'release/3.6.14' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonella Sgarlatta committed Jun 22, 2021
2 parents e70f24b + 092a091 commit 2de56c6
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 15 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
android:protectionLevel="signature" />

<uses-permission android:name="android.permission.READ_PHONE_STATE" tools:node="remove"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="remove"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" tools:node="remove"/>

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.USE_BIOMETRIC"/>
<uses-permission android:name="android.permission.USE_FINGERPRINT"/>

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand All @@ -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",
Expand Down
28 changes: 21 additions & 7 deletions src/lib/backups_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -92,10 +91,25 @@ export class BackupsService extends ApplicationService {
}

private async _exportAndroid(filename: string, data: string) {
const filepath = `${RNFS.ExternalDirectoryPath}/${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) {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected].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/[email protected].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"
Expand Down

0 comments on commit 2de56c6

Please sign in to comment.