Skip to content

Commit 9e4a699

Browse files
Release 5.9.0 (#1169)
* Updated version and changelog * Changes setAPIUrl back to static
1 parent 9708967 commit 9e4a699

File tree

6 files changed

+26
-18
lines changed

6 files changed

+26
-18
lines changed

Branch-SDK-TestBed/src/main/java/io/branch/branchandroidtestbed/SettingsActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ void setupApiUrlText() {
6161
apiUrlText.setOnEditorActionListener((textView, i, keyEvent) -> {
6262
if (i == EditorInfo.IME_ACTION_DONE) {
6363
String newApiUrl = textView.getText().toString();
64-
Branch.getInstance().setAPIUrl(newApiUrl);
64+
Branch.setAPIUrl(newApiUrl);
6565

6666
InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
6767
imm.hideSoftInputFromWindow(apiUrlText.getWindowToken(), 0);

Branch-SDK/src/androidTest/java/io/branch/referral/PrefHelperTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,26 @@ public void testGetAPIBaseUrl() {
4949

5050
@Test
5151
public void testSetAPIUrl_Example() {
52-
prefHelper.setAPIUrl("https://www.example.com/");
52+
PrefHelper.setAPIUrl("https://www.example.com/");
5353
String actual = prefHelper.getAPIBaseUrl();
5454
Assert.assertEquals("https://www.example.com/", actual);
5555
}
5656

5757
@Test
5858
public void testSetAPIUrl_InvalidHttp() {
59-
prefHelper.setAPIUrl("http://www.example.com/");
59+
PrefHelper.setAPIUrl("http://www.example.com/");
6060
assertDefaultURL();
6161
}
6262

6363
@Test
6464
public void testSetAPIUrl_InvalidNull() {
65-
prefHelper.setAPIUrl(null);
65+
PrefHelper.setAPIUrl(null);
6666
assertDefaultURL();
6767
}
6868

6969
@Test
7070
public void testSetAPIUrl_InvalidEmpty() {
71-
prefHelper.setAPIUrl("");
71+
PrefHelper.setAPIUrl("");
7272
assertDefaultURL();
7373
}
7474

Branch-SDK/src/main/java/io/branch/referral/Branch.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -505,10 +505,8 @@ public static void expectDelayedSessionInitialization(boolean expectDelayedInit)
505505
* <p>Sets a custom base URL for all calls to the Branch API. Requires https.</p>
506506
* @param url The {@link String} URL base URL that the Branch API uses.
507507
*/
508-
public void setAPIUrl(String url) {
509-
if (prefHelper_ != null && url.length() > 0) {
510-
prefHelper_.setAPIUrl(url);
511-
}
508+
public static void setAPIUrl(String url) {
509+
PrefHelper.setAPIUrl(url);
512510
}
513511
/**
514512
* <p>Sets a custom CDN base URL.</p>

Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ public class PrefHelper {
126126

127127
static final String KEY_REFERRING_URL_QUERY_PARAMETERS = "bnc_referringUrlQueryParameters";
128128
static final String KEY_ANON_ID = "bnc_anon_id";
129-
private static final String KEY_BASE_URL = "bnc_base_url";
130129

131130
/**
132131
* Internal static variable of own type {@link PrefHelper}. This variable holds the single
@@ -162,6 +161,11 @@ public class PrefHelper {
162161
*/
163162
private final JSONObject secondaryRequestMetadata = new JSONObject();
164163

164+
/**
165+
* Branch Custom server url. Used by clients that want to proxy all requests.
166+
*/
167+
private static String customServerURL_ = null;
168+
165169
/**
166170
* Branch Custom server url. Used by clients that want to proxy all CDN requests.
167171
*/
@@ -209,15 +213,16 @@ static void shutDown() {
209213
enableLogging_ = false;
210214
prefHelper_ = null;
211215
customCDNBaseURL_ = null;
216+
customServerURL_ = null;
212217
useEUEndpoint_ = false;
213218
}
214219

215220
/**
216221
* <p>Sets a custom base URL for all calls to the Branch API. Requires https.</p>
217222
* @param url The {@link String} URL base URL that the Branch API uses.
218223
*/
219-
public void setAPIUrl(String url) {
220-
setString(KEY_BASE_URL, url);
224+
static void setAPIUrl(String url) {
225+
customServerURL_ = url;
221226
}
222227

223228
/**
@@ -228,12 +233,12 @@ public void setAPIUrl(String url) {
228233
* API uses.
229234
*/
230235
public String getAPIBaseUrl() {
231-
if (useEUEndpoint_) {
232-
return BRANCH_EU_BASE_URL_V3;
236+
if (URLUtil.isHttpsUrl(customServerURL_)) {
237+
return customServerURL_;
233238
}
234239

235-
if (URLUtil.isHttpsUrl(getString(KEY_BASE_URL))) {
236-
return getString(KEY_BASE_URL);
240+
if (useEUEndpoint_) {
241+
return BRANCH_EU_BASE_URL_V3;
237242
}
238243

239244
if (Build.VERSION.SDK_INT >= 20) {

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
# Branch Android SDK change log
2+
- v5.9.0
3+
* _*Master Release*_ - Feb 15, 2024
4+
- Added new useEUEndpoint method
5+
- Added support for setting DMA Compliance Parameters
6+
- Removed v1/profile and v1/logout requests
27
- v5.8.2
38
* _*Release Branch 5.8.2*_ - Jan 26, 2024
49
- Removed deprecated field target SDK version from library manifest.

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=5.8.2
2-
VERSION_CODE=051002
1+
VERSION_NAME=5.9.0
2+
VERSION_CODE=051100
33
GROUP=io.branch.sdk.android
44

55
POM_DESCRIPTION=Use the Branch SDK (branch.io) to create and power the links that point back to your apps for all of these things and more. Branch makes it incredibly simple to create powerful deep links that can pass data across app install and open while handling all edge cases (using on desktop vs. mobile vs. already having the app installed, etc). Best of all, it is really simple to start using the links for your own app: only 2 lines of code to register the deep link router and one more line of code to create the links with custom data.

0 commit comments

Comments
 (0)