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:
parent
f83eebe4dd
commit
afa0fc2fac
@ -1,7 +1,10 @@
|
||||
package fr.unix_experience.owncloud_sms.activities.remote_account;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.ActionBar;
|
||||
import android.util.Log;
|
||||
import android.view.MenuItem;
|
||||
@ -13,6 +16,7 @@ import java.util.ArrayList;
|
||||
|
||||
import fr.unix_experience.android_lib.AppCompatListActivity;
|
||||
import fr.unix_experience.owncloud_sms.R;
|
||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||
|
||||
public class AccountActionsActivity extends AppCompatListActivity {
|
||||
@Override
|
||||
@ -31,6 +35,7 @@ public class AccountActionsActivity extends AppCompatListActivity {
|
||||
|
||||
// Create item list
|
||||
itemList.add(getBaseContext().getString(R.string.restore_all_messages));
|
||||
itemList.add(getBaseContext().getString(R.string.reinit_sync_cursor));
|
||||
|
||||
adp.notifyDataSetChanged();
|
||||
|
||||
@ -57,14 +62,31 @@ public class AccountActionsActivity extends AppCompatListActivity {
|
||||
case 0:
|
||||
Intent intent = new Intent(this, RestoreMessagesActivity.class);
|
||||
intent.putExtra("account", _accountName);
|
||||
try {
|
||||
startActivity(intent);
|
||||
} catch (IllegalStateException e) {
|
||||
Log.e(AccountActionsActivity.TAG, e.getMessage());
|
||||
}
|
||||
try {
|
||||
startActivity(intent);
|
||||
}
|
||||
catch (IllegalStateException e) {
|
||||
Log.e(AccountActionsActivity.TAG, e.getMessage());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break; // Unhandled
|
||||
case 1:
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class OCSMSOwnCloudClient {
|
||||
}
|
||||
|
||||
public void doPushRequest(JSONArray smsList) throws OCSyncException {
|
||||
/**
|
||||
/*
|
||||
* If we need other API push, set it here
|
||||
*/
|
||||
switch (_serverAPIVersion) {
|
||||
|
@ -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="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="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>
|
||||
|
@ -177,4 +177,6 @@
|
||||
<string name="restore_finished">La restauración SMS se ha completado.</string>
|
||||
<string name="x_messages_restored">mensajes restaurados…</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>
|
||||
|
@ -177,4 +177,8 @@
|
||||
<string name="restore_finished">La restauration des SMS est terminée</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="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>
|
||||
|
@ -254,4 +254,8 @@
|
||||
<string name="restore_finished">SMS restoration is now finished.</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="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>
|
||||
|
Loading…
x
Reference in New Issue
Block a user