Skip to content

Commit 5576880

Browse files
authored
Merge pull request #3173 from numbersprotocol/v240104-capture-cam-ionic-launch
2 parents 6fb9378 + 5922db2 commit 5576880

File tree

16 files changed

+191
-35
lines changed

16 files changed

+191
-35
lines changed

CHANGELOG.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.88.6] - 2024-01-11
11+
12+
### Added
13+
14+
Feature update the NSE domain (#3161)
15+
Feat confirm dialog on pull to refresh (#3171)
16+
Feat sort assets in VERIFIED tab by uploaded_at (#3158)
17+
18+
### Fixed
19+
20+
Fix excessive api call (#3157)
21+
1022
## [0.87.1] - 2023-12-04
1123

1224
### Fixed
@@ -2226,7 +2238,8 @@ This is the first release! _Capture Lite_ is a cross-platform app adapted from [
22262238
- Web - see the demo [here](https://github.com/numbersprotocol/capture-lite#demo-app)
22272239
- Android - the APK file `app-debug.apk` is attached to this release
22282240

2229-
[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.87.1...HEAD
2241+
[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.88.6...HEAD
2242+
[0.88.6]: https://github.com/numbersprotocol/capture-lite/compare/0.87.1...0.88.6
22302243
[0.87.1]: https://github.com/numbersprotocol/capture-lite/compare/0.87.0...0.87.1
22312244
[0.87.0]: https://github.com/numbersprotocol/capture-lite/compare/0.86.4...0.87.0
22322245
[0.86.4]: https://github.com/numbersprotocol/capture-lite/compare/0.83.2...0.86.4

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
applicationId "io.numbersprotocol.capturelite"
88
minSdkVersion rootProject.ext.minSdkVersion
99
targetSdkVersion rootProject.ext.targetSdkVersion
10-
versionCode 871
11-
versionName "0.87.1"
10+
versionCode 886
11+
versionName "0.88.6"
1212
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
1313
}
1414
buildFeatures {

ios/App/App.xcodeproj/project.pbxproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,13 +368,13 @@
368368
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
369369
CODE_SIGN_IDENTITY = "iPhone Distribution";
370370
CODE_SIGN_STYLE = Manual;
371-
CURRENT_PROJECT_VERSION = 871;
371+
CURRENT_PROJECT_VERSION = 886;
372372
DEVELOPMENT_TEAM = G7NB5YCKAP;
373373
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
374374
INFOPLIST_FILE = App/Info.plist;
375375
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
376376
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
377-
MARKETING_VERSION = 0.87.1;
377+
MARKETING_VERSION = 0.88.6;
378378
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
379379
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
380380
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -395,13 +395,13 @@
395395
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
396396
CODE_SIGN_IDENTITY = "iPhone Distribution";
397397
CODE_SIGN_STYLE = Manual;
398-
CURRENT_PROJECT_VERSION = 871;
398+
CURRENT_PROJECT_VERSION = 886;
399399
DEVELOPMENT_TEAM = G7NB5YCKAP;
400400
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
401401
INFOPLIST_FILE = App/Info.plist;
402402
IPHONEOS_DEPLOYMENT_TARGET = 15.6;
403403
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
404-
MARKETING_VERSION = 0.87.1;
404+
MARKETING_VERSION = 0.88.6;
405405
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
406406
PRODUCT_NAME = "$(TARGET_NAME)";
407407
PROVISIONING_PROFILE_SPECIFIER = NumbersAppDistributionV4;

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.87.1",
3+
"version": "0.88.6",
44
"author": "numbersprotocol",
55
"homepage": "https://numbersprotocol.io/",
66
"scripts": {

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,7 @@ export class CaptureItemComponent {
7171
)
7272
);
7373

74-
readonly hasCaption$ = this.proof$.pipe(
75-
switchMap(proof => this.diaBackendAssetRepository.fetchByProof$(proof)),
76-
map(asset => asset.caption !== '')
77-
);
74+
readonly hasCaption$ = this.proof$.pipe(map(proof => proof.caption !== ''));
7875

7976
readonly isVideo$ = this.proof$.pipe(
8077
concatMap(proof => proof.getFirstAssetMeta()),

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

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { formatDate, KeyValue } from '@angular/common';
22
import { HttpErrorResponse } from '@angular/common/http';
33
import { ChangeDetectorRef, Component, OnInit } from '@angular/core';
4+
import { MatDialog } from '@angular/material/dialog';
45
import { Router } from '@angular/router';
56
import {
67
ActionSheetButton,
@@ -15,7 +16,6 @@ import {
1516
catchError,
1617
concatMap,
1718
concatMapTo,
18-
finalize,
1919
map,
2020
pluck,
2121
shareReplay,
@@ -45,6 +45,7 @@ import { getOldProof } from '../../../shared/repositories/proof/old-proof-adapte
4545
import { Proof } from '../../../shared/repositories/proof/proof';
4646
import { ProofRepository } from '../../../shared/repositories/proof/proof-repository.service';
4747
import { reloadApp } from '../../../utils/miscellaneous';
48+
import { PrefetchingDialogComponent } from '../onboarding/prefetching-dialog/prefetching-dialog.component';
4849

4950
@UntilDestroy({ checkProperties: true })
5051
@Component({
@@ -94,7 +95,9 @@ export class CaptureTabComponent implements OnInit {
9495
);
9596

9697
readonly captures$ = this.proofs$.pipe(
97-
map(proofs => proofs.sort((a, b) => b.timestamp - a.timestamp))
98+
map(proofs =>
99+
proofs.sort((a, b) => b.uploadedAtOrTimestamp - a.uploadedAtOrTimestamp)
100+
)
98101
);
99102

100103
readonly networkConnected$ = this.networkService.connected$;
@@ -158,6 +161,8 @@ export class CaptureTabComponent implements OnInit {
158161
private readonly mediaStore: MediaStore,
159162
private readonly database: Database,
160163
private readonly confirmAlert: ConfirmAlert,
164+
private readonly dialog: MatDialog,
165+
161166
private readonly preferenceManager: PreferenceManager,
162167
private readonly changeDetectorRef: ChangeDetectorRef,
163168
private readonly proofRepository: ProofRepository,
@@ -334,17 +339,29 @@ export class CaptureTabComponent implements OnInit {
334339
return item.id;
335340
}
336341

337-
refreshCaptures(event: Event) {
338-
this.diaBackendAssetRefreshingService
339-
.refresh()
340-
.pipe(
341-
finalize(() => {
342-
this.capturedTabPageIndex$.next(0);
343-
this.collectedTabPageIndex$.next(0);
344-
this.draftTabPageIndex$.next(0);
345-
return (<CustomEvent>event).detail.complete();
346-
})
347-
)
348-
.subscribe();
342+
async refreshCaptures(event: Event) {
343+
(<CustomEvent>event).detail.complete();
344+
345+
const confirmRefresh = await this.showRefreshAlert();
346+
if (confirmRefresh) {
347+
this.capturedTabPageIndex$.next(0);
348+
this.collectedTabPageIndex$.next(0);
349+
this.draftTabPageIndex$.next(0);
350+
351+
return this.dialog.open(PrefetchingDialogComponent, {
352+
disableClose: true,
353+
});
354+
}
355+
}
356+
357+
private async showRefreshAlert() {
358+
return this.confirmAlert.present({
359+
header: this.translocoService.translate('syncAndRestore'),
360+
message: this.translocoService.translate('message.confirmSyncAndRestore'),
361+
confirmButtonText: this.translocoService.translate(
362+
'confirmSyncAndRestore'
363+
),
364+
cancelButtonText: this.translocoService.translate('cancelSyncAndRestore'),
365+
});
349366
}
350367
}

src/app/features/home/details/edit-caption/edit-caption.page.ts

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,22 @@ import { DomSanitizer } from '@angular/platform-browser';
33
import { ActivatedRoute } from '@angular/router';
44
import { NavController } from '@ionic/angular';
55
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
6-
import { combineLatest, fromEvent } from 'rxjs';
7-
import { map, tap } from 'rxjs/operators';
6+
import { combineLatest, fromEvent, of } from 'rxjs';
7+
import {
8+
concatMap,
9+
finalize,
10+
first,
11+
map,
12+
tap as switchTap,
13+
} from 'rxjs/operators';
814
import { DiaBackendAuthService } from '../../../../shared/dia-backend/auth/dia-backend-auth.service';
915
import { BUBBLE_IFRAME_URL } from '../../../../shared/dia-backend/secret';
1016
import { BubbleToIonicPostMessage } from '../../../../shared/iframe/iframe';
1117
import { IframeService } from '../../../../shared/iframe/iframe.service';
18+
import { getOldProof } from '../../../../shared/repositories/proof/old-proof-adapter';
19+
import { ProofRepository } from '../../../../shared/repositories/proof/proof-repository.service';
1220
import { isNonNullable } from '../../../../utils/rx-operators/rx-operators';
21+
import { InformationSessionService } from '../information/session/information-session.service';
1322

1423
@UntilDestroy()
1524
@Component({
@@ -43,15 +52,17 @@ export class EditCaptionPage {
4352
private readonly sanitizer: DomSanitizer,
4453
private readonly navController: NavController,
4554
private readonly iframeService: IframeService,
46-
private readonly diaBackendAuthService: DiaBackendAuthService
55+
private readonly diaBackendAuthService: DiaBackendAuthService,
56+
private readonly informationSessionService: InformationSessionService,
57+
private readonly proofRepository: ProofRepository
4758
) {
4859
this.processIframeEvents();
4960
}
5061

5162
processIframeEvents() {
5263
fromEvent(window, 'message')
5364
.pipe(
54-
tap(event => {
65+
switchTap(event => {
5566
const postMessageEvent = event as MessageEvent;
5667
const data = postMessageEvent.data as BubbleToIonicPostMessage;
5768
switch (data) {
@@ -60,12 +71,36 @@ export class EditCaptionPage {
6071
break;
6172
case BubbleToIonicPostMessage.EDIT_CAPTION_SAVE:
6273
this.iframeService.refreshDetailsPageIframe();
63-
this.navController.back();
74+
this.syncCaptionAndNavigateBack();
6475
break;
6576
}
6677
}),
6778
untilDestroyed(this)
6879
)
6980
.subscribe();
7081
}
82+
83+
syncCaptionAndNavigateBack() {
84+
if (this.informationSessionService.activatedDetailedCapture) {
85+
combineLatest([
86+
this.informationSessionService.activatedDetailedCapture.proof$,
87+
this.informationSessionService.activatedDetailedCapture.caption$,
88+
])
89+
.pipe(
90+
first(),
91+
concatMap(([proof, latestCaptionFromBackend]) => {
92+
if (proof) {
93+
proof.caption = latestCaptionFromBackend;
94+
return this.proofRepository.update(
95+
[proof],
96+
(x, y) => getOldProof(x).hash === getOldProof(y).hash
97+
);
98+
}
99+
return of(null);
100+
}),
101+
finalize(() => this.navController.back())
102+
)
103+
.subscribe();
104+
}
105+
}
71106
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ export interface DiaBackendAsset extends Tuple {
357357
readonly caption: string;
358358
readonly post_creation_workflow_id: string;
359359
readonly mint_workflow_id: string;
360+
readonly uploaded_at: string;
360361
}
361362

362363
export interface OwnerAddresses extends Tuple {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ export class DiaBackendAssetDownloadingService {
8080
},
8181
});
8282
proof.diaBackendAssetId = diaBackendAsset.id;
83+
proof.caption = diaBackendAsset.caption;
84+
proof.uploadedAt = diaBackendAsset.uploaded_at;
8385
if (diaBackendAsset.signed_metadata) proof.setSignatureVersion();
8486
return this.proofRepository.add(proof, OnConflictStrategy.REPLACE);
8587
}

0 commit comments

Comments
 (0)