Skip to content

Commit b829a73

Browse files
author
Unity Ads Travis
committed
Release 2.0.8
1 parent 71128ac commit b829a73

File tree

9 files changed

+46
-41
lines changed

9 files changed

+46
-41
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ android {
88
applicationId "com.unity3d.ads.example"
99
minSdkVersion 9
1010
targetSdkVersion 23
11-
versionCode = 2007
12-
versionName = "2.0.7"
11+
versionCode = 2008
12+
versionName = "2.0.8"
1313
}
1414
buildTypes {
1515
release {

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ buildscript {
44
jcenter()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:2.2.2'
7+
classpath 'com.android.tools.build:gradle:2.2.3'
88

99
// NOTE: Do not place your application dependencies here; they belong
1010
// in the individual module build.gradle files

lib/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ android {
1212
defaultConfig {
1313
minSdkVersion 9
1414
targetSdkVersion 23
15-
versionCode = 2007
16-
versionName = "2.0.7"
15+
versionCode = 2008
16+
versionName = "2.0.8"
1717

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

lib/src/androidTest/java/com/unity3d/ads/test/environment/EnvironmentTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public void testWifiEnabled () {
5858
}
5959

6060
@Test
61-
public void testRequest () throws IOException {
61+
public void testRequest () throws IOException, IllegalStateException{
6262
WebRequest request = new WebRequest(TestUtilities.getTestServerAddress() + "/testconfig.json", "GET", null);
6363
String data = request.makeRequest();
6464

lib/src/main/java/com/unity3d/ads/api/Listener.java

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,66 +9,71 @@
99
public class Listener {
1010
@WebViewExposed
1111
public static void sendReadyEvent(final String placementId, WebViewCallback callback) {
12-
if(UnityAds.getListener() != null) {
13-
Utilities.runOnUiThread(new Runnable() {
14-
@Override
15-
public void run() {
12+
Utilities.runOnUiThread(new Runnable() {
13+
@Override
14+
public void run() {
15+
if (UnityAds.getListener() != null) {
1616
UnityAds.getListener().onUnityAdsReady(placementId);
1717
}
18-
});
19-
}
18+
}
19+
});
20+
2021
callback.invoke();
2122
}
2223

2324
@WebViewExposed
2425
public static void sendStartEvent(final String placementId, WebViewCallback callback) {
25-
if(UnityAds.getListener() != null) {
26-
Utilities.runOnUiThread(new Runnable() {
27-
@Override
28-
public void run() {
26+
Utilities.runOnUiThread(new Runnable() {
27+
@Override
28+
public void run() {
29+
if (UnityAds.getListener() != null) {
2930
UnityAds.getListener().onUnityAdsStart(placementId);
3031
}
31-
});
32-
}
32+
}
33+
});
34+
3335
callback.invoke();
3436
}
3537

3638
@WebViewExposed
3739
public static void sendFinishEvent(final String placementId, final String result, WebViewCallback callback) {
38-
if(UnityAds.getListener() != null) {
39-
Utilities.runOnUiThread(new Runnable() {
40-
@Override
41-
public void run() {
40+
Utilities.runOnUiThread(new Runnable() {
41+
@Override
42+
public void run() {
43+
if (UnityAds.getListener() != null) {
4244
UnityAds.getListener().onUnityAdsFinish(placementId, UnityAds.FinishState.valueOf(result));
4345
}
44-
});
45-
}
46+
}
47+
});
48+
4649
callback.invoke();
4750
}
4851

4952
@WebViewExposed
5053
public static void sendClickEvent(final String placementId, WebViewCallback callback) {
51-
if(UnityAds.getListener() != null && UnityAds.getListener() instanceof IUnityAdsExtendedListener) {
52-
Utilities.runOnUiThread(new Runnable() {
53-
@Override
54-
public void run() {
54+
Utilities.runOnUiThread(new Runnable() {
55+
@Override
56+
public void run() {
57+
if (UnityAds.getListener() != null && UnityAds.getListener() instanceof IUnityAdsExtendedListener) {
5558
((IUnityAdsExtendedListener)UnityAds.getListener()).onUnityAdsClick(placementId);
5659
}
57-
});
58-
}
60+
}
61+
});
62+
5963
callback.invoke();
6064
}
6165

6266
@WebViewExposed
6367
public static void sendErrorEvent(final String error, final String message, WebViewCallback callback) {
64-
if(UnityAds.getListener() != null) {
65-
Utilities.runOnUiThread(new Runnable() {
66-
@Override
67-
public void run() {
68+
Utilities.runOnUiThread(new Runnable() {
69+
@Override
70+
public void run() {
71+
if (UnityAds.getListener() != null) {
6872
UnityAds.getListener().onUnityAdsError(UnityAds.UnityAdsError.valueOf(error), message);
6973
}
70-
});
71-
}
74+
}
75+
});
76+
7277
callback.invoke();
7378
}
7479
}

lib/src/main/java/com/unity3d/ads/cache/CacheThreadHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public void onRequestProgress(String url, long bytes, long total) {
124124
_active = false;
125125
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.CACHE, CacheEvent.DOWNLOAD_ERROR, CacheError.MALFORMED_URL, source, e.getMessage());
126126
}
127-
catch (IOException e) {
127+
catch (IOException | IllegalStateException e) {
128128
DeviceLog.exception("Couldn't request stream", e);
129129
_active = false;
130130
WebViewApp.getCurrentApp().sendEvent(WebViewEventCategory.CACHE, CacheEvent.DOWNLOAD_ERROR, CacheError.FILE_IO_ERROR, source, e.getMessage());

lib/src/main/java/com/unity3d/ads/configuration/Configuration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected String buildQueryString () {
7575
return queryString;
7676
}
7777

78-
protected void makeRequest () throws IOException, JSONException {
78+
protected void makeRequest () throws IOException, JSONException, IllegalStateException {
7979
if (_url == null) {
8080
throw new MalformedURLException("Base URL is null");
8181
}

lib/src/main/java/com/unity3d/ads/request/WebRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ public void setProgressListener(IWebRequestProgressListener listener) {
116116
_progressListener = listener;
117117
}
118118

119-
public long makeStreamRequest(OutputStream outputStream) throws IOException {
119+
public long makeStreamRequest(OutputStream outputStream) throws IOException, IllegalStateException {
120120
HttpURLConnection connection = getHttpUrlConnectionWithHeaders();
121121
connection.setDoInput(true);
122122

@@ -194,7 +194,7 @@ public long makeStreamRequest(OutputStream outputStream) throws IOException {
194194
return total;
195195
}
196196

197-
public String makeRequest () throws IOException {
197+
public String makeRequest () throws IOException, IllegalStateException {
198198
ByteArrayOutputStream baos = new ByteArrayOutputStream();
199199
makeStreamRequest(baos);
200200
return new String(baos.toByteArray());

lib/src/main/java/com/unity3d/ads/request/WebRequestHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ private void makeRequest (String url, String type, HashMap<String, List<String>>
8585
String response;
8686
try {
8787
response = _currentRequest.makeRequest();
88-
} catch (IOException e) {
88+
} catch (IOException | IllegalStateException e) {
8989
DeviceLog.exception("Error completing request", e);
9090
receiver.send(WebRequestResultReceiver.RESULT_FAILED, getBundleForFailResult(url, e.getMessage(), type, body));
9191
return;

0 commit comments

Comments
 (0)