Skip to content

Commit 1cfae31

Browse files
author
Unity Ads Travis
committed
Release 2.1.2
1 parent e9d882a commit 1cfae31

File tree

17 files changed

+216
-94
lines changed

17 files changed

+216
-94
lines changed

Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ setup-adb-reverse:
4545
dismantle-adb-reverse:
4646
adb reverse --remove-all
4747

48-
sonar:
49-
./gradlew sonarqube --info
50-
5148
javadoc:
5249
./gradlew :lib:generateReleaseJavadoc
5350

app/build.gradle

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,29 @@ apply plugin: 'com.android.application'
22

33
android {
44
compileSdkVersion 25
5-
buildToolsVersion '25.0.3'
5+
buildToolsVersion '27.0.1'
66

77
defaultConfig {
88
applicationId "com.unity3d.ads.example"
99
minSdkVersion 9
1010
targetSdkVersion 23
11-
versionCode = 2101
12-
versionName = "2.1.1"
11+
versionCode = 2102
12+
versionName = "2.1.2"
1313
}
1414
buildTypes {
1515
release {
1616
minifyEnabled false
1717
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
1818
}
1919
}
20+
compileOptions {
21+
sourceCompatibility JavaVersion.VERSION_1_7
22+
targetCompatibility JavaVersion.VERSION_1_7
23+
}
2024
}
2125

2226
dependencies {
23-
compile fileTree(dir: 'libs', include: ['*.jar'])
24-
compile 'com.android.support:appcompat-v7:25.3.1'
25-
debugCompile project(path: ':lib', configuration: "debug")
26-
releaseCompile project(path: ':lib', configuration: "release")
27+
implementation fileTree(include: ['*.jar'], dir: 'libs')
28+
implementation 'com.android.support:appcompat-v7:25.4.0'
29+
implementation project(':lib')
2730
}

build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,19 @@
22
buildscript {
33
repositories {
44
jcenter()
5+
google()
56
}
67
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.3.3'
8+
classpath 'com.android.tools.build:gradle:3.0.0'
89

910
// NOTE: Do not place your application dependencies here; they belong
1011
// in the individual module build.gradle files
1112
}
1213
}
1314

14-
plugins {
15-
id "org.sonarqube" version "1.2"
16-
}
17-
1815
allprojects {
1916
repositories {
2017
jcenter()
18+
google()
2119
}
2220
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Mon Mar 13 13:00:46 EET 2017
1+
#Tue Nov 14 14:59:02 EET 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.3.1-all.zip

lib/build.gradle

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,17 @@ apply plugin: 'com.android.library'
22

33
android {
44
compileSdkVersion 25
5-
buildToolsVersion '25.0.3'
5+
buildToolsVersion '27.0.1'
66
com.android.ddmlib.DdmPreferences.setLogLevel("verbose")
77
com.android.ddmlib.DdmPreferences.setTimeOut(10 * 60000)
88

99
defaultPublishConfig "release"
10-
publishNonDefault true
1110

1211
defaultConfig {
1312
minSdkVersion 9
1413
targetSdkVersion 23
15-
versionCode = 2101
16-
versionName = "2.1.1"
14+
versionCode = 2102
15+
versionName = "2.1.2"
1716

1817
setProperty("archivesBaseName", "unity-ads")
1918

@@ -45,45 +44,29 @@ android {
4544
consumerProguardFiles 'proguard-rules.pro'
4645
signingConfig signingConfigs.debug
4746
buildConfigField 'String', 'WEBVIEW_BRANCH', getPropertyStringWithDefaultValue('WEBVIEW_BRANCH', '"development"')
48-
sonarqube {
49-
properties {
50-
property "sonar.projectKey", "unity-ads-android"
51-
property "sonar.projectName", "UnityAds SDK Android"
52-
property "sonar.projectVersion", "2.0.0"
53-
property "sonar.sourceEncoding", "UTF-8"
54-
property "sonar.host.url", "${System.env.SONAR_HOST}"
55-
property "sonar.language", "java"
56-
property "sonar.sources", "lib/src"
57-
property "sonar.java.binaries", "lib/build/intermediates/classes/coverage/"
58-
property "sonar.java.libraries", "${System.env.ANDROID_SDK_ROOT}/platforms/android-23/android.jar"
59-
property "sonar.projectBaseDir", "."
60-
property "sonar.junit.reportsPath", "lib/build/outputs/androidTest-results/connected"
61-
property "sonar.jacoco.reportPath", "lib/build/outputs/code-coverage/connected/coverage.ec"
62-
}
63-
}
6447
}
6548
}
6649
}
6750

6851
dependencies {
69-
testCompile 'junit:junit:4.12'
70-
androidTestCompile 'org.mockito:mockito-core:1.10.19'
71-
androidTestCompile 'com.android.support.test:runner:0.5'
72-
androidTestCompile 'com.android.support.test:rules:0.5'
52+
testImplementation 'junit:junit:4.12'
53+
androidTestImplementation 'org.mockito:mockito-core:1.10.19'
54+
androidTestImplementation 'com.android.support.test:runner:1.0.1'
55+
androidTestImplementation 'com.android.support.test:rules:1.0.1'
7356
}
7457

7558
android.testVariants.all { variant ->
76-
variant.outputs.each { output ->
77-
output.outputFile = new File(output.outputFile.parent, "androidTest.apk")
59+
variant.outputs.all { output ->
60+
outputFileName = "../../androidTest.apk"
7861
}
7962
}
8063

8164
android.libraryVariants.all { variant ->
8265
task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
8366
description "Generates Javadoc for $variant.name."
84-
source = variant.javaCompile.source
67+
source = variant.javaCompiler.source
8568
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
86-
classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar)
69+
classpath = files(variant.javaCompiler.classpath.files) + files(ext.androidJar)
8770
options {
8871
links "http://docs.oracle.com/javase/7/docs/api/"
8972
linksOffline "http://developer.android.com/reference","${android.sdkDirectory}/docs/reference"
@@ -94,11 +77,11 @@ android.libraryVariants.all { variant ->
9477
}
9578

9679
def getPropertyStringWithDefaultValue(String key, String defaultValue) {
97-
def value = project.getProperties().get(key);
80+
def value = project.getProperties().get(key)
9881
// Ensure that string is quoted
9982
if ((value != null) && (!(value ==~ /^".*"$/)) ){
100-
println "Value for key '$key' is not quoted, adding quotes to '$value'";
101-
value = "\"$value\"";
83+
println "Value for key '$key' is not quoted, adding quotes to '$value'"
84+
value = "\"$value\""
10285
}
103-
return value != null ? value : defaultValue;
86+
return value != null ? value : defaultValue
10487
}

lib/src/androidTest/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
88

99
<application android:allowBackup="true"
10-
android:label="@string/app_name">
10+
android:label="Unity Ads 2.1">
1111
<activity
1212
android:name="com.unity3d.ads.test.hybrid.HybridTestActivity"
1313
android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen"

lib/src/androidTest/java/com/unity3d/ads/test/unit/AdUnitActivityTestBaseClass.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ public void run() {
120120
private boolean allowEvents = true;
121121
@Override
122122
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
123+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
124+
return true;
125+
}
123126
if (allowEvents) {
124127
EVENT_CATEGORIES.add(eventCategory);
125128
EVENTS.add(eventId);
@@ -152,6 +155,9 @@ protected Activity waitForActivityStart (final Intent intent) {
152155

153156
@Override
154157
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
158+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
159+
return true;
160+
}
155161
if (allowEvents) {
156162

157163
DeviceLog.debug(eventId.name());

lib/src/androidTest/java/com/unity3d/ads/test/unit/VideoViewTest.java

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,9 @@ public void testPrepareAndPlay () throws Exception {
111111
@Override
112112
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
113113
super.sendEvent(eventCategory, eventId, params);
114-
114+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
115+
return true;
116+
}
115117
if (allowEvents) {
116118
EVENT_CATEGORIES.add(eventCategory);
117119
EVENTS.add(eventId);
@@ -172,7 +174,9 @@ public void testPrepareAndPlayNonExistingUrl () throws Exception {
172174
@Override
173175
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
174176
super.sendEvent(eventCategory, eventId, params);
175-
177+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
178+
return true;
179+
}
176180
if (allowEvents) {
177181
EVENT_CATEGORIES.add(eventCategory);
178182
EVENTS.add(eventId);
@@ -235,6 +239,10 @@ public void testPreparePlaySeekToPause () throws Exception {
235239
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
236240
super.sendEvent(eventCategory, eventId, params);
237241

242+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
243+
return true;
244+
}
245+
238246
EVENT_CATEGORIES.add(eventCategory);
239247
EVENTS.add(eventId);
240248
EVENT_PARAMS = params;
@@ -294,6 +302,10 @@ public void testPreparePlayStop () throws Exception {
294302
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
295303
super.sendEvent(eventCategory, eventId, params);
296304

305+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
306+
return true;
307+
}
308+
297309
EVENT_CATEGORIES.add(eventCategory);
298310
EVENTS.add(eventId);
299311
EVENT_PARAMS = params;
@@ -350,6 +362,10 @@ public void testPreparePlaySetVolumePause () throws Exception {
350362
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
351363
super.sendEvent(eventCategory, eventId, params);
352364

365+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
366+
return true;
367+
}
368+
353369
EVENT_CATEGORIES.add(eventCategory);
354370
EVENTS.add(eventId);
355371
EVENT_PARAMS = params;
@@ -410,6 +426,10 @@ public void testSetProgressInterval () throws Exception {
410426
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
411427
super.sendEvent(eventCategory, eventId, params);
412428

429+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
430+
return true;
431+
}
432+
413433
EVENT_CATEGORIES.add(eventCategory);
414434
EVENTS.add(eventId);
415435
EVENT_PARAMS = params;
@@ -489,6 +509,10 @@ public void testPreparePlayPause () throws Exception {
489509
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
490510
super.sendEvent(eventCategory, eventId, params);
491511

512+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
513+
return true;
514+
}
515+
492516
EVENT_CATEGORIES.add(eventCategory);
493517
EVENTS.add(eventId);
494518
EVENT_PARAMS = params;
@@ -546,6 +570,10 @@ public void testInfoListener () throws Exception {
546570
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
547571
super.sendEvent(eventCategory, eventId, params);
548572

573+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
574+
return true;
575+
}
576+
549577
EVENT_CATEGORIES.add(eventCategory);
550578
EVENTS.add(eventId);
551579
EVENT_PARAMS = params;
@@ -607,6 +635,10 @@ public void testDisableInfoListener () throws Exception {
607635
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
608636
super.sendEvent(eventCategory, eventId, params);
609637

638+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
639+
return true;
640+
}
641+
610642
EVENT_CATEGORIES.add(eventCategory);
611643
EVENTS.add(eventId);
612644
EVENT_PARAMS = params;
@@ -669,6 +701,10 @@ public void testEnableInfoListener () throws Exception {
669701
public boolean sendEvent(Enum eventCategory, Enum eventId, Object... params) {
670702
super.sendEvent(eventCategory, eventId, params);
671703

704+
if ("ON_FOCUS_GAINED".equals(eventId.name()) || "ON_FOCUS_LOST".equals(eventId.name())) {
705+
return true;
706+
}
707+
672708
EVENT_CATEGORIES.add(eventCategory);
673709
EVENTS.add(eventId);
674710
EVENT_PARAMS = params;

lib/src/androidTest/java/com/unity3d/ads/test/unit/VolumeChangeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.os.Handler;
88
import android.os.Looper;
99
import android.support.test.filters.RequiresDevice;
10+
import android.support.test.filters.SdkSuppress;
1011
import android.view.ViewGroup;
1112

1213
import com.unity3d.ads.api.DeviceInfo;
@@ -31,6 +32,7 @@ public void setup() {
3132

3233
@Test
3334
@RequiresDevice
35+
@SdkSuppress(minSdkVersion = 21)
3436
public void testVolumeChange() throws Exception {
3537
final Activity activity = waitForActivityStart(null);
3638

@@ -100,6 +102,7 @@ public void run() {
100102
IVolumeChangeListener vcl = new IVolumeChangeListener() {
101103
@Override
102104
public void onVolumeChanged(int volume) {
105+
DeviceLog.debug("VOLUME_CHANGED: " + volume);
103106
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.DEVICEINFO, DeviceInfo.DeviceInfoEvent.VOLUME_CHANGED, volume);
104107
}
105108

@@ -118,6 +121,9 @@ public int getStreamType() {
118121
mockWebViewApp.CONDITION_VARIABLE = cv;
119122
success = cv.block(3000);
120123

124+
assertNotNull("WebViewApp NULL", mockWebViewApp);
125+
assertNotNull("EVENT_PARAMS NULL (params never received?)", mockWebViewApp.EVENT_PARAMS);
126+
assertNotNull("First EVENT_PARAMS NULL", mockWebViewApp.EVENT_PARAMS[0]);
121127
assertEquals("Volume not what was expected", 1, (int)mockWebViewApp.EVENT_PARAMS[0]);
122128

123129
VolumeChange.unregisterListener(vcl);

lib/src/main/java/com/unity3d/ads/adunit/AdUnitActivity.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,15 @@ public boolean onKeyDown(int keyCode, KeyEvent event) {
214214
return false;
215215
}
216216

217+
@Override public void onWindowFocusChanged(boolean hasFocus) {
218+
if (hasFocus) {
219+
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_FOCUS_GAINED, _activityId);
220+
} else {
221+
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.ADUNIT, AdUnitEvent.ON_FOCUS_LOST, _activityId);
222+
}
223+
super.onWindowFocusChanged(hasFocus);
224+
}
225+
217226
/* API */
218227

219228
public void setViewFrame (String view, int x, int y, int width, int height) {

0 commit comments

Comments
 (0)