1
0
mirror of https://github.com/nerzhul/ownCloud-SMS-App.git synced 2025-07-03 04:36:40 +00:00

Add a feature to reinitialize synchronization cursor

This commit is contained in:
Loic Blot 2017-03-23 20:42:09 +01:00
parent f83eebe4dd
commit afa0fc2fac
No known key found for this signature in database
GPG Key ID: EFAA458E8C153987
6 changed files with 44 additions and 8 deletions

View File

@ -1,7 +1,10 @@
package fr.unix_experience.owncloud_sms.activities.remote_account; package fr.unix_experience.owncloud_sms.activities.remote_account;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.os.Bundle; import android.os.Bundle;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBar;
import android.util.Log; import android.util.Log;
import android.view.MenuItem; import android.view.MenuItem;
@ -13,6 +16,7 @@ import java.util.ArrayList;
import fr.unix_experience.android_lib.AppCompatListActivity; import fr.unix_experience.android_lib.AppCompatListActivity;
import fr.unix_experience.owncloud_sms.R; import fr.unix_experience.owncloud_sms.R;
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
public class AccountActionsActivity extends AppCompatListActivity { public class AccountActionsActivity extends AppCompatListActivity {
@Override @Override
@ -31,6 +35,7 @@ public class AccountActionsActivity extends AppCompatListActivity {
// Create item list // Create item list
itemList.add(getBaseContext().getString(R.string.restore_all_messages)); itemList.add(getBaseContext().getString(R.string.restore_all_messages));
itemList.add(getBaseContext().getString(R.string.reinit_sync_cursor));
adp.notifyDataSetChanged(); adp.notifyDataSetChanged();
@ -57,14 +62,31 @@ public class AccountActionsActivity extends AppCompatListActivity {
case 0: case 0:
Intent intent = new Intent(this, RestoreMessagesActivity.class); Intent intent = new Intent(this, RestoreMessagesActivity.class);
intent.putExtra("account", _accountName); intent.putExtra("account", _accountName);
try { try {
startActivity(intent); startActivity(intent);
} catch (IllegalStateException e) { }
Log.e(AccountActionsActivity.TAG, e.getMessage()); catch (IllegalStateException e) {
} Log.e(AccountActionsActivity.TAG, e.getMessage());
}
break; break;
default: case 1:
break; // Unhandled final Context me = this;
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(R.string.reinit_sync_cursor)
.setMessage(R.string.reinit_sync_cursor_confirm)
.setPositiveButton(R.string.yes_confirm, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
(new OCSMSSharedPrefs(me)).setLastMessageDate(0L);
Log.i(AccountActionsActivity.TAG, "Synchronization cursor reinitialized");
}
})
.setNegativeButton(R.string.no_confirm, null)
.show();
break;
default: break; // Unhandled
} }
} }

View File

@ -95,7 +95,7 @@ public class OCSMSOwnCloudClient {
} }
public void doPushRequest(JSONArray smsList) throws OCSyncException { public void doPushRequest(JSONArray smsList) throws OCSyncException {
/** /*
* If we need other API push, set it here * If we need other API push, set it here
*/ */
switch (_serverAPIVersion) { switch (_serverAPIVersion) {

View File

@ -153,5 +153,9 @@
<string name="error_make_default_sms_app">Please make this application default SMS application to permit restore your messages. This limitation has been introduced by Android 4.4.</string> <string name="error_make_default_sms_app">Please make this application default SMS application to permit restore your messages. This limitation has been introduced by Android 4.4.</string>
<string name="x_messages_restored">messages restored...</string> <string name="x_messages_restored">messages restored...</string>
<string name="err_no_connection">No connection available, please ensure you have a valid data connection.</string> <string name="err_no_connection">No connection available, please ensure you have a valid data connection.</string>
<string name="reinit_sync_cursor">Reinit synchronisation cursor</string>
<string name="reinit_sync_cursor_confirm">Are you sure you want to reinitialize the synchronization cursor ? This can slowdown the next synchronisation if we found many old messages not synced with server.</string>
<string name="yes_confirm">Yes</string>
<string name="no_confirm">No</string>
</resources> </resources>

View File

@ -177,4 +177,6 @@
<string name="restore_finished">La restauración SMS se ha completado.</string> <string name="restore_finished">La restauración SMS se ha completado.</string>
<string name="x_messages_restored">mensajes restaurados&#8230;</string> <string name="x_messages_restored">mensajes restaurados&#8230;</string>
<string name="err_no_connection">Sin conexión disponible, por favor asegure que tiene una conexión de datos válida.</string> <string name="err_no_connection">Sin conexión disponible, por favor asegure que tiene una conexión de datos válida.</string>
<string name="yes_confirm">Si</string>
<string name="no_confirm">No</string>
</resources> </resources>

View File

@ -177,4 +177,8 @@
<string name="restore_finished">La restauration des SMS est terminée</string> <string name="restore_finished">La restauration des SMS est terminée</string>
<string name="x_messages_restored">messages restaurés...</string> <string name="x_messages_restored">messages restaurés...</string>
<string name="err_no_connection">Aucune connexion disponible, vérifiez que vous disposez d\'une connexion de données valide.</string> <string name="err_no_connection">Aucune connexion disponible, vérifiez que vous disposez d\'une connexion de données valide.</string>
<string name="reinit_sync_cursor">Réinitialiser le curseur de synchronisation</string>
<string name="reinit_sync_cursor_confirm">Êtes vous sûr de vouloir réinitialiser le curseur de synchronisation ? Cela peut ralentir fortement la prochaine synchronisation si l\'application trouve beaucoup d\'anciens messages non synchronisés avec le serveur.</string>
<string name="yes_confirm">Oui</string>
<string name="no_confirm">Non</string>
</resources> </resources>

View File

@ -254,4 +254,8 @@
<string name="restore_finished">SMS restoration is now finished.</string> <string name="restore_finished">SMS restoration is now finished.</string>
<string name="x_messages_restored">messages restored&#8230;</string> <string name="x_messages_restored">messages restored&#8230;</string>
<string name="err_no_connection">No connection available, please ensure you have a valid data connection.</string> <string name="err_no_connection">No connection available, please ensure you have a valid data connection.</string>
<string name="reinit_sync_cursor">Reinit synchronisation cursor</string>
<string name="reinit_sync_cursor_confirm">Are you sure you want to reinitialize the synchronization cursor ? This can slowdown the next synchronisation if we found many old messages not synced with server.</string>
<string name="yes_confirm">Yes</string>
<string name="no_confirm">No</string>
</resources> </resources>