Skip to content

Commit

Permalink
Merge pull request #1643 from numbersprotocol/fix-android-user-guide-…
Browse files Browse the repository at this point in the history
…highligh-capture-one-time-only

fix(user-guide): highligh first capture once and don't show again
  • Loading branch information
sultanmyrza authored May 27, 2022
2 parents 437b94f + 7f0c533 commit fd79cb2
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
8 changes: 8 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 @@ -39,6 +39,14 @@
(ionChange)="setHasCapturedVideoWithCustomCamera($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Highlighted First Capture</ion-label>
<ion-checkbox
slot="end"
[checked]="hasHighlightedFirstCapture$ | ngrxPush"
(ionChange)="setHasHighlightedFirstCapture($event)"
></ion-checkbox>
</ion-item>
<ion-item>
<ion-label text-wrap>Has Opened Details Page</ion-label>
<ion-checkbox
Expand Down
8 changes: 8 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 @@ -19,6 +19,9 @@ export class UserGuidePage {
readonly hasCapturedVideoWithCustomCamera$ =
this.userGuideService.hasCapturedVideoWithCustomCamera$();

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

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

Expand Down Expand Up @@ -58,6 +61,10 @@ export class UserGuidePage {
);
}

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

setHasOpenedDetailsPage(event: any) {
this.userGuideService.setHasOpenedDetailsPage(event.detail.checked);
}
Expand Down Expand Up @@ -90,6 +97,7 @@ export class UserGuidePage {
this.userGuideService.setHasOpenedCustomCameraPage(false);
this.userGuideService.setHasCapturedPhotoWithCustomCamera(false);
this.userGuideService.setHasCapturedVideoWithCustomCamera(false);
this.userGuideService.setHasHighlightedFirstCapture(false);
this.userGuideService.setHasOpenedDetailsPage(false);
this.userGuideService.setHasClickedDetailsPageOptionsMenu(false);
this.userGuideService.setHasHighligtedActivityButton(false);
Expand Down
25 changes: 24 additions & 1 deletion src/app/shared/user-guide/user-guide.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ export class UserGuideService {
customTexts: this.customTexts,
});
this.setHasHighlightedCameraTab(true);
} else if ((await this.hasOpenedDetailsPage()) === false) {
} else if ((await this.hasHighlightedFirstCapture()) === false) {
await this.delayBeforeStartTour();
this.joyrideService.startTour({
steps: ['highlightFirstCapture'],
showCounter: this.showCounter,
customTexts: this.customTexts,
});
this.setHasHighlightedFirstCapture(true);
} else if (
(await this.hasClickedDetailsPageOptionsMenu()) === true &&
(await this.hasHighligtedActivityButton()) === false
Expand Down Expand Up @@ -223,6 +224,27 @@ export class UserGuideService {
);
}

hasHighlightedFirstCapture$() {
return this.preferences.getBoolean$(
PrefKeys.HAS_HIGHLIGHTED_FIRST_CAPTURE,
false
);
}

async hasHighlightedFirstCapture() {
return await this.preferences.getBoolean(
PrefKeys.HAS_HIGHLIGHTED_FIRST_CAPTURE,
false
);
}

async setHasHighlightedFirstCapture(value: boolean) {
return await this.preferences.setBoolean(
PrefKeys.HAS_HIGHLIGHTED_FIRST_CAPTURE,
value
);
}

hasOpenedDetailsPage$() {
return this.preferences.getBoolean$(
PrefKeys.HAS_OPENED_DETAILS_PAGE,
Expand Down Expand Up @@ -363,6 +385,7 @@ const enum PrefKeys {
HAS_OPENED_CUSTOM_CAMERA_PAGE = 'HAS_OPENED_CUSTOM_CAMERA_PAGE',
HAS_CAPTURED_PHOTO_WITH_CUSTOM_CAMERA = 'HAS_CAPTURED_PHOTO_WITH_CUSTOM_CAMERA',
HAS_CAPTURED_VIDEO_WITH_CUSTOM_CAMERA = 'HAS_CAPTURED_VIDEO_WITH_CUSTOM_CAMERA',
HAS_HIGHLIGHTED_FIRST_CAPTURE = 'HAS_HIGHLIGHTED_FIRST_CAPTURE',
HAS_OPENED_DETAILS_PAGE = 'HAS_OPENED_DETAILS_PAGE',
HAS_CLICKED_DETAILS_PAGE_OPTIONS_MENU = 'HAS_CLICKED_DETAILS_PAGE_OPTIONS_MENU',
HAS_OPENED_ACTIVITIES_PAGE = 'HAS_OPENED_ACTIVITIES_PAGE',
Expand Down

0 comments on commit fd79cb2

Please sign in to comment.