Trigger event when authorisation is accepted.

This commit is contained in:
Mikunj 2019-09-26 10:04:21 +10:00
parent 0b49d7ae0d
commit 7d1883cfd2

View File

@ -1067,7 +1067,7 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
return;
}
// Unimplemented
// Unimplemented for REQUEST
if (authorisation.getType() != LokiPairingAuthorisation.Type.GRANT) { return; }
Log.d("Loki", "Receiving pairing authorisation from: " + authorisation.getPrimaryDevicePubKey());
@ -1077,12 +1077,13 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
DatabaseFactory.getLokiAPIDatabase(context).insertOrUpdatePairingAuthorisation(authorisation);
TextSecurePreferences.setIsSecondaryDevice(context, true);
// Send out accept event
LokiDeviceLinkingSession.Companion.getShared().acceptedLinkingRequest(authorisation);
// Propagate the updates to the file server
LokiStorageAPI storageAPI = LokiStorageAPI.Companion.getShared();
if (storageAPI != null) { storageAPI.updateOurDeviceMappings(); }
// TODO: Trigger an event here?
// Update display names
if (content.senderDisplayName.isPresent() && content.senderDisplayName.get().length() > 0) {
setDisplayName(envelope.getSource(), content.senderDisplayName.get());