-
Notifications
You must be signed in to change notification settings - Fork 985
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into milad/18543-add-token-options-to-watch-on…
…ly-accounts
- Loading branch information
Showing
7 changed files
with
110 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
(ns status-im.common.shared-urls.data-store | ||
(:require | ||
[clojure.set :as set])) | ||
|
||
(defn <-rpc | ||
[{:keys [community channel contact]}] | ||
{:community (set/rename-keys | ||
community | ||
{:communityId :community-id | ||
:displayName :display-name | ||
:membersCount :members-count | ||
:tagIndices :tag-indices}) | ||
:channel (set/rename-keys | ||
channel | ||
{:displayName :display-name | ||
:channelUuid :channel-uuid}) | ||
:contact (set/rename-keys | ||
contact | ||
{:displayName :display-name | ||
:publicKey :public-key})}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
(ns status-im.common.shared-urls.events | ||
(:require | ||
[clojure.string :as string] | ||
[re-frame.core :as re-frame] | ||
[status-im.common.shared-urls.data-store :as data-store] | ||
[taoensso.timbre :as log] | ||
[utils.re-frame :as rf])) | ||
|
||
(defn parse-shared-url-success | ||
[url response] | ||
(let [parsed-data (data-store/<-rpc response) | ||
cb #(rf/dispatch [:universal-links/match-value url %])] | ||
(cond | ||
(:channel parsed-data) | ||
(cb {:type :community-chat | ||
:chat-id (str (get-in parsed-data [:community :community-id]) | ||
(get-in parsed-data [:channel :channel-uuid])) | ||
:community-id (get-in parsed-data [:community :community-id])}) | ||
|
||
(:community parsed-data) | ||
(cb {:type :community :community-id (get-in parsed-data [:community :community-id])})))) | ||
|
||
(defn parse-shared-url | ||
[_ [uri]] | ||
(let [url (string/replace uri #"status-app:/" "https://status.app")] | ||
{:json-rpc/call | ||
[{:method "wakuext_parseSharedURL" | ||
:params [url] | ||
:on-success #(parse-shared-url-success url %) | ||
:on-error (fn [err] | ||
(log/error "failed to parse shared url" {:error err :url url}))}]})) | ||
|
||
(re-frame/reg-event-fx :shared-urls/parse-shared-url parse-shared-url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters