MM-20779 Handle Android notification reply with special characters (#3636)

This commit is contained in:
Elias Nahum 2019-12-02 12:25:33 -03:00 committed by Miguel Alatzar
parent 8d37e3d22f
commit 39cdbb757d

View file

@ -21,6 +21,9 @@ import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.json.JSONObject;
import org.json.JSONException;
import com.mattermost.react_native_interface.ResolvePromise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.WritableMap;
@ -114,11 +117,15 @@ public class NotificationReplyBroadcastReceiver extends BroadcastReceiver {
}
protected String buildReplyPost(String channelId, String rootId, String message) {
return "{"
+ "\"channel_id\": \"" + channelId + "\","
+ "\"message\": \"" + message + "\","
+ "\"root_id\": \"" + rootId + "\""
+ "}";
try {
JSONObject json = new JSONObject();
json.put("channel_id", channelId);
json.put("message", message);
json.put("root_id", rootId);
return json.toString();
} catch(JSONException e) {
return "{}";
}
}
protected void onReplyFailed(NotificationManager notificationManager, int notificationId, String channelId) {