Show notification when failing to import settings

This commit is contained in:
Stypox 2024-03-30 18:53:45 +01:00
parent 7da1d30010
commit 2756ef6d2f
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
2 changed files with 7 additions and 2 deletions

View File

@ -217,7 +217,7 @@ public class BackupRestoreSettingsFragment extends BasePreferenceFragment {
manager.loadSerializedPrefs(file, prefs);
}
} catch (IOException | ClassNotFoundException | JsonParserException e) {
showErrorSnackbar(e, "Importing preferences");
createErrorNotification(e, "Importing preferences");
return;
}
cleanImport(context, prefs);
@ -290,4 +290,10 @@ public class BackupRestoreSettingsFragment extends BasePreferenceFragment {
private void showErrorSnackbar(final Throwable e, final String request) {
ErrorUtil.showSnackbar(this, new ErrorInfo(e, UserAction.DATABASE_IMPORT_EXPORT, request));
}
private void createErrorNotification(final Throwable e, final String request) {
ErrorUtil.createNotification(
requireContext(),
new ErrorInfo(e, UserAction.DATABASE_IMPORT_EXPORT, request)
);
}
}

View File

@ -1,7 +1,6 @@
package org.schabi.newpipe.settings.export
import android.content.SharedPreferences
import android.util.Log
import com.grack.nanojson.JsonArray
import com.grack.nanojson.JsonParser
import com.grack.nanojson.JsonParserException