forked from mirror/monocles_chat_clean
Fix and improve settings import and export
This commit is contained in:
parent
83a5a19a4f
commit
2e2b13fc72
2 changed files with 9 additions and 1 deletions
|
@ -239,7 +239,7 @@ public class BackupSettingsFragment extends XmppPreferenceFragment {
|
|||
boolean success;
|
||||
ObjectInputStream input = null;
|
||||
try {
|
||||
final File file = new File(FileBackend.getBackupDirectory(requireContext()).getAbsolutePath() + "/settings.dat");
|
||||
final File file = new File(FileBackend.getBackupDirectory(requireContext()).getAbsolutePath(),"settings.dat");
|
||||
input = new ObjectInputStream(new FileInputStream(file));
|
||||
SharedPreferences.Editor prefEdit = PreferenceManager.getDefaultSharedPreferences(requireSettingsActivity()).edit();
|
||||
prefEdit.clear();
|
||||
|
@ -309,6 +309,12 @@ public class BackupSettingsFragment extends XmppPreferenceFragment {
|
|||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (success) {
|
||||
new Thread(() -> runOnUiThread(() -> requireActivity().recreate())).start();
|
||||
ToastCompat.makeText(requireActivity(), R.string.success_export_settings, ToastCompat.LENGTH_SHORT).show();
|
||||
} else {
|
||||
ToastCompat.makeText(requireActivity(), R.string.error_export_settings, ToastCompat.LENGTH_SHORT).show();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
@ -1410,4 +1410,6 @@
|
|||
<string name="pref_use_colored_muc_names_summary">Use colored user names in group chats</string>
|
||||
<string name="delete_avatar_message">Would you like to delete your avatar? Some clients might continue to display a cached copy of your avatar.</string>
|
||||
<string name="show_to_contacts_only">Show to contacts only</string>
|
||||
<string name="success_export_settings">Settings successfully exported</string>
|
||||
<string name="error_export_settings">Error while exporting settings</string>
|
||||
</resources>
|
Loading…
Reference in a new issue