diff --git a/syng-im/src/syng_im/components/chat/chat_message_new.cljs b/syng-im/src/syng_im/components/chat/chat_message_new.cljs index 2d90dc40dc..dd2c11f2b9 100644 --- a/syng-im/src/syng_im/components/chat/chat_message_new.cljs +++ b/syng-im/src/syng_im/components/chat/chat_message_new.cljs @@ -8,19 +8,24 @@ text-input touchable-highlight]] [syng-im.components.chat.plain-message-input :refer [plain-message-input-view]] - [syng-im.components.chat.simple-command-input :refer [simple-command-input-view]] - [syng-im.components.chat.phone-input :refer [phone-input-view]] + [syng-im.components.chat.input.simple-command :refer [simple-command-input-view]] + [syng-im.components.chat.input.phone :refer [phone-input-view]] + [syng-im.components.chat.input.password :refer [password-input-view]] + [syng-im.components.chat.input.money :refer [money-input-view]] [syng-im.utils.utils :refer [log toast http-post]] [syng-im.utils.logging :as log] [syng-im.resources :as res] [reagent.core :as r])) (defn default-command-input-view [command] - [simple-command-input-view command "default"]) + [simple-command-input-view command {}]) (defn special-input-view [command] (case (:command command) :phone [phone-input-view command] + :keypair-password [password-input-view command] + :money [money-input-view command] + :request [money-input-view command] [default-command-input-view command])) (defn chat-message-new [] diff --git a/syng-im/src/syng_im/components/chat/input/money.cljs b/syng-im/src/syng_im/components/chat/input/money.cljs new file mode 100644 index 0000000000..8401ff31a2 --- /dev/null +++ b/syng-im/src/syng_im/components/chat/input/money.cljs @@ -0,0 +1,15 @@ +(ns syng-im.components.chat.input.money + (:require + [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [syng-im.components.chat.input.simple-command :refer [simple-command-input-view]] + [syng-im.utils.utils :refer [log toast http-post]] + [syng-im.utils.logging :as log])) + +(defn money-input-view [command] + [simple-command-input-view command {:keyboardType "numeric" + :style {:flex 1 + :marginLeft 8 + :lineHeight 42 + :fontSize 32 + :fontFamily "Avenir-Roman" + :color "black"}}]) diff --git a/syng-im/src/syng_im/components/chat/input/password.cljs b/syng-im/src/syng_im/components/chat/input/password.cljs new file mode 100644 index 0000000000..e27c5f8112 --- /dev/null +++ b/syng-im/src/syng_im/components/chat/input/password.cljs @@ -0,0 +1,9 @@ +(ns syng-im.components.chat.input.password + (:require + [re-frame.core :refer [subscribe dispatch dispatch-sync]] + [syng-im.components.chat.input.simple-command :refer [simple-command-input-view]] + [syng-im.utils.utils :refer [log toast http-post]] + [syng-im.utils.logging :as log])) + +(defn password-input-view [command] + [simple-command-input-view command {:secureTextEntry true}]) diff --git a/syng-im/src/syng_im/components/chat/phone_input.cljs b/syng-im/src/syng_im/components/chat/input/phone.cljs similarity index 56% rename from syng-im/src/syng_im/components/chat/phone_input.cljs rename to syng-im/src/syng_im/components/chat/input/phone.cljs index b5f75fe212..ed8c71db1e 100644 --- a/syng-im/src/syng_im/components/chat/phone_input.cljs +++ b/syng-im/src/syng_im/components/chat/input/phone.cljs @@ -1,9 +1,9 @@ -(ns syng-im.components.chat.phone-input +(ns syng-im.components.chat.input.phone (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] - [syng-im.components.chat.simple-command-input :refer [simple-command-input-view]] + [syng-im.components.chat.input.simple-command :refer [simple-command-input-view]] [syng-im.utils.utils :refer [log toast http-post]] [syng-im.utils.logging :as log])) (defn phone-input-view [command] - [simple-command-input-view command "phone-pad"]) + [simple-command-input-view command {:keyboardType "phone-pad"}]) diff --git a/syng-im/src/syng_im/components/chat/simple_command_input.cljs b/syng-im/src/syng_im/components/chat/input/simple_command.cljs similarity index 72% rename from syng-im/src/syng_im/components/chat/simple_command_input.cljs rename to syng-im/src/syng_im/components/chat/input/simple_command.cljs index 1aed8cebf0..e3f35f5500 100644 --- a/syng-im/src/syng_im/components/chat/simple_command_input.cljs +++ b/syng-im/src/syng_im/components/chat/input/simple_command.cljs @@ -1,4 +1,4 @@ -(ns syng-im.components.chat.simple-command-input +(ns syng-im.components.chat.input.simple-command (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] [syng-im.components.react :refer [android? view @@ -14,7 +14,7 @@ (defn cancel-command-input [] (dispatch [:set-input-command nil])) -(defn simple-command-input-view [command input-type] +(defn simple-command-input-view [command input-options] (let [message-atom (r/atom nil) chat-id (subscribe [:get-current-chat-id])] (fn [] @@ -49,20 +49,21 @@ [image {:source res/att :style {:width 17 :height 14}}]]] - [text-input {:style {:flex 1 - :marginLeft 8 - :lineHeight 42 - :fontSize 14 - :fontFamily "Avenir-Roman" - :color "#9CBFC0"} - :underlineColorAndroid "transparent" - :autoFocus true - :keyboardType input-type - :value message - :onChangeText (fn [new-text] - ) - :onSubmitEditing (fn [e] - )}]]] + [text-input (merge {:style {:flex 1 + :marginLeft 8 + :lineHeight 42 + :fontSize 14 + :fontFamily "Avenir-Roman" + :color "black"} + :underlineColorAndroid "transparent" + :autoFocus true + :keyboardType "default" + :value message + :onChangeText (fn [new-text] + ) + :onSubmitEditing (fn [e] + )} + input-options)]]] [touchable-highlight {:style {:marginTop 14 :marginRight 16 :position "absolute" diff --git a/syng-im/src/syng_im/models/commands.cljs b/syng-im/src/syng_im/models/commands.cljs index 0e46eb8c33..f2fc5ed185 100644 --- a/syng-im/src/syng_im/models/commands.cljs +++ b/syng-im/src/syng_im/models/commands.cljs @@ -18,7 +18,7 @@ :text "!phone" :description "Send phone number" :color "#48ba30" - :suggestion false} + :suggestion true} {:command :send :text "!send" :description "Send location"