Skip to content

Commit

Permalink
Release 5.9.0 (#1169)
Browse files Browse the repository at this point in the history
* Updated version and changelog

* Changes setAPIUrl back to static
  • Loading branch information
nsingh-branch authored Feb 15, 2024
1 parent 9708967 commit 9e4a699
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ void setupApiUrlText() {
apiUrlText.setOnEditorActionListener((textView, i, keyEvent) -> {
if (i == EditorInfo.IME_ACTION_DONE) {
String newApiUrl = textView.getText().toString();
Branch.getInstance().setAPIUrl(newApiUrl);
Branch.setAPIUrl(newApiUrl);

InputMethodManager imm = (InputMethodManager)getSystemService(INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(apiUrlText.getWindowToken(), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,26 +49,26 @@ public void testGetAPIBaseUrl() {

@Test
public void testSetAPIUrl_Example() {
prefHelper.setAPIUrl("https://www.example.com/");
PrefHelper.setAPIUrl("https://www.example.com/");
String actual = prefHelper.getAPIBaseUrl();
Assert.assertEquals("https://www.example.com/", actual);
}

@Test
public void testSetAPIUrl_InvalidHttp() {
prefHelper.setAPIUrl("http://www.example.com/");
PrefHelper.setAPIUrl("http://www.example.com/");
assertDefaultURL();
}

@Test
public void testSetAPIUrl_InvalidNull() {
prefHelper.setAPIUrl(null);
PrefHelper.setAPIUrl(null);
assertDefaultURL();
}

@Test
public void testSetAPIUrl_InvalidEmpty() {
prefHelper.setAPIUrl("");
PrefHelper.setAPIUrl("");
assertDefaultURL();
}

Expand Down
6 changes: 2 additions & 4 deletions Branch-SDK/src/main/java/io/branch/referral/Branch.java
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,8 @@ public static void expectDelayedSessionInitialization(boolean expectDelayedInit)
* <p>Sets a custom base URL for all calls to the Branch API. Requires https.</p>
* @param url The {@link String} URL base URL that the Branch API uses.
*/
public void setAPIUrl(String url) {
if (prefHelper_ != null && url.length() > 0) {
prefHelper_.setAPIUrl(url);
}
public static void setAPIUrl(String url) {
PrefHelper.setAPIUrl(url);
}
/**
* <p>Sets a custom CDN base URL.</p>
Expand Down
19 changes: 12 additions & 7 deletions Branch-SDK/src/main/java/io/branch/referral/PrefHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ public class PrefHelper {

static final String KEY_REFERRING_URL_QUERY_PARAMETERS = "bnc_referringUrlQueryParameters";
static final String KEY_ANON_ID = "bnc_anon_id";
private static final String KEY_BASE_URL = "bnc_base_url";

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

/**
* Branch Custom server url. Used by clients that want to proxy all requests.
*/
private static String customServerURL_ = null;

/**
* Branch Custom server url. Used by clients that want to proxy all CDN requests.
*/
Expand Down Expand Up @@ -209,15 +213,16 @@ static void shutDown() {
enableLogging_ = false;
prefHelper_ = null;
customCDNBaseURL_ = null;
customServerURL_ = null;
useEUEndpoint_ = false;
}

/**
* <p>Sets a custom base URL for all calls to the Branch API. Requires https.</p>
* @param url The {@link String} URL base URL that the Branch API uses.
*/
public void setAPIUrl(String url) {
setString(KEY_BASE_URL, url);
static void setAPIUrl(String url) {
customServerURL_ = url;
}

/**
Expand All @@ -228,12 +233,12 @@ public void setAPIUrl(String url) {
* API uses.
*/
public String getAPIBaseUrl() {
if (useEUEndpoint_) {
return BRANCH_EU_BASE_URL_V3;
if (URLUtil.isHttpsUrl(customServerURL_)) {
return customServerURL_;
}

if (URLUtil.isHttpsUrl(getString(KEY_BASE_URL))) {
return getString(KEY_BASE_URL);
if (useEUEndpoint_) {
return BRANCH_EU_BASE_URL_V3;
}

if (Build.VERSION.SDK_INT >= 20) {
Expand Down
5 changes: 5 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Branch Android SDK change log
- v5.9.0
* _*Master Release*_ - Feb 15, 2024
- Added new useEUEndpoint method
- Added support for setting DMA Compliance Parameters
- Removed v1/profile and v1/logout requests
- v5.8.2
* _*Release Branch 5.8.2*_ - Jan 26, 2024
- Removed deprecated field target SDK version from library manifest.
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=5.8.2
VERSION_CODE=051002
VERSION_NAME=5.9.0
VERSION_CODE=051100
GROUP=io.branch.sdk.android

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.
Expand Down

0 comments on commit 9e4a699

Please sign in to comment.