mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
950 B
Swift
23 lines
950 B
Swift
import SessionUtilities
|
|
|
|
public enum ReceivingPipeline {
|
|
|
|
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
|
|
}
|
|
}
|