Skip to content

Commit beba2c5

Browse files
Code change to allow custom URL configuration per Operating System
Code change to allow custom URL configuration per Operating System
1 parent 389127e commit beba2c5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+515
-478
lines changed

android/src/main/java/br/com/rsmarques/flutter_branch_sdk/BranchJsonConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ public class BranchJsonConfig {
1919
public final Boolean enableLogging;
2020
public final Boolean useTestInstance;
2121

22+
public final String apiUrlAndroid;
23+
public final String apiUrlIOS;
2224

2325
private BranchJsonConfig(JSONObject jsonObject) {
2426
this.apiUrl = jsonObject.optString("apiUrl", "");
27+
this.apiUrlAndroid = jsonObject.optString("apiUrlAndroid", "");
28+
this.apiUrlIOS = jsonObject.optString("apiUrlIOS", "");
2529
this.branchKey = jsonObject.optString("branchKey", "");
2630
this.liveKey = jsonObject.optString("liveKey", "");
2731
this.testKey = jsonObject.optString("testKey", "");

android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkPlugin.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,18 @@ private void setupBranch(MethodCall call, final Result result) {
406406

407407
if (branchJsonConfig != null) {
408408
if (!branchJsonConfig.apiUrl.isEmpty()) {
409-
Branch.setAPIUrl(branchJsonConfig.apiUrl);
410-
LogUtils.debug(DEBUG_NAME, "Set API URL from branch-config.json: " + branchJsonConfig.apiUrl);
409+
LogUtils.debug(DEBUG_NAME, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
410+
LogUtils.debug(DEBUG_NAME, "The apiUrl parameter has been deprecated. Please use apiUrlAndroid instead. Check the documentation.");
411+
LogUtils.debug(DEBUG_NAME, "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
412+
throw new IllegalArgumentException("The apiUrl parameter has been deprecated. Please use apiUrlAndroid instead. Check the documentation.");
411413
}
412414

415+
if (!branchJsonConfig.apiUrlAndroid.isEmpty()) {
416+
Branch.setAPIUrl(branchJsonConfig.apiUrlAndroid);
417+
LogUtils.debug(DEBUG_NAME, "Set API URL from branch-config.json: " + branchJsonConfig.apiUrlAndroid);
418+
}
419+
420+
413421
if (branchJsonConfig.enableLogging) {
414422
Branch.enableLogging();
415423
LogUtils.debug(DEBUG_NAME, "Set EnableLogging from branch-config.json");

example/.metadata

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This file should be version controlled and should not be manually edited.
55

66
version:
7-
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
7+
revision: "d693b4b9dbac2acd4477aea4555ca6dcbea44ba2"
88
channel: "stable"
99

1010
project_type: app
@@ -13,11 +13,11 @@ project_type: app
1313
migration:
1414
platforms:
1515
- platform: root
16-
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
17-
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
18-
- platform: web
19-
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
20-
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
16+
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
17+
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
18+
- platform: ios
19+
create_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
20+
base_revision: d693b4b9dbac2acd4477aea4555ca6dcbea44ba2
2121

2222
# User provided section
2323

example/assets/branch-config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
2-
"apiUrl_test": "https://branch-api-proxy.onrender.com",
2+
"apiUrl_old": "https://branch-api-proxy.onrender.com",
3+
"apiUrlAndroid": "https://branch-api-proxy.onrender.com",
4+
"apiUrlIOS": "https://branch-api-proxy.onrender.com",
35
"branchKey": "key_test_ipQTteg11ENANDeCzSXgqdgfuycWoXYH",
46
"liveKey": "key_live_bkJRqpb15wLqUAgsDVNUIobjyviWi6Wx",
57
"testKey": "key_test_ipQTteg11ENANDeCzSXgqdgfuycWoXYH",

example/ios/.gitignore

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
**/dgph
2-
*.mode1v3
3-
*.mode2v3
4-
*.moved-aside
5-
*.pbxuser
6-
*.perspectivev3
7-
**/*sync/
8-
.sconsign.dblite
9-
.tags*
10-
**/.vagrant/
11-
**/DerivedData/
12-
Icon?
13-
**/Pods/
14-
**/.symlinks/
15-
profile
16-
xcuserdata
17-
**/.generated/
18-
Flutter/App.framework
19-
Flutter/Flutter.framework
20-
Flutter/Flutter.podspec
21-
Flutter/Generated.xcconfig
22-
Flutter/ephemeral/
23-
Flutter/app.flx
24-
Flutter/app.zip
25-
Flutter/flutter_assets/
26-
Flutter/flutter_export_environment.sh
27-
ServiceDefinitions.json
28-
Runner/GeneratedPluginRegistrant.*
29-
30-
# Exceptions to above rules.
31-
!default.mode1v3
32-
!default.mode2v3
33-
!default.pbxuser
34-
!default.perspectivev3
1+
**/dgph
2+
*.mode1v3
3+
*.mode2v3
4+
*.moved-aside
5+
*.pbxuser
6+
*.perspectivev3
7+
**/*sync/
8+
.sconsign.dblite
9+
.tags*
10+
**/.vagrant/
11+
**/DerivedData/
12+
Icon?
13+
**/Pods/
14+
**/.symlinks/
15+
profile
16+
xcuserdata
17+
**/.generated/
18+
Flutter/App.framework
19+
Flutter/Flutter.framework
20+
Flutter/Flutter.podspec
21+
Flutter/Generated.xcconfig
22+
Flutter/ephemeral/
23+
Flutter/app.flx
24+
Flutter/app.zip
25+
Flutter/flutter_assets/
26+
Flutter/flutter_export_environment.sh
27+
ServiceDefinitions.json
28+
Runner/GeneratedPluginRegistrant.*
29+
30+
# Exceptions to above rules.
31+
!default.mode1v3
32+
!default.mode2v3
33+
!default.pbxuser
34+
!default.perspectivev3

example/ios/Flutter/Debug.xcconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2-
#include "Generated.xcconfig"
1+
#include "Generated.xcconfig"
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2-
#include "Generated.xcconfig"
1+
#include "Generated.xcconfig"

example/ios/Podfile

Lines changed: 0 additions & 41 deletions
This file was deleted.

example/ios/Podfile.lock

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)