Skip to content

Commit b52b29d

Browse files
committed
Revert "Merge pull request #2966 from numbersprotocol/fix-v230725-issue-Some-device-can’t-record-15s-SHORT-by-Capture-camera"
This reverts commit 64ee163, reversing changes made to 4630fb9.
1 parent 72b1261 commit b52b29d

File tree

2 files changed

+11
-28
lines changed

2 files changed

+11
-28
lines changed

src/app/features/home/custom-camera/custom-camera.page.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@
148148

149149
<app-pre-publish-mode
150150
*ngIf="(mode$ | ngrxPush) === 'pre-publish'"
151-
[curCaptureCameraSource]="curCaptureCameraSource"
152151
[curCaptureFileSize]="curCaptureFileSize"
153152
[curCaptureFilePath]="curCaptureFilePath"
154153
[curCaptureFileName]="curCaptureFileName"

src/app/features/home/custom-camera/pre-publish-mode/pre-publish-mode.component.ts

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
Output,
88
ViewChild,
99
} from '@angular/core';
10-
import { CameraSource } from '@capacitor/camera';
1110
import { Directory, FilesystemPlugin } from '@capacitor/filesystem';
1211
import { AlertController, Platform } from '@ionic/angular';
1312
import { TranslocoService } from '@ngneat/transloco';
@@ -59,12 +58,6 @@ export class PrePublishModeComponent {
5958

6059
private toggleBlackAndWhiteFilter = true;
6160

62-
readonly curCaptureCameraSource$ = new ReplaySubject<CameraSource>(1);
63-
64-
readonly isFromGallery$ = this.curCaptureCameraSource$.pipe(
65-
map(cameraSource => cameraSource === CameraSource.Photos)
66-
);
67-
6861
readonly curCaptureFileSize$ = new ReplaySubject<number>(1);
6962

7063
readonly curCaptureFilePath$ = new ReplaySubject<string>(1);
@@ -105,12 +98,7 @@ export class PrePublishModeComponent {
10598
readonly isFileSizeExceeded$ = combineLatest([
10699
this.curCaptureFileSize$,
107100
this.maxAllowedFileSize$,
108-
]).pipe(map(([curSize, maxSize]) => curSize > maxSize));
109-
110-
@Input()
111-
set curCaptureCameraSource(value: CameraSource | undefined) {
112-
if (value) this.curCaptureCameraSource$.next(value);
113-
}
101+
]).pipe(map(([curSize, maxSize]) => curSize < maxSize));
114102

115103
@Input()
116104
set curCaptureFileSize(value: number | undefined) {
@@ -235,25 +223,21 @@ export class PrePublishModeComponent {
235223
tap(isImage => (isImage ? this.confirmImage() : this.confirmVideo()))
236224
);
237225

238-
const showFileSizeExceededAction$ = defer(() =>
239-
this.showFileSizeExceededModal()
226+
const showIsFileSizeExceededAction$ = defer(() =>
227+
this.showIsFileSizeExceededModal()
240228
);
241229

242-
const shouldShowFileSizeExeededDialog$ = combineLatest([
243-
this.isFromGallery$,
244-
this.isFileSizeExceeded$,
245-
]).pipe(map(([c1, c2]) => c1 === true && c2 === true));
246-
247-
shouldShowFileSizeExeededDialog$
230+
this.isFileSizeExceeded$
248231
.pipe(
249232
first(),
250-
switchMap(shouldShowFileSizeExeededDialog =>
233+
switchMap(hasEnoughMemory =>
251234
iif(
252-
() => shouldShowFileSizeExeededDialog,
253-
showFileSizeExceededAction$,
254-
runConfirmAction$
235+
() => hasEnoughMemory,
236+
runConfirmAction$,
237+
showIsFileSizeExceededAction$
255238
)
256-
)
239+
),
240+
catchError((error: unknown) => this.errorService.toastError$(error))
257241
)
258242
.subscribe();
259243
}
@@ -275,7 +259,7 @@ export class PrePublishModeComponent {
275259
this.confirm.emit(true);
276260
}
277261

278-
private showFileSizeExceededModal() {
262+
private showIsFileSizeExceededModal() {
279263
const translations$ = this.translocoService.selectTranslateObject({
280264
'customCamera.error.fileSizeExeedsLimit': null,
281265
ok: null,

0 commit comments

Comments
 (0)