mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-28 02:37:46 +00:00
Merge branch 'dev' into group-leaving
This commit is contained in:
commit
f46354392c
@ -725,26 +725,26 @@ public class PushDecryptJob extends BaseJob implements InjectableType {
|
||||
|
||||
private void handleGroupSyncMessage(@NonNull SignalServiceContent content, @NonNull SignalServiceAttachment groupMessage) {
|
||||
if (groupMessage.isStream()) {
|
||||
Log.d("Loki", "Received group sync message");
|
||||
Log.d("Loki", "Received a group sync message.");
|
||||
try {
|
||||
InputStream in = groupMessage.asStream().getInputStream();
|
||||
DeviceGroupsInputStream groupsInputStream = new DeviceGroupsInputStream(in);
|
||||
List<DeviceGroup> groups = groupsInputStream.readAll();
|
||||
for (DeviceGroup group : groups) {
|
||||
SignalServiceGroup serviceGroup = new SignalServiceGroup(
|
||||
SignalServiceGroup.Type.UPDATE,
|
||||
group.getId(),
|
||||
SignalServiceGroup.GroupType.SIGNAL,
|
||||
group.getName().orNull(),
|
||||
group.getMembers(),
|
||||
group.getAvatar().orNull(),
|
||||
group.getAdmins()
|
||||
SignalServiceGroup.Type.UPDATE,
|
||||
group.getId(),
|
||||
SignalServiceGroup.GroupType.SIGNAL,
|
||||
group.getName().orNull(),
|
||||
group.getMembers(),
|
||||
group.getAvatar().orNull(),
|
||||
group.getAdmins()
|
||||
);
|
||||
SignalServiceDataMessage dataMessage = new SignalServiceDataMessage(content.getTimestamp(), serviceGroup, null, null);
|
||||
GroupMessageProcessor.process(context, content, dataMessage, false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.d("Loki", "Failed to sync group: " + e);
|
||||
Log.d("Loki", "Failed to sync group due to error: " + e + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ fun sendDeviceLinkMessage(context: Context, hexEncodedPublicKey: String, deviceL
|
||||
}
|
||||
Promise.ofSuccess(Unit)
|
||||
} catch (e: Exception) {
|
||||
Log.d("Loki", "Failed to send device link message to $hexEncodedPublicKey: $e")
|
||||
Log.d("Loki", "Failed to send device link message to: $hexEncodedPublicKey due to error: $e.")
|
||||
Promise.ofFail(e)
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,6 @@ import org.thoughtcrime.securesms.loki.redesign.dialogs.*
|
||||
import org.thoughtcrime.securesms.loki.signAndSendDeviceLinkMessage
|
||||
import org.thoughtcrime.securesms.sms.MessageSender
|
||||
import org.thoughtcrime.securesms.util.TextSecurePreferences
|
||||
import org.thoughtcrime.securesms.util.Util
|
||||
import org.whispersystems.signalservice.loki.api.DeviceLink
|
||||
import org.whispersystems.signalservice.loki.api.LokiFileServerAPI
|
||||
import java.util.*
|
||||
@ -153,12 +152,11 @@ class LinkedDevicesActivity : PassphraseRequiredActionBarActivity, LoaderManager
|
||||
MessageSender.syncAllGroups(this@LinkedDevicesActivity)
|
||||
MessageSender.syncAllContacts(this@LinkedDevicesActivity, Address.fromSerialized(deviceLink.slaveHexEncodedPublicKey))
|
||||
}
|
||||
}.failUi {
|
||||
Toast.makeText(this, "Couldn't link device", Toast.LENGTH_LONG).show()
|
||||
}.fail {
|
||||
LokiFileServerAPI.shared.removeDeviceLink(deviceLink) // If this fails we have a problem
|
||||
DatabaseFactory.getLokiPreKeyBundleDatabase(this).removePreKeyBundle(deviceLink.slaveHexEncodedPublicKey)
|
||||
Util.runOnMain {
|
||||
Toast.makeText(this, "Couldn't link device", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}.failUi {
|
||||
DatabaseFactory.getLokiPreKeyBundleDatabase(this).removePreKeyBundle(deviceLink.slaveHexEncodedPublicKey)
|
||||
|
@ -55,7 +55,7 @@ class LokiPreKeyBundleDatabase(context: Context, helper: SQLCipherOpenHelper) :
|
||||
failureCount += 1
|
||||
}
|
||||
}
|
||||
Log.w("Loki", "Failed to generate a valid PreKeyBundle for $hexEncodedPublicKey")
|
||||
Log.w("Loki", "Failed to generate a valid pre key bundle for: $hexEncodedPublicKey.")
|
||||
return null
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user