diff --git a/Makefile b/Makefile index 5cf6bdb..7fc2926 100644 --- a/Makefile +++ b/Makefile @@ -58,3 +58,8 @@ sonar: javadoc: ./gradlew :lib:generateReleaseJavadoc + +zip: release + cp lib/build/outputs/aar/unity-ads-release.aar unity-ads.aar + zip -9r builds.zip unity-ads.aar + rm unity-ads.aar \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 4ab6d98..f3437f2 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -8,8 +8,8 @@ android { applicationId "com.unity3d.ads.example" minSdkVersion 9 targetSdkVersion 23 - versionCode = 2006 - versionName = "2.0.6" + versionCode = 2007 + versionName = "2.0.7" } buildTypes { release { diff --git a/lib/build.gradle b/lib/build.gradle index 33525ce..5c441f7 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -12,8 +12,8 @@ android { defaultConfig { minSdkVersion 9 targetSdkVersion 23 - versionCode = 2006 - versionName = "2.0.6" + versionCode = 2007 + versionName = "2.0.7" setProperty("archivesBaseName", "unity-ads") diff --git a/lib/src/androidTest/java/com/unity3d/ads/test/unit/MetaDataTest.java b/lib/src/androidTest/java/com/unity3d/ads/test/unit/MetaDataTest.java index 0f1207c..3e27eb7 100644 --- a/lib/src/androidTest/java/com/unity3d/ads/test/unit/MetaDataTest.java +++ b/lib/src/androidTest/java/com/unity3d/ads/test/unit/MetaDataTest.java @@ -14,8 +14,8 @@ import org.junit.After; import org.junit.BeforeClass; import org.junit.Test; import org.junit.runner.RunWith; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.assertEquals; +import static org.junit.Assert.*; + import java.util.HashMap; @RunWith(AndroidJUnit4.class) @@ -109,6 +109,17 @@ public class MetaDataTest { } } + @Test + public void testCommitWithoutMetaDataSet () throws Exception { + WebViewApp.setCurrentApp(new MetaDataWebApp()); + MetaData metaData = new MetaData(ClientProperties.getApplicationContext()); + metaData.setCategory("test"); + metaData.commit(); + + assertNull("Entries should still be null", metaData.getEntries()); + } + + private class MetaDataWebApp extends WebViewApp { public Object[] PARAMS = null; public Enum EVENT_CATEOGRY = null; diff --git a/lib/src/main/java/com/unity3d/ads/metadata/MetaData.java b/lib/src/main/java/com/unity3d/ads/metadata/MetaData.java index 7855b5e..ace603a 100644 --- a/lib/src/main/java/com/unity3d/ads/metadata/MetaData.java +++ b/lib/src/main/java/com/unity3d/ads/metadata/MetaData.java @@ -49,17 +49,20 @@ public class MetaData { if (StorageManager.init(_context)) { Storage storage = StorageManager.getStorage(StorageManager.StorageType.PUBLIC); - for (String key : _metaData.keySet()) { + if (_metaData != null) { + for (String key : _metaData.keySet()) { + if (storage != null) { + storage.set(key, _metaData.get(key)); + } + } + if (storage != null) { - storage.set(key, _metaData.get(key)); + storage.writeStorage(); + storage.sendEvent(StorageEvent.SET, _metaData); } } - - if (storage != null) { - storage.writeStorage(); - storage.sendEvent(StorageEvent.SET, _metaData); - } - } else { + } + else { DeviceLog.error("Unity Ads could not commit metadata due to storage error"); } }