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