1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-06-23 07:46:22 +00:00

Fullsync: add a complete sync message when sync is done instead of telling nothing to sync

This commit is contained in:
Loic Blot 2017-09-12 08:10:58 +02:00
parent 47abfac7c3
commit 587099dba7
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
5 changed files with 10 additions and 1 deletions

View File

@ -68,15 +68,19 @@ public interface ASyncSMSSync {
Log.i(ASyncSMSSync.TAG, "Current message date is " + syncStartupDate); Log.i(ASyncSMSSync.TAG, "Current message date is " + syncStartupDate);
boolean shouldSync = true; boolean shouldSync = true;
boolean hasSyncSomething = false;
AndroidSmsFetcher fetcher = new AndroidSmsFetcher(_context); AndroidSmsFetcher fetcher = new AndroidSmsFetcher(_context);
while (shouldSync) { while (shouldSync) {
SmsBuffer smsBuffer = new SmsBuffer(); SmsBuffer smsBuffer = new SmsBuffer();
fetcher.bufferMessagesSinceDate(smsBuffer, syncStartupDate); fetcher.bufferMessagesSinceDate(smsBuffer, syncStartupDate);
if (smsBuffer.empty()) { if (smsBuffer.empty()) {
if (_activity != null) { if (_activity != null) {
final boolean syncComplete = hasSyncSomething;
_activity.runOnUiThread(new Runnable() { _activity.runOnUiThread(new Runnable() {
public void run() { public void run() {
Toast.makeText(_context, _context.getString(R.string.nothing_to_sync), Toast.LENGTH_SHORT).show(); Toast.makeText(_context,
_context.getString(syncComplete ? R.string.sync_complete : R.string.nothing_to_sync),
Toast.LENGTH_SHORT).show();
} }
}); });
} }
@ -94,6 +98,7 @@ public interface ASyncSMSSync {
syncStartupDate = smsBuffer.getLastMessageDate(); syncStartupDate = smsBuffer.getLastMessageDate();
performSync(smsBuffer); performSync(smsBuffer);
hasSyncSomething = true;
} }
} }

View File

@ -182,4 +182,5 @@
<string name="yes_confirm">Yes</string> <string name="yes_confirm">Yes</string>
<string name="no_confirm">No</string> <string name="no_confirm">No</string>
<string name="pref_show_sync_notifications">Show sync notifications</string> <string name="pref_show_sync_notifications">Show sync notifications</string>
<string name="sync_complete">Synchronization complete</string>
</resources> </resources>

View File

@ -158,5 +158,6 @@
<string name="yes_confirm">Yes</string> <string name="yes_confirm">Yes</string>
<string name="no_confirm">No</string> <string name="no_confirm">No</string>
<string name="pref_show_sync_notifications">Show sync notifications</string> <string name="pref_show_sync_notifications">Show sync notifications</string>
<string name="sync_complete">Synchronization complete</string>
</resources> </resources>

View File

@ -182,4 +182,5 @@
<string name="yes_confirm">Oui</string> <string name="yes_confirm">Oui</string>
<string name="no_confirm">Non</string> <string name="no_confirm">Non</string>
<string name="pref_show_sync_notifications">Afficher les notifications de synchronisation</string> <string name="pref_show_sync_notifications">Afficher les notifications de synchronisation</string>
<string name="sync_complete">Synchronisation terminée</string>
</resources> </resources>

View File

@ -271,4 +271,5 @@
<string name="yes_confirm">Yes</string> <string name="yes_confirm">Yes</string>
<string name="no_confirm">No</string> <string name="no_confirm">No</string>
<string name="pref_show_sync_notifications">Show sync notifications</string> <string name="pref_show_sync_notifications">Show sync notifications</string>
<string name="sync_complete">Synchronization complete</string>
</resources> </resources>