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.
		
		
		
		
		
			
		
			
	
	
		
			32 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			32 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Swift
		
	
| 
											5 years ago
										 | 
 | ||
|  | public extension Storage { | ||
|  | 
 | ||
|  |     // MARK: Session Request Timestamps | ||
|  |     internal static let sessionRequestSentTimestampCollection = "LokiSessionRequestSentTimestampCollection" | ||
|  |     internal static let sessionRequestProcessedTimestampCollection = "LokiSessionRequestProcessedTimestampCollection" | ||
|  | 
 | ||
|  |     internal static func getSessionRequestSentTimestamp(for publicKey: String) -> UInt64 { | ||
|  |         var result: UInt64? | ||
|  |         read { transaction in | ||
|  |             result = transaction.object(forKey: publicKey, inCollection: sessionRequestSentTimestampCollection) as? UInt64 | ||
|  |         } | ||
|  |         return result ?? 0 | ||
|  |     } | ||
|  | 
 | ||
|  |     internal static func setSessionRequestSentTimestamp(for publicKey: String, to timestamp: UInt64, using transaction: YapDatabaseReadWriteTransaction) { | ||
|  |         transaction.setObject(timestamp, forKey: publicKey, inCollection: sessionRequestSentTimestampCollection) | ||
|  |     } | ||
|  | 
 | ||
|  |     internal static func getSessionRequestProcessedTimestamp(for publicKey: String) -> UInt64 { | ||
|  |         var result: UInt64? | ||
|  |         read { transaction in | ||
|  |             result = transaction.object(forKey: publicKey, inCollection: sessionRequestProcessedTimestampCollection) as? UInt64 | ||
|  |         } | ||
|  |         return result ?? 0 | ||
|  |     } | ||
|  | 
 | ||
|  |     internal static func setSessionRequestProcessedTimestamp(for publicKey: String, to timestamp: UInt64, using transaction: YapDatabaseReadWriteTransaction) { | ||
|  |         transaction.setObject(timestamp, forKey: publicKey, inCollection: sessionRequestProcessedTimestampCollection) | ||
|  |     } | ||
|  | } |