From c47ecad0248d3d035afec8dfd0cec8bc306a87c1 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 12 Feb 2020 14:44:23 +1100 Subject: [PATCH] Handle clock out of sync issue --- .../securesms/conversation/ConversationActivity.java | 9 +++++++++ .../securesms/loki/redesign/utilities/Broadcaster.kt | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java index 5e0d427b57..41cb2330ce 100644 --- a/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java +++ b/src/org/thoughtcrime/securesms/conversation/ConversationActivity.java @@ -404,6 +404,15 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity registerMessageStatusObserver("sendingMessage"); registerMessageStatusObserver("messageSent"); 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(); initializeActionBar(); diff --git a/src/org/thoughtcrime/securesms/loki/redesign/utilities/Broadcaster.kt b/src/org/thoughtcrime/securesms/loki/redesign/utilities/Broadcaster.kt index cf2074b657..7460341bd5 100644 --- a/src/org/thoughtcrime/securesms/loki/redesign/utilities/Broadcaster.kt +++ b/src/org/thoughtcrime/securesms/loki/redesign/utilities/Broadcaster.kt @@ -6,6 +6,11 @@ import android.support.v4.content.LocalBroadcastManager 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) { val intent = Intent(event) intent.putExtra("long", long)