diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml
index 35257cc3..a0e634b1 100644
--- a/android/app/src/main/AndroidManifest.xml
+++ b/android/app/src/main/AndroidManifest.xml
@@ -5,7 +5,7 @@
-
+
{
+ const downloadPem = () => {
dispatch(
getPemFile({
walletId: selectedWallet.walletId,
@@ -111,6 +112,19 @@ function ExportPem({ modalRef }: Props) {
);
};
+ const handleExportPem = async () => {
+ if (isIos) {
+ downloadPem();
+ } else {
+ await requestStoragePermissions(() => {
+ toast.showError(
+ t('exportPem.permissionError.title'),
+ t('exportPem.permissionError.message')
+ );
+ }, downloadPem);
+ }
+ };
+
const renderAccount = (account: Wallet) => {
const { name, walletId, icon, principal } = account;
const selected = selectedWallet.walletId === walletId;
diff --git a/src/translations/en/index.js b/src/translations/en/index.js
index 3809a2f5..ef8581bc 100644
--- a/src/translations/en/index.js
+++ b/src/translations/en/index.js
@@ -353,6 +353,10 @@ const translations = {
message:
'There was an error while exporting the account. Please try again.',
},
+ permissionError: {
+ title: 'Error Exporting Account',
+ message: 'You need to allow the app to access storage to save the file.',
+ },
success: {
title: 'Account Successfully Exported',
messageIos: 'Your .pem file should be located at the choosen directory.',
diff --git a/src/utils/filesystem.ts b/src/utils/filesystem.ts
index b24369ca..39ef19d8 100644
--- a/src/utils/filesystem.ts
+++ b/src/utils/filesystem.ts
@@ -6,7 +6,7 @@ import { isAndroid, isIos } from '@/constants/platform';
import { getExtension } from './fileTypes';
-const requestStoragePermissions = async (
+export const requestStoragePermissions = async (
onError?: () => void,
onSuccess?: () => void
) => {