Handle clock out of sync issue

This commit is contained in:
Niels Andriesse 2020-02-12 14:44:23 +11:00
parent fc2a7bb5a9
commit c47ecad024
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)