Skip to content

Commit 409b472

Browse files
authored
Merge pull request #1518 from numbersprotocol/develop
Bump version to 0.54.1
2 parents 31edb5e + 169f384 commit 409b472

File tree

9 files changed

+32
-33
lines changed

9 files changed

+32
-33
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## 0.54.1 - 2022-04-07
9+
10+
### Removed
11+
12+
- Revert Download asset using CDN instead of [DIA backend `/download/` endpoint](https://dia-backend.numbersprotocol.io/api/v3/redoc/#operation/assets_download) #1362
13+
814
## 0.54.0 - 2022-04-07
915

1016
### Added
@@ -18,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1824

1925
- Remove the Capture after Gift a Capture or Web 3 archive network action #1129
2026
- Fix wallets and NUM transfer page UI for screen width < 360px
27+
- Fix refresh not working when there's no Capture
2128

2229
## 0.53.0 - 2022-03-31
2330

@@ -28,6 +35,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2835
- Warn user that the asset will become public when sharing asset profile.
2936
- Support network action that doesn't take in any parameter.
3037
- Support optional network action parameters.
38+
- Go pro/multi select file upload.
3139

3240
## 0.52.1 - 2022-03-25
3341

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "io.numbersprotocol.capturelite"
77
minSdkVersion rootProject.ext.minSdkVersion
88
targetSdkVersion rootProject.ext.targetSdkVersion
9-
versionCode 370
10-
versionName "0.54.0"
9+
versionCode 371
10+
versionName "0.54.1"
1111
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1212
}
1313
buildTypes {

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "capture-lite",
3-
"version": "0.54.0",
3+
"version": "0.54.1",
44
"author": "numbersprotocol",
55
"homepage": "https://numbersprotocol.io/",
66
"scripts": {

src/app/features/home/capture-tab/capture-tab.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class CaptureTabComponent {
9999

100100
refreshCaptures(event: Event) {
101101
this.diaBackendAssetRefreshingService
102-
.refresh$()
102+
.refresh()
103103
.pipe(finalize(() => (<CustomEvent>event).detail.complete()))
104104
.subscribe();
105105
}

src/app/features/home/details/information/session/information-session.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export class DetailedCapture {
5252
const [index, meta] = Object.entries(proof.indexedAssets)[0];
5353
if (!(await this.mediaStore.exists(index)) && proof.diaBackendAssetId) {
5454
const mediaBlob = await this.diaBackendAssetRepository
55-
.downloadAssetFileFromCDN$(proof.diaBackendAssetId)
55+
.downloadFile$({ id: proof.diaBackendAssetId, field: 'asset_file' })
5656
.pipe(
5757
first(),
5858
catchError((err: unknown) => this.errorService.toastError$(err))
@@ -63,6 +63,7 @@ export class DetailedCapture {
6363
return proof.getFirstAssetUrl();
6464
});
6565
}
66+
6667
return this.diaBackendAsset$.pipe(
6768
isNonNullable(),
6869
switchMap(asset =>

src/app/shared/dia-backend/asset/dia-backend-asset-repository.service.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ export class DiaBackendAssetRepository {
134134
iif(
135135
() => !!image,
136136
of(image).pipe(isNonNullable()),
137-
this.downloadAssetFileFromCDN$(postCapture.id).pipe(
137+
this.downloadFile$({ id: postCapture.id, field: 'asset_file' }).pipe(
138138
first(),
139139
tap(blob => {
140140
// eslint-disable-next-line rxjs/no-subject-value
@@ -200,18 +200,16 @@ export class DiaBackendAssetRepository {
200200
);
201201
}
202202

203-
downloadAssetFileFromCDN$(cid: string) {
203+
downloadFile$({ id, field }: { id: string; field: AssetDownloadField }) {
204+
const formData = new FormData();
205+
formData.append('field', field);
204206
return defer(() => this.authService.getAuthHeaders()).pipe(
205207
concatMap(headers =>
206-
this.httpClient.get<DiaBackendAsset>(
207-
`${BASE_URL}/api/v3/assets/${cid}`,
208-
{ headers }
208+
this.httpClient.post(
209+
`${BASE_URL}/api/v3/assets/${id}/download/`,
210+
formData,
211+
{ headers, responseType: 'blob' }
209212
)
210-
),
211-
concatMap(diaBackendAsset =>
212-
this.httpClient.get(`${diaBackendAsset.asset_file}`, {
213-
responseType: 'blob',
214-
})
215213
)
216214
);
217215
}

src/app/shared/dia-backend/asset/downloading/dia-backend-downloading.service.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
import { HttpClient, HttpErrorResponse } from '@angular/common/http';
1+
import { HttpErrorResponse } from '@angular/common/http';
22
import { Injectable } from '@angular/core';
3+
import { first } from 'rxjs/operators';
34
import { blobToBase64 } from '../../../../utils/encoding/encoding';
45
import { OnConflictStrategy } from '../../../database/table/table';
56
import { HttpErrorCode } from '../../../error/error.service';
@@ -22,8 +23,7 @@ export class DiaBackendAssetDownloadingService {
2223
constructor(
2324
private readonly assetRepository: DiaBackendAssetRepository,
2425
private readonly mediaStore: MediaStore,
25-
private readonly proofRepository: ProofRepository,
26-
private readonly httpClient: HttpClient
26+
private readonly proofRepository: ProofRepository
2727
) {}
2828

2929
async storeRemoteCapture(
@@ -48,11 +48,9 @@ export class DiaBackendAssetDownloadingService {
4848
if (!diaBackendAsset.information.proof) {
4949
return;
5050
}
51-
// This function is only called by storeRemoteCapture, which should always
52-
// get diaBackendAsset from backend. That should mean we're always using
53-
// up-to-date asset_file_thumbnail cdn link.
54-
const thumbnailBlob = await this.httpClient
55-
.get(diaBackendAsset.asset_file_thumbnail, { responseType: 'blob' })
51+
const thumbnailBlob = await this.assetRepository
52+
.downloadFile$({ id: diaBackendAsset.id, field: 'asset_file_thumbnail' })
53+
.pipe(first())
5654
.toPromise();
5755
return this.mediaStore.storeThumbnail(
5856
diaBackendAsset.proof_hash,

src/app/shared/dia-backend/asset/refreshing/dia-backend-asset-refreshing.service.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,13 @@ export class DiaBackendAsseRefreshingService {
2727
.subscribe(value => (this.pendingUploadTasks = value));
2828
}
2929

30-
refresh$() {
30+
refresh() {
3131
// Don't refresh if there are still captures being uploaded.
3232
if (this.pendingUploadTasks > 0) {
3333
return EMPTY;
3434
}
35-
3635
return this.proofRepository.all$.pipe(
3736
first(),
38-
// Remove deleted Captures or Captures that no longer belong to the user.
3937
concatMap(proofs => {
4038
if (proofs.length === 0) return of([]);
4139
return forkJoin(
@@ -54,11 +52,7 @@ export class DiaBackendAsseRefreshingService {
5452
)
5553
);
5654
}),
57-
concatMap(async () => {
58-
// TO DO: pass in diaBackendAssets and skip those when prefetching.
59-
await this.diaBackendAssetPrefetchingService.prefetch();
60-
return EMPTY;
61-
})
55+
concatMap(() => this.diaBackendAssetPrefetchingService.prefetch())
6256
);
6357
}
6458
}

0 commit comments

Comments
 (0)