From bf5f974f61d1cf15f90ee4b0ae9d301258a3cf32 Mon Sep 17 00:00:00 2001 From: EddyVerbruggen Date: Tue, 30 Jul 2019 11:32:51 +0200 Subject: [PATCH] Support for NativeScript 6 #216 --- .../Android/{ => src/main}/AndroidManifest.xml | 0 .../main/res}/drawable-hdpi/background.png | Bin .../{ => src/main/res}/drawable-hdpi/icon.png | Bin .../{ => src/main/res}/drawable-hdpi/logo.png | Bin .../main/res}/drawable-ldpi/background.png | Bin .../{ => src/main/res}/drawable-ldpi/icon.png | Bin .../{ => src/main/res}/drawable-ldpi/logo.png | Bin .../main/res}/drawable-mdpi/background.png | Bin .../{ => src/main/res}/drawable-mdpi/icon.png | Bin .../{ => src/main/res}/drawable-mdpi/logo.png | Bin .../main/res}/drawable-nodpi/splash_screen.xml | 0 .../main/res}/drawable-xhdpi/background.png | Bin .../{ => src/main/res}/drawable-xhdpi/icon.png | Bin .../{ => src/main/res}/drawable-xhdpi/logo.png | Bin .../main/res}/drawable-xxhdpi/background.png | Bin .../{ => src/main/res}/drawable-xxhdpi/icon.png | Bin .../{ => src/main/res}/drawable-xxhdpi/logo.png | Bin .../main/res}/drawable-xxxhdpi/background.png | Bin .../{ => src/main/res}/drawable-xxxhdpi/icon.png | Bin .../{ => src/main/res}/drawable-xxxhdpi/logo.png | Bin .../{ => src/main/res}/values-v21/colors.xml | 0 .../{ => src/main/res}/values-v21/styles.xml | 0 .../Android/{ => src/main/res}/values/colors.xml | 0 .../Android/{ => src/main/res}/values/styles.xml | 0 demo/package.json | 14 +++++++------- src/barcodescanner.ios.ts | 7 +++---- src/package.json | 8 ++++---- 27 files changed, 14 insertions(+), 15 deletions(-) rename demo/app/App_Resources/Android/{ => src/main}/AndroidManifest.xml (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-hdpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-hdpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-hdpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-ldpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-ldpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-ldpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-mdpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-mdpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-mdpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-nodpi/splash_screen.xml (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xhdpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xhdpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xhdpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxhdpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxhdpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxhdpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxxhdpi/background.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxxhdpi/icon.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/drawable-xxxhdpi/logo.png (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/values-v21/colors.xml (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/values-v21/styles.xml (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/values/colors.xml (100%) rename demo/app/App_Resources/Android/{ => src/main/res}/values/styles.xml (100%) diff --git a/demo/app/App_Resources/Android/AndroidManifest.xml b/demo/app/App_Resources/Android/src/main/AndroidManifest.xml similarity index 100% rename from demo/app/App_Resources/Android/AndroidManifest.xml rename to demo/app/App_Resources/Android/src/main/AndroidManifest.xml diff --git a/demo/app/App_Resources/Android/drawable-hdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-hdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-hdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-hdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-hdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-ldpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-ldpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-ldpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-mdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-mdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-mdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml b/demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml similarity index 100% rename from demo/app/App_Resources/Android/drawable-nodpi/splash_screen.xml rename to demo/app/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/background.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/background.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/icon.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png diff --git a/demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png b/demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png similarity index 100% rename from demo/app/App_Resources/Android/drawable-xxxhdpi/logo.png rename to demo/app/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png diff --git a/demo/app/App_Resources/Android/values-v21/colors.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml similarity index 100% rename from demo/app/App_Resources/Android/values-v21/colors.xml rename to demo/app/App_Resources/Android/src/main/res/values-v21/colors.xml diff --git a/demo/app/App_Resources/Android/values-v21/styles.xml b/demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml similarity index 100% rename from demo/app/App_Resources/Android/values-v21/styles.xml rename to demo/app/App_Resources/Android/src/main/res/values-v21/styles.xml diff --git a/demo/app/App_Resources/Android/values/colors.xml b/demo/app/App_Resources/Android/src/main/res/values/colors.xml similarity index 100% rename from demo/app/App_Resources/Android/values/colors.xml rename to demo/app/App_Resources/Android/src/main/res/values/colors.xml diff --git a/demo/app/App_Resources/Android/values/styles.xml b/demo/app/App_Resources/Android/src/main/res/values/styles.xml similarity index 100% rename from demo/app/App_Resources/Android/values/styles.xml rename to demo/app/App_Resources/Android/src/main/res/values/styles.xml diff --git a/demo/package.json b/demo/package.json index da22b4f..7983ac7 100644 --- a/demo/package.json +++ b/demo/package.json @@ -2,17 +2,17 @@ "nativescript": { "id": "org.nativescript.plugindemo.barcodescanner", "tns-ios": { - "version": "6.0.0-rc-2019-06-28-105002-01" + "version": "6.0.1" }, "tns-android": { - "version": "6.0.0-rc-2019-06-27-172817-03" + "version": "6.0.0" } }, "dependencies": { "nativescript-barcodescanner": "file:../src", "nativescript-theme-core": "^1.0.4", - "nativescript-unit-test-runner": "0.6.3", - "tns-core-modules": "6.0.0-rc-2019-06-28-175837-02" + "nativescript-unit-test-runner": "0.7.0", + "tns-core-modules": "6.0.1" }, "devDependencies": { "jasmine-core": "^2.5.2", @@ -20,10 +20,10 @@ "karma-jasmine": "2.0.1", "karma-nativescript-launcher": "^0.4.0", "nativescript-css-loader": "~0.26.1", - "nativescript-dev-webpack": "1.0.0-rc-2019-07-02-161545-02", - "tns-platform-declarations": "6.0.0-rc-2019-06-28-175837-02", + "nativescript-dev-webpack": "1.0.1", + "tns-platform-declarations": "6.0.1", "tslint": "~5.11.0", - "typescript": "3.4.1", + "typescript": "3.4.5", "karma-webpack": "3.0.5" }, "scripts": { diff --git a/src/barcodescanner.ios.ts b/src/barcodescanner.ios.ts index e90360b..b2b1068 100644 --- a/src/barcodescanner.ios.ts +++ b/src/barcodescanner.ios.ts @@ -4,7 +4,6 @@ import { ScanOptions, ScanResult } from "./barcodescanner-common"; -import * as utils from "tns-core-modules/utils/utils"; export class BarcodeScannerView extends BarcodeScannerBaseView { @@ -119,7 +118,7 @@ export class BarcodeScanner { return; } - this._audioSession = utils.ios.getter(AVAudioSession, AVAudioSession.sharedInstance); + this._audioSession = AVAudioSession.sharedInstance(); this._audioSession.setActiveError(true); this._currentVolume = this._audioSession.outputVolume; if (!this._observerActive) { @@ -208,7 +207,7 @@ export class BarcodeScanner { // only need for denied permission as conveniently, this method will auto-request permission upon scan if (this._hasDeniedCameraPermission()) { if (arg.openSettingsIfPermissionWasPreviouslyDenied) { - utils.ios.getter(UIApplication, UIApplication.sharedApplication).openURL(NSURL.URLWithString(UIApplicationOpenSettingsURLString)); + UIApplication.sharedApplication.openURL(NSURL.URLWithString(UIApplicationOpenSettingsURLString)); } reject("The user previously denied permission to access the camera."); return; @@ -491,7 +490,7 @@ class QRCodeReaderDelegateImpl extends NSObject implements QRCodeReaderDelegate class VolumeObserverClass extends NSObject { observeValueForKeyPathOfObjectChangeContext(path: string, obj: Object, change: NSDictionary, context: any) { if (path === "outputVolume") { - let volumeLevel = utils.ios.getter(MPMusicPlayerController, MPMusicPlayerController.applicationMusicPlayer).volume; + let volumeLevel = MPMusicPlayerController.applicationMusicPlayer.volume; if (volumeLevel > this["_owner"]._currentVolume) { // volume up button pressed, so enable torch this["_owner"]._enableTorch(); diff --git a/src/package.json b/src/package.json index 545c44a..348c426 100644 --- a/src/package.json +++ b/src/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-barcodescanner", - "version": "3.2.1", + "version": "3.2.2", "description": "Scan QR/barcodes with your NativeScript app.", "main": "barcodescanner", "typings": "index.d.ts", @@ -69,9 +69,9 @@ }, "homepage": "https://github.com/eddyverbruggen/nativescript-barcodescanner", "devDependencies": { - "tns-core-modules": "~5.2.2", - "tns-platform-declarations": "~5.2.2", - "typescript": "~2.8.0", + "tns-core-modules": "~6.0.0", + "tns-platform-declarations": "~6.0.0", + "typescript": "3.4.5", "prompt": "^1.0.0", "rimraf": "^2.6.2", "tslint": "^5.11.0",