parent
1e17930295
commit
d8ae553f89
|
@ -14,7 +14,7 @@
|
|||
[syng-im.new-group.screen :refer [new-group]]
|
||||
[syng-im.participants.views.create :refer [new-participants]]
|
||||
[syng-im.participants.views.remove :refer [remove-participants]]
|
||||
[syng-im.components.profile :refer [profile my-profile]]
|
||||
[syng-im.profile.screen :refer [profile my-profile]]
|
||||
[syng-im.utils.utils :refer [toast]]
|
||||
[syng-im.utils.encryption]))
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
[syng-im.chats-list.views.chat-list-item :refer [chat-list-item]]
|
||||
[syng-im.components.action-button :refer [action-button
|
||||
action-button-item]]
|
||||
[syng-im.components.drawer :refer [drawer-view open-drawer]]
|
||||
[syng-im.components.drawer.view :refer [drawer-view open-drawer]]
|
||||
[syng-im.components.styles :refer [color-blue]]
|
||||
[syng-im.components.toolbar :refer [toolbar]]
|
||||
[syng-im.components.icons.ionicons :refer [icon]]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
(ns syng-im.components.drawer-styles
|
||||
(ns syng-im.components.drawer.styles
|
||||
(:require [syng-im.components.styles :refer [font
|
||||
color-light-blue-transparent
|
||||
color-white
|
|
@ -1,4 +1,4 @@
|
|||
(ns syng-im.components.drawer
|
||||
(ns syng-im.components.drawer.view
|
||||
(:require [clojure.string :as s]
|
||||
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||
[reagent.core :as r]
|
||||
|
@ -11,7 +11,7 @@
|
|||
drawer-layout-android
|
||||
touchable-opacity]]
|
||||
[syng-im.resources :as res]
|
||||
[syng-im.components.drawer-styles :as st]))
|
||||
[syng-im.components.drawer.styles :as st]))
|
||||
|
||||
(defonce drawer-atom (atom))
|
||||
|
|
@ -1,109 +0,0 @@
|
|||
(ns syng-im.components.profile
|
||||
(:require [clojure.string :as s]
|
||||
[re-frame.core :refer [subscribe dispatch dispatch-sync]]
|
||||
[syng-im.components.react :refer [android?
|
||||
view
|
||||
text
|
||||
text-input
|
||||
image
|
||||
icon
|
||||
scroll-view
|
||||
touchable-highlight
|
||||
touchable-opacity]]
|
||||
[syng-im.resources :as res]
|
||||
[syng-im.components.profile-styles :as st]))
|
||||
|
||||
(defn user-photo [{:keys [photo-path]}]
|
||||
[image {:source (if (s/blank? photo-path)
|
||||
res/user-no-photo
|
||||
{:uri photo-path})
|
||||
:style st/user-photo}])
|
||||
|
||||
(defn user-online [{:keys [online]}]
|
||||
(when online
|
||||
[view st/user-online-container
|
||||
[view st/user-online-dot-left]
|
||||
[view st/user-online-dot-right]]))
|
||||
|
||||
(defn profile-property-view [{:keys [name value]}]
|
||||
[view st/profile-property-view-container
|
||||
[view st/profile-property-view-sub-container
|
||||
[text {:style st/profile-property-view-label}
|
||||
name]
|
||||
[text {:style st/profile-property-view-value}
|
||||
value]]])
|
||||
|
||||
(defn message-user [identity]
|
||||
(when identity
|
||||
(dispatch [:show-chat identity nil :push])))
|
||||
|
||||
(defn profile []
|
||||
(let [contact (subscribe [:contact])]
|
||||
(fn []
|
||||
[scroll-view {:style st/profile}
|
||||
[touchable-highlight {:style st/back-btn-touchable
|
||||
:on-press #(dispatch [:navigate-back])}
|
||||
[view st/back-btn-container
|
||||
[icon :back st/back-btn-icon]]]
|
||||
[view st/status-block
|
||||
[view st/user-photo-container
|
||||
[user-photo {}]
|
||||
[user-online {:online true}]]
|
||||
[text {:style st/user-name}
|
||||
(:name @contact)]
|
||||
[text {:style st/status}
|
||||
"!not implemented"]
|
||||
[view st/btns-container
|
||||
[touchable-highlight {:onPress #(message-user (:whisper-identity @contact))}
|
||||
[view st/message-btn
|
||||
[text {:style st/message-btn-text}
|
||||
"Message"]]]
|
||||
[touchable-highlight {:onPress (fn []
|
||||
;; TODO not implemented
|
||||
)}
|
||||
[view st/more-btn
|
||||
[icon :more_vertical_blue st/more-btn-image]]]]]
|
||||
[view st/profile-properties-container
|
||||
[profile-property-view {:name "Username"
|
||||
:value (:name @contact)}]
|
||||
[profile-property-view {:name "Phone number"
|
||||
:value (:phone-number @contact)}]
|
||||
[profile-property-view {:name "Email"
|
||||
:value "!not implemented"}]
|
||||
[view st/report-user-container
|
||||
[touchable-opacity {}
|
||||
[text {:style st/report-user-text}
|
||||
"REPORT USER"]]]]])))
|
||||
|
||||
(defn my-profile []
|
||||
(let [username (subscribe [:get :username])
|
||||
phone-number (subscribe [:get :phone-number])
|
||||
email (subscribe [:get :email])
|
||||
status (subscribe [:get :status])]
|
||||
(fn []
|
||||
[scroll-view {:style st/profile}
|
||||
[touchable-highlight {:style st/back-btn-touchable
|
||||
:on-press #(dispatch [:navigate-back])}
|
||||
[view st/back-btn-container
|
||||
[icon :back st/back-btn-icon]]]
|
||||
[touchable-highlight {:style st/actions-btn-touchable
|
||||
:on-press (fn []
|
||||
;; TODO not implemented
|
||||
)}
|
||||
[view st/actions-btn-container
|
||||
[icon :dots st/actions-btn-icon]]]
|
||||
[view st/status-block
|
||||
[view st/user-photo-container
|
||||
[user-photo {}]
|
||||
[user-online {:online true}]]
|
||||
[text {:style st/user-name}
|
||||
@username]
|
||||
[text {:style st/status}
|
||||
@status]]
|
||||
[view st/profile-properties-container
|
||||
[profile-property-view {:name "Username"
|
||||
:value @username}]
|
||||
[profile-property-view {:name "Phone number"
|
||||
:value @phone-number}]
|
||||
[profile-property-view {:name "Email"
|
||||
:value @email}]]])))
|
|
@ -28,7 +28,7 @@
|
|||
(register-sub :contact
|
||||
(fn [db _]
|
||||
(let [identity (:contact-identity @db)]
|
||||
(reaction (get-in db [:contacts identity])))))
|
||||
(reaction (get-in @db [:contacts identity])))))
|
||||
|
||||
(register-sub :all-new-contacts
|
||||
(fn [db _]
|
||||
|
|
|
@ -72,10 +72,11 @@
|
|||
clear-new-participants)))
|
||||
|
||||
(register-handler :show-profile
|
||||
(fn [db [_ identity]]
|
||||
(let [db (assoc db :contact-identity identity)]
|
||||
(dispatch [:navigate-to :profile])
|
||||
db)))
|
||||
(debug
|
||||
(fn [db [_ identity]]
|
||||
(let [db (assoc db :contact-identity identity)]
|
||||
(dispatch [:navigate-to :profile])
|
||||
db))))
|
||||
|
||||
(register-handler :show-my-profile
|
||||
(fn [db _]
|
||||
|
|
|
@ -0,0 +1,98 @@
|
|||
(ns syng-im.profile.screen
|
||||
(:require-macros [syng-im.utils.views :refer [defview]])
|
||||
(:require [clojure.string :as s]
|
||||
[re-frame.core :refer [subscribe dispatch]]
|
||||
[syng-im.components.react :refer [view
|
||||
text
|
||||
image
|
||||
icon
|
||||
scroll-view
|
||||
touchable-highlight
|
||||
touchable-opacity]]
|
||||
[syng-im.resources :as res]
|
||||
[syng-im.profile.styles :as st]))
|
||||
|
||||
(defn user-photo [{:keys [photo-path]}]
|
||||
[image {:source (if (s/blank? photo-path)
|
||||
res/user-no-photo
|
||||
{:uri photo-path})
|
||||
:style st/user-photo}])
|
||||
|
||||
(defn user-online [{:keys [online]}]
|
||||
(when online
|
||||
[view st/user-online-container
|
||||
[view st/user-online-dot-left]
|
||||
[view st/user-online-dot-right]]))
|
||||
|
||||
(defn profile-property-view [{:keys [name value]}]
|
||||
[view st/profile-property-view-container
|
||||
[view st/profile-property-view-sub-container
|
||||
[text {:style st/profile-property-view-label} name]
|
||||
[text {:style st/profile-property-view-value} value]]])
|
||||
|
||||
(defn message-user [identity]
|
||||
(when identity
|
||||
(dispatch [:show-chat identity :push])))
|
||||
|
||||
(defview profile []
|
||||
[{:keys [name whisper-identity phone-number]} [:contact]]
|
||||
[scroll-view {:style st/profile}
|
||||
[touchable-highlight {:style st/back-btn-touchable
|
||||
:on-press #(dispatch [:navigate-back])}
|
||||
[view st/back-btn-container
|
||||
[icon :back st/back-btn-icon]]]
|
||||
[view st/status-block
|
||||
[view st/user-photo-container
|
||||
[user-photo {}]
|
||||
[user-online {:online true}]]
|
||||
[text {:style st/user-name} name]
|
||||
[text {:style st/status} "!not implemented"]
|
||||
[view st/btns-container
|
||||
[touchable-highlight {:onPress #(message-user whisper-identity)}
|
||||
[view st/message-btn
|
||||
[text {:style st/message-btn-text} "Message"]]]
|
||||
[touchable-highlight {:onPress (fn []
|
||||
;; TODO not implemented
|
||||
)}
|
||||
[view st/more-btn
|
||||
[icon :more_vertical_blue st/more-btn-image]]]]]
|
||||
[view st/profile-properties-container
|
||||
[profile-property-view {:name "Username"
|
||||
:value name}]
|
||||
[profile-property-view {:name "Phone number"
|
||||
:value phone-number}]
|
||||
[profile-property-view {:name "Email"
|
||||
:value "!not implemented"}]
|
||||
[view st/report-user-container
|
||||
[touchable-opacity {}
|
||||
[text {:style st/report-user-text} "REPORT USER"]]]]])
|
||||
|
||||
(defview my-profile []
|
||||
[username [:get :username]
|
||||
phone-number [:get :phone-number]
|
||||
email [:get :email]
|
||||
status [:get :status]]
|
||||
[scroll-view {:style st/profile}
|
||||
[touchable-highlight {:style st/back-btn-touchable
|
||||
:on-press #(dispatch [:navigate-back])}
|
||||
[view st/back-btn-container
|
||||
[icon :back st/back-btn-icon]]]
|
||||
[touchable-highlight {:style st/actions-btn-touchable
|
||||
:on-press (fn []
|
||||
;; TODO not implemented
|
||||
)}
|
||||
[view st/actions-btn-container
|
||||
[icon :dots st/actions-btn-icon]]]
|
||||
[view st/status-block
|
||||
[view st/user-photo-container
|
||||
[user-photo {}]
|
||||
[user-online {:online true}]]
|
||||
[text {:style st/user-name} username]
|
||||
[text {:style st/status} status]]
|
||||
[view st/profile-properties-container
|
||||
[profile-property-view {:name "Username"
|
||||
:value username}]
|
||||
[profile-property-view {:name "Phone number"
|
||||
:value phone-number}]
|
||||
[profile-property-view {:name "Email"
|
||||
:value email}]]])
|
|
@ -1,4 +1,4 @@
|
|||
(ns syng-im.components.profile-styles
|
||||
(ns syng-im.profile.styles
|
||||
(:require [syng-im.components.styles :refer [font
|
||||
color-light-blue-transparent
|
||||
color-white
|
Loading…
Reference in New Issue