Comitting before pulling Picture service
This commit is contained in:
parent
57352c3763
commit
024ffe2a7f
|
@ -1,11 +1,11 @@
|
||||||
<AbsoluteLayout>
|
<AbsoluteLayout>
|
||||||
<ns-side-drawer></ns-side-drawer>
|
<ns-side-drawer></ns-side-drawer>
|
||||||
|
|
||||||
|
<ns-locationButton (tap)=onLocationTap($event)></ns-locationButton>
|
||||||
|
|
||||||
<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>
|
||||||
|
|
||||||
<ns-locationButton></ns-locationButton>
|
|
||||||
|
|
||||||
</AbsoluteLayout>
|
</AbsoluteLayout>
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,11 @@
|
||||||
import { Component } from "@angular/core";
|
import { Component } from "@angular/core";
|
||||||
import * as dialogs from "tns-core-modules/ui/dialogs";
|
import * as dialogs from "tns-core-modules/ui/dialogs";
|
||||||
import { MyHttpPostService } from './services/my-http-post-service'
|
|
||||||
import { TouchGestureEventData, GestureEventData } from 'tns-core-modules/ui/gestures'
|
import { TouchGestureEventData, GestureEventData } from 'tns-core-modules/ui/gestures'
|
||||||
import { isEnabled, enableLocationRequest, getCurrentLocation, watchLocation, distance, clearWatch } from "nativescript-geolocation";
|
import { Location } from "nativescript-geolocation";
|
||||||
|
|
||||||
|
import { MyHttpPostService } from './services/my-http-post-service'
|
||||||
|
import { MyGeoLocationService} from './services/my-geo-location.service';
|
||||||
|
import { MyBatteryInfoService } from './services/my-battery-info.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: "ns-app",
|
selector: "ns-app",
|
||||||
|
@ -12,30 +15,38 @@ import { isEnabled, enableLocationRequest, getCurrentLocation, watchLocation, di
|
||||||
providers: [MyHttpPostService]
|
providers: [MyHttpPostService]
|
||||||
})
|
})
|
||||||
export class AppComponent {
|
export class AppComponent {
|
||||||
public user: string = "";
|
|
||||||
public pass: string = "";
|
|
||||||
returnMessage: string = "";
|
returnMessage: string = "";
|
||||||
|
myReturnJSON: JSON;
|
||||||
|
locationData: Location;
|
||||||
|
|
||||||
constructor(private myHttpPostSerivce: MyHttpPostService) { }
|
constructor(private myHttpPostSerivce: MyHttpPostService,
|
||||||
|
private geoLocationService: MyGeoLocationService,
|
||||||
|
private batterInfoService: MyBatteryInfoService) { }
|
||||||
|
|
||||||
public onTap(args: GestureEventData): any {
|
public onTap(args: GestureEventData): any {
|
||||||
|
this.geoLocationService.getLocation().then(location => {
|
||||||
|
this.locationData = location;
|
||||||
|
console.log('this is locationData', this.locationData);
|
||||||
this.submit();
|
this.submit();
|
||||||
dialogs.confirm("Should be result").then(result => {
|
}).catch(error => {
|
||||||
console.log("Dialog result: " + result);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public onLocationTap(args: GestureEventData): any {
|
||||||
|
console.log('This should be batterinfo', this.batterInfoService.getPowerPercent());
|
||||||
|
}
|
||||||
|
|
||||||
public submit(): void {
|
public submit(): void {
|
||||||
this.makePostRequest();
|
this.makePostRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
private makePostRequest(): void {
|
private makePostRequest(): void {
|
||||||
console.log('Reached makepostRequest');
|
|
||||||
this.myHttpPostSerivce
|
this.myHttpPostSerivce
|
||||||
.postData({ username: this.user, password: this.pass })
|
.postData({ position: this.locationData })
|
||||||
.subscribe(res => {
|
.subscribe(res => {
|
||||||
console.log('This is res', res);
|
console.log('This is res', res);
|
||||||
this.returnMessage = (<any>res).json.data.username;
|
this.myReturnJSON = (<any>res).json.data.username;
|
||||||
|
console.log('THis is myreturnJSON', this.myReturnJSON);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<StackLayout>
|
<StackLayout>
|
||||||
<Button text="{{title}}" class="btn btn-primary" (tap)="onTap()"></Button>
|
<Button text="{{title}}" class="btn btn-primary" (tap)="onTap($event)"></Button>
|
||||||
<Label text="{{lat}}"></Label>
|
<Label text="{{lat}}"></Label>
|
||||||
</StackLayout>
|
</StackLayout>
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, EventEmitter, OnInit, Output } from '@angular/core';
|
||||||
|
import { TouchGestureEventData, GestureEventData } from 'tns-core-modules/ui/gestures'
|
||||||
import { MyGeoLocationService} from '../../services/my-geo-location.service';
|
import { MyGeoLocationService} from '../../services/my-geo-location.service';
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'ns-locationButton',
|
selector: 'ns-locationButton',
|
||||||
|
@ -11,12 +12,15 @@ export class MyLocationButtonComponent implements OnInit {
|
||||||
lat = "start";
|
lat = "start";
|
||||||
geoLocationService = new MyGeoLocationService();
|
geoLocationService = new MyGeoLocationService();
|
||||||
|
|
||||||
|
@Output() tap: EventEmitter<GestureEventData> = new EventEmitter<GestureEventData>();
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
}
|
}
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
onTap() {
|
onTap(args: GestureEventData): any {
|
||||||
|
this.tap.emit(args);
|
||||||
this.geoLocationService.getLocation().then(location => {
|
this.geoLocationService.getLocation().then(location => {
|
||||||
this.lat = ""+location.latitude;
|
this.lat = ""+location.latitude;
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user