Skip to content

Commit

Permalink
Pull request #733: Release version 8.10
Browse files Browse the repository at this point in the history
Merge in MOBILE-SDK/app_mobile-sdk-android from release_branch_8.10 to master

* commit 'c4ae4e439ab75bfe893315c2d2e8d6d992e4ddc4':
  release version 8.10
  Pull request #731: Fixed: AdResponseMap and response handling, fixed unit test
  Pull request #730: 6014990 Changed Internal Error to Network error for applicable cases and provided additional failure message
  production mvp using npm
  Pull request #727: 6029394 Added Content Language Field in Request
  omid upgrade 1.4.9-microsoft
  upgrade_fb_6.16.0
  • Loading branch information
Ritesh Zaveri committed Jan 10, 2024
2 parents d410c46 + c4ae4e4 commit 9e7a7da
Show file tree
Hide file tree
Showing 25 changed files with 219 additions and 121 deletions.
12 changes: 12 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 8.10

### New Feature
+ 6029394 Added support for setting content language in Ad Request. New API introduced in SDKSettings setContentLanguage(String contentLanguage)
+ 6014990 Changed Internal Error to Network error for applicable cases and provided additional failure message

### Improvement/Bug Fixes
+ 6015110 Upgraded OMSDK from 1.4.8 to 1.4.9 (Microsoft namespace)

### Mediation partner updates
+ 5622337 Upgraded Facebook Audience Network SDK from 6.13.7 to 6.16.0

## 8.9

### New Feature
Expand Down
2 changes: 1 addition & 1 deletion csr/Facebook/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Project Properties
version = "6.13.7" // supported Facebook version
version = "6.16.0" // supported Facebook version

apply plugin: 'com.android.library'

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.48" // Instream SDK version
version = "1.49" // Instream SDK version

apply plugin: 'com.android.library'

Expand All @@ -10,7 +10,7 @@ android {
defaultConfig {
minSdkVersion 14
targetSdkVersion 32
versionCode 47 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 48 // 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
Empty file modified sdk/assets/OMLICENSE
100755 → 100644
Empty file.
113 changes: 57 additions & 56 deletions sdk/assets/apn_omsdk.js

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions sdk/assets/mobilevastplayer.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sdk/assets/optionsparser.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ var outstreamOptions = {

// Default Partner. This will later be overriden by call from native layer to setOMIDPartner.
var partner = {
"name" : "Appnexus", // This option name is to get OMID partner name
"name" : "Microsoft", // This option name is to get OMID partner name
"version" : "Default-version", // This option name is to get OMID partner version
};

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.9"
version = "8.10"
group='com.appnexus.opensdk'

// Android build
Expand All @@ -10,7 +10,7 @@ android {
buildToolsVersion '32.0.0'

defaultConfig {
versionCode 106 // An integer value that represents the version of the code, relative to other versions. Increase for each release.
versionCode 107 // 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
Binary file modified sdk/libs/omsdk.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion sdk/src/com/appnexus/opensdk/BaseNativeAdResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import com.appnexus.opensdk.utils.Settings.ImpressionType;
import com.appnexus.opensdk.viewability.ANOmidAdSession;
import com.appnexus.opensdk.viewability.ANOmidVerificationScriptParseUtil;
import com.iab.omid.library.appnexus.adsession.VerificationScriptResource;
import com.iab.omid.library.microsoft.adsession.VerificationScriptResource;

import org.json.JSONObject;

Expand Down
17 changes: 16 additions & 1 deletion sdk/src/com/appnexus/opensdk/SDKSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.appnexus.opensdk.utils.Settings;
import com.appnexus.opensdk.utils.StringUtil;
import com.appnexus.opensdk.viewability.ANOmidViewabilty;
import com.iab.omid.library.appnexus.Omid;
import com.iab.omid.library.microsoft.Omid;

import java.util.List;
import java.util.concurrent.Executor;
Expand Down Expand Up @@ -336,6 +336,21 @@ public static boolean isLocationEnabledForCreative() {
return Settings.getSettings().locationEnabledForCreative;
}

/**
* The contentLanguage will be passed to request parameters only if it isn't empty
*
* @param contentLanguage The contentLanguage value to use in the ad call.
*/
public static void setContentLanguage(String contentLanguage){
Settings.getSettings().contentLanguage = contentLanguage;
}

/**
* Returns the contentLanguage value that is set using {setContentLanguage}
* */
public static String getContentLanguage() {
return Settings.getSettings().contentLanguage;
}

/**
* Specifies a string that corresponds to the Publisher(First Party) User ID for the current application user.
Expand Down
27 changes: 20 additions & 7 deletions sdk/src/com/appnexus/opensdk/ut/UTAdRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ private void fail(ResultCode code) {

HashMap<String, UTAdResponse> makeRequest() {
Clog.logTime(getClass().getSimpleName() + " - makeRequest");
HashMap<String, UTAdResponse> adResponseMap = new HashMap<>();
try {

Settings.getSettings().deviceAccessAllowed = ANGDPRSettings.canIAccessDeviceData(requestParams.getContext()); // Make sure GDPR device access is allowed.
Expand Down Expand Up @@ -178,7 +179,7 @@ HashMap<String, UTAdResponse> makeRequest() {
// Read request response
int httpResult = conn.getResponseCode();

HashMap<String, UTAdResponse> adResponseMap = new HashMap<>();

if (httpResult == HttpURLConnection.HTTP_OK) {
StringBuilder builder = new StringBuilder();
InputStream is = conn.getInputStream();
Expand Down Expand Up @@ -224,26 +225,32 @@ HashMap<String, UTAdResponse> makeRequest() {
}
} else {
Clog.d(Clog.httpRespLogTag, Clog.getString(R.string.http_bad_status, httpResult));
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true));
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, "httpResultCode::"+httpResult));
}
return adResponseMap;

} catch (SocketTimeoutException e) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, Clog.getString(R.string.http_timeout)));
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.http_timeout));
} catch (IOException e) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, Clog.getString(R.string.http_io)));
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.http_io));
} catch (SecurityException se) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, Clog.getString(R.string.permissions_internet)));
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.permissions_internet));
} catch (IllegalArgumentException ie) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, Clog.getString(R.string.http_unknown)));
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.http_unknown));
} catch (OutOfMemoryError e) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, Clog.getString(R.string.http_ooo)));
e.printStackTrace();
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.http_ooo));
} catch (Exception e) {
adResponseMap.put(requestParams.getUUID(), new UTAdResponse(true, e.getClass().getSimpleName()));
e.printStackTrace();
Clog.e(Clog.httpReqLogTag, Clog.getString(R.string.unknown_exception));
}
return null;
return adResponseMap;
}

private class AsyncRequest extends AsyncTask<Void, Integer, HashMap<String, UTAdResponse>> {
Expand Down Expand Up @@ -278,7 +285,7 @@ void processResponse(HashMap<String, UTAdResponse> adResponseMap) {
ANMultiAdRequest anMultiAdRequest = getMultiAdRequest();
if (anMultiAdRequest == null) {

if (adResponseMap == null) {
if (adResponseMap == null || adResponseMap.isEmpty()) {
Clog.e(Clog.httpRespLogTag, Clog.getString(R.string.no_response));
fail(ResultCode.getNewInstance(ResultCode.INVALID_REQUEST, "Server did not respond and failed to map response"));
return;
Expand All @@ -292,7 +299,7 @@ void processResponse(HashMap<String, UTAdResponse> adResponseMap) {
return; // http request failed
}
if (result.isHttpError()) {
fail(ResultCode.getNewInstance(ResultCode.NETWORK_ERROR));
fail(ResultCode.getNewInstance(ResultCode.NETWORK_ERROR,result.getHttpErrorMessage()));
return;
}

Expand All @@ -305,12 +312,18 @@ void processResponse(HashMap<String, UTAdResponse> adResponseMap) {
}
}
} else if (anMultiAdRequest != null) {
if (adResponseMap == null) {
if (adResponseMap == null || adResponseMap.isEmpty()) {
ResultCode code = ResultCode.getNewInstance(ResultCode.INVALID_REQUEST, "Failed to map response");
Clog.e(Clog.SRMLogTag, "FAILED: " + code.getMessage());
anMultiAdRequest.onRequestFailed(code);
} else {
anMultiAdRequest.onMARLoadCompleted();
if (adResponseMap.containsKey(null)) {
ResultCode code = ResultCode.getNewInstance(ResultCode.INVALID_REQUEST, adResponseMap.get(null).getHttpErrorMessage());
Clog.e(Clog.SRMLogTag, "FAILED: " + code.getMessage());
anMultiAdRequest.onRequestFailed(code);
} else {
anMultiAdRequest.onMARLoadCompleted();
}
}
if (anMultiAdRequest != null && anMultiAdRequest.getAdUnitList() != null && !anMultiAdRequest.getAdUnitList().isEmpty()) {
ArrayList<WeakReference<Ad>> adUnitList = new ArrayList();
Expand Down
9 changes: 8 additions & 1 deletion sdk/src/com/appnexus/opensdk/ut/UTAdResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public class UTAdResponse {


private boolean isHttpError = false;

private String httpErrorMessage = "";
private LinkedList<BaseAdResponse> adList;
private String noAdUrl;
private int tagId;
Expand All @@ -105,8 +107,9 @@ public UTAdResponse(String body, Map<String, List<String>> headers, MediaType re
this(body, null, headers, requestMediaType, orientation);
}

public UTAdResponse(boolean isHttpError) {
public UTAdResponse(boolean isHttpError, String httpErrorMessage) {
this.isHttpError = isHttpError;
this.httpErrorMessage = httpErrorMessage;
}

public UTAdResponse(String body, JSONObject tag, Map<String, List<String>> headers, MediaType requestMediaType, String orientation) {
Expand Down Expand Up @@ -545,6 +548,10 @@ boolean isHttpError() {
return isHttpError;
}

String getHttpErrorMessage(){
return httpErrorMessage;
}

public MediaType getMediaType() {
return mediaType;
}
Expand Down
19 changes: 19 additions & 0 deletions sdk/src/com/appnexus/opensdk/ut/UTRequestParameters.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ public class UTRequestParameters {
private static final String GPP_SID = "gpp_sid";
private static final String GPP = "gpp";

// Content Language
private static final String REQUEST_CONTENT = "request_content";
private static final String CONTENT_LANGUAGE = "language";

private static final int ALLOWED_TYPE_BANNER = 1;
private static final int ALLOWED_TYPE_INTERSTITIAL = 3;
Expand Down Expand Up @@ -519,6 +522,11 @@ String getPostData() {
postData.put(AUCTION_TIMEOUT_MS, auctionTimeout);
}

// add contentLanguage
JSONObject contentLanguage = getContentLanguage();
if (contentLanguage != null && contentLanguage.length() > 0) {
postData.put(REQUEST_CONTENT, contentLanguage);
}

// add app
JSONObject app = getAppObject();
Expand Down Expand Up @@ -632,6 +640,17 @@ private JSONObject getGeoOverride() {
return null;
}

private JSONObject getContentLanguage() {
JSONObject contentLanguage = new JSONObject();
try {
if (!StringUtil.isEmpty(SDKSettings.getContentLanguage())) {
contentLanguage.put(CONTENT_LANGUAGE, SDKSettings.getContentLanguage());
}
}catch (JSONException e) {
}
return contentLanguage;
}

private String orientation;

public String getOrientation() {
Expand Down
4 changes: 3 additions & 1 deletion sdk/src/com/appnexus/opensdk/utils/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public enum ImpressionType {
public boolean debug_mode = false; // This should always be false here.
public String ua = null;

public final String sdkVersion = "8.9";
public final String sdkVersion = "8.10";
// BuildConfig.VERSION_NAME;


Expand Down Expand Up @@ -99,6 +99,8 @@ public enum ImpressionType {
public String publisherUserId = "";
public List<ANUserId> userIds = new ArrayList<>();

public String contentLanguage;

/**
* @deprecated
* This feature flag is responsible for turning on/off ib.adnxs-simple.com domain usage.
Expand Down
22 changes: 11 additions & 11 deletions sdk/src/com/appnexus/opensdk/viewability/ANOmidAdSession.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
import com.appnexus.opensdk.SDKSettings;
import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.StringUtil;
import com.iab.omid.library.appnexus.ScriptInjector;
import com.iab.omid.library.appnexus.adsession.AdEvents;
import com.iab.omid.library.appnexus.adsession.AdSession;
import com.iab.omid.library.appnexus.adsession.AdSessionConfiguration;
import com.iab.omid.library.appnexus.adsession.AdSessionContext;
import com.iab.omid.library.appnexus.adsession.CreativeType;
import com.iab.omid.library.appnexus.adsession.ImpressionType;
import com.iab.omid.library.appnexus.adsession.Owner;
import com.iab.omid.library.appnexus.adsession.VerificationScriptResource;
import com.iab.omid.library.microsoft.ScriptInjector;
import com.iab.omid.library.microsoft.adsession.AdEvents;
import com.iab.omid.library.microsoft.adsession.AdSession;
import com.iab.omid.library.microsoft.adsession.AdSessionConfiguration;
import com.iab.omid.library.microsoft.adsession.AdSessionContext;
import com.iab.omid.library.microsoft.adsession.CreativeType;
import com.iab.omid.library.microsoft.adsession.ImpressionType;
import com.iab.omid.library.microsoft.adsession.Owner;
import com.iab.omid.library.microsoft.adsession.VerificationScriptResource;

import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -64,7 +64,7 @@ public void initAdSession(WebView webView, boolean isVideoAd) {

try {
String customReferenceData = "";
AdSessionContext adSessionContext = AdSessionContext.createHtmlAdSessionContext(ANOmidViewabilty.getInstance().getAppnexusPartner(), webView, null, customReferenceData);
AdSessionContext adSessionContext = AdSessionContext.createHtmlAdSessionContext(ANOmidViewabilty.getInstance().getMicrosoftPartner(), webView, null, customReferenceData);

Owner owner = isVideoAd ? Owner.JAVASCRIPT : Owner.NATIVE;

Expand Down Expand Up @@ -92,7 +92,7 @@ public void initNativeAdSession(View view) {
return;
try {

AdSessionContext adSessionContext = AdSessionContext.createNativeAdSessionContext(ANOmidViewabilty.getInstance().getAppnexusPartner(), ANOmidViewabilty.getInstance().getOmidJsServiceContent(), verificationScriptResources, null, null);
AdSessionContext adSessionContext = AdSessionContext.createNativeAdSessionContext(ANOmidViewabilty.getInstance().getMicrosoftPartner(), ANOmidViewabilty.getInstance().getOmidJsServiceContent(), verificationScriptResources, null, null);
AdSessionConfiguration adSessionConfiguration =
AdSessionConfiguration.createAdSessionConfiguration(CreativeType.NATIVE_DISPLAY, ImpressionType.VIEWABLE, Owner.NATIVE, null, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.JsonUtil;
import com.iab.omid.library.appnexus.adsession.VerificationScriptResource;
import com.iab.omid.library.microsoft.adsession.VerificationScriptResource;

import org.json.JSONObject;

Expand Down
16 changes: 8 additions & 8 deletions sdk/src/com/appnexus/opensdk/viewability/ANOmidViewabilty.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import com.appnexus.opensdk.utils.Clog;
import com.appnexus.opensdk.utils.Settings;
import com.appnexus.opensdk.utils.StringUtil;
import com.iab.omid.library.appnexus.Omid;
import com.iab.omid.library.appnexus.adsession.Partner;
import com.iab.omid.library.microsoft.Omid;
import com.iab.omid.library.microsoft.adsession.Partner;

import java.io.BufferedReader;
import java.io.IOException;
Expand All @@ -35,10 +35,10 @@
public class ANOmidViewabilty {

private static ANOmidViewabilty omid_instance = null;
public static final String OMID_PARTNER_NAME = "Appnexus";
public static final String OMID_PARTNER_NAME = "Microsoft";
private static String OMID_JS_SERVICE_CONTENT = "";

private static Partner appnexusPartner = null;
private static Partner microsoftPartner = null;

public static ANOmidViewabilty getInstance() {
if (omid_instance == null) {
Expand Down Expand Up @@ -68,9 +68,9 @@ public void activateOmidAndCreatePartner(Context applicationContext) {


// If OMID active but partner is null then create partner
if (Omid.isActive() && appnexusPartner == null) {
if (Omid.isActive() && microsoftPartner == null) {
try {
appnexusPartner = Partner.createPartner(OMID_PARTNER_NAME, Settings.getSettings().sdkVersion);
microsoftPartner = Partner.createPartner(OMID_PARTNER_NAME, Settings.getSettings().sdkVersion);
} catch (IllegalArgumentException e) {
e.printStackTrace();
}
Expand All @@ -86,8 +86,8 @@ public void activateOmidAndCreatePartner(Context applicationContext) {

}

public Partner getAppnexusPartner() {
return appnexusPartner;
public Partner getMicrosoftPartner() {
return microsoftPartner;
}

public String getOmidJsServiceContent() {
Expand Down
Loading

0 comments on commit 9e7a7da

Please sign in to comment.