fix: reply from a push is sent to the correct destination (#5152)
* add tmid to msg json body * add tmid to ios reply * remove unused param
This commit is contained in:
parent
c9f4ca1197
commit
7affa268fa
|
@ -34,6 +34,8 @@ public class Ejson {
|
|||
String senderName;
|
||||
String msg;
|
||||
|
||||
String tmid;
|
||||
|
||||
private MMKV mmkv;
|
||||
|
||||
private String TOKEN_KEY = "reactnativemeteor_usertoken-";
|
||||
|
|
|
@ -123,7 +123,9 @@ public class ReplyBroadcast extends BroadcastReceiver {
|
|||
if (msg != message) {
|
||||
msgMap.put("t", "e2e");
|
||||
}
|
||||
msgMap.put("tmid", null);
|
||||
if(ejson.tmid != null) {
|
||||
msgMap.put("tmid", ejson.tmid);
|
||||
}
|
||||
|
||||
Map m = new HashMap();
|
||||
m.put("message", msgMap);
|
||||
|
|
|
@ -34,7 +34,7 @@ class ReplyNotification: RNNotificationEventHandler {
|
|||
if let msg = (response as? UNTextInputNotificationResponse)?.userText {
|
||||
let rocketchat = RocketChat.instanceForServer(server: payload.host.removeTrailingSlash())
|
||||
let backgroundTask = UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
|
||||
rocketchat.sendMessage(rid: rid, message: msg) { response in
|
||||
rocketchat.sendMessage(rid: rid, message: msg, threadIdentifier: payload.tmid) { response in
|
||||
guard let response = response, response.success else {
|
||||
let content = UNMutableNotificationContent()
|
||||
content.body = "Failed to reply message."
|
||||
|
|
|
@ -19,4 +19,5 @@ struct Payload: Codable {
|
|||
let messageType: MessageType?
|
||||
let msg: String?
|
||||
let senderName: String?
|
||||
let tmid: String?
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ final class RocketChat {
|
|||
}
|
||||
}
|
||||
|
||||
func sendMessage(rid: String, message: String, completion: @escaping((MessageResponse?) -> Void)) {
|
||||
func sendMessage(rid: String, message: String, threadIdentifier: String?, completion: @escaping((MessageResponse?) -> Void)) {
|
||||
let id = String.random(length: 17)
|
||||
|
||||
var msg = message
|
||||
|
@ -61,7 +61,7 @@ final class RocketChat {
|
|||
msg = encryptMessage(rid: rid, id: id, message: message)
|
||||
}
|
||||
|
||||
api?.fetch(request: SendMessageRequest(id: id, roomId: rid, text: msg, messageType: encrypted ? .e2e : nil )) { response in
|
||||
api?.fetch(request: SendMessageRequest(id: id, roomId: rid, text: msg, threadIdentifier: threadIdentifier, messageType: encrypted ? .e2e : nil )) { response in
|
||||
switch response {
|
||||
case .resource(let response):
|
||||
completion(response)
|
||||
|
|
Loading…
Reference in New Issue