diff --git a/.gitignore b/.gitignore index 97f4ab7..9e87428 100644 --- a/.gitignore +++ b/.gitignore @@ -17,4 +17,5 @@ demo/platforms node_modules demo/hooks/ publish/package/ -report/ \ No newline at end of file +report/ +package-lock.json \ No newline at end of file diff --git a/src/.npmignore b/src/.npmignore index 2f91548..6ab875b 100644 --- a/src/.npmignore +++ b/src/.npmignore @@ -2,4 +2,5 @@ *.ts !*.d.ts tsconfig.json -references.d.ts \ No newline at end of file +references.d.ts +*.tgz \ No newline at end of file diff --git a/src/directions.android.ts b/src/directions.android.ts index e6d4064..3e37e8c 100644 --- a/src/directions.android.ts +++ b/src/directions.android.ts @@ -1,6 +1,5 @@ import { DirectionsApi, DirectionsCommon, NavigateToOptions } from "./directions.common"; -import * as application from "tns-core-modules/application"; -import * as utils from "tns-core-modules/utils/utils"; +import { Application, Utils } from "@nativescript/core"; let com: any; @@ -32,7 +31,7 @@ export class Directions extends DirectionsCommon implements DirectionsApi { if (!this.isPackageInstalled()) { // fall back to web - utils.openUrl("http://maps.google.com/maps" + fromToQs); + Utils.openUrl("http://maps.google.com/maps" + fromToQs); } else { const intent = new android.content.Intent( android.content.Intent.ACTION_VIEW, @@ -42,7 +41,7 @@ export class Directions extends DirectionsCommon implements DirectionsApi { intent.addFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); } - (application.android.foregroundActivity || application.android.startActivity).startActivityForResult(intent, 0); + (Application.android.foregroundActivity || Application.android.startActivity).startActivityForResult(intent, 0); } resolve(); diff --git a/src/directions.ios.ts b/src/directions.ios.ts index d18dc1e..e470989 100644 --- a/src/directions.ios.ts +++ b/src/directions.ios.ts @@ -1,4 +1,4 @@ -import { openUrl } from "tns-core-modules/utils/utils"; +import { Utils } from "@nativescript/core"; import { DirectionsApi, DirectionsCommon, NavigateToOptions } from "./directions.common"; const isAppAvailable = require("nativescript-appavailability").availableSync; @@ -17,11 +17,11 @@ export class Directions extends DirectionsCommon implements DirectionsApi { if ((options.ios === undefined || options.ios.preferGoogleMaps !== false) && isAppAvailable("comgooglemaps://")) { // if Google maps is installed, use that, otherwise use Apple maps (which doesn't support waypoints.. so nav to the first destination if that's used) // url = `http://maps.google.com/maps?${fromToQs}+to:${encodeURIComponent("Weerdestein 144, Dordrecht, Netherlands")}`; - openUrl("comgooglemaps://" + fromToQs); + Utils.openUrl("comgooglemaps://" + fromToQs); } else if (options.ios && options.ios.allowGoogleMapsWeb && options.to instanceof Array && options.to.length > 1) { - openUrl("http://maps.google.com/maps" + fromToQs); + Utils.openUrl("http://maps.google.com/maps" + fromToQs); } else { - openUrl("http://maps.apple.com/maps" + fromToQs); + Utils.openUrl("http://maps.apple.com/maps" + fromToQs); } resolve(); } catch (e) { diff --git a/src/package.json b/src/package.json index 1f751c5..a3c9ac9 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { - "name": "nativescript-directions", - "version": "1.4.0", + "name": "@nativescript/directions", + "version": "2.0.0", "description": "Leverage the native Maps app to show directions from and to anywhere you like.", "main": "directions", "typings": "index.d.ts", @@ -52,9 +52,9 @@ "nativescript-appavailability": "~1.3.1" }, "devDependencies": { - "tns-core-modules": "~6.0.1", - "tns-platform-declarations": "~6.0.1", - "typescript": "~3.4.5", - "tslint": "~5.0.0" + "@nativescript/core": "rc", + "@nativescript/types": "rc", + "typescript": "~3.9.0", + "tslint": "~6.1.3" } } diff --git a/src/references.d.ts b/src/references.d.ts index 992a504..fac6b8b 100644 --- a/src/references.d.ts +++ b/src/references.d.ts @@ -1,2 +1,2 @@ -/// -/// \ No newline at end of file +/// +/// \ No newline at end of file diff --git a/src/tsconfig.json b/src/tsconfig.json index 3eb2fd0..5df824c 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { - "target": "es6", - "module": "commonjs", + "target": "es2017", + "module": "esnext", + "moduleResolution": "node", "declaration": true, "removeComments": true, "noLib": false, @@ -16,13 +17,7 @@ "noImplicitAny": false, "noImplicitReturns": true, "noImplicitUseStrict": false, - "noFallthroughCasesInSwitch": true, - "typeRoots": [ - "./node_modules/@types", - "./node_modules" - ], - "types": [ - ] + "noFallthroughCasesInSwitch": true }, "exclude": [ "demo",