Skip to content

Commit

Permalink
Release 3.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
UnitySteven committed Mar 19, 2021
1 parent 2417560 commit 2606de4
Show file tree
Hide file tree
Showing 107 changed files with 2,679 additions and 1,049 deletions.
12 changes: 6 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ android {
applicationId "com.unity3d.ads.example"
minSdkVersion 19
targetSdkVersion 30
versionCode = 3620
versionName = "3.6.2"
versionCode = 3700
versionName = "3.7.0"
}

flavorDimensions "arEnabled"
Expand All @@ -36,10 +36,10 @@ android {

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.android.support:appcompat-v7:26.1.0'
implementation 'com.android.support:design:26.1.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'android.arch.lifecycle:extensions:1.1.1'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.lifecycle:lifecycle-extensions:2.0.0'
arImplementation 'com.google.ar:core:1.4.0'
implementation project(':unity-ads')
}
12 changes: 3 additions & 9 deletions app/src/main/java/com/unity3d/ads/example/UnityAdsTestApp.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
package com.unity3d.ads.example;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;

import androidx.viewpager.widget.ViewPager;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.material.tabs.TabLayout;
import com.unity3d.ads.example.ui.main.SectionsPagerAdapter;

public class UnityAdsTestApp extends AppCompatActivity {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
package com.unity3d.ads.example.ui.main;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.unity3d.ads.example.R;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

/**
* A [FragmentPagerAdapter] that returns a fragment corresponding to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import android.view.animation.AlphaAnimation;
import android.widget.Button;
import android.widget.CheckBox;
Expand All @@ -29,12 +29,8 @@
import com.unity3d.services.banners.view.BannerPosition;
import com.unity3d.services.core.log.DeviceLog;
import com.unity3d.services.core.misc.Utilities;
import com.unity3d.services.core.properties.SdkProperties;
import com.unity3d.services.core.webview.WebView;

import java.net.MalformedURLException;
import java.net.URISyntaxException;

/**
* A placeholder fragment containing a simple view.
*/
Expand Down
12 changes: 6 additions & 6 deletions app/src/main/res/layout/activity_unity_ads_test_app.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".UnityAdsTestApp">

<android.support.design.widget.AppBarLayout
<com.google.android.material.appbar.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.AppBarOverlay">
Expand All @@ -21,17 +21,17 @@
android:text="@string/app_name"
android:textAppearance="@style/TextAppearance.Widget.AppCompat.Toolbar.Title" />

<android.support.design.widget.TabLayout
<com.google.android.material.tabs.TabLayout
android:id="@+id/tabs"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/colorPrimary" />
</android.support.design.widget.AppBarLayout>
</com.google.android.material.appbar.AppBarLayout>

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior" />

</android.support.design.widget.CoordinatorLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ buildscript {
jcenter()
google()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.4'

dependencies {
classpath 'com.android.tools.build:gradle:3.2.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# org.gradle.parallel=true
android.useAndroidX=true
49 changes: 24 additions & 25 deletions unity-ads/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ ext {
siteUrl = 'https://github.com/Unity-Technologies/unity-ads-android'
gitUrl = 'https://github.com/Unity-Technologies/unity-ads-android.git'

libraryVersion = '3.6.2'
libraryVersion = '3.7.0'

developerId = 'sbankhead'
developerName = 'Steven Bankhead'
Expand All @@ -31,7 +31,7 @@ ext {
version = libraryVersion

android {
compileSdkVersion 26
compileSdkVersion 30
buildToolsVersion '28.0.2'
com.android.ddmlib.DdmPreferences.setLogLevel("verbose")
com.android.ddmlib.DdmPreferences.setTimeOut(10 * 60000)
Expand All @@ -40,7 +40,7 @@ android {

defaultConfig {
minSdkVersion 19
targetSdkVersion 29
targetSdkVersion 30
/*
Please ensure that the last two digits of version number does not exceed 50 unless
it is a China SDK. This is because adding 50 to the version number is a one-to-one
Expand All @@ -51,16 +51,15 @@ android {
All SDK with version numbers with last two digits >= 50 will be treated
as China SDK for filtering in the backend.
*/
versionCode = 3620
versionName = "3.6.2"
versionCode = 3700
versionName = "3.7.0"

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

buildConfigField 'String', 'WEBVIEW_BRANCH', getPropertyStringWithDefaultValue('WEBVIEW_BRANCH', '"' + versionName + '"')

buildConfigField('String', 'WEBVIEW_BRANCH', getPropertyStringWithDefaultValue('WEBVIEW_BRANCH', '"' + versionName + '"'))
testBuildType "debug"

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
testInstrumentationRunnerArguments disableAnalytics: 'true' // Won't work yet, see: https://code.google.com/p/android/issues/detail?id=188241
}

Expand Down Expand Up @@ -99,31 +98,31 @@ android {

dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'org.mockito:mockito-core:2.19.1'
androidTestImplementation 'org.mockito:mockito-android:2.19.1'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'org.mockito:mockito-core:2.25.0'
androidTestImplementation 'org.mockito:mockito-android:2.25.0'
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test:rules:1.1.1'
compileOnly 'com.google.ar:core:1.0.0'
}

task javadoc(type: Javadoc, overwrite: true) {
description "Generates Javadoc for Release"
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
doFirst {
classpath = project.files(android.getBootClasspath().join(File.pathSeparator)) + files(ext.androidJar)
}
description "Generates Javadoc for Release"
source = android.sourceSets.main.java.srcDirs
ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar"
doFirst {
classpath = project.files(android.getBootClasspath().join(File.pathSeparator)) + files(ext.androidJar)
}
options {
links "http://docs.oracle.com/javase/7/docs/api/"
linksOffline "http://developer.android.com/reference","${android.sdkDirectory}/docs/reference"
}
exclude '**/R.java'
exclude 'com/unity3d/services/ar/view/GLSurfaceView.java'
exclude 'com/unity3d/services/ar/api/AR.java'
exclude 'com/unity3d/services/ar/view/ARView.java'
exclude 'com/unity3d/services/ar/view/ARViewHandler.java'
destinationDir = file("../javadoc/")
}
exclude '**/R.java'
exclude 'com/unity3d/services/ar/view/GLSurfaceView.java'
exclude 'com/unity3d/services/ar/api/AR.java'
exclude 'com/unity3d/services/ar/view/ARView.java'
exclude 'com/unity3d/services/ar/view/ARViewHandler.java'
destinationDir = file("../javadoc/")
}

task androidJavadocsJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
package com.unity3d.ads.test;

import com.unity3d.ads.test.instrumentation.services.ads.load.LoadModuleTest;
import com.unity3d.ads.test.instrumentation.services.ads.operation.AdOperationTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleDecoratorInitializationBufferTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleDecoratorTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleDecoratorTimeoutTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadModuleTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.LoadOperationTests;
import com.unity3d.ads.test.instrumentation.services.ads.operation.ShowModuleTests;
import com.unity3d.ads.test.instrumentation.services.ads.properties.AdsPropertiesTests;
import com.unity3d.ads.test.instrumentation.services.ads.webplayer.WebPlayerViewCacheTest;
import com.unity3d.ads.test.instrumentation.services.ads.webplayer.WebPlayerViewSettingsCacheTest;
import com.unity3d.ads.test.instrumentation.services.banners.BannerViewCacheTests;
import com.unity3d.ads.test.instrumentation.services.core.configuration.InitializationNotificationCenterTest;
import com.unity3d.ads.test.instrumentation.services.core.webview.bridge.WebViewBridgeSharedObjectTests;
import com.unity3d.ads.test.instrumentation.services.core.webview.bridge.invocation.WebViewBridgeInvocationTests;
import com.unity3d.ads.test.legacy.ConfigurationTest;
import com.unity3d.services.analytics.AcquisitionTypeTest;
import com.unity3d.services.analytics.UnityAnalyticsTest;

Expand All @@ -18,11 +27,20 @@
AcquisitionTypeTest.class,
AdsPropertiesTests.class,
InitializationNotificationCenterTest.class,
LoadModuleTest.class,
// LoadBridgeTest.class,
WebPlayerViewSettingsCacheTest.class,
WebPlayerViewCacheTest.class,
BannerViewCacheTests.class
BannerViewCacheTests.class,
WebViewBridgeSharedObjectTests.class,
WebViewBridgeInvocationTests.class,
LoadOperationTests.class,
LoadModuleTests.class,
LoadModuleDecoratorTimeoutTests.class,
LoadModuleDecoratorTests.class,
LoadModuleDecoratorInitializationBufferTests.class,
AdOperationTests.class,
ShowModuleTests.class,
ConfigurationTest.class
})

public class InstrumentationTestSuite {}
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,9 @@ public static <T> T[] concat(T[] first, T[] second) {
return result;
}

public static void SleepCurrentThread(int timeInMilliseconds) {
try {
Thread.sleep(timeInMilliseconds);
} catch (InterruptedException e) { }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,41 +4,40 @@
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;

import android.telephony.TelephonyManager;
import android.test.ActivityInstrumentationTestCase2;

import com.unity3d.services.ads.adunit.AdUnitActivity;
import com.unity3d.services.core.request.WebRequest;
import com.unity3d.ads.test.TestUtilities;

import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

import java.io.File;

import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

@RunWith(AndroidJUnit4.class)
public class EnvironmentTest extends ActivityInstrumentationTestCase2<AdUnitActivity> {
public class EnvironmentTest extends ActivityTestRule<AdUnitActivity> {

public EnvironmentTest () {
super(AdUnitActivity.class);
}

@Before
public void beforeTest () {
injectInstrumentation(InstrumentationRegistry.getInstrumentation());
}

@Test
public void testWifiEnabled () {
ConnectivityManager mConnectivity;
boolean isWifi = false;

mConnectivity = (ConnectivityManager) InstrumentationRegistry.getTargetContext().getSystemService(Context.CONNECTIVITY_SERVICE);
mConnectivity = (ConnectivityManager) InstrumentationRegistry.getInstrumentation().getTargetContext().getSystemService(Context.CONNECTIVITY_SERVICE);
TelephonyManager mTelephony;
mTelephony = (TelephonyManager)InstrumentationRegistry.getTargetContext().getSystemService(Context.TELEPHONY_SERVICE);
mTelephony = (TelephonyManager)InstrumentationRegistry.getInstrumentation().getTargetContext().getSystemService(Context.TELEPHONY_SERVICE);

// Skip if no connection, or background data disabled
if (mConnectivity != null) {
Expand Down Expand Up @@ -68,15 +67,15 @@ public void testRequest () throws Exception {

@Test
public void testStorageAccess () {
File cacheDir = getCacheDirectory(InstrumentationRegistry.getTargetContext());
File cacheDir = getCacheDirectory(InstrumentationRegistry.getInstrumentation().getTargetContext());
assertNotNull("Cache directory is null", cacheDir);
assertTrue("Cannot read cache directory: " + cacheDir, cacheDir.canRead());
assertTrue("Cannot write to cache directory: " + cacheDir, cacheDir.canWrite());
}

@Test
public void testStorageSpace () {
File cacheDir = getCacheDirectory(InstrumentationRegistry.getTargetContext());
File cacheDir = getCacheDirectory(InstrumentationRegistry.getInstrumentation().getTargetContext());
assertNotNull("Cache directory is null", cacheDir);
assertTrue("Target cache (" + cacheDir + ") doesn't have enough space left", cacheDir.getFreeSpace() > 2000000);
assertTrue("Cannot read cache directory: " + cacheDir, cacheDir.canRead());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
package com.unity3d.ads.test.hybrid;

import android.os.Build;
import android.support.test.rule.ActivityTestRule;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.rule.ActivityTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;

import com.unity3d.ads.UnityAds;
import com.unity3d.services.core.configuration.Configuration;
import com.unity3d.services.core.configuration.IModuleConfiguration;
import com.unity3d.services.core.configuration.InitializeThread;
import com.unity3d.services.core.misc.Utilities;
import com.unity3d.services.core.properties.ClientProperties;
Expand All @@ -23,7 +22,6 @@
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;

Expand Down
Loading

0 comments on commit 2606de4

Please sign in to comment.