Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

fix: use combine for method channel communication

Prateek Sunalf1d978fbf76f
diff --git a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
index 776e03994a..7502036bf9 100644
--- a/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
+++ b/mobile/apps/photos/lib/services/isolated_ffmpeg_service.dart
@@ -1,8 +1,7 @@
import "dart:async";
-import "dart:io";
+import "package:combine/combine.dart";
import "package:computer/computer.dart";
-import "package:dart_ui_isolate/dart_ui_isolate.dart";
import "package:ffmpeg_kit_flutter/ffmpeg_kit.dart";
import "package:ffmpeg_kit_flutter/ffprobe_kit.dart";
import "package:ffmpeg_kit_flutter/media_information.dart";
@@ -18,14 +17,13 @@ class IsolatedFfmpegService {
}
static Future<Map> runFfmpeg(String command) async {
- return await flutterCompute<Map, String>(
- _ffmpegRun,
- command,
- );
+ return await CombineWorker()
+ .executeWithArg<Map, String>(_ffmpegRun, command);
}
- static Future<Map> getVideoInfo(File file) async {
- return flutterCompute<Map, String>(_getVideoProps, file.path);
+ static Future<Map> getVideoInfo(String file) async {
+ return await CombineWorker()
+ .executeWithArg<Map, String>(_getVideoProps, file);
}
}
@@ -56,9 +54,7 @@ Future<Map> _getVideoProps(String filePath) async {
}
@pragma('vm:entry-point')
-Future<Map> _ffmpegRun(
- String value,
-) async {
+Future<Map> _ffmpegRun(String value) async {
final session = await FFmpegKit.execute(value, true);
final returnCode = (await session.getReturnCode())?.getValue();
diff --git a/mobile/apps/photos/lib/utils/exif_util.dart b/mobile/apps/photos/lib/utils/exif_util.dart
index 3d2bfe29b7..9b1ae3593c 100644
--- a/mobile/apps/photos/lib/utils/exif_util.dart
+++ b/mobile/apps/photos/lib/utils/exif_util.dart
@@ -70,7 +70,8 @@ Future<FFProbeProps?> getVideoPropsAsync(File originalFile) async {
try {
final stopwatch = Stopwatch()..start();
- final mediaInfo = await IsolatedFfmpegService.getVideoInfo(originalFile);
+ final mediaInfo =
+ await IsolatedFfmpegService.getVideoInfo(originalFile.path);
if (mediaInfo.isEmpty) {
return null;
}
diff --git a/mobile/apps/photos/pubspec.lock b/mobile/apps/photos/pubspec.lock
index cb49e18a5a..fa8c67b03c 100644
--- a/mobile/apps/photos/pubspec.lock
+++ b/mobile/apps/photos/pubspec.lock
@@ -324,6 +324,15 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.19.1"
+ combine:
+ dependency: "direct main"
+ description:
+ path: "."
+ ref: "feat_version_3.32.0"
+ resolved-ref: "49a02bc7b2d3636f7c3dba294371959f9f60a513"
+ url: "https://github.com/mobaink/combine.git"
+ source: git
+ version: "0.5.8"
computer:
dependency: "direct main"
description:
diff --git a/mobile/apps/photos/pubspec.yaml b/mobile/apps/photos/pubspec.yaml
index c64514350d..de62ace4f5 100644
--- a/mobile/apps/photos/pubspec.yaml
+++ b/mobile/apps/photos/pubspec.yaml
@@ -36,6 +36,10 @@ dependencies:
url: https://github.com/ente-io/chewie.git
ref: mybranched
collection: #dart
+ combine:
+ git:
+ url: https://github.com/mobaink/combine.git
+ ref: feat_version_3.32.0
computer: # logged task name in verbose in fork
git: "https://github.com/ente-io/computer.git"
connectivity_plus: ^6.0.2