Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX #2118] ui: store search-key under [:toolbar-search :show] #2585

Merged
merged 1 commit into from
Dec 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use of undeclared Var status-im.ui.screens.chats-list.views/search? at line 98 /Users/jenkins/workspace/status-react/parametrized build/src/status_im/ui/screens/chats_list/views.cljs

search? symbol is used later in this function

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]]))