mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 19:08:26 +00:00
Clean
This commit is contained in:
parent
e5b1174879
commit
281d921849
@ -21,6 +21,7 @@ object ClosedGroupsProtocol {
|
||||
@JvmStatic
|
||||
fun shouldIgnoreContentMessage(context: Context, conversation: Recipient, groupID: String?, content: SignalServiceContent): Boolean {
|
||||
if (!conversation.address.isClosedGroup || groupID == null) { return false }
|
||||
// A closed group's members should never include slave devices
|
||||
val senderPublicKey = content.sender
|
||||
val senderMasterPublicKey = MultiDeviceProtocol.shared.getMasterDevice(senderPublicKey)
|
||||
val publicKeyToCheckFor = senderMasterPublicKey ?: senderPublicKey
|
||||
|
@ -34,7 +34,7 @@ class MultiDeviceOpenGroupUpdateJob private constructor(parameters: Parameters)
|
||||
|
||||
override fun getFactoryKey(): String { return KEY }
|
||||
|
||||
override fun serialize(): Data { return Data.EMPTY } // TODO: Should we implement this?
|
||||
override fun serialize(): Data { return Data.EMPTY }
|
||||
|
||||
@Throws(Exception::class)
|
||||
public override fun onRun() {
|
||||
|
@ -31,7 +31,6 @@ class PushEphemeralMessageSendJob private constructor(parameters: Parameters, pr
|
||||
message)
|
||||
|
||||
override fun serialize(): Data {
|
||||
// TODO: Is this correct?
|
||||
return Data.Builder()
|
||||
.putString(KEY_MESSAGE, message.serialize())
|
||||
.build()
|
||||
@ -41,23 +40,17 @@ class PushEphemeralMessageSendJob private constructor(parameters: Parameters, pr
|
||||
|
||||
public override fun onRun() {
|
||||
val recipient = message.get<String?>("recipient", null) ?: throw IllegalStateException()
|
||||
val dataMessage = SignalServiceDataMessage.newBuilder()
|
||||
.withTimestamp(System.currentTimeMillis())
|
||||
.withBody(message.get<String?>("body", null))
|
||||
val dataMessage = SignalServiceDataMessage.newBuilder().withTimestamp(System.currentTimeMillis())
|
||||
// Attach a pre key bundle if needed
|
||||
if (message.get("friendRequest", false)) {
|
||||
val bundle = DatabaseFactory.getLokiPreKeyBundleDatabase(context).generatePreKeyBundle(recipient)
|
||||
dataMessage.withPreKeyBundle(bundle).asFriendRequest(true)
|
||||
}
|
||||
// Set flags if needed
|
||||
if (message.get("unpairingRequest", false)) {
|
||||
dataMessage.asUnlinkingRequest(true)
|
||||
}
|
||||
if (message.get("sessionRestore", false)) {
|
||||
dataMessage.asSessionRestorationRequest(true)
|
||||
}
|
||||
if (message.get("sessionRequest", false)) {
|
||||
dataMessage.asSessionRequest(true)
|
||||
// Set flags if needed (these are mutually exclusive)
|
||||
when {
|
||||
message.get("unpairingRequest", false) -> dataMessage.asUnlinkingRequest(true)
|
||||
message.get("sessionRestore", false) -> dataMessage.asSessionRestorationRequest(true)
|
||||
message.get("sessionRequest", false) -> dataMessage.asSessionRequest(true)
|
||||
}
|
||||
// Send the message
|
||||
val messageSender = ApplicationContext.getInstance(context).communicationModule.provideSignalMessageSender()
|
||||
|
Loading…
x
Reference in New Issue
Block a user