Skip to content

Commit

Permalink
https://github.com/status-im/status-go/compare/640793fe85d9a9eef9eb37…
Browse files Browse the repository at this point in the history
…12cda1c5a1ceea401a...0048aaebcc7859a6f0dd7cdf0266fe029f3066fcn

[#13173] move stickers business logic to status-go

Signed-off-by: andrey <motor4ik@gmail.com>
  • Loading branch information
flexsurfer committed May 9, 2022
1 parent d765dd1 commit 54c3030
Show file tree
Hide file tree
Showing 24 changed files with 208 additions and 411 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ COLLECTIBLES_ENABLED=1
COMMANDS_ENABLED=1
TWO_MINUTES_SYNCING=1
SWAP_ENABLED=1
STICKERS_TEST_ENABLED=1
1 change: 1 addition & 0 deletions .env.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ COMMUNITIES_MANAGEMENT_ENABLED=1
METRICS_ENABLED=0
DELETE_MESSAGE_ENABLED=1
TWO_MINUTES_SYNCING=1
STICKERS_TEST_ENABLED=1
1 change: 1 addition & 0 deletions .env.jenkins
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ METRICS_ENABLED=0
DELETE_MESSAGE_ENABLED=1
TWO_MINUTES_SYNCING=1
ENABLE_QUO_PREVIEW=1
STICKERS_TEST_ENABLED=1
15 changes: 0 additions & 15 deletions src/status_im/browser/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
[status-im.native-module.core :as status]
[status-im.ui.components.list-selection :as list-selection]
[status-im.navigation :as navigation]
[status-im.utils.contenthash :as contenthash]
[status-im.utils.fx :as fx]
[status-im.utils.http :as http]
[status-im.utils.platform :as platform]
Expand Down Expand Up @@ -182,20 +181,6 @@
:history new-history
:history-index new-index))))))

(defmulti storage-gateway :namespace)

(defmethod storage-gateway :ipns
[{:keys [hash]}]
(str "https://" hash))

(defmethod storage-gateway :ipfs
[{:keys [hash]}]
(contenthash/ipfs-url hash))

(defmethod storage-gateway :swarm
[{:keys [hash]}]
(str "https://gateway.ethswarm.org/bzz/" hash))

(fx/defn resolve-ens-multihash-success
{:events [:browser.callback/resolve-ens-multihash-success]}
[{:keys [db] :as cofx} url]
Expand Down
22 changes: 12 additions & 10 deletions src/status_im/chat/models/input.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
[status-im.utils.fx :as fx]
["emojilib" :as emojis]
[status-im.chat.models.mentions :as mentions]
[status-im.utils.utils :as utils]
[status-im.multiaccounts.update.core :as multiaccounts.update]))
[status-im.utils.utils :as utils]))

(defn text->emoji
"Replaces emojis in a specified `text`"
Expand Down Expand Up @@ -230,12 +229,12 @@
:text (i18n/label :t/update-to-listen-audio {"locale" "en"})})))

(fx/defn send-sticker-message
[cofx {:keys [hash pack]} current-chat-id]
(when-not (string/blank? hash)
[cofx {:keys [hash packID]} current-chat-id]
(when-not (or (string/blank? hash) (string/blank? packID))
(chat.message/send-message cofx {:chat-id current-chat-id
:content-type constants/content-type-sticker
:sticker {:hash hash
:pack pack}
:pack (int packID)}
:text (i18n/label :t/update-to-see-sticker {"locale" "en"})})))

(fx/defn send-edited-message [{:keys [db] :as cofx} text {:keys [message-id]}]
Expand Down Expand Up @@ -265,13 +264,16 @@

(fx/defn chat-send-sticker
{:events [:chat/send-sticker]}
[{{:keys [current-chat-id multiaccount]} :db :as cofx} {:keys [hash] :as sticker}]
[{{:keys [current-chat-id] :as db} :db :as cofx} {:keys [hash packID] :as sticker}]
(fx/merge
cofx
(multiaccounts.update/multiaccount-update
:stickers/recent-stickers
(conj (remove #(= hash %) (:stickers/recent-stickers multiaccount)) hash)
{})
{:db (update db
:stickers/recent-stickers
(fn [recent]
(conj (remove #(= hash (:hash %)) recent) sticker)))
::json-rpc/call [{:method "stickers_addRecent"
:params [(int packID) hash]
:on-success #()}]}
(send-sticker-message sticker current-chat-id)))

(fx/defn chat-send-audio
Expand Down
6 changes: 5 additions & 1 deletion src/status_im/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,8 @@
(def ^:const visibility-status-inactive 4)

(def ^:const wallet-connect-version-1 1)
(def ^:const wallet-connect-version-2 2)
(def ^:const wallet-connect-version-2 2)

(def ^:const sticker-pack-status-installed 1)
(def ^:const sticker-pack-status-pending 2)
(def ^:const sticker-pack-status-owned 3)
2 changes: 0 additions & 2 deletions src/status_im/data_store/settings.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
config/default-network))
(update :wallet/visible-tokens rpc->visible-tokens)
(update :pinned-mailservers rpc->pinned-mailservers)
(update :stickers/packs-installed rpc->stickers-packs)
(update :stickers/packs-pending set)
(update :link-previews-enabled-sites set)
(update :custom-bootnodes rpc->custom-bootnodes)
(update :custom-bootnodes-enabled? rpc->custom-bootnodes)
Expand Down
1 change: 0 additions & 1 deletion src/status_im/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
:dimensions/window (dimensions/window)
:registry {}
:visibility-status-updates {}
:stickers/packs-owned #{}
:stickers/packs-pending #{}
:keycard {:nfc-enabled? false
:pin {:original []
Expand Down
11 changes: 10 additions & 1 deletion src/status_im/ethereum/json_rpc.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,16 @@
"mailservers_getChatRequestRanges" {}
"mailservers_deleteChatRequestRange" {}
"appmetrics_saveAppMetrics" {}
"appmetrics_getAppMetrics" {}})
"appmetrics_getAppMetrics" {}
"stickers_market" {}
"stickers_installed" {}
"stickers_install" {}
"stickers_addRecent" {}
"stickers_recent" {}
"stickers_buyPrepareTx" {}
"stickers_processPending" {}
"stickers_addPending" {}
"stickers_pending" {}})

(defn on-error-retry
[call-method {:keys [method number-of-retries delay on-error] :as arg}]
Expand Down
2 changes: 0 additions & 2 deletions src/status_im/multiaccounts/login/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
[status-im.popover.core :as popover]
[status-im.communities.core :as communities]
[status-im.transport.core :as transport]
[status-im.stickers.core :as stickers]
[status-im.mobile-sync-settings.core :as mobile-network]
[status-im.utils.fx :as fx]
[status-im.utils.keychain.core :as keychain]
Expand Down Expand Up @@ -445,7 +444,6 @@
(initialize-transactions-management-enabled)
(check-network-version network-id)
(contact/initialize-contacts)
(stickers/init-stickers-packs)
(initialize-browser)
(mobile-network/on-network-status-change)
(get-group-chat-invitations)
Expand Down
Loading

0 comments on commit 54c3030

Please sign in to comment.