diff --git a/VERSION b/VERSION index 84cc529467..744068368f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.18.0 +1.18.0 \ No newline at end of file diff --git a/src/status_im/chat/models/message.cljs b/src/status_im/chat/models/message.cljs index 1d3d8953d9..02f61cdcae 100644 --- a/src/status_im/chat/models/message.cljs +++ b/src/status_im/chat/models/message.cljs @@ -6,6 +6,7 @@ [status-im.data-store.messages :as data-store.messages] [status-im.ethereum.json-rpc :as json-rpc] [status-im.transport.message.protocol :as protocol] + [status-im.navigation :as navigation] [status-im.utils.fx :as fx] [taoensso.timbre :as log] [status-im.chat.models.mentions :as mentions] @@ -181,6 +182,14 @@ :on-error #(log/error "failed to re-send message" %)}]} (update-message-status chat-id message-id :sending))) +(fx/defn share-to-contacts-pressed + {:events [::share-to-contacts-pressed]} + [{:keys [db] :as cofx} + {:keys [message-id] :as message}] + (fx/merge cofx + (navigation/open-modal + :share-to-contacts {:message-id message-id}))) + (fx/defn delete-message "Deletes chat message, rebuild message-list" {:events [:chat.ui/delete-message]} diff --git a/src/status_im/ethereum/json_rpc.cljs b/src/status_im/ethereum/json_rpc.cljs index 31a0fb37a4..932fc52809 100644 --- a/src/status_im/ethereum/json_rpc.cljs +++ b/src/status_im/ethereum/json_rpc.cljs @@ -75,6 +75,7 @@ "wakuext_createGroupChatWithMembers" {} "wakuext_createGroupChatFromInvitation" {} "wakuext_reSendChatMessage" {} + "wakuext_shareImageMessage" {} "wakuext_getOurInstallations" {} "wakuext_setInstallationMetadata" {} "wakuext_loadFilters" {} diff --git a/src/status_im/transport/message/protocol.cljs b/src/status_im/transport/message/protocol.cljs index 108d502e85..6a1ed3476f 100644 --- a/src/status_im/transport/message/protocol.cljs +++ b/src/status_im/transport/message/protocol.cljs @@ -26,6 +26,22 @@ :sticker sticker :contentType content-type}) +(fx/defn share-image-to-contacts-pressed + {:events [::share-image-to-contacts-pressed]} + [cofx user-pk contacts message-id] + (let [pks (if (seq user-pk) + (conj contacts user-pk) + contacts)] + (when (seq pks) + {::json-rpc/call [{:method "wakuext_shareImageMessage" + :params [{:users pks + :id message-id}] + :js-response true + :on-success #(re-frame/dispatch [:navigate-back]) + :on-error #(do + (log/error "failed to share image message" %) + (re-frame/dispatch [::failed-to-share-image %]))}]}))) + (fx/defn send-chat-messages [_ messages] {::json-rpc/call [{:method (json-rpc/call-ext-method "sendChatMessages") :params [(mapv build-message messages)] diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index 3eacb0aa72..f7a2ee3f8a 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -24,6 +24,8 @@ [status-im.ui.screens.chat.components.reply :as components.reply] [status-im.ui.screens.chat.message.link-preview :as link-preview] [status-im.ui.screens.communities.icon :as communities.icon] + [status-im.chat.models.message :as message] + [status-im.utils.handlers :refer [>evt]] [status-im.ui.components.animation :as animation] [status-im.chat.models.pin-message :as models.pin-message]) (:require-macros [status-im.utils.views :refer [defview letsubs]])) @@ -583,6 +585,9 @@ [{:on-press #(re-frame/dispatch [:chat.ui/reply-to-message message]) :id :reply :label (i18n/label :t/message-reply)} + {:on-press #(>evt [::message/share-to-contacts-pressed message]) + :id :share + :label (i18n/label :t/share)} {:on-press #(re-frame/dispatch [:chat.ui/save-image-to-gallery (:image content)]) :id :save :label (i18n/label :t/save)}]))}] diff --git a/src/status_im/ui/screens/chat/share.cljs b/src/status_im/ui/screens/chat/share.cljs new file mode 100644 index 0000000000..82133ce9d2 --- /dev/null +++ b/src/status_im/ui/screens/chat/share.cljs @@ -0,0 +1,55 @@ +(ns status-im.ui.screens.chat.share + (:require [reagent.core :as reagent] + [quo.react-native :as rn] + [quo.core :as quo] + [status-im.i18n.i18n :as i18n] + [status-im.ui.components.toolbar :as toolbar] + [status-im.utils.handlers :refer [evt-once]] + [status-im.transport.message.protocol :as protocol] + [status-im.ui.components.topbar :as topbar] + [status-im.ui.components.chat-icon.screen :as chat-icon.screen] + [status-im.multiaccounts.core :as multiaccounts] + [clojure.string :as str])) + +(defn contacts-list-item [{:keys [public-key active] :as contact} _ _ {:keys [selected]}] + (let [[first-name second-name] (multiaccounts/contact-two-names contact true)] + [quo/list-item + {:title first-name + :subtitle second-name + :icon [chat-icon.screen/contact-icon-contacts-tab + (multiaccounts/displayed-photo contact)] + :accessory :checkbox + :active active + :on-press (fn [] + (if active + (swap! selected disj public-key) + (swap! selected conj public-key)))}])) + +(defn share [] + (let [user-pk (reagent/atom "") + contacts-selected (reagent/atom #{}) + {:keys [message-id]} ( + [topbar/topbar {:modal? true}] + [rn/flat-list {:style {:flex 1} + :content-container-style {:padding-vertical 16} + :render-data {:selected contacts-selected} + :render-fn contacts-list-item + :key-fn (fn [{:keys [active public-key]}] + (str public-key active)) + :data contacts}] + [toolbar/toolbar + {:show-border? true + :center + [quo/button {:disabled (and (str/blank? @user-pk) + (zero? (count selected))) + :type :secondary + :on-press #(>evt-once [::protocol/share-image-to-contacts-pressed + @user-pk selected message-id])} + (i18n/label :t/share)]}]])))) diff --git a/src/status_im/ui/screens/screens.cljs b/src/status_im/ui/screens/screens.cljs index 2a5cc6cf4e..6786785d93 100644 --- a/src/status_im/ui/screens/screens.cljs +++ b/src/status_im/ui/screens/screens.cljs @@ -23,6 +23,7 @@ [status-im.ui.screens.bug-report :as bug-report] [status-im.ui.screens.chat.pinned-messages :as pin-messages] [status-im.ui.screens.chat.views :as chat] + [status-im.ui.screens.chat.share :as chat.share] [status-im.ui.screens.communities.channel-details :as communities.channel-details] [status-im.ui.screens.communities.community :as community] [status-im.ui.screens.communities.community-emoji-thumbnail-picker :as community-emoji-thumbnail-picker] @@ -611,6 +612,13 @@ :options {:topBar {:title {:text (i18n/label :t/new-public-group-chat)}}} :component new-public-chat/new-public-chat} + ;[Chat] Share Images message + {:name :share-to-contacts + :options {:topBar {:visible false + :title (i18n/label :t/community-share-title)}} + :component chat.share/share + :insets {:bottom true}} + ;[Chat] Link preview settings {:name :link-preview-settings :options {:topBar {:title {:text (i18n/label :t/chat-link-previews)}}} diff --git a/status-go-version.json b/status-go-version.json index 0670952132..c4a8495205 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -3,7 +3,7 @@ "_comment": "Instead use: scripts/update-status-go.sh ", "owner": "status-im", "repo": "status-go", - "version": "v0.94.7", - "commit-sha1": "b559c561d80a3b8b131b81d82e2bfda3ae387824", - "src-sha256": "0ak0zb3bq3jwlrvqcvf8fycdxvgls61qi2bmp8xi81952andk27w" + "version": "v0.94.8", + "commit-sha1": "7d956bef9436e89f39e7ce500b3ea1251426af8e", + "src-sha256": "0zggxvbgv5zpinb1833wy9imxc409hy9q8s18f4m111649fs4ml6" }