geolocation permissions request on android

This commit is contained in:
Roman Volosovskyi 2017-05-08 12:59:35 +03:00 committed by Roman Volosovskyi
parent 34b77022f7
commit d4f2983a09
4 changed files with 11 additions and 2 deletions

View File

@ -15,6 +15,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/> <uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.RECEIVE_SMS"/> <uses-permission android:name="android.permission.RECEIVE_SMS"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- these permissions should be removed --> <!-- these permissions should be removed -->
<!-- react-native-orientation adds an unnecessary permission; here we remove it --> <!-- react-native-orientation adds an unnecessary permission; here we remove it -->

View File

@ -75,7 +75,7 @@
"react-native-tcp": "^3.2.1", "react-native-tcp": "^3.2.1",
"react-native-udp": "^2.0.0", "react-native-udp": "^2.0.0",
"react-native-vector-icons": "^4.0.1", "react-native-vector-icons": "^4.0.1",
"react-native-webview-bridge": "github:status-im/react-native-webview-bridge#0.33.12", "react-native-webview-bridge": "github:status-im/react-native-webview-bridge#0.33.13",
"readable-stream": "1.0.33", "readable-stream": "1.0.33",
"realm": "^0.14.3", "realm": "^0.14.3",
"stream-browserify": "^1.0.0", "stream-browserify": "^1.0.0",

View File

@ -9,7 +9,8 @@
:write-external-storage "android.permission.WRITE_EXTERNAL_STORAGE" :write-external-storage "android.permission.WRITE_EXTERNAL_STORAGE"
:read-contacts "android.permission.READ_CONTACTS" :read-contacts "android.permission.READ_CONTACTS"
:camera "android.permission.CAMERA" :camera "android.permission.CAMERA"
:receive-sms "android.permission.RECEIVE_SMS"}) :receive-sms "android.permission.RECEIVE_SMS"
:geolocation "android.permission.ACCESS_FINE_LOCATION"})
(defn all-granted? [permissions] (defn all-granted? [permissions]
(let [permission-vals (distinct (vals permissions))] (let [permission-vals (distinct (vals permissions))]

View File

@ -142,6 +142,11 @@
#(dispatch [:move-to-internal-failure-message])]) #(dispatch [:move-to-internal-failure-message])])
(status/start-node (fn [result] (node-started db result))))))))) (status/start-node (fn [result] (node-started db result)))))))))
(register-handler :webview-geo-permissions-granted
(u/side-effect!
(fn [{:keys [webview-bridge]}]
(.geoPermissionsGranted webview-bridge))))
(register-handler :signal-event (register-handler :signal-event
(u/side-effect! (u/side-effect!
(fn [_ [_ event-str]] (fn [_ [_ event-str]]
@ -154,6 +159,8 @@
"node.started" (dispatch [:status-node-started!]) "node.started" (dispatch [:status-node-started!])
"module.initialized" (dispatch [:status-module-initialized!]) "module.initialized" (dispatch [:status-module-initialized!])
"local_storage.set" (dispatch [:set-local-storage event]) "local_storage.set" (dispatch [:set-local-storage event])
"request_geo_permissions" (dispatch [:request-permissions [:geolocation]
#(dispatch [:webview-geo-permissions-granted])])
(log/debug "Event " type " not handled")))))) (log/debug "Event " type " not handled"))))))
(register-handler :status-module-initialized! (register-handler :status-module-initialized!