Code Monkey home page Code Monkey logo

nativescript-advanced-webview's People

Contributors

bradmartin avatar davecoffin avatar eddyverbruggen avatar jeremypele avatar jibon57 avatar nathanwalker avatar oluwaseye avatar silureth avatar sis0k0 avatar triniwiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

nativescript-advanced-webview's Issues

Does not Work when app is Released

Hey, there is a weird problem with the plugin, when running the app from tns run android works fine but when you run the app from the compiled apk or from the Play Store nothing happend at all!!.

The app is not built since I installed the plugin

image

At the time of installing the plugin the application stops working, I am initializing correctly as shown in the documentation but I get an error.

Why does this happen? Will I have to make the reference in the references.d.ts file?

Fatal Crash on Android running NativeScript 4

System.err: Calling js method onClick failed
System.err:
System.err: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'void co.fitcom.fancywebview.CustomTabsServiceConnectionCallBack.setWebViewListener(co.fitcom.fancywebview.AdvancedWebViewListener)' on a null object reference
System.err: co.fitcom.fancywebview.AdvancedWebView.setWebViewListener(AdvancedWebView.java:60)
System.err: co.fitcom.fancywebview.AdvancedWebView.(AdvancedWebView.java:34)
System.err: com.tns.Runtime.callJSMethodNative(Native Method)
System.err: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
System.err: com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:957)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:941)
System.err: com.tns.Runtime.callJSMethod(Runtime.java:933)
System.err: com.tns.gen.java.lang.Object_button_19_32_ClickListenerImpl.onClick(Object_button_19_32_ClickListenerImpl.java:12)
System.err: android.view.View.performClick(View.java:6207)
System.err: android.widget.TextView.performClick(TextView.java:11094)
System.err: android.view.View$PerformClick.run(View.java:23639)
System.err: android.os.Handler.handleCallback(Handler.java:751)
System.err: android.os.Handler.dispatchMessage(Handler.java:95)
System.err: android.os.Looper.loop(Looper.java:154)
System.err: android.app.ActivityThread.main(ActivityThread.java:6688)
System.err: java.lang.reflect.Method.invoke(Native Method)
System.err: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1468)
System.err: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1358)
System.err: File: "file:///data/data/com.myapp.myapp/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js, line: 43, column: 13

This is line 43 from the advanced-webview.js file:
var wv = new co.fitcom.fancywebview.AdvancedWebView(activity, i);

Not loading on iOS 15

I installed the latest version of the plugin and it is not loading the URL on ios 15. I just get an empty page.

it works good with Android, but with ios it seems like it is just initializing the webview but not loading the URL

Simulator Screen Shot - iPhone 11 - 2021-11-30 at 17 36 45

I tired the following change in advanced-webview.ios.js and now it works

const app = UIApplication.sharedApplication; ctrl = app.keyWindow.rootViewController;

Android: OAuth Flow via Schemes doesn't work in the new version

In the latest version (2.0.2), it appears that something broke or changed with regards to redirecting to a custom scheme. I use the webview for an OAuth login flow that redirects to a custom scheme that relaunches the app. When this happens, the browser shows ERR_UNKNOWN_URL_SCHEME. There is some discussion here about a similar issue but it's relatively old:
EddyVerbruggen/Custom-URL-scheme#156

I don't have a repo of the issue but there were some errors related to the sandbox. Any ideas what changed in the latest release that could have affected this?

Breaks build on Android

When I install this plugin the build stops working. I remove it it builds again. I reviewed a couple of closed issues that are similar. Unfortunately none of the fixes have worked for me.

I am using:
nativescript 4.1.2
tns-core-modules 4.1.1
tns-android 4.1.3
Android SDK build tools 27.0.2 (supports appcompat)

This is what I think is the salient portion of the output.

`C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.

C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.

C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontStyle not found.

C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/font not found.

C:\Users\Chris Haff.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\9b5e00fece4821b56b57b99b7f241c6c\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontWeight not found.

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:processDebugResources'.

Failed to process resources, see aapt output above for details.`

How to get current URL or HTML?

I'm trying to get the current URL or maybe the HTML, just like we can do with Nativescript WebView UI component.

Does this plugin has any way to get it? Because I'm not being able to find it. :(

Android problem

Hi, plugin works very well on iOS but when I try to open webview on android it doesn't work and I get this error.

`
JS: Error: java.lang.NullPointerException: Attempt to invoke virtual method 'android.support.customtabs.CustomTabsSession android.support.customtabs.CustomTabsClient.newSession(android.support.customtabs.CustomTabsCallback)' on a null object reference
JS: co.fitcom.fancywebview.AdvancedWebView.(AdvancedWebView.java:35)
JS: com.tns.Runtime.callJSMethodNative(Native Method)
JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1088)
JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:970)
JS: com.tns.Runtime.callJSMethod(Runtime.java:957)
JS: com.tns.Runtime.callJSMethod(Runtime.java:941)
JS: com.tns.Runtime.callJSMethod(Runtime.java:933)
JS: com.tns.gen.java.lang.Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.onClick(Object_frnal_ts_helpers_l58_c38__ClickListenerImpl.java:12)
JS: android.view.View.performClick(View.java:5610)
JS: android.view.View$PerformClick.run(View.java:22265)
JS: android.os.Handler.handleCallback(Handler.java:751)
JS: android.os.Handler.dispatchMessage(Handler.java:95)
JS: android.os.Looper.loop(Looper.java:154)
JS: android.app.ActivityThread.main(ActivityThread.java:6077)
JS: java.lang.reflect.Method.invoke(Native Method)
JS: com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
JS: com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)

`

Broken with NS 2.4

Might be the native library breaking changes introduced - leaning toward this since it worked not long ago just fine. Looks like context is expected in launchUrl(context, url) and not an activity anymore.

Error: java.lang.NoSuchMethodError: no static method "Landroid/view/View;.setPadding(IIII)V"

{
"nativescript": {
"id": "org.nativescript.testingAdvanceView",
"tns-android": {
"version": "6.3.1"
},
"tns-ios": {
"version": "6.3.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN ",
"repository": "",
"dependencies": {
"@nativescript/theme": "~2.2.1",
"nativescript-advanced-webview": "^5.0.0",
"tns-core-modules": "~6.3.0"
},
"devDependencies": {
"nativescript-dev-webpack": "~1.4.0"
},
"gitHead": "fa98f785df3fba482e5e2a0c76f4be1fa6dc7a14",
"readme": "NativeScript Application"
}
Getting error app crash in android

Use location in webview

Is it possible for to use geolocation in an advanced webview? If so could you direct me to a resource that shows how?

Thanks.

object dump on init (nativescript angular)

Created a new project using tns create HelloWorld, selected angular project.

Added the plugin using tns plugin add nativescript-advanced-webview

Updated main.ts so it looks like:

    import { platformNativeScriptDynamic } from "nativescript-angular/platform";
    import { AppModule } from "./app/app.module";
    import { init } from 'nativescript-advanced-webview';

    init();
    platformNativeScriptDynamic().bootstrapModule(AppModule);

On launch get:

    JS: ==== object dump start ====
    JS: extend()
    JS: PACKAGE_NAME: "com.android.chrome"
    JS: REQUEST_CODE: "1868"
    JS: INSTANCE: co.fitcom.fancywebview.AdvancedWebViewStatics@1803b14
    JS: null()
    JS: class: class co.fitcom.fancywebview.AdvancedWebViewStatics
    JS: ==== object dump end ====
    JS: ==== object dump start ====
    JS: AdvancedWebView()
    JS: AdvancedWebViewListener()
    JS: AdvancedWebViewStatics()
    JS: CustomTabsCallbackListener()
    JS: CustomTabsServiceConnectionCallBack()
    JS: BuildConfig()
    JS: CustomTabFallback()
    JS: R()
    JS: WebViewActivity()
    JS: WebViewActivityConstants()
    JS: WebViewFallback()
    JS: ==== object dump end ====

package.json

{
  "nativescript": {
    "id": "org.nativescript.HelloWorld",
    "tns-ios": {
      "version": "6.1.0"
    },
    "tns-android": {
      "version": "6.1.2"
    }
  },
  "description": "NativeScript Application",
  "license": "SEE LICENSE IN <your-license-filename>",
  "repository": "<fill-your-repository-here>",
  "dependencies": {
    "@angular/animations": "~8.2.0",
    "@angular/common": "~8.2.0",
    "@angular/compiler": "~8.2.0",
    "@angular/core": "~8.2.0",
    "@angular/forms": "~8.2.0",
    "@angular/platform-browser": "~8.2.0",
    "@angular/platform-browser-dynamic": "~8.2.0",
    "@angular/router": "~8.2.0",
    "nativescript-advanced-webview": "^4.0.1",
    "nativescript-angular": "~8.2.0",
    "nativescript-theme-core": "~1.0.6",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.1.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "nativescript-dev-webpack": "~1.2.0",
    "typescript": "~3.5.3"
  },
  "gitHead": "1964ea9e8ca1a0518e0d6370781eedcf6c23db42",
  "readme": "NativeScript Application"
}

Callback Function

Hello,

I think you should implement callback function for custom tab as: Start load page, Finish load page.
I think it need for authorize with OAuth2. This my suggest.

Thanks.

No event fires when browser closes

Due to a bug with the app I am working on, there is an issue with screen orientation when coming back to the app from a browser window. If the app enters the safari view controller in portrait mode, in the SVC turns to landscape mode and then presses the 'done' button in the top left corner of the application, on return, the app still thinks it is in portrait mode.here is a <- picture of the problem. The app is not suspended when the browser opens, and I think that is what causes this problem. Is there any on an event that fires when the browser closes so I can force orient (using your other plugin) to portrait mode? Or a fix to this orientation problem as a whole?

Chrometabs to defaults

Hello Brad,
First thank you very much for this plugin. The difference in speed is noticed immediately compared to webview.
I have a problem when I run this in the Visual Studio Emulator with Andoird 5.1 and Chrome Browser installed (The application crashes, log in the bottom of this message).

In my device it runs well but there is the action of selecting the default browser(which is chrome) and after that you can always open chrometabs. If you dont select Chrome to be default it always asks you.
Is there anyway of assuming Chrome to be default?? My device has android 4.4.4 but if its doable in newer versions i dont mind knowing it :).

I/ActivityManager( 441): START u0 {act=android.intent.action.VIEW dat=http://www.panorama.com.al/deputeti-i-rames-zbulon-negociatat-basha-nxori-jashte-loje-aleatet-ja-pse-i-genjeu/ flg=0x800000 cmp=com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity (has extras)} from uid 10078 on display 0 V/WindowManager( 441): addAppToken: AppWindowToken{c356dd8 token=Token{a7944bb ActivityRecord{358a6d4a u0 com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity t66}}} to stack=1 task=66 at 2 I/cr_LibraryLoader(14489): Using linker: org.chromium.base.library_loader.LegacyLinker W/linker (14489): libchromium_android_linker.so: unused DT entry: type 0x6ffffffe arg 0xbc8 W/linker (14489): libchromium_android_linker.so: unused DT entry: type 0x6fffffff arg 0x3 V/WindowManager( 441): Adding window Window{1c70e969 u0 com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity} at 4 of 9 (after Window{d3d463a u0 com.krisidmisso.Gossip/com.tns.NativeScriptActivity}) V/WindowManager( 441): Adding window Window{3106fc8f u0 SurfaceView} at 4 of 10 (before Window{1c70e969 u0 com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity}) chromium: [INFO:library_loader_hooks.cc(140)] Chromium logging enabled: level = 0, default verbosity = 0 I/ActivityManager( 441): Start proc 14520:com.android.chrome:sandboxed_process0/u0i3 for service com.android.chrome/org.chromium.content.app.SandboxedProcessService0 I/ActivityManager( 441): Displayed com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity: +1s354ms (total +1s774ms) I/cr_BrowserStartup(14489): Initializing chromium process, singleProcess=false I/ActivityManager( 441): Start proc 14562:com.android.chrome:privileged_process0/u0a78 for service com.android.chrome/org.chromium.content.app.PrivilegedProcessService0 I/cr_LibraryLoader(14562): Using linker: org.chromium.base.library_loader.LegacyLinker W/linker (14562): libchromium_android_linker.so: unused DT entry: type 0x6ffffffe arg 0xbc8 W/linker (14562): libchromium_android_linker.so: unused DT entry: type 0x6fffffff arg 0x3 chromium: [INFO:library_loader_hooks.cc(140)] Chromium logging enabled: level = 0, default verbosity = 0 I/cr_LibraryLoader(14520): Using linker: org.chromium.base.library_loader.LegacyLinker W/linker (14520): libchromium_android_linker.so: unused DT entry: type 0x6ffffffe arg 0xbc8 W/linker (14520): libchromium_android_linker.so: unused DT entry: type 0x6fffffff arg 0x3 chromium: [INFO:library_loader_hooks.cc(140)] Chromium logging enabled: level = 0, default verbosity = 0 I/art (14489): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.FloatingActionModeCallback> I/art (14489): Rejecting re-init on previously-failed class java.lang.Class<org.chromium.content.browser.FloatingActionModeCallback> F/google-breakpad(14595): M A48CE000 00000000 00018000 AFEF64D06B9A2E8DF050906F3AD0CDC60 libchromium_android_linker.so F/google-breakpad(14595): M ACA51000 00000000 00002000 4651ECB3F77EC8B4EB4FB4A5D7BF61DE0 libwebviewchromium_loader.so chromium: [ERROR:compositor_impl_android.cc(685)] Failed to init ContextProvider for compositor. chromium: [WARNING:compositor_view.cc(243)] Child process disconnected (type=9) pid=14562) W/ActivityManager( 441): Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.PrivilegedProcessService0 in 1000ms I/cr_LogcatExtraction(14489): Trying to extract logcat for minidump chromium-renderer-minidump-405046c63c0a1579.dmp14562. I/ActivityManager( 441): Start proc 14607:com.android.chrome:privileged_process1/u0a78 for service com.android.chrome/org.chromium.content.app.PrivilegedProcessService1 I/cr_LibraryLoader(14607): Using linker: org.chromium.base.library_loader.LegacyLinker W/linker (14607): libchromium_android_linker.so: unused DT entry: type 0x6ffffffe arg 0xbc8 W/linker (14607): libchromium_android_linker.so: unused DT entry: type 0x6fffffff arg 0x3 chromium: [INFO:library_loader_hooks.cc(140)] Chromium logging enabled: level = 0, default verbosity = 0 I/cr_LogcatExtraction(14489): Succeeded extracting logcat to chromium-renderer-minidump-405046c63c0a1579.dmp14562.try0. F/google-breakpad(14635): M A48CE000 00000000 00018000 AFEF64D06B9A2E8DF050906F3AD0CDC60 libchromium_android_linker.so F/google-breakpad(14635): M ACA51000 00000000 00002000 4651ECB3F77EC8B4EB4FB4A5D7BF61DE0 libwebviewchromium_loader.so chromium: [ERROR:compositor_impl_android.cc(685)] Failed to init ContextProvider for compositor. chromium: [FATAL:compositor_impl_android.cc(686)] Too many context creation failures. Giving up... W/ActivityManager( 441): Scheduling restart of crashed service com.android.chrome/org.chromium.content.app.PrivilegedProcessService1 in 1000ms F/google-breakpad(14643): M A3E3D000 00000000 00018000 AFEF64D06B9A2E8DF050906F3AD0CDC60 libchromium_android_linker.so F/google-breakpad(14643): M ACA51000 00000000 00002000 4651ECB3F77EC8B4EB4FB4A5D7BF61DE0 libwebviewchromium_loader.so W/ActivityManager( 441): Force finishing activity 4 com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity W/ActivityManager( 441): Wtf, activity ActivityRecord{358a6d4a u0 com.android.chrome/org.chromium.chrome.browser.customtabs.CustomTabActivity t66 f} in proc activity list not using proc ProcessRecord{2c8a1416 14489:com.android.chrome/u0a78}?!?

Color Options not working

first of all, nice plugin, Brad.
Everything works, except for the color options.

I set the options as shown in the readme:

 toolbarColor: '#ff4081',
 toolbarControlsColor: '#333', // iOS only 

but this doesn't change anything.
I'm using Nativescript 2.5.0

Android: showTitle and toolbarColor don't work

The options showTitle and toolbarColor have no effect on Android but at least toolbarColor works fine on iOS. (showTitle is Android only)

I added following code at the top of my app/app.module.ts file.
(It's an Angular app.)

import { init } from 'nativescript-advanced-webview';
init();

I can reproduce it on a real device and on an emulator.

The emulator is a Genymotion Google Pixel running Android 7.1.0.
The real device is a Google Pixel 2 running Android 8.1.0

"nativescript": {
    "tns-ios": {
      "version": "3.4.1"
    },
    "tns-android": {
      "version": "3.4.2"
    }
  },
  "dependencies": {
    "@angular/animations": "~5.0.0",
    "@angular/common": "~5.0.0",
    "@angular/compiler": "~5.0.0",
    "@angular/core": "~5.0.0",
    "@angular/forms": "~5.0.0",
    "@angular/http": "~5.0.0",
    "@angular/platform-browser": "~5.0.0",
    "@angular/platform-browser-dynamic": "~5.0.0",
    "@angular/router": "~5.0.0",
    "lodash": "^4.17.4",
    "nativescript-advanced-webview": "^2.0.2",
    "nativescript-angular": "^5.0.0",
    "nativescript-carousel": "^3.1.1",
    "nativescript-dom": "^2.0.0",
    "nativescript-feedback": "^1.1.0",
    "nativescript-geolocation": "^4.2.0",
    "nativescript-google-maps-sdk": "^2.4.3",
    "nativescript-iqkeyboardmanager": "^1.1.0",
    "nativescript-loading-indicator": "^2.4.0",
    "nativescript-plugin-firebase": "^5.1.7",
    "nativescript-plugin-regions": "^1.0.1",
    "nativescript-pulltorefresh": "^2.1.0",
    "nativescript-ripple": "^2.0.0",
    "nativescript-social-share": "^1.5.0",
    "nativescript-theme-core": "1.0.4",
    "nativescript-ui-sidedrawer": "^3.5.0",
    "nativescript-webview-interface": "^1.4.2",
    "reflect-metadata": "0.1.10",
    "rxjs": "^5.5.0",
    "sanitizer": "^0.1.3",
    "tns-core-modules": "^3.4.1",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~5.0.0",
    "@ngtools/webpack": "~1.8.2",
    "@types/lodash": "^4.14.85",
    "babel-traverse": "6.25.0",
    "babel-types": "6.25.0",
    "babylon": "6.17.4",
    "copy-webpack-plugin": "~4.0.1",
    "css-loader": "~0.28.7",
    "extract-text-webpack-plugin": "~3.0.0",
    "lazy": "1.0.11",
    "nativescript-css-loader": "~0.26.0",
    "nativescript-dev-sass": "1.3.2",
    "nativescript-dev-typescript": "^0.6.0",
    "nativescript-dev-webpack": "^0.9.0",
    "nativescript-sass-variables-to-typescript": "file:plugins/nativescript-sass-variables-to-typescript",
    "nativescript-worker-loader": "~0.8.1",
    "node-sass": "^4.5.3",
    "raw-loader": "~0.5.1",
    "resolve-url-loader": "~2.1.0",
    "sass-loader": "~6.0.6",
    "tns-platform-declarations": "^3.4.0",
    "typescript": "~2.4.2",
    "webpack": "~3.8.1",
    "webpack-bundle-analyzer": "^2.8.2",
    "webpack-sources": "~1.0.1"
  },

Could not find com.android.support:customtabs:25.0.1.

I could be related to the other two issues there were recently closed, but as I'm a total native noob I didn't find solutions in the issues.

Since version 1.1.2(this include 1.1.3) my build is failing.

He is what I do:

$ tns --version
2.4.2

$ rm -rf node_modules && npm i && tns platform remove android && tns platform add android && tns deploy android

...
...
...
FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring root project 'stefanTravel'.
> Could not resolve all dependencies for configuration ':_F0F1F2DebugCompile'.
   > Could not find com.android.support:customtabs:25.0.1.
     Searched in the following locations:

Any help is appreciated. :)

Android opens multiple webviews

On Android, it is possible to open multiple WebViews by rapidly tapping a button that opens them if there is any async action happening before opening. For instance, I have a button which opens the webview after getting the location. Since the location request is async, I can continue to tap the button and open a webview. Here's a snippet which causes this behavior:

	async onButtonTap() {
		try {
			if (!isEnabled()) {
				await enableLocationRequest();
			}
		} catch (e) {
			console.log('location permissions denied');
		}
		const location = await getCurrentLocation({
			desiredAccuracy: 3,
			updateDistance: 10,
			maximumAge: 20000,
			timeout: 5000
		})
			.catch(() => {
				return {longitude: NaN, latitude: NaN};
			});

		const params = {
			latitude: location.latitude,
			longitude: location.longitude,
		}
		const encoded = Object.keys(params)
			.map(key => `${key}=${encodeURIComponent(params[key] || '')}`)
			.join('&');

		const opts: AdvancedWebViewOptions = {
			url: `https://google.com/#q=${encoded}`,
			toolbarColor: platform.isIOS ? '#0044AD' : '#F2F2F2',
			toolbarControlsColor: '#FFFFFF', // iOS only
			showTitle: false // Android only
		};

		openAdvancedUrl(opts);
	}

One possible fix could be returning a promise from openAdvancedUrl(opts) that resolves when the webview opens and allowing the developer to manually keep track of when it opened successfully. Once it's opened, there is no way to open another one through the UI due to it hiding the UI.

Another fix may be to implement some kind of event system for opening and closing the WebView.

Can't run on iOS emulator

Thanks @bradmartin: plug-in works super on a device, but not on the emulator. I get this error message: file:///app/tns_modules/nativescript-advanced-webview/advanced-webview.js:15:63: JS ERROR ReferenceError: Can't find variable: SFSafariViewControllerDelegate

I think this might be expected behavior but wanted to check. Thanks again.

Android: co.fitcom.fancywebview.AdvancedWebViewListener is not defined

ReferenceError: co is not defined

When I call init() or openAdvancedUrl() I get this error:
JS: ReferenceError: co is not defined JS: at Object.openAdvancedUrl (file:///data/data/org.nativescript.drawertemplate/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js:29:13)

I am using:

  • nativescript 4.1.2
  • tns-core-modules 4.1.1
  • tns-android 4.1.3
  • Android SDK build tools 27.0.2

Execution failed for task ':app:processDebugResources'

I got this build error after installing AdvancedWebView Plugin

C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values-v26\values-v26.xml:9:5-12:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values-v26\values-v26.xml:13:5-16:13: AAPT: error: resource android:attr/colorError not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values-v26\values-v26.xml:17:5-93: AAPT: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontStyle not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/font not found.
C:\Users\user.gradle\caches\transforms-1\files-1.1\appcompat-v7-27.0.2.aar\4cfb5a08e8368816ef3645c7e80ffb22\res\values\values.xml:252:5-69: AAPT: error: resource android:attr/fontWeight not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:7: error: resource android:attr/colorError not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:11: error: resource android:attr/colorError not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values-v26\values-v26.xml:15: error: style attribute 'android:attr/keyboardNavigationCluster' not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:501: error: resource android:attr/fontStyle not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:501: error: resource android:attr/font not found.
E:\NativeScript\simpleapp\platforms\android\app\build\intermediates\incremental\mergeDebugResources\merged.dir\values\values.xml:501: error: resource android:attr/fontWeight not found.
error: failed linking references.
Failed to execute aapt

Angular - IOS platform missing

it doesn't work with Angular in IOS - ns plugin remove nativescript-advanced-webview or tns plugin add nativescript-advanced-webview doesn't install IOS platform.

Screenshot 2022-11-28 at 1 44 09 PM

Feature: provide interface for controlling the advanced webview

I'm trying to use the advanced webview for an oauth workflow. The problem is that I need programatic access to the webview so that I can close it when the workflow completes. Right now it only allows user interaction to control it.

PS. I'd be happy to collaborate on it.

pass data via URL

Hey @bradmartin This looks amazing! Before I install it I just want to know - can I add parameters to my URL like a token and user_role so my server can apply some logic? The standard {N} webview doesn't has my parameters in the URL but my server doesn't see them, so not sure it passes them along.

android.content.ActivityNotFoundException: No Activity found to handle Intent

When I follow the nativescript-advancced-webview plugin instructions i get the error:
ERROR Error: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=google.com pkg=com.android.chrome (has extras) }
What does this mean and how can i solve it?
Any help appreciated.

Failed to find module: "nativescript-advanced-webview"

An uncaught Exception occurred on "main" thread...
Failed to find module: "nativescript-advanced-webview"

I copied the repo directly from this project and I installed the plugin and as the screenshot shows it is installed, but I'm still getting this error. I appreciate any help. Thanks.

node_modules

failedtofindmodule

ReferenceError: co is not definded

When you call the init () function, a "ReferenceError: co is not definded" message is displayed.
I am using nativescript-vue.

const AdvancedWebView = require('nativescript-advanced-webview');
AdvancedWebView.init();

Keyboard

Is it possible to use the keyboard?
Its only possible in desktop browser, isn't supported in mobile browser.

Does not work with Angular on iOS

I tried with NativeScript Plain on an iOS device, everything works!
But if I try on NativeScript Angular, it only works on Android
2022-03-17_16-48-36
2022-03-17_16-48-50
.

NativeScript: 8.1.5
@nativescript/core: 8.0.2
@nativescript/angular: 13.0.0
nativescript-advanced-webview: 7.0.1

@bradmartin

Changed the links to Nativescript Core Packages to work with NS-8

Hi! ๐Ÿ‘‹

Firstly, thanks for your work on this project! ๐Ÿ™‚

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/nativescript-advanced-webview/advanced-webview.android.js b/node_modules/nativescript-advanced-webview/advanced-webview.android.js
index b084670..38df641 100644
--- a/node_modules/nativescript-advanced-webview/advanced-webview.android.js
+++ b/node_modules/nativescript-advanced-webview/advanced-webview.android.js
@@ -1,8 +1,13 @@
 "use strict";
 Object.defineProperty(exports, "__esModule", { value: true });
-var app = require("tns-core-modules/application");
-var color_1 = require("tns-core-modules/color");
-var utils_1 = require("tns-core-modules/utils/utils");
+
+const { Application, Color, Utils } = require("@nativescript/core")
+
+const app = Application
+const color_1 = Color
+const utils_1 = Utils
+
+
 var REQUEST_CODE = 1868;
 function init() {
     co.fitcom.fancywebview.AdvancedWebView.AdvancedWebViewStatics.init(utils_1.ad.getApplicationContext(), true);

This issue body was partially generated by patch-package.

WebPage Not Available Issue

Facing below issue while open upi apps.
image
How to handle this?
Can you please help me.
Here is my package.json
"dependencies": {
"@angular/animations": "~10.1.0",
"@angular/common": "~10.1.0",
"@angular/compiler": "~10.1.0",
"@angular/core": "~10.1.0",
"@angular/forms": "~10.1.0",
"@angular/platform-browser": "~10.1.0",
"@angular/platform-browser-dynamic": "~10.1.0",
"@angular/router": "~10.1.0",
"@nativescript/angular": "~10.1.0",
"@nativescript/core": "~7.0.0",
"@nativescript/firebase": "^11.0.0",
"@nativescript/social-share": "^2.0.4",
"@nativescript/theme": "~2.3.0",
"@nativescript/webpack": "3.0.0",
"@nstudio/nativescript-cardview": "^2.0.0",
"@nstudio/nativescript-loading-indicator": "^4.0.0",
"@nstudio/nativescript-snackbar": "^2.1.0",
"nativescript-advanced-webview": "^6.1.1",
"nativescript-appversion": "^1.4.2",
"nativescript-exit": "^1.0.1",
"nativescript-fancyalert": "^3.0.9",
"nativescript-image-cache": "^1.1.6",
"nativescript-permissions": "^1.3.8",
"nativescript-phone": "^1.4.1",
"nativescript-sqlite": "^2.6.4",
"nativescript-theme-core": "~1.0.6",
"nativescript-toasts": "^1.0.3",
"nativescript-ui-sidedrawer": "~9.0.0",
"reflect-metadata": "~0.1.12",
"rxjs": "^6.6.0",
"rxjs-compat": "^6.4.0",
"zone.js": "~0.11.1"
},
"devDependencies": {
"@angular/compiler-cli": "~10.1.0",
"@nativescript/android": "7.0.1",
"@nativescript/ios": "7.0.2-rc1",
"@nativescript/webpack": "~3.0.0",
"@ngtools/webpack": "~10.1.0",
"codelyzer": "~6.0.0",
"node-sass": "^4.14.1",
"tslint": "~6.1.3",
"typescript": "~3.9.0"
},

nativescript-advanced-webview not compatible with latest NativeScript 6

Due to using a specific RC version of androidx.appcompat library the plugin is now not fully compatible with NativeScript 6 and breaks all applications during navigation. The thing is that the plugin is installing a specific RC version of androidx.appcompat via the native library (fancy-advanced-webivew). This RC version of the appcompat is breaking the Fragment manager logic in NativeScript and thus causing any app that uses this plugin to fail on navigation or on app/resume.

See this issue for details NativeScript/NativeScript#7901

Error calling module function

Good day, I am presenting the following error in Android, could you help me please.

System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException:
System.err:
System.err: Error calling module function
System.err:
System.err: TypeError: Cannot read property 'init' of undefined
System.err: File: "file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js, line: 9, column: 42
System.err:
System.err: StackTrace:
System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: TypeError: Cannot read property 'init' of undefined
System.err: File: ", line: 1, column: 265
System.err:
System.err: StackTrace:
System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5447)
System.err: at android.app.ActivityThread.-wrap2(ActivityThread.java)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1558)
System.err: at android.os.Handler.dispatchMessage(Handler.java:102)
System.err: at android.os.Looper.loop(Looper.java:154)
System.err: at android.app.ActivityThread.main(ActivityThread.java:6165)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:778)
System.err: Caused by: com.tns.NativeScriptException:
System.err:
System.err: Error calling module function
System.err:
System.err: TypeError: Cannot read property 'init' of undefined
System.err: File: "file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js, line: 9, column: 42
System.err:
System.err: StackTrace:
System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err:
System.err: TypeError: Cannot read property 'init' of undefined
System.err: File: ", line: 1, column: 265
System.err:
System.err: StackTrace:
System.err: Frame: function:'init', file:'file:///data/data/org.nativescript.VetsCol/files/app/tns_modules/nativescript-advanced-webview/advanced-webview.js', line: 9, column: 43
System.err: Frame: function:'', file:'file:///data/data/org.nativescript.VetsCol/files/app/main.js', line: 6, column: 33
System.err: Frame: function:'require', file:'', line: 1, column: 266
System.err:
System.err: at com.tns.Runtime.runModule(Native Method)
System.err: at com.tns.Runtime.runModule(Runtime.java:530)
System.err: at com.tns.Runtime.run(Runtime.java:522)
System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:19)
System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1046)
System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:5444)
System.err: ... 8 more
ActivityManager: Process org.nativescript.VetsCol (pid 24483) has died
ActivityManager: cleanUpApplicationRecord -- 24483

error on tns run android

hi, i am getting the following errors on tns run android.
i created app using

tns create myapp --ng
tns plugin add nativescript-advanced-webview
tns run android

errors
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':transformClassesWithDexForF0F1Debug'.

com.android.build.api.transform.TransformException: com.android.ide.common.pro
cess.ProcessException: java.util.concurrent.ExecutionException: com.android.dex.
DexException: Multiple dex files define Landroid/support/v4/accessibilityservice
/AccessibilityServiceInfoCompat$AccessibilityServiceInfoVersionImpl;

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 42.096 secs
Command G:\Mobile-SDK\webview-test\platforms\android\gradlew.bat failed with exit code 1

run android

Add Ability to Close WebView

This would be really helpful for OpenId Connect using a Hybrid Authorization Workflow. For my case, I launch to the external browser for login (Identity Server 4) and use the redirect with UrlHandler. If the server redirect is something like adams.app://authorized I want to programmatically be able to close the webview and pop back into the app.

I have a created a branch locally and have implemented the dismiss call for the SafariViewController (iOS) in the Demo app. Unfortunately, its been sometime since I have dealt with native Android; so I am not sure where to start there.

'error' [TypeError: null is not an object (evaluating 'app.keyWindow')]

Using Nativescript-vue. 4.2.3

In our main.js file, we're calling:

const AdvancedWebView = require("nativescript-advanced-webview");
AdvancedWebView.init();

in our vue component, we're calling:

var opts = {
        url: 'https://google.com',
};
    
try {
      AdvancedWebView.openAdvancedUrl(opts);
 } catch(err) {
      console.log('error', err);
 }

Unfortunately though, we are getting the error noted above:
'error' [TypeError: null is not an object (evaluating 'app.keyWindow')]

We know the openAdvancedURL() method is being called, because if we leave the opts.url blank, we get the appropriate error.

any ideas on what we're missing?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.