Skip to content

Commit

Permalink
Merge pull request #2955 from numbersprotocol/milestone-v230711-part-2
Browse files Browse the repository at this point in the history
Milestone v230711 part 2
  • Loading branch information
sultanmyrza authored Aug 1, 2023
2 parents 279f44e + 5aeeb3b commit 5cdb5f0
Show file tree
Hide file tree
Showing 11 changed files with 107 additions and 56 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: test

on:
push:
branches: [master, develop, 'feature-*', 'fix-*', 'hotfix-*']
on: [push, pull_request]

jobs:
lint:
Expand Down
14 changes: 10 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.82.4] - 2023-08-01

### Fixed

1. Fix User can’t register asset when using capture camera (#2930)
1. Fix can't register new account on some android device (#2953)

## [0.82.3] - 2023-07-28

### Fixed
Expand All @@ -21,8 +28,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed

1. Fix can't register new account on some android device (#2928)
1. Fix User can’t register asset when using capture camera (#2930)
1. Fix Change capture tab VALIDATED to VERIFIED (#2939)
1. Fix 4k videos can not generate thumbnail on some android devices (Android only) (#2923). reverted (#2938)
1. Fix show correct error mesage for sign up duplicate username error (#2926)
Expand Down Expand Up @@ -2159,8 +2164,9 @@ 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.82.3...HEAD
[0.82.3]: https://github.com/numbersprotocol/capture-lite/compare/0.82.2...0.23.3
[unreleased]: https://github.com/numbersprotocol/capture-lite/compare/0.82.4...HEAD
[0.82.4]: https://github.com/numbersprotocol/capture-lite/compare/0.82.3...0.82.4
[0.82.3]: https://github.com/numbersprotocol/capture-lite/compare/0.82.2...0.82.3
[0.82.2]: https://github.com/numbersprotocol/capture-lite/compare/0.81.2...0.82.2
[0.81.2]: https://github.com/numbersprotocol/capture-lite/compare/0.79.0...0.81.2
[0.79.0]: https://github.com/numbersprotocol/capture-lite/compare/0.78.0...0.79.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 @@ -7,8 +7,8 @@ android {
applicationId "io.numbersprotocol.capturelite"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 823
versionName "0.82.3"
versionCode 824
versionName "0.82.4"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildFeatures {
Expand Down
8 changes: 4 additions & 4 deletions ios/App/App.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -368,13 +368,13 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 823;
CURRENT_PROJECT_VERSION = 824;
DEVELOPMENT_TEAM = G7NB5YCKAP;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.82.3;
MARKETING_VERSION = 0.82.4;
OTHER_SWIFT_FLAGS = "$(inherited) \"-D\" \"COCOAPODS\" \"-DDEBUG\"";
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -395,13 +395,13 @@
CODE_SIGN_ENTITLEMENTS = App/App.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 823;
CURRENT_PROJECT_VERSION = 824;
DEVELOPMENT_TEAM = G7NB5YCKAP;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = G7NB5YCKAP;
INFOPLIST_FILE = App/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 0.82.3;
MARKETING_VERSION = 0.82.4;
PRODUCT_BUNDLE_IDENTIFIER = io.numbersprotocol.capturelite;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = NumbersAppDistributionV4;
Expand Down
8 changes: 4 additions & 4 deletions ios/App/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ PODS:
- Capacitor
- CapacitorGeolocation (5.0.4):
- Capacitor
- CapacitorLocalNotifications (5.0.4):
- CapacitorLocalNotifications (5.0.6):
- Capacitor
- CapacitorNativeSettings (4.0.3):
- Capacitor
- CapacitorNetwork (5.0.4):
- Capacitor
- CapacitorPushNotifications (5.0.4):
- CapacitorPushNotifications (5.0.6):
- Capacitor
- CapacitorShare (5.0.4):
- Capacitor
Expand Down Expand Up @@ -231,10 +231,10 @@ SPEC CHECKSUMS:
CapacitorDevice: eb4b5e3b42ac35d2527f20aad296b59e0785dc8d
CapacitorFilesystem: e1bdfab09b95b181c844c16abcfda45ec8e8ed6b
CapacitorGeolocation: 33015be1ef496585a60da9efa1c5642ff8624db3
CapacitorLocalNotifications: 2c95d27ccf9cc28ecc59d69b54d29074c1740172
CapacitorLocalNotifications: c2d8b14794064fd4814b1d6c4ddbac8029afa295
CapacitorNativeSettings: b6f40955945bc659f966a43fa54fc6be192d8f9b
CapacitorNetwork: e2bd0bf1614aca34bb976f125a756a8a3df1c81a
CapacitorPushNotifications: 3704ac3dac68a9bfc669fb384cbc7beec9b1f100
CapacitorPushNotifications: 7eb70469f1fcc3dec07126336d4896520e4991db
CapacitorShare: 427bba238a1e3f116b2b349019aec6ea7f42cebd
CapacitorSplashScreen: 93a389d4f7673c08214ae25bb6f21d867d5305c5
CapacitorStorage: 8ec2cf8fec179d829288b16c6fba6c3c43d2bdc9
Expand Down
32 changes: 16 additions & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "capture-lite",
"version": "0.82.3",
"version": "0.82.4",
"author": "numbersprotocol",
"homepage": "https://numbersprotocol.io/",
"scripts": {
Expand Down Expand Up @@ -45,9 +45,9 @@
"@capacitor/filesystem": "^5.0.4",
"@capacitor/geolocation": "^5.0.4",
"@capacitor/ios": "^5.0.5",
"@capacitor/local-notifications": "^5.0.4",
"@capacitor/local-notifications": "^5.0.6",
"@capacitor/network": "^5.0.4",
"@capacitor/push-notifications": "^5.0.4",
"@capacitor/push-notifications": "^5.0.6",
"@capacitor/share": "^5.0.4",
"@capacitor/splash-screen": "^5.0.4",
"@capacitor/storage": "^1.2.4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
*ngIf="(mode$ | ngrxPush) === 'pre-publish'"
[curCaptureFileSize]="curCaptureFileSize"
[curCaptureFilePath]="curCaptureFilePath"
[curCaptureFileName]="curCaptureFileName"
[curCaptureMimeType]="curCaptureMimeType"
[curCaptureSrc]="curCaptureSrc"
(confirm)="confirmCurrentCapture()"
Expand Down
32 changes: 29 additions & 3 deletions src/app/features/home/custom-camera/custom-camera.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export class CustomCameraPage implements OnInit, OnDestroy {

curCaptureFileSize?: number;
curCaptureFilePath?: string;
curCaptureFileName?: string;
curCaptureMimeType?: 'image/jpeg' | 'video/mp4';
curCaptureType?: MediaType = 'image';
curCaptureSrc?: string;
Expand Down Expand Up @@ -142,8 +143,32 @@ export class CustomCameraPage implements OnInit, OnDestroy {
});
}

private handleCaptureSuccessResult(result: CaptureSuccessResult) {
this.prepareForPublishing(result, CameraSource.Camera);
private async handleCaptureSuccessResult(result: CaptureSuccessResult) {
const resultCopy = await this.copyResultIfNeeded(result);
this.prepareForPublishing(resultCopy, CameraSource.Camera);
}

private async copyResultIfNeeded(result: CaptureSuccessResult) {
/**
* WORKAROUND: https://github.com/numbersprotocol/capture-lite/issues/2904
* On Android 13 capacitor filesystem plugin need to pass directory parameter to be
* able to re-write media file (aka when we edit image and save it the same file).
* Therefore we copy image to cache so we can re-write it if user crop/filter the image.
*
*/
if (this.platform.is('android') && result.mimeType.startsWith('image/')) {
const originalFilePath = result.path;
const readFileResult = await Filesystem.readFile({ path: result.path });
const writeFileResult = await Filesystem.writeFile({
data: readFileResult.data,
path: `${result.name}`,
directory: Directory.Cache,
recursive: true,
});
result.path = writeFileResult.uri;
await Filesystem.deleteFile({ path: originalFilePath });
}
return result;
}

private handleCaptureErrorResult(result: CaptureErrorResult) {
Expand All @@ -156,6 +181,7 @@ export class CustomCameraPage implements OnInit, OnDestroy {
) {
this.curCaptureFileSize = result.size;
this.curCaptureFilePath = result.path;
this.curCaptureFileName = result.name;
this.curCaptureMimeType = result.mimeType;
this.curCaptureType = result.mimeType === 'image/jpeg' ? 'image' : 'video';
this.curCaptureSrc = Capacitor.convertFileSrc(result.path);
Expand Down Expand Up @@ -328,7 +354,7 @@ export class CustomCameraPage implements OnInit, OnDestroy {
const readFileResult = await Filesystem.readFile({ path: file.path });
const writeFileresult = await Filesystem.writeFile({
data: readFileResult.data,
path: `${Date.now()}/${file.name}`,
path: `${file.name}`,
directory: Directory.Cache,
recursive: true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
Output,
ViewChild,
} from '@angular/core';
import { FilesystemPlugin } from '@capacitor/filesystem';
import { AlertController } from '@ionic/angular';
import { Directory, FilesystemPlugin } from '@capacitor/filesystem';
import { AlertController, Platform } from '@ionic/angular';
import { TranslocoService } from '@ngneat/transloco';
import { ColorMatrix, getEditorDefaults } from '@pqina/pintura';
import {
Expand Down Expand Up @@ -62,6 +62,8 @@ export class PrePublishModeComponent {

readonly curCaptureFilePath$ = new ReplaySubject<string>(1);

readonly curCaptureFileName$ = new ReplaySubject<string>(1);

readonly curCaptureMimeType$ = new ReplaySubject<CaptureMimeType>(1);

readonly curCaptureSrc$ = new ReplaySubject<string>(1);
Expand Down Expand Up @@ -108,6 +110,11 @@ export class PrePublishModeComponent {
if (value) this.curCaptureFilePath$.next(value);
}

@Input()
set curCaptureFileName(value: string | undefined) {
if (value) this.curCaptureFileName$.next(value);
}

@Input()
set curCaptureMimeType(value: CaptureMimeType | undefined) {
if (value) this.curCaptureMimeType$.next(value);
Expand All @@ -129,7 +136,8 @@ export class PrePublishModeComponent {
private readonly filesystemPlugin: FilesystemPlugin,
private readonly errorService: ErrorService,
private readonly alertController: AlertController,
private readonly translocoService: TranslocoService
private readonly translocoService: TranslocoService,
private readonly platform: Platform
) {}

handleEditorUpdate(imageState: any): void {
Expand All @@ -150,12 +158,24 @@ export class PrePublishModeComponent {

async handleEditorProcess(imageWriterResult: any): Promise<void> {
const base64 = await blobToBase64(imageWriterResult.dest as File);
combineLatest([this.curCaptureFilePath$, of(base64)])
combineLatest([
this.curCaptureFilePath$,
of(base64),
this.isImage$,
this.curCaptureFileName$,
])
.pipe(
first(),
switchMap(([path, data]) =>
this.filesystemPlugin.writeFile({ path, data })
),
switchMap(([path, data, isImage, fileName]) => {
if (this.platform.is('android') && isImage) {
return this.filesystemPlugin.writeFile({
path: fileName,
data: data,
directory: Directory.Cache,
});
}
return this.filesystemPlugin.writeFile({ path, data });
}),
tap(() => this.isProcessingImage$.next(false)),
tap(() => this.confirm.emit(true)),
catchError((error: unknown) => {
Expand Down
20 changes: 10 additions & 10 deletions src/app/shared/media/component/media.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,15 @@ export class MediaComponent implements AfterViewInit, OnDestroy {
* and the native player is no longer needed.
*/
private removeCSSClass() {
// Remove the CSS class from the body element
this.renderer.removeClass(
this.elementRef.nativeElement.ownerDocument.body,
this.globalCSSClass
);
// Remove the CSS class from the ion-app element
this.renderer.removeClass(
this.elementRef.nativeElement.ownerDocument.querySelector('ion-app'),
this.globalCSSClass
);
const bodyElement = this.elementRef.nativeElement.ownerDocument.body;
const ionAppElement =
this.elementRef.nativeElement.ownerDocument.querySelector('ion-app');

if (bodyElement && ionAppElement) {
// Remove the CSS class from the body element
this.renderer.removeClass(bodyElement, this.globalCSSClass);
// Remove the CSS class from the ion-app element
this.renderer.removeClass(ionAppElement, this.globalCSSClass);
}
}
}

0 comments on commit 5cdb5f0

Please sign in to comment.