parent
12ad697c3e
commit
a1fea66141
@ -11,11 +11,15 @@
|
|||||||
strokeWidth="2"
|
strokeWidth="2"
|
||||||
styleClass="angular-spinner"
|
styleClass="angular-spinner"
|
||||||
></p-progressSpinner>
|
></p-progressSpinner>
|
||||||
<share-buttons
|
<!-- <share-buttons
|
||||||
[theme]="'modern-dark'"
|
[theme]="'modern-dark'"
|
||||||
[include]="['telegram', 'whatsapp', 'vk', 'copy', 'facebook', 'twitter']"
|
[include]="['telegram', 'whatsapp', 'vk', 'copy', 'facebook', 'twitter']"
|
||||||
[show]="4"
|
[show]="4"
|
||||||
[url]="refUrl"
|
[url]="refUrl"
|
||||||
style="display: flex; justify-content: center;"
|
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>
|
</div>
|
||||||
|
|||||||
@ -1,5 +1,29 @@
|
|||||||
:host {
|
:host {
|
||||||
.ref-system {
|
.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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import * as barcode from 'jsbarcode';
|
import * as barcode from 'jsbarcode';
|
||||||
|
import { MessageService } from 'primeng/api';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
|
import { JsonrpcService, RpcService } from 'src/app/services/jsonrpc.service';
|
||||||
import { environment } from 'src/environments/environment';
|
import { environment } from 'src/environments/environment';
|
||||||
@ -15,6 +16,7 @@ export class RefSystemComponent implements OnInit {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private jsonrpc: JsonrpcService,
|
private jsonrpc: JsonrpcService,
|
||||||
|
private messageService: MessageService
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
@ -25,8 +27,42 @@ export class RefSystemComponent implements OnInit {
|
|||||||
},
|
},
|
||||||
RpcService.bonusService
|
RpcService.bonusService
|
||||||
)))['Cards'][0]
|
)))['Cards'][0]
|
||||||
|
this.refUrl += accountData.CardNumber
|
||||||
this.loading = false
|
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: 'Произошла ошибка!',
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,7 +45,6 @@ export class MainComponent implements OnInit {
|
|||||||
this.deferredPrompt = e;
|
this.deferredPrompt = e;
|
||||||
});
|
});
|
||||||
route.queryParams.subscribe((params) => {
|
route.queryParams.subscribe((params) => {
|
||||||
console.log('####: ', params);
|
|
||||||
if (params['token']) this.token = params['token'];
|
if (params['token']) this.token = params['token'];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -67,7 +66,7 @@ export class MainComponent implements OnInit {
|
|||||||
this.deferredPrompt.userChoice.then((res: any) => {
|
this.deferredPrompt.userChoice.then((res: any) => {
|
||||||
if (res.outcome === 'accepted') {
|
if (res.outcome === 'accepted') {
|
||||||
this.messageService.add({
|
this.messageService.add({
|
||||||
severity: 'success',
|
severity: 'custom',
|
||||||
summary: 'Спасибо за установку!',
|
summary: 'Спасибо за установку!',
|
||||||
});
|
});
|
||||||
console.log('User Accepted!!!');
|
console.log('User Accepted!!!');
|
||||||
|
|||||||
@ -53,18 +53,9 @@ export class MessagingService {
|
|||||||
|
|
||||||
requestPermission() {
|
requestPermission() {
|
||||||
try {
|
try {
|
||||||
console.log('1');
|
|
||||||
|
|
||||||
this.angularFireMessaging.getToken.subscribe({
|
|
||||||
next: (val) => {
|
|
||||||
console.log('VAL: ', val)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.angularFireMessaging.requestToken.subscribe({
|
this.angularFireMessaging.requestToken.subscribe({
|
||||||
next: (token) => {
|
next: (token) => {
|
||||||
console.log('#: ')
|
|
||||||
this.updateToken(token);
|
this.updateToken(token);
|
||||||
console.log('####TOKEN: ', token);
|
|
||||||
},
|
},
|
||||||
error: (e) => console.error(e),
|
error: (e) => console.error(e),
|
||||||
});
|
});
|
||||||
@ -77,7 +68,6 @@ export class MessagingService {
|
|||||||
* hook method when new notification received in foreground
|
* hook method when new notification received in foreground
|
||||||
*/
|
*/
|
||||||
receiveMessage() {
|
receiveMessage() {
|
||||||
console.log('#REC')
|
|
||||||
this.angularFireMessaging.messages.subscribe((payload: any) => {
|
this.angularFireMessaging.messages.subscribe((payload: any) => {
|
||||||
console.log('new message received. ', payload);
|
console.log('new message received. ', payload);
|
||||||
this.currentMessage.next(payload);
|
this.currentMessage.next(payload);
|
||||||
|
|||||||
14
src/assets/share.svg
Normal file
14
src/assets/share.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 11 KiB |
@ -60,3 +60,7 @@ button {
|
|||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
max-width: 400px;
|
max-width: 400px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
input::-webkit-date-and-time-value {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user