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.
		
		
		
		
		
			
		
			
	
	
		
			59 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			59 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			Swift
		
	
| 
											2 years ago
										 | // Copyright © 2023 Rangeproof Pty Ltd. All rights reserved. | ||
|  | 
 | ||
|  | import Foundation | ||
|  | import SessionSnodeKit | ||
|  | import SessionUtilitiesKit | ||
|  | 
 | ||
|  | public extension Message { | ||
|  |     enum Origin: Codable, Hashable { | ||
|  |         case swarm( | ||
|  |             publicKey: String, | ||
|  |             namespace: SnodeAPI.Namespace, | ||
|  |             serverHash: String, | ||
|  |             serverTimestampMs: Int64, | ||
|  |             serverExpirationTimestamp: TimeInterval | ||
|  |         ) | ||
|  |         case community( | ||
|  |             openGroupId: String, | ||
|  |             sender: String, | ||
|  |             timestamp: TimeInterval, | ||
|  |             messageServerId: Int64 | ||
|  |         ) | ||
|  |         case openGroupInbox( | ||
|  |             timestamp: TimeInterval, | ||
|  |             messageServerId: Int64, | ||
|  |             serverPublicKey: String, | ||
|  |             blindedPublicKey: String, | ||
|  |             isOutgoing: Bool | ||
|  |         ) | ||
|  |          | ||
|  |         public var isConfigNamespace: Bool { | ||
|  |             switch self { | ||
|  |                 case .swarm(_, let namespace, _, _, _): return namespace.isConfigNamespace | ||
|  |                 default: return false | ||
|  |             } | ||
|  |         } | ||
|  |          | ||
|  |         public var isCommunity: Bool { | ||
|  |             switch self { | ||
|  |                 case .community: return true | ||
|  |                 default: return false | ||
|  |             } | ||
|  |         } | ||
|  |          | ||
|  |         public var serverHash: String? { | ||
|  |             switch self { | ||
|  |                 case .swarm(_, _, let serverHash, _, _): return serverHash | ||
|  |                 default: return nil | ||
|  |             } | ||
|  |         } | ||
|  |          | ||
|  |         public var serverExpirationTimestamp: TimeInterval? { | ||
|  |             switch self { | ||
|  |                 case .swarm(_, _, _, _, let expirationTimestamp): return expirationTimestamp | ||
|  |                 default: return nil | ||
|  |             } | ||
|  |         } | ||
|  |     } | ||
|  | } |