1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-26 09:47:13 +00:00

Check SAF before export/import

This commit is contained in:
M66B 2019-12-02 15:10:19 +01:00
parent 6aac7cfa2e
commit c24ebe7381

View file

@ -373,31 +373,33 @@ public class ActivitySetup extends ActivityBase implements FragmentManager.OnBac
} }
private void onMenuExport() { private void onMenuExport() {
if (ActivityBilling.isPro(this)) { if (ActivityBilling.isPro(this))
try { askPassword(true);
askPassword(true); else
} catch (Throwable ex) {
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
} else
startActivity(new Intent(this, ActivityBilling.class)); startActivity(new Intent(this, ActivityBilling.class));
} }
private void onMenuImport() { private void onMenuImport() {
try { askPassword(false);
askPassword(false);
} catch (Throwable ex) {
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
} }
private void askPassword(final boolean export) { private void askPassword(final boolean export) {
Bundle args = new Bundle(); Intent intent = (export ? getIntentExport() : getIntentImport());
args.putBoolean("export", export); if (intent.resolveActivity(getPackageManager()) == null) {
ToastEx.makeText(this, R.string.title_no_saf, Toast.LENGTH_LONG).show();
return;
}
FragmentDialogPassword fragment = new FragmentDialogPassword(); try {
fragment.setArguments(args); Bundle args = new Bundle();
fragment.show(getSupportFragmentManager(), "password"); args.putBoolean("export", export);
FragmentDialogPassword fragment = new FragmentDialogPassword();
fragment.setArguments(args);
fragment.show(getSupportFragmentManager(), "password");
} catch (Throwable ex) {
Helper.unexpectedError(getSupportFragmentManager(), ex);
}
} }
private void onMenuOrder(int title, Class clazz) { private void onMenuOrder(int title, Class clazz) {