Fix MessageSendJob deserialization

pull/313/head
Niels Andriesse 4 years ago
parent c5a7d39518
commit 1ca3366518

@ -31,11 +31,11 @@ public final class MessageSendJob : NSObject, Job, NSCoding { // NSObject/NSCodi
guard rawDestination.removeSuffix(")") else { return nil } guard rawDestination.removeSuffix(")") else { return nil }
let publicKey = rawDestination let publicKey = rawDestination
destination = .contact(publicKey: publicKey) destination = .contact(publicKey: publicKey)
} else if rawDestination.removePrefix("closedGroup") { } else if rawDestination.removePrefix("closedGroup(") {
guard rawDestination.removeSuffix(")") else { return nil } guard rawDestination.removeSuffix(")") else { return nil }
let groupPublicKey = rawDestination let groupPublicKey = rawDestination
destination = .closedGroup(groupPublicKey: groupPublicKey) destination = .closedGroup(groupPublicKey: groupPublicKey)
} else if rawDestination.removePrefix("openGroup") { } else if rawDestination.removePrefix("openGroup(") {
guard rawDestination.removeSuffix(")") else { return nil } guard rawDestination.removeSuffix(")") else { return nil }
let components = rawDestination.split(separator: ",").map { String($0).trimmingCharacters(in: .whitespacesAndNewlines) } let components = rawDestination.split(separator: ",").map { String($0).trimmingCharacters(in: .whitespacesAndNewlines) }
guard components.count == 2, let channel = UInt64(components[0]) else { return nil } guard components.count == 2, let channel = UInt64(components[0]) else { return nil }

Loading…
Cancel
Save