Skip to content

Commit

Permalink
fixes #9205
Browse files Browse the repository at this point in the history
  • Loading branch information
tbenr authored and rasom committed Oct 28, 2019
1 parent dc7724f commit dfe259f
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 98 deletions.
30 changes: 8 additions & 22 deletions src/status_im/ui/screens/chat/message/message.cljs
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
(ns status-im.ui.screens.chat.message.message
(:require [re-frame.core :as re-frame]
[status-im.chat.commands.core :as commands]
[status-im.chat.commands.protocol :as protocol]
[status-im.chat.commands.receiving :as commands-receiving]
[status-im.constants :as constants]
[status-im.i18n :as i18n]
[status-im.ui.components.action-sheet :as action-sheet]
[status-im.ui.components.colors :as colors]
[status-im.ui.components.icons.vector-icons :as vector-icons]
[status-im.ui.components.list-selection :as list-selection]
[status-im.ui.components.popup-menu.views :as desktop.pop-up]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.message.sheets :as sheets]
[status-im.ui.screens.chat.photos :as photos]
[status-im.ui.screens.chat.styles.message.message :as style]
[status-im.ui.screens.chat.utils :as chat.utils]
[status-im.utils.contenthash :as contenthash]
[status-im.utils.platform :as platform]
[status-im.utils.config :as config])
[status-im.utils.platform :as platform])
(:require-macros [status-im.utils.views :refer [defview letsubs]]))

(defview message-content-command
Expand Down Expand Up @@ -145,25 +142,14 @@
(defn message-not-sent-text
[chat-id message-id]
[react/touchable-highlight
{:on-press (fn [] (cond
platform/ios?
(action-sheet/show
{:title (i18n/label :message-not-sent)
:options [{:label (i18n/label :resend-message)
:action #(re-frame/dispatch
[:chat.ui/resend-message chat-id message-id])}
{:label (i18n/label :delete-message)
:destructive? true
:action #(re-frame/dispatch
[:chat.ui/delete-message chat-id message-id])}]})
platform/desktop?
{:on-press (fn [] (if platform/desktop?
(desktop.pop-up/show-desktop-menu
(desktop.pop-up/get-message-menu-items chat-id message-id))

:else
(re-frame/dispatch
[:chat.ui/show-message-options {:chat-id chat-id
:message-id message-id}])))}
(do
(re-frame/dispatch [:bottom-sheet/show-sheet
{:content (sheets/options chat-id message-id)
:content-height 200}])
(react/dismiss-keyboard!))))}
[react/view style/not-sent-view
[react/text {:style style/not-sent-text}
(i18n/label (if platform/desktop?
Expand Down
38 changes: 0 additions & 38 deletions src/status_im/ui/screens/chat/message/options.cljs

This file was deleted.

26 changes: 26 additions & 0 deletions src/status_im/ui/screens/chat/message/sheets.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(ns status-im.ui.screens.chat.message.sheets
(:require [re-frame.core :as re-frame]
[status-im.ui.components.react :as react]
[status-im.ui.screens.chat.styles.message.sheets :as sheets.styles]
[status-im.ui.components.list-item.views :as list-item]))

(defn hide-sheet-and-dispatch [event]
(re-frame/dispatch [:bottom-sheet/hide-sheet])
(re-frame/dispatch event))

(defn options [chat-id message-id]
(fn []
[react/view
[react/i18n-text {:style sheets.styles/sheet-text :key :message-not-sent}]
[list-item/list-item
{:theme :action
:title :t/resend-message
:icon :main-icons/refresh
:accessibility-label :resend-message-button
:on-press #(hide-sheet-and-dispatch [:chat.ui/resend-message chat-id message-id])}]
[list-item/list-item
{:theme :action-destructive
:title :t/delete-message
:icon :main-icons/delete
:accessibility-label :delete-transaction-button
:on-press #(hide-sheet-and-dispatch [:chat.ui/delete-message chat-id message-id])}]]))
33 changes: 0 additions & 33 deletions src/status_im/ui/screens/chat/styles/message/options.cljs

This file was deleted.

8 changes: 8 additions & 0 deletions src/status_im/ui/screens/chat/styles/message/sheets.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(ns status-im.ui.screens.chat.styles.message.sheets
(:require [status-im.ui.components.colors :as colors]))

(def sheet-text
{:color colors/gray
:padding 24
:line-height 22
:font-size 15})
6 changes: 1 addition & 5 deletions src/status_im/ui/screens/chat/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
[status-im.ui.screens.chat.message.datemark :as message-datemark]
[status-im.ui.screens.chat.message.gap :as gap]
[status-im.ui.screens.chat.message.message :as message]
[status-im.ui.screens.chat.message.options :as message-options]
[status-im.ui.screens.chat.stickers.views :as stickers]
[status-im.ui.screens.chat.styles.main :as style]
[status-im.ui.screens.chat.toolbar-content :as toolbar-content]
Expand Down Expand Up @@ -398,7 +397,6 @@
(letsubs [{:keys [public? chat-id chat-name show-input? group-chat contact] :as current-chat}
[:chats/current-chat]
current-chat-id [:chats/current-chat-id]
show-message-options? [:chats/current-chat-ui-prop :show-message-options?]
show-stickers? [:chats/current-chat-ui-prop :show-stickers?]
two-pane-ui-enabled? [:two-pane-ui-enabled?]
anim-translate-y (animation/create-value
Expand Down Expand Up @@ -438,9 +436,7 @@
(when show-input?
[input/container])
(when show-stickers?
[stickers/stickers-view])
(when show-message-options?
[message-options/view])]))
[stickers/stickers-view])]))

(defview chat []
[chat-root false])
Expand Down

0 comments on commit dfe259f

Please sign in to comment.