From b373e1bc22621f99707cfaaa2de7a36e3ee18d27 Mon Sep 17 00:00:00 2001 From: Sivan Ratson <89018301+Sivan22@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:01:08 +0200 Subject: [PATCH] fix: memory issue on extracting --- .github/workflows/flutter.yml | 21 +++++++++++++++++---- android/build.gradle | 2 +- lib/screens/empty_library_screen.dart | 22 +++------------------- 3 files changed, 21 insertions(+), 24 deletions(-) diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml index 651bf734..c4f5449c 100644 --- a/.github/workflows/flutter.yml +++ b/.github/workflows/flutter.yml @@ -96,9 +96,22 @@ jobs: channel: stable cache: true - run: flutter pub get - - run: flutter build ios --release --no-codesign - - name: Upload iphone build + - name: Build iOS + run: | + flutter build ios --release + cd build/ios/iphoneos + mkdir Payload + cp -r Runner.app Payload + zip -r otzaria-ios.ipa Payload + - name: Upload iOS build uses: actions/upload-artifact@v4 with: - name: otzaria-iphone.app - path: build/ios/iphoneos/Runner.app + name: otzaria-ios.ipa + path: build/ios/iphoneos/otzaria-ios.ipa + - name: Upload iOS archive + uses: actions/upload-artifact@v4 + with: + name: ios-build + path: | + build/ios/archive/Runner.xcarchive + build/ios/iphoneos/ diff --git a/android/build.gradle b/android/build.gradle index 802640d0..54e39a96 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -1,5 +1,5 @@ buildscript { - ext.kotlin_version = '1.9.22' + ext.kotlin_version = "2.1.0-RC" repositories { google() mavenCentral() diff --git a/lib/screens/empty_library_screen.dart b/lib/screens/empty_library_screen.dart index 1b3dfbb5..cfa5b94f 100644 --- a/lib/screens/empty_library_screen.dart +++ b/lib/screens/empty_library_screen.dart @@ -201,25 +201,9 @@ class _EmptyLibraryScreenState extends State { if (file.isFile) { final outputFile = File(filePath); await outputFile.parent.create(recursive: true); - - // Use streaming to write file contents - if (file.content != null) { - final sink = outputFile.openWrite(); - try { - // Process in chunks to avoid memory issues - const chunkSize = 1024 * 1024; // 1MB chunks - final content = file.content as List; - for (var i = 0; i < content.length; i += chunkSize) { - final end = (i + chunkSize < content.length) - ? i + chunkSize - : content.length; - sink.add(content.sublist(i, end)); - await sink.flush(); - } - } finally { - await sink.close(); - } - } + final outputStream = OutputFileStream(outputFile.path); + file.writeContent(outputStream); + outputStream.close(); } else { await Directory(filePath).create(recursive: true); }