mirror of
https://github.com/oxen-io/session-android.git
synced 2023-12-14 02:53:01 +01:00
temporarily disable encrypted backup
// FREEBIE
This commit is contained in:
parent
622d8975fc
commit
5121ab0eed
4 changed files with 84 additions and 80 deletions
|
@ -15,7 +15,7 @@
|
|||
android:background="#ffeaeaea">
|
||||
|
||||
|
||||
<LinearLayout android:id="@+id/export_encrypted_backup"
|
||||
<!--LinearLayout android:id="@+id/export_encrypted_backup"
|
||||
android:clickable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -53,7 +53,7 @@
|
|||
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</LinearLayout-->
|
||||
|
||||
|
||||
<LinearLayout android:id="@+id/export_plaintext_backup"
|
||||
|
|
|
@ -161,6 +161,10 @@
|
|||
<string name="GroupCreateActivity_creating_group">Creating %1$s…</string>
|
||||
<string name="GroupCreateActivity_cannot_add_non_push_to_existing_group">Cannot add non-TextSecure contacts to an existing TextSecure group</string>
|
||||
|
||||
<!-- ImportExportActivity -->
|
||||
<string name="ImportExportActivity_import">Import</string>
|
||||
<string name="ImportExportActivity_export">Export</string>
|
||||
|
||||
<!-- ImportFragment -->
|
||||
<string name="ImportFragment_import_system_sms_database">Import system SMS database?</string>
|
||||
<string name="ImportFragment_this_will_import_messages_from_the_system">This will import
|
||||
|
|
|
@ -16,7 +16,7 @@ import android.widget.Toast;
|
|||
import com.actionbarsherlock.app.SherlockFragment;
|
||||
import org.whispersystems.textsecure.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.util.Dialogs;
|
||||
import org.thoughtcrime.securesms.database.EncryptedBackupExporter;
|
||||
//import org.thoughtcrime.securesms.database.EncryptedBackupExporter;
|
||||
import org.thoughtcrime.securesms.database.NoExternalStorageException;
|
||||
import org.thoughtcrime.securesms.database.PlaintextBackupExporter;
|
||||
|
||||
|
@ -38,15 +38,15 @@ public class ExportFragment extends SherlockFragment {
|
|||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle bundle) {
|
||||
View layout = inflater.inflate(R.layout.export_fragment, container, false);
|
||||
View exportEncryptedView = layout.findViewById(R.id.export_encrypted_backup);
|
||||
// View exportEncryptedView = layout.findViewById(R.id.export_encrypted_backup);
|
||||
View exportPlaintextView = layout.findViewById(R.id.export_plaintext_backup);
|
||||
|
||||
exportEncryptedView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
handleExportEncryptedBackup();
|
||||
}
|
||||
});
|
||||
// exportEncryptedView.setOnClickListener(new View.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(View v) {
|
||||
// handleExportEncryptedBackup();
|
||||
// }
|
||||
// });
|
||||
|
||||
exportPlaintextView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
@ -58,20 +58,20 @@ public class ExportFragment extends SherlockFragment {
|
|||
return layout;
|
||||
}
|
||||
|
||||
private void handleExportEncryptedBackup() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_info_icon));
|
||||
builder.setTitle(getActivity().getString(R.string.ExportFragment_export_to_sd_card));
|
||||
builder.setMessage(getActivity().getString(R.string.ExportFragment_this_will_export_your_encrypted_keys_settings_and_messages));
|
||||
builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
new ExportEncryptedTask().execute();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);
|
||||
builder.show();
|
||||
}
|
||||
// private void handleExportEncryptedBackup() {
|
||||
// AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
// builder.setIcon(Dialogs.resolveIcon(getActivity(), R.attr.dialog_info_icon));
|
||||
// builder.setTitle(getActivity().getString(R.string.ExportFragment_export_to_sd_card));
|
||||
// builder.setMessage(getActivity().getString(R.string.ExportFragment_this_will_export_your_encrypted_keys_settings_and_messages));
|
||||
// builder.setPositiveButton(getActivity().getString(R.string.ExportFragment_export), new Dialog.OnClickListener() {
|
||||
// @Override
|
||||
// public void onClick(DialogInterface dialog, int which) {
|
||||
// new ExportEncryptedTask().execute();
|
||||
// }
|
||||
// });
|
||||
// builder.setNegativeButton(getActivity().getString(R.string.ExportFragment_cancel), null);
|
||||
// builder.show();
|
||||
// }
|
||||
|
||||
private void handleExportPlaintextBackup() {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
|
@ -143,56 +143,56 @@ public class ExportFragment extends SherlockFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private class ExportEncryptedTask extends AsyncTask<Void, Void, Integer> {
|
||||
private ProgressDialog dialog;
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
dialog = ProgressDialog.show(getActivity(),
|
||||
getActivity().getString(R.string.ExportFragment_exporting),
|
||||
getActivity().getString(R.string.ExportFragment_exporting_keys_settings_and_messages),
|
||||
true, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Integer result) {
|
||||
Context context = getActivity();
|
||||
|
||||
if (dialog != null) dialog.dismiss();
|
||||
|
||||
if (context == null) return;
|
||||
|
||||
switch (result) {
|
||||
case NO_SD_CARD:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_error_unable_to_write_to_sd_card),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case IO_ERROR:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_error_while_writing_to_sd_card),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
case SUCCESS:
|
||||
Toast.makeText(context,
|
||||
context.getString(R.string.ExportFragment_success),
|
||||
Toast.LENGTH_LONG).show();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Integer doInBackground(Void... params) {
|
||||
try {
|
||||
EncryptedBackupExporter.exportToSd(getActivity());
|
||||
return SUCCESS;
|
||||
} catch (NoExternalStorageException e) {
|
||||
Log.w("ExportFragment", e);
|
||||
return NO_SD_CARD;
|
||||
} catch (IOException e) {
|
||||
Log.w("ExportFragment", e);
|
||||
return IO_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
// private class ExportEncryptedTask extends AsyncTask<Void, Void, Integer> {
|
||||
// private ProgressDialog dialog;
|
||||
//
|
||||
// @Override
|
||||
// protected void onPreExecute() {
|
||||
// dialog = ProgressDialog.show(getActivity(),
|
||||
// getActivity().getString(R.string.ExportFragment_exporting),
|
||||
// getActivity().getString(R.string.ExportFragment_exporting_keys_settings_and_messages),
|
||||
// true, false);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void onPostExecute(Integer result) {
|
||||
// Context context = getActivity();
|
||||
//
|
||||
// if (dialog != null) dialog.dismiss();
|
||||
//
|
||||
// if (context == null) return;
|
||||
//
|
||||
// switch (result) {
|
||||
// case NO_SD_CARD:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_error_unable_to_write_to_sd_card),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// case IO_ERROR:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_error_while_writing_to_sd_card),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// case SUCCESS:
|
||||
// Toast.makeText(context,
|
||||
// context.getString(R.string.ExportFragment_success),
|
||||
// Toast.LENGTH_LONG).show();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected Integer doInBackground(Void... params) {
|
||||
// try {
|
||||
// EncryptedBackupExporter.exportToSd(getActivity());
|
||||
// return SUCCESS;
|
||||
// } catch (NoExternalStorageException e) {
|
||||
// Log.w("ExportFragment", e);
|
||||
// return NO_SD_CARD;
|
||||
// } catch (IOException e) {
|
||||
// Log.w("ExportFragment", e);
|
||||
// return IO_ERROR;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
|
@ -72,8 +72,8 @@ public class ImportExportActivity extends PassphraseRequiredSherlockFragmentActi
|
|||
public void onTabReselected(ActionBar.Tab tab, FragmentTransaction ft) {}
|
||||
};
|
||||
|
||||
actionBar.addTab(actionBar.newTab().setText("Import").setTabListener(tabListener));
|
||||
actionBar.addTab(actionBar.newTab().setText("Export").setTabListener(tabListener));
|
||||
actionBar.addTab(actionBar.newTab().setText(R.string.ImportExportActivity_import).setTabListener(tabListener));
|
||||
actionBar.addTab(actionBar.newTab().setText(R.string.ImportExportActivity_export).setTabListener(tabListener));
|
||||
}
|
||||
|
||||
private class TabPagerAdapter extends FragmentStatePagerAdapter {
|
||||
|
@ -102,8 +102,8 @@ public class ImportExportActivity extends PassphraseRequiredSherlockFragmentActi
|
|||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int i) {
|
||||
if (i == 0) return "Import";
|
||||
else return "Export";
|
||||
if (i == 0) return getString(R.string.ImportExportActivity_import);
|
||||
else return getString(R.string.ImportExportActivity_export);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue