Skip to content

Commit

Permalink
[Fixes #7325] Add EIP681 deeplink support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeluard committed Apr 30, 2019
1 parent c4f7193 commit 917fd6e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="status-im" />
<data android:scheme="ethereum" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity"/>
Expand Down
4 changes: 2 additions & 2 deletions src/status_im/ui/screens/wallet/choose_recipient/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
new-amount (:value details)
new-gas (:gas details)
symbol-changed? (and old-symbol new-symbol (not= old-symbol new-symbol))]
(cond-> {:db db
:dispatch [:navigate-back]}
(cond-> {:db db}
(not= :deep-link origin) (assoc :dispatch [:navigate-back]) ;; Only navigate-back when called from within wallet
(and address valid-network?) (update :db #(fill-request-details % details false))
symbol-changed? (changed-asset old-symbol new-symbol)
(and old-amount new-amount (not= old-amount new-amount)) (changed-amount-warning old-amount new-amount)
Expand Down
8 changes: 8 additions & 0 deletions src/status_im/utils/universal_links/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[status-im.ui.screens.navigation :as navigation]
[status-im.utils.config :as config]
[status-im.utils.fx :as fx]
[status-im.utils.ethereum.eip681 :as eip681]
[taoensso.timbre :as log]
[status-im.utils.platform :as platform]
[status-im.constants :as constants]))
Expand Down Expand Up @@ -79,6 +80,10 @@
(log/info "universal-links: handling url profile" url)
(extensions.registry/load cofx url false))

(fx/defn handle-eip681 [cofx url]
{:dispatch-n [[:navigate-to :wallet-send-transaction]
[:wallet/fill-request-from-url url :deep-link]]})

(defn handle-not-found [full-url]
(log/info "universal-links: no handler for " full-url))

Expand All @@ -105,6 +110,9 @@
(and config/extensions-enabled? (match-url url extension-regex))
(handle-extension cofx url)

(some? (eip681/parse-uri url))
(handle-eip681 cofx url)

:else (handle-not-found url)))

(fx/defn store-url-for-later
Expand Down

0 comments on commit 917fd6e

Please sign in to comment.