File tree 1 file changed +15
-8
lines changed
src/status_im/notifications
1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 29
29
(log/debug " notifications-denied" )
30
30
(re-frame/dispatch [:notifications.callback/request-notifications-permissions-denied {}]))))))
31
31
32
+ (defn valid-notification-payload?
33
+ [{:keys [from to] :as payload}]
34
+ (and from to))
35
+
32
36
(defn create-notification-payload
33
37
[{:keys [from to] :as payload}]
34
- (if (and from to )
38
+ (if (valid-notification-payload? payload )
35
39
{:msg (js/JSON.stringify #js {:from from
36
40
:to to})}
37
41
(throw (str " Invalid push notification payload" payload))))
48
52
(def icon " ic_stat_status_notification" )
49
53
50
54
(defn get-notification-payload [message-js]
51
- (let [data (.. message-js -data) ; ; https://github.com/invertase/react-native-firebase/blob/adcbeac3d11585dd63922ef178ff6fd886d5aa9b/src/modules/notifications/Notification.js#L79
52
- msg (js/JSON.parse (object/get data " msg" ))
53
- from (object/get msg " from" )
54
- to (object/get msg " to" )]
55
- (if (and from to)
56
- {:from from
57
- :to to}
55
+ ; ; message-js.-data is Notification.data():
56
+ ; ; https://github.com/invertase/react-native-firebase/blob/adcbeac3d11585dd63922ef178ff6fd886d5aa9b/src/modules/notifications/Notification.js#L79
57
+ (let [data (.. message-js -data)
58
+ msg (js/JSON.parse (object/get data " msg" ))
59
+ from (object/get msg " from" )
60
+ to (object/get msg " to" )
61
+ payload {:from from
62
+ :to to}]
63
+ (if (valid-notification-payload? payload)
64
+ payload
58
65
(log/warn " failed to retrieve notification payload from" (js/JSON.stringify data)))))
59
66
60
67
(defn display-notification [{:keys [title body from to]}]
You can’t perform that action at this time.
0 commit comments