fix: Fixed issue where Moments could incorrectly get engaged during biometrics unlocking

This commit is contained in:
Mo
2022-12-28 22:20:44 -06:00
parent 5a0d87845c
commit 8e3ae80aa0

View File

@@ -29,11 +29,13 @@ export class MomentsService extends AbstractViewController {
void this.beginTakingPhotos() void this.beginTakingPhotos()
} }
}, ApplicationEvent.LocalDataLoaded), }, ApplicationEvent.LocalDataLoaded),
application.addEventObserver(async () => { application.addEventObserver(async () => {
this.disableMoments() this.pauseMoments()
}, ApplicationEvent.BiometricsSoftLockEngaged), }, ApplicationEvent.BiometricsSoftLockEngaged),
application.addEventObserver(async () => { application.addEventObserver(async () => {
this.enableMoments() this.resumeMoments()
}, ApplicationEvent.BiometricsSoftLockDisengaged), }, ApplicationEvent.BiometricsSoftLockDisengaged),
) )
@@ -67,6 +69,18 @@ export class MomentsService extends AbstractViewController {
clearInterval(this.intervalReference) clearInterval(this.intervalReference)
} }
private pauseMoments(): void {
clearInterval(this.intervalReference)
}
private resumeMoments(): void {
if (!this.isEnabled) {
return
}
void this.beginTakingPhotos()
}
private beginTakingPhotos() { private beginTakingPhotos() {
if (this.intervalReference) { if (this.intervalReference) {
clearInterval(this.intervalReference) clearInterval(this.intervalReference)