diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b0f917d4b..43c70f3de 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -33,14 +33,6 @@ const routes: Routes = [{ path: 'about', loadChildren: () => import('./pages/about/about.module').then(m => m.AboutPageModule), canActivate: [AuthGuardService], -}, { - path: 'publishers', - redirectTo: 'settings', - canActivate: [AuthGuardService], -}, { - path: 'publishers/numbers-storage', - loadChildren: () => import('./pages/publishers/numbers-storage/numbers-storage.module').then(m => m.NumbersStoragePageModule), - canActivate: [AuthGuardService], }]; @NgModule({ diff --git a/src/app/pages/publishers/numbers-storage/login/login-routing.module.ts b/src/app/pages/publishers/numbers-storage/login/login-routing.module.ts deleted file mode 100644 index 698f28e30..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login-routing.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { LoginPage } from './login.page'; - -const routes: Routes = [{ - path: '', - component: LoginPage -}]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class LoginPageRoutingModule { } diff --git a/src/app/pages/publishers/numbers-storage/login/login.module.ts b/src/app/pages/publishers/numbers-storage/login/login.module.ts deleted file mode 100644 index 442754956..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { LoginPageRoutingModule } from './login-routing.module'; -import { LoginPage } from './login.page'; - -@NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - IonicModule, - LoginPageRoutingModule, - TranslocoModule - ], - declarations: [LoginPage] -}) -export class LoginPageModule { } diff --git a/src/app/pages/publishers/numbers-storage/login/login.page.html b/src/app/pages/publishers/numbers-storage/login/login.page.html deleted file mode 100644 index 719c9fcfa..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login.page.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - {{ t('login') }} - - - - - -
- - - - {{ t('email') }} - - - - - {{ t('password') }} - - - - {{ t('login') }} - -
- - {{ t('signUp') }} -
\ No newline at end of file diff --git a/src/app/pages/publishers/numbers-storage/login/login.page.scss b/src/app/pages/publishers/numbers-storage/login/login.page.scss deleted file mode 100644 index 6ebbd8d4e..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login.page.scss +++ /dev/null @@ -1,12 +0,0 @@ -.numbers-logo { - margin: 10vh 20vw; -} - -.errors { - color: var(--ion-color-danger, red); - margin: 2px 0 8px; -} - -.errors p { - margin: 0; -} diff --git a/src/app/pages/publishers/numbers-storage/login/login.page.spec.ts b/src/app/pages/publishers/numbers-storage/login/login.page.spec.ts deleted file mode 100644 index 3bda1ae75..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login.page.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ReactiveFormsModule } from '@angular/forms'; -import { RouterTestingModule } from '@angular/router/testing'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { LoginPage } from './login.page'; - -describe('LoginPage', () => { - let component: LoginPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [LoginPage], - imports: [ - IonicModule.forRoot(), - ReactiveFormsModule, - RouterTestingModule, - TranslocoModule, - HttpClientTestingModule - ] - }).compileComponents(); - - fixture = TestBed.createComponent(LoginPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/publishers/numbers-storage/login/login.page.ts b/src/app/pages/publishers/numbers-storage/login/login.page.ts deleted file mode 100644 index f43dc4e89..000000000 --- a/src/app/pages/publishers/numbers-storage/login/login.page.ts +++ /dev/null @@ -1,54 +0,0 @@ -import { Component } from '@angular/core'; -import { FormBuilder } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { ToastController } from '@ionic/angular'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { defer } from 'rxjs'; -import { catchError, concatMapTo } from 'rxjs/operators'; -import { BlockingActionService } from 'src/app/services/blocking-action/blocking-action.service'; -import { NumbersStorageApi } from 'src/app/services/publisher/numbers-storage/numbers-storage-api.service'; -import { emailValidators, passwordValidators } from 'src/app/utils/validators'; - -@UntilDestroy({ checkProperties: true }) -@Component({ - selector: 'app-login', - templateUrl: './login.page.html', - styleUrls: ['./login.page.scss'], -}) -export class LoginPage { - - readonly loginForm = this.formBuilder.group({ - email: ['', emailValidators], - password: ['', passwordValidators] - }); - - constructor( - private readonly router: Router, - private readonly route: ActivatedRoute, - private readonly formBuilder: FormBuilder, - private readonly translocoService: TranslocoService, - private readonly blockingActionService: BlockingActionService, - private readonly toastController: ToastController, - private readonly numbersStorageApi: NumbersStorageApi - ) { } - - login() { - const action$ = this.numbersStorageApi.login$( - this.loginForm.get('email')?.value, - this.loginForm.get('password')?.value - ).pipe( - concatMapTo(defer(() => this.router.navigate(['..'], { relativeTo: this.route }))), - catchError(err => this.toastController - .create({ message: JSON.stringify(err.error), duration: 4000 }) - .then(toast => toast.present()) - ) - ); - this.blockingActionService.run$( - action$, - { message: this.translocoService.translate('talkingToTheServer') } - ).pipe( - untilDestroyed(this) - ).subscribe(); - } -} diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage-routing.module.ts b/src/app/pages/publishers/numbers-storage/numbers-storage-routing.module.ts deleted file mode 100644 index 6fddc848a..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage-routing.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { NumbersStoragePage } from './numbers-storage.page'; - -const routes: Routes = [{ - path: '', - component: NumbersStoragePage -}, { - path: 'login', - loadChildren: () => import('./login/login.module').then(m => m.LoginPageModule) -}, { - path: 'sign-up', - loadChildren: () => import('./sign-up/sign-up.module').then(m => m.SignUpPageModule) -}]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class NumbersStoragePageRoutingModule { } diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage.module.ts b/src/app/pages/publishers/numbers-storage/numbers-storage.module.ts deleted file mode 100644 index 47c10ad95..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { NumbersStoragePageRoutingModule } from './numbers-storage-routing.module'; -import { NumbersStoragePage } from './numbers-storage.page'; - -@NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - IonicModule, - NumbersStoragePageRoutingModule, - TranslocoModule - ], - declarations: [NumbersStoragePage] -}) -export class NumbersStoragePageModule { } diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage.page.html b/src/app/pages/publishers/numbers-storage/numbers-storage.page.html deleted file mode 100644 index 8e9217643..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage.page.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - Numbers Storage - - - - - - - - - {{ t('userName') }} - {{ userName$ | async }} - - - - {{ t('email') }} - {{ email$ | async }} - - - - {{ t('login') }} - - {{ t('logout') }} - - \ No newline at end of file diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage.page.scss b/src/app/pages/publishers/numbers-storage/numbers-storage.page.scss deleted file mode 100644 index 98582c5a0..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage.page.scss +++ /dev/null @@ -1,3 +0,0 @@ -.numbers-logo { - margin: 10vh 20vw; -} diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage.page.spec.ts b/src/app/pages/publishers/numbers-storage/numbers-storage.page.spec.ts deleted file mode 100644 index f4d7a66aa..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage.page.spec.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { RouterTestingModule } from '@angular/router/testing'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { NumbersStoragePage } from './numbers-storage.page'; - -describe('NumbersStoragePage', () => { - let component: NumbersStoragePage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [NumbersStoragePage], - imports: [ - IonicModule.forRoot(), - RouterTestingModule, - TranslocoModule, - HttpClientTestingModule - ] - }).compileComponents(); - - fixture = TestBed.createComponent(NumbersStoragePage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/publishers/numbers-storage/numbers-storage.page.ts b/src/app/pages/publishers/numbers-storage/numbers-storage.page.ts deleted file mode 100644 index 7149381d3..000000000 --- a/src/app/pages/publishers/numbers-storage/numbers-storage.page.ts +++ /dev/null @@ -1,47 +0,0 @@ -import { Component } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { ToastController } from '@ionic/angular'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { defer } from 'rxjs'; -import { catchError, concatMapTo } from 'rxjs/operators'; -import { BlockingActionService } from 'src/app/services/blocking-action/blocking-action.service'; -import { NumbersStorageApi } from 'src/app/services/publisher/numbers-storage/numbers-storage-api.service'; - -@UntilDestroy({ checkProperties: true }) -@Component({ - selector: 'app-numbers-storage', - templateUrl: './numbers-storage.page.html', - styleUrls: ['./numbers-storage.page.scss'], -}) -export class NumbersStoragePage { - - readonly isEnabled$ = this.numbersStorageApi.isEnabled$(); - readonly userName$ = this.numbersStorageApi.getUserName$(); - readonly email$ = this.numbersStorageApi.getEmail$(); - - constructor( - private readonly router: Router, - private readonly route: ActivatedRoute, - private readonly blockingActionService: BlockingActionService, - private readonly toastController: ToastController, - private readonly translocoService: TranslocoService, - private readonly numbersStorageApi: NumbersStorageApi - ) { } - - logout() { - const action$ = this.numbersStorageApi.logout$().pipe( - concatMapTo(defer(() => this.router.navigate(['login'], { relativeTo: this.route }))), - catchError(err => this.toastController - .create({ message: JSON.stringify(err.error), duration: 4000 }) - .then(toast => toast.present()) - ) - ); - this.blockingActionService.run$( - action$, - { message: this.translocoService.translate('talkingToTheServer') } - ).pipe( - untilDestroyed(this) - ).subscribe(); - } -} diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up-routing.module.ts b/src/app/pages/publishers/numbers-storage/sign-up/sign-up-routing.module.ts deleted file mode 100644 index 0da3a1d06..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up-routing.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { SignUpPage } from './sign-up.page'; - -const routes: Routes = [{ - path: '', - component: SignUpPage -}]; - -@NgModule({ - imports: [RouterModule.forChild(routes)], - exports: [RouterModule], -}) -export class SignUpPageRoutingModule { } diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.module.ts b/src/app/pages/publishers/numbers-storage/sign-up/sign-up.module.ts deleted file mode 100644 index 6fe603020..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.module.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { CommonModule } from '@angular/common'; -import { NgModule } from '@angular/core'; -import { ReactiveFormsModule } from '@angular/forms'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { SignUpPageRoutingModule } from './sign-up-routing.module'; -import { SignUpPage } from './sign-up.page'; - -@NgModule({ - imports: [ - CommonModule, - ReactiveFormsModule, - IonicModule, - SignUpPageRoutingModule, - TranslocoModule - ], - declarations: [SignUpPage] -}) -export class SignUpPageModule { } diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.html b/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.html deleted file mode 100644 index 0d0266507..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - {{ t('signUp') }} - - - - - -
- - - - {{ t('userName') }} - -
-

{{ t('required') }}

-
-
- - - {{ t('email') }} - -
-

{{ t('required') }}

-

{{ t('message.isNotEmail') }}

-
-
- - - {{ t('password') }} - -
-

{{ t('required') }}

-

{{ t('tooShort') }}

-

{{ t('message.forbiddenAllNumeric') }}

-
-
-
- {{ t('signUp') }} - -
-
\ No newline at end of file diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.scss b/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.scss deleted file mode 100644 index 6ebbd8d4e..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.scss +++ /dev/null @@ -1,12 +0,0 @@ -.numbers-logo { - margin: 10vh 20vw; -} - -.errors { - color: var(--ion-color-danger, red); - margin: 2px 0 8px; -} - -.errors p { - margin: 0; -} diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.spec.ts b/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.spec.ts deleted file mode 100644 index 80ae24e28..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ReactiveFormsModule } from '@angular/forms'; -import { RouterTestingModule } from '@angular/router/testing'; -import { IonicModule } from '@ionic/angular'; -import { TranslocoModule } from '@ngneat/transloco'; -import { SignUpPage } from './sign-up.page'; - -describe('SignUpPage', () => { - let component: SignUpPage; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [SignUpPage], - imports: [ - IonicModule.forRoot(), - ReactiveFormsModule, - HttpClientTestingModule, - RouterTestingModule, - TranslocoModule - ] - }).compileComponents(); - - fixture = TestBed.createComponent(SignUpPage); - component = fixture.componentInstance; - fixture.detectChanges(); - })); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.ts b/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.ts deleted file mode 100644 index 044de04b8..000000000 --- a/src/app/pages/publishers/numbers-storage/sign-up/sign-up.page.ts +++ /dev/null @@ -1,56 +0,0 @@ -import { Component } from '@angular/core'; -import { FormBuilder, Validators } from '@angular/forms'; -import { ActivatedRoute, Router } from '@angular/router'; -import { ToastController } from '@ionic/angular'; -import { TranslocoService } from '@ngneat/transloco'; -import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; -import { defer } from 'rxjs'; -import { catchError, concatMapTo } from 'rxjs/operators'; -import { BlockingActionService } from 'src/app/services/blocking-action/blocking-action.service'; -import { NumbersStorageApi } from 'src/app/services/publisher/numbers-storage/numbers-storage-api.service'; -import { emailValidators, passwordValidators } from 'src/app/utils/validators'; - -@UntilDestroy({ checkProperties: true }) -@Component({ - selector: 'app-sign-up', - templateUrl: './sign-up.page.html', - styleUrls: ['./sign-up.page.scss'], -}) -export class SignUpPage { - - readonly signUpForm = this.formBuilder.group({ - userName: ['', Validators.required], - email: ['', emailValidators], - password: ['', passwordValidators] - }); - - constructor( - private readonly router: Router, - private readonly route: ActivatedRoute, - private readonly formBuilder: FormBuilder, - private readonly blockingActionService: BlockingActionService, - private readonly toastController: ToastController, - private readonly translocoService: TranslocoService, - private readonly numbersStorageApi: NumbersStorageApi - ) { } - - signUp() { - const action$ = this.numbersStorageApi.createUser$( - this.signUpForm.get('userName')?.value, - this.signUpForm.get('email')?.value, - this.signUpForm.get('password')?.value - ).pipe( - concatMapTo(defer(() => this.router.navigate(['..'], { relativeTo: this.route }))), - catchError(err => this.toastController - .create({ message: JSON.stringify(err.error), duration: 4000 }) - .then(toast => toast.present()) - ) - ); - this.blockingActionService.run$( - action$, - { message: this.translocoService.translate('talkingToTheServer') } - ).pipe( - untilDestroyed(this) - ).subscribe(); - } -}