2020-11-06 04:05:45 +01:00
|
|
|
import SessionUtilities
|
2020-11-05 23:17:05 +01:00
|
|
|
|
|
|
|
public enum ReceivingPipeline {
|
|
|
|
|
2020-11-06 04:05:45 +01:00
|
|
|
public static func parse(_ data: Data) -> Message? {
|
|
|
|
// TODO: Decrypt
|
|
|
|
let proto: SNProtoContent
|
|
|
|
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
|
|
|
|
}
|
2020-11-05 23:17:05 +01:00
|
|
|
}
|