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"; ...@@ -10,6 +10,7 @@ import { Myservice } from "../providers/myservice";
import { driver } from "../models/mymodel"; import { driver } from "../models/mymodel";
import * as firebase from 'firebase'; import * as firebase from 'firebase';
import { LocalNotifications } from '@ionic-native/local-notifications'; import { LocalNotifications } from '@ionic-native/local-notifications';
import { dataService } from "../providers/common.service";
@Component({ @Component({
templateUrl: 'app.html' templateUrl: 'app.html'
...@@ -25,7 +26,7 @@ export class MyApp { ...@@ -25,7 +26,7 @@ export class MyApp {
status: boolean status: boolean
pushId: string 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 // , private localNotifications: LocalNotifications
this.initializeApp(); this.initializeApp();
...@@ -162,31 +163,39 @@ export class MyApp { ...@@ -162,31 +163,39 @@ export class MyApp {
this.myservice.load_post({ id: this.local.id }, 'getMyRides').subscribe(response => { this.myservice.load_post({ id: this.local.id }, 'getMyRides').subscribe(response => {
if (response.status == 'success') { if (response.status == 'success') {
// console.log(response.data.upcoming)
var upcoming = response.data.upcoming var upcoming = response.data.upcoming
var arr = []
for (let i = 0; i < upcoming.length; i++) { for (let i = 0; i < upcoming.length; i++) {
arr.push({
this.localNotifications.schedule([{
id: i, id: i,
text: 'Ride Notification', text: 'Ride Notification',
title: 'CMC-Driver', 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', 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 { ...@@ -43,8 +43,8 @@ export class SigninPage {
}, 500); }, 500);
} }
else{ else{
This.myservice.hide_loader(); this.myservice.hide_loader();
This.myservice.show_alert('', response.message) 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