Comitting before pulling Picture service
This commit is contained in:
parent
57352c3763
commit
024ffe2a7f
|
@ -1,11 +1,11 @@
|
|||
<AbsoluteLayout>
|
||||
<ns-side-drawer></ns-side-drawer>
|
||||
|
||||
<StackLayout class="float-btn-container">
|
||||
<ns-my-button (tap)=onTap($event) text="Nightr"></ns-my-button>
|
||||
</StackLayout>
|
||||
<ns-locationButton (tap)=onLocationTap($event)></ns-locationButton>
|
||||
|
||||
<ns-locationButton></ns-locationButton>
|
||||
<StackLayout class="float-btn-container">
|
||||
<ns-my-button (tap)=onTap($event) text="Nightr"></ns-my-button>
|
||||
</StackLayout>
|
||||
|
||||
</AbsoluteLayout>
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
import { Component } from "@angular/core";
|
||||
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 { 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({
|
||||
selector: "ns-app",
|
||||
|
@ -12,30 +15,38 @@ import { isEnabled, enableLocationRequest, getCurrentLocation, watchLocation, di
|
|||
providers: [MyHttpPostService]
|
||||
})
|
||||
export class AppComponent {
|
||||
public user: string = "";
|
||||
public pass: 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 {
|
||||
this.geoLocationService.getLocation().then(location => {
|
||||
this.locationData = location;
|
||||
console.log('this is locationData', this.locationData);
|
||||
this.submit();
|
||||
dialogs.confirm("Should be result").then(result => {
|
||||
console.log("Dialog result: " + result);
|
||||
}).catch(error => {
|
||||
});
|
||||
}
|
||||
|
||||
public onLocationTap(args: GestureEventData): any {
|
||||
console.log('This should be batterinfo', this.batterInfoService.getPowerPercent());
|
||||
}
|
||||
|
||||
public submit(): void {
|
||||
this.makePostRequest();
|
||||
}
|
||||
|
||||
private makePostRequest(): void {
|
||||
console.log('Reached makepostRequest');
|
||||
this.myHttpPostSerivce
|
||||
.postData({ username: this.user, password: this.pass })
|
||||
.postData({ position: this.locationData })
|
||||
.subscribe(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>
|
||||
<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>
|
||||
</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';
|
||||
@Component({
|
||||
selector: 'ns-locationButton',
|
||||
|
@ -11,12 +12,15 @@ export class MyLocationButtonComponent implements OnInit {
|
|||
lat = "start";
|
||||
geoLocationService = new MyGeoLocationService();
|
||||
|
||||
@Output() tap: EventEmitter<GestureEventData> = new EventEmitter<GestureEventData>();
|
||||
|
||||
constructor() {
|
||||
}
|
||||
ngOnInit() {
|
||||
}
|
||||
|
||||
onTap() {
|
||||
onTap(args: GestureEventData): any {
|
||||
this.tap.emit(args);
|
||||
this.geoLocationService.getLocation().then(location => {
|
||||
this.lat = ""+location.latitude;
|
||||
}).catch(error => {
|
||||
|
|
Loading…
Reference in a new issue