mirror of
https://github.com/etesync/android
synced 2025-02-02 10:51:10 +00:00
Cleanup error messages in notifications.
This commit is contained in:
parent
09196e52a5
commit
d832ae9bc6
@ -88,7 +88,7 @@ public class CalendarsSyncAdapterService extends SyncAdapterService {
|
||||
syncResult.databaseError = true;
|
||||
}
|
||||
|
||||
String syncPhase = SyncManager.SYNC_PHASE_JOURNALS;
|
||||
int syncPhase = R.string.sync_phase_journals;
|
||||
String title = getContext().getString(R.string.sync_error_calendar, account.name);
|
||||
|
||||
notificationManager.setThrowable(e);
|
||||
@ -102,7 +102,7 @@ public class CalendarsSyncAdapterService extends SyncAdapterService {
|
||||
detailsIntent.putExtra(DebugInfoActivity.KEY_PHASE, syncPhase);
|
||||
}
|
||||
|
||||
notificationManager.notify(title, syncPhase);
|
||||
notificationManager.notify(title, getContext().getString(syncPhase));
|
||||
}
|
||||
|
||||
App.log.info("Calendar sync complete");
|
||||
|
@ -84,7 +84,7 @@ public class ContactsSyncAdapterService extends SyncAdapterService {
|
||||
syncResult.stats.numIoExceptions++;
|
||||
syncResult.delayUntil = (e.retryAfter > 0) ? e.retryAfter : Constants.DEFAULT_RETRY_DELAY;
|
||||
} catch (Exception | OutOfMemoryError e) {
|
||||
String syncPhase = SyncManager.SYNC_PHASE_JOURNALS;
|
||||
int syncPhase = R.string.sync_phase_journals;
|
||||
String title = getContext().getString(R.string.sync_error_contacts, account.name);
|
||||
|
||||
notificationManager.setThrowable(e);
|
||||
@ -97,7 +97,7 @@ public class ContactsSyncAdapterService extends SyncAdapterService {
|
||||
detailsIntent.putExtra(DebugInfoActivity.KEY_AUTHORITY, authority);
|
||||
detailsIntent.putExtra(DebugInfoActivity.KEY_PHASE, syncPhase);
|
||||
}
|
||||
notificationManager.notify(title, syncPhase);
|
||||
notificationManager.notify(title, getContext().getString(syncPhase));
|
||||
} finally {
|
||||
dbHelper.close();
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import at.bitfire.davdroid.GsonHelper;
|
||||
import at.bitfire.davdroid.HttpClient;
|
||||
import at.bitfire.davdroid.InvalidAccountException;
|
||||
import at.bitfire.davdroid.NotificationHelper;
|
||||
import at.bitfire.davdroid.R;
|
||||
import at.bitfire.davdroid.journalmanager.Exceptions;
|
||||
import at.bitfire.davdroid.journalmanager.JournalEntryManager;
|
||||
import at.bitfire.davdroid.model.CollectionInfo;
|
||||
@ -48,18 +49,6 @@ import lombok.Getter;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
abstract public class SyncManager {
|
||||
|
||||
final static String SYNC_PHASE_PREPARE = "sync_phase_prepare",
|
||||
SYNC_PHASE_JOURNALS = "sync_phase_journals",
|
||||
SYNC_PHASE_QUERY_CAPABILITIES = "sync_phase_query_capabilities",
|
||||
SYNC_PHASE_PREPARE_LOCAL = "sync_phase_prepare_local",
|
||||
SYNC_PHASE_CREATE_LOCAL_ENTRIES = "sync_phase_create_local_entries",
|
||||
SYNC_PHASE_FETCH_ENTRIES = "sync_phase_fetch_entries",
|
||||
SYNC_PHASE_APPLY_REMOTE_ENTRIES = "sync_phase_apply_remote_entries",
|
||||
SYNC_PHASE_APPLY_LOCAL_ENTRIES = "sync_phase_apply_local_entries",
|
||||
SYNC_PHASE_PUSH_ENTRIES = "sync_phase_push_entries",
|
||||
SYNC_PHASE_POST_PROCESSING = "sync_phase_post_processing";
|
||||
|
||||
protected final NotificationHelper notificationManager;
|
||||
protected final String uniqueCollectionId;
|
||||
|
||||
@ -122,7 +111,7 @@ abstract public class SyncManager {
|
||||
|
||||
@TargetApi(21)
|
||||
public void performSync() {
|
||||
String syncPhase = SYNC_PHASE_PREPARE;
|
||||
int syncPhase = R.string.sync_phase_prepare;
|
||||
try {
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
if (!prepare()) {
|
||||
@ -132,51 +121,51 @@ abstract public class SyncManager {
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_QUERY_CAPABILITIES;
|
||||
syncPhase = R.string.sync_phase_query_capabilities;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
queryCapabilities();
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_PREPARE_LOCAL;
|
||||
syncPhase = R.string.sync_phase_prepare_local;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
prepareLocal();
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_FETCH_ENTRIES;
|
||||
syncPhase = R.string.sync_phase_fetch_entries;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
fetchEntries();
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_APPLY_REMOTE_ENTRIES;
|
||||
syncPhase = R.string.sync_phase_apply_remote_entries;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
applyRemoteEntries();
|
||||
|
||||
/* Create journal entries out of local changes. */
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_CREATE_LOCAL_ENTRIES;
|
||||
syncPhase = R.string.sync_phase_create_local_entries;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
createLocalEntries();
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_APPLY_LOCAL_ENTRIES;
|
||||
syncPhase = R.string.sync_phase_apply_local_entries;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
applyLocalEntries();
|
||||
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_PUSH_ENTRIES;
|
||||
syncPhase = R.string.sync_phase_push_entries;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
pushEntries();
|
||||
|
||||
/* Cleanup and finalize changes */
|
||||
if (Thread.interrupted())
|
||||
return;
|
||||
syncPhase = SYNC_PHASE_POST_PROCESSING;
|
||||
syncPhase = R.string.sync_phase_post_processing;
|
||||
App.log.info("Sync phase: " + syncPhase);
|
||||
postProcess();
|
||||
} catch (IOException e) {
|
||||
@ -211,7 +200,7 @@ abstract public class SyncManager {
|
||||
detailsIntent.putExtra(DebugInfoActivity.KEY_PHASE, syncPhase);
|
||||
}
|
||||
|
||||
notificationManager.notify(getSyncErrorTitle(), syncPhase);
|
||||
notificationManager.notify(getSyncErrorTitle(), context.getString(syncPhase));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,20 +269,16 @@
|
||||
<string name="sync_error_http_dav">Server error while %s</string>
|
||||
<string name="sync_error_unavailable">Could not connect to server while %s</string>
|
||||
<string name="sync_error_local_storage">Database error while %s</string>
|
||||
<string-array name="sync_error_phases">
|
||||
<item>preparing synchronization</item>
|
||||
<item>querying capabilities</item>
|
||||
<item>processing locally deleted entries</item>
|
||||
<item>preparing created/modified entries</item>
|
||||
<item>uploading created/modified entries</item>
|
||||
<item>checking sync state</item>
|
||||
<item>listing local entries</item>
|
||||
<item>listing remote entries</item>
|
||||
<item>comparing local/remote entries</item>
|
||||
<item>downloading remote entries</item>
|
||||
<item>post-processing</item>
|
||||
<item>saving sync state</item>
|
||||
</string-array>
|
||||
<string name="sync_phase_prepare">preparing synchronization</string>
|
||||
<string name="sync_phase_journals">syncronizing journals</string>
|
||||
<string name="sync_phase_query_capabilities">querying capabilities</string>
|
||||
<string name="sync_phase_prepare_local">preparing local entries</string>
|
||||
<string name="sync_phase_create_local_entries">creating local entries</string>
|
||||
<string name="sync_phase_fetch_entries">fetching remote entries</string>
|
||||
<string name="sync_phase_apply_remote_entries">applying remote entries</string>
|
||||
<string name="sync_phase_apply_local_entries">reapplying local entries</string>
|
||||
<string name="sync_phase_push_entries">pushing entries</string>
|
||||
<string name="sync_phase_post_processing">post processing</string>
|
||||
<string name="sync_error_unauthorized">Authentication failed</string>
|
||||
|
||||
<!-- cert4android -->
|
||||
|
Loading…
Reference in New Issue
Block a user