Skip to content

Commit

Permalink
[FIX #2118] ui: store search-key under [:toolbar-search :show]
Browse files Browse the repository at this point in the history
Chat list used to store booleans under [:toolbar-search :show] which is
different from other views and caused the issue described in #2118.
  • Loading branch information
Vitaliy Vlasov authored and rasom committed Dec 22, 2017
1 parent 43c2f09 commit 907d3c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/status_im/ui/screens/chats_list/subs.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
(reg-sub :filtered-chats
:<- [:get :chats]
:<- [:get-in [:toolbar-search :text]]
(fn [[chats search-text]]
(let [unordered-chats (if search-text
:<- [:get-in [:toolbar-search :show]]
(fn [[chats search-text show-search]]
(let [unordered-chats (if (and (= show-search :chat-list) search-text)
(filter #(search-filter search-text (second %))
chats)
chats)]
Expand Down
14 changes: 7 additions & 7 deletions src/status_im/ui/screens/chats_list/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
[{:text (i18n/label :t/edit) :value #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] true])}])

(defn android-toolbar-actions []
[(act/search #(re-frame/dispatch [:set-in [:toolbar-search :show] true]))
[(act/search #(re-frame/dispatch [:set-in [:toolbar-search :show] :chat-list]))
(act/opts android-toolbar-popup-options)])

(def ios-toolbar-popup-options
[{:text (i18n/label :t/edit-chats) :value #(re-frame/dispatch [:set-in [:chat-list-ui-props :edit?] true])}
{:text (i18n/label :t/search-chats) :value #(re-frame/dispatch [:set-in [:toolbar-search :show] true])}])
{:text (i18n/label :t/search-chats) :value #(re-frame/dispatch [:set-in [:toolbar-search :show] :chat-list])}])

(defn ios-toolbar-actions []
[(act/opts ios-toolbar-popup-options)
Expand Down Expand Up @@ -77,13 +77,13 @@
(defview chats-list []
(letsubs [chats [:filtered-chats]
edit? [:get-in [:chat-list-ui-props :edit?]]
search? [:get-in [:toolbar-search :show]]
show-search [:get-in [:toolbar-search :show]]
tabs-hidden? [:tabs-hidden?]]
[react/view st/chats-container
(cond
edit? [toolbar-edit]
search? [toolbar-search]
:else [toolbar-view])
edit? [toolbar-edit]
(= show-search :chat-list) [toolbar-search]
:else [toolbar-view])
[react/list-view {:dataSource (to-datasource chats)
:renderRow (fn [[id :as row] _ _]
(react/list-item ^{:key id} [chat-list-item row edit?]))
Expand All @@ -95,7 +95,7 @@
:renderSeparator renderers/list-separator-renderer
:style st/list-container}]
(when (and (not edit?)
(not search?)
(not= show-search :chat-list)
(get-in platform-specific [:chats :action-button?]))
[chats-action-button])
[offline-view]]))

0 comments on commit 907d3c7

Please sign in to comment.