mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
Request sender keys as needed
This commit is contained in:
parent
bed1600cbb
commit
418079732b
@ -68,6 +68,7 @@ import org.thoughtcrime.securesms.loki.database.LokiAPIDatabase;
|
|||||||
import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase;
|
import org.thoughtcrime.securesms.loki.database.LokiThreadDatabase;
|
||||||
import org.thoughtcrime.securesms.loki.database.LokiUserDatabase;
|
import org.thoughtcrime.securesms.loki.database.LokiUserDatabase;
|
||||||
import org.thoughtcrime.securesms.loki.database.SharedSenderKeysDatabase;
|
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.SessionRequestMessageSendJob;
|
||||||
import org.thoughtcrime.securesms.loki.protocol.SessionResetImplementation;
|
import org.thoughtcrime.securesms.loki.protocol.SessionResetImplementation;
|
||||||
import org.thoughtcrime.securesms.loki.utilities.Broadcaster;
|
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.api.shelved.p2p.LokiP2PAPIDelegate;
|
||||||
import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol;
|
import org.whispersystems.signalservice.loki.database.LokiAPIDatabaseProtocol;
|
||||||
import org.whispersystems.signalservice.loki.protocol.closedgroups.SharedSenderKeysImplementation;
|
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.mentions.MentionsManager;
|
||||||
import org.whispersystems.signalservice.loki.protocol.meta.SessionMetaProtocol;
|
import org.whispersystems.signalservice.loki.protocol.meta.SessionMetaProtocol;
|
||||||
import org.whispersystems.signalservice.loki.protocol.meta.TTLUtilities;
|
import org.whispersystems.signalservice.loki.protocol.meta.TTLUtilities;
|
||||||
@ -141,7 +143,8 @@ import static nl.komponents.kovenant.android.KovenantAndroid.stopKovenant;
|
|||||||
*
|
*
|
||||||
* @author Moxie Marlinspike
|
* @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 static final String TAG = ApplicationContext.class.getSimpleName();
|
||||||
private final static int OK_HTTP_CACHE_SIZE = 10 * 1024 * 1024; // 10 MB
|
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);
|
SharedSenderKeysDatabase sskDatabase = DatabaseFactory.getSSKDatabase(this);
|
||||||
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
String userPublicKey = TextSecurePreferences.getLocalNumber(this);
|
||||||
SessionResetImplementation sessionResetImpl = new SessionResetImplementation(this);
|
SessionResetImplementation sessionResetImpl = new SessionResetImplementation(this);
|
||||||
SharedSenderKeysImplementation.Companion.configureIfNeeded(sskDatabase);
|
SharedSenderKeysImplementation.Companion.configureIfNeeded(sskDatabase, this);
|
||||||
if (userPublicKey != null) {
|
if (userPublicKey != null) {
|
||||||
SwarmAPI.Companion.configureIfNeeded(apiDB);
|
SwarmAPI.Companion.configureIfNeeded(apiDB);
|
||||||
SnodeAPI.Companion.configureIfNeeded(userPublicKey, apiDB, broadcaster);
|
SnodeAPI.Companion.configureIfNeeded(userPublicKey, apiDB, broadcaster);
|
||||||
@ -634,5 +637,10 @@ public class ApplicationContext extends MultiDexApplication implements Dependenc
|
|||||||
SessionRequestMessageSendJob job = new SessionRequestMessageSendJob(publicKey, timestamp);
|
SessionRequestMessageSendJob job = new SessionRequestMessageSendJob(publicKey, timestamp);
|
||||||
jobManager.add(job);
|
jobManager.add(job);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void requestSenderKey(@NotNull String groupPublicKey, @NotNull String senderPublicKey) {
|
||||||
|
ClosedGroupsProtocol.requestSenderKey(this, groupPublicKey, senderPublicKey);
|
||||||
|
}
|
||||||
// endregion
|
// endregion
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,7 @@ object ClosedGroupsProtocol {
|
|||||||
insertInfoMessage(context, groupID, type, name, members, admins, threadID)
|
insertInfoMessage(context, groupID, type, name, members, admins, threadID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) {
|
public fun requestSenderKey(context: Context, groupPublicKey: String, senderPublicKey: String) {
|
||||||
// Establish session if needed
|
// Establish session if needed
|
||||||
ApplicationContext.getInstance(context).sendSessionRequestIfNeeded(senderPublicKey)
|
ApplicationContext.getInstance(context).sendSessionRequestIfNeeded(senderPublicKey)
|
||||||
|
Loading…
Reference in New Issue
Block a user