From 14cada8373456d21e07077339306611b0b6c57ca Mon Sep 17 00:00:00 2001 From: Vitaliy Vlasov Date: Fri, 31 Aug 2018 14:23:23 +0300 Subject: [PATCH] Always define request-permissions Remove empty line Another empty line --- src/status_im/notifications/core.cljs | 29 +++++++++++++++------------ 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/status_im/notifications/core.cljs b/src/status_im/notifications/core.cljs index ed500b3c71..19b0eae8c3 100644 --- a/src/status_im/notifications/core.cljs +++ b/src/status_im/notifications/core.cljs @@ -13,20 +13,22 @@ (when-not platform/desktop? - (def firebase (object/get rn/react-native-firebase "default")) + (def firebase (object/get rn/react-native-firebase "default"))) - ;; NOTE: Only need to explicitly request permissions on iOS. - (defn request-permissions [] - (if platform/desktop? - (re-frame/dispatch [:notifications/request-notifications-granted {}]) - (-> (.requestPermission (.messaging firebase)) - (.then - (fn [_] - (log/debug "notifications-granted") - (re-frame/dispatch [:notifications/request-notifications-granted {}])) - (fn [_] - (log/debug "notifications-denied") - (re-frame/dispatch [:notifications/request-notifications-denied {}])))))) +;; NOTE: Only need to explicitly request permissions on iOS. +(defn request-permissions [] + (if platform/desktop? + (re-frame/dispatch [:notifications/request-notifications-granted {}]) + (-> (.requestPermission (.messaging firebase)) + (.then + (fn [_] + (log/debug "notifications-granted") + (re-frame/dispatch [:notifications/request-notifications-granted {}])) + (fn [_] + (log/debug "notifications-denied") + (re-frame/dispatch [:notifications/request-notifications-denied {}])))))) + +(when-not platform/desktop? (defn get-fcm-token [] (-> (.getToken (.messaging firebase)) @@ -158,3 +160,4 @@ (handle-push-notification {:from from :to to} cofx))))) +