GithubHelp home page GithubHelp logo

proyecto26 / nativescript-inappbrowser Goto Github PK

View Code? Open in Web Editor NEW
73.0 73.0 21.0 5.46 MB

📱InAppBrowser for NativeScript (Android & iOS) 🤘

Home Page: https://market.nativescript.org/plugins/nativescript-inappbrowser

License: MIT License

Shell 2.64% TypeScript 97.36%
android authentication browser chrome chrome-custom-tabs chrome-customtabs deep-linking deep-links inappbrowser ios nativescript nativescript-plugin oauth oauth2 safari safari-services sso-authentication sso-login web-authentication

nativescript-inappbrowser's People

Contributors

dependabot[bot] avatar ebsi-cgoboncan avatar edusperoni avatar farfromrefug avatar jdnichollsc avatar nathanwalker avatar rigor789 avatar ronalson avatar santiaguf avatar tralves avatar uderline avatar wwelling 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

nativescript-inappbrowser's Issues

can't compile custom component dynamically in nativescript angular

hi
I'm using a Angular Dynamic Compile component called "P3X Angular Compile", that turns a string into a compiled component in my nativescript project.
link : https://npm.taobao.org/package/p3x-angular-compile
I install that via npm in my {N} project but it not worked, so I use a part of P3X's source code in my project and create a dynamic component builder like this :

dynamic-component.ts:

export class DynamicComponentBuilder implements OnChanges {

@Input('template') html: string;
@Input('module') module: NgModule;
@Input('parent') context: any;
@Input('error-handler') errorHandler: Function = undefined;
@Input('imports') imports: Array<Type<any> | ModuleWithProviders | any[]>;

dynamicComponent: any;
dynamicModule: NgModuleFactory<any> | any;

constructor(private compiler: Compiler) { }

ngOnChanges(changes: SimpleChanges) {
	this.update();
}

update() {
	try {
		if (this.html === undefined || this.html === null || this.html.trim() === '') {
			this.dynamicComponent = undefined;
			this.dynamicModule = undefined;
			return;
		}
		this.dynamicComponent = this.createNewComponent(this.html, this.context);
		this.dynamicModule = this.compiler.compileModuleSync(this.createComponentModule(this.dynamicComponent));

	} catch (e) {
		if (this.errorHandler === undefined)
			throw e;
		else
			this.errorHandler(e);
	}
}

createComponentModule(componentType: any) {
	let module: NgModule = {};
	if (this.module !== undefined)
		module = cloneDeep(this.module);

	module.imports = module.imports || [];
	module.imports.push(CommonModule);
	if (this.imports !== undefined)
		module.imports = module.imports.concat(this.imports)

	if (module.declarations === undefined)
		module.declarations = [componentType];
	else
		module.declarations.push(componentType);

	module.entryComponents = [componentType];

	@NgModule(module)
	class RuntimeComponentModule { }
	return RuntimeComponentModule;
}


createNewComponent(html: string, context: any) {
	@Component({
		selector: nextId(),
		template: html
	})
	class DynamicComponent {
		context: any = context;
	}
	return DynamicComponent;
}

}

dynamic-component.html:

<ng-container *ngIf="html !== undefined && html !== null && html.trim() !== ''">
<ng-container *ngComponentOutlet="dynamicComponent; ngModuleFactory: dynamicModule;"> </ng-container>
</ng-container>

and I use this component like this:

customPage.html:

<StackLayout dynamic [template]="myListCmp" [module]="myListMd" [parent]="this"></StackLayout>
<StackLayout dynamic [template]="textField" [parent]="this"></StackLayout>

customPage.ts:

textField: string = "<TextField hint='Enter date'></TextField>";
myListCmp= "<my-list></my-list>";
myListMd= { entityComponents: [ EmptyListComponent ] }

the component work with "textField" correctly but with my custom "my-list" component not working.
I need to mention that "my-list" component is declared in a custom Module.

help me, thanks!

OpenAuth redirect

Question
When using the openAuth method how should your api look like for the authUrl. I am getting a token in browser but not getting a response back to redirect to app.

  loginWithPortal() {
    const loginUrl = `http://login.test/m/portal/redirect`;
    const deepLink = getDeepLink()
    const url = `${loginUrl}?redirect_url=${deepLink}`;
    try {
    InAppBrowser.openAuth(url, deepLink, {
      // iOS Properties
      ephemeralWebSession: false,
      // Android Properties
      showTitle: false,
      enableUrlBarHiding: true,
      enableDefaultShare: false
    }).then((response) => {
          console.log(response)
        if (
          response.type === 'success' &&
          response.url
        ) {
          // Utils.openUrl(response.url)
          console.log(response)
        }
      })
    } catch (error) {
      console.log(error)
    }
  }

Browser screen is closed on android when application launched from background

Which platform(s) does your issue occur on?

  • Android
  • Android version: 9
  • Both emulator and android phone

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.1.2
  • Cross-platform modules: 7.1.0
  • Runtime(s): tns-android: 7.0.1
  • Plugin(s): 3.0.2

Please, tell us how to recreate the issue in as much detail as possible.

I am using the plugin for opening a login url inside the application where user have to enter his credentials. During that process if user closes the application by pressing home button on android phone, and opens the app again by pressing app icon from phone menu, webview screen is automatically closed.
I wanted to know if is there a way to keep the webview login screen open when user opens the app by pressing app icon from phone menu.
I am using: android:launchMode="singleTask" in AndroidManifest.xml

Is there any code involved?

It can be reproduced in sample application

onClose event

Does this plugin provide an onClose event?
I want to execute some code when the user closes the inAppBrowser. How?

Application fails to start when upgraded from nativescript 6.2.2 to 6.5.0

Which platform(s) does your issue occur on?

  • iOS (Fails to Build)

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.5.0
  • Cross-platform modules:
    tns-core-modules : 6.5.0
  • Runtime(s):
    tns-android : 6.5.0
    tns-ios : 6.5.0
  • Plugin(s): 2.2.0

Please, tell us how to recreate the issue in as much detail as possible.

Application fails on startup with following error on iOS

NativeScript caught signal 11.
Native Stack:
1 0x10818a251 sig_handler(int)
2 0x7fff51bf5b5d _sigtramp
3 0x7fff51c2a71a libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::setInfoBasedOnIPRegister(bool)
4 0x7fff51c29b85 libunwind::UnwindCursor<libunwind::LocalAddressSpace, libunwind::Registers_x86_64>::step()
5 0x7fff51c2de58 _Unwind_RaiseException
6 0x7fff4f9fcad3 __cxa_rethrow
7 0x7fff50b97cb4 objc_exception_rethrow
8 0x7fff50b98f50 initializeNonMetaClass
9 0x7fff50b994ba initializeAndMaybeRelock(objc_class*, objc_object*, mutex_tt&, bool)
10 0x7fff50ba3a5d lookUpImpOrForward
11 0x7fff50b94219 _objc_msgSend_uncached
12 0x7fff50bac5ce +[NSObject new]
13 0x108b7ba8d ffi_call_unix64
14 0x110aeb950
JS Stack:
new([native code])
at ../node_modules/nativescript-inappbrowser/InAppBrowser.js(file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:226:0)
at webpack_require(file: src/webpack/bootstrap:753:0)
at fn(file: src/webpack/bootstrap:120:0)

InAppBrowser.isAvailable is not a function

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

Tested on Android only

Please, provide the following version numbers that your issue occurs with:

- CLI: 6.5.0
- Cross-platform modules: 6.5.15
- Runtime(s): 6.5.0
- Plugin(s): "dependencies": {
    "@nativescript/theme": "~2.3.0",
    "@nstudio/nativescript-camera-plus": "^3.0.7",
    "nativescript-background-http": "^4.2.1",
    "nativescript-cardview": "^3.2.0",
    "nativescript-cfalert-dialog": "^1.0.15",
    "nativescript-connectycube": "^3.6.1",
    "nativescript-download-progress": "^1.3.0",
    "nativescript-downloadmanager": "^0.1.0",
    "nativescript-filter-select": "^1.3.0",
    "nativescript-gif": "^4.0.6",
    "nativescript-image": "^3.0.12",
    "nativescript-image-cache-it": "^6.0.0",
    "nativescript-imagepicker": "^7.1.0",
    "nativescript-inappbrowser": "^2.3.0",
    "nativescript-ripple": "^2.2.1",
    "nativescript-sinch": "^1.1.5",
    "nativescript-textinputlayout": "^2.0.7",
    "nativescript-toast": "^2.0.0",
    "nativescript-ui-listview": "^9.0.1",
    "nativescript-ui-sidedrawer": "^9.0.2",
    "tns-core-modules": "~6.5.0"
  },
  "devDependencies": {
    "nativescript-dev-webpack": "~1.5.0"
  },

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.
I added the plugin to my nativescript core (JS) project and i copied the code from the documentation to my project.

Is there any code involved?

 const openUrl = require("tns-core-modules/utils/utils").openUrl;
const alert = require("tns-core-modules/ui/dialogs").alert;
const InAppBrowser = require("nativescript-inappbrowser");

videoCall: function (args) {
    try {
      const url = "https://example.com";
      if (InAppBrowser.isAvailable()) {
        const result = InAppBrowser.open(url, {
          // iOS Properties
          dismissButtonStyle: 'cancel',
          preferredBarTintColor: '#453AA4',
          preferredControlTintColor: 'white',
          readerMode: false,
          animated: true,
          modalPresentationStyle: 'fullScreen',
          modalTransitionStyle: 'partialCurl',
          modalEnabled: true,
          enableBarCollapsing: false,
          // Android Properties
          showTitle: true,
          toolbarColor: '#6200EE',
          secondaryToolbarColor: 'black',
          enableUrlBarHiding: true,
          enableDefaultShare: true,
          forceCloseOnRedirection: false,
          // Specify full animation resource identifier(package:anim/name)
          // or only resource name(in case of animation bundled with app).
          animations: {
            startEnter: 'slide_in_right',
            startExit: 'slide_out_left',
            endEnter: 'slide_in_left',
            endExit: 'slide_out_right'
          },
          headers: {
            'my-custom-header': 'MVM'
          }
        })
        alert({
          title: 'Response',
          message: JSON.stringify(result),
          okButtonText: 'Ok'
        })
      }
      else {
        openUrl(url);
      }
    }
    catch(error) {
      alert({
        title: 'Error',
        message: error.message,
        okButtonText: 'Ok'
      })
  }
},

can't compile custom component dynamically in nativescript angular

hi
I'm using a Angular Dynamic Compile component called "P3X Angular Compile", that turns a string into a compiled component in my nativescript project.
link : https://npm.taobao.org/package/p3x-angular-compile
I install that via npm in my {N} project but now work, so I use a part of P3X's source code in my project like this :

const reverse = (str: string) => { return str.split("").reverse().join(""); }
const random = () => { return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16); }
let currentIdTime:let currentId = 0;

does not work, ERROR

I just created a new project in NS Sidekick (core XML/TypeScript), and added this plugin, and built app on my Android device, copied and paste the demo page files, but this when I open my app, this ERROR message appears
67127477_2342535762627551_470824652973801472_n

Which platform(s) does your issue occur on?

  • Android
  • Android version 9
  • Real device. Samsung Galaxy A70

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.0.2
  • Cross-platform modules: 6.0.0
  • Runtime(s): "tns-android" version 6.0.0
  • Plugin(s): using latest core-tns-modules, core-theme, typescript, and dev-webpack, all appear latest in Sidekick GUI, and obviously InAppBrowser.

EDIT:
Nothing works, each time new build and I try new ways, new kind of error messages appear,
once even a dialog opened while taping on the search (from demo), it said something like " cannot build of undefined...".
Also, I tried to use the code from readme, but the browser does not open, no errors appear, no feedback...

Should enableUrlBarHiding work in the same manner as enableBarCollapsing ?

Which platform(s) does your issue occur on?

  • Android
  • emulator and device.

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.5.0
  • Cross-platform modules: 6.5.1
  • Runtime(s):
    tns-android : 6.5.0
    tns-ios : 6.5.0
  • Plugin(s): 2.3.0

Please, tell us how to recreate the issue in as much detail as possible.

I am calling InAppBrowser.open with the property enableUrlBarHiding: false,
Should this prevent the url from being hidden when you scroll down the page on android, in the same manner as enableBarCollapsing: false in IOS, or am I misunderstanding the property?

openAuth isn't working as expected

Which platform(s) does your issue occur on?

  • Android
  • Android pie
  • emulator pixel 3 | API LEVEL 28

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.5.0
  • Cross-platform modules: 6.5.1
  • Runtime(s): 6.5.0
  • Framework: nativescript-vue 2.6.1

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

  1. i am using the module openAuth for Google sign in
  2. the module even gives a success response but the app crashes right after the response

Is there any code involved?

// the block of code where all starts breaking
async onLogin() {
const deepLink = application-deeplink
const url = https://my-auth-login-page.com?redirect_uri=${deepLink}
try {
InAppBrowser.openAuth(url, deepLink, {
// iOS Properties
ephemeralWebSession: false,
// Android Properties
showTitle: false,
enableUrlBarHiding: true,
enableDefaultShare: false
}).then((response) => {
if (
response.type === 'success' &&
response.url
) {
Linking.openURL(response.url)
}
})
} catch (error) {
Linking.openURL(url)
}
}

console logs

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to resume activity {com.package/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onActivityResumed failed
System.err: TypeError: Cannot read property 'resumeWithUrl' of undefined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to resume activity {app.pocketnerd/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onActivityResumed failed
System.err: TypeError: Cannot read property 'resumeWithUrl' of undefined
System.err: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4052)
System.err: at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:4089)
System.err: at android.app.servertransaction.ResumeActivityItem.execute(ResumeActivityItem.java:51)
System.err: at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:145)
System.err: at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:70)
System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1978)
System.err: at android.os.Handler.dispatchMessage(Handler.java:106)
System.err: at android.os.Looper.loop(Looper.java:232)
System.err: at android.app.ActivityThread.main(ActivityThread.java:7172)
System.err: at java.lang.reflect.Method.invoke(Native Method)
System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:888)
System.err: Caused by: com.tns.NativeScriptException: Calling js method onActivityResumed failed
System.err: TypeError: Cannot read property 'resumeWithUrl' of undefined
System.err: at com.tns.Runtime.callJSMethodNative(Native Method)
System.err: at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1286)
System.err: at com.tns.Runtime.callJSMethodImpl(Runtime.java:1173)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1160)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1138)
System.err: at com.tns.Runtime.callJSMethod(Runtime.java:1134)
System.err: at com.tns.gen.android.app.Application_ActivityLifecycleCallbacks.onActivityResumed(Application_ActivityLifecycleCallbacks.java:32)
System.err: at android.app.Application.dispatchActivityResumed(Application.java:261)
System.err: at android.app.Activity.onResume(Activity.java:1397)
System.err: at androidx.fragment.app.FragmentActivity.onResume(FragmentActivity.java:514)
System.err: at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1413)
System.err: at android.app.Activity.performResume(Activity.java:7467)
System.err: at android.app.ActivityThread.performResumeActivity(ActivityThread.java:4044)
System.err: ... 11 more

Is there any way to detect the URL in the In App Browser?

I want to implement auto close the InAppBrowser once the InAppBrowser redirect to a URL from a URL. So far in the documentation there's no way for me to check the URL of the InAppBrowser.

Another way of implementing the auto close that I could think of is, when the app received a notification from firebase, I will call the close() method.

I've put the logic in App.vue in the mounted method

mounted() { firebase.addOnMessageReceivedCallback( message => { let notification_type = message.data.notification_type; if(notification_type === 'payment_success') { setTimeout(() => { InAppBrowser.close() }, 2000) } } ).catch(e => console.error(e)); }

So far it is not working

Cannot build app with this plugin: System.err: Error: com.tns.system.classes.loading.LookedUpClassNotFound: Class "com.proyecto26.inappbrowser.ChromeTabsManagerActivity" not found.

I am writing an app with NativeScript 6 and Angular 8.

I am trying to use this plugin in my app.

package.json

{
  "nativescript": {
    "id": "org.nativescript.abc",
    "tns-android": {
      "version": "6.1.2"
    },
    "tns-ios": {
      "version": "6.1.0"
    }
  },
  "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/theme": "^2.2.1",
    "@schematics/angular": "^8.3.18",
    "autobind-decorator": "^2.4.0",
    "nativescript-angular": "~8.2.0",
    "nativescript-inappbrowser": "^2.2.0",
    "nativescript-theme-core": "~1.0.6",
    "nativescript-toast": "^2.0.0",
    "nativescript-ui-dataform": "^6.0.0",
    "nativescript-unit-test-runner": "^0.7.0",
    "nativescript-urlhandler": "^1.3.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.4.0",
    "tns-core-modules": "~6.1.0",
    "tns-platform-declarations": "^6.4.1",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~8.2.0",
    "@ngtools/webpack": "~8.2.0",
    "@types/jasmine": "3.4.0",
    "@types/jest": "^24.0.20",
    "@types/mocha": "^5.2.7",
    "karma": "4.4.1",
    "karma-jasmine": "2.0.1",
    "karma-nativescript-launcher": "0.4.0",
    "karma-webpack": "3.0.5",
    "nativescript-dev-webpack": "~1.2.0",
    "node-sass": "4.12.0",
    "sass": "^1.23.7",
    "sass-loader": "^8.0.0",
    "typescript": "~3.5.3"
  }
}

When I run tns run android, I get these errors:

System.err: An uncaught Exception occurred on "main" thread.

System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function 

System.err: Error: com.tns.system.classes.loading.LookedUpClassNotFound: Class "com.proyecto26.inappbrowser.ChromeTabsManagerActivity" not found.

System.err:     com.tns.system.classes.loading.impl.ClassStorageServiceImpl.retrieveClass(ClassStorageServiceImpl.java:46)

System.err:     com.tns.ClassResolver.resolveClass(ClassResolver.java:29)

System.err:     com.tns.Runtime.resolveClass(Runtime.java:717)

System.err:     com.tns.Runtime.runModule(Native Method)

System.err:     com.tns.Runtime.runModule(Runtime.java:662)

System.err:     com.tns.Runtime.run(Runtime.java:654)

System.err:     com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21)

System.err:     android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1020)

System.err:     android.app.ActivityThread.handleBindApplication(ActivityThread.java:5109)

System.err:     android.app.ActivityThread.access$1600(ActivityThread.java:177)

System.err:     android.app.ActivityThread$H.handleMessage(ActivityThread.java:1509)

System.err:     android.os.Handler.dispatchMessage(Handler.java:102)

System.err:     android.os.Looper.loop(Looper.java:145)

System.err:     android.app.ActivityThread.main(ActivityThread.java:5938)

System.err:     java.lang.reflect.Method.invoke(Native Method)

System.err:     java.lang.reflect.Method.invoke(Method.java:372)

System.err:     com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)

System.err:     com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)

System.err: File: (/data/data/org.nativescript.SelfServiceApp/files/internal/ts_helpers.js:154:25)

System.err: StackTrace: 

System.err: 	(/data/data/org.nativescript.SelfServiceApp/files/internal/ts_helpers.js:154:26)

System.err: 	at DecorateConstructor(file:///node_modules\reflect-metadata\Reflect.js:541:0)

System.err: 	at decorate(file:///node_modules\reflect-metadata\Reflect.js:130:0)

System.err: 	at __decorate(/data/data/org.nativescript.SelfServiceApp/files/internal/ts_helpers.js:8:23)

System.err: 	at (file:///node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:80:0)

System.err: 	at (file:///node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:85:1)

System.err: 	at ../node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js(file:///data/data/org.nativescript.SelfServiceApp/files/app/vendor.js:92644:30)

System.err: 	at __webpack_require__(file:///src\webpack\bootstrap:750:0)

System.err: 	at fn(file:///src\webpack\bootstrap:120:0)

System.err: 	at (file:///node_modules\nativescript-inappbrowser\InAppBrowser.js:12:34)

System.err: 	at ../node_modules/nativescript-inappbrowser/InAppBrowser.js(file:///data/data/org.nativescript.SelfServiceApp/files/app/vendor.js:92929:30)

System.err: 	at __webpack_require__(file:///src\webpack\bootstrap:750:0)

System.err: 	at fn(file:///src\webpack\bootstrap:120:0)

System.err: 	at ./app/authentication/single-sign-on/sso-authentication.service.ts(file:///src\app\authentication\single-sign-on\sso-authentication.service.ts:1:0)

System.err: 	at __webpack_require__(file:///src\webpack\bootstrap:750:0)

System.err: 	at fn(file:///src\webpack\bootstrap:120:0)

System.err: 	at ./app/authentication/register-via-sso/register-via-sso.component.ts(file:///src\app\authentication\register-via-sso\register-via-sso.component.ts:1:0)

System.err: 	at __webpack_require__(file:///src\webpack\bootstrap:750:0)

System.err: 	at fn(file:///src\webpack\bootstrap:120:0)

System.err: 	at ./app/app-routing.module.ts(file:///src\app\app-routing.module.ts:1:0)

System.err: 	at __webpack_require__(file:///src\webpack\bootstrap:750:0)

plugin crashes app after NS7 & Angular 10 upgrade System.err: TypeError: Class constructor Observable cannot be invoked without 'new'

I have an app written with NS7 and Angular 10. Here is the sample code: https://github.com/aquinn637/NS7InAppBrowser

I am using this plugin to open a browser.

When I run the command ns run android I get this error:

Gradle build...
         + setting applicationId
         + applying user-defined configuration from /Users/aubrey/Documents/GitHub/NS7InAppBrowser/App_Resources/Android/app.gradle
         + using android X library androidx.legacy:legacy-support-v4:1.0.0
         + adding nativescript runtime package dependency: nativescript-optimized-with-inspector
         + adding aar plugin dependency: /Users/aubrey/Documents/GitHub/NS7InAppBrowser/node_modules/@nativescript/core/platforms/android/widgets-release.aar
         + adding aar plugin dependency: /Users/aubrey/Documents/GitHub/NS7InAppBrowser/node_modules/nativescript-inappbrowser/platforms/android/nativescript_inappbrowser.aar
Project successfully built.
The build result is located at: /Users/aubrey/Documents/GitHub/NS7InAppBrowser/platforms/android/app/build/outputs/apk/debug/app-debug.apk
Installing on device 2cccaac838017ece...
Successfully installed on device with identifier '2cccaac838017ece'.
Restarting application on device 2cccaac838017ece...
System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function 
System.err: TypeError: Class constructor Observable cannot be invoked without 'new'
System.err: File: (file: node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js:8:0)
System.err: 
System.err: StackTrace: 
System.err: ChromeTabsEvent(file: node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js:8:0)
System.err: 	at (file: node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js:13:0)
System.err: 	at ../node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js(file:///data/data/org.nativescript.NS7InAppBrowser/files/app/vendor.js:152874:30)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at fn(file: src/webpack/bootstrap:120:0)
System.err: 	at (file: node_modules/nativescript-inappbrowser/InAppBrowser.android.js:12:34)
System.err: 	at ../node_modules/nativescript-inappbrowser/InAppBrowser.js(file:///data/data/org.nativescript.NS7InAppBrowser/files/app/vendor.js:153115:30)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at fn(file: src/webpack/bootstrap:120:0)
System.err: 	at ./app/item/items.component.ts(file: src/app/item/items.component.ts:1:0)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at fn(file: src/webpack/bootstrap:120:0)
System.err: 	at ./app/app-routing.module.ts(file: src/app/app-routing.module.ts:1:0)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at fn(file: src/webpack/bootstrap:120:0)
System.err: 	at ./app/app.module.ts(file: src/app/app.module.ts:1:0)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at fn(file: src/webpack/bootstrap:120:0)
System.err: 	at (file:///data/data/org.nativescript.NS7InAppBrowser/files/app/bundle.js:305:73)
System.err: 	at ./main.ts(file:///data/data/org.nativescript.NS7InAppBrowser/files/app/bundle.js:371:30)
System.err: 	at __webpack_require__(file: src/webpack/bootstrap:816:0)
System.err: 	at checkDeferredModules(file: src/webpack/bootstrap:43:0)
System.err: 	at webpackJsonpCallback(file: src/webpack/bootstrap:30:0)
System.err: 	at (file:///data/data/org.nativescript.NS7InAppBrowser/files/app/bundle.js:2:57)
System.err: 	at require(:1:266)
System.err: 
System.err: 
System.err: TypeError: Class constructor Observable cannot be invoked without 'new'

Access to the URL on InAppBrowser

Do we have a way of access the URL parameters? The initial URL that I open the InAppBrowser with actually redirects me to another page where I need to access the queryParams. Is there a way of access the the URL params with this plugin?

exception with nativescript 7

On upgrade to Nativescript 7, I now get an exception when trying to run my app:

System.err: An uncaught Exception occurred on "main" thread.
System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: TypeError: Class constructor Observable cannot be invoked without 'new'
System.err: File: (file: node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:8:41)
System.err:
System.err: StackTrace:
System.err: ChromeTabsEvent(file: node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:8:41)
System.err:     at (file: node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:13:34)
System.err:     at ../node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js(file:///data/data/com.my.domain/files/app/vendor.js:82059:30)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:816:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)
System.err:     at (file: node_modules\nativescript-inappbrowser\InAppBrowser.android.js:12:34)
System.err:     at ../node_modules/nativescript-inappbrowser/InAppBrowser.js(file:///data/data/com.my.domain/files/app/vendor.js:82371:30)
System.err:     at __webpack_require__(file: app\webpack\bootstrap:816:0)
System.err:     at fn(file: app\webpack\bootstrap:120:0)

openAuth does not work for iOS13

openAuth does not work for iOS13. An error is thrown when trying to start the ASWebAuthentication session:

Error Domain=com.apple.AuthenticationServices.WebAuthenticationSession Code=2 "Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start." UserInfo={NSDebugDescription=Cannot start ASWebAuthenticationSession without providing presentation context. Set presentationContextProvider before calling -start.}

This is likely due to the new API for the class introduced in iOS13:
https://developer.apple.com/documentation/authenticationservices/aswebauthenticationpresentationcontextproviding?language=objc

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

Please, ensure your title is less than 63 characters long and starts with a capital
letter.

Which platform(s) does your issue occur on?

  • iOS
  • iOS13
  • All

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it)
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project)
  • Plugin(s): (look for the version numbers in the package.json file of your
    project and paste your dependencies and devDependencies here)

Please, tell us how to recreate the issue in as much detail as possible.

Describe the steps to reproduce it.

Is there any code involved?

  • provide a code example to recreate the problem
  • (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.

Scoped package imports error (@nativescript/core)

Hi !

I upgraded to Angular 10 by following this article https://nativescript.org/blog/angular-10-support/

Even if everything works with a blank project, it seems like when adding some packages not using scoped package names, it give some errors at runtime on android and iOS (emulator).

Log error

***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x10bc9c60e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x10bcee5f4 -[TNSRuntime executeModule:referredBy:]
3   0x10b58ddc3 main
4   0x7fff51a231fd start
5   0x1
JavaScript stack trace:
../node_modules/nativescript-inappbrowser/InAppBrowser.js(file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:35:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/components/welcome/welcome.component.ts(file: src/app/components/welcome/welcome.component.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/app-routing.module.ts(file: src/app/app-routing.module.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/app.module.ts(file: src/app/app.module.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at file:///app/bundle.js:3276:92
at ./main.ts(file:///app/bundle.js:3365:34)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at checkDeferredModules(file: src/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: src/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asy<…>
JavaScript error:
file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:35:0: JS ERROR TypeError: undefined is not an object (evaluating 'utils_1.ios.MajorVersion')
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: TypeError: undefined is not an object (evaluating 'utils_1.ios.MajorVersion')
at
../node_modules/nativescript-inappbrowser/InAppBrowser.js(file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:35:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/components/welcome/welcome.component.ts(file: src/app/components/welcome/welcome.component.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/app-routing.module.ts(file: src/app/app-routing.module.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at ./app/app.module.ts(file: src/app/app.module.ts:1:0)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at fn(file: src/webpack/bootstrap:120:0)
at file:///app/bundle.js:3276:92
at ./main.ts(file:///app/bundle.js:3365:34)
at __webpack_require__(file: src/webpack/bootstrap:816:0)
at checkDeferredModules(file: src/webpack/bootstrap:43:0)
at webpack<…>
NativeScript caught signal 6.
Native Stack:
1   0x10bced251 sig_handler(int)
2   0x7fff51c005fd _sigtramp
3   0x7fff51af4f39 itoa64
4   0x7fff51af0b7c abort
5   0x7fff4f9f7858 abort_message
6   0x7fff4f9e8cbf demangling_unexpected_handler()
7   0x7fff50ba8c0b _objc_terminate()
8   0x7fff4f9f6c87 std::__terminate(void (*)())
9   0x7fff4f9f940b __cxa_get_exception_ptr
10  0x7fff4f9f93d2 __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
11  0x7fff50ba8ad6 _objc_exception_destructor(void*)
12  0x10bc9cb4f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
13  0x10bcee5f4 -[TNSRuntime executeModule:referredBy:]
14  0x10b58ddc3 main
15  0x7fff51a231fd start
16  0x1

Ok so I guessed what was important was this line: file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:35:0: JS ERROR TypeError: undefined is not an object (evaluating 'utils_1.ios.MajorVersion').

By changing (directly in the nodes_modules files) all the imports, in each file, from tns-core-modules to @nativescript/core, I managed to run my app.

I tried some changes here on my forked project and it runs: uderline@aa9cd74

According to you, what should I do ?

Thanks,

Does not work

I used the same exact codes from demo, and clean built my app, but I get this error message:

image

I use these versions of NS
image

OpenAuth: can change the size of the popup

Hi !

I didn't manage to find information so that's why I'm opening an issue.

Device

  • iPad 7th generation (iOS 13)

Project version

  • CLI: 6.6.0-2020-03-12-100308-14143
  • Cross-platform modules: "version": "6.5.12"
  • Runtimes: both android and iOS are 6.5.0
  • Plugins:
"dependencies": {
    "@angular/animations": "~9.1.0",
    "@angular/common": "~9.1.0",
    "@angular/compiler": "~9.1.0",
    "@angular/core": "~9.1.0",
    "@angular/forms": "~9.1.0",
    "@angular/platform-browser": "~9.1.0",
    "@angular/platform-browser-dynamic": "~9.1.0",
    "@angular/router": "~9.1.0",
    "@nativescript/angular": "~9.0.0",
    "@nativescript/theme": "~2.3.0",
    "nativescript-inappbrowser": "^2.3.0",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.5.0",
    "tns-core-modules": "~6.5.0",
    "zone.js": "~0.10.3"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~9.1.0",
    "@ngtools/webpack": "~9.1.0",
    "nativescript-dev-webpack": "~1.5.0",
    "tns-platform-declarations": "~6.5.0",
    "typescript": "~3.8.3"
  }

Details

I use the auth0 website and I'm using the inappbrowser. No issues in the functionnalities and quite easy to put in place so thanks guys !

Although, I'm not sure about something. When using the .open() function, it seems to open in full screen but when using the .openAuth() function, it opens as a small centered square.

image

I went through the code - I'm certainly not an expert (please don't judge me, I come from PHP) - and I didn't find any options referring to the available ones for .open(). Basically, I'm looking for a fullScreen option for the .openAuth() function or a workaround ?

Sample code

.ts

async start() {
        if (await InAppBrowser.isAvailable()) {
            InAppBrowser.openAuth('http://google.com', 'http://google.com', {
                modalEnabled: true,
                modalPresentationStyle: 'fullScreen'
            });
        }
    }

.html

<StackLayout>
    <Button (tap)="start()" text="Start"></Button>
</StackLayout>

Thanks !

A type error

What is this typescript error
image

Details: Just installed inAppBrowser and playing with it, all today and all latest of everything.

communication nativescript <-> browser app

This is maybe not exactly the right place to ask, feel free to point me to the right place.

Is there any way to establish communication between the nativescript app and the js-app in the opened browser tab?
Assuming both know about each other.

AndroidX compatibility (Cannot read property 'Builder' of undefined)

please add androidx compatibility

<StackLayout>
    <Button text="test inappbrowser" (tap)="testBrowser()"></Button>
</StackLayout>

async testBrowser() {
    const url = 'https://www.google.com'
    if (await InAppBrowser.isAvailable()) {
        const result = await InAppBrowser.open(url)
        alert({
        title: 'Response',
        message: JSON.stringify(result),
        okButtonText: 'Ok'
        })
    }
}

Android platform while calling InAppBrowser throw error:

JS: ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'Builder' of undefined
JS: TypeError: Cannot read property 'Builder' of undefined
JS: at Object.push.../node_modules/nativescript-inappbrowser/InAppBrowser.js.InAppBrowserModule.open (file:///data/data/org.nativescript.inappBrowserTest/files/app/vendor.js:80447:44)
JS: at ItemsComponent. (file:///data/data/org.nativescript.inappBrowserTest/files/app/bundle.f10a611c2a8d3c767d72.hot-update.js:38:111)
JS: at step (file:///data/data/org.nativescript.inappBrowserTest/files/app/vendor.js:127752:23)
JS: at Object.next (file:///data/data/org.nativescript.inappBrowserTest/files/app/vendor.js:127733:53)
JS: at fulfilled (file:///data/data/org.nativescript.inappBrowserTest/files/app/vendor.js:127723:58)
JS: at ZoneDelegate.push.../node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js.ZoneDelegate.invoke (file:///data/data/org.nativescript.inappBrowserTest/files/app/vendor.js:78754:26)

here is the steps to create new project and reproduce issue:

tns create [] --ng
cd []
tns plugin add nativescript-inappbrowser
tns platform add android@androidx
npm i tns-core-modules@androidx
tns run android -- bundle

"nativescript": {
"id": "org.nativescript.inappBrowserTest",
"tns-android": {
"version": "6.0.0-2019-06-05-002854-01"
}
}
"dependencies": {
"@angular/...": "~8.0.0",
"nativescript-angular": "~8.0.0",
"nativescript-inappbrowser": "^1.0.2",
...
"tns-core-modules": "^5.4.0-androidx-2019-03-22-160602-06",
}

tns --version 5.4.2
Angular CLI: 8.0.6
Node: 10.16.0
npm 6.9.0
OS: darwin x64
Angular: 8.0.3

Browser in android (IsAvailable returning false)

Hi !

I'm testing my app on Android and it seems like the in-app browser doesn't work whereas on iOS it works like a charm.

await InAppBrowser.isAvailable() always return false on android.

Just in case, I tested the demo app (master) on an emulator Pixel 3 (API 30) and it still doesn't work.

async openLink() {
    try {
      const { url } = this;
      console.log(await InAppBrowser.isAvailable()); // Returns false
      if (await InAppBrowser.isAvailable()) {
        const result = await InAppBrowser.open(url, {
          // iOS Properties
          dismissButtonStyle: 'cancel',
          ....
       });
    ....

So I was wondering if it was a bug, my emulator or am I just missing something ?

Thanks,

Cannot read property 'MajorVersion' of undefined

The issue occurs on :

  • iOS 14
  • Emulator & device
  • CLI: 7.0.9-rc.0

"dependencies": {
"@nativescript/core": "^7.0.5",
"@nativescript/webpack": "3.0.4",
"@nota/nativescript-webview-ext": "^7.0.0",
"axios": "^0.20.0",
"date-fns": "^2.10.0",
"nativescript-audio": "^6.1.0",
"nativescript-carousel": "^7.0.1",
"nativescript-email": "^1.6.0",
"nativescript-feedback": "^2.0.0",
"nativescript-google-analytics": "^0.4.4",
"nativescript-inappbrowser": "^2.2.0",
"nativescript-insomnia": "^2.0.0",
"nativescript-iqkeyboardmanager": "^1.5.1",
"nativescript-modal-datetimepicker": "^1.2.2",
"nativescript-onesignal": "^1.0.8",
"nativescript-orientation": "^2.2.3",
"nativescript-purchase": "^2.0.13",
"nativescript-rater": "^2.1.1",
"nativescript-sentry": "^2.0.0",
"nativescript-social-share": "^1.6.0",
"nativescript-socket.io": "^0.11.1",
"nativescript-status-bar": "^1.2.0",
"nativescript-vibrate": "^4.0.1",
"nativescript-videoplayer": "^5.0.1",
"nativescript-vue": "2.8.1",
"nativescript-vue-star-rating": "^0.0.5",
"underscore": "^1.9.2",
"vuex": "^3.1.2"
},
"devDependencies": {
"@babel/core": "~7.11.6",
"@babel/preset-env": "~7.11.5",
"@nativescript/android": "7.0.0",
"@nativescript/ios": "7.0.0",
"babel-loader": "~8.1.0",
"nativescript-vue-template-compiler": "2.8.1",
"node-sass": "^4.13.1",
"vue-loader": "~15.9.0"
},

The app crashes at launch with this following error :

(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught TypeError: Cannot read property 'MajorVersion' of undefined at ../node_modules/nativescript-inappbrowser/InAppBrowser.js(file: node_modules/nativescript-inappbrowser/InAppBrowser.ios.js:35:28)

[Discussion] Who is using InAppBrowser in production?

I'm heavily wondering about the creation of the "Who is using InAppBrowser" section in the README. Are there any companies/startups that would like to be there? If so, please, post me a URL to your company website. 🙂

[Bug] Same color for Bar and Controls on iOS

Hi there, just opened an small PR #56.

We've noticed a small typo with the param passed to the parseColor method when selecting the preferredControlTintColor. It's getting the color option for the bar instead of the control.

Can you generate a new release with this fix?

Thanks

Execution failed for task ':app:checkDebugDuplicateClasses' android

Hey Folks,
after updatign nativescript to 6.3.3 i cant get it work on android.
i get following errror:

Execution failed for task ':app:checkDebugDuplicateClasses'. Duplicate class com.google.common.util.concurrent.ListenableFuture found in modules guava-26.0-android.jar (com.google.guava:guava:26.0-android) and listenablefuture-1.0.jar (com.google.guava:listenablefuture:1.0) Go to the documentation to learn how to <a href="d.android.com/r/tools/classpath-sync-errors">Fix dependency resolution errors</a>. Unable to apply changes on device: emulator-5554. Error is: Command ./gradlew failed with exit code 1.

Which platform(s) does your issue occur on?

  • Android
  • emulator and device.

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.3.3
  • Cross-platform modules: (check the 'version' attribute in the
  • node_modules/tns-core-modules/package.json 6.3

The error comes, whe i try to build android.

iOS works like charm

Feature request: Ability to open with html string instead of URL.

The Nativescript WebView component allows passing either a URL or a string containing html content. It's sometimes necessary to build an html string and open it, and this would allow this plugin to be used instead of the WebView component where that is necessary.

Thanks for the great plugin!

[iOS] InAppBrowser is reverting the statusbar color settings after closing it

Which platform(s) does your issue occur on?

  • iOS 7.2.0

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.2.0
  • Cross-platform modules: 7.0.0
  • Runtime(s): 7.2.0
  • Plugin(s):
"dependencies": {
    "@nativescript-community/systemui": "^1.1.7",
    "@nativescript/core": "7.0.0",
    "@nativescript/firebase": "^11.1.3",
    "@nativescript/local-notifications": "^5.0.3",
    "@nativescript/webpack": "3.0.0",
    "@nota/nativescript-webview-ext": "^8.0.0",
    "@owen-it/nativescript-uuid": "0.0.4",
    "nativescript-inappbrowser": "^3.0.2",
    "nativescript-socket.io": "^0.11.1",
    "nativescript-vue": "~2.8.0",
    "nativescript-webview-interface": "^1.4.4",
    "vuex": "^3.5.1"
},
"devDependencies": {
    "@babel/core": "^7.11.6",
    "@babel/preset-env": "^7.11.5",
    "@nativescript/android": "7.0.1",
    "@nativescript/ios": "7.2.0",
    "@nativescript/types": "7.0.0",
    "@types/node": "^14.11.2",
    "@vue/test-utils": "^1.1.3",
    "axios": "^0.21.1",
    "babel-jest": "^26.6.3",
    "babel-loader": "^8.1.0",
    "dotenv": "^8.2.0",
    "jest": "^26.6.3",
    "nativescript-vue-template-compiler": "~2.8.0",
    "node-sass": "^4.14.1",
    "typescript": "^4.0.3",
    "vue-jest": "^3.0.7",
    "vue-loader": "15.9.3",
    "vue": "^2.6.12"
},

Please, tell us how to recreate the issue in as much detail as possible.

  • set the status bar color for the iOS app (ie: blue)
  • install the inappbrowser plugin
  • open a link via inappbrowser
  • close it and then notice the statusbar color reverting to the original color/theme (light/dark)

Is there any code involved?

main.ts
image

template
image

inappbrowser code block
image

Screenshots of my app doing the steps above.
image

Load local HTML files

If the demo apps cannot help and there is no issue for your problem, tell us about it

How do I load local HTML files? Those inside app/ directory.

Which platform(s) does your issue occur on?

  • Both
  • Device

[openAuth] redirectUrl parameter

Hi everyone !

I wanted to talk about the openAuth's parameter

Possible issue for iOS users

I just updated XCode to 12.5 - iOS 14.5 - and a small change has appeared for apple devices.
On iOS, putting a : or a / in the redirectUrl argument of the openAuth method will result with an error.

CONSOLE ERROR: Issue when disconnecting the user Error: The provided scheme is not valid. A scheme should not include special characters such as ":" or "/".

Basically you can't write schema://host.com. This is due to ASWebAuthenticationSession which only accepts a schema. Link to a post answered by an Apple engineer: https://developer.apple.com/forums/thread/679251

So ... Maybe we should rename the parameter and/or send a warning saying that it comes from the openAuth method. Also update the doc ?

Dummy value when using Auth0 service

By the way, I use the Auth0 service and the request to send is:

const authorizeUrl = 'https://{tenant}.auth0.com/authorize?audience={audience}&' +
            'scope=offline_access&' +
            'response_type=code&' +
            'client_id={client_id}&' +
            'redirect_uri=' + redirectUri + '&' +
            'code_challenge=' + challenge + '&' +
            'code_challenge_method=S256';

  const response: AuthSessionResult = await InAppBrowser.openAuth(authorizeUrl, 'dummy', {
      // iOS Properties
      ephemeralWebSession: true,
      // Android Properties
      showTitle: false,
      enableUrlBarHiding: true,
      enableDefaultShare: false,
      forceCloseOnRedirection: true,
  });

await InAppBrowser.openAuth(authorizeUrl, 'dummy') see here I use the value "dummy" and it still works like a charm ! Is this normal ? 😮

It seems like Auth0 actually deals with redirect uri so is it relevant to have redirectUrl mandatory ? I know ASWebAuthenticationSession.initWithURLCallbackURLSchemeCompletionHandler asks for it though maybe this method can give a dummy value instead like this:

// InAppBrowser.ios.ts
this.authSession = (
  Utils.ios.MajorVersion >= 12 ? ASWebAuthenticationSession : SFAuthenticationSession
).alloc().initWithURLCallbackURLSchemeCompletionHandler(
  url,
  redirectUrl ?? "dummy",

All this is for the iOS vision but I keep in mind Android. For the dummy value, this also works with Android.

Before I forget, I'm using Nativescript 8 😉 All this has been tested on emulators.

I know PRs are always appreciated but I'd like your opinion on all this before I do anything

Regards,

headers not working in android app

my code with headers is below:
private _url: string;

constructor() {
super();
this.token= JSON.parse(getString("token"));
// Initialize default values.
this._url = 'www.example.com/api/auth';
console.log(this.token);
}

get url(): string {
return this._url;
}

set url(value: string) {
if (this._url !== value) {
this._url = value;
this.notifyPropertyChange('url', value);
}
}

sleep(timeout) {
return new Promise(resolve => setTimeout(resolve, timeout));
}

openLink = async () => {
console.log(this.token);
try {
const { url } = this;
if (await InAppBrowser.isAvailable()) {
const result = await InAppBrowser.open(url, {
// iOS Properties
dismissButtonStyle: 'cancel',
preferredBarTintColor: '#453AA4',
preferredControlTintColor: 'white',
readerMode: false,
animated: true,
modalPresentationStyle: 'overFullScreen',
modalTransitionStyle: 'partialCurl',
modalEnabled: true,
// Android Properties
showTitle: true,
toolbarColor: '#6200EE',
secondaryToolbarColor: 'black',
enableUrlBarHiding: true,
enableDefaultShare: true,
forceCloseOnRedirection: true,
// Specify full animation resource identifier(package:anim/name)
// or only resource name(in case of animation bundled with app).
animations: {
startEnter: 'slide_in_right',
startExit: 'slide_out_left',
endEnter: 'slide_in_left',
endExit: 'slide_out_right'
},
headers: {
'Authorization': this.token
}
});
await this.sleep(800);
alert({
title: 'Response',
message: JSON.stringify(result),
okButtonText: 'Ok'
});
}
else {
openUrl(url);
}
}
catch (error) {
alert({
title: 'Error',
message: error.message,
okButtonText: 'Ok'
});
}
}

output above url is load but unautherized that url error is thrown.

Accessing InAppBrowser object crashes the app

Which platform(s) does your issue occur on?

  • Android: 10

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.8.0
  • Cross-platform modules: 6.5.27
  • Runtime(s): tns-android: 6.5.0
  • Plugin(s):
    image

Please, tell us how to recreate the issue in as much detail as possible.

I don't know if I am missing something but I can't access the InAppBrowser object without the app crashing. This issue should be reproducible by following the steps written below.

Steps to reproduce:

  1. Create a simple NativeScript app using tns create app.
  2. Install the nativescript-inappbrowser module.
  3. Adapt the basic onTap function or create a new function that involves the InAppBrowser object (see screenshot).
  4. Observe that the app will crash when this object is being accessed with the following error:
    image

Is there any code involved?

image

Any help is much appreciated! 😊

Is there any way to listen to events within the inAppBrowser?

Hi Maintainers,

I have the following question:
I am using the function open to load a website and I would like to close the InAppBrowser if the website loading returns a network or http error. Is there any way to listen to them?

Thanks a lot.

Android Crash - TypeError: Cannot read property 'resources' of undefined

Which platform(s) does your issue occur on?

  • Android 9
  • Device: Samsung S8+

Please, provide the following version numbers that your issue occurs with:

  • CLI: 6.8.0
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s):
    "tns-ios": { "version": "6.5.2" }, "tns-android": { "version": "6.5.3" }
  • Plugin(s):
    "dependencies": { "nativescript-inappbrowser": "^3.0.2", }

Please, tell us how to recreate the issue in as much detail as possible.

I'm on Nativescript Vue. Running tns run android, app crashes with the following error:

Error calling module function
System.err: TypeError: Cannot read property 'resources' of undefined

2021-03-25 at 1 29 PM

Implementation-wise, it's simply the same as shown in demo.

import { InAppBrowser } from 'nativescript-inappbrowser';
...
this.openMyLink();
...
public async openMyLink() {
  try {
    const url = 'https://google.com'
    if (await InAppBrowser.isAvailable()) {
      const result = await InAppBrowser.open(url, {
        // iOS Properties
        dismissButtonStyle: 'done',
        preferredBarTintColor: '#f4f6fb',
        preferredControlTintColor: '#000',
        readerMode: false,
        animated: true,
        modalPresentationStyle: 'fullScreen',
        modalTransitionStyle: 'coverVertical',
        modalEnabled: true,
        enableBarCollapsing: false,

        // Android Properties
        showTitle: true,
        toolbarColor: '#f4f6fb',
        secondaryToolbarColor: '#000',
        enableUrlBarHiding: true,
        enableDefaultShare: true,
        forceCloseOnRedirection: false,

        animations: {
          startEnter: 'slide_in_right',
          startExit: 'slide_out_left',
          endEnter: 'slide_in_left',
          endExit: 'slide_out_right'
        },
        hasBackButton: true,
        browserPackage: '',
        showInRecents: false
      });
      console.log("--->", result);
    }
    else {
      utils.openUrl(url);
    }
  }
  catch(error) {
    console.log("--->", error);
  }
}

App restarts after successful login

Which platform(s) does your issue occur on?

  • Android
  • Android version: 10
  • Device: Galaxy A6

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.1.2
  • Cross-platform modules: 7.1.0
  • Runtime(s): Android 7.0.1
  • Plugin(s):
{
  "dependencies": {
    "@angular/animations": "~11.0.0",
    "@angular/common": "~11.0.0",
    "@angular/compiler": "~11.0.0",
    "@angular/core": "~11.0.0",
    "@angular/forms": "~11.0.0",
    "@angular/platform-browser": "~11.0.0",
    "@angular/platform-browser-dynamic": "~11.0.0",
    "@angular/router": "~11.0.0",
    "@nativescript/angular": "~11.0.0",
    "@nativescript/core": "~7.1.0",
    "@nativescript/theme": "~3.0.0",
    "nativescript-inappbrowser": "^3.0.1",
    "reflect-metadata": "~0.1.12",
    "rxjs": "^6.6.0",
    "zone.js": "~0.11.1"
  },
  "devDependencies": {
    "@angular/compiler-cli": "~11.0.0",
    "@nativescript/android": "7.0.1",
    "@nativescript/types": "~7.0.0",
    "@nativescript/webpack": "~4.0.0",
    "@ngtools/webpack": "~11.0.0",
    "typescript": "~4.0.0"
  }
}

Please, tell us how to recreate the issue in as much detail as possible.

When using the openAuth method with a redirect url on Android the app restarts after a successful login.

  • Android Logcat;
2021-01-13 10:28:43.653 7367-7388/org.nativescript.inappbrowser W/System: A resource failed to call close. 
2021-01-13 10:28:47.717 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@aa3f78f[ChromeTabsManagerActivity]: dispatchDetachedFromWindow
2021-01-13 10:28:47.722 7367-7367/org.nativescript.inappbrowser D/InputTransport: Input channel destroyed: 'dfd798 ', fd=80
2021-01-13 10:28:47.808 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@e1ebee[NativeScriptActivity]: dispatchDetachedFromWindow
2021-01-13 10:28:47.820 7367-7367/org.nativescript.inappbrowser D/InputTransport: Input channel destroyed: '1313219', fd=72
2021-01-13 10:28:47.821 7367-7367/org.nativescript.inappbrowser W/ActivityThread: handleWindowVisibility: no activity for token android.os.BinderProxy@453a0c6
2021-01-13 10:28:47.897 7367-7367/org.nativescript.inappbrowser I/JS: Angular is running in development mode. Call enableProdMode() to enable production mode.
2021-01-13 10:28:47.934 7367-7367/org.nativescript.inappbrowser D/PhoneWindow: forceLight changed to true [] from com.android.internal.policy.PhoneWindow.updateForceLightNavigationBar:4238 com.android.internal.policy.DecorView.updateColorViews:1510 com.android.internal.policy.PhoneWindow.dispatchWindowAttributesChanged:3216 android.view.Window.setFlags:1148 com.android.internal.policy.PhoneWindow.generateLayout:2444 
2021-01-13 10:28:47.935 7367-7367/org.nativescript.inappbrowser I/MultiWindowDecorSupport: updateCaptionType >> DecorView@ffb86f[], isFloating: false, isApplication: true, hasWindowDecorCaption: false, hasWindowControllerCallback: true
2021-01-13 10:28:47.935 7367-7367/org.nativescript.inappbrowser D/MultiWindowDecorSupport: setCaptionType = 0, DecorView = DecorView@ffb86f[]
2021-01-13 10:28:47.987 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@427c60a[NativeScriptActivity]: setView = com.android.internal.policy.DecorView@ffb86f TM=true MM=false
2021-01-13 10:28:48.022 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@427c60a[NativeScriptActivity]: Relayout returned: old=(0,0,720,1480) new=(0,0,720,1480) req=(720,1480)0 dur=10 res=0x7 s={true 4037935104} ch=true
2021-01-13 10:28:48.023 7367-7431/org.nativescript.inappbrowser D/OpenGLRenderer: createReliableSurface : 0xd5ceac00, 0xf0ae0000
2021-01-13 10:28:48.024 7367-7431/org.nativescript.inappbrowser D/mali_winsys: EGLint new_window_surface(egl_winsys_display *, void *, EGLSurface, EGLConfig, egl_winsys_surface **, EGLBoolean) returns 0x3000
2021-01-13 10:28:48.097 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@427c60a[NativeScriptActivity]: MSG_WINDOW_FOCUS_CHANGED 1 1
2021-01-13 10:28:48.097 7367-7367/org.nativescript.inappbrowser D/InputMethodManager: prepareNavigationBarInfo() DecorView@ffb86f[NativeScriptActivity]
2021-01-13 10:28:48.097 7367-7367/org.nativescript.inappbrowser D/InputMethodManager: getNavigationBarColor() -855310
2021-01-13 10:28:48.099 7367-7367/org.nativescript.inappbrowser D/InputMethodManager: prepareNavigationBarInfo() DecorView@ffb86f[NativeScriptActivity]
2021-01-13 10:28:48.100 7367-7367/org.nativescript.inappbrowser D/InputMethodManager: getNavigationBarColor() -855310
2021-01-13 10:28:48.100 7367-7367/org.nativescript.inappbrowser V/InputMethodManager: Starting input: tba=org.nativescript.inappbrowser ic=null mNaviBarColor -855310 mIsGetNaviBarColorSuccess true , NavVisible : true , NavTrans : false
2021-01-13 10:28:48.100 7367-7367/org.nativescript.inappbrowser D/InputMethodManager: startInputInner - Id : 0
2021-01-13 10:28:48.100 7367-7367/org.nativescript.inappbrowser I/InputMethodManager: startInputInner - mService.startInputOrWindowGainedFocus
2021-01-13 10:28:48.103 7367-7367/org.nativescript.inappbrowser D/ViewRootImpl@427c60a[NativeScriptActivity]: MSG_RESIZED: frame=(0,0,720,1480) ci=(0,48,0,96) vi=(0,48,0,96) or=1
2021-01-13 10:28:48.429 7367-7367/org.nativescript.inappbrowser D/AbsListView:  in onLayout changed

Is there any code involved?

https://github.com/SmailHammour/inapp-browser

Screen.Recording.2021-01-13.at.10.37.57.mov

can't compile custom component dynamically in nativescript angular

hi
I'm using a Angular Dynamic Compile component called "P3X Angular Compile", that turns a string into a compiled component in my nativescript project.
link : https://npm.taobao.org/package/p3x-angular-compile
I install that via npm in my {N} project but now work, so I use a part of P3X's source code in my project like this :

const reverse = (str: string) => { return str.split("").reverse().join(""); }
const random = () => { return (Math.floor(Math.random() * (99999999999999999 - 10000000000000000)) + 10000000000000000).toString(16); }
let currentIdTime:let currentId = 0;

3.1.0 seems to not be compiled correctly

I'm getting then following on android:

ReferenceError: NativeClass is not defined
System.err:
System.err: StackTrace:
System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function
System.err: ReferenceError: NativeClass is not defined
System.err: File: (file: node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:87:0)
System.err:
System.err: StackTrace:
System.err: ./node_modules/nativescript-inappbrowser/ChromeTabsManagerActivity.js(file: node_modules\nativescript-inappbrowser\ChromeTabsManagerActivity.js:87:0)
System.err: at webpack_require(file: src\webpack\bootstrap:19:0)

This typically happens when the plugin is built, but ts-patch install has not been executed.

Which platform(s) does your issue occur on?

  • Android emulator

Please, provide the following version numbers that your issue occurs with:

√ Your ANDROID_HOME environment variable is set and points to correct directory.
√ Your adb from the Android SDK is correctly installed.
√ The Android SDK is installed.
√ A compatible Android SDK for compilation is found.
√ Javac is installed and is configured properly.
√ The Java Development Kit (JDK) is installed and is configured properly.
√ Local builds for iOS can be executed only on a macOS system. To build for iOS on a different operating system, you can use the NativeScript cloud infrastructure.
√ Getting NativeScript components versions information...
√ Component nativescript has 8.0.2 version and is up to date.
√ Component @nativescript/core has 8.0.8 version and is up to date.
√ Component @nativescript/ios has 8.0.0 version and is up to date.
√ Component @nativescript/android has 8.0.0 version and is up to date.

Please, tell us how to recreate the issue in as much detail as possible.

Just trying to launch the app will trigger it.

iOS: inAppBrowser does not open when triggered inside a Modal.

Hi there,
the inappbrowser works very-well in android.
In iOS it works very well except in one situation, when you open the inappbrowser inside a modal.
Then it das not appear.

Which platform(s) does your issue occur on?

  • iOS
    Emulator and Device

Please, provide the following version numbers that your issue occurs with:

  • CLI: (run tns --version to fetch it)
  • Cross-platform modules: 6.5.13
  • Runtime(s): 6.5.3

Please, tell us how to recreate the issue in as much detail as possible.

open a link inside a modal.

Test Zip File

just run in ios
test.zip

Fatal Exception: android.util.SuperNotCalledException: Activity {my.app.package/com.proyecto26.inappbrowser.ChromeTabsManagerActivity} did not call through to super.onDestroy()

Make sure to check the demo app(s) for sample usage

Make sure to check the existing issues in this repository

If the demo apps cannot help and there is no issue for your problem, tell us about it

This error is happen on Android 10:

Fatal Exception: android.util.SuperNotCalledException: Activity {my.app.package/com.proyecto26.inappbrowser.ChromeTabsManagerActivity} did not call through to super.onDestroy()
       at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5314)
       at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5360)
       at android.app.servertransaction.DestroyActivityItem.execute(DestroyActivityItem.java:44)
       at android.app.servertransaction.TransactionExecutor.executeLifecycleState(TransactionExecutor.java:176)
       at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:97)
       at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2216)
       at android.os.Handler.dispatchMessage(Handler.java:107)
       at android.os.Looper.loop(Looper.java:237)
       at android.app.ActivityThread.main(ActivityThread.java:7948)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1075)

I think that we have to include this line:


On this line, I think we have to call the super.onDestroy() on the first line (Line 66) to prevent this issues.

Which platform(s) does your issue occur on?

  • Android
  • Android 10.0
  • Device

Is there any code involved?

DeepLinking redirect to app not working

Which platform(s) does your issue occur on?

Android Emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.2.0
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project)
  • Plugin(s): "dependencies": {
    "@angular/animations": "10.0.0",
    "@angular/cdk": "^9.2.1",
    "@angular/common": "10.0.0",
    "@angular/compiler": "10.0.0",
    "@angular/core": "10.0.0",
    "@angular/fire": "^6.0.0",
    "@angular/forms": "10.0.0",
    "@angular/material": "^9.2.1",
    "@angular/platform-browser": "10.0.0",
    "@angular/platform-browser-dynamic": "10.0.0",
    "@angular/router": "10.0.0",
    "@nativescript/angular": "10.0.0",
    "@nativescript/core": "~7.0.0",
    "@nativescript/firebase": "^11.1.3",
    "@nativescript/theme": "~2.5.0",
    "angular-material": "^1.1.21",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "firebase": "^7.14.2",
    "nativescript-audio": "^6.2.1",
    "nativescript-inappbrowser": "^3.0.2",
    "nativescript-remote-builds": "^1.1.1",
    "ng-circle-progress": "^1.5.1",
    "reflect-metadata": "~0.1.12",
    "rxjs": "6.6.0",
    "tslib": "^1.10.0",
    "zone.js": "0.11.1"
    },
    "devDependencies": {
    "@angular-devkit/build-angular": "0.1000.8",
    "@angular/cli": "~9.1.1",
    "@angular/compiler-cli": "10.0.0",
    "@angular/language-service": "~9.1.1",
    "@nativescript/android": "7.0.1",
    "@nativescript/schematics": "^11.0.0",
    "@nativescript/tslint-rules": "~0.0.5",
    "@nativescript/webpack": "~3.0.0",
    "@types/jasmine": "~3.5.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "^12.11.1",
    "codelyzer": "^5.1.2",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~2.1.0",
    "karma-jasmine": "~3.0.1",
    "karma-jasmine-html-reporter": "^1.4.2",
    "protractor": "~5.4.3",
    "ts-node": "~8.3.0",
    "tslint": "~6.1.0",
    "typescript": "^3.8.3"
    },

Please, tell us how to recreate the issue in as much detail as possible.

When i try deeplinking there is 1 sec load when i press PRESS HERE TO REDIRECT and then nothing happens.

AndroidManifest:

	<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
	</intent-filter>
	<intent-filter>
				<action android:name="android.intent.action.VIEW" />
				<category android:name="android.intent.category.DEFAULT" />
				<category android:name="android.intent.category.BROWSABLE" />
				<data android:scheme="my-demo" android:host="demo"  android:scheme="http"/>
	</intent-filter>

deep link function:

  async onLogin() {
    const deepLink = getDeepLink('home')
    const loginUrl = `https://proyecto26.github.io/react-native-inappbrowser`
    const url = `${loginUrl}?redirect_url=${encodeURIComponent(deepLink)}`;
    try {
      if (await InAppBrowser.isAvailable()) {
        InAppBrowser.openAuth(url, deepLink, {
          // iOS Properties
          ephemeralWebSession: false,
          // Android Properties
          showTitle: false,
          enableUrlBarHiding: true,
          enableDefaultShare: false
        }).then((response) => {
          console.log( response)
          if (
            response.type === 'success' &&
            response.url
          ) {
            Utils.openUrl(response.url)
          }
        })
      } else Utils.openUrl(url)
    } catch (error) {
      Utils.openUrl(url)
    }
  }

utilities.ts

export const getDeepLink = (path = "") => {
  const scheme = 'my-demo';
  const prefix = global.isAndroid ? `${scheme}://demo/` : `${scheme}://`;
  return prefix + path;
};

Is there any code involved?

  • provide a code example to recreate the problem
  • (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.

Crashes with error, Unable to start activity ComponentInfo

I'm seeing crashes with error,

Fatal Exception: java.lang.RuntimeException Unable to start activity ComponentInfo{com.MY_APP_NAME/com.proyecto26.inappbrowser.ChromeTabsManagerActivity}: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://MY_WEBSITE/... flg=0x4000000 (has extras) }

Caused by android.content.ActivityNotFoundException No Activity found to handle Intent { act=android.intent.action.VIEW dat=https://MY_WEBSITE

com.proyecto26.inappbrowser.ChromeTabsManagerActivity.onCreate (ChromeTabsManagerActivity.java:52)

for 0.25% of my users.

Which platform(s) does your issue occur on?

  • Android
  • Android 7, 8 (29%), 9 (49%) and 10
  • Devices: Samsung Galaxy XXX(51%), Motorola (14%), HUAWEI, XIOMI

Please, provide the following version numbers that your issue occurs with:

  • I don't have tns-core-modules in my package.json file
  • Plugin(s): "react-native": "0.61.5", "react-native-inappbrowser-reborn": "^3.3.4"

Please, tell us how to recreate the issue in as much detail as possible.

Unfortunately, I am unable to reproduce this issue. It never crashed when I tried it on my devices. It seems to affect 0.25% of users.
This seems to be related to this issue which has been closed with no fix.

Is there any code involved?

async launchInAppBrowser () {
const isAvailable = await InAppBrowser.isAvailable() 
if (isAvailable) {
  await InAppBrowser.open(gateway.uri, {
    toolbarColor: colors.primaryColor,
    secondaryToolbarColor: 'black',
    enableUrlBarHiding: true,
    enableDefaultShare: false,
    forceCloseOnRedirection: false
  })
} else {
  await Linking.openURL(gateway.uri)
}
}

This is the only function which uses InAppBrowser.

Can't start demo app

Which platform(s) does your issue occur on?

Android Emulator

Please, provide the following version numbers that your issue occurs with:

  • CLI: 7.2.0
  • Cross-platform modules: (check the 'version' attribute in the
    node_modules/tns-core-modules/package.json file in your project)
  • Runtime(s): (look for the "tns-android" and "tns-ios" properties in the package.json file of your project)
  • Plugin(s): {
    "description": "NativeScript Application",
    "license": "SEE LICENSE IN ",
    "repository": "",
    "dependencies": {
    "nativescript-inappbrowser": "file:../src",
    "nativescript-theme-core": "~2.0.24",
    "@nativescript/core": "~7.0.0"
    },
    "devDependencies": {
    "@nativescript/android": "7.0.1",
    "@nativescript/ios": "7.0.0",
    "@nativescript/webpack": "~3.0.0",
    "typescript": "~3.9.7"
    },
    "gitHead": "42f2a6a9c94eaf9c68d2a41e0daaa1a2544bc28f",
    "readme": "NativeScript Application",
    "main": "app.js"
    }

Please, tell us how to recreate the issue in as much detail as possible.

git clone https://github.com/proyecto26/react-native-inappbrowser.git
cd demo
tns run android

When i try to launch demo app there are a lot of errors occured:

Errors

ERROR in ../../src/ChromeTabsManagerActivity.ts:1:26
TS2694: Namespace 'android' has no exported member 'content'.
  > 1 | import Context = android.content.Context;
      |                          ^^^^^^^
    2 | import Intent = android.content.Intent;
    3 | import Bundle = android.os.Bundle;
    4 |

ERROR in ../../src/ChromeTabsManagerActivity.ts:2:25
TS2339: Property 'content' does not exist on type 'typeof android'.
    1 | import Context = android.content.Context;
  > 2 | import Intent = android.content.Intent;
      |                         ^^^^^^^
    3 | import Bundle = android.os.Bundle;
    4 |
    5 | import { Observable } from '@nativescript/core';

ERROR in ../../src/ChromeTabsManagerActivity.ts:2:25
TS2694: Namespace 'android' has no exported member 'content'.
    1 | import Context = android.content.Context;
  > 2 | import Intent = android.content.Intent;
      |                         ^^^^^^^
    3 | import Bundle = android.os.Bundle;
    4 |
    5 | import { Observable } from '@nativescript/core';

ERROR in ../../src/ChromeTabsManagerActivity.ts:3:25
TS2694: Namespace 'android' has no exported member 'os'.
    1 | import Context = android.content.Context;
    2 | import Intent = android.content.Intent;
  > 3 | import Bundle = android.os.Bundle;
      |                         ^^
    4 |
    5 | import { Observable } from '@nativescript/core';
    6 | import { BROWSER_TYPES } from './InAppBrowser.common';

ERROR in ../../src/ChromeTabsManagerActivity.ts:5:28
TS2307: Cannot find module '@nativescript/core' or its corresponding type declarations.
    3 | import Bundle = android.os.Bundle;
    4 |
  > 5 | import { Observable } from '@nativescript/core';
      |                            ^^^^^^^^^^^^^^^^^^^^
    6 | import { BROWSER_TYPES } from './InAppBrowser.common';
    7 | import { DISMISSED_EVENT } from './utils.android';
    8 |

ERROR in ../../src/ChromeTabsManagerActivity.ts:27:56
TS2339: Property 'app' does not exist on type 'typeof android'.
    25 | @NativeClass()
    26 | @JavaProxy('com.proyecto26.inappbrowser.ChromeTabsManagerActivity')
  > 27 | export class ChromeTabsManagerActivity extends android.app.Activity {
       |                                                        ^^^
    28 |   private mOpened = false;
    29 |   private resultType = null;
    30 |

ERROR in ../../src/ChromeTabsManagerActivity.ts:43:12
TS2339: Property 'getIntent' does not exist on type 'ChromeTabsManagerActivity'.
    41 |     // in order to close the intent that was started previously so we just close this.
    42 |     if (
  > 43 |       this.getIntent().hasExtra(KEY_BROWSER_INTENT)
       |            ^^^^^^^^^
    44 |       && (!savedInstanceState || !savedInstanceState.getString(BROWSER_RESULT_TYPE))
    45 |     ) {
    46 |       const browserIntent = <Intent>this.getIntent().getParcelableExtra(KEY_BROWSER_INTENT);

ERROR in ../../src/ChromeTabsManagerActivity.ts:46:42
TS2339: Property 'getIntent' does not exist on type 'ChromeTabsManagerActivity'.
    44 |       && (!savedInstanceState || !savedInstanceState.getString(BROWSER_RESULT_TYPE))
    45 |     ) {
  > 46 |       const browserIntent = <Intent>this.getIntent().getParcelableExtra(KEY_BROWSER_INTENT);
       |                                          ^^^^^^^^^
    47 |       browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
    48 |       this.startActivity(browserIntent);
    49 |       this.resultType = DEFAULT_RESULT_TYPE;

ERROR in ../../src/ChromeTabsManagerActivity.ts:48:12
TS2339: Property 'startActivity' does not exist on type 'ChromeTabsManagerActivity'.
    46 |       const browserIntent = <Intent>this.getIntent().getParcelableExtra(KEY_BROWSER_INTENT);
    47 |       browserIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  > 48 |       this.startActivity(browserIntent);
       |            ^^^^^^^^^^^^^
    49 |       this.resultType = DEFAULT_RESULT_TYPE;
    50 |     } else {
    51 |       this.finish();

ERROR in ../../src/ChromeTabsManagerActivity.ts:51:12
TS2339: Property 'finish' does not exist on type 'ChromeTabsManagerActivity'.
    49 |       this.resultType = DEFAULT_RESULT_TYPE;
    50 |     } else {
  > 51 |       this.finish();
       |            ^^^^^^
    52 |     }
    53 |   }
    54 |

ERROR in ../../src/ChromeTabsManagerActivity.ts:65:12
TS2339: Property 'finish' does not exist on type 'ChromeTabsManagerActivity'.
    63 |     } else {
    64 |       this.resultType = BROWSER_TYPES.CANCEL;
  > 65 |       this.finish();
       |            ^^^^^^
    66 |     }
    67 |   }
    68 |

ERROR in ../../src/ChromeTabsManagerActivity.ts:73:35
TS2339: Property 'set' does not exist on type 'ChromeTabsEvent'.
    71 |       switch (this.resultType) {
    72 |         case BROWSER_TYPES.CANCEL:
  > 73 |           BROWSER_ACTIVITY_EVENTS.set('message', 'chrome tabs activity closed');
       |                                   ^^^
    74 |           BROWSER_ACTIVITY_EVENTS.set('resultType', this.resultType);
    75 |           break;
    76 |         default:

ERROR in ../../src/ChromeTabsManagerActivity.ts:74:35
TS2339: Property 'set' does not exist on type 'ChromeTabsEvent'.
    72 |         case BROWSER_TYPES.CANCEL:
    73 |           BROWSER_ACTIVITY_EVENTS.set('message', 'chrome tabs activity closed');
  > 74 |           BROWSER_ACTIVITY_EVENTS.set('resultType', this.resultType);
       |                                   ^^^
    75 |           break;
    76 |         default:
    77 |           BROWSER_ACTIVITY_EVENTS.set('message', 'chrome tabs activity destroyed');

ERROR in ../../src/ChromeTabsManagerActivity.ts:77:35
TS2339: Property 'set' does not exist on type 'ChromeTabsEvent'.
    75 |           break;
    76 |         default:
  > 77 |           BROWSER_ACTIVITY_EVENTS.set('message', 'chrome tabs activity destroyed');
       |                                   ^^^
    78 |           BROWSER_ACTIVITY_EVENTS.set('resultType', DEFAULT_RESULT_TYPE);
    79 |           break;
    80 |       }

ERROR in ../../src/ChromeTabsManagerActivity.ts:78:35
TS2339: Property 'set' does not exist on type 'ChromeTabsEvent'.
    76 |         default:
    77 |           BROWSER_ACTIVITY_EVENTS.set('message', 'chrome tabs activity destroyed');
  > 78 |           BROWSER_ACTIVITY_EVENTS.set('resultType', DEFAULT_RESULT_TYPE);
       |                                   ^^^
    79 |           break;
    80 |       }
    81 |       BROWSER_ACTIVITY_EVENTS.notify({

ERROR in ../../src/ChromeTabsManagerActivity.ts:81:31
TS2339: Property 'notify' does not exist on type 'ChromeTabsEvent'.
    79 |           break;
    80 |       }
  > 81 |       BROWSER_ACTIVITY_EVENTS.notify({
       |                               ^^^^^^
    82 |         eventName: DISMISSED_EVENT,
    83 |         object: BROWSER_ACTIVITY_EVENTS
    84 |       });

ERROR in ../../src/ChromeTabsManagerActivity.ts:92:10
TS2339: Property 'setIntent' does not exist on type 'ChromeTabsManagerActivity'.
    90 |   onNewIntent(intent: Intent): void {
    91 |     super.onNewIntent(intent);
  > 92 |     this.setIntent(intent);
       |          ^^^^^^^^^
    93 |   }
    94 |
    95 |   onRestoreInstanceState(savedInstanceState: Bundle) {

ERROR in ../../src/ChromeTabsManagerActivity.ts:119:56
TS2339: Property 'class' does not exist on type 'typeof ChromeTabsManagerActivity'.
    117 |
    118 | export const createBaseIntent = (context: Context): Intent => {
  > 119 |   return new Intent(context, ChromeTabsManagerActivity.class);
        |                                                        ^^^^^
    120 | };

ERROR in ../../src/InAppBrowser.common.ts:1:23
TS2307: Cannot find module '@nativescript/core' or its corresponding type declarations.
  > 1 | import { Color } from "@nativescript/core";
      |                       ^^^^^^^^^^^^^^^^^^^^
    2 |
    3 | export interface RedirectEvent {
    4 |   url: 'string';

ERROR in ../../src/utils.android.ts:1:27
TS2694: Namespace 'android' has no exported member 'app'.
  > 1 | import Activity = android.app.Activity;
      |                           ^^^
    2 | import Intent = android.content.Intent;
    3 | import NfcAdapter = android.nfc.NfcAdapter;
    4 | import Context = android.content.Context;

ERROR in ../../src/utils.android.ts:2:25
TS2339: Property 'content' does not exist on type 'typeof android'.
    1 | import Activity = android.app.Activity;
  > 2 | import Intent = android.content.Intent;
      |                         ^^^^^^^
    3 | import NfcAdapter = android.nfc.NfcAdapter;
    4 | import Context = android.content.Context;
    5 | import ResolveInfo = android.content.pm.ResolveInfo;

ERROR in ../../src/utils.android.ts:2:25
TS2694: Namespace 'android' has no exported member 'content'.
    1 | import Activity = android.app.Activity;
  > 2 | import Intent = android.content.Intent;
      |                         ^^^^^^^
    3 | import NfcAdapter = android.nfc.NfcAdapter;
    4 | import Context = android.content.Context;
    5 | import ResolveInfo = android.content.pm.ResolveInfo;

ERROR in ../../src/utils.android.ts:3:29
TS2339: Property 'nfc' does not exist on type 'typeof android'.
    1 | import Activity = android.app.Activity;
    2 | import Intent = android.content.Intent;
  > 3 | import NfcAdapter = android.nfc.NfcAdapter;
      |                             ^^^
    4 | import Context = android.content.Context;
    5 | import ResolveInfo = android.content.pm.ResolveInfo;
    6 | import Color = android.graphics.Color;

ERROR in ../../src/utils.android.ts:3:29
TS2694: Namespace 'android' has no exported member 'nfc'.
    1 | import Activity = android.app.Activity;
    2 | import Intent = android.content.Intent;
  > 3 | import NfcAdapter = android.nfc.NfcAdapter;
      |                             ^^^
    4 | import Context = android.content.Context;
    5 | import ResolveInfo = android.content.pm.ResolveInfo;
    6 | import Color = android.graphics.Color;

ERROR in ../../src/utils.android.ts:4:26
TS2694: Namespace 'android' has no exported member 'content'.
    2 | import Intent = android.content.Intent;
    3 | import NfcAdapter = android.nfc.NfcAdapter;
  > 4 | import Context = android.content.Context;
      |                          ^^^^^^^
    5 | import ResolveInfo = android.content.pm.ResolveInfo;
    6 | import Color = android.graphics.Color;
    7 | import List = java.util.List;

ERROR in ../../src/utils.android.ts:5:30
TS2694: Namespace 'android' has no exported member 'content'.
    3 | import NfcAdapter = android.nfc.NfcAdapter;
    4 | import Context = android.content.Context;
  > 5 | import ResolveInfo = android.content.pm.ResolveInfo;
      |                              ^^^^^^^
    6 | import Color = android.graphics.Color;
    7 | import List = java.util.List;
    8 | import Arrays = java.util.Arrays;

ERROR in ../../src/utils.android.ts:6:24
TS2694: Namespace 'android' has no exported member 'graphics'.
    4 | import Context = android.content.Context;
    5 | import ResolveInfo = android.content.pm.ResolveInfo;
  > 6 | import Color = android.graphics.Color;
      |                        ^^^^^^^^
    7 | import List = java.util.List;
    8 | import Arrays = java.util.Arrays;
    9 |

ERROR in ../../src/utils.android.ts:7:15
TS2503: Cannot find namespace 'java'.
     5 | import ResolveInfo = android.content.pm.ResolveInfo;
     6 | import Color = android.graphics.Color;
  >  7 | import List = java.util.List;
       |               ^^^^
     8 | import Arrays = java.util.Arrays;
     9 |
    10 | import {

ERROR in ../../src/utils.android.ts:8:17
TS2304: Cannot find name 'java'.
     6 | import Color = android.graphics.Color;
     7 | import List = java.util.List;
  >  8 | import Arrays = java.util.Arrays;
       |                 ^^^^
     9 |
    10 | import {
    11 |   Utils,

ERROR in ../../src/utils.android.ts:8:17
TS2503: Cannot find namespace 'java'.
     6 | import Color = android.graphics.Color;
     7 | import List = java.util.List;
  >  8 | import Arrays = java.util.Arrays;
       |                 ^^^^
     9 |
    10 | import {
    11 |   Utils,

ERROR in ../../src/utils.android.ts:16:8
TS2307: Cannot find module '@nativescript/core' or its corresponding type declarations.
    14 |   AndroidApplication,
    15 |   AndroidActivityEventData
  > 16 | } from '@nativescript/core';
       |        ^^^^^^^^^^^^^^^^^^^^
    17 | import {
    18 |   RedirectResult,
    19 |   OpenBrowserAsync,

ERROR in ../../src/utils.android.ts:28:42
TS2339: Property 'core' does not exist on type 'typeof androidx'.
    26 | export const CustomTabsIntent = (useAndroidX() ? androidx.browser : android.support).customtabs.CustomTabsIntent;
    27 | export const CustomTabsClient = (useAndroidX() ? androidx.browser : android.support).customtabs.CustomTabsClient;
  > 28 | export const ColorUtils: typeof androidx.core.graphics.ColorUtils = (
       |                                          ^^^^
    29 |   useAndroidX()
    30 |     ? androidx.core.graphics
    31 |     : (android.support.v4.graphics as any)

ERROR in ../../src/utils.android.ts:30:16
TS2339: Property 'core' does not exist on type 'typeof androidx'.
    28 | export const ColorUtils: typeof androidx.core.graphics.ColorUtils = (
    29 |   useAndroidX()
  > 30 |     ? androidx.core.graphics
       |                ^^^^
    31 |     : (android.support.v4.graphics as any)
    32 | ).ColorUtils;
    33 | export const CHROME_PACKAGE_STABLE = "com.android.chrome";

ERROR in ../../src/utils.android.ts:31:24
TS2339: Property 'v4' does not exist on type 'typeof support'.
    29 |   useAndroidX()
    30 |     ? androidx.core.graphics
  > 31 |     : (android.support.v4.graphics as any)
       |                        ^^
    32 | ).ColorUtils;
    33 | export const CHROME_PACKAGE_STABLE = "com.android.chrome";
    34 | export const CHROME_PACKAGE_BETA = "com.chrome.beta";

ERROR in ../../src/utils.common.ts:1:23
TS2307: Cannot find module '@nativescript/core' or its corresponding type declarations.
  > 1 | import { Color } from "@nativescript/core";
      |                       ^^^^^^^^^^^^^^^^^^^^
    2 |
    3 | export function parseColor(color: string | Color) {
    4 |   if (color && !(color instanceof Color)) {

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.