From 2535e23db6ed1b4bba8f584a504b7cb6383476cf Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Thu, 14 Jul 2022 11:11:04 -0500 Subject: [PATCH 1/2] Add viewing key field to owner model --- CHANGELOG.md | 8 ++++++-- src/app/business/business.component.ts | 7 +++++-- src/app/fullnode.service.ts | 3 ++- src/app/header/header.component.ts | 3 ++- src/app/items/item-list/item-list.component.ts | 3 ++- src/app/login/login.component.ts | 3 ++- src/app/order/order.service.ts | 3 ++- src/app/owner.model.ts | 1 + src/app/receipt.service.ts | 3 ++- src/app/user.service.ts | 3 ++- src/app/viewer/viewer.component.ts | 3 ++- 11 files changed, 28 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ae4c373..3b82b18 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] -- (20022-07-11) Order's list UI updated (Alpha version) + +### Changed + +- Added viewing key field to owner model +- (2022-07-11) Order's list UI updated (Alpha version) + Paid status icons added to order's title + Order detail redesigned Components affected: @@ -15,7 +19,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [1.1.2] - 2022-05-24 -## Added +### Added - Button in QR code prompt to copy ZGo address. - Button in QR code prompt to copy transaction amount. diff --git a/src/app/business/business.component.ts b/src/app/business/business.component.ts index b5ce34a..f27a444 100644 --- a/src/app/business/business.component.ts +++ b/src/app/business/business.component.ts @@ -65,7 +65,8 @@ export class BusinessComponent implements OnInit { website: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' } public countriesUpdate: Observable; public ownerUpdate: Observable; @@ -127,6 +128,7 @@ export class BusinessComponent implements OnInit { this.ownerUpdate.subscribe(ownerData => { if(ownerData.name.length > 0 && this.stepper!.selectedIndex == 0){ this.stepper!.next(); + this.loginCheck(); } }); } @@ -170,7 +172,8 @@ export class BusinessComponent implements OnInit { website: this.bizForm.get('website')!.value, zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; this.userService.addOwner(this.owner); this.stepper!.next(); diff --git a/src/app/fullnode.service.ts b/src/app/fullnode.service.ts index ca57ecd..8be648b 100644 --- a/src/app/fullnode.service.ts +++ b/src/app/fullnode.service.ts @@ -44,7 +44,8 @@ export class FullnodeService{ country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; constructor(private http: HttpClient, public userService: UserService){ diff --git a/src/app/header/header.component.ts b/src/app/header/header.component.ts index 37ee99b..d7e57fa 100644 --- a/src/app/header/header.component.ts +++ b/src/app/header/header.component.ts @@ -39,7 +39,8 @@ export class HeaderComponent implements OnInit, OnDestroy { country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; private session: string | null = ''; public heightUpdate: Observable; diff --git a/src/app/items/item-list/item-list.component.ts b/src/app/items/item-list/item-list.component.ts index c08ac73..71343c9 100644 --- a/src/app/items/item-list/item-list.component.ts +++ b/src/app/items/item-list/item-list.component.ts @@ -42,7 +42,8 @@ export class ItemListComponent implements OnInit{ country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; public price: number = 1; public ownerUpdate: Observable; diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 9898140..69f0b1c 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -59,7 +59,8 @@ export class LoginComponent implements OnInit, AfterViewInit { country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; private FullnodeSub: Subscription = new Subscription(); private UserSub: Subscription = new Subscription(); diff --git a/src/app/order/order.service.ts b/src/app/order/order.service.ts index 4deb7bb..71aa4df 100644 --- a/src/app/order/order.service.ts +++ b/src/app/order/order.service.ts @@ -45,7 +45,8 @@ export class OrderService { country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }, order: { address: '', diff --git a/src/app/owner.model.ts b/src/app/owner.model.ts index e371de6..cb310d4 100644 --- a/src/app/owner.model.ts +++ b/src/app/owner.model.ts @@ -21,4 +21,5 @@ export interface Owner { zats: boolean; invoices: boolean; expiration: string; + viewkey: string; } diff --git a/src/app/receipt.service.ts b/src/app/receipt.service.ts index 096a150..d52a4ce 100644 --- a/src/app/receipt.service.ts +++ b/src/app/receipt.service.ts @@ -35,7 +35,8 @@ export class ReceiptService { country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }, order: { address: '', diff --git a/src/app/user.service.ts b/src/app/user.service.ts index 4e462a5..d423ac3 100644 --- a/src/app/user.service.ts +++ b/src/app/user.service.ts @@ -41,7 +41,8 @@ export class UserService{ country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }, txs : [], countries: [] diff --git a/src/app/viewer/viewer.component.ts b/src/app/viewer/viewer.component.ts index 2c10ed4..9d1ac6b 100644 --- a/src/app/viewer/viewer.component.ts +++ b/src/app/viewer/viewer.component.ts @@ -49,7 +49,8 @@ export class ViewerComponent implements OnInit { country: '', zats: false, invoices: false, - expiration: new Date(Date.now()).toISOString() + expiration: new Date(Date.now()).toISOString(), + viewkey: '' }; public addrUpdate: Observable; public ownerUpdate: Observable; From 4fe5857383294b3d5871f7df258d010d92ac40fc Mon Sep 17 00:00:00 2001 From: Rene Vergara Date: Thu, 14 Jul 2022 13:12:26 -0500 Subject: [PATCH 2/2] Fix redirect on order list page --- src/app/login/login.component.ts | 1 + src/app/viewer/viewer.component.ts | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/app/login/login.component.ts b/src/app/login/login.component.ts index 69f0b1c..f86e692 100644 --- a/src/app/login/login.component.ts +++ b/src/app/login/login.component.ts @@ -167,6 +167,7 @@ export class LoginComponent implements OnInit, AfterViewInit { } //console.log('Log in found in blockchain!'); if (user.validated) { + clearInterval(this.intervalHolder); if (this.owner.paid) { this.router.navigate(['/shop']); } else { diff --git a/src/app/viewer/viewer.component.ts b/src/app/viewer/viewer.component.ts index 9d1ac6b..5056177 100644 --- a/src/app/viewer/viewer.component.ts +++ b/src/app/viewer/viewer.component.ts @@ -80,9 +80,9 @@ export class ViewerComponent implements OnInit { this.message = owner.name; }); this.loginCheck(); - this.intervalHolder = setInterval(() => { - this.loginCheck(); - }, 60000); + //this.intervalHolder = setInterval(() => { + //this.loginCheck(); + //}, 60000); } ngOnDestroy(){ @@ -124,7 +124,7 @@ export class ViewerComponent implements OnInit { this.owner = owner; this.userUpdate.subscribe((user) => { this.user = user; - //console.log('Viewer loginCheck', this.user); + console.log('Viewer loginCheck', this.user); if (!this.owner.paid || !this.user.validated) { console.log('Log in expired!'); this.router.navigate(['/login']);