From 2c8cfa82125763e60b20d19e089cf5c36e084913 Mon Sep 17 00:00:00 2001 From: virvar Date: Thu, 7 Apr 2016 13:28:02 +0300 Subject: [PATCH] Delete old sign up forms --- src/syng_im/android/core.cljs | 6 +- src/syng_im/components/sign_up.cljs | 59 -------------- src/syng_im/components/sign_up_confirm.cljs | 86 --------------------- 3 files changed, 1 insertion(+), 150 deletions(-) delete mode 100644 src/syng_im/components/sign_up.cljs delete mode 100644 src/syng_im/components/sign_up_confirm.cljs diff --git a/src/syng_im/android/core.cljs b/src/syng_im/android/core.cljs index d5fc0361f3..073c5150bd 100644 --- a/src/syng_im/android/core.cljs +++ b/src/syng_im/android/core.cljs @@ -9,8 +9,6 @@ [syng-im.components.react :refer [navigator app-registry]] [syng-im.components.contact-list.contact-list :refer [contact-list]] [syng-im.components.chat :refer [chat]] - [syng-im.components.sign-up :refer [sign-up-view]] - [syng-im.components.sign-up-confirm :refer [sign-up-confirm-view]] [syng-im.components.chats.chats-list :refer [chats-list]] [syng-im.components.chats.new-group :refer [new-group]] [syng-im.utils.logging :as log] @@ -45,9 +43,7 @@ :chat-list (r/as-element [chats-list {:navigator nav}]) :new-group (r/as-element [new-group {:navigator nav}]) :contact-list (r/as-element [contact-list {:navigator nav}]) - :chat (r/as-element [chat {:navigator nav}]) - :sign-up (r/as-element [sign-up-view {:navigator nav}]) - :sign-up-confirm (r/as-element [sign-up-confirm-view {:navigator nav}])))))}]) + :chat (r/as-element [chat {:navigator nav}])))))}]) (defn init [] (dispatch-sync [:initialize-db]) diff --git a/src/syng_im/components/sign_up.cljs b/src/syng_im/components/sign_up.cljs deleted file mode 100644 index 917365b5d3..0000000000 --- a/src/syng_im/components/sign_up.cljs +++ /dev/null @@ -1,59 +0,0 @@ -(ns syng-im.components.sign-up - (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] - [syng-im.components.react :refer [view text image touchable-highlight - toolbar-android text-input]] - [syng-im.components.spinner :refer [spinner]] - [syng-im.resources :as res] - [syng-im.navigation :as nav] - [syng-im.utils.utils :refer [log toast http-post]] - [syng-im.utils.phone-number :refer [format-phone-number]])) - -(defn show-confirm-view [navigator] - (dispatch [:set-loading false]) - (nav/nav-replace navigator {:view-id :sign-up-confirm})) - -(defn sign-up [user-phone-number user-identity navigator] - (dispatch [:set-loading true]) - (dispatch [:sign-up user-phone-number user-identity #(show-confirm-view navigator)])) - -(defn update-phone-number [value] - (let [formatted (format-phone-number value)] - (dispatch [:set-user-phone-number formatted]))) - -(defn sign-up-view [{:keys [navigator]}] - (let [loading (subscribe [:get-loading]) - user-phone-number (subscribe [:get-user-phone-number]) - user-identity (subscribe [:get-user-identity])] - (fn [] - [view {:style {:flex 1}} - [view {:style {:flex 1 - :backgroundColor "white"}} - [toolbar-android {:logo res/logo-icon - :title "Sign up" - :titleColor "#4A5258" - :style {:backgroundColor "white" - :height 56 - :elevation 2}}] - [view {} - [text-input {:underlineColorAndroid "#9CBFC0" - :placeholder "Enter your phone number" - :keyboardType "phone-pad" - :onChangeText (fn [value] - (update-phone-number value)) - :style {:flex 1 - :marginHorizontal 18 - :lineHeight 42 - :fontSize 14 - :fontFamily "Avenir-Roman" - :color "#9CBFC0"}} - @user-phone-number] - [touchable-highlight {:onPress #(sign-up @user-phone-number @user-identity navigator) - :style {:alignSelf "center" - :borderRadius 7 - :backgroundColor "#E5F5F6" - :width 100}} - [text {:style {:marginVertical 10 - :textAlign "center"}} - "Sign up"]]]] - (when (or @loading (not @user-identity)) - [spinner {:visible true}])]))) diff --git a/src/syng_im/components/sign_up_confirm.cljs b/src/syng_im/components/sign_up_confirm.cljs deleted file mode 100644 index 4bfba81cd2..0000000000 --- a/src/syng_im/components/sign_up_confirm.cljs +++ /dev/null @@ -1,86 +0,0 @@ -(ns syng-im.components.sign-up-confirm - (:require-macros - [natal-shell.core :refer [with-error-view]]) - (:require [re-frame.core :refer [subscribe dispatch dispatch-sync]] - [syng-im.components.react :refer [view text image touchable-highlight list-view - toolbar-android text-input]] - [syng-im.components.spinner :refer [spinner]] - [syng-im.resources :as res] - [syng-im.navigation :as nav] - [syng-im.utils.utils :refer [log toast http-post]])) - -(defn show-home-view [navigator] - (dispatch [:set-loading false]) - (nav/nav-replace navigator {:view-id :contact-list})) - -(defn sync-contacts [navigator] - (dispatch [:sync-contacts #(show-home-view navigator)])) - -(defn on-send-code-response [navigator body] - (log body) - (toast (if (:confirmed body) - "Confirmed" - "Wrong code")) - (if (:confirmed body) - ;; TODO user action required - (sync-contacts navigator) - (dispatch [:set-loading false]))) - -(defn code-valid? [code] - (= 4 (count code))) - -(defn send-code [code navigator] - (when (code-valid? code) - (dispatch [:set-loading true]) - (dispatch [:sign-up-confirm code (partial on-send-code-response navigator)]))) - -(defn update-code [value] - (let [formatted value] - (dispatch [:set-confirmation-code formatted]))) - -(defn sign-up-confirm-view [{:keys [navigator]}] - (let [loading (subscribe [:get-loading]) - confirmation-code (subscribe [:get-confirmation-code])] - (fn [] - [view {:style {:flex 1}} - [view {:style {:flex 1 - :backgroundColor "white"}} - [toolbar-android {:logo res/logo-icon - :title "Confirm" - :titleColor "#4A5258" - :style {:backgroundColor "white" - :height 56 - :elevation 2}}] - [view {} - [text-input {:underlineColorAndroid "#9CBFC0" - :placeholder "Enter confirmation code" - :keyboardType "number-pad" - :maxLength 4 - :onChangeText (fn [value] - (update-code value)) - :style {:flex 1 - :marginHorizontal 18 - :lineHeight 42 - :fontSize 14 - :fontFamily "Avenir-Roman" - :color "#9CBFC0"}} - @confirmation-code] - (if (code-valid? @confirmation-code) - [touchable-highlight {:onPress #(send-code @confirmation-code navigator) - :style {:alignSelf "center" - :borderRadius 7 - :backgroundColor "#E5F5F6" - - :width 100}} - [text {:style {:marginVertical 10 - :textAlign "center"}} - "Confirm"]] - [view {:style {:alignSelf "center" - :borderRadius 7 - :backgroundColor "#AAB2B2" - :width 100}} - [text {:style {:marginVertical 10 - :textAlign "center"}} - "Confirm"]])]] - (when @loading - [spinner {:visible true}])])))