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
1 changed files with 16 additions and 13 deletions

View File

@ -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)))))