From 5121ab0eed935e24a7c2617d5df12fd92b6115e8 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Sun, 22 Jun 2014 16:29:05 -0700 Subject: [PATCH] temporarily disable encrypted backup // FREEBIE --- res/layout/export_fragment.xml | 4 +- res/values/strings.xml | 4 + .../securesms/ExportFragment.java | 148 +++++++++--------- .../securesms/ImportExportActivity.java | 8 +- 4 files changed, 84 insertions(+), 80 deletions(-) diff --git a/res/layout/export_fragment.xml b/res/layout/export_fragment.xml index 8056164f58..38dff972cf 100644 --- a/res/layout/export_fragment.xml +++ b/res/layout/export_fragment.xml @@ -15,7 +15,7 @@ android:background="#ffeaeaea"> - - + Creating %1$s… Cannot add non-TextSecure contacts to an existing TextSecure group + + Import + Export + Import system SMS database? This will import diff --git a/src/org/thoughtcrime/securesms/ExportFragment.java b/src/org/thoughtcrime/securesms/ExportFragment.java index c980c987a5..da17f01395 100644 --- a/src/org/thoughtcrime/securesms/ExportFragment.java +++ b/src/org/thoughtcrime/securesms/ExportFragment.java @@ -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 { - 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 { +// 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; +// } +// } +// } } \ No newline at end of file diff --git a/src/org/thoughtcrime/securesms/ImportExportActivity.java b/src/org/thoughtcrime/securesms/ImportExportActivity.java index 175d1d5741..5cc3e5a76a 100644 --- a/src/org/thoughtcrime/securesms/ImportExportActivity.java +++ b/src/org/thoughtcrime/securesms/ImportExportActivity.java @@ -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); } }