Always define request-permissions

Remove empty line

Another empty line
This commit is contained in:
Vitaliy Vlasov 2018-08-31 14:23:23 +03:00
parent c176d9a160
commit 14cada8373
No known key found for this signature in database
GPG Key ID: A7D57C347F2B2964

View File

@ -13,20 +13,22 @@
(when-not platform/desktop? (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. ;; NOTE: Only need to explicitly request permissions on iOS.
(defn request-permissions [] (defn request-permissions []
(if platform/desktop? (if platform/desktop?
(re-frame/dispatch [:notifications/request-notifications-granted {}]) (re-frame/dispatch [:notifications/request-notifications-granted {}])
(-> (.requestPermission (.messaging firebase)) (-> (.requestPermission (.messaging firebase))
(.then (.then
(fn [_] (fn [_]
(log/debug "notifications-granted") (log/debug "notifications-granted")
(re-frame/dispatch [:notifications/request-notifications-granted {}])) (re-frame/dispatch [:notifications/request-notifications-granted {}]))
(fn [_] (fn [_]
(log/debug "notifications-denied") (log/debug "notifications-denied")
(re-frame/dispatch [:notifications/request-notifications-denied {}])))))) (re-frame/dispatch [:notifications/request-notifications-denied {}]))))))
(when-not platform/desktop?
(defn get-fcm-token [] (defn get-fcm-token []
(-> (.getToken (.messaging firebase)) (-> (.getToken (.messaging firebase))
@ -158,3 +160,4 @@
(handle-push-notification {:from from (handle-push-notification {:from from
:to to} :to to}
cofx))))) cofx)))))