Skip to content

Commit

Permalink
[BUGFIX] Fixes and configuration updates related to Branch.io Deep Li…
Browse files Browse the repository at this point in the history
…nks (#5262)

* updates react-native-branch to latest versions and fixes some related configurations

* removes unused 'metamask.io' as deep link url from Android

* changes AndroidManifest.xml to start the main activity as SingleTask instead of SingleInstance

* adds missing pieces
  • Loading branch information
andreahaku authored Nov 23, 2022
1 parent b79dad0 commit e90a90c
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
3 changes: 1 addition & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
</intent-filter>
</activity>
<activity
android:launchMode="singleInstance"
android:launchMode="singleTask"
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
Expand Down Expand Up @@ -64,7 +64,6 @@
<data android:host="metamask-alternate.app.link" />
<data android:host="metamask.test-app.link" />
<data android:host="metamask-alternate.test-app.link" />
<data android:host="metamask.io" />
</intent-filter>
<!-- Branch URI Scheme -->
<intent-filter>
Expand Down
22 changes: 15 additions & 7 deletions android/app/src/main/java/io/metamask/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,22 @@ protected void onCreate(Bundle savedInstanceState) {

@Override
public void onNewIntent(Intent intent) {
super.onNewIntent(intent);
if (intent != null &&
intent.hasExtra("branch_force_new_session") &&
intent.getBooleanExtra("branch_force_new_session",false)) {
RNBranchModule.onNewIntent(intent);
}
super.onNewIntent(intent);
/*
if activity is in foreground (or in backstack but partially visible) launch the same
activity will skip onStart, handle this case with reInit
if reInit() is called without this flag, you will see the following message:
BRANCH_SDK: Warning. Session initialization already happened.
To force a new session,
set intent extra, "branch_force_new_session", to true.
*/
if (intent != null &&
intent.hasExtra("branch_force_new_session") &&
intent.getBooleanExtra("branch_force_new_session", false)) {
RNBranchModule.onNewIntent(intent);
}
}

@Override
protected ReactActivityDelegate createReactActivityDelegate() {
return new ReactActivityDelegate(this, getMainComponentName()) {
Expand Down
14 changes: 13 additions & 1 deletion ios/MetaMask/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>branch_universal_link_domains</key>
<array>
<string>metamask.app.link</string>
<string>metamask-alternate.app.link</string>
<string>metamask.test.app.link</string>
<string>metamask-alternate.test.app.link</string>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand Down Expand Up @@ -115,7 +122,12 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>branch_key</key>
<string>$(MM_BRANCH_KEY_LIVE)</string>
<dict>
<key>live</key>
<string>$(MM_BRANCH_KEY_LIVE)</string>
<key>test</key>
<string>$(MM_BRANCH_KEY_TEST)</string>
</dict>
<key>fox_code</key>
<string>$(MM_FOX_CODE)</string>
<key>mixpanel_token</key>
Expand Down
10 changes: 5 additions & 5 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- boost (1.76.0)
- Branch (1.41.0)
- Branch (1.43.2)
- BVLinearGradient (2.5.6):
- React
- CocoaAsyncSocket (7.6.5)
Expand Down Expand Up @@ -297,8 +297,8 @@ PODS:
- React
- react-native-blur (0.8.0):
- React
- react-native-branch (5.4.0):
- Branch (= 1.41.0)
- react-native-branch (5.6.2):
- Branch (= 1.43.2)
- React-Core
- react-native-camera (3.44.3):
- React-Core
Expand Down Expand Up @@ -774,7 +774,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost: a7c83b31436843459a1961bfd74b96033dc77234
Branch: bd6c472d6cab03206877ac86c1241327a3f217d1
Branch: 74cc856025984f691833c8fa332834ac38a0cf4e
BVLinearGradient: e3aad03778a456d77928f594a649e96995f1c872
CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99
DoubleConversion: 831926d9b8bf8166fd87886c4abab286c2422662
Expand Down Expand Up @@ -811,7 +811,7 @@ SPEC CHECKSUMS:
react-native-aes: ff31f0dd4c791eb423a631ee04570fcf3c618924
react-native-background-timer: 1b6e6b4e10f1b74c367a1fdc3c72b67c619b222b
react-native-blur: cad4d93b364f91e7b7931b3fa935455487e5c33c
react-native-branch: 5b20bf032b3a1a20d2b76e57215bd3254a137dd5
react-native-branch: 4e42fda662d96893afbbd02839806931398e3d2e
react-native-camera: b8cc03e2feec0c04403d0998e37cf519d8fd4c6f
react-native-cookies: f54fcded06bb0cda05c11d86788020b43528a26c
react-native-get-random-values: a6ea6a8a65dc93e96e24a11105b1a9c8cfe1d72a
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@
"react-native-animatable": "^1.3.3",
"react-native-animated-fox": "git+https://github.com/MetaMask/react-native-animated-fox.git#16e38d54d829709e497f196e31fa8ff00cdf2aa9",
"react-native-background-timer": "2.1.1",
"react-native-branch": "5.4.0",
"react-native-branch": "^5.6.2",
"react-native-browser-polyfill": "0.1.2",
"react-native-button": "git+https://github.com/MetaMask/react-native-button.git#fd79f4d6c8ced4086ba6e3021b6ed6d4a3e19cf7",
"react-native-camera": "^3.36.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -19233,10 +19233,10 @@ react-native-background-timer@2.1.1:
resolved "https://registry.yarnpkg.com/react-native-background-timer/-/react-native-background-timer-2.1.1.tgz#9a2489681ab2f8033c213c73272e9d4c47572cd5"
integrity sha512-cuXIIv+dcG8a8qkTD8pMzeqOEZCO+UGKglZWIe1osve+yJslmCowYQff+bI9xa7NOt2w+Vtd4L3d9JonlSqODg==

react-native-branch@5.4.0:
version "5.4.0"
resolved "https://registry.yarnpkg.com/react-native-branch/-/react-native-branch-5.4.0.tgz#ba71422e38047b744ae5d88a834e7a7cb5185d68"
integrity sha512-KuYpFPm6cKzUSTMOpI216w4BYP/5E4g8MH5a/4/xaWPqVqZmeoQS89/GqDxg7YwOG70YMtwdSobulh/wrv2tMw==
react-native-branch@^5.6.2:
version "5.6.2"
resolved "https://registry.yarnpkg.com/react-native-branch/-/react-native-branch-5.6.2.tgz#c3ec137a5427a21fcd6559b83f02e6162ea627f6"
integrity sha512-plYpedNI1SSquD7bDOJ4UptkPIrGtz4O1NXfFA5tBshGb0AhuUSYS13dNZuHa+Ug+7YaqBcc0SF02vIB0ktZKw==

react-native-browser-polyfill@0.1.2:
version "0.1.2"
Expand Down

0 comments on commit e90a90c

Please sign in to comment.