[android] Skip error aler dialog if nothing to backup

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-06-30 22:50:19 +07:00
committed by Konstantin Pastbin
parent ac30139432
commit b409d805cc

View File

@@ -292,18 +292,25 @@ public class BackupSettingsFragment
@Override @Override
public void onBackupFailed(LocalBackupManager.ErrorCode errorCode) public void onBackupFailed(LocalBackupManager.ErrorCode errorCode)
{ {
String errorMessage = switch (errorCode) String errorMessage;
if (errorCode == LocalBackupManager.ErrorCode.EMPTY_CATEGORY)
{ {
case EMPTY_CATEGORY -> requireContext().getString(R.string.pref_backup_now_summary_empty_lists); errorMessage = requireContext().getString(R.string.pref_backup_now_summary_empty_lists);
default -> requireContext().getString(R.string.pref_backup_now_summary_failed); Logger.i(TAG, "Nothing to backup");
}; }
else
Logger.e(TAG, "Manual backup was failed with code: " + errorCode); {
errorMessage = requireContext().getString(R.string.pref_backup_now_summary_failed);
Logger.e(TAG, "Manual backup has failed: " + errorCode);
}
backupNowOption.setEnabled(true); backupNowOption.setEnabled(true);
backupNowOption.setSummary(errorMessage); backupNowOption.setSummary(errorMessage);
showBackupErrorAlertDialog(requireContext().getString(R.string.dialog_report_error_with_logs)); if (errorCode != LocalBackupManager.ErrorCode.EMPTY_CATEGORY)
{
showBackupErrorAlertDialog(requireContext().getString(R.string.dialog_report_error_with_logs));
}
} }
}); });