More cleanup.

This commit is contained in:
Mikunj 2019-10-30 10:13:19 +11:00
parent 7ff7c36e27
commit 359363184a
2 changed files with 6 additions and 19 deletions

View File

@ -147,7 +147,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
private LokiPublicChatAPI lokiPublicChatAPI = null;
public SignalCommunicationModule communicationModule;
public MixpanelAPI mixpanel;
private BroadcastReceiver syncMessageEventReceiver;
private volatile boolean isAppVisible;
@ -200,22 +199,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
if (setUpStorageAPIIfNeeded()) {
LokiStorageAPI.Companion.getShared().updateUserDeviceMappings();
}
// Loki - Event listener
syncMessageEventReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
// Send the sync message to our devices
long messageID = intent.getLongExtra(LokiMessageSyncEvent.MESSAGE_ID, -1);
long timestamp = intent.getLongExtra(LokiMessageSyncEvent.TIMESTAMP, -1);
byte[] message = intent.getByteArrayExtra(LokiMessageSyncEvent.SYNC_MESSAGE);
int ttl = intent.getIntExtra(LokiMessageSyncEvent.TTL, -1);
if (messageID > 0 && timestamp > 0 && message != null && ttl > 0) {
MessageSender.sendSyncMessageToOurDevices(context, messageID, timestamp, message, ttl);
}
}
};
LocalBroadcastManager.getInstance(this).registerReceiver(syncMessageEventReceiver, new IntentFilter(LokiMessageSyncEvent.MESSAGE_SYNC_EVENT));
}
@Override
@ -243,7 +226,6 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
@Override
public void onTerminate() {
stopKovenant();
LocalBroadcastManager.getInstance(this).unregisterReceiver(syncMessageEventReceiver);
super.onTerminate();
}
@ -532,6 +514,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
}
public void createDefaultPublicChatsIfNeeded() {
/*
List<LokiPublicChat> defaultPublicChats = LokiPublicChatAPI.Companion.getDefaultChats(BuildConfig.DEBUG);
for (LokiPublicChat publiChat : defaultPublicChats) {
long threadID = GroupManager.getThreadId(publiChat.getId(), this);
@ -548,6 +531,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
TextSecurePreferences.setBooleanPreference(this, migrationKey, true);
}
}
*/
}
public void createRSSFeedsIfNeeded() {

View File

@ -5,6 +5,7 @@ import android.content.Context;
import org.thoughtcrime.securesms.crypto.SecurityEvent;
import org.thoughtcrime.securesms.loki.FriendRequestHandler;
import org.thoughtcrime.securesms.loki.LokiMessageSyncEvent;
import org.thoughtcrime.securesms.sms.MessageSender;
import org.whispersystems.signalservice.api.SignalServiceMessageSender;
import org.whispersystems.signalservice.api.push.SignalServiceAddress;
@ -25,7 +26,9 @@ public class MessageSenderEventListener implements SignalServiceMessageSender.Ev
@Override
public void onSyncEvent(long messageID, long timestamp, byte[] message, int ttl) {
LokiMessageSyncEvent.INSTANCE.broadcastSecurityUpdateEvent(context, messageID, timestamp, message, ttl);
if (messageID > 0 && timestamp > 0 && message != null && ttl > 0) {
MessageSender.sendSyncMessageToOurDevices(context, messageID, timestamp, message, ttl);
}
}
@Override public void onFriendRequestSending(long messageID, long threadID) {