Skip to content

Commit

Permalink
Merge pull request #1638 from numbersprotocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
shc261392 authored May 24, 2022
2 parents fc45f5c + ed0f119 commit 3979f85
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 34 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ 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.57.2 - 2022-05-24

### Fixed

- Show old user guide for iOS
- Show new user guide for Android, Web

## 0.57.1 - 2022-05-19

### 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 394
versionName "0.57.1"
versionCode 395
versionName "0.57.2"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
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.57.1",
"version": "0.57.2",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down
23 changes: 18 additions & 5 deletions src/app/features/home/details/details.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
switchTap,
VOID$,
} from '../../../utils/rx-operators/rx-operators';
import { getAssetProfileUrl } from '../../../utils/url';
import { getAssetProfileUrlWithTmpToken } from '../../../utils/url';
import {
DetailedCapture,
InformationSessionService,
Expand Down Expand Up @@ -177,6 +177,15 @@ export class DetailsPage {
)
);

readonly activeDetailedCaptureTmpShareToken$ =
this._activeDetailedCapture$.pipe(
distinctUntilChanged(),
concatMap(({ id }) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return this.diaBackendAssetRepository.createTemporaryShareToken$(id!);
})
);

readonly isFromSeriesPage$ = this.type$.pipe(map(type => type === 'series'));

constructor(
Expand Down Expand Up @@ -208,6 +217,7 @@ export class DetailsPage {
async ionViewDidEnter() {
await this.userGuideService.showUserGuidesOnDetailsPage();
await this.userGuideService.setHasOpenedDetailsPage(true);
await this.userGuideService.setHasClickedDetailsPageOptionsMenu(true);
}

// eslint-disable-next-line class-methods-use-this
Expand Down Expand Up @@ -467,15 +477,18 @@ export class DetailsPage {
openCertificate() {
combineLatest([
this.activeDetailedCapture$,
this.diaBackendAuthService.token$,
this.activeDetailedCaptureTmpShareToken$,
])
.pipe(
first(),
concatMap(([detailedCapture, token]) =>
concatMap(([detailedCapture, tmpShareToken]) =>
defer(() =>
Browser.open({
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
url: getAssetProfileUrl(detailedCapture.id!, token),
url: getAssetProfileUrlWithTmpToken(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
detailedCapture.id!,
tmpShareToken
),
toolbarColor: '#564dfc',
})
)
Expand Down
18 changes: 16 additions & 2 deletions src/app/features/home/home.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ import { ChangeDetectorRef, Component } from '@angular/core';
import { MatDialog } from '@angular/material/dialog';
import { ActivatedRoute, Router } from '@angular/router';
import { Browser } from '@capacitor/browser';
import { ActionSheetController, AlertController } from '@ionic/angular';
import {
ActionSheetController,
AlertController,
Platform,
} from '@ionic/angular';
import { TranslocoService } from '@ngneat/transloco';
import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy';
import { combineLatest, defer, EMPTY, iif, of } from 'rxjs';
Expand Down Expand Up @@ -71,7 +75,8 @@ export class HomePage {
private readonly alertController: AlertController,
private readonly goProBluetoothService: GoProBluetoothService,
private readonly diaBackendWalletService: DiaBackendWalletService,
private readonly userGuideService: UserGuideService
private readonly userGuideService: UserGuideService,
private readonly platform: Platform
) {
this.downloadExpiredPostCaptures();
}
Expand All @@ -92,6 +97,15 @@ export class HomePage {
}

private async onboardingRedirect() {
if (
this.platform.is('ios') &&
(await this.onboardingService.hasShownTutorialVersion()) === ''
) {
return this.router.navigate(['tutorial'], {
relativeTo: this.route,
});
}

this.onboardingService.isNewLogin = false;

if (!(await this.onboardingService.hasCreatedOrImportedIntegrityWallet())) {
Expand Down
24 changes: 24 additions & 0 deletions src/app/features/settings/user-guide/user-guide.page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

<ion-content>
<ion-list>
<ion-item>
<ion-label text-wrap>Has Highlighted Camera Tab</ion-label>
<ion-checkbox
slot="end"
[checked]="hasHighlightedCameraTab$ | ngrxPush"
(ionChange)="setHasHighlightedCameraTab($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Opened Camera Page</ion-label>
<ion-checkbox
Expand Down Expand Up @@ -47,6 +55,14 @@
(ionChange)="setHasClickedDetailsPageOptionsMenu($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Highligted Activity Button</ion-label>
<ion-checkbox
slot="end"
[checked]="hasHighligtedActivityButton$ | ngrxPush"
(ionChange)="setHasHighligtedActivityButton($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Opened Activities Page</ion-label>
<ion-checkbox
Expand All @@ -55,6 +71,14 @@
(ionChange)="setHasOpenedActivitiesPage($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Hightlighted Inbox Tab</ion-label>
<ion-checkbox
slot="end"
[checked]="hasHightlightedInboxTab$ | ngrxPush"
(ionChange)="setHasHightlightedInboxTab($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Opened Inbox Tab</ion-label>
<ion-checkbox
Expand Down
24 changes: 24 additions & 0 deletions src/app/features/settings/user-guide/user-guide.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { UserGuideService } from '../../../shared/user-guide/user-guide.service'
styleUrls: ['./user-guide.page.scss'],
})
export class UserGuidePage {
readonly hasHighlightedCameraTab$ =
this.userGuideService.hasHighlightedCameraTab$();

readonly hasOpenedCustomCameraPage$ =
this.userGuideService.hasOpenedCustomCameraPage$();

Expand All @@ -22,13 +25,23 @@ export class UserGuidePage {
readonly hasClickedDetailsPageOptionsMenu$ =
this.userGuideService.hasClickedDetailsPageOptionsMenu$();

readonly hasHighligtedActivityButton$ =
this.userGuideService.hasHighligtedActivityButton$();

readonly hasOpenedActivitiesPage$ =
this.userGuideService.hasOpenedActivitiesPage$();

readonly hasHightlightedInboxTab$ =
this.userGuideService.hasHightlightedInboxTab$();

readonly hasOpenedInboxTab$ = this.userGuideService.hasOpenedInboxTab$();

constructor(private readonly userGuideService: UserGuideService) {}

setHasHighlightedCameraTab(event: any) {
this.userGuideService.setHasHighlightedCameraTab(event.detail.checked);
}

setHasOpenedCustomCameraPage(event: any) {
this.userGuideService.setHasOpenedCustomCameraPage(event.detail.checked);
}
Expand All @@ -55,22 +68,33 @@ export class UserGuidePage {
);
}

setHasHighligtedActivityButton(event: any) {
this.userGuideService.setHasHighligtedActivityButton(event.detail.checked);
}

setHasOpenedActivitiesPage(event: any) {
this.userGuideService.setHasOpenedActivitiesPage(event.detail.checked);
}

setHasHightlightedInboxTab(event: any) {
this.userGuideService.setHasHightlightedInboxTab(event.detail.checked);
}

setHasOpenedInboxTab(event: any) {
this.userGuideService.setHasOpenedInboxTab(event.detail.checked);
}

resetAll() {
this.userGuideService.setHasHighlightedCameraTab(false);
this.userGuideService.setHasOpenedCustomCameraPage(false);
this.userGuideService.setHasOpenedCustomCameraPage(false);
this.userGuideService.setHasCapturedPhotoWithCustomCamera(false);
this.userGuideService.setHasCapturedVideoWithCustomCamera(false);
this.userGuideService.setHasOpenedDetailsPage(false);
this.userGuideService.setHasClickedDetailsPageOptionsMenu(false);
this.userGuideService.setHasHighligtedActivityButton(false);
this.userGuideService.setHasOpenedActivitiesPage(false);
this.userGuideService.setHasHightlightedInboxTab(false);
this.userGuideService.setHasOpenedInboxTab(false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,22 @@ export class DiaBackendAssetRepository {
);
}

createTemporaryShareToken$(id: string) {
const formData = new FormData();
const secondsInDay = 86400;
formData.append('expiration_seconds', `${secondsInDay}`);
return defer(() => this.authService.getAuthHeaders()).pipe(
concatMap(headers =>
this.httpClient.post<CreateTmpShareTokenResponse>(
`${BASE_URL}/api/v3/assets/${id}/private-share/`,
formData,
{ headers }
)
),
map(response => response.tmp_token)
);
}

removeCaptureById$(id: string) {
return defer(() => this.authService.getAuthHeaders()).pipe(
concatMap(headers =>
Expand Down Expand Up @@ -349,6 +365,14 @@ export type AssetDownloadField =
type CreateAssetResponse = DiaBackendAsset;
type UpdateAssetResponse = DiaBackendAsset;

export interface CreateTmpShareTokenResponse extends Tuple {
tmp_token: string;
url: string;
expiration_seconds: number;
created_at: string;
expired_at: string;
}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
interface DeleteAssetResponse {}

Expand Down
Loading

0 comments on commit 3979f85

Please sign in to comment.