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 May 3, 2019
1 parent e6bd5c5 commit 483bed0
Show file tree
Hide file tree
Showing 8 changed files with 104 additions and 81 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
14 changes: 7 additions & 7 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ SPEC CHECKSUMS:
GoogleUtilities: 06b66f9567769a7958db20a92f0128b2843e49d5
nanopb: 5601e6bca2dbf1ed831b519092ec110f66982ca3
Protobuf: 1eb9700044745f00181c136ef21b8ff3ad5a0fd5
React: b52fdb80565505b7e4592b313a38868f5df51641
react-native-background-timer: f7bc6cb474ca47d81f3be8a1b4c986ac7ee136b3
react-native-camera: 70db6904b34e02054a25deb84dde9196e94caaee
react-native-webview: 763be2e9f8b103d195170fafc2fd77805d5434b5
RNKeychain: 216f37338fcb9e5c3a2530f1e3295f737a690cb1
React: 1d605e098d69bdf08960787f3446f0a9dc2e2ccf
react-native-background-timer: bb7a98c8e97fc7c290de2d423dd09ddb73dcbcbb
react-native-camera: 68ad5143d2d0636236d46c7de8d2a6455ca52a36
react-native-webview: a42108b827082f8f0333529b0772102031d5960d
RNKeychain: 627c6095cef215dd3d9804a9a9cf45ab96aa3997
SQLCipher: f9fcf29b2e59ced7defc2a2bdd0ebe79b40d4990
yoga: 1a492113f66a35e9e583bb0434f4b8cc668dd839
yoga: 128daf064cacaede0c3bb27424b6b4c71052e6cd

PODFILE CHECKSUM: 2e0971124458d413e18b407b2337bf2c1d32f357

COCOAPODS: 1.6.1
COCOAPODS: 1.5.3
67 changes: 34 additions & 33 deletions ios/StatusIm.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

86 changes: 48 additions & 38 deletions ios/StatusIm/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,8 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>im.status.ethereum.applink</string>
<key>CFBundleURLSchemes</key>
<array>
<string>status-im</string>
</array>
</dict>
</array>
<key>CFBundleBuildUrl</key>
<string>????</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
Expand All @@ -31,10 +22,33 @@
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleBuildUrl</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>im.status.ethereum.applink</string>
<key>CFBundleURLSchemes</key>
<array>
<string>status-im</string>
</array>
</dict>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>im.status.ethereum.eip681</string>
<key>CFBundleURLSchemes</key>
<array>
<string>ethereum</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>ITSAppUsesNonExemptEncryption</key>
<true/>
<key>ITSEncryptionExportComplianceCode</key>
<string>1aa92c4d-6194-4d7d-b70a-16b48256b87e</string>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>whatsapp</string>
Expand Down Expand Up @@ -69,6 +83,27 @@
<string>Location access is required for some DApps to function properly.</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photos access it required to give you ability to choose custom profile pictures.</string>
<key>UIAppFonts</key>
<array>
<string>Inter-Bold.otf</string>
<string>Inter-Medium.otf</string>
<string>Inter-Regular.otf</string>
<string>Inter-Black.otf</string>
<string>Inter-BlackItalic.otf</string>
<string>Inter-BoldItalic.otf</string>
<string>Inter-ExtraBold.otf</string>
<string>Inter-ExtraBoldItalic.otf</string>
<string>Inter-ExtraLight-BETA.otf</string>
<string>Inter-ExtraLightItalic-BETA.otf</string>
<string>Inter-Italic.otf</string>
<string>Inter-Light-BETA.otf</string>
<string>Inter-LightItalic-BETA.otf</string>
<string>Inter-MediumItalic.otf</string>
<string>Inter-SemiBold.otf</string>
<string>Inter-SemiBoldItalic.otf</string>
<string>Inter-Thin-BETA.otf</string>
<string>Inter-ThinItalic-BETA.otf</string>
</array>
<key>UIBackgroundModes</key>
<array>
<string>remote-notification</string>
Expand All @@ -94,30 +129,5 @@
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>ITSAppUsesNonExemptEncryption</key>
<true/>
<key>UIAppFonts</key>
<array>
<string>Inter-Bold.otf</string>
<string>Inter-Medium.otf</string>
<string>Inter-Regular.otf</string>
<string>Inter-Black.otf</string>
<string>Inter-BlackItalic.otf</string>
<string>Inter-BoldItalic.otf</string>
<string>Inter-ExtraBold.otf</string>
<string>Inter-ExtraBoldItalic.otf</string>
<string>Inter-ExtraLight-BETA.otf</string>
<string>Inter-ExtraLightItalic-BETA.otf</string>
<string>Inter-Italic.otf</string>
<string>Inter-Light-BETA.otf</string>
<string>Inter-LightItalic-BETA.otf</string>
<string>Inter-MediumItalic.otf</string>
<string>Inter-SemiBold.otf</string>
<string>Inter-SemiBoldItalic.otf</string>
<string>Inter-Thin-BETA.otf</string>
<string>Inter-ThinItalic-BETA.otf</string>
</array>
<key>ITSEncryptionExportComplianceCode</key>
<string>1aa92c4d-6194-4d7d-b70a-16b48256b87e</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion src/status_im/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
(def regx-italic #"~[^~]+~")
(def regx-backquote #"`[^`]+`")
(def regx-universal-link #"((^https?://get.status.im/)|(^status-im://))[\x00-\x7F]+$")
(def regx-deep-link #"(^status-im://)[\x00-\x7F]+$")
(def regx-deep-link #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))")

(def ^:const lines-collapse-threshold 20)
(def ^:const chars-collapse-threshold 600)
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 @@ -103,8 +103,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 @@ -14,6 +14,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 @@ -83,6 +84,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 @@ -109,6 +114,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
3 changes: 3 additions & 0 deletions test/cljs/status_im/test/utils/universal_links/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
(testing "status-im://blah"
(testing "it returns true"
(is (links/deep-link? "status-im://blah"))))
(testing "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"
(testing "it returns true"
(is (links/deep-link? "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"))))
(testing "http://get.status.im/blah"
(testing "it returns true"
(is (links/universal-link? "http://get.status.im/blah"))))
Expand Down

0 comments on commit 483bed0

Please sign in to comment.