diff --git a/src/org/thoughtcrime/securesms/ApplicationContext.java b/src/org/thoughtcrime/securesms/ApplicationContext.java index 0029416a3d..5090774f31 100644 --- a/src/org/thoughtcrime/securesms/ApplicationContext.java +++ b/src/org/thoughtcrime/securesms/ApplicationContext.java @@ -68,6 +68,7 @@ import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase; import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase; import org.thoughtcrime.securesms.loki.database.LokiUserDatabase; import org.thoughtcrime.securesms.loki.database.SharedSenderKeysDatabase; +import org.thoughtcrime.securesms.loki.protocol.ClosedGroupsProtocol; import org.thoughtcrime.securesms.loki.protocol.SessionRequestMessageSendJob; import org.thoughtcrime.securesms.loki.protocol.SessionResetImplementation; import org.thoughtcrime.securesms.loki.utilities.Broadcaster; @@ -109,6 +110,7 @@ import org.whispersystems.signalservice.loki.api.shelved.p2p.LokiP2PAPI; import org.whispersystems.signalservice.loki.api.shelved.p2p.LokiP2PAPIDelegate; import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol; import org.whispersystems.signalservice.loki.protocol.closedgroups.SharedSenderKeysImplementation; +import org.whispersystems.signalservice.loki.protocol.closedgroups.SharedSenderKeysImplementationDelegate; import org.whispersystems.signalservice.loki.protocol.mentions.MentionsManager; import org.whispersystems.signalservice.loki.protocol.meta.SessionMetaProtocol; import org.whispersystems.signalservice.loki.protocol.meta.TTLUtilities; @@ -141,7 +143,8 @@ import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant; * * @author Moxie Marlinspike */ -public class ApplicationContext extends MultiDexApplication implements DependencyInjector, DefaultLifecycleObserver, LokiP2PAPIDelegate, SessionManagementProtocolDelegate { +public class ApplicationContext extends MultiDexApplication implements DependencyInjector, DefaultLifecycleObserver, LokiP2PAPIDelegate, + SessionManagementProtocolDelegate, SharedSenderKeysImplementationDelegate { private static final String TAG = ApplicationContext.class.getSimpleName(); private final static int OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10 MB @@ -190,7 +193,7 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc SharedSenderKeysDatabase sskDatabase = DatabaseFactory.getSSKDatabase(this); String userPublicKey = TextSecurePreferences.getLocalNumber(this); SessionResetImplementation sessionResetImpl = new SessionResetImplementation(this); - SharedSenderKeysImplementation.Companion.configureIfNeeded(sskDatabase); + SharedSenderKeysImplementation.Companion.configureIfNeeded(sskDatabase, this); if (userPublicKey != null) { SwarmAPI.Companion.configureIfNeeded(apiDB); SnodeAPI.Companion.configureIfNeeded(userPublicKey, apiDB, broadcaster); @@ -634,5 +637,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc SessionRequestMessageSendJob job = new SessionRequestMessageSendJob(publicKey, timestamp); jobManager.add(job); } + + @Override + public void requestSenderKey(@NotNull String groupPublicKey, @NotNull String senderPublicKey) { + ClosedGroupsProtocol.requestSenderKey(this, groupPublicKey, senderPublicKey); + } // endregion } diff --git a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt index 06ac198a5b..a6fd63758f 100644 --- a/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt +++ b/src/org/thoughtcrime/securesms/loki/protocol/ClosedGroupsProtocol.kt @@ -180,6 +180,7 @@ object ClosedGroupsProtocol { insertInfoMessage(context, groupID, type, name, members, admins, threadID) } + @JvmStatic public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) { // Establish session if needed ApplicationContext.getInstance(context).sendSessionRequestIfNeeded(senderPublicKey)