@capgo/inappbrowser 1.3.17 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,10 +3,13 @@ package ee.forgr.capacitor_inappbrowser;
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.app.AlertDialog;
|
|
5
5
|
import android.app.Dialog;
|
|
6
|
+
import android.content.ActivityNotFoundException;
|
|
6
7
|
import android.content.Context;
|
|
7
8
|
import android.content.DialogInterface;
|
|
9
|
+
import android.content.Intent;
|
|
8
10
|
import android.graphics.Bitmap;
|
|
9
11
|
import android.graphics.Color;
|
|
12
|
+
import android.net.Uri;
|
|
10
13
|
import android.text.TextUtils;
|
|
11
14
|
import android.util.Log;
|
|
12
15
|
import android.view.View;
|
|
@@ -326,6 +329,19 @@ public class WebViewDialog extends Dialog {
|
|
|
326
329
|
WebView view,
|
|
327
330
|
WebResourceRequest request
|
|
328
331
|
) {
|
|
332
|
+
Context context = view.getContext();
|
|
333
|
+
String url = request.getUrl().toString();
|
|
334
|
+
|
|
335
|
+
if (!url.startsWith("https://") && !url.startsWith("http://")) {
|
|
336
|
+
try {
|
|
337
|
+
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
|
338
|
+
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
339
|
+
context.startActivity(intent);
|
|
340
|
+
return true;
|
|
341
|
+
} catch (ActivityNotFoundException e) {
|
|
342
|
+
// Do nothing
|
|
343
|
+
}
|
|
344
|
+
}
|
|
329
345
|
return false;
|
|
330
346
|
}
|
|
331
347
|
|