diff --git a/client/Nightr/package-lock.json b/client/Nightr/package-lock.json
index 6091599..10dcff8 100644
--- a/client/Nightr/package-lock.json
+++ b/client/Nightr/package-lock.json
@@ -3784,6 +3784,11 @@
"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": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/nativescript-dev-typescript/-/nativescript-dev-typescript-0.9.0.tgz",
diff --git a/client/Nightr/package.json b/client/Nightr/package.json
index f583598..ea733d8 100644
--- a/client/Nightr/package.json
+++ b/client/Nightr/package.json
@@ -23,6 +23,7 @@
"@angular/router": "~7.2.0",
"nativescript-angular": "~7.2.0",
"nativescript-camera": "^4.4.0",
+ "nativescript-checkbox": "^3.0.3",
"nativescript-geolocation": "^5.0.0",
"nativescript-powerinfo": "^1.0.7",
"nativescript-theme-core": "~1.0.4",
diff --git a/client/Nightr/src/app/home-page/home-page.component.html b/client/Nightr/src/app/home-page/home-page.component.html
index 34a9045..91270c3 100644
--- a/client/Nightr/src/app/home-page/home-page.component.html
+++ b/client/Nightr/src/app/home-page/home-page.component.html
@@ -2,13 +2,14 @@
+
+
+
+
+
+
-
-
-
-
-
diff --git a/client/Nightr/src/app/home-page/home-page.component.ts b/client/Nightr/src/app/home-page/home-page.component.ts
index 329ff98..bb41300 100644
--- a/client/Nightr/src/app/home-page/home-page.component.ts
+++ b/client/Nightr/src/app/home-page/home-page.component.ts
@@ -1,12 +1,11 @@
import { Component, OnInit } from "@angular/core";
-import * as dialogs from "tns-core-modules/ui/dialogs";
import { RouterExtensions } from "nativescript-angular/router";
-import { TouchGestureEventData, GestureEventData } from 'tns-core-modules/ui/gestures'
-import { isEnabled, enableLocationRequest, getCurrentLocation, watchLocation, distance, clearWatch, Location } from "nativescript-geolocation";
+import { GestureEventData } from 'tns-core-modules/ui/gestures'
+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';
-
@Component({
selector: "home-page",
moduleId: module.id,
@@ -15,29 +14,47 @@ import { MyHttpPostService } from '../services/my-http-post-service';
providers: [MyHttpPostService]
})
export class HomePageComponent implements OnInit {
- returnMessage: string = "";
- myReturnJSON: Object;
- locationData: Location;
- myPicture: String;
- image: any;
- flat_earth: boolean;
- in_australia: boolean;
- changeYes: boolean;
-
+ public toggleFlatEarthState = "Is the earth flat?";
+ public toggleIsAustraliaState = "Are you in Australia?";
+ isEarthFlat: boolean;
+ inAustralia: boolean;
constructor(private routerExtensions: RouterExtensions,
) { }
ngOnInit(): void {
}
- public changeGenderMale(){
- if(this.changeYes == true)
- this.changeYes = false;
- else
- this.changeYes = true;
- }
+ public toggleFlatEarth(args) {
+ console.log('Reached toggleFlatearch');
+ let firstSwitch = args.object;
+ if (firstSwitch.checked) {
+ this.isEarthFlat = true;
+ appSettings.setBoolean("applicationIsEarthFlat", true);
+ } else {
+ this.isEarthFlat = false;
+ appSettings.setBoolean("applicationIsEarthFlat", false);
+ }
+ }
+
+ public toggleIsAustralia(args) {
+ let secondSwitch = 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 {
- 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;
}
}
diff --git a/client/Nightr/src/app/result-page/result-page.component.ts b/client/Nightr/src/app/result-page/result-page.component.ts
index f447ffb..0d94949 100644
--- a/client/Nightr/src/app/result-page/result-page.component.ts
+++ b/client/Nightr/src/app/result-page/result-page.component.ts
@@ -6,6 +6,7 @@ import { MyBatteryInfoService } from '../services/my-battery-info.service';
import { MyCameraService } from '../services/my-camera-service'
import { RouterExtensions } from 'nativescript-angular/router';
import { Location } from 'nativescript-geolocation';
+import * as appSettings from "tns-core-modules/application-settings";
class Reason {
constructor(public str: string, public causestring: string) {
@@ -18,6 +19,7 @@ class Reason {
templateUrl: './result-page.component.html',
styleUrls: ['./result-page.component.css'],
moduleId: module.id,
+ providers: [MyHttpPostService]
})
export class ResultPageComponent implements OnInit {
returnMessage: string = "";
@@ -33,10 +35,10 @@ export class ResultPageComponent implements OnInit {
public reasons: Array;
constructor(private myHttpPostSerivce: MyHttpPostService,
- private routerExtensions: RouterExtensions,
- private geoLocationService: MyGeoLocationService,
- private batterInfoService: MyBatteryInfoService,
- private cameraService: MyCameraService,){ }
+ private routerExtensions: RouterExtensions,
+ private geoLocationService: MyGeoLocationService,
+ private batterInfoService: MyBatteryInfoService,
+ private cameraService: MyCameraService,){ }
ngOnInit(): Promise {
return this.cameraService.takePicture().
@@ -61,7 +63,9 @@ public submit(): void {
private makePostRequest(): void {
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 => {
//console.log('This is res', res);
this.JSONObject = res;