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.
		
		
		
		
		
			
	
	
		
			
				
					
						
							|  |  |  | // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import Foundation | 
					
						
							|  |  |  | import GRDB | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | extension MessageReceiver { | 
					
						
							|  |  |  |     internal static func handleDataExtractionNotification(_ db: Database, message: DataExtractionNotification) throws { | 
					
						
							|  |  |  |         guard | 
					
						
							|  |  |  |             let sender: String = message.sender, | 
					
						
							|  |  |  |             let messageKind: DataExtractionNotification.Kind = message.kind, | 
					
						
							|  |  |  |             let thread: SessionThread = try? SessionThread.fetchOne(db, id: sender), | 
					
						
							|  |  |  |             thread.variant == .contact | 
					
						
							|  |  |  |         else { return } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |         _ = try Interaction( | 
					
						
							|  |  |  |             serverHash: message.serverHash, | 
					
						
							|  |  |  |             threadId: thread.id, | 
					
						
							|  |  |  |             authorId: sender, | 
					
						
							|  |  |  |             variant: { | 
					
						
							|  |  |  |                 switch messageKind { | 
					
						
							|  |  |  |                     case .screenshot: return .infoScreenshotNotification | 
					
						
							|  |  |  |                     case .mediaSaved: return .infoMediaSavedNotification | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  |             }() | 
					
						
							|  |  |  |         ).inserted(db) | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | } |