Skip to content

Commit

Permalink
Merge pull request #1292 from numbersprotocol/develop
Browse files Browse the repository at this point in the history
Bump version to 0.49.0
  • Loading branch information
ruizehung committed Feb 21, 2022
2 parents 7324db5 + a3b6725 commit 12382c5
Show file tree
Hide file tree
Showing 17 changed files with 345 additions and 27 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ 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).

## 0.49.0 - 2022-02-21

### Added

- Add NUM balance loading indicator
- Add hyperlink for users to view NUM wallet transaction history on EtherScan/BscScan
- New introductory UI/UX for new users

### Fixed

- Show custody wallet balance instead of Capture wallet balance
- Fix null message overwriting asset caption when send. #1166

## 0.48.1 - 2022-02-11

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ android {
applicationId "io.numbersprotocol.capturelite"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 311
versionName "0.48.1"
versionCode 320
versionName "0.49.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capture-lite",
"version": "0.48.1",
"version": "0.49.0",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down
48 changes: 48 additions & 0 deletions src/app/features/home/onboarding/tutorial/tutorial.page.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,53 @@
<ion-content *transloco="let t">
<ion-slides #slides pager>
<ion-slide>
<ng-container>
<div class="onboarding-container" (click)="slides.slideNext()">
<img
class="onboarding-text"
loading="lazy"
src="/assets/images/NewOnboardingDesign_blockchaincamera.svg"
/>
<img
class="onboarding-logo"
loading="lazy"
src="/assets/images/NewOnboardingDesign_LogoCN.svg"
/>
</div>
</ng-container>
</ion-slide>
<ion-slide>
<ng-container>
<div class="onboarding-container" (click)="slides.slideNext()">
<img
class="onboarding-text"
loading="lazy"
src="/assets/images/NewOnboardingDesign_giftphoto.svg"
/>
<img
class="onboarding-logo"
loading="lazy"
src="/assets/images/NewOnboardingDesign_LogoCN.svg"
/>
</div>
</ng-container>
</ion-slide>
<ion-slide>
<ng-container>
<div class="onboarding-container" (click)="slides.slideNext()">
<img
class="onboarding-text"
loading="lazy"
src="/assets/images/NewOnboardingDesign_28Feb.svg"
/>
<img
class="onboarding-logo"
loading="lazy"
src="/assets/images/NewOnboardingDesign_LogoCN.svg"
/>
</div>
</ng-container>
</ion-slide>
<ion-slide>
<ng-container>
<svg
Expand Down
18 changes: 18 additions & 0 deletions src/app/features/home/onboarding/tutorial/tutorial.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ ion-content {
}
}

.onboarding-container {
display: flex;
flex-direction: column;
height: 100vh;
width: 100vw;
background-color: #0000d8;
}

.onboarding-logo {
width: 95%;
margin: auto 20;
margin-bottom: 20px;
}

.onboarding-text {
flex: 1; // Fill remaining space of the flex-direction (column)
}

.pagination-bullets {
bottom: 16px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<mat-form-field appearance="outline">
<mat-label>{{ t('.message') }}</mat-label>
<textarea
[(ngModel)]="previewCaption"
[(ngModel)]="message"
name="caption"
ngModel
matInput
Expand Down Expand Up @@ -75,7 +75,7 @@
</mat-card>

<button
(click)="send(previewCaption)"
(click)="send()"
class="send-button"
mat-raised-button
color="primary"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export class SendingPostCapturePage {
asset_file: assetFileUrl,
asset_file_thumbnail: assetFileUrl,
sharable_copy: assetFileUrl,
caption: this.previewCaption,
caption: this.message !== '' ? this.message : asset.caption,
source_transaction: {
id: '',
sender: asset.owner_name,
Expand All @@ -119,7 +119,7 @@ export class SendingPostCapturePage {
shareReplay({ bufferSize: 1, refCount: true })
);

previewCaption = '';
message = '';

isPreview = false;

Expand Down Expand Up @@ -152,14 +152,14 @@ export class SendingPostCapturePage {
}
}

async send(captionText: string) {
async send() {
const action$ = combineLatest([this.asset$, this.receiverEmail$]).pipe(
first(),
switchTap(([asset, contact]) =>
this.diaBackendTransactionRepository.add$({
assetId: asset.id,
targetEmail: contact,
caption: captionText,
caption: this.message !== '' ? this.message : asset.caption,
createContact: this.shouldCreateContact,
})
),
Expand Down
36 changes: 28 additions & 8 deletions src/app/features/profile/profile.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,43 @@
<mat-list-item>
<ion-icon mat-list-icon src="/assets/images/num-icon.svg"></ion-icon>
<div mat-line>NUM {{ t('balance') }}</div>
<div mat-line>ERC20</div>
<div mat-line>
ERC20
<a (click)="openNUMTransactionHistory('erc20')">{{
t('numTransactionHistory')
}}</a>
</div>
<div class="num-balance">
<ng-container *ngIf="networkConnected$ | ngrxPush; else offline">
$ {{ ethNumBalance$ | ngrxPush | number: '1.2-2' }}
<ng-container *ngIf="networkConnected$ | ngrxPush; else balanceOffline">
<ng-container
*ngIf="!(isLoadingBalance$ | ngrxPush); else balanceLoading"
>
$ {{ ethNumBalance$ | ngrxPush | number: '1.2-2' }}
</ng-container>
</ng-container>
<ng-template #offline> --offline-- </ng-template>
<ng-template #balanceOffline> --offline-- </ng-template>
<ng-template #balanceLoading>
<mat-spinner diameter="30"></mat-spinner>
</ng-template>
</div>
</mat-list-item>
<mat-list-item>
<ion-icon mat-list-icon src="/assets/images/num-icon.svg"></ion-icon>
<div mat-line>NUM {{ t('balance') }}</div>
<div mat-line>BEP20</div>
<div mat-line>
BEP20
<a (click)="openNUMTransactionHistory('bep20')">{{
t('numTransactionHistory')
}}</a>
</div>
<div class="num-balance">
<ng-container *ngIf="networkConnected$ | ngrxPush; else offline">
$ {{ bscNumBalance$ | ngrxPush | number: '1.2-2' }}
<ng-container *ngIf="networkConnected$ | ngrxPush; else balanceOffline">
<ng-container
*ngIf="!(isLoadingBalance$ | ngrxPush); else balanceLoading"
>
$ {{ bscNumBalance$ | ngrxPush | number: '1.2-2' }}
</ng-container>
</ng-container>
<ng-template #offline> --offline-- </ng-template>
</div>
</mat-list-item>
<mat-list-item>
Expand Down
40 changes: 38 additions & 2 deletions src/app/features/profile/profile.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,13 @@ import { AlertController } from '@ionic/angular';
import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { defer, forkJoin, iif } from 'rxjs';
import { catchError, concatMap, concatMapTo, first } from 'rxjs/operators';
import {
catchError,
concatMap,
concatMapTo,
first,
switchMap,
} from 'rxjs/operators';
import { BlockingActionService } from '../../shared/blocking-action/blocking-action.service';
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';
Expand All @@ -19,7 +25,7 @@ import { ExportPrivateKeyModalComponent } from '../../shared/export-private-key-
import { MediaStore } from '../../shared/media/media-store/media-store.service';
import { PreferenceManager } from '../../shared/preference-manager/preference-manager.service';

const { Clipboard } = Plugins;
const { Browser, Clipboard } = Plugins;

@UntilDestroy({ checkProperties: true })
@Component({
Expand All @@ -37,6 +43,15 @@ export class ProfilePage {
readonly ethNumBalance$ = this.diaBackendWalletService.ethNumBalance$;
readonly bscNumBalance$ = this.diaBackendWalletService.bscNumBalance$;
readonly networkConnected$ = this.diaBackendWalletService.networkConnected$;
readonly isLoadingBalance$ = this.diaBackendWalletService.isLoadingBalance$;

readonly contractAddressNUMERC20 =
'0x3496b523e5c00a4b4150d6721320cddb234c3079';
readonly contractAddressNUMBEP20 =
'0xeceb87cf00dcbf2d4e2880223743ff087a995ad9';

readonly domainEtherScan = 'etherscan.io';
readonly domainBscScan = 'bscscan.com';

constructor(
private readonly database: Database,
Expand Down Expand Up @@ -65,6 +80,27 @@ export class ProfilePage {
.subscribe();
}

openNUMTransactionHistory(standard: 'erc20' | 'bep20') {
const domain =
standard == 'erc20' ? this.domainEtherScan : this.domainBscScan;
const contractAddress =
standard == 'erc20'
? this.contractAddressNUMERC20
: this.contractAddressNUMBEP20;
this.diaBackendWalletService.numWalletAddr$
.pipe(
first(),
switchMap(address =>
Browser.open({
url: `https://${domain}/token/${contractAddress}?a=${address}`,
toolbarColor: '#564dfc',
})
),
untilDestroyed(this)
)
.subscribe();
}

async editUsername() {
const alert = await this.alertController.create({
header: this.translocoService.translate('editUsername'),
Expand Down
26 changes: 20 additions & 6 deletions src/app/shared/dia-backend/wallet/dia-backend-wallet.service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { defer, forkJoin } from 'rxjs';
import { concatMap } from 'rxjs/operators';
import { BehaviorSubject, defer, forkJoin } from 'rxjs';
import { concatMap, tap } from 'rxjs/operators';
import { NetworkService } from '../../network/network.service';
import { PreferenceManager } from '../../preference-manager/preference-manager.service';
import { DiaBackendAuthService } from '../auth/dia-backend-auth.service';
Expand All @@ -21,9 +21,14 @@ export class DiaBackendWalletService {
readonly bscNumBalance$ = this.preferences.getNumber$(
PrefKeys.BSC_NUM_BALANCE
);
readonly numWalletAddr$ = this.preferences.getString$(
PrefKeys.NUM_WALLET_ADDR
);

readonly networkConnected$ = this.networkService.connected$;

readonly isLoadingBalance$ = new BehaviorSubject<boolean>(false);

constructor(
private readonly httpClient: HttpClient,
private readonly authService: DiaBackendAuthService,
Expand Down Expand Up @@ -56,19 +61,20 @@ export class DiaBackendWalletService {
);
}

getManagedWallet$() {
getNumWallet$() {
return defer(() => this.authService.getAuthHeaders()).pipe(
concatMap(headers => {
return this.httpClient.get<DiaBackendWallet>(
`${BASE_URL}/api/v3/wallets/managed-wallet/`,
`${BASE_URL}/api/v3/wallets/num-wallet/`,
{ headers }
);
})
);
}

syncCaptBalance$() {
return this.getAssetWallet$().pipe(
this.isLoadingBalance$.next(true);
return this.getNumWallet$().pipe(
concatMap(diaBackendWallet =>
forkJoin([
this.preferences.setNumber(
Expand All @@ -79,8 +85,15 @@ export class DiaBackendWalletService {
PrefKeys.BSC_NUM_BALANCE,
diaBackendWallet.num_balance.bsc_num
),
this.preferences.setString(
PrefKeys.NUM_WALLET_ADDR,
diaBackendWallet.address
),
])
)
),
tap(() => {
this.isLoadingBalance$.next(false);
})
);
}
}
Expand All @@ -102,4 +115,5 @@ export interface DiaBackendWallet {
const enum PrefKeys {
ETH_NUM_BALANCE = 'ETH_NUM_BALANCE',
BSC_NUM_BALANCE = 'BSC_NUM_BALANCE',
NUM_WALLET_ADDR = 'NUM_WALLET_ADDR',
}
1 change: 1 addition & 0 deletions src/assets/i18n/en-us.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"ignore": "Ignore",
"accept": "Accept",
"transaction": "Activity",
"numTransactionHistory": "View transaction history",
"transactionDetails": "Activity Details",
"sentFrom": "Sent from",
"receiver": "Receiver",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"ignore": "忽略",
"accept": "接收",
"transaction": "活動紀錄",
"numTransactionHistory": "查詢交易紀錄",
"transactionDetails": "活動資訊",
"sentFrom": "發送自",
"receiver": "收件人",
Expand Down

0 comments on commit 12382c5

Please sign in to comment.