dpa99c / phonegap-launch-navigator

Phonegap/Cordova plugin which launches native route navigation apps for Android, iOS and Windows
369 stars 131 forks source link

Issue with adding LaunchNavigator to NgModule providers in Ionic 4 #208

Closed unplugged216 closed 6 years ago

unplugged216 commented 6 years ago

I'm submitting a ... (check one with "x"):

Bug report

When adding 'LaunchNavigator' to providers inside NgModule the following error occurs.

[ng] ERROR in src/app/app.module.ts(17,11): error TS2345: Argument of type '{ declarations: (typeof AppComponent)[]; entryComponents: undefined[]; imports: (ModuleWithProvid...' is not assignable to parameter of type 'NgModule'.
[ng]   Types of property 'providers' are incompatible.
[ng]     Type '(typeof SplashScreen | LaunchNavigatorOriginal | { provide: typeof RouteReuseStrategy; useClass: ...' is not assignable to type 'Provider[]'.
[ng]       Type 'typeof SplashScreen | LaunchNavigatorOriginal | { provide: typeof RouteReuseStrategy; useClass: t...' is not assignable to type 'Provider'.
[ng]         Type 'LaunchNavigatorOriginal' is not assignable to type 'Provider'.
[ng]           Type 'LaunchNavigatorOriginal' is not assignable to type 'ClassProvider'.
[ng]             Property 'provide' is missing in type 'LaunchNavigatorOriginal'.
[ng] src/app/pages/dashboard/main/main.page.ts(88,34): error TS2304: Cannot find name 'LaunchNavigator'.

Expected behavior: I expect this error not to occur? Following the instructions here https://beta.ionicframework.com/docs/native/launch-navigator/ and https://github.com/dpa99c/phonegap-launch-navigator Should work fine. I have been migrating an older ionic 3 app to a new fresh ionic 4 app. All worked prior in ionic 4.

Steps to reproduce:

Environment information

Available platforms: android ~7.0.0 browser ~5.0.1 ios ~4.5.4 osx ~4.0.1 windows ~5.0.0 www ^3.12.0

- Plugins & versions installed in project (including this plugin)
    - `cordova-plugin-geolocation 4.0.1 "Geolocation"`
    - `uk.co.workingedge.phonegap.plugin.launchnavigator 4.2.2 "Launch Navigator"`
- Dev machine OS and version, e.g.
    - Windows 10
        - `1709 (Build 16299.726)`

_If using an [Ionic Native Typescript wrapper]() for this plugin:_

Ionic:

ionic (Ionic CLI) : 4.1.2 (C:\Users\ZacharyHarding\AppData\Roaming\npm\node_modules\ionic) Ionic Framework : @ionic/angular 4.0.0-beta.13 @angular-devkit/core : 0.8.6 @angular-devkit/schematics : 0.8.6 @angular/cli : 6.2.6 @ionic/ng-toolkit : not installed @ionic/schematics-angular : not installed

Cordova:

cordova (Cordova CLI) : 8.0.0 Cordova Platforms : none Cordova Plugins : no whitelisted plugins (1 plugins total)

System:

NodeJS : v9.5.0 (C:\Program Files\nodejs\node.exe) npm : 6.4.1 OS : Windows 10

- Installed Ionic Native modules and versions

+-- @ionic-native/camera@5.0.0-beta.21 +-- @ionic-native/core@5.0.0-beta.21 +-- @ionic-native/geolocation@5.0.0-beta.21 +-- @ionic-native/in-app-browser@5.0.0-beta.21 +-- @ionic-native/launch-navigator@5.0.0-beta.21 +-- @ionic-native/push@5.0.0-beta.21 +-- @ionic-native/splash-screen@5.0.0-beta.21 +-- @ionic-native/status-bar@5.0.0-beta.21



<!--
NOTE: Ionic Native Typescript wrappers are maintained by the Ionic Team:
- Any issue which is suspected of being caused by the Ionic Native wrapper should be reported against Ionic Native (https://github.com/ionic-team/ionic-native/issues)
- To verify an if an issue is caused by this plugin or its Typescript wrapper, please re-test using the vanilla Javascript plugin interface (without the Ionic Native wrapper).
- Any issue opened here which is obviously an Ionic Typescript wrapper issue will be closed immediately.
-->

<!--
A POLITE REMINDER

- This is free, open-source software. 
- Although the author makes every effort to maintain it, no guarantees are made as to the quality or reliability, and reported issues will be addressed if and when the author has time. 
- Help/support will not be given by the author, so forums (e.g. Ionic) or Stack Overflow should be used. Any issues requesting help/support will be closed immediately.
- If you have urgent need of a bug fix/feature, the author can be engaged for PAID contract work to do so: please contact dave@workingedge.co.uk
- Rude or abusive comments/issues will not be tolerated, nor will opening multiple issues if those previously closed are deemed unsuitable. Any of the above will result in you being BANNED from ALL of my Github repositories.
-->
dpa99c commented 6 years ago

This issue relates to the Ionic Native Typescript wrapper for this plugin, which is created and maintained by Ionic. This repo contains only the Launch Navigator Cordova plugin itself, comprised of the native plugin implementation and pure Javascript API.

Therefore the issue should be raised against Ionic Native which contains the relevant Typescript code.

unplugged216 commented 6 years ago

@dpa99c Ah, makes sense. It is literally a guid issue anyhow.

Resolution: add nix to the import. import {LaunchNavigator} from '@ionic-native/launch-navigator/ngx';

Apparently, they need to update quite a bit. I will attempt to throw my two cents in over there.

Thank you.

Fomare commented 5 years ago

That works for me, but now, I get this error when ionic serve

ERROR Error: Uncaught (in promise): TypeError: Object(...) is not a function TypeError: Object(...) is not a function at OneSignal.startInit (index.js:79)

keyurmeandev commented 5 years ago

Facing the same issue here @Fomare

dpa99c commented 5 years ago

OneSignal.startInit indicates the problem lies with the One Signal plugin.

As documented, this plugin requires a native mobile platform (iOS/Android/Windows 10) so will not work in the browser emulation invoked by ionic serve

keyurmeandev commented 5 years ago

@dpa99c Yes, correct it will not work in browser but it's giving same error after building the apk and checking in the android device.

keyurmeandev commented 5 years ago

@dpa99c @Fomare It's done.

We need to install the right version of launch-navigator according to ionic-native version..

npm i @ionic-native/launch-navigator@4.12.0

This has solved my problem..