added sliders on frontpage
This commit is contained in:
parent
02d306f1c5
commit
ca4c0fe1d9
5
client/Nightr/package-lock.json
generated
5
client/Nightr/package-lock.json
generated
|
@ -3784,6 +3784,11 @@
|
||||||
"nativescript-permissions": "^1.2.3"
|
"nativescript-permissions": "^1.2.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nativescript-checkbox": {
|
||||||
|
"version": "3.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/nativescript-checkbox/-/nativescript-checkbox-3.0.3.tgz",
|
||||||
|
"integrity": "sha1-H5oC4BvPi9fSd79IW8CvMa3jdcs="
|
||||||
|
},
|
||||||
"nativescript-dev-typescript": {
|
"nativescript-dev-typescript": {
|
||||||
"version": "0.9.0",
|
"version": "0.9.0",
|
||||||
"resolved": "https://registry.npmjs.org/nativescript-dev-typescript/-/nativescript-dev-typescript-0.9.0.tgz",
|
"resolved": "https://registry.npmjs.org/nativescript-dev-typescript/-/nativescript-dev-typescript-0.9.0.tgz",
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
"@angular/router": "~7.2.0",
|
"@angular/router": "~7.2.0",
|
||||||
"nativescript-angular": "~7.2.0",
|
"nativescript-angular": "~7.2.0",
|
||||||
"nativescript-camera": "^4.4.0",
|
"nativescript-camera": "^4.4.0",
|
||||||
|
"nativescript-checkbox": "^3.0.3",
|
||||||
"nativescript-geolocation": "^5.0.0",
|
"nativescript-geolocation": "^5.0.0",
|
||||||
"nativescript-powerinfo": "^1.0.7",
|
"nativescript-powerinfo": "^1.0.7",
|
||||||
"nativescript-theme-core": "~1.0.4",
|
"nativescript-theme-core": "~1.0.4",
|
||||||
|
|
|
@ -2,13 +2,14 @@
|
||||||
|
|
||||||
<ScrollView class="page">
|
<ScrollView class="page">
|
||||||
<AbsoluteLayout>
|
<AbsoluteLayout>
|
||||||
|
<GridLayout rows="auto auto" columns="* *" class="m-5">
|
||||||
|
<Label class="h3 m-15" text="Is the Earth flat?" textWrap="true" row="0" col="0"></Label>
|
||||||
|
<Switch class="m-15" checked="false" (checkedChange)="toggleFlatEarth($event)" row="0" col="1"></Switch>
|
||||||
|
<Label class="h3 m-15" text="Are you in Australia?" textWrap="true" row="1" col="0"></Label>
|
||||||
|
<Switch class="m-15" checked="false" (checkedChange)="toggleIsAustralia($event)" row="1" col="1"></Switch>
|
||||||
|
</GridLayout>
|
||||||
<StackLayout class="float-btn-container">
|
<StackLayout class="float-btn-container">
|
||||||
<ns-my-button (tap)=onTap($event) text="Nightr"></ns-my-button>
|
<ns-my-button (tap)=onTap($event) text="Nightr"></ns-my-button>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
<StackLayout>
|
|
||||||
<ns-locationButton></ns-locationButton>
|
|
||||||
<ns-camera-button></ns-camera-button>
|
|
||||||
<Button class="btn btn-primary" text="Result page" [nsRouterLink]="['/result-page']"></Button>
|
|
||||||
</StackLayout>
|
|
||||||
</AbsoluteLayout>
|
</AbsoluteLayout>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
import { Component, OnInit } from "@angular/core";
|
import { Component, OnInit } from "@angular/core";
|
||||||
import * as dialogs from "tns-core-modules/ui/dialogs";
|
|
||||||
import { RouterExtensions } from "nativescript-angular/router";
|
import { RouterExtensions } from "nativescript-angular/router";
|
||||||
import { TouchGestureEventData, GestureEventData } from 'tns-core-modules/ui/gestures'
|
import { GestureEventData } from 'tns-core-modules/ui/gestures'
|
||||||
import { isEnabled, enableLocationRequest, getCurrentLocation, watchLocation, distance, clearWatch, Location } from "nativescript-geolocation";
|
import { Switch } from "tns-core-modules/ui/switch";
|
||||||
|
import * as appSettings from "tns-core-modules/application-settings";
|
||||||
|
|
||||||
import { MyHttpPostService } from '../services/my-http-post-service';
|
import { MyHttpPostService } from '../services/my-http-post-service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "home-page",
|
selector: "home-page",
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
@ -15,29 +14,47 @@ import { MyHttpPostService } from '../services/my-http-post-service';
|
||||||
providers: [MyHttpPostService]
|
providers: [MyHttpPostService]
|
||||||
})
|
})
|
||||||
export class HomePageComponent implements OnInit {
|
export class HomePageComponent implements OnInit {
|
||||||
returnMessage: string = "";
|
public toggleFlatEarthState = "Is the earth flat?";
|
||||||
myReturnJSON: Object;
|
public toggleIsAustraliaState = "Are you in Australia?";
|
||||||
locationData: Location;
|
isEarthFlat: boolean;
|
||||||
myPicture: String;
|
inAustralia: boolean;
|
||||||
image: any;
|
|
||||||
flat_earth: boolean;
|
|
||||||
in_australia: boolean;
|
|
||||||
changeYes: boolean;
|
|
||||||
|
|
||||||
constructor(private routerExtensions: RouterExtensions,
|
constructor(private routerExtensions: RouterExtensions,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeGenderMale(){
|
public toggleFlatEarth(args) {
|
||||||
if(this.changeYes == true)
|
console.log('Reached toggleFlatearch');
|
||||||
this.changeYes = false;
|
let firstSwitch = <Switch>args.object;
|
||||||
else
|
if (firstSwitch.checked) {
|
||||||
this.changeYes = true;
|
this.isEarthFlat = true;
|
||||||
}
|
appSettings.setBoolean("applicationIsEarthFlat", true);
|
||||||
|
} else {
|
||||||
|
this.isEarthFlat = false;
|
||||||
|
appSettings.setBoolean("applicationIsEarthFlat", false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public toggleIsAustralia(args) {
|
||||||
|
let secondSwitch = <Switch>args.object;
|
||||||
|
if (secondSwitch.checked) {
|
||||||
|
this.inAustralia = true;
|
||||||
|
appSettings.setBoolean("applicationinAustralia", true);
|
||||||
|
} else {
|
||||||
|
this.inAustralia = false;
|
||||||
|
appSettings.setBoolean("applicationinAustralia", false);
|
||||||
|
console.log('isEarthflat', this.isEarthFlat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public onTap(args: GestureEventData): void {
|
public onTap(args: GestureEventData): void {
|
||||||
this.routerExtensions.navigateByUrl("/result-page");
|
let navigationExtras = {
|
||||||
|
queryParams: {
|
||||||
|
isEarthFlat: this.isEarthFlat,
|
||||||
|
inAustralia: this.inAustralia }
|
||||||
|
}
|
||||||
|
//console.log('this is inAustralia', this.inAustralia, 'This is isEarthFlat', this.isEarthFlat);
|
||||||
|
this.routerExtensions.navigateByUrl("/result-page"), navigationExtras;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { MyBatteryInfoService } from '../services/my-battery-info.service';
|
||||||
import { MyCameraService } from '../services/my-camera-service'
|
import { MyCameraService } from '../services/my-camera-service'
|
||||||
import { RouterExtensions } from 'nativescript-angular/router';
|
import { RouterExtensions } from 'nativescript-angular/router';
|
||||||
import { Location } from 'nativescript-geolocation';
|
import { Location } from 'nativescript-geolocation';
|
||||||
|
import * as appSettings from "tns-core-modules/application-settings";
|
||||||
|
|
||||||
class Reason {
|
class Reason {
|
||||||
constructor(public str: string, public causestring: string) {
|
constructor(public str: string, public causestring: string) {
|
||||||
|
@ -18,6 +19,7 @@ class Reason {
|
||||||
templateUrl: './result-page.component.html',
|
templateUrl: './result-page.component.html',
|
||||||
styleUrls: ['./result-page.component.css'],
|
styleUrls: ['./result-page.component.css'],
|
||||||
moduleId: module.id,
|
moduleId: module.id,
|
||||||
|
providers: [MyHttpPostService]
|
||||||
})
|
})
|
||||||
export class ResultPageComponent implements OnInit {
|
export class ResultPageComponent implements OnInit {
|
||||||
returnMessage: string = "";
|
returnMessage: string = "";
|
||||||
|
@ -33,10 +35,10 @@ export class ResultPageComponent implements OnInit {
|
||||||
public reasons: Array<Reason>;
|
public reasons: Array<Reason>;
|
||||||
|
|
||||||
constructor(private myHttpPostSerivce: MyHttpPostService,
|
constructor(private myHttpPostSerivce: MyHttpPostService,
|
||||||
private routerExtensions: RouterExtensions,
|
private routerExtensions: RouterExtensions,
|
||||||
private geoLocationService: MyGeoLocationService,
|
private geoLocationService: MyGeoLocationService,
|
||||||
private batterInfoService: MyBatteryInfoService,
|
private batterInfoService: MyBatteryInfoService,
|
||||||
private cameraService: MyCameraService,){ }
|
private cameraService: MyCameraService,){ }
|
||||||
|
|
||||||
ngOnInit(): Promise<void> {
|
ngOnInit(): Promise<void> {
|
||||||
return this.cameraService.takePicture().
|
return this.cameraService.takePicture().
|
||||||
|
@ -61,7 +63,9 @@ public submit(): void {
|
||||||
|
|
||||||
private makePostRequest(): void {
|
private makePostRequest(): void {
|
||||||
this.myHttpPostSerivce
|
this.myHttpPostSerivce
|
||||||
.postData({ position: this.locationData, image: this.image, flat_earth: true, in_australia: true, })
|
.postData({ position: this.locationData, image: this.image,
|
||||||
|
flat_earth: appSettings.getBoolean("applicationIsEarthFlat", false),
|
||||||
|
in_australia: appSettings.getBoolean("applicationinAustralia", false), })
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
//console.log('This is res', res);
|
//console.log('This is res', res);
|
||||||
this.JSONObject = res;
|
this.JSONObject = res;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user