Commit f4354625 authored by David Burke's avatar David Burke

Updated to NS 6.0. Wear OS version isn't functional yet.

parent 960f78ac
Pipeline #71579200 passed with stage
in 1 minute and 39 seconds
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="__PACKAGE__"
android:versionCode="14"
android:versionName="1.2.0">
android:versionCode="15"
android:versionName="1.3.0">
<supports-screens
android:smallScreens="true"
......
{
"appResourcesPath": "App_Resources",
"appPath": "src",
"nsext": ".tns",
"webext": "",
"shared": true,
"useLegacyWorkflow": false
{
"appResourcesPath": "App_Resources",
"appPath": "src",
"nsext": ".tns",
"webext": "",
"shared": true
}
\ No newline at end of file
This diff is collapsed.
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
import { registerElement } from "nativescript-angular/element-registry";
import { PagerModule } from "nativescript-pager/angular";
import { Carousel, CarouselItem } from "nativescript-carousel";
import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";
......@@ -12,10 +12,12 @@ registerElement(
"SvgImage",
() => require("@teammaestro/nativescript-svg").SVGImage
);
registerElement("Carousel", () => Carousel);
registerElement("CarouselItem", () => CarouselItem);
@NgModule({
declarations: [AppComponent],
imports: [NativeScriptModule, AppRoutingModule, AlyaModule, PagerModule],
imports: [NativeScriptModule, AppRoutingModule, AlyaModule],
providers: [],
bootstrap: [AppComponent],
schemas: [NO_ERRORS_SCHEMA]
......
......@@ -15,15 +15,9 @@
<app-onboarding *ngIf="hasLoaded && devices?.length === 0"></app-onboarding>
<StackLayout *ngIf="devices?.length > 0">
<Pager
[items]="devices"
height="90%"
width="100%"
[selectedIndex]="currentPagerIndex"
(selectedIndexChange)="onPagerIndexChanged($event)"
>
<ng-template let-i="index" let-item="item">
<StackLayout>
<Carousel #carousel (pageChanged)="onPagerIndexChanged($event)" height="90%">
<CarouselItem *ngFor="let item of devices">
<StackLayout class="card">
<app-device-card
[device]="item"
......@@ -31,6 +25,6 @@
(toggleProperty)="toggleProperty.emit($event)"
></app-device-card>
</StackLayout>
</ng-template>
</Pager>
</CarouselItem>
</Carousel>
</StackLayout>
import { Component, Input, Output, EventEmitter, OnInit } from "@angular/core";
import {
Component,
Input,
Output,
EventEmitter,
OnInit,
ViewChild,
ElementRef
} from "@angular/core";
import { IDeviceWithProperties, IProperty } from "../alya/api.interfaces";
import { Carousel } from "nativescript-carousel";
@Component({
selector: "app-home",
......@@ -19,6 +28,7 @@ export class HomeComponent implements OnInit {
value: string;
}>();
@Output() signOut = new EventEmitter();
@ViewChild("carousel", { static: false }) carousel: ElementRef<Carousel>;
/** NS pager */
currentPagerIndex = 0;
title: string;
......@@ -29,6 +39,9 @@ export class HomeComponent implements OnInit {
this._devices = devices;
this.getDowndraftProperty();
this.getDowndraftLabel();
if (this.carousel) {
setTimeout(() => this.refreshCarousel());
}
}
get devices(): IDeviceWithProperties[] {
......@@ -39,6 +52,11 @@ export class HomeComponent implements OnInit {
this.title = this.getTitle();
}
refreshCarousel() {
const adapter = this.carousel.nativeElement.android.getAdapter();
adapter.notifyDataSetChanged();
}
getTitle() {
if (this.devices.length) {
if (this.currentPagerIndex) {
......@@ -58,10 +76,8 @@ export class HomeComponent implements OnInit {
}
}
onPagerIndexChanged(index) {
if (typeof index.value !== "undefined") {
this.currentPagerIndex = index.value;
}
onPagerIndexChanged(args: any) {
this.currentPagerIndex = args.index;
this.title = this.getTitle();
this.getDowndraftProperty();
this.getDowndraftLabel();
......
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptCommonModule } from "nativescript-angular/common";
import { PagerModule } from "nativescript-pager/angular";
import { HomeRoutingModule } from "./home-routing.module";
import { HomeComponent } from "./home.component";
......@@ -16,12 +15,7 @@ import { OnboardingComponent } from "./onboarding/onboarding.component";
DeviceCardComponent,
OnboardingComponent
],
imports: [
HomeRoutingModule,
NativeScriptCommonModule,
SharedModule,
PagerModule
],
imports: [HomeRoutingModule, NativeScriptCommonModule, SharedModule],
exports: [HomeComponent],
schemas: [NO_ERRORS_SCHEMA]
})
......
import { Injectable } from "@angular/core";
import { SnackBar } from "nativescript-snackbar";
import { SnackBar } from "@nstudio/nativescript-snackbar";
@Injectable({
providedIn: "root"
......
......@@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="__PACKAGE__"
android:versionCode="15"
android:versionName="1.2.0">
android:versionCode="16"
android:versionName="1.3.0">
<supports-screens
android:smallScreens="true"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment