This commit is contained in:
nielsandriesse 2020-07-08 10:48:09 +10:00
parent 6fcc26cc22
commit 4e672d5b49
3 changed files with 8 additions and 4 deletions

View File

@ -487,7 +487,8 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
if (userPublicKey == null) return;
if (lokiPoller != null) {
lokiPoller.updateUserHexEncodedPublicKey(userPublicKey);
LokiAPI.shared.setUserHexEncodedPublicKey(userPublicKey);
lokiPoller.setUserHexEncodedPublicKey(userPublicKey);
return;
}
LokiAPIDatabase apiDB = DatabaseFactory.getLokiAPIDatabase(this);
@ -507,8 +508,9 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
if (lokiPoller != null) { lokiPoller.startIfNeeded(); }
}
public void stopPollingIfNeeded() {
if (lokiPoller != null) { lokiPoller.stopIfNeeded(); }
public void stopPolling() {
if (lokiPoller == null) { return; }
lokiPoller.stopIfNeeded();
}
private void resubmitProfilePictureIfNeeded() {

View File

@ -146,6 +146,6 @@ class LandingActivity : BaseActionBarActivity(), LinkDeviceSlaveModeDialogDelega
TextSecurePreferences.setHasSeenWelcomeScreen(this, false)
TextSecurePreferences.setPromptedPushRegistration(this, false)
val application = ApplicationContext.getInstance(this)
application.stopPollingIfNeeded()
application.stopPolling()
}
}

View File

@ -17,6 +17,7 @@ import org.whispersystems.libsignal.SignalProtocolAddress
import org.whispersystems.signalservice.api.messages.SignalServiceContent
import org.whispersystems.signalservice.api.messages.SignalServiceGroup
import org.whispersystems.signalservice.api.push.SignalServiceAddress
import org.whispersystems.signalservice.loki.api.LokiAPI
import org.whispersystems.signalservice.loki.api.fileserver.LokiFileServerAPI
import org.whispersystems.signalservice.loki.protocol.multidevice.MultiDeviceProtocol
import java.util.*
@ -108,6 +109,7 @@ object ClosedGroupsProtocol {
val deviceAsAddress = SignalProtocolAddress(device, SignalServiceAddress.DEFAULT_DEVICE_ID)
val hasSession = TextSecureSessionStore(context).containsSession(deviceAsAddress)
if (hasSession) { continue }
if (DatabaseFactory.getLokiAPIDatabase(context).getSessionRequestTimestamp(device) != null) { return }
DatabaseFactory.getLokiAPIDatabase(context).setSessionRequestTimestamp(device, Date().time)
val sessionRequest = EphemeralMessage.createSessionRequest(device)
ApplicationContext.getInstance(context).jobManager.add(PushEphemeralMessageSendJob(sessionRequest))