Merge pull request #91 from loki-project/robustness

Handle Clock Out of Sync Issue
This commit is contained in:
gmbnt 2020-02-12 15:14:01 +11:00 committed by GitHub
commit 24116bc7cb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -404,6 +404,15 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
registerMessageStatusObserver("sendingMessage"); registerMessageStatusObserver("sendingMessage");
registerMessageStatusObserver("messageSent"); registerMessageStatusObserver("messageSent");
registerMessageStatusObserver("messageFailed"); registerMessageStatusObserver("messageFailed");
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(ConversationActivity.this, "Your clock is out of sync with the service node network.", Toast.LENGTH_LONG).show();
}
};
broadcastReceivers.add(broadcastReceiver);
LocalBroadcastManager.getInstance(this).registerReceiver(broadcastReceiver, new IntentFilter("clockOutOfSync"));
initializeReceivers(); initializeReceivers();
initializeActionBar(); initializeActionBar();

View File

@ -6,6 +6,11 @@ import android.support.v4.content.LocalBroadcastManager
class Broadcaster(private val context: Context) : org.whispersystems.signalservice.loki.utilities.Broadcaster { class Broadcaster(private val context: Context) : org.whispersystems.signalservice.loki.utilities.Broadcaster {
override fun broadcast(event: String) {
val intent = Intent(event)
LocalBroadcastManager.getInstance(context).sendBroadcast(intent)
}
override fun broadcast(event: String, long: Long) { override fun broadcast(event: String, long: Long) {
val intent = Intent(event) val intent = Intent(event)
intent.putExtra("long", long) intent.putExtra("long", long)