Skip to content

Commit 17fc209

Browse files
author
Pierre-Florent Poujol
committed
remove unused code
1 parent 0d3538f commit 17fc209

File tree

10 files changed

+6
-133
lines changed

10 files changed

+6
-133
lines changed

src/app/app-routing.module.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ const routes: Routes = [
1616
{
1717
path: 'register',
1818
loadChildren: () => import('./register/register.module').then( m => m.RegisterPageModule)
19-
},
20-
{
21-
path: 'reset-password',
22-
loadChildren: () => import('./reset-password/reset-password.module').then( m => m.ResetPasswordPageModule)
2319
}
2420
];
2521

src/app/home/home.page.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import {PromosService} from '../services/promos.service';
44
import {Promotion} from '../models/Promotion';
55
import {User} from '../models/User';
66
import {UserFirestore} from '../models/firestore/UserFirestore';
7-
import {AngularFirestore, DocumentReference, DocumentSnapshot} from '@angular/fire/firestore';
7+
import {AngularFirestore} from '@angular/fire/firestore';
88
import {Subscription} from 'rxjs';
99
import {Clipboard} from '@ionic-native/clipboard/ngx';
1010
import {BarcodeScanner} from '@ionic-native/barcode-scanner/ngx';
1111
import * as moment from 'moment';
12-
import {PromotionFirestore} from '../models/firestore/PromotionFirestore';
1312
import {ToastController} from '@ionic/angular';
1413
import {AlertController} from '@ionic/angular';
1514

@@ -66,7 +65,7 @@ export class HomePage implements OnInit, OnDestroy {
6665
this.mapPromos = action.ownedPromos;
6766
this.promiseCompletUser.then(isComplet => {
6867
if (isComplet) {
69-
const subscription = this.promosService.getPromosAPI(uid).subscribe((promotions) => {
68+
const subscription = this.promosService.getPromos(uid).subscribe((promotions) => {
7069
const promosEnCours = promotions.filter(promo => moment(promo.dateExpiration).isAfter());
7170
if (promosEnCours.length === 0) {
7271
this.promos = [];
@@ -98,7 +97,7 @@ export class HomePage implements OnInit, OnDestroy {
9897
if (!barcodeData.cancelled) {
9998
if (barcodeData.format === 'QR_CODE' && barcodeData.text !== '') {
10099
// this.getScannedPromo(barcodeData.text);
101-
const subscription = this.promosService.addPromoToUserAPI(barcodeData.text, this.userId).subscribe(() => {
100+
const subscription = this.promosService.addPromoToUser(barcodeData.text, this.userId).subscribe(() => {
102101
this.presentToast('<ion-icon name="checkmark-done-circle"></ion-icon>' +
103102
' Code promo ajouté avec succès !', 'success');
104103
}, (response) => {

src/app/reset-password/reset-password-routing.module.ts

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/app/reset-password/reset-password.module.ts

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/app/reset-password/reset-password.page.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

src/app/reset-password/reset-password.page.scss

Whitespace-only changes.

src/app/reset-password/reset-password.page.spec.ts

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/app/reset-password/reset-password.page.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

src/app/services/auth.service.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ export class AuthService {
1616
public navController: NavController
1717
) {
1818
}
19-
isLoggedIn(): Observable<firebase.User | null> {
20-
return this.afAuth.authState;
21-
}
2219
doLogin(value) {
2320
return this.afAuth.auth.signInWithEmailAndPassword(value.email.toLowerCase().trim(), value.password)
2421
.then((result) => {
@@ -32,14 +29,8 @@ export class AuthService {
3229
}
3330

3431
doLogout() {
35-
// window.localStorage.removeItem('firebase:session::<host-name>');
36-
// firebase.auth().signOut();
3732
return this.afAuth.auth.signOut().then(() => {
38-
// localStorage.removeItem('user');
3933
this.navController.navigateRoot(['login']);
40-
/*then(() => this.router.routeReuseStrategy.shouldReuseRoute = function() {
41-
return false;
42-
});*/
4334
});
4435
}
4536

src/app/services/promos.service.ts

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
import {Injectable} from '@angular/core';
2-
import {AngularFirestore, DocumentChangeAction, DocumentReference} from '@angular/fire/firestore';
32
import {Observable} from 'rxjs';
43

54
import {HttpClient} from '@angular/common/http';
6-
import {PromotionFirestore} from '../models/firestore/PromotionFirestore';
75
import {Promotion} from '../models/Promotion';
86

97
@Injectable({
@@ -12,26 +10,13 @@ import {Promotion} from '../models/Promotion';
1210

1311
export class PromosService {
1412

15-
constructor(private http: HttpClient, private firestore: AngularFirestore) {
13+
constructor(private http: HttpClient) {
1614
}
17-
18-
getPromo(codePromo: string): DocumentReference {
19-
return this.firestore.collection('promotions').doc(codePromo).ref;
20-
}
21-
22-
getPromosAFS(array: Array<string>): Observable<DocumentChangeAction<PromotionFirestore>[]> {
23-
return this.firestore.collection<PromotionFirestore>('promotions', ref => ref
24-
.where('dateExpiration', '>', new Date())
25-
.where('code', 'in', array))
26-
.snapshotChanges();
27-
}
28-
29-
getPromosAPI(uid: string): Observable<Array<Promotion>> {
15+
getPromos(uid: string): Observable<Array<Promotion>> {
3016
const url = 'https://europe-west1-mspr-gostyleapp.cloudfunctions.net/webServices/v1/users/' + uid + '/promotions';
3117
return this.http.get<Array<Promotion>>(url);
3218
}
33-
addPromoToUserAPI(promo: string, uid: string) {
34-
// https://europe-west1-mspr-gostyleapp.cloudfunctions.net/webServices/v1/users/goEdwr6nOpN0oyiAGWvs9vFWaSj1
19+
addPromoToUser(promo: string, uid: string) {
3520
const url = 'https://europe-west1-mspr-gostyleapp.cloudfunctions.net/webServices/v1/users/' + uid;
3621
return this.http.put(url, {promo});
3722
}

0 commit comments

Comments
 (0)