From 371c4889acb246944150cfdd9059f8c945e5c73f Mon Sep 17 00:00:00 2001 From: Roman Volosovskyi Date: Fri, 21 Oct 2016 17:42:08 +0300 Subject: [PATCH] fixes #383 --- ios/StatusIm/Info.plist | 2 ++ resources/commands.js | 12 ++++++------ src/status_im/chat/views/response.cljs | 10 +++++++++- src/status_im/translations/en.cljs | 5 ++++- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/ios/StatusIm/Info.plist b/ios/StatusIm/Info.plist index 14960f6551..f3f7488818 100644 --- a/ios/StatusIm/Info.plist +++ b/ios/StatusIm/Info.plist @@ -46,6 +46,8 @@ NSAppTransportSecurity + NSAllowsArbitraryLoads + NSExceptionDomains api.status.im diff --git a/resources/commands.js b/resources/commands.js index 497ad774ed..f391b91a66 100644 --- a/resources/commands.js +++ b/resources/commands.js @@ -12,12 +12,12 @@ status.command({ fontFamily: "font", color: "black" } - }, params.value); + }, params.address); var uri = "https://maps.googleapis.com/maps/api/staticmap?center=" - + params.value + + params.address + "&size=100x100&maptype=roadmap&key=AIzaSyBNsj1qoQEYPb3IllmWMAscuXW0eeuYqAA&language=en" + "&markers=size:mid%7Ccolor:0xff0000%7Clabel:%7C" - + params.value; + + params.address; var image = status.components.image( { @@ -39,8 +39,8 @@ status.command({ function browseSuggestions(params) { - if (params.value != "") { - var url = params.value; + if (params.url && params.url !== "undefined" && params.url != "") { + var url = params.url; if (!/^[a-zA-Z-_]+:/.test(url)) { url = 'http://' + url; } @@ -56,7 +56,7 @@ status.command({ fullscreen: true, suggestionsTrigger: 'on-send', params: [{ - name: "webpage", + name: "url", suggestions: browseSuggestions, type: status.types.TEXT }] diff --git a/src/status_im/chat/views/response.cljs b/src/status_im/chat/views/response.cljs index 7258861cab..8b66b338b9 100644 --- a/src/status_im/chat/views/response.cljs +++ b/src/status_im/chat/views/response.cljs @@ -38,7 +38,7 @@ (defview info-container [command] [{:keys [name chat-id]} [:get-current-chat] - {:keys [added]} [:get-current-request]] + {:keys [added]} [:get-current-request]] [view st/info-container [text {:style st/command-name} (str (:description command) " " (label :t/request))] @@ -112,6 +112,13 @@ (dispatch [:set-web-view-url url]) (dispatch [:set-chat-command-content (str "c " url)]))))) +(defn web-view-error [] + (r/as-element + [view {:justify-content :center + :align-items :center + :flex-direction :row} + [text (label :t/web-view-error)]])) + (defview suggestions-web-view [] [url [:web-view-url]] (when url @@ -119,6 +126,7 @@ {:ref #(dispatch [:set-webview-bridge %]) :on-bridge-message #(dispatch [:webview-bridge-message %]) :source {:uri url} + :render-error web-view-error :java-script-enabled true :injected-java-script (slurp "resources/webview.js") :bounces false diff --git a/src/status_im/translations/en.cljs b/src/status_im/translations/en.cljs index e502cbc852..2fc6fbacc5 100644 --- a/src/status_im/translations/en.cljs +++ b/src/status_im/translations/en.cljs @@ -206,4 +206,7 @@ :recipient "Recipient" :one-more-item "One more item" :fee "Fee" - :value "Value"}) + :value "Value" + + ;:webview + :web-view-error "oops, error"})