Skip to content

Commit

Permalink
SDK v8.1
Browse files Browse the repository at this point in the history
* commit 'b26adf1618ab8e39e92d7983616160d19108692f':
  Updated versionCode, versionName and RELEASE-NOTES
  MS-5080 Added support for High Impact media
  • Loading branch information
avohraa committed Oct 7, 2022
2 parents b1838c1 + b26adf1 commit 137c80f
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 4 deletions.
5 changes: 5 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 8.1

### Improvement/Bug Fixes
+ MS-5080 Enable support for high impact media type creatives in BannerAdView

## 8.0.1

### Improvement/Bug Fixes
Expand Down
4 changes: 2 additions & 2 deletions instreamvideo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "1.38.1" // Instream SDK version
version = "1.39" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 37 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 38 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
}
Expand Down
4 changes: 2 additions & 2 deletions sdk/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project properties
version = "8.0.1"
version = "8.1"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -9,7 +9,7 @@ android {
compileSdkVersion 32
buildToolsVersion '32.0.0'
defaultConfig {
versionCode 96 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 97 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionName version
consumerProguardFiles 'proguard-project.txt'
minSdkVersion 14
Expand Down
1 change: 1 addition & 0 deletions sdk/res/values/errors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
<string formatted="false" name="set_allow_video">setAllowVideo() to %b</string>
<string formatted="false" name="set_allow_banner">setAllowBanner() to %b</string>
<string formatted="false" name="set_allow_native">setAllowNative() to %b</string>
<string formatted="false" name="set_allow_high_impact">setAllowHighImpact() to %b</string>
<string formatted="false" name="set_count_on_ad_load">setCountImpressionOnAdLoad() to %b</string>
<string formatted="false" name="webview_loading">WebView loading body: %s</string>
<string formatted="false" name="load_ad_int">loadAd() called for interstitial.</string>
Expand Down
21 changes: 21 additions & 0 deletions sdk/src/com/appnexus/opensdk/BannerAdView.java
Original file line number Diff line number Diff line change
Expand Up @@ -852,6 +852,18 @@ public void setAllowNativeDemand(boolean enabled) {
requestParameters.setBannerNativeEnabled(enabled);
}

/**
* Sets whether or not High Impact media(AppNexus Media Type:11) can serve on this Ad object.
* This overrides the value set in console.
*
* @param enabled whether to enable High Impact media or not. default is false
*/
public void setAllowHighImpactDemand(boolean enabled) {
Clog.d(Clog.publicFunctionsLogTag, Clog.getString(
R.string.set_allow_high_impact, enabled));
requestParameters.setHighImpactEnabled(enabled);
}


/**
* Check whether Video Ad is enabled on this ad view
Expand All @@ -872,6 +884,15 @@ public boolean getAllowNativeDemand() {
return requestParameters.isBannerNativeEnabled();
}

/**
* Check whether High Impact media is enabled on this ad view
*
* @return If true, High Impact Ad can be loaded on the ad view.
*/
public boolean getAllowHighImpactDemand() {
return requestParameters.isHighImpactEnabled();
}


@Override
protected void onWindowVisibilityChanged(int visibility) {
Expand Down
16 changes: 16 additions & 0 deletions sdk/src/com/appnexus/opensdk/ut/UTRequestParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class UTRequestParameters {
private boolean isBannerVideoEnabled = false;
private boolean isBannerEnabled = true;
private boolean isBannerNativeEnabled = false;
private boolean isHighImpactEnabled = false;
private String extInvCode;
private float reserve = 0.00f;
private String age;
Expand Down Expand Up @@ -176,6 +177,7 @@ public class UTRequestParameters {
private static final int ALLOWED_TYPE_BANNER = 1;
private static final int ALLOWED_TYPE_INTERSTITIAL = 3;
private static final int ALLOWED_TYPE_VIDEO = 4;
private static final int ALLOWED_TYPE_HIGH_IMPACT = 11;
private static final int ALLOWED_TYPE_NATIVE = 12;
private static final String os = "android";

Expand Down Expand Up @@ -697,6 +699,12 @@ private JSONArray getTagsObject(JSONObject postData) {
tag.put(VIDEO_FRAMEWORKS, omidFrameworksValue);
}
}
if (utRequestParameters.isHighImpactEnabled) {
allowedMediaAdTypes.put(ALLOWED_TYPE_HIGH_IMPACT);
if(!utRequestParameters.isBannerEnabled && SDKSettings.getOMEnabled()) {
tag.put(BANNER_FRAMEWORKS, omidFrameworksValue);
}
}
if (utRequestParameters.isBannerNativeEnabled) {
allowedMediaAdTypes.put(ALLOWED_TYPE_NATIVE);
if(SDKSettings.getOMEnabled()) {
Expand Down Expand Up @@ -1177,4 +1185,12 @@ public int getPublisherId() {
public void setPublisherId(int publisherId) {
this.publisherId = publisherId;
}

public boolean isHighImpactEnabled() {
return isHighImpactEnabled;
}

public void setHighImpactEnabled(boolean highImpactEnabled) {
isHighImpactEnabled = highImpactEnabled;
}
}
70 changes: 70 additions & 0 deletions sdk/test/com/appnexus/opensdk/BannerAdToRequestParametersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ public void testSetAllowBanner(){
bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1,12]"));

bannerAdView.setAllowHighImpactDemand(true);
bannerAdView.setAllowNativeDemand(false);
assertEquals(true,bannerAdView.getAllowHighImpactDemand());
bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1,11]"));



}
Expand Down Expand Up @@ -191,7 +197,71 @@ public void testSetAllowVideoAndNative(){
assertTrue(bannerNativePostData.contains("\"allowed_media_types\":[1,4,12]"));
}

// Test setAllowHighImpact
@Test
public void testSetAllowHighImpact(){
assertEquals(false,bannerAdView.getAllowHighImpactDemand());
String bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1]"));

bannerAdView.setAllowHighImpactDemand(true);
assertEquals(true,bannerAdView.getAllowHighImpactDemand());
String bannerNativePostData = getRequestParametersPostData();
assertTrue(bannerNativePostData.contains("\"allowed_media_types\":[1,11]"));
}

// Test setAllowNative and setAllowHighImpact
@Test
public void testSetAllowNativeAndHighImpact(){
assertEquals(false,bannerAdView.getAllowNativeDemand());
assertEquals(false,bannerAdView.getAllowHighImpactDemand());
String bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1]"));


bannerAdView.setAllowNativeDemand(true);
bannerAdView.setAllowHighImpactDemand(true);
assertEquals(true,bannerAdView.getAllowNativeDemand());
assertEquals(true,bannerAdView.getAllowHighImpactDemand());
String bannerNativePostData = getRequestParametersPostData();
assertTrue(bannerNativePostData.contains("\"allowed_media_types\":[1,11,12]"));
}

// Test setAllowVideo and setAllowHighImpact
@Test
public void testSetAllowVideoAndHighImpact(){
assertEquals(false,bannerAdView.getAllowVideoDemand());
assertEquals(false,bannerAdView.getAllowHighImpactDemand());
String bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1]"));


bannerAdView.setAllowVideoDemand(true);
bannerAdView.setAllowHighImpactDemand(true);
assertEquals(true,bannerAdView.getAllowVideoDemand());
assertEquals(true,bannerAdView.getAllowHighImpactDemand());
String bannerNativePostData = getRequestParametersPostData();
assertTrue(bannerNativePostData.contains("\"allowed_media_types\":[1,4,11]"));
}

// Test setAllowVideo and setAllowHighImpact
@Test
public void testSetAllowVideoNativeAndHighImpact(){
assertEquals(false,bannerAdView.getAllowNativeDemand());
assertEquals(false,bannerAdView.getAllowVideoDemand());
assertEquals(false,bannerAdView.getAllowHighImpactDemand());
String bannerPostData = getRequestParametersPostData();
assertTrue(bannerPostData.contains("\"allowed_media_types\":[1]"));

bannerAdView.setAllowNativeDemand(true);
bannerAdView.setAllowVideoDemand(true);
bannerAdView.setAllowHighImpactDemand(true);
assertEquals(true,bannerAdView.getAllowNativeDemand());
assertEquals(true,bannerAdView.getAllowVideoDemand());
assertEquals(true,bannerAdView.getAllowHighImpactDemand());
String bannerNativePostData = getRequestParametersPostData();
assertTrue(bannerNativePostData.contains("\"allowed_media_types\":[1,4,11,12]"));
}


// Setting MAX size should reset all the other size params set earlier
Expand Down

0 comments on commit 137c80f

Please sign in to comment.