diff --git a/angular/src/app/directives/download-app.directive.ts b/angular/src/app/directives/download-app.directive.ts index 9b2d3b6..18f7b1d 100644 --- a/angular/src/app/directives/download-app.directive.ts +++ b/angular/src/app/directives/download-app.directive.ts @@ -58,6 +58,7 @@ export class DownloadAppDirective implements OnInit { @HostListener('click', ['$event']) async downloadApp(event: MouseEvent) { if (!this.deferredPrompt) { + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Не поддерживается в Вашем браузере!', @@ -67,6 +68,7 @@ export class DownloadAppDirective implements OnInit { this.deferredPrompt.prompt(); this.deferredPrompt.userChoice.then((res: any) => { if (res.outcome === 'accepted') { + this.messageService.clear(); this.messageService.add({ severity: 'success', summary: 'Спасибо за установку!', diff --git a/angular/src/app/pages/account/ref-system/ref-system.component.ts b/angular/src/app/pages/account/ref-system/ref-system.component.ts index 8f0ceb5..8e346ad 100644 --- a/angular/src/app/pages/account/ref-system/ref-system.component.ts +++ b/angular/src/app/pages/account/ref-system/ref-system.component.ts @@ -31,7 +31,7 @@ export class RefSystemComponent implements OnInit { true ) )).data - + this.refUrl += accountData.user_id this.loading = false } @@ -53,12 +53,14 @@ export class RefSystemComponent implements OnInit { copyUrl() { navigator.clipboard.writeText(this.refUrl) .then(() => { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: 'Ссылка скопирована!', }); }) .catch(err => { + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Произошла ошибка!', diff --git a/angular/src/app/pages/login/login.component.ts b/angular/src/app/pages/login/login.component.ts index 0a60904..4676142 100644 --- a/angular/src/app/pages/login/login.component.ts +++ b/angular/src/app/pages/login/login.component.ts @@ -38,9 +38,9 @@ export class LoginComponent implements OnInit, AfterViewInit { private jsonrpc: JsonrpcService, private messageService: MessageService, private _snackBar: MatSnackBar - ) {} + ) { } - ngOnInit(): void {} + ngOnInit(): void { } ngAfterViewInit() { setTimeout(() => { @@ -72,7 +72,7 @@ export class LoginComponent implements OnInit, AfterViewInit { const nextInputIndex = index + 1; if (event.target.value.length > 1) { event.target.value = event.target.value.slice(-1); - + } if (nextInputIndex > 0 && nextInputIndex <= this.inputIds.length) { this.inputFocusEmitter.emit(`#${this.inputIds[nextInputIndex]}`); @@ -85,6 +85,7 @@ export class LoginComponent implements OnInit, AfterViewInit { const data = this.phoneForm.value; this.isShowNumber = false; if (this.timeLeft) { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: `Отправить повторно можно через ${this.timeLeft}с`, @@ -95,29 +96,29 @@ export class LoginComponent implements OnInit, AfterViewInit { method: 'sendVerifyByPhone', params: [data.phone] }, RpcService.authService, false).subscribe({ - next: (result) => { - if (result.code !== 0) { - this._snackBar.open('Произошла ошибка! Попробуйте позже', '', { - duration: 3000 - }) - } - if (result.code === 0) { - this.timeLeft = 60; - const interval = setInterval(() => { - if(this.timeLeft > 0) { - this.timeLeft--; - } else { - clearInterval(interval); - } - },1000) - } - this.isShowNumber = false; - }, - error: (error) => { - console.error('Error: ', error); - + next: (result) => { + if (result.code !== 0) { + this._snackBar.open('Произошла ошибка! Попробуйте позже', '', { + duration: 3000 + }) } + if (result.code === 0) { + this.timeLeft = 60; + const interval = setInterval(() => { + if (this.timeLeft > 0) { + this.timeLeft--; + } else { + clearInterval(interval); + } + }, 1000) + } + this.isShowNumber = false; + }, + error: (error) => { + console.error('Error: ', error); + } + } ); setTimeout(() => { this.inputFocusEmitter.emit(`#${this.inputIds[0]}`); @@ -130,28 +131,28 @@ export class LoginComponent implements OnInit, AfterViewInit { method: 'getTokenByPhone', params: [this.phoneForm.value.phone, Object.values(data).join('')] }, RpcService.authService, false).subscribe({ - next: (result) => { - if (result.code === 0) { - this.cookiesService.setCookie('token', result?.data?.token); - this.router.navigate(['/'], { - queryParams: { - token: result?.data?.token - }, - }); - // this.phoneConfirmed.emit(null); - } else if (result.code === 230) { - this._snackBar.open('Неверный код!', '', { - duration: 3000 - }) - // this.errorConfirmCode = true; - - } - }, - error: (error) => { - console.error(error); - + next: (result) => { + if (result.code === 0) { + this.cookiesService.setCookie('token', result?.data?.token); + this.router.navigate(['/'], { + queryParams: { + token: result?.data?.token + }, + }); + // this.phoneConfirmed.emit(null); + } else if (result.code === 230) { + this._snackBar.open('Неверный код!', '', { + duration: 3000 + }) + // this.errorConfirmCode = true; + } + }, + error: (error) => { + console.error(error); + } + } ); } diff --git a/angular/src/app/pages/main/main.component.ts b/angular/src/app/pages/main/main.component.ts index 7f6270a..b05b7a8 100644 --- a/angular/src/app/pages/main/main.component.ts +++ b/angular/src/app/pages/main/main.component.ts @@ -61,12 +61,13 @@ export class MainComponent implements OnInit { const userAgent = window.navigator.userAgent.toLowerCase(); const ios = /iphone|ipod|ipad/.test(userAgent); if (ios) { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: `Чтобы получать уведомления, добавьте карту в Apple Wallet`, life: 5000, }); - + // var permissionData = window.safari.pushNotification.permission('web.com.example.domain'); // $scope.checkRemotePermission(permissionData); } else { diff --git a/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.scss b/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.scss index ecc2439..51150dc 100644 --- a/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.scss +++ b/angular/src/app/presentation-options/default-option/components/navbar/navbar.component.scss @@ -44,6 +44,7 @@ display: flex; align-items: center; gap: 10px; + min-width: 40px; } .menu { position: relative; diff --git a/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts b/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts index 07e4516..f864e21 100644 --- a/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts +++ b/angular/src/app/presentation-options/default-option/pages/guest-card/guest-card.component.ts @@ -42,6 +42,7 @@ export class GuestCardComponent implements OnInit { const userAgent = window.navigator.userAgent.toLowerCase(); const ios = /iphone|ipod|ipad/.test(userAgent); if (ios) { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: `Чтобы получать уведомления, добавьте карту в Apple Wallet`, diff --git a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts index 6e19ef2..22915b7 100644 --- a/angular/src/app/presentation-options/default-option/pages/login/login.component.ts +++ b/angular/src/app/presentation-options/default-option/pages/login/login.component.ts @@ -104,10 +104,10 @@ export class LoginComponent implements OnInit { if (this.phoneForm.invalid) { this.phoneForm.markAsTouched(); + this.messageService.clear(); this.messageService.add({ severity: 'error', - summary: 'Введите имя и телефон', - life: 5000, + summary: 'Введите имя и телефон', }); return; diff --git a/angular/src/app/services/auth.service.ts b/angular/src/app/services/auth.service.ts index 2b068d3..e5db85b 100644 --- a/angular/src/app/services/auth.service.ts +++ b/angular/src/app/services/auth.service.ts @@ -81,6 +81,7 @@ export class AuthService { } }) } else if (value && value.error && value.error.code > 1) { + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Произошла ошибка! Попробуйте позже', @@ -110,6 +111,7 @@ export class AuthService { sendVerifyByPhone(phone: string) { if (this.timeLeft) { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: `Отправить повторно можно через ${this.timeLeft}с`, @@ -130,6 +132,7 @@ export class AuthService { .subscribe({ next: (result) => { if (result.code !== 0) { + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Произошла ошибка! Попробуйте позже', @@ -192,6 +195,7 @@ export class AuthService { }, }) } else if (result.code === 230) { + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Неверный код!', diff --git a/angular/src/app/services/messaging.service.ts b/angular/src/app/services/messaging.service.ts index be242a6..d05ea0d 100644 --- a/angular/src/app/services/messaging.service.ts +++ b/angular/src/app/services/messaging.service.ts @@ -50,6 +50,7 @@ export class MessagingService { ) .subscribe({ next: () => { + this.messageService.clear(); this.messageService.add({ severity: 'custom', summary: 'Спасибо за подписку!', @@ -57,6 +58,7 @@ export class MessagingService { }, error: (err) => { console.error('Error: ', err); + this.messageService.clear(); this.messageService.add({ severity: 'error', summary: 'Произошла ошибка, попробуйте позже',