Skip to content

Commit

Permalink
Merge branch 'release-0.69.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
bafu committed Nov 17, 2022
2 parents 653c62b + e5ea636 commit 5c878b2
Show file tree
Hide file tree
Showing 19 changed files with 256 additions and 30 deletions.
14 changes: 13 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.69.2] - 2022-11-17

### Changed

1. User can update asset info by clicking the `Edit` option (#2310)

### Fixed

1. Fix Android go back button navigation (#2298)
2. Disable the `Mint & Share` option temporarily (#2311)

## [0.69.1] - 2022-11-08

### Fixed
Expand Down Expand Up @@ -1901,7 +1912,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.69.1...HEAD
[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.69.2...HEAD
[0.69.2]: https://github.com/numbersprotocol/capture-lite/compare/0.69.1...0.69.2
[0.69.1]: https://github.com/numbersprotocol/capture-lite/compare/0.69.0...0.69.1
[0.69.0]: https://github.com/numbersprotocol/capture-lite/compare/0.68.0...0.69.0
[0.68.0]: https://github.com/numbersprotocol/capture-lite/compare/0.67.1...0.68.0
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 451
versionName "0.69.1"
versionCode 452
versionName "0.69.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
Expand Down
4 changes: 2 additions & 2 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.69.1;
MARKETING_VERSION = 0.69.2;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -397,7 +397,7 @@
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.7;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.69.1;
MARKETING_VERSION = 0.69.2;
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = NumbersAppDistributionV4;
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.69.1",
"version": "0.69.2",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down
7 changes: 7 additions & 0 deletions src/app/features/home/details/details-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ const routes: Routes = [
loadChildren: () =>
import('./actions/actions.module').then(m => m.ActionsPageModule),
},
{
path: 'edit-caption',
loadChildren: () =>
import('./edit-caption/edit-caption.module').then(
m => m.EditCaptionPageModule
),
},
];

@NgModule({
Expand Down
31 changes: 19 additions & 12 deletions src/app/features/home/details/details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { BUBBLE_IFRAME_URL } from '../../../shared/dia-backend/secret';
import { DiaBackendStoreService } from '../../../shared/dia-backend/store/dia-backend-store.service';
import { DiaBackendWorkflowService } from '../../../shared/dia-backend/workflow/dia-backend-workflow.service';
import { ErrorService } from '../../../shared/error/error.service';
import { IframeService } from '../../../shared/iframe/iframe.service';
import { MediaStore } from '../../../shared/media/media-store/media-store.service';
import { NetworkService } from '../../../shared/network/network.service';
import { ProofRepository } from '../../../shared/repositories/proof/proof-repository.service';
Expand Down Expand Up @@ -218,9 +219,10 @@ export class DetailsPage {
readonly iframeUrlWithJWTToken$ = combineLatest([
this.activeDetailedCapture$,
this.diaBackendAuthService.cachedQueryJWTToken$,
this.iframeService.detailsPageIframeReloadRequested$,
]).pipe(
distinctUntilChanged(),
map(([detailedCapture, token]) => {
map(([detailedCapture, token, _]) => {
const params =
`nid=${detailedCapture.id}` +
`&token=${token.access}` +
Expand Down Expand Up @@ -258,7 +260,8 @@ export class DetailsPage {
private readonly userGuideService: UserGuideService,
private readonly actionsService: ActionsService,
private readonly networkService: NetworkService,
private readonly diaBackendStoreService: DiaBackendStoreService
private readonly diaBackendStoreService: DiaBackendStoreService,
private readonly iframeService: IframeService
) {
this.initializeActiveDetailedCapture$
.pipe(untilDestroyed(this))
Expand Down Expand Up @@ -435,13 +438,14 @@ export class DetailsPage {
},
});

buttons.push({
text: this.translocoService.translate('details.actions.mintAndShare'),
handler: () => {
this.handleMintAndShareAction();
resolve();
},
});
// Temporarely remove Mint & Share button
// buttons.push({
// text: this.translocoService.translate('details.actions.mintAndShare'),
// handler: () => {
// this.handleMintAndShareAction();
// resolve();
// },
// });

buttons.push({
text: this.translocoService.translate('details.actions.unpublish'),
Expand Down Expand Up @@ -475,18 +479,21 @@ export class DetailsPage {
}

private handleEditAction() {
this.networkConnected$
combineLatest([this.networkConnected$, this.activeDetailedCapture$])
.pipe(
first(),
concatMap(networkConnected => {
switchTap(([networkConnected, detailedCapture]) => {
if (!networkConnected) {
return this.errorService.toastError$(
this.translocoService.translate(
'details.noNetworkConnectionCannotPerformAction'
)
);
}
return this.editCaption();
return this.router.navigate(
['edit-caption', { id: detailedCapture.id }],
{ relativeTo: this.route }
);
})
)
.subscribe();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';

import { EditCaptionPage } from './edit-caption.page';

const routes: Routes = [
{
path: '',
component: EditCaptionPage,
},
];

@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule],
})
export class EditCaptionPageRoutingModule {}
12 changes: 12 additions & 0 deletions src/app/features/home/details/edit-caption/edit-caption.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { NgModule } from '@angular/core';

import { EditCaptionPageRoutingModule } from './edit-caption-routing.module';

import { SharedModule } from '../../../../shared/shared.module';
import { EditCaptionPage } from './edit-caption.page';

@NgModule({
imports: [SharedModule, EditCaptionPageRoutingModule],
declarations: [EditCaptionPage],
})
export class EditCaptionPageModule {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<ion-content>
<div *ngIf="iframeUrl$ | ngrxPush as iframeUrl">
<iframe [src]="iframeUrl" frameborder="0"></iframe>
</div>
</ion-content>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
iframe {
height: 100vh;
width: 100vw;
background-color: black;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { ComponentFixture, TestBed, waitForAsync } from '@angular/core/testing';
import { SharedTestingModule } from '../../../../shared/shared-testing.module';

import { EditCaptionPage } from './edit-caption.page';

describe('EditCaptionPage', () => {
let component: EditCaptionPage;
let fixture: ComponentFixture<EditCaptionPage>;

beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [EditCaptionPage],
imports: [SharedTestingModule],
}).compileComponents();

fixture = TestBed.createComponent(EditCaptionPage);
component = fixture.componentInstance;
fixture.detectChanges();
})
);

it('should create', () => {
expect(component).toBeTruthy();
});
});
69 changes: 69 additions & 0 deletions src/app/features/home/details/edit-caption/edit-caption.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { Component } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
import { ActivatedRoute } from '@angular/router';
import { NavController } from '@ionic/angular';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { combineLatest, fromEvent } from 'rxjs';
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';
import { isNonNullable } from '../../../../utils/rx-operators/rx-operators';

@UntilDestroy()
@Component({
selector: 'app-edit-caption',
templateUrl: './edit-caption.page.html',
styleUrls: ['./edit-caption.page.scss'],
})
export class EditCaptionPage {
private readonly id$ = this.route.paramMap.pipe(
map(params => params.get('id')),
isNonNullable()
);

iframeUrl$ = combineLatest([
this.id$,
this.diaBackendAuthService.cachedQueryJWTToken$,
]).pipe(
map(([id, token]) => {
const params =
`nid=${id}` +
`&token=${token.access}` +
`&refresh_token=${token.refresh}` +
`&from=mycapture`;
const url = `${BUBBLE_IFRAME_URL}/edit?${params}`;
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
})
);

constructor(
private readonly route: ActivatedRoute,
private readonly sanitizer: DomSanitizer,
private readonly navController: NavController,
private readonly iframeService: IframeService,
private readonly diaBackendAuthService: DiaBackendAuthService
) {
this.processIframeEvents();
}

processIframeEvents() {
fromEvent(window, 'message')
.pipe(
tap(event => {
const postMessageEvent = event as MessageEvent;

if (postMessageEvent.data === 'edit-caption-cancel') {
this.navController.back();
}

if (postMessageEvent.data === 'edit-caption-save') {
this.iframeService.refreshDetailsPageIframe();
this.navController.back();
}
}),
untilDestroyed(this)
)
.subscribe();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"
>
<iframe
#exploreIframe
[src]="bubbleIframeUrlWithCachedJWTToken"
class="bubble-iframe"
></iframe>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import { Component } from '@angular/core';
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 } 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';
import { NetworkService } from '../../../../shared/network/network.service';

@UntilDestroy()
@Component({
selector: 'app-explore-tab',
templateUrl: './explore-tab.component.html',
Expand All @@ -25,10 +27,26 @@ export class ExploreTabComponent {

readonly networkConnected$ = this.networkService.connected$;

@ViewChild('exploreIframe') exploreIframe?: ElementRef<HTMLIFrameElement>;

constructor(
private readonly networkService: NetworkService,
private readonly diaBackendAuthService: DiaBackendAuthService,
private readonly iframeService: IframeService,
private readonly sanitizer: DomSanitizer
) {}
) {
iframeService.exploreTabIframeNavigateBack$
.pipe(
tap(_ => this.navigateBackExploreIframe()),
untilDestroyed(this)
)
.subscribe();
}

navigateBackExploreIframe() {
this.exploreIframe?.nativeElement.contentWindow?.postMessage(
'android-back-button',
BUBBLE_IFRAME_URL
);
}
}
Loading

0 comments on commit 5c878b2

Please sign in to comment.