diff --git a/src/status_im/chat/models.cljs b/src/status_im/chat/models.cljs index 8f1d2dfd13..9599a5fdce 100644 --- a/src/status_im/chat/models.cljs +++ b/src/status_im/chat/models.cljs @@ -20,7 +20,7 @@ [status-im.chat.models.message-seen :as message-seen] [status-im.chat.models.loading :as loading] [status-im.utils.image-processing :as image-processing] - [status-im.ipfs.core :as ipfs])) + [taoensso.timbre :as log])) (defn- get-chat [cofx chat-id] (get-in cofx [:db :chats chat-id])) @@ -322,20 +322,10 @@ 400 400 (fn [resized-image] (re-frame/dispatch [:chat.ui/set-chat-ui-props {:send-image (aget resized-image "path")}])) - #())) - "any"))) + #(log/error "could not resize image" %))) + "photo"))) (fx/defn chat-open-image-picker {:events [:chat.ui/open-image-picker]} [cofx] {:chat-open-image-picker nil}) - -(fx/defn send-image - {:events [:chat.ui/send-image]} - [{:keys [db] :as cofx} send-image] - (fx/merge cofx - {:db (set-chat-ui-props db {:send-image-loading? true})} - (ipfs/add {:value #js {:uri send-image :name "image"} - :opts {:headers {"Content-Type" "multipart/form-data"}} - :on-failure #(re-frame/dispatch [:chat.ui/set-chat-ui-props {:send-image-loading? false}]) - :on-success #(re-frame/dispatch [:chat-image-added-to-ipfs %])}))) \ No newline at end of file diff --git a/src/status_im/chat/models/input.cljs b/src/status_im/chat/models/input.cljs index 876261cb61..47ce0a1ff7 100644 --- a/src/status_im/chat/models/input.cljs +++ b/src/status_im/chat/models/input.cljs @@ -112,6 +112,18 @@ (chat-input-clear :input-ref) (process-cooldown))))) +(fx/defn send-image + {:events [:chat.ui/send-image]} + [{{:keys [current-chat-id] :as db} :db :as cofx} send-image] + (println "SENDING" send-image) + (fx/merge cofx + {:db (chat/set-chat-ui-props db {:send-image-loading? true})} + (when-not (string/blank? send-image) + (chat.message/send-message {:chat-id current-chat-id + :content-type constants/content-type-image + :image-path send-image + :text "Update to latest version to see a nice image here!"})))) + (fx/defn send-sticker-fx [{:keys [db] :as cofx} {:keys [hash pack]} current-chat-id] (when-not (string/blank? hash) @@ -121,14 +133,6 @@ :pack pack} :text "Update to latest version to see a nice sticker here!"}))) -(fx/defn send-image - [{:keys [db] :as cofx} hash] - (when-not (string/blank? hash) - (chat.message/send-message cofx {:chat-id (:current-chat-id db) - :content-type constants/content-type-image - :content {:chat-id (:current-chat-id db) - :hash hash}}))) - (fx/defn send-current-message "Sends message from current chat input" [{{:keys [current-chat-id] :as db} :db :as cofx}] @@ -141,13 +145,6 @@ ;;TODO: should be implemented on status-go side ;;see https://github.com/status-im/team-core/blob/6c3d67d8e8bd8500abe52dab06a59e976ec942d2/rfc-001.md#status-gostatus-react-interface -(fx/defn chat-image-added-to-ipfs - {:events [:chat-image-added-to-ipfs]} - [{:keys [db] :as cofx} {:keys [hash]}] - (fx/merge cofx - {:db (chat/set-chat-ui-props db {:send-image-loading? false :show-image? nil :send-image nil})} - (send-image hash))) - ;; effects (re-frame/reg-fx diff --git a/src/status_im/data_store/messages.cljs b/src/status_im/data_store/messages.cljs index c2a9cf933a..c4a9ba5f41 100644 --- a/src/status_im/data_store/messages.cljs +++ b/src/status_im/data_store/messages.cljs @@ -31,6 +31,7 @@ :commandState :command-state}) (assoc :content {:chat-id (:chatId message) :text (:text message) + :image (:image message) :sticker (:sticker message) :ens-name (:ensName message) :line-count (:lineCount message) @@ -38,7 +39,7 @@ :rtl? (:rtl message) :response-to (:responseTo message)} :outgoing (boolean (:outgoingStatus message))) - (dissoc :ensName :chatId :text :rtl :responseTo :sticker :lineCount :parsedText))) + (dissoc :ensName :chatId :text :rtl :responseTo :image :sticker :lineCount :parsedText))) (defn update-outgoing-status-rpc [waku-enabled? message-id status] {::json-rpc/call [{:method (json-rpc/call-ext-method waku-enabled? "updateMessageOutgoingStatus") diff --git a/src/status_im/node/core.cljs b/src/status_im/node/core.cljs index 4c99a86ab2..33aec365ea 100644 --- a/src/status_im/node/core.cljs +++ b/src/status_im/node/core.cljs @@ -123,7 +123,7 @@ {:Enabled true :BloomFilterMode waku-bloom-filter-mode :LightClient true - :MinimumPoW 0.001} + :MinimumPoW 0.000001} :ShhextConfig {:BackupDisabledDataDir (utils.platform/no-backup-directory) :InstallationID installation-id diff --git a/src/status_im/transport/db.cljs b/src/status_im/transport/db.cljs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/status_im/transport/message/protocol.cljs b/src/status_im/transport/message/protocol.cljs index 3d0afc7774..eb5a5c6977 100644 --- a/src/status_im/transport/message/protocol.cljs +++ b/src/status_im/transport/message/protocol.cljs @@ -9,6 +9,7 @@ text response-to ens-name + image-path message-type sticker content-type] @@ -20,6 +21,7 @@ :text text :responseTo response-to :ensName ens-name + :imagePath image-path :sticker sticker :contentType content-type}] :on-success diff --git a/src/status_im/ui/screens/chat/message/message.cljs b/src/status_im/ui/screens/chat/message/message.cljs index c593b3c7ee..8e67d08dd0 100644 --- a/src/status_im/ui/screens/chat/message/message.cljs +++ b/src/status_im/ui/screens/chat/message/message.cljs @@ -297,5 +297,5 @@ :source {:uri (contenthash/url (-> content :sticker :hash))}}] (if (= content-type constants/content-type-image) [react/image {:style {:margin-vertical 10 :width 140 :height 140 :border-radius 8} - :source {:uri (str "https://ipfs.infura.io/ipfs/" (:hash content))}}] + :source {:uri (:image content)}}] [unknown-content-type message])))))]]))) diff --git a/src/status_im/ui/screens/events.cljs b/src/status_im/ui/screens/events.cljs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/src/status_im/utils/config.cljs b/src/status_im/utils/config.cljs index 241dd9e4fb..f8f23b3a95 100644 --- a/src/status_im/utils/config.cljs +++ b/src/status_im/utils/config.cljs @@ -51,6 +51,6 @@ string/upper-case)) (def fleet (get-config :FLEET "eth.staging")) (def default-network (get-config :DEFAULT_NETWORK)) -(def pow-target (js/parseFloat (get-config :POW_TARGET "0.002"))) +(def pow-target (js/parseFloat (get-config :POW_TARGET "0.0001"))) (def pow-time (js/parseInt (get-config :POW_TIME "1"))) (def max-installations 2) diff --git a/status-go-version.json b/status-go-version.json index fae3d11842..69a913969e 100644 --- a/status-go-version.json +++ b/status-go-version.json @@ -2,7 +2,7 @@ "_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh ' instead", "owner": "status-im", "repo": "status-go", - "version": "v0.53.2", - "commit-sha1": "ee0a83fdc4a19f70fa8d08347ef67c0ca3d67f1e", - "src-sha256": "1jv7cw6a41czhslmqxbqjw2alv9yb0ddpbxyin2l0kdpnxvph965" + "version": "feature/content-type-images", + "commit-sha1": "514923e84df1426a85cac1f2470f064820ab6d4b", + "src-sha256": "03k55hn20ijr98j80p20j38i2lpl6f3dib70b3d83zjcz00wpgqh" }