Commit 89236633 by Nabil Sadki

Merge branch 'v1.1.0.0' into v1.1.5.0

# Conflicts:
#	package-lock.json
#	package.json
#	src/app/app.component.ts
#	src/app/app.module.ts
#	src/app/pages/mainslider/mainslider.page.ts
parents 52a15477 6f6627e8
{
"name": "atapp",
"version": "1.1.5.0",
"version": "1.1.5-0",
"author": "Allo Testeurs",
"homepage": "http://www.allo-testeurs.com/",
"scripts": {
......@@ -29,6 +29,7 @@
"@ionic-native/diagnostic": "^5.8.0",
"@ionic-native/file": "^5.14.0",
"@ionic-native/file-path": "^5.14.0",
"@ionic-native/google-analytics": "^5.15.0",
"@ionic-native/google-plus": "^5.0.0",
"@ionic-native/http": "^5.8.0",
"@ionic-native/ionic-webview": "^5.14.0",
......@@ -45,6 +46,7 @@
"cordova-plugin-background-mode": "git+https://github.com/sercatven/cordova-plugin-background-mode.git",
"cordova-plugin-badge": "^0.8.8",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-google-analytics": "^1.8.6",
"cordova-plugin-googleplus": "^8.0.0",
"cordova-plugin-local-notification": "^0.9.0-beta.2",
"cordova-plugin-play-games-services": "^1.1.2",
......@@ -100,7 +102,7 @@
"fs": false,
"module": false
},
"description": "An Ionic project",
"description": "Allo Testeurs application",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
......@@ -127,4 +129,4 @@
"android"
]
}
}
\ No newline at end of file
}
......@@ -6,6 +6,8 @@ import { Platform } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { GoogleAnalytics } from '@ionic-native/google-analytics/ngx';
import { AppVersion } from '@ionic-native/app-version/ngx';
import { TripService } from './services/trip-service';
import { AuthService } from './services/auth.service';
......@@ -25,7 +27,9 @@ export class AppComponent {
private splashScreen: SplashScreen,
private statusBar: StatusBar,
private router: Router,
private _STOR: Storage,
private storage: Storage,
private ga: GoogleAnalytics,
private appVersion: AppVersion,
private _AUTH: AuthService
// private _LOCAT: LocationService
) {
......@@ -38,6 +42,14 @@ export class AppComponent {
this.statusBar.styleDefault();
this.splashScreen.hide();
// Start GA tracking
this.ga.startTrackerWithId('UA-129706772-2')
.then(() => {
this.appVersion.getVersionNumber().then((versionNumber) => {
this.ga.setAppVersion(versionNumber);
});
}).catch(e => alert('Error starting GoogleAnalytics == ' + e));
// Set params
this.setDefaultParams();
......@@ -46,7 +58,7 @@ export class AppComponent {
this._AUTH.authState.subscribe(state => {
if (state) {
this._STOR.get('APP_PARAMS').then(appParams => {
this.storage.get('APP_PARAMS').then(appParams => {
if (appParams.PARAM_mainslider) {
this.router.navigate(['app/dashboard']);
} else {
......@@ -57,7 +69,7 @@ export class AppComponent {
this.router.navigate(['login']);
}
});
// this._STOR.get('wpUser').then((wpUser) => {
// this.storage.get('wpUser').then((wpUser) => {
// if (wpUser) {
// this.router.navigateByUrl('/app/dashboard', { replaceUrl: true });
// // this._AUTH.validateAuthToken(wpUser.token);
......@@ -65,9 +77,9 @@ export class AppComponent {
// this.router.navigateByUrl('/login', { replaceUrl: true });
// }
// });
// this._STOR.get('PARAM_mainslider').then((prmMainslider) => {
// this.storage.get('PARAM_mainslider').then((prmMainslider) => {
// if (prmMainslider) {
// this._STOR.get('isLoggedIn').then((isLoggedIn) => {
// this.storage.get('isLoggedIn').then((isLoggedIn) => {
// if (isLoggedIn) {
// this.router.navigateByUrl('/app/dashboard', { replaceUrl: true });
// } else {
......@@ -76,16 +88,16 @@ export class AppComponent {
// });
// } else {
// this.router.navigateByUrl('/mainslider', { replaceUrl: true });
// this._STOR.set('PARAM_mainslider', true);
// this.storage.set('PARAM_mainslider', true);
// }
// });
});
}
setDefaultParams() {
this._STOR.get('APP_PARAMS').then((val) => {
this.storage.get('APP_PARAMS').then((val) => {
if (val === null) {
this._STOR.set('APP_PARAMS', {
this.storage.set('APP_PARAMS', {
PARAM_mainslider: false,
PARAM_geolocate: true,
PARAM_geoarea: 1000,
......@@ -96,16 +108,16 @@ export class AppComponent {
});
}
});
this._STOR.get('WISHLIST').then((val) => {
this.storage.get('WISHLIST').then((val) => {
if (val === null) {
this._STOR.set('WISHLIST', []);
this.storage.set('WISHLIST', []);
}
});
}
setLocator() {
// Start locator if ON
// this._STOR.get('PARAM_geolocate').then((val) => {
// this.storage.get('PARAM_geolocate').then((val) => {
// if (val !== null) {
// this._LOCAT.restartTracking();
// }
......
......@@ -19,6 +19,7 @@ import { LocalNotifications } from '@ionic-native/local-notifications/ngx';
import { BackgroundMode } from '@ionic-native/background-mode/ngx';
import { BackgroundGeolocation } from '@ionic-native/background-geolocation/ngx';
import { AppVersion } from '@ionic-native/app-version/ngx';
import { GoogleAnalytics } from '@ionic-native/google-analytics/ngx';
import { GooglePlus } from '@ionic-native/google-plus/ngx';
import { Camera } from '@ionic-native/Camera/ngx';
import { File } from '@ionic-native/File/ngx';
......@@ -70,7 +71,8 @@ import { OffresCarteFiltersPageModule } from './modals/offres-carte-filters/offr
FilePath,
QRScanner,
AuthService,
AuthGuardService
AuthGuardService,
GoogleAnalytics
],
bootstrap: [AppComponent]
})
......
......@@ -2,6 +2,7 @@ import { Component, ViewChild, OnInit } from '@angular/core';
import { Platform, NavController, IonSlides } from '@ionic/angular';
import { Storage } from '@ionic/storage';
import { Router } from '@angular/router';
import { GoogleAnalytics } from '@ionic-native/google-analytics/ngx';
// import { DashboardPage } from "../dashboard/dashboard";
import { PermService } from '../../services/perm-service';
import { LocationService } from '../../services/location-service';
......@@ -34,8 +35,9 @@ export class MainsliderPage implements OnInit {
private _PERM: PermService,
private _LOCATE: LocationService,
// private _ALLO: AlloService,
private _STOR: Storage,
private router: Router
private storage: Storage,
private router: Router,
private ga: GoogleAnalytics
) {
this.prmMainslider = false;
}
......@@ -46,32 +48,10 @@ export class MainsliderPage implements OnInit {
});
}
// gpsStart() {
// this._LOCATE.startTracking();
// }
// gpsStop() {
// this._LOCATE.stopTracking();
// }
// gpsStatus() {
// this._LOCATE.checkStatus();
// }
// gpsLocations() {
// this._LOCATE.getLocations();
// }
// gpsLogEntries() {
// this._LOCATE.getLogEntries();
// }
// setParam() {
// console.log(this.prmMainslider);
// this._STOR.set('PARAM_mainslider', this.prmMainslider);
// }
skipPresentation($event) {
if (this.platform.is('cordova')) {
this.ga.trackEvent('Presentation', 'Tapped button', 'Skip presentation');
}
this.mainSlider.getActiveIndex().then(index => {
this.hideSlider = true;
this.mainSlider.slideTo(4, 1000);
......@@ -81,14 +61,16 @@ export class MainsliderPage implements OnInit {
getGps() {
if (this.platform.is('cordova')) {
this.ga.trackEvent('Presentation', 'Tapped button', 'Continue with GPS');
this._PERM.checkGps();
this._LOCATE.initLocator();
}
this._STOR.get('APP_PARAMS').then(appParams => {
appParams.PARAM_mainslider = true;
appParams.PARAM_geolocate = true;
this._STOR.set('APP_PARAMS', appParams);
this.goToDashboard();
});
this.goToDashboard();
}
getDashboard() {
......@@ -103,126 +85,4 @@ export class MainsliderPage implements OnInit {
});
this.router.navigate(['app/dashboard']);
}
ionViewDidEnter() {
console.log('ionViewDidEnter Mainslider');
// this._ALLO.presentLoading();
}
ionViewDidLoad() {
console.log('ionViewDidLoad Mainslider');
// this._ALLO.dismissLoading();
}
// getNearby() {
// this._STOR.get('REST_services').then((services) => {
// if ('object' === typeof services && services.hasOwnProperty('brands')) {
// let brands = this._ALLO.jsonToArray(services.brands);
// this._STOR.get('PARAM_geoarea').then((area) => {
// if (area === null) {
// area = 400;
// }
// this._STOR.get('NOTIF_shownpartners').then((shown) => {
// let shown_notifs = [];
// if (shown !== null) {
// shown_notifs = shown;
// }
// let notifs = [];
// brands.forEach(partner => {
// if (this.checkNotifTime(partner.id, shown_notifs)) {
// let lat1 = partner.latitude;
// let lon1 = partner.longitude;
// let lat2 = 34.253968;
// let lon2 = -6.580888;
// let distance = this._LOCATE.calculateDistance(lat1, lon1, lat2, lon2);
// if (distance <= (area / 1000)) {
// notifs.push({
// id: partner.id,
// title: 'Spotted ! ' + partner.label,
// text: 'Vous êtes tout prêt de ce partenaire!',
// led: 'FFFFFF',
// attachments: [partner.thumb],
// sound: null
// });
// let current_date = new Date();
// shown_notifs.push({
// id: partner.id,
// time: current_date.getTime()
// });
// }
// }
// });
// shown_notifs = this.makeUnique(shown_notifs);
// this._STOR.set('NOTIF_shownpartners', shown_notifs);
// if (notifs) {
// this.showMultipleNotification(notifs);
// }
// });
// });
// }
// });
// }
// makeUnique(shown) {
// let filtred = [];
// shown.forEach(notif => {
// let exist = filtred.filter(obj => {
// return obj.id === notif.id;
// });
// if (exist.length == 0) {
// filtred.push(notif);
// } else {
// filtred = filtred.filter(function (obj) {
// return obj.id !== notif.id;
// });
// filtred.push(notif);
// }
// });
// return filtred;
// }
// checkNotifTime(id, shown) {
// let valid = true;
// let notifs_count = shown.length;
// let i = 0;
// for (i = 0; i < notifs_count; i++) {
// let notif = shown[i];
// let notif_date = new Date(notif.time);
// let current_date = new Date();
// if (notif.id == id && ((current_date.getTime() - notif_date.getTime()) / 1000) <= 3600) {
// valid = false;
// break;
// }
// }
// return valid;
// }
// showNotification(title, text) {
// this.LN.requestPermission().then((granted) => {
// console.log(granted);
// if (granted) {
// this.LN.schedule({
// title: title,
// text: text,
// led: 'FFFFFF',
// sound: null
// });
// }
// });
// }
// showMultipleNotification(notifs) {
// this.LN.requestPermission().then((granted) => {
// if (granted) {
// this.LN.schedule(notifs);
// }
// });
// }
}
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