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