Commit 3980622b by Alen Jose

Merge branch 'alen' into 'master'

july 6 See merge request alen/CMC-driver!10
parents 9e1168bd bfdc8e80
......@@ -10,6 +10,7 @@ import { Myservice } from "../providers/myservice";
import { driver } from "../models/mymodel";
import * as firebase from 'firebase';
import { LocalNotifications } from '@ionic-native/local-notifications';
import { dataService } from "../providers/common.service";
@Component({
templateUrl: 'app.html'
......@@ -25,7 +26,7 @@ export class MyApp {
status: boolean
pushId: string
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events, private localNotifications: LocalNotifications) {
constructor(public platform: Platform, public statusBar: StatusBar, public splashScreen: SplashScreen, private network: Network, private alertCtrl: AlertController, private oneSignal: OneSignal, private locationAccuracy: LocationAccuracy, private storage: Storage, private myservice: Myservice, public events: Events, private localNotifications: LocalNotifications, private data: dataService) {
// , private localNotifications: LocalNotifications
this.initializeApp();
......@@ -162,31 +163,39 @@ export class MyApp {
this.myservice.load_post({ id: this.local.id }, 'getMyRides').subscribe(response => {
if (response.status == 'success') {
// console.log(response.data.upcoming)
var upcoming = response.data.upcoming
var arr = []
for (let i = 0; i < upcoming.length; i++) {
this.localNotifications.schedule([{
arr.push({
id: i,
text: 'Ride Notification',
title: 'CMC-Driver',
trigger: { at: new Date(upcoming[i].pickup_date + upcoming[i].pickup_time) },
trigger: { at: new Date(upcoming[i].pickup_date + ' ' +upcoming[i].pickup_time) },
led: 'FF0000',
sound: null
sound: null,
data: upcoming[i],
vibrate:true,
})
if(i == upcoming.length-1){
this.localNotifications.schedule(arr);
var This = this
setTimeout(() => {
This.localNotifications.getAll().then(data=>{
console.log('1',data)
})
}, 5000);
}
]);
// if(i == upcoming.length-1){
var This = this
setTimeout(() => {
This.localNotifications.getAll().then(data=>{
console.log('1',data)
})
}, 5000);
// }
}
}
})
this.localNotifications.on('click').subscribe(rideData=>{
console.log(rideData)
this.data.setrideData(rideData.data)
this.nav.push('RidedetailsPage')
})
}
}
......@@ -43,8 +43,8 @@ export class SigninPage {
}, 500);
}
else{
This.myservice.hide_loader();
This.myservice.show_alert('', response.message)
this.myservice.hide_loader();
this.myservice.show_alert('', response.message)
}
})
}
......
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