From 7a21d15f1119febc1d3b5d813a75520ec0bfcbc8 Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Wed, 8 Apr 2020 11:38:13 +0200 Subject: [PATCH] Fix ios push --- lib/components/matrix.dart | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/components/matrix.dart b/lib/components/matrix.dart index e1121a8..14f9804 100644 --- a/lib/components/matrix.dart +++ b/lib/components/matrix.dart @@ -171,7 +171,7 @@ class MatrixState extends State { if (message is String) { roomId = message; } else if (message is Map) { - roomId = message["data"]["room_id"]; + roomId = (message["data"] ?? message)["room_id"]; } if (roomId?.isEmpty ?? true) throw ("Bad roomId"); await Navigator.of(context).pushAndRemoveUntil( @@ -207,9 +207,10 @@ class MatrixState extends State { _firebaseMessaging.configure( onMessage: (Map message) async { try { - final String roomId = message["data"]["room_id"]; - final String eventId = message["data"]["event_id"]; - final int unread = json.decode(message["data"]["counts"])["unread"]; + final data = message['data'] ?? message; + final String roomId = data["room_id"]; + final String eventId = data["event_id"]; + final int unread = json.decode(data["counts"])["unread"]; if ((roomId?.isEmpty ?? true) || (eventId?.isEmpty ?? true) || unread == 0) {