From d4f2983a09d4d395af79397b1453ae938b22591d Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Mon, 8 May 2017 12:59:35 +0300 Subject: [PATCH] geolocation permissions request on android --- android/app/src/main/AndroidManifest.xml | 1 + package.json | 2 +- src/status_im/components/permissions.cljs | 3 ++- src/status_im/handlers.cljs | 7 +++++++ 4 files changed, 11 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 03f6175655..3d1cb961a0 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -15,6 +15,7 @@ + diff --git a/package.json b/package.json index 683c56df38..f16d10dd56 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "react-native-tcp": "^3.2.1", "react-native-udp": "^2.0.0", "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", "realm": "^0.14.3", "stream-browserify": "^1.0.0", diff --git a/src/status_im/components/permissions.cljs b/src/status_im/components/permissions.cljs index 3ef997bd8e..1b5f556b2c 100644 --- a/src/status_im/components/permissions.cljs +++ b/src/status_im/components/permissions.cljs @@ -9,7 +9,8 @@ :write-external-storage "android.permission.WRITE_EXTERNAL_STORAGE" :read-contacts "android.permission.READ_CONTACTS" :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] (let [permission-vals (distinct (vals permissions))] diff --git a/src/status_im/handlers.cljs b/src/status_im/handlers.cljs index 8710a74b8f..e06fd0c302 100644 --- a/src/status_im/handlers.cljs +++ b/src/status_im/handlers.cljs @@ -142,6 +142,11 @@ #(dispatch [:move-to-internal-failure-message])]) (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 (u/side-effect! (fn [_ [_ event-str]] @@ -154,6 +159,8 @@ "node.started" (dispatch [:status-node-started!]) "module.initialized" (dispatch [:status-module-initialized!]) "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")))))) (register-handler :status-module-initialized!