Commit 09e2dc6d by Nabil Sadki

Merge branch 'v1.1.4.0' into v1.1.5.0

# Conflicts:
#	src/app/pages/menu/menu.page.html
parents a0ad77ff 36dcfd0c
...@@ -105,4 +105,5 @@ ...@@ -105,4 +105,5 @@
<feature name="StatusBar"> <feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" /> <param name="ios-package" onload="true" value="CDVStatusBar" />
</feature> </feature>
<engine name="android" spec="^8.1.0" />
</widget> </widget>
...@@ -65,6 +65,7 @@ export class LoginPage implements OnInit { ...@@ -65,6 +65,7 @@ export class LoginPage implements OnInit {
} }
doAnonymousLogIn() { doAnonymousLogIn() {
this._AUTH.isAnonymous = true;
const wpUser = { const wpUser = {
token: null, token: null,
user_nicename: 'anonymous', user_nicename: 'anonymous',
...@@ -89,7 +90,7 @@ export class LoginPage implements OnInit { ...@@ -89,7 +90,7 @@ export class LoginPage implements OnInit {
.then( .then(
res => { res => {
this._ALLO.dismissLoading(); this._ALLO.dismissLoading();
console.log('User exist', res); this._AUTH.isAnonymous = false;
this.storage.get('APP_PARAMS').then(appParams => { this.storage.get('APP_PARAMS').then(appParams => {
if (appParams.PARAM_mainslider) { if (appParams.PARAM_mainslider) {
this.router.navigate(['app/dashboard']); this.router.navigate(['app/dashboard']);
......
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
<ion-content> <ion-content>
<div *ngFor="let p of pages"> <div *ngFor="let p of pages">
<div *ngIf="p.anonymous || (!p.anonymous && !_AUTH.isAnonymous)">
<!-- Standard Menu Item --> <!-- Standard Menu Item -->
<ion-menu-toggle *ngIf="p.url"> <ion-menu-toggle *ngIf="p.url">
<ion-item [routerLink]="p.url" routerDirection="root" routerLinkActive="active"> <ion-item [routerLink]="p.url" routerDirection="root" routerLinkActive="active">
...@@ -95,8 +95,8 @@ ...@@ -95,8 +95,8 @@
</ion-menu-toggle> </ion-menu-toggle>
<!-- Item with Children --> <!-- Item with Children -->
<ion-item button *ngIf="p.children?.length > 0" (click)="p.open = !p.open" [class.parent-active]="p.open" <ion-item button *ngIf="p.children?.length > 0" (click)="p.open = !p.open"
detail="false"> [class.parent-active]="p.open" detail="false">
<ion-icon slot="start" name="arrow-forward" *ngIf="!p.open"></ion-icon> <ion-icon slot="start" name="arrow-forward" *ngIf="!p.open"></ion-icon>
<ion-icon slot="start" name="arrow-down" *ngIf="p.open"></ion-icon> <ion-icon slot="start" name="arrow-down" *ngIf="p.open"></ion-icon>
<ion-label>{{ p.title }}</ion-label> <ion-label>{{ p.title }}</ion-label>
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
</ion-item> </ion-item>
</ion-menu-toggle> </ion-menu-toggle>
</ion-list> </ion-list>
</div>
</div> </div>
</ion-content> </ion-content>
......
...@@ -13,17 +13,20 @@ export class MenuPage implements OnInit { ...@@ -13,17 +13,20 @@ export class MenuPage implements OnInit {
{ {
title: 'Les promos', title: 'Les promos',
url: '/app/dashboard', url: '/app/dashboard',
icon: 'home' icon: 'home',
anonymous: 'true'
}, },
{ {
title: 'Partenaires', title: 'Partenaires',
url: '/app/partenaires', url: '/app/partenaires',
icon: 'contacts' icon: 'contacts',
anonymous: true
}, },
{ {
title: 'Favoris', title: 'Favoris',
url: '/app/favoris', url: '/app/favoris',
icon: 'bookmark' icon: 'bookmark',
anonymous: false
}, },
{ {
title: 'Mes mérites', title: 'Mes mérites',
...@@ -33,22 +36,26 @@ export class MenuPage implements OnInit { ...@@ -33,22 +36,26 @@ export class MenuPage implements OnInit {
{ {
title: 'Paramètres', title: 'Paramètres',
url: '/app/params', url: '/app/params',
icon: 'settings' icon: 'settings',
anonymous: true
}, },
{ {
title: 'Contact', title: 'Contact',
url: '/app/contact', url: '/app/contact',
icon: 'at' icon: 'at',
anonymous: true
}, },
{ {
title: 'A propos', title: 'A propos',
url: '/app/a-propos', url: '/app/a-propos',
icon: 'alert' icon: 'alert',
anonymous: true
}, },
{ {
title: 'Présentation', title: 'Présentation',
url: '/mainslider', url: '/mainslider',
icon: 'albums' icon: 'albums',
anonymous: true
} }
]; ];
......
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
</ion-card> </ion-card>
</div> </div>
<div class="card-wrapper" *ngFor="let trip of _TRIP.offersCardList"> <div class="card-wrapper" *ngFor="let trip of _TRIP.offersCardList">
<div *ngIf="!_AUTH.isAnonymous">
<ion-button color="light" fill="solid" class="bookmark" (click)="_TRIP.wishList(trip, 'add')" <ion-button color="light" fill="solid" class="bookmark" (click)="_TRIP.wishList(trip, 'add')"
*ngIf="!trip.bookmarked" no-padding> *ngIf="!trip.bookmarked" no-padding>
<ion-icon name="heart-empty"></ion-icon> <ion-icon name="heart-empty"></ion-icon>
...@@ -60,6 +61,7 @@ ...@@ -60,6 +61,7 @@
*ngIf="trip.bookmarked" no-padding> *ngIf="trip.bookmarked" no-padding>
<ion-icon name="heart" color="danger"></ion-icon> <ion-icon name="heart" color="danger"></ion-icon>
</ion-button> </ion-button>
</div>
<ion-card (click)="viewDetail(trip.id)" tappable no-margin margin-bottom> <ion-card (click)="viewDetail(trip.id)" tappable no-margin margin-bottom>
<div class="img-spinner-wrap ion-text-center"> <div class="img-spinner-wrap ion-text-center">
<ion-spinner name="dots" *ngIf="trip.hidden"></ion-spinner> <ion-spinner name="dots" *ngIf="trip.hidden"></ion-spinner>
......
import { Component, OnInit, ViewChild } from '@angular/core'; import { Component, OnInit, ViewChild } from '@angular/core';
import { ToastController, IonInfiniteScroll } from '@ionic/angular'; import { ToastController, IonInfiniteScroll } from '@ionic/angular';
import { AlloService } from '../../../services/allo-service'; import { AlloService } from '../../../services/allo-service';
import { AuthService } from '../../../services/auth.service';
import { TripService } from '../../../services/trip-service'; import { TripService } from '../../../services/trip-service';
import { Storage } from '@ionic/storage'; import { Storage } from '@ionic/storage';
import { Router } from '@angular/router'; import { Router } from '@angular/router';
...@@ -17,6 +18,7 @@ export class OffresCartePage implements OnInit { ...@@ -17,6 +18,7 @@ export class OffresCartePage implements OnInit {
constructor( constructor(
public _ALLO: AlloService, public _ALLO: AlloService,
public _AUTH: AuthService,
public _TRIP: TripService, public _TRIP: TripService,
public toastCtrl: ToastController, public toastCtrl: ToastController,
private router: Router, private router: Router,
......
...@@ -22,7 +22,7 @@ export class AuthService { ...@@ -22,7 +22,7 @@ export class AuthService {
public infoEmail; public infoEmail;
authState = new BehaviorSubject(false); authState = new BehaviorSubject(false);
authProfile = new BehaviorSubject(false); public isAnonymous = false;
constructor( constructor(
private platform: Platform, private platform: Platform,
...@@ -41,7 +41,7 @@ export class AuthService { ...@@ -41,7 +41,7 @@ export class AuthService {
} }
}); });
this.isLoggedIn(); this.isLoggedIn();
this.isAnonymous(); this.checkIsAnonymous();
}); });
} }
...@@ -56,16 +56,16 @@ export class AuthService { ...@@ -56,16 +56,16 @@ export class AuthService {
isLoggedIn() { isLoggedIn() {
this.storage.get('wpUser').then((wpUser) => { this.storage.get('wpUser').then((wpUser) => {
if (wpUser) { if (wpUser) {
console.log('wpuser found')
this.authState.next(true); this.authState.next(true);
} }
}); });
} }
isAnonymous() { checkIsAnonymous() {
this.storage.get('wpUser').then((wpUser) => { this.storage.get('wpUser').then((wpUser) => {
if (wpUser && wpUser.hasOwnProperty('user_nicename') && wpUser.user_nicename === 'anonymous') { if (wpUser && wpUser.hasOwnProperty('user_nicename') && wpUser.user_nicename === 'anonymous') {
this.authProfile.next(true); this.isAnonymous = true;
console.log('this.isAnonymous', this.isAnonymous);
} }
}); });
} }
......
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