From f555ee41a1dd125f25e834c23c035b6ecc5ce755 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 17 Jan 2023 18:40:11 +0800 Subject: [PATCH 01/16] feat(buy-num.page): show price for bronze pack --- src/app/features/wallets/buy-num/buy-num.page.html | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/app/features/wallets/buy-num/buy-num.page.html b/src/app/features/wallets/buy-num/buy-num.page.html index 541fc66e0..db7a6e99d 100644 --- a/src/app/features/wallets/buy-num/buy-num.page.html +++ b/src/app/features/wallets/buy-num/buy-num.page.html @@ -17,9 +17,7 @@
-
+
{{ product.inAppProduct.title }}
-
+
{{ product.inAppProduct.price }}
From f9e7c9dca660e92c0777170fbc9f6ec57e73c09d Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 27 Jan 2023 15:30:18 +0800 Subject: [PATCH 02/16] fix: CI deprecated github commands --- .github/workflows/pre-release.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml index 8d800af70..5e9832f96 100644 --- a/.github/workflows/pre-release.yml +++ b/.github/workflows/pre-release.yml @@ -19,7 +19,7 @@ jobs: - name: Get release version id: version_check - run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + run: echo "version_new=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Build Ionic env: @@ -90,7 +90,7 @@ jobs: - name: Get release version id: version_check - run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + run: echo "version_new=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Build Ionic env: @@ -166,7 +166,7 @@ jobs: - name: Get release version id: version_check - run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + run: echo "version_new=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Build Ionic env: @@ -286,7 +286,7 @@ jobs: - name: Get release version id: version_check - run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + run: echo "version_new=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - name: Create GitHub prerelease id: create_release From 5a35c2c32ab113c43a0ed244d389f5e03784f3d8 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Sun, 29 Jan 2023 10:59:10 +0800 Subject: [PATCH 03/16] feat(wallet.page): use wallet iframe --- src/app/features/wallets/wallets.page.html | 174 +++------------------ src/app/features/wallets/wallets.page.scss | 161 +++---------------- src/app/features/wallets/wallets.page.ts | 84 +++++++++- 3 files changed, 133 insertions(+), 286 deletions(-) diff --git a/src/app/features/wallets/wallets.page.html b/src/app/features/wallets/wallets.page.html index c31a2f78f..c4107a8a7 100644 --- a/src/app/features/wallets/wallets.page.html +++ b/src/app/features/wallets/wallets.page.html @@ -1,149 +1,27 @@ - - - {{ t('wallets.wallets') }} - + + + + {{ 'wallets.walets' | transloco }} + +
+ {{ 'message.networkNotConnected' | transloco }} +
+
- - - -

- ↓{{ t('wallets.pullToRefreshBalance') }}↓ -

- - - - - -

- {{ totalBalance$ | ngrxPush | currency }} NUM -

-
-
- - - - -

NUM

-
-
-
-
- - Mainnet: - - - ${{ mainNumBalance$ | ngrxPush | number: '1.2-2' }} - - - - - - - {{ t('wallets.buyCredits.credits') }}: - {{ points$ | ngrxPush | number: '1.2-2' }} - - - {{ t('wallets.buyCredits.buyCredits') }} - {{ t('wallets.deposit') }} - {{ t('wallets.withdraw') }} - -
-
- - - - -
- {{ t('wallets.myAssetWallet') }} - -
-
{{ assetWalletAddr$ | ngrxPush }}
- -
- - vpn_key -
- {{ t('wallets.integrityWallet') }} - -
-
{{ publicKey$ | ngrxPush }}
- -
- - history -
{{ t('wallets.assetWalletHistory') }}
- -
-
- - {{ t('wallets.exportIntegrityKey') }} - -
+ + + + diff --git a/src/app/features/wallets/wallets.page.scss b/src/app/features/wallets/wallets.page.scss index 0c67b9487..044c5df02 100644 --- a/src/app/features/wallets/wallets.page.scss +++ b/src/app/features/wallets/wallets.page.scss @@ -1,148 +1,39 @@ mat-toolbar { span { padding-right: 40px; + font-style: normal; + font-weight: 500; + font-size: 16px; + line-height: 21px; + text-align: center; + color: white; } -} - -.text-black { - color: black; -} - -#pull-to-refresh-help-text { - margin: 0; - font-style: normal; - font-weight: 500; - font-size: 11px; - line-height: 10px; - text-align: center; - letter-spacing: 0.02em; - color: #9c9c9c; -} - -ion-card { - background: white; - border-radius: 15px; - flex: none; - order: 0; - flex-grow: 0; - margin-top: 5px; - margin-left: 8px; - margin-right: 8px; - - ion-grid { - margin-left: 12px; - margin-right: 8px; - - h1.balance-text { - @media (max-width: 360px) { - font-size: 20px; - } - } - - #num-icon-row { - ion-img { - margin-top: 10px; - width: 29px; - - @media (max-width: 360px) { - width: 20px; - } - } - - h3.num-text { - flex: none; - order: 1; - flex-grow: 0; - margin-top: 21px; - margin-left: 7px; - - @media (max-width: 360px) { - font-size: 20px; - } - } - } - - #mainnet-points-row { - margin-top: 5%; - padding-left: 2%; - align-items: center; - - .mainnet-points { - letter-spacing: 0.05em; - font-weight: bold; - margin-left: 1%; - transform: translateY(-2); - } - - ion-icon { - transform: translateY(0.5px); - font-size: 1.1em; - margin-left: 8px; - margin-right: 5%; - } - - mat-spinner { - margin-left: 5%; - margin-right: 5%; - } - } - #buy-deposit-withdraw-row { - margin-top: 10px; - } + .capture-rebranded-button { + margin: 0 4px; + background: #ffffff40 !important; /* stylelint-disable-line declaration-no-important */ + color: white !important; /* stylelint-disable-line declaration-no-important */ + backdrop-filter: blur(4px); + box-shadow: none; } } -ion-button { - --box-shadow: 0; -} - -.num-operation-btn { - --border-radius: 10.4988px; - - margin-bottom: 16px; - padding-right: 10px; - min-width: 90px; -} - -mat-list { - padding-top: 0; - margin: 0 8px; -} - -#buy-num-btn { - color: white; -} - -.deposit-withdraw-num-btn { - color: #626262; -} - -#export-integrity-wallet-btn { - margin: 8px 16px; -} - -.info-icon { - transform: translateY(3px); - margin-left: 3px; - font-size: 1.1em; -} - -.asset-wallet-qr-code-container { - // background-color: green; - max-width: 300px; - margin: 0 auto; - display: flex; - flex-direction: column; - align-items: center; +.no-network-text { + font-size: 18px; + margin: auto; } -.qr-code-info { - text-align: center; - opacity: 0.6; - font-size: 12px; +.bubble-iframe { + background-color: black; + width: 100vw; + height: 100vh; + border: 0; } -.vertical-pacing-12 { - height: 12px; +ion-spinner { + position: absolute; + left: 50%; + top: 50%; + transform: translate(-50%, -50%); + scale: 1.5; } diff --git a/src/app/features/wallets/wallets.page.ts b/src/app/features/wallets/wallets.page.ts index 2c46f63c2..9bb385888 100644 --- a/src/app/features/wallets/wallets.page.ts +++ b/src/app/features/wallets/wallets.page.ts @@ -6,11 +6,11 @@ import { DomSanitizer } from '@angular/platform-browser'; import { Router } from '@angular/router'; import { Browser } from '@capacitor/browser'; import { Clipboard } from '@capacitor/clipboard'; -import { Platform } from '@ionic/angular'; +import { NavController, Platform } from '@ionic/angular'; import { TranslocoService } from '@ngneat/transloco'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { NgxQrcodeElementTypes } from '@techiediaries/ngx-qrcode'; -import { BehaviorSubject, combineLatest, forkJoin } from 'rxjs'; +import { BehaviorSubject, combineLatest, forkJoin, fromEvent } from 'rxjs'; import { catchError, concatMap, @@ -23,6 +23,7 @@ import { import { WebCryptoApiSignatureProvider } from '../../shared/collector/signature/web-crypto-api-signature-provider/web-crypto-api-signature-provider.service'; import { ConfirmAlert } from '../../shared/confirm-alert/confirm-alert.service'; import { DiaBackendAuthService } from '../../shared/dia-backend/auth/dia-backend-auth.service'; +import { BUBBLE_IFRAME_URL } from '../../shared/dia-backend/secret'; import { DiaBackendWalletService } from '../../shared/dia-backend/wallet/dia-backend-wallet.service'; import { ErrorService } from '../../shared/error/error.service'; import { ExportPrivateKeyModalComponent } from '../../shared/export-private-key-modal/export-private-key-modal.component'; @@ -48,6 +49,15 @@ export class WalletsPage { readonly isLoadingBalance$ = new BehaviorSubject(false); readonly networkConnected$ = this.diaBackendWalletService.networkConnected$; + readonly iframeUrl$ = this.diaBackendAuthService.cachedQueryJWTToken$.pipe( + map(token => { + const queryParams = `token=${token.access}&refresh_token=${token.refresh}`; + const url = `${BUBBLE_IFRAME_URL}/version-v230116-ethan/wallet?${queryParams}`; + return url; + }) + ); + readonly iframeLoaded$ = new BehaviorSubject(false); + elementType = NgxQrcodeElementTypes.URL; shouldHideDepositButton = false; @@ -63,7 +73,8 @@ export class WalletsPage { private readonly dialog: MatDialog, private readonly errorService: ErrorService, private readonly router: Router, - private readonly platform: Platform + private readonly platform: Platform, + private readonly navController: NavController ) { this.matIconRegistry.addSvgIcon( 'wallet', @@ -85,6 +96,73 @@ export class WalletsPage { this.shouldHideDepositButton = this.platform.is('ios'); } + ionViewDidEnter() { + this.processIframeEvents(); + } + + private processIframeEvents() { + fromEvent(window, 'message') + .pipe( + tap(event => { + const postMessageEvent = event as MessageEvent; + switch (postMessageEvent.data) { + case 'iframe-on-load': + this.iframeLoaded$.next(true); + break; + case 'iframeBackButtonClicked': + this.navController.pop(); + break; + case 'iframe-buy-num-button-clicked': + this.navigateToBuyNumPage(); + break; + case 'iframe-copy-to-clipboard-asset-wallet': + this.copyToClipboardAssetWallet(); + break; + case 'iframe-copy-to-clipboard-integrity-wallet': + this.copyToClipboardIntegrityWallet(); + break; + case 'iframe-copy-to-clipboard-private-key': + this.copyToClipboardPrivateKey(); + break; + default: + break; + } + }), + untilDestroyed(this) + ) + .subscribe(); + } + + private copyToClipboardAssetWallet() { + this.assetWalletAddr$ + .pipe( + first(), + concatMap(assetWalletAddr => this.copyToClipboard(assetWalletAddr)), + untilDestroyed(this) + ) + .subscribe(); + } + + private copyToClipboardIntegrityWallet() { + this.publicKey$ + .pipe( + first(), + concatMap(publicKey => this.copyToClipboard(publicKey)), + untilDestroyed(this) + ) + .subscribe(); + } + + private copyToClipboardPrivateKey() { + this.privateKey$ + .pipe( + first(), + concatMap(privateKey => this.copyToClipboard(privateKey)), + untilDestroyed(this) + ) + .subscribe(); + } + // eslint-disable-next-line class-methods-use-this onBuyNumBtnClicked() { Browser.open({ From 2879fa1d6411b67c14f45c06e77a9a43261c412e Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Sun, 29 Jan 2023 12:12:49 +0800 Subject: [PATCH 04/16] fix(wallet.page): remove unused vars, methods --- src/app/features/wallets/wallets.page.ts | 159 +---------------------- 1 file changed, 4 insertions(+), 155 deletions(-) diff --git a/src/app/features/wallets/wallets.page.ts b/src/app/features/wallets/wallets.page.ts index 9bb385888..1ec73a2d3 100644 --- a/src/app/features/wallets/wallets.page.ts +++ b/src/app/features/wallets/wallets.page.ts @@ -1,32 +1,17 @@ import { Component } from '@angular/core'; -import { MatDialog } from '@angular/material/dialog'; -import { MatIconRegistry } from '@angular/material/icon'; import { MatSnackBar } from '@angular/material/snack-bar'; -import { DomSanitizer } from '@angular/platform-browser'; import { Router } from '@angular/router'; -import { Browser } from '@capacitor/browser'; import { Clipboard } from '@capacitor/clipboard'; -import { NavController, Platform } from '@ionic/angular'; +import { NavController } from '@ionic/angular'; import { TranslocoService } from '@ngneat/transloco'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { NgxQrcodeElementTypes } from '@techiediaries/ngx-qrcode'; -import { BehaviorSubject, combineLatest, forkJoin, fromEvent } from 'rxjs'; -import { - catchError, - concatMap, - finalize, - first, - map, - switchMap, - tap, -} from 'rxjs/operators'; +import { BehaviorSubject, fromEvent } from 'rxjs'; +import { concatMap, first, map, tap } from 'rxjs/operators'; import { WebCryptoApiSignatureProvider } from '../../shared/collector/signature/web-crypto-api-signature-provider/web-crypto-api-signature-provider.service'; -import { ConfirmAlert } from '../../shared/confirm-alert/confirm-alert.service'; import { DiaBackendAuthService } from '../../shared/dia-backend/auth/dia-backend-auth.service'; import { BUBBLE_IFRAME_URL } from '../../shared/dia-backend/secret'; import { DiaBackendWalletService } from '../../shared/dia-backend/wallet/dia-backend-wallet.service'; -import { ErrorService } from '../../shared/error/error.service'; -import { ExportPrivateKeyModalComponent } from '../../shared/export-private-key-modal/export-private-key-modal.component'; @UntilDestroy({ checkProperties: true }) @Component({ selector: 'app-wallets', @@ -34,19 +19,10 @@ import { ExportPrivateKeyModalComponent } from '../../shared/export-private-key- styleUrls: ['./wallets.page.scss'], }) export class WalletsPage { - readonly domainMainnetNum = 'mainnet.num.network'; - - readonly mainNumBalance$ = - this.diaBackendWalletService.assetWalletMainnetNumBalance$; - readonly points$ = this.diaBackendAuthService.points$; - - readonly totalBalance$ = new BehaviorSubject(0); - readonly publicKey$ = this.webCryptoApiSignatureProvider.publicKey$; readonly privateKey$ = this.webCryptoApiSignatureProvider.privateKey$; readonly assetWalletAddr$ = this.diaBackendWalletService.assetWalletAddr$; - readonly isLoadingBalance$ = new BehaviorSubject(false); readonly networkConnected$ = this.diaBackendWalletService.networkConnected$; readonly iframeUrl$ = this.diaBackendAuthService.cachedQueryJWTToken$.pipe( @@ -64,37 +40,12 @@ export class WalletsPage { constructor( private readonly diaBackendWalletService: DiaBackendWalletService, private readonly diaBackendAuthService: DiaBackendAuthService, - private readonly matIconRegistry: MatIconRegistry, - private readonly domSanitizer: DomSanitizer, private readonly snackBar: MatSnackBar, private readonly translocoService: TranslocoService, private readonly webCryptoApiSignatureProvider: WebCryptoApiSignatureProvider, - private readonly confirmAlert: ConfirmAlert, - private readonly dialog: MatDialog, - private readonly errorService: ErrorService, private readonly router: Router, - private readonly platform: Platform, private readonly navController: NavController - ) { - this.matIconRegistry.addSvgIcon( - 'wallet', - this.domSanitizer.bypassSecurityTrustResourceUrl( - '../../../assets/images/wallet.svg' - ) - ); - - combineLatest([this.mainNumBalance$, this.points$]) - .pipe( - first(), - map( - ([mainNumBalance, points]) => Number(mainNumBalance) + Number(points) - ), - untilDestroyed(this) - ) - .subscribe(totalBalance => this.totalBalance$.next(totalBalance)); - - this.shouldHideDepositButton = this.platform.is('ios'); - } + ) {} ionViewDidEnter() { this.processIframeEvents(); @@ -163,116 +114,14 @@ export class WalletsPage { .subscribe(); } - // eslint-disable-next-line class-methods-use-this - onBuyNumBtnClicked() { - Browser.open({ - url: `https://link.numbersprotocol.io/buy-num`, - toolbarColor: '#564dfc', - }); - } - navigateToBuyNumPage() { this.router.navigate(['wallets', 'buy-num']); } - openAssetWalletHistory() { - this.diaBackendWalletService.assetWalletAddr$ - .pipe( - first(), - switchMap(address => - Browser.open({ - url: `https://${this.domainMainnetNum}/address/${address}`, - toolbarColor: '#000000', - }) - ), - untilDestroyed(this) - ) - .subscribe(); - } - - refreshBalance(event: Event) { - (event).detail.complete(); - this.networkConnected$ - .pipe( - first(), - concatMap(networkConnected => { - if (!networkConnected) { - return this.errorService.toastError$( - this.translocoService.translate( - `error.wallets.noNetworkConnectionCannotRefreshBalance` - ) - ); - } - this.isLoadingBalance$.next(true); - return forkJoin([ - this.diaBackendWalletService.syncAssetWalletBalance$(), - this.diaBackendAuthService.syncProfile$(), - ]).pipe( - tap(async ([assetWallet, _]) => { - this.totalBalance$.next( - Number(assetWallet[1]) + - (await this.diaBackendAuthService.getPoints()) - ); - }), - catchError(() => - this.errorService.toastError$( - this.translocoService.translate( - `error.wallets.cannotRefreshBalance` - ) - ) - ), - finalize(() => this.isLoadingBalance$.next(false)) - ); - }), - untilDestroyed(this) - ) - .subscribe(); - } - - async onDepositWithdrawBtnClick(mode: 'deposit' | 'withdraw') { - this.networkConnected$ - .pipe( - first(), - concatMap(networkConnected => { - if (!networkConnected) { - return this.errorService.toastError$( - this.translocoService.translate(`error.internetError`) - ); - } - return this.router.navigate(['wallets', 'transfer', mode]); - }), - untilDestroyed(this) - ) - .subscribe(); - } - async copyToClipboard(value: string) { await Clipboard.write({ string: value }); this.snackBar.open( this.translocoService.translate('message.copiedToClipboard') ); } - - exportIntegrityWalletPrivateKey() { - this.privateKey$ - .pipe( - first(), - concatMap(async privateKey => { - const result = await this.confirmAlert.present({ - message: this.translocoService.translate( - 'message.confirmCopyPrivateKey' - ), - }); - if (result) - this.dialog.open( - ExportPrivateKeyModalComponent, - { - data: { privateKey }, - } - ); - }), - untilDestroyed(this) - ) - .subscribe(); - } } From eb0365851f2d971bfd6f6b4d05f68db883e67e28 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Fri, 27 Jan 2023 18:38:36 +0800 Subject: [PATCH 05/16] fix(custom-camera): focus on camera preview click --- src/app/features/home/custom-camera/custom-camera.page.html | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/features/home/custom-camera/custom-camera.page.html b/src/app/features/home/custom-camera/custom-camera.page.html index a59b1dfb4..bfbf594b3 100644 --- a/src/app/features/home/custom-camera/custom-camera.page.html +++ b/src/app/features/home/custom-camera/custom-camera.page.html @@ -50,6 +50,7 @@
Date: Thu, 19 Jan 2023 16:58:06 +0800 Subject: [PATCH 06/16] add close button to login, signup pages --- src/app/features/login/login.page.html | 9 +++++++++ src/app/features/login/login.page.scss | 9 +++++++++ src/app/features/signup/signup.page.html | 9 +++++++++ src/app/features/signup/signup.page.scss | 9 +++++++++ 4 files changed, 36 insertions(+) diff --git a/src/app/features/login/login.page.html b/src/app/features/login/login.page.html index ade6b8420..8057891e0 100644 --- a/src/app/features/login/login.page.html +++ b/src/app/features/login/login.page.html @@ -1,4 +1,13 @@
+ +
diff --git a/src/app/features/login/login.page.scss b/src/app/features/login/login.page.scss index cf4cc3dbc..34f7560be 100644 --- a/src/app/features/login/login.page.scss +++ b/src/app/features/login/login.page.scss @@ -1,6 +1,15 @@ .page-content { padding: 0 16px 16px; + button.capture-rebranded-button { + margin: 16 4px; + width: 40px; + background: #ffffff40 !important; /* stylelint-disable-line declaration-no-important */ + color: white !important; /* stylelint-disable-line declaration-no-important */ + backdrop-filter: blur(4px); + box-shadow: none; + } + .logo { width: 50%; margin: 0 auto; diff --git a/src/app/features/signup/signup.page.html b/src/app/features/signup/signup.page.html index e1461d56c..8b4449d00 100644 --- a/src/app/features/signup/signup.page.html +++ b/src/app/features/signup/signup.page.html @@ -1,4 +1,13 @@
+ + diff --git a/src/app/features/signup/signup.page.scss b/src/app/features/signup/signup.page.scss index b63910d45..f54c6efa7 100644 --- a/src/app/features/signup/signup.page.scss +++ b/src/app/features/signup/signup.page.scss @@ -1,6 +1,15 @@ .page-content { padding: 0 16px 16px; + button.capture-rebranded-button { + margin: 16 4px; + width: 40px; + background: #ffffff40 !important; /* stylelint-disable-line declaration-no-important */ + color: white !important; /* stylelint-disable-line declaration-no-important */ + backdrop-filter: blur(4px); + box-shadow: none; + } + .logo { width: 50%; margin: 0 auto; From 6df9e825007a0965864b78beb5293587db01238d Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Thu, 19 Jan 2023 17:29:56 +0800 Subject: [PATCH 07/16] allow enter home page without login --- src/app/app-routing.module.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index b40f8bd48..34fdaa5ea 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -22,7 +22,6 @@ const routes: Routes = [ path: 'home', loadChildren: () => import('./features/home/home.module').then(m => m.HomePageModule), - canActivate: [AuthGuard], }, { path: 'profile', From 4b49d31f6ed13a7614a0a3e3dd9920fa78a0501f Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Thu, 19 Jan 2023 17:32:56 +0800 Subject: [PATCH 08/16] feat(explore-tab): provide iframe url without login --- .../explore-tab/explore-tab/explore-tab.component.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts b/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts index 5d073fc54..38e0e8eff 100644 --- a/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts +++ b/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts @@ -2,7 +2,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { combineLatest } from 'rxjs'; -import { map, tap } from 'rxjs/operators'; +import { map, startWith, tap } from 'rxjs/operators'; import { DiaBackendAuthService } from '../../../../shared/dia-backend/auth/dia-backend-auth.service'; import { BUBBLE_IFRAME_URL } from '../../../../shared/dia-backend/secret'; import { IframeService } from '../../../../shared/iframe/iframe.service'; @@ -19,10 +19,12 @@ export class ExploreTabComponent { this.diaBackendAuthService.cachedQueryJWTToken$, this.iframeService.exploreTabRefreshRequested$, ]).pipe( + startWith([undefined, undefined]), map(([token, _]) => { - const url = `${BUBBLE_IFRAME_URL}/?token=${token.access}&refresh_token=${token.refresh}`; - return this.sanitizer.bypassSecurityTrustResourceUrl(url); - }) + if (!token) return BUBBLE_IFRAME_URL; + return `${BUBBLE_IFRAME_URL}/?token=${token.access}&refresh_token=${token.refresh}`; + }), + map(url => this.sanitizer.bypassSecurityTrustResourceUrl(url)) ); readonly networkConnected$ = this.networkService.connected$; From 8677a8b0d45b236f8aae4d90f815faae4cc5f2eb Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Thu, 19 Jan 2023 17:35:05 +0800 Subject: [PATCH 09/16] feat(home.page): work without login --- src/app/features/home/home.page.html | 2 +- src/app/features/home/home.page.ts | 53 ++++++++++++++++------------ 2 files changed, 32 insertions(+), 23 deletions(-) diff --git a/src/app/features/home/home.page.html b/src/app/features/home/home.page.html index 27b0d0bb1..35f74a088 100644 --- a/src/app/features/home/home.page.html +++ b/src/app/features/home/home.page.html @@ -115,7 +115,7 @@ - + - + + + From ffb54dc0b30fc9398fb0799bb626d05e01ba037e Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Mon, 6 Feb 2023 11:36:15 +0800 Subject: [PATCH 12/16] set wallet page iframe url to version qa --- src/app/features/wallets/wallets.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/wallets/wallets.page.ts b/src/app/features/wallets/wallets.page.ts index 1ec73a2d3..b560891fa 100644 --- a/src/app/features/wallets/wallets.page.ts +++ b/src/app/features/wallets/wallets.page.ts @@ -28,7 +28,7 @@ export class WalletsPage { readonly iframeUrl$ = this.diaBackendAuthService.cachedQueryJWTToken$.pipe( map(token => { const queryParams = `token=${token.access}&refresh_token=${token.refresh}`; - const url = `${BUBBLE_IFRAME_URL}/version-v230116-ethan/wallet?${queryParams}`; + const url = `${BUBBLE_IFRAME_URL}/version-qa-release/wallet?${queryParams}`; return url; }) ); From be59ce6baa9f30ea994cd1c41634064c54140dcd Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 7 Feb 2023 12:52:15 +0800 Subject: [PATCH 13/16] Revert "Merge pull request #2529 from numbersprotocol/feat-v230131-lazy-login" This reverts commit 4549f3c58f8794d767f7c5bb2a8bd3113b22f361, reversing changes made to 1235ab4722bbbe94d689a79d83c3eec69acd2f9a. --- src/app/app-routing.module.ts | 1 + .../explore-tab/explore-tab.component.ts | 10 ++-- src/app/features/home/home.page.html | 8 +-- src/app/features/home/home.page.ts | 55 ++++++++----------- src/app/features/login/login.page.html | 9 --- src/app/features/login/login.page.scss | 9 --- src/app/features/signup/signup.page.html | 9 --- src/app/features/signup/signup.page.scss | 9 --- 8 files changed, 31 insertions(+), 79 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 34fdaa5ea..b40f8bd48 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -22,6 +22,7 @@ const routes: Routes = [ path: 'home', loadChildren: () => import('./features/home/home.module').then(m => m.HomePageModule), + canActivate: [AuthGuard], }, { path: 'profile', diff --git a/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts b/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts index 38e0e8eff..5d073fc54 100644 --- a/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts +++ b/src/app/features/home/explore-tab/explore-tab/explore-tab.component.ts @@ -2,7 +2,7 @@ import { Component, ElementRef, ViewChild } from '@angular/core'; import { DomSanitizer } from '@angular/platform-browser'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { combineLatest } from 'rxjs'; -import { map, startWith, tap } from 'rxjs/operators'; +import { map, tap } from 'rxjs/operators'; import { DiaBackendAuthService } from '../../../../shared/dia-backend/auth/dia-backend-auth.service'; import { BUBBLE_IFRAME_URL } from '../../../../shared/dia-backend/secret'; import { IframeService } from '../../../../shared/iframe/iframe.service'; @@ -19,12 +19,10 @@ export class ExploreTabComponent { this.diaBackendAuthService.cachedQueryJWTToken$, this.iframeService.exploreTabRefreshRequested$, ]).pipe( - startWith([undefined, undefined]), map(([token, _]) => { - if (!token) return BUBBLE_IFRAME_URL; - return `${BUBBLE_IFRAME_URL}/?token=${token.access}&refresh_token=${token.refresh}`; - }), - map(url => this.sanitizer.bypassSecurityTrustResourceUrl(url)) + const url = `${BUBBLE_IFRAME_URL}/?token=${token.access}&refresh_token=${token.refresh}`; + return this.sanitizer.bypassSecurityTrustResourceUrl(url); + }) ); readonly networkConnected$ = this.networkService.connected$; diff --git a/src/app/features/home/home.page.html b/src/app/features/home/home.page.html index aa07fe1bb..27b0d0bb1 100644 --- a/src/app/features/home/home.page.html +++ b/src/app/features/home/home.page.html @@ -115,9 +115,9 @@ - + - - - - + diff --git a/src/app/features/home/home.page.ts b/src/app/features/home/home.page.ts index ab20d0400..45abf4142 100644 --- a/src/app/features/home/home.page.ts +++ b/src/app/features/home/home.page.ts @@ -59,8 +59,6 @@ export class HomePage { readonly username$ = this.diaBackendAuthService.username$; - readonly hasLoggedIn$ = this.diaBackendAuthService.hasLoggedIn$; - private readonly userGuideIsTemporarelyDisabled = true; readonly hasNewInbox$ = this.diaBackendTransactionRepository.inbox$.pipe( @@ -106,23 +104,20 @@ export class HomePage { this.downloadExpiredPostCaptures(); } - async ionViewDidEnter() { - const hasLoggedIn = await this.diaBackendAuthService.hasLoggedIn(); - if (hasLoggedIn) { - of(this.onboardingService.isNewLogin) - .pipe( - concatMap(isNewLogin => this.migrationService.migrate$(isNewLogin)), - catchError(() => VOID$), - switchTapTo(defer(() => this.promptAppUpdateIfAny())), - switchTapTo(defer(() => this.onboardingRedirect())), - switchTapTo( - defer(() => this.userGuideService.showUserGuidesOnHomePage()) - ), - catchError((err: unknown) => this.errorService.toastError$(err)), - untilDestroyed(this) - ) - .subscribe(); - } + ionViewDidEnter() { + of(this.onboardingService.isNewLogin) + .pipe( + concatMap(isNewLogin => this.migrationService.migrate$(isNewLogin)), + catchError(() => VOID$), + switchTapTo(defer(() => this.promptAppUpdateIfAny())), + switchTapTo(defer(() => this.onboardingRedirect())), + switchTapTo( + defer(() => this.userGuideService.showUserGuidesOnHomePage()) + ), + catchError((err: unknown) => this.errorService.toastError$(err)), + untilDestroyed(this) + ) + .subscribe(); this.androidBackButtonService.androidBackButtonEvent$ .pipe( @@ -278,12 +273,14 @@ export class HomePage { .subscribe(); } - async captureWithCustomCamera() { - const hasLoggedIn = await this.diaBackendAuthService.hasLoggedIn(); - if (!hasLoggedIn) return this.redirectToLoginPage(); - if (!this.platform.is('hybrid')) return this.capture(); - this.selectedTabIndex = this.afterCaptureTabIndex; - this.router.navigate(['home', 'custom-camera']); + captureWithCustomCamera() { + if (!this.platform.is('hybrid')) { + this.capture(); + } else { + const captureIndex = this.afterCaptureTabIndex; + this.selectedTabIndex = captureIndex; + this.router.navigate(['home', 'custom-camera']); + } } private presentCaptureActions$() { @@ -379,17 +376,11 @@ export class HomePage { } } - async navigateToProfileTab() { - const hasLoggedIn = await this.diaBackendAuthService.hasLoggedIn(); - if (!hasLoggedIn) return this.redirectToLoginPage(); + async navigateToInboxTab() { await this.userGuideService.showUserGuidesOnInboxTab(); await this.userGuideService.setHasOpenedInboxTab(true); } - private async redirectToLoginPage() { - this.router.navigate(['/', 'login']); - } - logout() { const action$ = defer(() => this.mediaStore.clear()).pipe( concatMapTo(defer(() => this.database.clear())), diff --git a/src/app/features/login/login.page.html b/src/app/features/login/login.page.html index 8057891e0..ade6b8420 100644 --- a/src/app/features/login/login.page.html +++ b/src/app/features/login/login.page.html @@ -1,13 +1,4 @@
- - diff --git a/src/app/features/login/login.page.scss b/src/app/features/login/login.page.scss index 34f7560be..cf4cc3dbc 100644 --- a/src/app/features/login/login.page.scss +++ b/src/app/features/login/login.page.scss @@ -1,15 +1,6 @@ .page-content { padding: 0 16px 16px; - button.capture-rebranded-button { - margin: 16 4px; - width: 40px; - background: #ffffff40 !important; /* stylelint-disable-line declaration-no-important */ - color: white !important; /* stylelint-disable-line declaration-no-important */ - backdrop-filter: blur(4px); - box-shadow: none; - } - .logo { width: 50%; margin: 0 auto; diff --git a/src/app/features/signup/signup.page.html b/src/app/features/signup/signup.page.html index 8b4449d00..e1461d56c 100644 --- a/src/app/features/signup/signup.page.html +++ b/src/app/features/signup/signup.page.html @@ -1,13 +1,4 @@
- - diff --git a/src/app/features/signup/signup.page.scss b/src/app/features/signup/signup.page.scss index f54c6efa7..b63910d45 100644 --- a/src/app/features/signup/signup.page.scss +++ b/src/app/features/signup/signup.page.scss @@ -1,15 +1,6 @@ .page-content { padding: 0 16px 16px; - button.capture-rebranded-button { - margin: 16 4px; - width: 40px; - background: #ffffff40 !important; /* stylelint-disable-line declaration-no-important */ - color: white !important; /* stylelint-disable-line declaration-no-important */ - backdrop-filter: blur(4px); - box-shadow: none; - } - .logo { width: 50%; margin: 0 auto; From ee8fa36be0032ac67761458d17c8ebfd3f8cd609 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Wed, 8 Feb 2023 13:20:21 +0800 Subject: [PATCH 14/16] fix(wallets.page): iframe url --- src/app/features/wallets/wallets.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/features/wallets/wallets.page.ts b/src/app/features/wallets/wallets.page.ts index b560891fa..53e82c122 100644 --- a/src/app/features/wallets/wallets.page.ts +++ b/src/app/features/wallets/wallets.page.ts @@ -28,7 +28,7 @@ export class WalletsPage { readonly iframeUrl$ = this.diaBackendAuthService.cachedQueryJWTToken$.pipe( map(token => { const queryParams = `token=${token.access}&refresh_token=${token.refresh}`; - const url = `${BUBBLE_IFRAME_URL}/version-qa-release/wallet?${queryParams}`; + const url = `${BUBBLE_IFRAME_URL}/wallet?${queryParams}`; return url; }) ); From 8a21c34c4e7a6006ada66d04deb7d05307f480a3 Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 14 Feb 2023 18:45:17 +0800 Subject: [PATCH 15/16] build: bump to 0.74.0 --- android/app/build.gradle | 4 ++-- ios/App/App.xcodeproj/project.pbxproj | 4 ++-- package-lock.json | 4 ++-- package.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index d302e5a6e..f583aa32b 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -6,8 +6,8 @@ android { applicationId "io.numbersprotocol.capturelite" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 471 - versionName "0.73.1" + versionCode 472 + versionName "0.74.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" } buildFeatures { diff --git a/ios/App/App.xcodeproj/project.pbxproj b/ios/App/App.xcodeproj/project.pbxproj index 2abc0cce0..7db3d22e2 100644 --- a/ios/App/App.xcodeproj/project.pbxproj +++ b/ios/App/App.xcodeproj/project.pbxproj @@ -374,7 +374,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.73.1; + MARKETING_VERSION = 0.74.0; OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\""; PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -401,7 +401,7 @@ INFOPLIST_FILE = App/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; - MARKETING_VERSION = 0.73.1; + MARKETING_VERSION = 0.74.0; PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = NumbersAppDistributionV4; diff --git a/package-lock.json b/package-lock.json index 30cbdd9b1..b69389392 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "capture-lite", - "version": "0.73.1", + "version": "0.74.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "capture-lite", - "version": "0.73.1", + "version": "0.74.0", "dependencies": { "packages": "^0.0.8", "@angular/animations": "^14.2.0", diff --git a/package.json b/package.json index 2bd9d82ea..a66d443fc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "capture-lite", - "version": "0.73.1", + "version": "0.74.0", "author": "numbersprotocol", "homepage": "https://numbersprotocol.io/", "scripts": { From cf39eb8e16a89d48c092ba6a0b632b482486956f Mon Sep 17 00:00:00 2001 From: sultanmyrza Date: Tue, 14 Feb 2023 18:55:10 +0800 Subject: [PATCH 16/16] build: update changelog --- CHANGELOG.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 69542499b..1fd5fd1a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 To check the difference between the last releaes and the latest dev status, click the link above. +## [0.74.0] - 2023-02-14 + +### Added + +1. Feature support iframe wallet page (#2577) + +### Fixed + +1. Fix camera tap to focus (#2527) +2. Fix to show bronze pack price (#2521) + ## [0.73.1] - 2023-01-30 ### Added @@ -2019,7 +2030,8 @@ This is the first release! _Capture Lite_ is a cross-platform app adapted from [ - Web - see the demo [here](https://github.com/numbersprotocol/capture-lite#demo-app) - Android - the APK file `app-debug.apk` is attached to this release -[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.73.1...HEAD +[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.74.0...HEAD +[0.74.0]: https://github.com/numbersprotocol/capture-lite/compare/0.73.0...0.74.0 [0.73.1]: https://github.com/numbersprotocol/capture-lite/compare/0.72.4...0.73.1 [0.72.4]: https://github.com/numbersprotocol/capture-lite/compare/0.72.3...0.72.4 [0.72.3]: https://github.com/numbersprotocol/capture-lite/compare/0.72.2...0.72.3