Skip to content

Commit

Permalink
[TIMOB-17754] Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashraf A. S committed Jan 8, 2015
1 parent 00c8a25 commit d44430b
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,14 @@
import org.appcelerator.titanium.TiC;

import ti.modules.titanium.media.TiVideoActivity;
import android.annotation.TargetApi;
import android.content.Intent;
import android.graphics.Bitmap;
import android.net.Uri;
import android.net.http.SslError;
import android.os.Build;
import android.webkit.HttpAuthHandler;
import android.webkit.MimeTypeMap;
import android.webkit.SslErrorHandler;
import android.webkit.URLUtil;
import android.webkit.WebResourceRequest;
import android.webkit.WebResourceResponse;
import android.webkit.WebView;
import android.webkit.WebViewClient;

Expand Down Expand Up @@ -173,7 +169,7 @@ public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError e

KrollDict data = new KrollDict();
data.put(TiC.ERROR_PROPERTY_CODE, error.getPrimaryError());
webView.getProxy().fireSyncEvent(TiC.EVENT_SSL_ERROR, data);
webView.getProxy().fireEvent(TiC.EVENT_SSL_ERROR, data);

boolean ignoreSslError = false;
try {
Expand Down Expand Up @@ -201,29 +197,4 @@ public void onLoadResource(WebView view, String url)
webView.getProxy().fireSyncEvent(TiC.EVENT_WEBVIEW_ON_LOAD_RESOURCE, data);
}

// This method was deprecated from Android API level 21.
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view, String url)
{
if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_URL, url);
webView.getProxy().fireSyncEvent(TiC.EVENT_WEBVIEW_SHOULD_INTERCEPT_REQUEST, data);
}
return super.shouldInterceptRequest(view, url);
}

// This method is available from Android API level 21.
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
@Override
public WebResourceResponse shouldInterceptRequest(WebView view,
WebResourceRequest request)
{
KrollDict data = new KrollDict();
data.put(TiC.PROPERTY_URL, request.getUrl().toString());
webView.getProxy().fireSyncEvent(TiC.EVENT_WEBVIEW_SHOULD_INTERCEPT_REQUEST, data);
return super.shouldInterceptRequest(view, request);
}

}
5 changes: 0 additions & 5 deletions android/titanium/src/java/org/appcelerator/titanium/TiC.java
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,6 @@ public class TiC
*/
public static final String EVENT_WEBVIEW_ON_LOAD_RESOURCE = "onLoadResource";

/**
* @module.api
*/
public static final String EVENT_WEBVIEW_SHOULD_INTERCEPT_REQUEST = "shouldInterceptRequest";

/**
* @module.api
*/
Expand Down
13 changes: 0 additions & 13 deletions apidoc/Titanium/UI/WebView.yml
Original file line number Diff line number Diff line change
Expand Up @@ -380,19 +380,6 @@ events:
summary: The url of the resource that will load.
type: String

- name: shouldInterceptRequest
summary: Fired when resource request occurs.
description: |
Android only. Notify the host application of a resource request.
This is only available on Android devices at API Level 11 or greater.
platforms: [android]
since: "3.6.0"
properties:
- name: url
summary: The raw url of the resource.
type: String

- name: sslerror
summary: Fired when an SSL error occurred.
description: |
Expand Down

0 comments on commit d44430b

Please sign in to comment.