Merge pull request #385 from status-im/bug/#383

This commit is contained in:
Roman Volosovskyi 2016-10-22 15:53:11 +03:00 committed by GitHub
commit dc6701ea1d
4 changed files with 21 additions and 8 deletions

View File

@ -46,6 +46,8 @@
<string></string> <string></string>
<key>NSAppTransportSecurity</key> <key>NSAppTransportSecurity</key>
<dict> <dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSExceptionDomains</key> <key>NSExceptionDomains</key>
<dict> <dict>
<key>api.status.im</key> <key>api.status.im</key>

View File

@ -12,12 +12,12 @@ status.command({
fontFamily: "font", fontFamily: "font",
color: "black" color: "black"
} }
}, params.value); }, params.address);
var uri = "https://maps.googleapis.com/maps/api/staticmap?center=" var uri = "https://maps.googleapis.com/maps/api/staticmap?center="
+ params.value + params.address
+ "&size=100x100&maptype=roadmap&key=AIzaSyBNsj1qoQEYPb3IllmWMAscuXW0eeuYqAA&language=en" + "&size=100x100&maptype=roadmap&key=AIzaSyBNsj1qoQEYPb3IllmWMAscuXW0eeuYqAA&language=en"
+ "&markers=size:mid%7Ccolor:0xff0000%7Clabel:%7C" + "&markers=size:mid%7Ccolor:0xff0000%7Clabel:%7C"
+ params.value; + params.address;
var image = status.components.image( var image = status.components.image(
{ {
@ -39,8 +39,8 @@ status.command({
function browseSuggestions(params) { function browseSuggestions(params) {
if (params.value != "") { if (params.url && params.url !== "undefined" && params.url != "") {
var url = params.value; var url = params.url;
if (!/^[a-zA-Z-_]+:/.test(url)) { if (!/^[a-zA-Z-_]+:/.test(url)) {
url = 'http://' + url; url = 'http://' + url;
} }
@ -56,7 +56,7 @@ status.command({
fullscreen: true, fullscreen: true,
suggestionsTrigger: 'on-send', suggestionsTrigger: 'on-send',
params: [{ params: [{
name: "webpage", name: "url",
suggestions: browseSuggestions, suggestions: browseSuggestions,
type: status.types.TEXT type: status.types.TEXT
}] }]

View File

@ -112,6 +112,13 @@
(dispatch [:set-web-view-url url]) (dispatch [:set-web-view-url url])
(dispatch [:set-chat-command-content (str "c " 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 [] (defview suggestions-web-view []
[url [:web-view-url]] [url [:web-view-url]]
(when url (when url
@ -119,6 +126,7 @@
{:ref #(dispatch [:set-webview-bridge %]) {:ref #(dispatch [:set-webview-bridge %])
:on-bridge-message #(dispatch [:webview-bridge-message %]) :on-bridge-message #(dispatch [:webview-bridge-message %])
:source {:uri url} :source {:uri url}
:render-error web-view-error
:java-script-enabled true :java-script-enabled true
:injected-java-script (slurp "resources/webview.js") :injected-java-script (slurp "resources/webview.js")
:bounces false :bounces false

View File

@ -206,4 +206,7 @@
:recipient "Recipient" :recipient "Recipient"
:one-more-item "One more item" :one-more-item "One more item"
:fee "Fee" :fee "Fee"
:value "Value"}) :value "Value"
;:webview
:web-view-error "oops, error"})