mirror of https://github.com/oxen-io/session-ios
Partially implement receiving pipeline
parent
2d618cc6e9
commit
40098ac180
@ -1,8 +1,22 @@
|
|||||||
|
import SessionUtilities
|
||||||
|
|
||||||
public enum ReceivingPipeline {
|
public enum ReceivingPipeline {
|
||||||
|
|
||||||
// 1. Decrypt
|
public static func parse(_ data: Data) -> Message? {
|
||||||
// 2. Convert binary to proto
|
// TODO: Decrypt
|
||||||
// 3. Convert proto to message
|
let proto: SNProtoContent
|
||||||
// 4. Handle message
|
do {
|
||||||
|
proto = try SNProtoContent.parseData(data)
|
||||||
|
} catch {
|
||||||
|
SNLog("Couldn't parse proto due to error: \(error).")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if let readReceipt = ReadReceipt.fromProto(proto) { return readReceipt }
|
||||||
|
if let sessionRequest = SessionRequest.fromProto(proto) { return sessionRequest }
|
||||||
|
if let typingIndicator = TypingIndicator.fromProto(proto) { return typingIndicator }
|
||||||
|
if let closedGroupUpdate = ClosedGroupUpdate.fromProto(proto) { return closedGroupUpdate }
|
||||||
|
if let expirationTimerUpdate = ExpirationTimerUpdate.fromProto(proto) { return expirationTimerUpdate }
|
||||||
|
if let visibleMessage = VisibleMessage.fromProto(proto) { return visibleMessage }
|
||||||
|
return nil
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue