chore(service): Fix service port
This commit is contained in:
		
							parent
							
								
									95a6a458db
								
							
						
					
					
						commit
						0872b2a134
					
				| @ -684,6 +684,7 @@ Future<void> performRequestDownload( | |||||||
| 
 | 
 | ||||||
|   await srv.downloadFile( |   await srv.downloadFile( | ||||||
|     FileDownloadJob( |     FileDownloadJob( | ||||||
|  |       message.messageKey, | ||||||
|       MediaFileLocation( |       MediaFileLocation( | ||||||
|         fileMetadata.sourceUrls!, |         fileMetadata.sourceUrls!, | ||||||
|         fileMetadata.filename, |         fileMetadata.filename, | ||||||
| @ -698,11 +699,9 @@ Future<void> performRequestDownload( | |||||||
|         fileMetadata.ciphertextHashes, |         fileMetadata.ciphertextHashes, | ||||||
|         null, |         null, | ||||||
|       ), |       ), | ||||||
|       message.sid, |  | ||||||
|       accountJid, |       accountJid, | ||||||
|       message.fileMetadata!.id, |       message.fileMetadata!.id, | ||||||
|       message.fileMetadata!.plaintextHashes?.isNotEmpty ?? false, |       message.fileMetadata!.plaintextHashes?.isNotEmpty ?? false, | ||||||
|       message.conversationJid, |  | ||||||
|       mimeGuess, |       mimeGuess, | ||||||
|     ), |     ), | ||||||
|   ); |   ); | ||||||
| @ -1073,8 +1072,8 @@ Future<void> performAddMessageReaction( | |||||||
|   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); |   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); | ||||||
|   final rs = GetIt.I.get<ReactionsService>(); |   final rs = GetIt.I.get<ReactionsService>(); | ||||||
|   final msg = await rs.addNewReaction( |   final msg = await rs.addNewReaction( | ||||||
|     command.messageSid, |     command.key.sid, | ||||||
|     command.conversationJid, |     command.key.conversationJid, | ||||||
|     accountJid, |     accountJid, | ||||||
|     accountJid, |     accountJid, | ||||||
|     command.emoji, |     command.emoji, | ||||||
| @ -1083,19 +1082,19 @@ Future<void> performAddMessageReaction( | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (command.conversationJid != '') { |   if (command.key.conversationJid != '') { | ||||||
|     // Send the reaction |     // Send the reaction | ||||||
|     final manager = GetIt.I |     final manager = GetIt.I | ||||||
|         .get<XmppConnection>() |         .get<XmppConnection>() | ||||||
|         .getManagerById<MessageManager>(messageManager)!; |         .getManagerById<MessageManager>(messageManager)!; | ||||||
|     await manager.sendMessage( |     await manager.sendMessage( | ||||||
|       JID.fromString(command.conversationJid), |       JID.fromString(command.key.conversationJid), | ||||||
|       TypedMap<StanzaHandlerExtension>.fromList([ |       TypedMap<StanzaHandlerExtension>.fromList([ | ||||||
|         MessageReactionsData( |         MessageReactionsData( | ||||||
|           msg.originId ?? msg.sid, |           msg.originId ?? msg.sid, | ||||||
|           await rs.getReactionsForMessageByJid( |           await rs.getReactionsForMessageByJid( | ||||||
|             command.messageSid, |             command.key.sid, | ||||||
|             command.conversationJid, |             command.key.conversationJid, | ||||||
|             accountJid, |             accountJid, | ||||||
|             accountJid, |             accountJid, | ||||||
|           ), |           ), | ||||||
| @ -1116,8 +1115,8 @@ Future<void> performRemoveMessageReaction( | |||||||
|   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); |   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); | ||||||
|   final rs = GetIt.I.get<ReactionsService>(); |   final rs = GetIt.I.get<ReactionsService>(); | ||||||
|   final msg = await rs.removeReaction( |   final msg = await rs.removeReaction( | ||||||
|     command.messageSid, |     command.key.sid, | ||||||
|     command.conversationJid, |     command.key.conversationJid, | ||||||
|     accountJid, |     accountJid, | ||||||
|     accountJid, |     accountJid, | ||||||
|     command.emoji, |     command.emoji, | ||||||
| @ -1126,19 +1125,19 @@ Future<void> performRemoveMessageReaction( | |||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   if (command.conversationJid != '') { |   if (command.key.conversationJid != '') { | ||||||
|     // Send the reaction |     // Send the reaction | ||||||
|     final manager = GetIt.I |     final manager = GetIt.I | ||||||
|         .get<XmppConnection>() |         .get<XmppConnection>() | ||||||
|         .getManagerById<MessageManager>(messageManager)!; |         .getManagerById<MessageManager>(messageManager)!; | ||||||
|     await manager.sendMessage( |     await manager.sendMessage( | ||||||
|       JID.fromString(command.conversationJid), |       JID.fromString(command.key.conversationJid), | ||||||
|       TypedMap<StanzaHandlerExtension>.fromList([ |       TypedMap<StanzaHandlerExtension>.fromList([ | ||||||
|         MessageReactionsData( |         MessageReactionsData( | ||||||
|           msg.originId ?? msg.sid, |           msg.originId ?? msg.sid, | ||||||
|           await rs.getReactionsForMessageByJid( |           await rs.getReactionsForMessageByJid( | ||||||
|             command.messageSid, |             command.key.sid, | ||||||
|             command.conversationJid, |             command.key.conversationJid, | ||||||
|             accountJid, |             accountJid, | ||||||
|             accountJid, |             accountJid, | ||||||
|           ), |           ), | ||||||
| @ -1363,8 +1362,8 @@ Future<void> performGetReactions( | |||||||
|   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); |   final accountJid = await GetIt.I.get<XmppStateService>().getAccountJid(); | ||||||
|   final reactionsRaw = |   final reactionsRaw = | ||||||
|       await GetIt.I.get<ReactionsService>().getReactionsForMessage( |       await GetIt.I.get<ReactionsService>().getReactionsForMessage( | ||||||
|             command.messageSid, |             command.key.sid, | ||||||
|             command.conversationJid, |             command.key.conversationJid, | ||||||
|             accountJid, |             accountJid, | ||||||
|           ); |           ); | ||||||
|   final reactionsMap = <String, List<String>>{}; |   final reactionsMap = <String, List<String>>{}; | ||||||
|  | |||||||
| @ -220,6 +220,7 @@ class HttpFileTransferService { | |||||||
|     } |     } | ||||||
|     final slot = slotResult.get<HttpFileUploadSlot>(); |     final slot = slotResult.get<HttpFileUploadSlot>(); | ||||||
| 
 | 
 | ||||||
|  |     final messageKey = job.messageMap.values.first.messageKey; | ||||||
|     final uploadStatusCode = await client.uploadFile( |     final uploadStatusCode = await client.uploadFile( | ||||||
|       Uri.parse(slot.putUrl), |       Uri.parse(slot.putUrl), | ||||||
|       slot.headers, |       slot.headers, | ||||||
| @ -231,8 +232,7 @@ class HttpFileTransferService { | |||||||
|           final progress = current.toDouble() / total.toDouble(); |           final progress = current.toDouble() / total.toDouble(); | ||||||
|           sendEvent( |           sendEvent( | ||||||
|             ProgressEvent( |             ProgressEvent( | ||||||
|               sid: job.messageMap.values.first.sid, |               key: messageKey, | ||||||
|               conversationJid: job.messageMap.values.first.conversationJid, |  | ||||||
|               progress: progress == 1 ? 0.99 : progress, |               progress: progress == 1 ? 0.99 : progress, | ||||||
|             ), |             ), | ||||||
|           ); |           ); | ||||||
| @ -410,8 +410,8 @@ class HttpFileTransferService { | |||||||
| 
 | 
 | ||||||
|     // Notify UI of download failure |     // Notify UI of download failure | ||||||
|     final msg = await ms.updateMessage( |     final msg = await ms.updateMessage( | ||||||
|       job.mSid, |       job.messageKey.sid, | ||||||
|       job.conversationJid, |       job.messageKey.conversationJid, | ||||||
|       job.accountJid, |       job.accountJid, | ||||||
|       errorType: error, |       errorType: error, | ||||||
|       isDownloading: false, |       isDownloading: false, | ||||||
| @ -453,8 +453,7 @@ class HttpFileTransferService { | |||||||
|           final progress = current.toDouble() / total.toDouble(); |           final progress = current.toDouble() / total.toDouble(); | ||||||
|           sendEvent( |           sendEvent( | ||||||
|             ProgressEvent( |             ProgressEvent( | ||||||
|               sid: job.mSid, |               key: job.messageKey, | ||||||
|               conversationJid: job.conversationJid, |  | ||||||
|               progress: progress == 1 ? 0.99 : progress, |               progress: progress == 1 ? 0.99 : progress, | ||||||
|             ), |             ), | ||||||
|           ); |           ); | ||||||
| @ -480,8 +479,7 @@ class HttpFileTransferService { | |||||||
|       // The file was downloaded and is now being decrypted |       // The file was downloaded and is now being decrypted | ||||||
|       sendEvent( |       sendEvent( | ||||||
|         ProgressEvent( |         ProgressEvent( | ||||||
|           sid: job.mSid, |           key: job.messageKey, | ||||||
|           conversationJid: job.conversationJid, |  | ||||||
|         ), |         ), | ||||||
|       ); |       ); | ||||||
| 
 | 
 | ||||||
| @ -600,10 +598,10 @@ class HttpFileTransferService { | |||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     final cs = GetIt.I.get<ConversationService>(); |     final cs = GetIt.I.get<ConversationService>(); | ||||||
|     final conversation = (await cs.getConversationByJid(job.conversationJid, job.accountJid))!; |     final conversation = (await cs.getConversationByJid(job.messageKey.conversationJid, job.accountJid))!; | ||||||
|     final msg = await GetIt.I.get<MessageService>().updateMessage( |     final msg = await GetIt.I.get<MessageService>().updateMessage( | ||||||
|           job.mSid, |           job.messageKey.sid, | ||||||
|           job.conversationJid, |           job.messageKey.conversationJid, | ||||||
|           job.accountJid, |           job.accountJid, | ||||||
|           fileMetadata: metadata, |           fileMetadata: metadata, | ||||||
|           isFileUploadNotification: false, |           isFileUploadNotification: false, | ||||||
| @ -618,7 +616,7 @@ class HttpFileTransferService { | |||||||
|     sendEvent(MessageUpdatedEvent(message: msg)); |     sendEvent(MessageUpdatedEvent(message: msg)); | ||||||
| 
 | 
 | ||||||
|     final updatedConversation = conversation.copyWith( |     final updatedConversation = conversation.copyWith( | ||||||
|       lastMessage: conversation.lastMessage?.sid == job.mSid |       lastMessage: conversation.lastMessage?.sid == job.messageKey.sid | ||||||
|           ? msg |           ? msg | ||||||
|           : conversation.lastMessage, |           : conversation.lastMessage, | ||||||
|     ); |     ); | ||||||
|  | |||||||
| @ -55,22 +55,21 @@ class FileUploadJob { | |||||||
| @immutable | @immutable | ||||||
| class FileDownloadJob { | class FileDownloadJob { | ||||||
|   const FileDownloadJob( |   const FileDownloadJob( | ||||||
|  |     this.messageKey, | ||||||
|     this.location, |     this.location, | ||||||
|     this.mSid, |  | ||||||
|     this.accountJid, |     this.accountJid, | ||||||
|     this.metadataId, |     this.metadataId, | ||||||
|     this.createMetadataHashes, |     this.createMetadataHashes, | ||||||
|     this.conversationJid, |  | ||||||
|     this.mimeGuess, { |     this.mimeGuess, { | ||||||
|     this.shouldShowNotification = true, |     this.shouldShowNotification = true, | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|  |   /// The message key. | ||||||
|  |   final MessageKey messageKey; | ||||||
|  | 
 | ||||||
|   /// The location where the file can be found. |   /// The location where the file can be found. | ||||||
|   final MediaFileLocation location; |   final MediaFileLocation location; | ||||||
| 
 | 
 | ||||||
|   /// The id of the message associated with the download. |  | ||||||
|   final String mSid; |  | ||||||
| 
 |  | ||||||
|   /// The associated account |   /// The associated account | ||||||
|   final String accountJid; |   final String accountJid; | ||||||
| 
 | 
 | ||||||
| @ -81,9 +80,6 @@ class FileDownloadJob { | |||||||
|   /// object. |   /// object. | ||||||
|   final bool createMetadataHashes; |   final bool createMetadataHashes; | ||||||
| 
 | 
 | ||||||
|   /// The JID of the conversation this message was received in. |  | ||||||
|   final String conversationJid; |  | ||||||
| 
 |  | ||||||
|   /// A guess to the files's MIME type. |   /// A guess to the files's MIME type. | ||||||
|   final String? mimeGuess; |   final String? mimeGuess; | ||||||
| 
 | 
 | ||||||
| @ -94,10 +90,9 @@ class FileDownloadJob { | |||||||
|   bool operator ==(Object other) { |   bool operator ==(Object other) { | ||||||
|     return other is FileDownloadJob && |     return other is FileDownloadJob && | ||||||
|         location == other.location && |         location == other.location && | ||||||
|         mSid == other.mSid && |         messageKey == other.messageKey && | ||||||
|         accountJid == other.accountJid && |         accountJid == other.accountJid && | ||||||
|         metadataId == other.metadataId && |         metadataId == other.metadataId && | ||||||
|         conversationJid == other.conversationJid && |  | ||||||
|         mimeGuess == other.mimeGuess && |         mimeGuess == other.mimeGuess && | ||||||
|         shouldShowNotification == other.shouldShowNotification; |         shouldShowNotification == other.shouldShowNotification; | ||||||
|   } |   } | ||||||
| @ -105,9 +100,8 @@ class FileDownloadJob { | |||||||
|   @override |   @override | ||||||
|   int get hashCode => |   int get hashCode => | ||||||
|       location.hashCode ^ |       location.hashCode ^ | ||||||
|       mSid.hashCode ^ |       messageKey.hashCode ^ | ||||||
|       metadataId.hashCode ^ |       metadataId.hashCode ^ | ||||||
|       conversationJid.hashCode ^ |  | ||||||
|       mimeGuess.hashCode ^ |       mimeGuess.hashCode ^ | ||||||
|       shouldShowNotification.hashCode; |       shouldShowNotification.hashCode; | ||||||
| } | } | ||||||
|  | |||||||
| @ -1480,14 +1480,13 @@ class XmppService { | |||||||
|         ); |         ); | ||||||
|         await fts.downloadFile( |         await fts.downloadFile( | ||||||
|           FileDownloadJob( |           FileDownloadJob( | ||||||
|  |             message.messageKey, | ||||||
|             embeddedFile, |             embeddedFile, | ||||||
|             message.sid, |  | ||||||
|             accountJid, |             accountJid, | ||||||
|             message.fileMetadata!.id, |             message.fileMetadata!.id, | ||||||
|             // If we did not retrieve the file, then we were not able to find it using |             // If we did not retrieve the file, then we were not able to find it using | ||||||
|             // hashes. |             // hashes. | ||||||
|             !fileMetadata!.retrieved, |             !fileMetadata!.retrieved, | ||||||
|             conversationJid, |  | ||||||
|             mimeGuess, |             mimeGuess, | ||||||
|           ), |           ), | ||||||
|         ); |         ); | ||||||
| @ -1675,14 +1674,13 @@ class XmppService { | |||||||
|         _log.finest('Advertised file MIME: ${_getMimeGuess(event)}'); |         _log.finest('Advertised file MIME: ${_getMimeGuess(event)}'); | ||||||
|         await GetIt.I.get<HttpFileTransferService>().downloadFile( |         await GetIt.I.get<HttpFileTransferService>().downloadFile( | ||||||
|               FileDownloadJob( |               FileDownloadJob( | ||||||
|  |                 message.messageKey, | ||||||
|                 embeddedFile, |                 embeddedFile, | ||||||
|                 message.sid, |  | ||||||
|                 accountJid, |                 accountJid, | ||||||
|                 oldFileMetadata!.id, |                 oldFileMetadata!.id, | ||||||
|                 // If [fileMetadata] is null, then we were not able to find the file metadata |                 // If [fileMetadata] is null, then we were not able to find the file metadata | ||||||
|                 // using hashes and thus have to create hash pointers. |                 // using hashes and thus have to create hash pointers. | ||||||
|                 fileMetadata == null, |                 fileMetadata == null, | ||||||
|                 conversationJid, |  | ||||||
|                 _getMimeGuess(event), |                 _getMimeGuess(event), | ||||||
|                 shouldShowNotification: false, |                 shouldShowNotification: false, | ||||||
|               ), |               ), | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user