правки
This commit is contained in:
gofnnp 2022-09-20 10:28:41 +04:00
parent 12ad697c3e
commit a1fea66141
7 changed files with 87 additions and 16 deletions

View File

@ -11,11 +11,15 @@
strokeWidth="2"
styleClass="angular-spinner"
></p-progressSpinner>
<share-buttons
<!-- <share-buttons
[theme]="'modern-dark'"
[include]="['telegram', 'whatsapp', 'vk', 'copy', 'facebook', 'twitter']"
[show]="4"
[url]="refUrl"
style="display: flex; justify-content: center;"
></share-buttons>
></share-buttons> -->
<div class="share-container" *ngIf="!loading">
<div class="copy" type="button" (click)="copyUrl()">Скопировать ссылку</div>
<div class="share" type="button" (click)="share()"><img src="./assets/share.svg" alt="share"></div>
</div>
</div>

View File

@ -1,5 +1,29 @@
:host {
.ref-system {
.share-container {
display: flex;
justify-content: space-between;
height: 50px;
.share {
width: 50px;
background-color: #09467f;
border-radius: 8px;
display: flex;
justify-content: center;
align-items: center;
img {
height: 26px;
}
}
.copy {
background-color: #09467f;
color: #fff;
border-radius: 8px;
width: calc(100% - 66px);
display: flex;
justify-content: center;
align-items: center;
}
}
}
}

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import * as barcode from 'jsbarcode';
import { MessageService } from 'primeng/api';
import { lastValueFrom } from 'rxjs';
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
import { environment } from 'src/environments/environment';
@ -15,6 +16,7 @@ export class RefSystemComponent implements OnInit {
constructor(
private jsonrpc: JsonrpcService,
private messageService: MessageService
) { }
async ngOnInit() {
@ -25,8 +27,42 @@ export class RefSystemComponent implements OnInit {
},
RpcService.bonusService
)))['Cards'][0]
this.refUrl += accountData.CardNumber
this.loading = false
this.refUrl += accountData.CardNumber
}
share() {
if (navigator.share) {
navigator.share({
title: document.title,
text: "Fashion Logica",
url: this.refUrl
})
.then(() => console.log('Successful share'))
.catch((error) => {
this.messageService.add({
severity: 'error',
summary: 'Произошла ошибка!',
});
console.log('Error sharing:', error)
});
}
}
copyUrl() {
navigator.clipboard.writeText(this.refUrl)
.then(() => {
this.messageService.add({
severity: 'custom',
summary: 'Ссылка скопирована!',
});
})
.catch(err => {
this.messageService.add({
severity: 'error',
summary: 'Произошла ошибка!',
});
});
}
}

View File

@ -45,7 +45,6 @@ export class MainComponent implements OnInit {
this.deferredPrompt = e;
});
route.queryParams.subscribe((params) => {
console.log('####: ', params);
if (params['token']) this.token = params['token'];
});
}
@ -67,7 +66,7 @@ export class MainComponent implements OnInit {
this.deferredPrompt.userChoice.then((res: any) => {
if (res.outcome === 'accepted') {
this.messageService.add({
severity: 'success',
severity: 'custom',
summary: 'Спасибо за установку!',
});
console.log('User Accepted!!!');

View File

@ -53,18 +53,9 @@ export class MessagingService {
requestPermission() {
try {
console.log('1');
this.angularFireMessaging.getToken.subscribe({
next: (val) => {
console.log('VAL: ', val)
}
})
this.angularFireMessaging.requestToken.subscribe({
next: (token) => {
console.log('#: ')
this.updateToken(token);
console.log('####TOKEN: ', token);
},
error: (e) => console.error(e),
});
@ -77,7 +68,6 @@ export class MessagingService {
* hook method when new notification received in foreground
*/
receiveMessage() {
console.log('#REC')
this.angularFireMessaging.messages.subscribe((payload: any) => {
console.log('new message received. ', payload);
this.currentMessage.next(payload);

14
src/assets/share.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -60,3 +60,7 @@ button {
justify-content: space-between;
max-width: 400px;
}
input::-webkit-date-and-time-value {
text-align: left;
}