Merge pull request #365 from status-im/bug/#349

Various !browse command issues on open (#349)
This commit is contained in:
Roman Volosovskyi 2016-10-18 15:35:18 +03:00 committed by GitHub
commit efeb82ac3c
11 changed files with 40 additions and 33 deletions

View File

@ -5,8 +5,8 @@ function wallet() {
}
status.command({
name: "wallet",
description: "wallet",
name: "browse",
description: "Browse wallet",
color: "#ffa500",
fullscreen: true,
suggestionsTrigger: 'on-send',
@ -17,4 +17,4 @@ status.command({
}]
});
status.autorun("wallet");
status.autorun("browse");

View File

@ -13,7 +13,8 @@
[status-im.constants :refer [text-content-type
content-type-command
content-type-command-request
default-number-of-messages]]
default-number-of-messages
wallet-chat-id]]
[status-im.utils.random :as random]
[status-im.chat.sign-up :as sign-up-service]
[status-im.navigation.handlers :as nav]
@ -275,6 +276,8 @@
(let [chat-id (or id current-chat-id)
messages (get-in db [:chats chat-id :messages])
db' (assoc db :current-chat-id chat-id)]
(when (= current-chat-id wallet-chat-id)
(dispatch [:cancel-command]))
(dispatch [:load-requests! chat-id])
(dispatch [:load-commands! chat-id])
(if (and (seq messages)

View File

@ -17,6 +17,6 @@
(dispatch [:add-chat
wallet-chat-id
{:name "Wallet"
:dapp-url "http://127.0.0.1:3450"}])
:dapp-url "http://192.168.1.125:3450"}])
(dispatch [:add-contacts [dapp-contact]])))))

View File

@ -7,7 +7,8 @@
color-black]]
[status-im.chat.constants :refer [input-height
request-info-height
response-height-normal]]))
response-height-normal]]
[status-im.utils.platform :as p]))
(def drag-container
{:height 16
@ -84,8 +85,8 @@
(defn command-input [ml disable?]
{:flex 1
:marginRight 16
:margin-right 16
:margin-left (- ml 5)
:padding 0
:fontSize 14
:font-size 14
:color (if disable? color-white text1-color)})

View File

@ -9,7 +9,8 @@
[status-im.chat.views.plain-message :as plain-message]
[status-im.chat.views.command :as command]
[status-im.constants :refer [content-type-status]]
[status-im.utils.datetime :as time]))
[status-im.utils.datetime :as time]
[status-im.utils.platform :refer [platform-specific]]))
(register-sub :chat-properties
(fn [db [_ properties]]
@ -214,10 +215,12 @@
(get-in @db [:animations :command-suggestions-height @chat-id])))))
(register-sub :response-height
(fn [db]
(fn [db [_ status-bar]]
(let [chat-id (subscribe [:get-current-chat-id])]
(reaction
(get-in @db [:animations :to-response-height @chat-id])))))
(min (get-in @db [:animations :to-response-height @chat-id])
(- (:layout-height @db)
(get-in platform-specific [:component-styles :status-bar status-bar :height])))))))
(register-sub :web-view-url
(fn [db]

View File

@ -63,7 +63,7 @@
disable? [:get :disable-input]]
[text-input (merge
(command-input-options command icon-width disable?)
{:auto-focus true
{:auto-focus false
:blur-on-submit false
:accessibility-label :input
:on-focus #(dispatch [:set :focused true])

View File

@ -76,13 +76,14 @@
(when-let [to-value @to-value]
(when-not (= to-value (.-_value val))
(if (or (nil? @animate?) @animate?)
(anim/start (anim/spring val {:toValue to-value}))
(anim/start (anim/timing val {:toValue to-value
:duration 300}))
(anim/set-value val to-value)))))
(defn container [response-height & children]
(let [;; todo to-response-height, cur-response-height must be specific
;; for each chat
to-response-height (subscribe [:response-height])
to-response-height (subscribe [:response-height :default])
changed (subscribe [:animations :response-height-changed])
animate? (subscribe [:animate?])
keyboard-height (subscribe [:get :keyboard-height])
@ -120,7 +121,7 @@
:source {:uri url}
:java-script-enabled true
:injected-java-script (slurp "resources/webview.js")
:style {:height 300}
:bounces false
:on-navigation-state-change on-navigation-change}]))
(defview placeholder []

View File

@ -91,10 +91,8 @@
(reg-handler :suggestions-handler
[(after #(dispatch [:animate-show-response]))
(after (print-error-message! "Error on param suggestions"))
(after (fn [_ [{:keys [command]} {:keys [result]}]]
(after (fn [_ [{:keys [command]}]]
(when (= :on-send (keyword (:suggestions-trigger command)))
(when (:webViewUrl result)
(dispatch [:set-soft-input-mode :pan]))
(r/dismiss-keyboard!))))]
suggestions-handler!)
(reg-handler :suggestions-event! (u/side-effect! suggestions-events-handler!))

View File

@ -1,6 +1,7 @@
(ns status-im.models.commands
(:require [status-im.db :as db]
[tailrecursion.priority-map :refer [priority-map-by]]))
[tailrecursion.priority-map :refer [priority-map-by]]
[taoensso.timbre :as log]))
(defn get-commands [{:keys [current-chat-id] :as db}]
(or (get-in db [:chats current-chat-id :commands]) {}))