Skip to content

Commit bba4dd5

Browse files
authored
Merge pull request #252 from BranchMetrics/example-updates
Example updates
2 parents 91a2d03 + 27e10d9 commit bba4dd5

File tree

34 files changed

+282
-264
lines changed

34 files changed

+282
-264
lines changed

examples/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,5 @@ buck-out/
3838
\.buckd/
3939
android/app/libs
4040
android/keystores/debug.keystore
41+
report.*
42+
*/fastlane/README.md

examples/Branchfile

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Edit the configuration below.
2+
# Change to any example project folder and run fastlane update_branch.
3+
4+
# bundle install
5+
# cd webview_example
6+
# bundle exec fastlane update_branch
7+
8+
# iOS projects: Also validate the Universal Link configuration with
9+
# bundle exec fastlane validate
10+
11+
# -----
12+
13+
# Branch configuration defaults
14+
15+
live_key "key_live_dczvWn3zrK8575YRe07IgjblAAmfx51S"
16+
test_key "key_test_fbqC9k2BqS68Y1XQi7YVjakhCxomD6Z9"
17+
app_link_subdomain "wujv"
18+
19+
# Use instead of app_link_subdomain for custom domains:
20+
# domains %w{example.com www.example.com}
21+
22+
# Android only
23+
uri_scheme "myurischeme"

examples/README.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,19 @@ Once this is done, you can deploy the app on a device and open Universal Links i
2525

2626
To use this tool:
2727

28-
```bash
29-
export BRANCH_LIVE_KEY=key_live_xxxx
30-
export BRANCH_TEST_KEY=key_test_yyyy
31-
export BRANCH_APP_LINK_SUBDOMAIN=myapp # myapp.app.link
32-
# OR
33-
export BRANCH_DOMAINS=example.com # for custom domains
34-
bundle install
35-
cd webview_example
36-
bundle exec fastlane update_branch
37-
```
38-
39-
The plugin crawls the Branch-generated apple-app-site-association file for the domain to get the
40-
team and bundle identifiers that you entered in the Branch Dashboard. The live or test key is required.
41-
Both are not required, but both may be supplied to set up both environments.
28+
1. Edit the [Branchfile](./Branchfile) in this directory to use the correct parameters for your app from the
29+
Branch Dashboard.
30+
2. To update any example app, e.g. `webview_example`:
31+
```bash
32+
bundle install
33+
cd webview_example
34+
bundle exec fastlane update_branch
35+
```
36+
Now the project is set up to use your app parameters, including your team and bundle identifiers.
37+
3. iOS projects: Validate the Universal Link configuration:
38+
```bash
39+
bundle exec fastlane validate
40+
```
4241

4342
## webview_example apps
4443

Lines changed: 22 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,32 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="io.branch.testbed_native_android">
4-
<uses-permission android:name="android.permission.INTERNET" />
5-
6-
<application
7-
android:allowBackup="true"
8-
android:icon="@mipmap/ic_launcher"
9-
android:label="@string/app_name"
10-
android:roundIcon="@mipmap/ic_launcher_round"
11-
android:supportsRtl="true"
12-
android:theme="@style/AppTheme">
13-
<activity
14-
android:name=".MainActivity"
15-
android:label="@string/app_name"
16-
android:theme="@style/Theme.AppCompat.Light.NoActionBar"
17-
android:launchMode="singleTask">
1+
<?xml version='1.0' encoding='UTF-8'?>
2+
<manifest xmlns:android='http://schemas.android.com/apk/res/android' package='io.branch.testbed_native_android'>
3+
<uses-permission android:name='android.permission.INTERNET'/>
4+
<application android:allowBackup='true' android:icon='@mipmap/ic_launcher' android:label='@string/app_name' android:roundIcon='@mipmap/ic_launcher_round' android:supportsRtl='true' android:theme='@style/AppTheme'>
5+
<activity android:name='.MainActivity' android:label='@string/app_name' android:theme='@style/Theme.AppCompat.Light.NoActionBar' android:launchMode='singleTask'>
186
<intent-filter>
19-
<action android:name="android.intent.action.MAIN" />
20-
21-
<category android:name="android.intent.category.LAUNCHER" />
7+
<action android:name='android.intent.action.MAIN'/>
8+
<category android:name='android.intent.category.LAUNCHER'/>
229
</intent-filter>
23-
2410
<!-- Branch intent-filter -->
25-
<intent-filter android:autoVerify="true">
26-
<action android:name="android.intent.action.VIEW" />
27-
<category android:name="android.intent.category.DEFAULT" />
28-
<category android:name="android.intent.category.BROWSABLE" />
29-
<!-- App Links -->
30-
<data android:scheme="https" android:host="bnctestbed-alternate.app.link" />
31-
<data android:scheme="https" android:host="bnctestbed.app.link" />
32-
<data android:scheme="https" android:host="bnctestbed-alternate.test-app.link" />
33-
<data android:scheme="https" android:host="bnctestbed.test-app.link" />
34-
<!-- Custom URI scheme -->
35-
<data android:scheme="branchtest" android:host="open" />
11+
<intent-filter android:autoverify='true'>
12+
<action android:name='android.intent.action.VIEW'/>
13+
<category android:name='android.intent.category.DEFAULT'/>
14+
<category android:name='android.intent.category.BROWSABLE'/>
15+
<data android:scheme='myurischeme' android:host='open'/>
16+
<data android:scheme='https' android:host='wujv.app.link'/>
17+
<data android:scheme='https' android:host='wujv-alternate.app.link'/>
18+
<data android:scheme='https' android:host='wujv.test-app.link'/>
19+
<data android:scheme='https' android:host='wujv-alternate.test-app.link'/>
3620
</intent-filter>
37-
</activity>
38-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
39-
40-
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
21+
</activity>
22+
<activity android:name='com.facebook.react.devsupport.DevSettingsActivity'/>
23+
<receiver android:name='io.branch.referral.InstallListener' android:exported='true'>
4124
<intent-filter>
42-
<action android:name="com.android.vending.INSTALL_REFERRER" />
25+
<action android:name='com.android.vending.INSTALL_REFERRER'/>
4326
</intent-filter>
4427
</receiver>
45-
4628
<!-- Branch keys -->
47-
<meta-data android:name="io.branch.sdk.BranchKey" android:value="key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv" />
48-
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc" />
29+
<meta-data android:name='io.branch.sdk.BranchKey' android:value='key_live_dczvWn3zrK8575YRe07IgjblAAmfx51S'/>
30+
<meta-data android:name='io.branch.sdk.BranchKey.test' android:value='key_test_fbqC9k2BqS68Y1XQi7YVjakhCxomD6Z9'/>
4931
</application>
50-
5132
</manifest>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../Branchfile
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
fastlane_version "2.27"
2+
3+
desc "Update Branch configuration"
4+
lane :update_branch do
5+
setup_branch(
6+
android_project_path: "android",
7+
remove_existing_domains: true
8+
)
9+
end
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../Branchfile

examples/testbed_native_ios/fastlane/Fastfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,8 @@ lane :update_branch do
88
remove_existing_domains: true
99
)
1010
end
11+
12+
desc "Validate Universal Links in iOS project"
13+
lane :validate do
14+
validate_universal_links xcodeproj: "testbed_native_ios.xcodeproj"
15+
end

examples/testbed_native_ios/testbed_native_ios.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@
352352
DEVELOPMENT_TEAM = R63EM248DP;
353353
INFOPLIST_FILE = testbed_native_ios/Info.plist;
354354
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
355-
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.sdk.Branch-TestBed";
355+
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.WebViewExample;
356356
PRODUCT_NAME = "$(TARGET_NAME)";
357357
};
358358
name = "Test-Release";
@@ -418,7 +418,7 @@
418418
DEVELOPMENT_TEAM = R63EM248DP;
419419
INFOPLIST_FILE = testbed_native_ios/Info.plist;
420420
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
421-
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.sdk.Branch-TestBed";
421+
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.WebViewExample;
422422
PRODUCT_NAME = "$(TARGET_NAME)";
423423
};
424424
name = "Test-Debug";
@@ -525,7 +525,7 @@
525525
DEVELOPMENT_TEAM = R63EM248DP;
526526
INFOPLIST_FILE = testbed_native_ios/Info.plist;
527527
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
528-
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.sdk.Branch-TestBed";
528+
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.WebViewExample;
529529
PRODUCT_NAME = "$(TARGET_NAME)";
530530
};
531531
name = Debug;
@@ -540,7 +540,7 @@
540540
DEVELOPMENT_TEAM = R63EM248DP;
541541
INFOPLIST_FILE = testbed_native_ios/Info.plist;
542542
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
543-
PRODUCT_BUNDLE_IDENTIFIER = "io.branch.sdk.Branch-TestBed";
543+
PRODUCT_BUNDLE_IDENTIFIER = io.branch.sdk.WebViewExample;
544544
PRODUCT_NAME = "$(TARGET_NAME)";
545545
};
546546
name = Release;

examples/testbed_native_ios/testbed_native_ios/Info.plist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
<key>branch_key</key>
5656
<dict>
5757
<key>live</key>
58-
<string>key_live_feebgAAhbH9Tv85H5wLQhpdaefiZv5Dv</string>
58+
<string>key_live_dczvWn3zrK8575YRe07IgjblAAmfx51S</string>
5959
<key>test</key>
60-
<string>key_test_hdcBLUy1xZ1JD0tKg7qrLcgirFmPPVJc</string>
60+
<string>key_test_fbqC9k2BqS68Y1XQi7YVjakhCxomD6Z9</string>
6161
</dict>
6262
</dict>
6363
</plist>

0 commit comments

Comments
 (0)