Skip to content

Commit

Permalink
Merge pull request #1511 from numbersprotocol/develop
Browse files Browse the repository at this point in the history
Bump version to 0.54.0
  • Loading branch information
shc261392 committed Apr 7, 2022
2 parents ed0ded2 + 8ccfa83 commit 31edb5e
Show file tree
Hide file tree
Showing 19 changed files with 198 additions and 54 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,20 @@ 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.54.0 - 2022-04-07

### Added

- Add buy NUM button at wallets page
- Support redirecting to external website after successfully submitting a network action order
- Skip storing asset thumbnail for cached assets
- Download asset using CDN instead of [DIA backend `/download/` endpoint](https://dia-backend.numbersprotocol.io/api/v3/redoc/#operation/assets_download) #1362

### Fixed

- Remove the Capture after Gift a Capture or Web 3 archive network action #1129
- Fix wallets and NUM transfer page UI for screen width < 360px

## 0.53.0 - 2022-03-31

### Added
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,3 +140,11 @@ When push to the `master` branch with new version in the `package.json` file, Gi
1. Publish the app to Play Console on alpha track.
1. Upload debug apk to Google Drive.
1. Send notification to the private `reminder-releases` slack channel.

If error occur in `deploy-app-store` GitHub Action, most likely it's due to some weird error with GitHub MacOS runner or iOS server. Re-run the failed job should fix that. However, you might run into

```
Error: Validation Failed: {"resource":"Release","code":"already_exists","field":"tag_name"}
```

In this case, you could delete the releae tag by doing `git push --delete origin tagname`. E.g. `git push --delete origin 0.53.0`.
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 360
versionName "0.53.0"
versionCode 370
versionName "0.54.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.53.0",
"version": "0.54.0",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/app/features/home/capture-tab/capture-tab.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export class CaptureTabComponent {

refreshCaptures(event: Event) {
this.diaBackendAssetRefreshingService
.refresh()
.refresh$()
.pipe(finalize(() => (<CustomEvent>event).detail.complete()))
.subscribe();
}
Expand Down
60 changes: 54 additions & 6 deletions src/app/features/home/details/actions/actions.page.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { MatSnackBar } from '@angular/material/snack-bar';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { Browser } from '@capacitor/browser';
import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { combineLatest, forkJoin, iif, of } from 'rxjs';
Expand All @@ -22,10 +23,12 @@ import {
import { DiaBackendWalletService } from '../../../../shared/dia-backend/wallet/dia-backend-wallet.service';
import { ErrorService } from '../../../../shared/error/error.service';
import { OrderDetailDialogComponent } from '../../../../shared/order-detail-dialog/order-detail-dialog.component';
import { ProofRepository } from '../../../../shared/repositories/proof/proof-repository.service';
import {
isNonNullable,
VOID$,
} from '../../../../utils/rx-operators/rx-operators';
import { InformationSessionService } from '../information/session/information-session.service';

@UntilDestroy()
@Component({
Expand All @@ -44,6 +47,7 @@ export class ActionsPage {
);

constructor(
private readonly router: Router,
private readonly actionsService: ActionsService,
private readonly errorService: ErrorService,
private readonly translocoService: TranslocoService,
Expand All @@ -56,7 +60,9 @@ export class ActionsPage {
private readonly orderHistoryService: OrderHistoryService,
private readonly diaBackendStoreService: DiaBackendStoreService,
private readonly diaBackendSeriesRepository: DiaBackendSeriesRepository,
private readonly diaBackendWalletService: DiaBackendWalletService
private readonly diaBackendWalletService: DiaBackendWalletService,
private readonly informationSessionService: InformationSessionService,
private readonly proofRepository: ProofRepository
) {}

canPerformAction$(action: Action) {
Expand Down Expand Up @@ -196,17 +202,47 @@ export class ActionsPage {
);
}

redirectToExternalUrl(url: string, orderId: string) {
this.id$
.pipe(
first(),
isNonNullable(),
tap(cid =>
Browser.open({
url: `${url}?cid=${cid}&order_id=${orderId}`,
toolbarColor: '#564dfc',
})
),
catchError((err: unknown) => {
return this.errorService.toastError$(err);
}),
untilDestroyed(this)
)
.subscribe();
}

removeCapture() {
if (this.informationSessionService.activatedDetailedCapture) {
this.informationSessionService.activatedDetailedCapture.proof$.subscribe(
proof => {
if (proof) {
this.proofRepository.remove(proof);
this.router.navigate(['/home']);
}
}
);
}
}

doAction(action: Action) {
this.blockingActionService
.run$(this.canPerformAction$(action))
.pipe(
catchError((err: unknown) => {
return this.errorService.toastError$(err);
}),
concatMap(() =>
combineLatest([this.openActionDialog$(action), of(action)])
),
concatMap(([createOrderInput, action]) =>
concatMap(() => this.openActionDialog$(action)),
concatMap(createOrderInput =>
this.blockingActionService.run$(
forkJoin([
this.createOrder$(
Expand Down Expand Up @@ -245,6 +281,18 @@ export class ActionsPage {
this.translocoService.translate('message.sentSuccessfully')
);
}),
tap(networkAppOrder => {
if (action.ext_action_destination_text) {
this.redirectToExternalUrl(
action.ext_action_destination_text,
networkAppOrder.id
);
}
}),
tap(() => {
if (action.hide_capture_after_execution_boolean ?? false)
this.removeCapture();
}),
untilDestroyed(this)
)
.subscribe();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class DetailedCapture {
const [index, meta] = Object.entries(proof.indexedAssets)[0];
if (!(await this.mediaStore.exists(index)) && proof.diaBackendAssetId) {
const mediaBlob = await this.diaBackendAssetRepository
.downloadFile$({ id: proof.diaBackendAssetId, field: 'asset_file' })
.downloadAssetFileFromCDN$(proof.diaBackendAssetId)
.pipe(
first(),
catchError((err: unknown) => this.errorService.toastError$(err))
Expand All @@ -63,7 +63,6 @@ export class DetailedCapture {
return proof.getFirstAssetUrl();
});
}

return this.diaBackendAsset$.pipe(
isNonNullable(),
switchMap(asset =>
Expand Down
4 changes: 2 additions & 2 deletions src/app/features/wallets/transfer/transfer.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,11 @@ <h5>
<ion-icon name="wallet"></ion-icon>
</ion-col>
<ion-col size="5" *ngrxLet="gasFee$ as gasFee">
<h6>
<h6 class="gas-fee-text">
{{ t('wallets.gasFee') }}:
{{ gasFee > 0 ? (gasFee | number: '1.2-2') : t('wallets.pending') }}
</h6>
<h4>
<h4 class="wallet-total-text">
{{ t('wallets.total') }} {{ totalCost$ | ngrxPush | currency }}
</h4>
</ion-col>
Expand Down
26 changes: 26 additions & 0 deletions src/app/features/wallets/transfer/transfer.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,24 @@ ion-card {
margin-bottom: 0;
}

h6.gas-fee-text {
@media (max-width: 360px) {
font-size: 14px;
}
}

h4 {
margin-top: 2%;
font-weight: bold;
letter-spacing: 0.02em;
}

h4.wallet-total-text {
@media (max-width: 360px) {
font-size: 14px;
}
}

#deposit-withdraw-btn-col {
padding-left: 0;
padding-right: 0;
Expand All @@ -53,6 +65,10 @@ ion-card {
width: 80%;

--border-radius: 10px;

@media (max-width: 360px) {
font-size: 12px;
}
}
}

Expand All @@ -73,6 +89,16 @@ ion-card {
margin-top: 0;
font-weight: bold;
letter-spacing: 0.02em;

@media (max-width: 360px) {
font-size: 16px;
}
}

h1 {
@media (max-width: 360px) {
font-size: 20px;
}
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/app/features/wallets/wallets.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@
<ion-row>
<ion-col size="8">
<ion-text class="text-black">
<h1>{{ totalBalance$ | ngrxPush | currency }} NUM</h1>
<h1 class="balance-text">
{{ totalBalance$ | ngrxPush | currency }} NUM
</h1>
</ion-text>
</ion-col>
<ion-col offset="0.3">
<ion-row id="num-icon-row">
<ion-img src="../../../assets/images/num-icon.svg"></ion-img>
<ion-text class="text-black">
<h3>NUM</h3>
<h3 class="num-text">NUM</h3>
</ion-text>
</ion-row>
</ion-col>
Expand All @@ -48,7 +50,7 @@ <h3>NUM</h3>
</ion-row>
<ion-row id="buy-deposit-withdraw-row">
<ion-button
hidden
(click)="onBuyNumBtnClicked()"
id="buy-num-btn"
size="small"
class="num-operation-btn"
Expand Down
16 changes: 15 additions & 1 deletion src/app/features/wallets/wallets.page.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,32 @@ ion-card {
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 {
h3.num-text {
flex: none;
order: 1;
flex-grow: 0;
margin-top: 21px;
margin-left: 7px;

@media (max-width: 360px) {
font-size: 20px;
}
}
}

Expand Down
10 changes: 9 additions & 1 deletion src/app/features/wallets/wallets.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ 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 { Router } from '@angular/router';
import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { BehaviorSubject, combineLatest, forkJoin } from 'rxjs';
Expand Down Expand Up @@ -79,6 +79,14 @@ export class WalletsPage {
.subscribe(totalBalance => this.totalBalance$.next(totalBalance));
}

// eslint-disable-next-line class-methods-use-this
onBuyNumBtnClicked() {
Browser.open({
url: `https://link.numbersprotocol.io/buy-num`,
toolbarColor: '#564dfc',
});
}

openNUMTransactionHistory() {
this.diaBackendWalletService.assetWalletAddr$
.pipe(
Expand Down
2 changes: 2 additions & 0 deletions src/app/shared/actions/service/actions.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ export interface Action {
readonly params_list_custom_param1?: string[];
readonly title_text: string;
readonly network_app_id_text: string;
readonly ext_action_destination_text?: string;
readonly hide_capture_after_execution_boolean?: boolean;
}

export interface Param {
Expand Down

0 comments on commit 31edb5e

Please sign in to comment.