diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..5ea3845 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,23 @@ +name: Build CI + +# Trigger the workflow on push +on: [push] + +jobs: + job1: + name: Android Builds + runs-on: macos-latest + steps: + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: 1.8 + + - name: Base Setup + run: npm run ci.base.setup + + - name: Lint + run: npm run ci.tslint + + - name: Build Vanilla Android Demo App + run: npm run ci.vanilla.android.build diff --git a/.prettierrc b/.prettierrc index 650cb88..b57da5f 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,4 +1,6 @@ { "singleQuote": true, - "semi": true + "semi": true, + "arrowParens": "avoid", + "trailingComma": "none" } diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 0d0fa9e..0000000 --- a/.travis.yml +++ /dev/null @@ -1,78 +0,0 @@ -branches: - only: - - master -env: - global: - - ANDROID_PACKAGE_JS='seed-js.apk' - - ANDROID_PACKAGE_FOLDER_JS=$TRAVIS_BUILD_DIR/demo/outputs - - ANDROID_PACKAGE_NG='seed-ng.apk' - - ANDROID_PACKAGE_FOLDER_NG=$TRAVIS_BUILD_DIR/demo-angular/outputs - - ANDROID_SAUCE_STORAGE="https://saucelabs.com/rest/v1/storage/$SAUCE_USER" - -matrix: - include: - - stage: "Lint" - language: node_js - os: linux - node_js: "10" - script: cd src && npm run ci.tslint - - stage: "Build and Test" - env: - - BuildAndroid="28" - - NodeJs="8" - - Type="TypeScript" - language: android - dist: trusty - os: linux - jdk: oraclejdk8 - before_install: nvm install 8 - script: - - cd src - - npm run build - - cd ../demo - - tns build android - - env: - - BuildAndroid="28" - - Type="TypeScript" - language: android - dist: trusty - os: linux - jdk: oraclejdk8 - before_install: nvm install 10 - script: - - cd src - - npm run tsc - - cd ../demo - - travis_wait travis_retry tns build android --copy-to "$ANDROID_PACKAGE_FOLDER_JS/$ANDROID_PACKAGE_JS" - - "curl -u $SAUCE_USER:$SAUCE_KEY -X POST -H 'Content-Type: application/octet-stream' $ANDROID_SAUCE_STORAGE/$ANDROID_PACKAGE_JS?overwrite=true --data-binary @$ANDROID_PACKAGE_FOLDER_JS/$ANDROID_PACKAGE_JS" - - stage: "UI Tests" - env: - - Android="24" - - Type="TypeScript" - language: node_js - os: linux - node_js: "10" - script: - - npm i -g appium - - cd seed-tests && npm i - - travis_wait travis_retry npm run e2e -- --runType android24 --sauceLab --appPath $ANDROID_PACKAGE_JS - - -android: - components: - - tools - - platform-tools - - build-tools-28.0.3 - - android-21 - - android-28 - - extra-android-m2repository - - sys-img-armeabi-v7a-android-21 - -before_install: - - sudo pip install --upgrade pip - - sudo pip install six - -install: - - echo no | npm install -g nativescript - - tns usage-reporting disable - - tns error-reporting disable \ No newline at end of file diff --git a/README.md b/README.md index d66c19a..167531e 100644 --- a/README.md +++ b/README.md @@ -6,31 +6,33 @@ NativeScript-Wear-OS is a NativeScript plugin that provides layouts and utilitie

+ + Action Build + npm npm - - stars - - - forks - - - license -

--- ## Installation +NativeScript Version 7+: + ```bash tns plugin add nativescript-wear-os ``` +NativeScript version prior to 7: + +```bash +tns plugin add nativescript-wear-os@2.1.1 +``` + --- ### Ambient Mode Support @@ -56,9 +58,9 @@ tns plugin add nativescript-wear-os ```javascript // Add your custom Activities, Services and other Android app components here. const appComponents = [ - 'tns-core-modules/ui/frame', - 'tns-core-modules/ui/frame/activity', - resolve(__dirname, 'app/ambient-activity') + '@nativescript/core/ui/frame', + '@nativescript/core/ui/frame/activity', + resolve(__dirname, 'app/ambient-activity'), ]; ``` @@ -156,7 +158,7 @@ The plugin has a success dialog and failure/error dialog to present on WearOS. T ```typescript import { showFailure, - showSuccess + showSuccess, } from 'nativescript-wear-os/packages/dialogs'; showSuccess('Great choice! NativeScript is awesome.', 4).then(() => { diff --git a/demo/app/ambient-activity.ts b/demo/app/ambient-activity.ts index edda9f0..d453078 100644 --- a/demo/app/ambient-activity.ts +++ b/demo/app/ambient-activity.ts @@ -1,15 +1,13 @@ -/// -/// - -import * as application from 'tns-core-modules/application'; import { AndroidActivityCallbacks, setActivityCallbacks -} from 'tns-core-modules/ui/frame'; +} from '@nativescript/core'; +@NativeClass() @JavaProxy('com.nativescript.AmbientActivity') @Interfaces([androidx.wear.ambient.AmbientModeSupport.AmbientCallbackProvider]) -class Activity extends androidx.appcompat.app.AppCompatActivity +class Activity + extends androidx.appcompat.app.AppCompatActivity implements androidx.wear.ambient.AmbientModeSupport.AmbientCallbackProvider { private _callbacks: AndroidActivityCallbacks; @@ -95,6 +93,7 @@ class Activity extends androidx.appcompat.app.AppCompatActivity } } +@NativeClass() class MyAmbientCallback extends androidx.wear.ambient.AmbientModeSupport .AmbientCallback { /** If the display is low-bit in ambient mode. i.e. it requires anti-aliased fonts. */ @@ -122,10 +121,10 @@ class MyAmbientCallback extends androidx.wear.ambient.AmbientModeSupport object: this, data: { isLowBitAmbient: this.mIsLowBitAmbient, - doBurnInProtection: this.mDoBurnInProtection - } + doBurnInProtection: this.mDoBurnInProtection, + }, }; - application.notify(eventData); + global.NativeScriptGlobals.events.notify(eventData); } public onExitAmbient(): void { @@ -135,10 +134,10 @@ class MyAmbientCallback extends androidx.wear.ambient.AmbientModeSupport object: this, data: { isLowBitAmbient: this.mIsLowBitAmbient, - doBurnInProtection: this.mDoBurnInProtection - } + doBurnInProtection: this.mDoBurnInProtection, + }, }; - application.notify(eventData); + global.NativeScriptGlobals.events.notify(eventData); } public onUpdateAmbient(): void { @@ -148,9 +147,9 @@ class MyAmbientCallback extends androidx.wear.ambient.AmbientModeSupport object: this, data: { isLowBitAmbient: this.mIsLowBitAmbient, - doBurnInProtection: this.mDoBurnInProtection - } + doBurnInProtection: this.mDoBurnInProtection, + }, }; - application.notify(eventData); + global.NativeScriptGlobals.events.notify(eventData); } } diff --git a/demo/app/app.ts b/demo/app/app.ts index cc75a29..8f692fb 100644 --- a/demo/app/app.ts +++ b/demo/app/app.ts @@ -1,2 +1,2 @@ -import * as application from 'tns-core-modules/application'; -application.run({ moduleName: 'app-root' }); +import { Application } from '@nativescript/core'; +Application.run({ moduleName: 'app-root' }); diff --git a/demo/app/box-inset-page/box-inset-page.ts b/demo/app/box-inset-page/box-inset-page.ts index 5bf0ca7..e468ca4 100644 --- a/demo/app/box-inset-page/box-inset-page.ts +++ b/demo/app/box-inset-page/box-inset-page.ts @@ -1,4 +1,4 @@ -import { Frame } from 'tns-core-modules/ui/frame'; +import { Frame } from '@nativescript/core'; export function pageLoaded() { console.log('page loaded'); diff --git a/demo/app/circular-progress-page/circular-progress-page.ts b/demo/app/circular-progress-page/circular-progress-page.ts index b97a43d..3af07cb 100644 --- a/demo/app/circular-progress-page/circular-progress-page.ts +++ b/demo/app/circular-progress-page/circular-progress-page.ts @@ -1,4 +1,4 @@ -import { Frame } from 'tns-core-modules/ui/frame'; +import { Frame } from '@nativescript/core'; export function pageLoaded() { console.log('page loaded'); } diff --git a/demo/app/main-page.ts b/demo/app/main-page.ts index 77eda9e..2cac562 100644 --- a/demo/app/main-page.ts +++ b/demo/app/main-page.ts @@ -1,11 +1,10 @@ -import * as observable from 'tns-core-modules/data/observable'; -import * as pages from 'tns-core-modules/ui/page'; +import { EventData, Page } from '@nativescript/core'; import { HelloWorldModel } from './main-view-model'; // Event handler for Page 'loaded' event attached in main-page.xml -export function navigatingTo(args: observable.EventData) { +export function navigatingTo(args: EventData) { // Get the event sender - const page = args.object; + const page = args.object; page.actionBarHidden = true; page.bindingContext = new HelloWorldModel(page); } diff --git a/demo/app/main-page.xml b/demo/app/main-page.xml index 986a47f..a0451cf 100644 --- a/demo/app/main-page.xml +++ b/demo/app/main-page.xml @@ -1,6 +1,6 @@ -