diff --git a/.github/workflows/build-firebase.yaml b/.github/workflows/build-firebase.yaml new file mode 100644 index 00000000..71451485 --- /dev/null +++ b/.github/workflows/build-firebase.yaml @@ -0,0 +1,163 @@ +name: build firebase + +# Controls when the action will run. Triggers the workflow on push or pull request +# events but only for the develop branch +on: + workflow_dispatch: + + push: + tags: + - "firebase-v[0-9]+.[0-9]+.[0-9]+*" + branches: [develop, main] + paths: + - "flutter_cache_manager_firebase/**" + - ".github/workflows/**" + pull_request: + branches: [develop, main] + paths: + - "flutter_cache_manager_firebase/**" + - ".github/workflows/**" + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + format: + name: Format + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + source-directory: ./flutter_cache_manager_firebase + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + # Make sure the stable version of Flutter is available + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + architecture: x64 + cache: true + + # Download all Flutter packages + - name: Download dependencies + run: flutter pub get + working-directory: ${{env.source-directory}} + + # Run Flutter Format to ensure formatting is valid + - name: Run Flutter Format + run: dart format --set-exit-if-changed . + working-directory: ${{env.source-directory}} + + analyze: + name: Analyze + + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + source-directory: ./flutter_cache_manager_firebase + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + # Make sure the stable version of Flutter is available + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + architecture: x64 + cache: true + + # Download all Flutter packages + - name: Download dependencies + run: flutter pub get + working-directory: ${{env.source-directory}} + + # Run Flutter Analyzer + - name: Run Flutter Analyzer + run: flutter analyze + working-directory: ${{env.source-directory}} + + tests: + name: Unit-tests + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + source-directory: ./flutter_cache_manager_firebase + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + # Make sure the stable version of Flutter is available + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + architecture: x64 + cache: true + + # Download all Flutter packages + - name: Download dependencies + run: flutter pub get + working-directory: ${{env.source-directory}} + + # Run all unit-tests with code coverage + # - name: Run unit tests + # run: flutter test --coverage + # working-directory: ${{env.source-directory}} + + # # Upload code coverage information + # - uses: codecov/codecov-action@v4 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: ${{env.source-directory}}/coverage/lcov.info + # name: CacheManager + # fail_ci_if_error: true + + publish_cache_manager_firebase: + if: ${{ github.ref_type == 'tag' }} + name: Publish Cache Manager Firebase + permissions: + id-token: write + needs: [format, analyze, tests] + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + source-directory: ./flutter_cache_manager_firebase + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + - name: Set up Dart + uses: dart-lang/setup-dart@v1 + + # Make sure the stable version of Flutter is available + - name: Set up Flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + architecture: x64 + cache: true + + # Download all Flutter packages + - name: Download dependencies + run: flutter pub get + working-directory: ${{env.source-directory}} + + # Publish the package + - name: Publish package + run: dart pub publish -v -f + working-directory: ${{env.source-directory}} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c5c0ebcb..08bfb396 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -3,14 +3,20 @@ name: build # Controls when the action will run. Triggers the workflow on push or pull request # events but only for the develop branch on: + workflow_dispatch: + push: - branches: [ develop, master ] + tags: + - "v[0-9]+.[0-9]+.[0-9]+*" + branches: [develop, main] paths: - - 'flutter_cache_manager/**' + - "flutter_cache_manager/**" + - ".github/workflows/**" pull_request: - branches: [ develop ] + branches: [develop, main] paths: - - 'flutter_cache_manager/**' + - "flutter_cache_manager/**" + - ".github/workflows/**" # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -26,12 +32,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -55,12 +64,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -85,18 +97,21 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Ensure correct JAVA version is installed. - - uses: actions/setup-java@v3 + - uses: actions/setup-java@v4 with: - distribution: 'zulu' - java-version: '17' + distribution: "zulu" + java-version: "17" # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -121,12 +136,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -151,12 +169,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Enable platform support - name: Enable macOS @@ -186,12 +207,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Enable platform support - name: Enable Windows @@ -225,12 +249,15 @@ jobs: - run: sudo apt-get install -y ninja-build libgtk-3-dev libblkid-dev # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Enable platform support - name: Enable Linux @@ -265,12 +292,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -293,12 +323,15 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 # Make sure the stable version of Flutter is available - - uses: subosito/flutter-action@v2 + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - channel: 'stable' + channel: "stable" + architecture: x64 + cache: true # Download all Flutter packages - name: Download dependencies @@ -310,9 +343,60 @@ jobs: run: flutter test --coverage working-directory: ${{env.source-directory}} - # Upload code coverage information - - uses: codecov/codecov-action@v3 + # # Upload code coverage information + # - uses: codecov/codecov-action@v4 + # env: + # CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + # with: + # files: ${{env.source-directory}}/coverage/lcov.info + # name: CacheManager + # fail_ci_if_error: true + + publish_cache_manager: + if: ${{ github.ref_type == 'tag' }} + name: Publish CacheManager + permissions: + id-token: write + needs: + [ + format, + analyze, + tests, + build_android, + build_ios, + build_macOS, + build_windows, + build_linux, + build_web, + ] + # The type of runner that the job will run on + runs-on: ubuntu-latest + + env: + source-directory: ./flutter_cache_manager + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v4 + + - name: Set up Dart + uses: dart-lang/setup-dart@v1 + + # Make sure the stable version of Flutter is available + - name: Set up Flutter + uses: subosito/flutter-action@v2 with: - files: ${{env.source-directory}}/coverage/lcov.info - name: CacheManager - fail_ci_if_error: true + channel: "stable" + architecture: x64 + cache: true + + # Download all Flutter packages + - name: Download dependencies + run: flutter pub get + working-directory: ${{env.source-directory}} + + # Publish the package + - name: Publish package + run: dart pub publish -v -f + working-directory: ${{env.source-directory}} diff --git a/.gitignore b/.gitignore index 556b6c26..067d0e08 100644 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,11 @@ .atom/ .buildlog/ .history -.project .svn/ -bin/ +devtools_options.yaml + +# Environment files +ios/Flutter/Dart-Defines.xcconfig # IntelliJ related *.iml @@ -18,30 +20,23 @@ bin/ *.iws .idea/ -# Android Studio related -android/.classpath -android/.settings/ - # Visual Studio Code related -.vscode/ - -# Flutter repo-specific -/bin/cache/ -/bin/mingit/ -/dev/benchmarks/mega_gallery/ -/dev/bots/.recipe_deps -/dev/bots/android_tools/ -/dev/docs/doc/ -/dev/docs/lib/ -/dev/docs/pubspec.yaml -/packages/flutter/coverage/ -version +.classpath +.project +.settings/ +.vscode/* + +# packages file containing multi-root paths +.packages.generated # Flutter/Dart/Pub related **/doc/api/ .dart_tool/ .flutter-plugins +.flutter-plugins-dependencies +**/generated_plugin_registrant.dart .packages +.pub-preload-cache/ .pub-cache/ .pub/ build/ @@ -49,16 +44,17 @@ flutter_*.png linked_*.ds unlinked.ds unlinked_spec.ds -flutter_export_environment.sh # Android related **/android/**/gradle-wrapper.jar -**/android/.gradle +.gradle/ **/android/captures/ **/android/gradlew **/android/gradlew.bat **/android/local.properties **/android/**/GeneratedPluginRegistrant.java +**/android/key.properties +*.jks # iOS/XCode related **/ios/**/*.mode1v3 @@ -77,15 +73,51 @@ flutter_export_environment.sh **/ios/**/profile **/ios/**/xcuserdata **/ios/.generated/ +**/ios/Flutter/.last_build_id **/ios/Flutter/App.framework **/ios/Flutter/Flutter.framework +**/ios/Flutter/Flutter.podspec **/ios/Flutter/Generated.xcconfig +**/ios/Flutter/ephemeral **/ios/Flutter/app.flx **/ios/Flutter/app.zip **/ios/Flutter/flutter_assets/ +**/ios/Flutter/flutter_export_environment.sh **/ios/ServiceDefinitions.json **/ios/Runner/GeneratedPluginRegistrant.* +# macOS +**/Flutter/ephemeral/ +**/Pods/ +**/macos/Flutter/GeneratedPluginRegistrant.swift +**/macos/Flutter/ephemeral +**/xcuserdata/ + +# Windows +**/windows/flutter/generated_plugin_registrant.cc +**/windows/flutter/generated_plugin_registrant.h +**/windows/flutter/generated_plugins.cmake + +# Linux +**/linux/flutter/generated_plugin_registrant.cc +**/linux/flutter/generated_plugin_registrant.h +**/linux/flutter/generated_plugins.cmake + +# Coverage +coverage/ + +# Submodules +packages/**/pubspec.lock + +# Web related +lib/generated_plugin_registrant.dart + +# Symbols +app.*.symbols + +# Obfuscation related +app.*.map.json + # Exceptions to above rules. !**/ios/**/default.mode1v3 !**/ios/**/default.mode2v3 @@ -96,3 +128,18 @@ example/.flutter-plugins-dependencies flutter_cache_manager/example/ios/Flutter/.last_build_id flutter_cache_manager/coverage/ +!/dev/ci/**/Gemfile.lock +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json +!.idea/codeStyles/ +!.idea/dictionaries/ +!.idea/runConfigurations/ + +# Generated files +**/generated +*.g.dart + +# Injection generated files +injectable.config.dart diff --git a/flutter_cache_manager/CHANGELOG.md b/flutter_cache_manager/CHANGELOG.md index beb2c28d..5d122841 100644 --- a/flutter_cache_manager/CHANGELOG.md +++ b/flutter_cache_manager/CHANGELOG.md @@ -1,70 +1,107 @@ +## [3.4.0] - 2024-08-01 + +* [Bugfix] For a previously cached file that got removed on the server, now evicts that file on 404 and notifies listeners. +* Allow to override ifNoneMatchHeader +* Get cache total size +* Export File System +* Expose memoryCacheContainsKey method from cache_store +* Updates dependencies + +## [3.3.3] - 2024-07-23 + +* Updates dependencies ([#457](https://github.com/Baseflow/flutter_cache_manager/pull/457)) + +## [3.3.2] - 2024-04-25 + +* Updates dependencies to their latest versions. + ## [3.3.1] - 2023-07-03 + * Support Dart 3.0.0 for http ^1.0.0 and file ^7.0.0 * Update example * Add topics ## [3.3.0] - 2021-11-29 + * Added option to manage the log level. Doesn't print failed downloads by default anymore. You can set it like this: + ```dart CacheManager.logLevel = CacheManagerLogLevel.verbose; ``` ## [3.2.0] - 2021-11-27 + * [Bugfix] getSingleFile now downloads a new file before completing as the outdated file might have been deleted. ## [3.1.3] - 2021-11-05 + * Disabled resizing of cached gifs as this was broken. ## [3.1.2] - 2021-06-17 + * removeFile function now completes after the file is removed from disk and not earlier ([#323](https://github.com/Baseflow/flutter_cache_manager/pull/323)) * Image resizing doesn't block ui anymore and doesn't use image package but existing Flutter components ([#319](https://github.com/Baseflow/flutter_cache_manager/pull/319)) ## [3.1.1] - 2021-06-03 + * Move File to separate file. You can add it using the following import: + ```dart import 'package:flutter_cache_manager/file.dart' as cache_file; ``` ## [3.1.0] - 2021-05-28 + * Export File from package file ([#302](https://github.com/Baseflow/flutter_cache_manager/pull/302)) * Bugfix for eTag on Flutter Web ([#304](https://github.com/Baseflow/flutter_cache_manager/pull/315)) * Bugfix for loading multiple images simultaneously ([#315](https://github.com/Baseflow/flutter_cache_manager/pull/315)) ## [3.0.2] - 2021-05-10 + * Include rxdart 0.27 as possible dependency ## [3.0.1] - 2021-03-29 + * Include file 6.0.0 as possible dependency ## [3.0.0] - 2021-03-27 + * Bug fix on removing a relatively new file from cache * Migration to nullsafety. ## [3.0.0-nullsafety.3] - 2021-03-26 + * Add null-check on id in removeFile ## [3.0.0-nullsafety.2] - 2021-03-22 + * Fix sqflite warning ## [3.0.0-nullsafety.1] - 2021-03-02 + * Bug fix for NonStoringObjectProvider. ## [3.0.0-nullsafety.0] - 2021-02-25 + * Migration to nullsafety. ## [2.1.2] - 2021-03-09 + * Update dependencies * Bug fix for JsonCacheInfoRepository when file is corrupted. ## [2.1.1] - 2021-01-14 + * Update minimal dependency sqflite * Small fix for non-existing directory (PR [#264](https://github.com/Baseflow/flutter_cache_manager/pull/264)) ## [2.1.0] - 2020-12-21 + * Added ImageCacheManager with support for image resizing. * Upgrade dependencies. ## [2.0.0] - 2020-10-16 + * Restructured the configuration of the CacheManager. Look at the ReadMe for more information. * Added queueing mechanism for downloading new files. By default, the cache manager downloads a maximum of 10 files at the same time. @@ -78,14 +115,15 @@ import 'package:flutter_cache_manager/file.dart' as cache_file; * **BREAKING CHANGE** A CacheInfoRepository is now assumed to allow multiple connections, which means you can call 'open' multiple times and the repo keeps track on the number of connections. - ## [2.0.0-beta.1] - 2020-10-10 + * Reintroduced BaseCacheManager interface for backwards compatibility. * Renamed putExistFile to putFileStream. This is equally efficient, but more clear in what it does. ## [2.0.0-beta] - 2020-10-01 + * Added option for a key different from the url. -* Added a new CacheInfoRepository: JsonCacheInfoRepository, which is not used by default on the existing platforms, +* Added a new CacheInfoRepository: JsonCacheInfoRepository, which is not used by default on the existing platforms, but can be used on any. * Added support for Windows and Linux using the JsonCacheInfoRepository by default. * Added support for adding an existing file. @@ -95,49 +133,56 @@ but can be used on any. * **BREAKING CHANGE** A CacheInfoRepository is now assumed to allow multiple connections, which means you can call 'open' multiple times and the repo keeps track on the number of connections. - ## [1.4.2] - 2020-09-10 + * Compatibility with Flutter version 1.22. ## [1.4.1] - 2020-06-14 + * Bugfix: CacheManager returned a file that didn't exist when the file was removed by the OS (or any other external system) while the app was active. This also prevented the CacheManager to redownload the file ([PR #190](https://github.com/Baseflow/flutter_cache_manager/pull/190)). ## [1.4.0] - 2020-06-04 + * Allow cleaning of memory cache ([PR #183](https://github.com/Baseflow/flutter_cache_manager/pull/183)). * Bugfix: Cleaning doesn't want to delete a file twice anymore ([PR #185](https://github.com/Baseflow/flutter_cache_manager/pull/185)). ## [1.3.0] - 2020-05-28 + * Basic web support. (At least it downloads the file for you.) * Support for the following mimetypes: - * application/vnd.android.package-archive (apk) - * audio/x-aac (aac) - * video/quicktime (mov) + * application/vnd.android.package-archive (apk) + * audio/x-aac (aac) + * video/quicktime (mov) ## [1.2.2] - 2020-04-16 + * Support for RxDart 0.24.x ## [1.2.1] - 2020-04-14 + * Fixed optional parameters in the Content-Type header ([#164](https://github.com/Baseflow/flutter_cache_manager/issues/164)). ## [1.2.0] - 2020-04-10 + * Added getFileStream to CacheManager - * getFileStream has an optional parameter 'withProgress' to receive progress. - * getFileStream returns a FileResponse which is either a FileInfo or a DownloadProgress. + * getFileStream has an optional parameter 'withProgress' to receive progress. + * getFileStream returns a FileResponse which is either a FileInfo or a DownloadProgress. * Changes to FileFetcher and FileFetcherResponse: - * FileFetcher is now replaced with a FileService which is a class instead of a function. - * FileServiceResponse doesn't just give magic headers, but concrete implementation of the needed information. - * FileServiceResponse gives a contentStream instead of content for more efficient handling of the data. - * FileServiceResponse contains contentLength with information about the total size of the content. + * FileFetcher is now replaced with a FileService which is a class instead of a function. + * FileServiceResponse doesn't just give magic headers, but concrete implementation of the needed information. + * FileServiceResponse gives a contentStream instead of content for more efficient handling of the data. + * FileServiceResponse contains contentLength with information about the total size of the content. * Changes in CacheStore for testability: - * CleanupRunMinInterval can now be set. - * Expects a mockable directory instead of a path. + * CleanupRunMinInterval can now be set. + * Expects a mockable directory instead of a path. * Added CacheInfoRepository interface to possibly replace the current CacheObjectProvider based on sqflite. * Changes in WebHelper * Files are now always saved with a new name. Files are first saved to storage before old file is removed. * General code quality improvements ## [1.1.3] - 2019-10-17 + * Use try-catch in WebHelper so VM understands that errors are not uncaught. ## [1.1.2] - 2019-10-16 @@ -197,7 +242,7 @@ while the app was active. This also prevented the CacheManager to redownload the ## [0.0.4+1] - 2018-02-16 -* Fixed nullpointer when non-updated file (a 304 response) has no cache-control period. +* Fixed nullpointer when non-updated file (a 304 response) has no cache-control period. ## [0.0.4] - 2018-01-31 diff --git a/flutter_cache_manager/example/.metadata b/flutter_cache_manager/example/.metadata index a59942bf..8a0ce793 100644 --- a/flutter_cache_manager/example/.metadata +++ b/flutter_cache_manager/example/.metadata @@ -4,7 +4,39 @@ # This file should be version controlled and should not be manually edited. version: - revision: 6a3ff018b199a7febbe2b5adbb564081d8f49e2f - channel: dev + revision: "b0850beeb25f6d5b10426284f506557f66181b36" + channel: "stable" project_type: app + +# Tracks metadata for the flutter migrate command +migration: + platforms: + - platform: root + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: android + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: ios + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: macos + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: web + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + - platform: windows + create_revision: b0850beeb25f6d5b10426284f506557f66181b36 + base_revision: b0850beeb25f6d5b10426284f506557f66181b36 + + # User provided section + + # List of Local paths (relative to this file) that should be + # ignored by the migrate tool. + # + # Files that are not part of the templates will be ignored by default. + unmanaged_files: + - 'lib/main.dart' + - 'ios/Runner.xcodeproj/project.pbxproj' diff --git a/flutter_cache_manager/example/android/app/build.gradle b/flutter_cache_manager/example/android/app/build.gradle index 9192d00d..2a2d082b 100644 --- a/flutter_cache_manager/example/android/app/build.gradle +++ b/flutter_cache_manager/example/android/app/build.gradle @@ -1,69 +1,58 @@ +plugins { + id "com.android.application" + id "kotlin-android" + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins. + id "dev.flutter.flutter-gradle-plugin" +} + def localProperties = new Properties() -def localPropertiesFile = rootProject.file('local.properties') +def localPropertiesFile = rootProject.file("local.properties") if (localPropertiesFile.exists()) { - localPropertiesFile.withReader('UTF-8') { reader -> + localPropertiesFile.withReader("UTF-8") { reader -> localProperties.load(reader) } } -def flutterRoot = localProperties.getProperty('flutter.sdk') -if (flutterRoot == null) { - throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") -} - -def flutterVersionCode = localProperties.getProperty('flutter.versionCode') +def flutterVersionCode = localProperties.getProperty("flutter.versionCode") if (flutterVersionCode == null) { - flutterVersionCode = '1' + flutterVersionCode = "1" } -def flutterVersionName = localProperties.getProperty('flutter.versionName') +def flutterVersionName = localProperties.getProperty("flutter.versionName") if (flutterVersionName == null) { - flutterVersionName = '1.0' + flutterVersionName = "1.0" } -apply plugin: 'com.android.application' -apply plugin: 'kotlin-android' -apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" - android { - namespace "com.baseflow.example" - compileSdkVersion 33 - ndkVersion flutter.ndkVersion + namespace = "com.example.example" + compileSdk = flutter.compileSdkVersion + ndkVersion = flutter.ndkVersion compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 - } - - kotlinOptions { - jvmTarget = '1.8' - } - - sourceSets { - main.java.srcDirs += 'src/main/kotlin' + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } defaultConfig { - applicationId "com.baseflow.example" - minSdkVersion 21 - targetSdkVersion 33 - versionCode flutterVersionCode.toInteger() - versionName flutterVersionName + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). + applicationId = "com.example.example" + // You can update the following values to match your application needs. + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration. + minSdk = flutter.minSdkVersion + targetSdk = flutter.targetSdkVersion + versionCode = flutterVersionCode.toInteger() + versionName = flutterVersionName } buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig signingConfigs.debug + signingConfig = signingConfigs.debug } } } flutter { - source '../..' -} - -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" + source = "../.." } diff --git a/flutter_cache_manager/example/android/app/src/main/AndroidManifest.xml b/flutter_cache_manager/example/android/app/src/main/AndroidManifest.xml index 19b862ec..74a78b93 100644 --- a/flutter_cache_manager/example/android/app/src/main/AndroidManifest.xml +++ b/flutter_cache_manager/example/android/app/src/main/AndroidManifest.xml @@ -7,6 +7,7 @@ android:name=".MainActivity" android:exported="true" android:launchMode="singleTop" + android:taskAffinity="" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" @@ -30,4 +31,15 @@ android:name="flutterEmbedding" android:value="2" /> + + + + + + + diff --git a/flutter_cache_manager/example/android/app/src/main/kotlin/com/baseflow/example/MainActivity.kt b/flutter_cache_manager/example/android/app/src/main/kotlin/com/baseflow/example/MainActivity.kt deleted file mode 100644 index 1751a1f6..00000000 --- a/flutter_cache_manager/example/android/app/src/main/kotlin/com/baseflow/example/MainActivity.kt +++ /dev/null @@ -1,6 +0,0 @@ -package com.baseflow.example - -import io.flutter.embedding.android.FlutterActivity - -class MainActivity: FlutterActivity() { -} diff --git a/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt b/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt new file mode 100644 index 00000000..70f8f08f --- /dev/null +++ b/flutter_cache_manager/example/android/app/src/main/kotlin/com/example/example/MainActivity.kt @@ -0,0 +1,5 @@ +package com.example.example + +import io.flutter.embedding.android.FlutterActivity + +class MainActivity: FlutterActivity() diff --git a/flutter_cache_manager/example/android/build.gradle b/flutter_cache_manager/example/android/build.gradle index ce647a43..d2ffbffa 100644 --- a/flutter_cache_manager/example/android/build.gradle +++ b/flutter_cache_manager/example/android/build.gradle @@ -1,16 +1,3 @@ -buildscript { - ext.kotlin_version = '1.7.10' - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.4.2' - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - allprojects { repositories { google() @@ -18,12 +5,12 @@ allprojects { } } -rootProject.buildDir = '../build' +rootProject.buildDir = "../build" subprojects { project.buildDir = "${rootProject.buildDir}/${project.name}" } subprojects { - project.evaluationDependsOn(':app') + project.evaluationDependsOn(":app") } tasks.register("clean", Delete) { diff --git a/flutter_cache_manager/example/android/gradle.properties b/flutter_cache_manager/example/android/gradle.properties index 94adc3a3..3b5b324f 100644 --- a/flutter_cache_manager/example/android/gradle.properties +++ b/flutter_cache_manager/example/android/gradle.properties @@ -1,3 +1,3 @@ -org.gradle.jvmargs=-Xmx1536M +org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError android.useAndroidX=true android.enableJetifier=true diff --git a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties index ceccc3a8..e1ca574e 100644 --- a/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties +++ b/flutter_cache_manager/example/android/gradle/wrapper/gradle-wrapper.properties @@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip diff --git a/flutter_cache_manager/example/android/settings.gradle b/flutter_cache_manager/example/android/settings.gradle index 44e62bcf..536165d3 100644 --- a/flutter_cache_manager/example/android/settings.gradle +++ b/flutter_cache_manager/example/android/settings.gradle @@ -1,11 +1,25 @@ -include ':app' +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() -def localPropertiesFile = new File(rootProject.projectDir, "local.properties") -def properties = new Properties() + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") -assert localPropertiesFile.exists() -localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} -def flutterSdkPath = properties.getProperty("flutter.sdk") -assert flutterSdkPath != null, "flutter.sdk not set in local.properties" -apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "7.3.0" apply false + id "org.jetbrains.kotlin.android" version "1.7.10" apply false +} + +include ":app" diff --git a/flutter_cache_manager/example/ios/Flutter/AppFrameworkInfo.plist b/flutter_cache_manager/example/ios/Flutter/AppFrameworkInfo.plist index 9625e105..7c569640 100644 --- a/flutter_cache_manager/example/ios/Flutter/AppFrameworkInfo.plist +++ b/flutter_cache_manager/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/flutter_cache_manager/example/ios/Podfile b/flutter_cache_manager/example/ios/Podfile index fdcc671e..d97f17e2 100644 --- a/flutter_cache_manager/example/ios/Podfile +++ b/flutter_cache_manager/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '11.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj b/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj index c75eb654..506236fe 100644 --- a/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj +++ b/flutter_cache_manager/example/ios/Runner.xcodeproj/project.pbxproj @@ -14,8 +14,6 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; - A89E80E5C66383851D85960C /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7704FAAF0269F6CE42DFB4D6 /* Pods_Runner.framework */; }; - F7BD10BFE0340F283E6E93AA /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A27122686E56836116819985 /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -44,16 +42,11 @@ /* Begin PBXFileReference section */ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; }; 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; }; - 1FFD3A151B2AE9CB0F79637E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; - 28A91B98ACD307F50795CE63 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 2A5D500DD59C5ABD8BC320E9 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; - 2BDBBCDC95EE9D699340FEB0 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; 331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; }; 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; - 7704FAAF0269F6CE42DFB4D6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; }; 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; }; @@ -62,25 +55,13 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - A27122686E56836116819985 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BFBE6121C722D36CAD68B894 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; - E65907C93E9A58DEA8ECEC68 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - 0356ECBC3811FC8EF96B797F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - F7BD10BFE0340F283E6E93AA /* Pods_RunnerTests.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; 97C146EB1CF9000F007C117D /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - A89E80E5C66383851D85960C /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -113,8 +94,6 @@ 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, 331C8082294A63A400263BE5 /* RunnerTests */, - F70FE31A2C97E1C947ACFAE4 /* Pods */, - F197309FCBE2E2C735CA3658 /* Frameworks */, ); sourceTree = ""; }; @@ -142,29 +121,6 @@ path = Runner; sourceTree = ""; }; - F197309FCBE2E2C735CA3658 /* Frameworks */ = { - isa = PBXGroup; - children = ( - 7704FAAF0269F6CE42DFB4D6 /* Pods_Runner.framework */, - A27122686E56836116819985 /* Pods_RunnerTests.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - F70FE31A2C97E1C947ACFAE4 /* Pods */ = { - isa = PBXGroup; - children = ( - 1FFD3A151B2AE9CB0F79637E /* Pods-Runner.debug.xcconfig */, - 2A5D500DD59C5ABD8BC320E9 /* Pods-Runner.release.xcconfig */, - 28A91B98ACD307F50795CE63 /* Pods-Runner.profile.xcconfig */, - 2BDBBCDC95EE9D699340FEB0 /* Pods-RunnerTests.debug.xcconfig */, - E65907C93E9A58DEA8ECEC68 /* Pods-RunnerTests.release.xcconfig */, - BFBE6121C722D36CAD68B894 /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -172,10 +128,8 @@ isa = PBXNativeTarget; buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - A7C74AA6240117247B9AC070 /* [CP] Check Pods Manifest.lock */, 331C807D294A63A400263BE5 /* Sources */, 331C807F294A63A400263BE5 /* Resources */, - 0356ECBC3811FC8EF96B797F /* Frameworks */, ); buildRules = ( ); @@ -191,14 +145,12 @@ isa = PBXNativeTarget; buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 62496165A00AB805F616810E /* [CP] Check Pods Manifest.lock */, 9740EEB61CF901F6004384FC /* Run Script */, 97C146EA1CF9000F007C117D /* Sources */, 97C146EB1CF9000F007C117D /* Frameworks */, 97C146EC1CF9000F007C117D /* Resources */, 9705A1C41CF9048500538489 /* Embed Frameworks */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */, - A9CBAD837CA4D9F4D3F704C5 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -215,7 +167,8 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1300; + BuildIndependentTargetsInParallel = YES; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { @@ -285,28 +238,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin"; }; - 62496165A00AB805F616810E /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -322,45 +253,6 @@ shellPath = /bin/sh; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; }; - A7C74AA6240117247B9AC070 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - A9CBAD837CA4D9F4D3F704C5 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -415,6 +307,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -444,6 +337,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -452,7 +346,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -468,14 +362,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = NWAXZVJAA5; + DEVELOPMENT_TEAM = 6UEL98K25V; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; @@ -485,14 +379,13 @@ }; 331C8088294A63A400263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 2BDBBCDC95EE9D699340FEB0 /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -503,14 +396,13 @@ }; 331C8089294A63A400263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = E65907C93E9A58DEA8ECEC68 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -519,14 +411,13 @@ }; 331C808A294A63A400263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BFBE6121C722D36CAD68B894 /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CODE_SIGN_STYLE = Automatic; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Runner.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Runner"; @@ -537,6 +428,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -566,6 +458,7 @@ DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -580,7 +473,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -592,6 +485,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; @@ -621,6 +515,7 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -629,7 +524,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -647,14 +542,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = NWAXZVJAA5; + DEVELOPMENT_TEAM = 6UEL98K25V; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; @@ -670,14 +565,14 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; - DEVELOPMENT_TEAM = NWAXZVJAA5; + DEVELOPMENT_TEAM = 6UEL98K25V; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", ); - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 5.0; diff --git a/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index e42adcb3..8e3ca5df 100644 --- a/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/flutter_cache_manager/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - diff --git a/flutter_cache_manager/example/ios/Runner/AppDelegate.swift b/flutter_cache_manager/example/ios/Runner/AppDelegate.swift index 70693e4a..9074fee9 100644 --- a/flutter_cache_manager/example/ios/Runner/AppDelegate.swift +++ b/flutter_cache_manager/example/ios/Runner/AppDelegate.swift @@ -1,5 +1,5 @@ -import UIKit import Flutter +import UIKit @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { diff --git a/flutter_cache_manager/example/ios/Runner/Info.plist b/flutter_cache_manager/example/ios/Runner/Info.plist index 7f553465..5458fc41 100644 --- a/flutter_cache_manager/example/ios/Runner/Info.plist +++ b/flutter_cache_manager/example/ios/Runner/Info.plist @@ -41,8 +41,6 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight - UIViewControllerBasedStatusBarAppearance - CADisableMinimumFrameDurationOnPhone UIApplicationSupportsIndirectInputEvents diff --git a/flutter_cache_manager/example/macos/Runner.xcodeproj/project.pbxproj b/flutter_cache_manager/example/macos/Runner.xcodeproj/project.pbxproj index 41d3694e..daa7bf13 100644 --- a/flutter_cache_manager/example/macos/Runner.xcodeproj/project.pbxproj +++ b/flutter_cache_manager/example/macos/Runner.xcodeproj/project.pbxproj @@ -27,8 +27,6 @@ 33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; }; 33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; }; 33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; }; - D5B01A320121EDFB3C6E5ACE /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CC57B9A51BACFF27C67AB72D /* Pods_Runner.framework */; }; - ED974FA40384DB36751215A8 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE2C8A8FDAE0A7FDAB1E4DBD /* Pods_RunnerTests.framework */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -62,13 +60,11 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 0F691A0E4B4C9F59E57294BC /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = ""; }; - 28DB72531F61FBC40F3CEDAA /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = ""; }; 331C80D5294CF71000263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 331C80D7294CF71000263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = ""; }; 333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = ""; }; 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = ""; }; - 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 33CC10ED2044A3C60003C045 /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = ""; }; 33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; @@ -80,14 +76,8 @@ 33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = ""; }; 33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = ""; }; 33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = ""; }; - 42144AD4456D168DBD9EA36B /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = ""; }; - 421819CD2EE32280AEA755EC /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = ""; }; 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = ""; }; 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = ""; }; - BAD57FC1C963D684F07ED177 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = ""; }; - CC57B9A51BACFF27C67AB72D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - DE2C8A8FDAE0A7FDAB1E4DBD /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - FF9DC3FB6BB66E62F5038DE0 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -95,7 +85,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - ED974FA40384DB36751215A8 /* Pods_RunnerTests.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -103,7 +92,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - D5B01A320121EDFB3C6E5ACE /* Pods_Runner.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -137,7 +125,6 @@ 331C80D6294CF71000263BE5 /* RunnerTests */, 33CC10EE2044A3C60003C045 /* Products */, D73912EC22F37F3D000D13A0 /* Frameworks */, - 82766BBE125D5C25EDDF556B /* Pods */, ); sourceTree = ""; }; @@ -185,25 +172,9 @@ path = Runner; sourceTree = ""; }; - 82766BBE125D5C25EDDF556B /* Pods */ = { - isa = PBXGroup; - children = ( - FF9DC3FB6BB66E62F5038DE0 /* Pods-Runner.debug.xcconfig */, - 421819CD2EE32280AEA755EC /* Pods-Runner.release.xcconfig */, - 0F691A0E4B4C9F59E57294BC /* Pods-Runner.profile.xcconfig */, - 42144AD4456D168DBD9EA36B /* Pods-RunnerTests.debug.xcconfig */, - BAD57FC1C963D684F07ED177 /* Pods-RunnerTests.release.xcconfig */, - 28DB72531F61FBC40F3CEDAA /* Pods-RunnerTests.profile.xcconfig */, - ); - name = Pods; - path = Pods; - sourceTree = ""; - }; D73912EC22F37F3D000D13A0 /* Frameworks */ = { isa = PBXGroup; children = ( - CC57B9A51BACFF27C67AB72D /* Pods_Runner.framework */, - DE2C8A8FDAE0A7FDAB1E4DBD /* Pods_RunnerTests.framework */, ); name = Frameworks; sourceTree = ""; @@ -215,7 +186,6 @@ isa = PBXNativeTarget; buildConfigurationList = 331C80DE294CF71000263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */; buildPhases = ( - D3A74C11E776FE7C8B976997 /* [CP] Check Pods Manifest.lock */, 331C80D1294CF70F00263BE5 /* Sources */, 331C80D2294CF70F00263BE5 /* Frameworks */, 331C80D3294CF70F00263BE5 /* Resources */, @@ -234,13 +204,11 @@ isa = PBXNativeTarget; buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */; buildPhases = ( - 1F2AC582A47D8424DC730A99 /* [CP] Check Pods Manifest.lock */, 33CC10E92044A3C60003C045 /* Sources */, 33CC10EA2044A3C60003C045 /* Frameworks */, 33CC10EB2044A3C60003C045 /* Resources */, 33CC110E2044A8840003C045 /* Bundle Framework */, 3399D490228B24CF009A79C7 /* ShellScript */, - D383C0B9CE6563DCF1551308 /* [CP] Embed Pods Frameworks */, ); buildRules = ( ); @@ -258,8 +226,9 @@ 33CC10E52044A3C60003C045 /* Project object */ = { isa = PBXProject; attributes = { + BuildIndependentTargetsInParallel = YES; LastSwiftUpdateCheck = 0920; - LastUpgradeCheck = 1300; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C80D4294CF70F00263BE5 = { @@ -322,28 +291,6 @@ /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ - 1F2AC582A47D8424DC730A99 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; 3399D490228B24CF009A79C7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; alwaysOutOfDate = 1; @@ -382,45 +329,6 @@ shellPath = /bin/sh; shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire"; }; - D383C0B9CE6563DCF1551308 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; - D3A74C11E776FE7C8B976997 /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; /* End PBXShellScriptBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ @@ -472,13 +380,12 @@ /* Begin XCBuildConfiguration section */ 331C80DB294CF71000263BE5 /* Debug */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 42144AD4456D168DBD9EA36B /* Pods-RunnerTests.debug.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; @@ -487,13 +394,12 @@ }; 331C80DC294CF71000263BE5 /* Release */ = { isa = XCBuildConfiguration; - baseConfigurationReference = BAD57FC1C963D684F07ED177 /* Pods-RunnerTests.release.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; @@ -502,13 +408,12 @@ }; 331C80DD294CF71000263BE5 /* Profile */ = { isa = XCBuildConfiguration; - baseConfigurationReference = 28DB72531F61FBC40F3CEDAA /* Pods-RunnerTests.profile.xcconfig */; buildSettings = { BUNDLE_LOADER = "$(TEST_HOST)"; CURRENT_PROJECT_VERSION = 1; GENERATE_INFOPLIST_FILE = YES; MARKETING_VERSION = 1.0; - PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example.RunnerTests; + PRODUCT_BUNDLE_IDENTIFIER = com.example.example.RunnerTests; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 5.0; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/example.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/example"; @@ -520,6 +425,7 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -543,9 +449,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; @@ -593,6 +501,7 @@ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -616,9 +525,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; @@ -646,6 +557,7 @@ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES; CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; @@ -669,9 +581,11 @@ CLANG_WARN_SUSPICIOUS_MOVE = YES; CODE_SIGN_IDENTITY = "-"; COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_USER_SCRIPT_SANDBOXING = NO; GCC_C_LANGUAGE_STANDARD = gnu11; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; diff --git a/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 8fedab68..15368ecc 100644 --- a/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/flutter_cache_manager/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ - - diff --git a/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig b/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig index 8705ced4..92fb3cd5 100644 --- a/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig +++ b/flutter_cache_manager/example/macos/Runner/Configs/AppInfo.xcconfig @@ -8,7 +8,7 @@ PRODUCT_NAME = example // The application's bundle identifier -PRODUCT_BUNDLE_IDENTIFIER = com.baseflow.example +PRODUCT_BUNDLE_IDENTIFIER = com.example.example // The copyright displayed in application information -PRODUCT_COPYRIGHT = Copyright © 2023 com.baseflow. All rights reserved. +PRODUCT_COPYRIGHT = Copyright © 2024 com.example. All rights reserved. diff --git a/flutter_cache_manager/example/macos/RunnerTests/RunnerTests.swift b/flutter_cache_manager/example/macos/RunnerTests/RunnerTests.swift index 5418c9f5..61f3bd1f 100644 --- a/flutter_cache_manager/example/macos/RunnerTests/RunnerTests.swift +++ b/flutter_cache_manager/example/macos/RunnerTests/RunnerTests.swift @@ -1,5 +1,5 @@ -import FlutterMacOS import Cocoa +import FlutterMacOS import XCTest class RunnerTests: XCTestCase { diff --git a/flutter_cache_manager/example/pubspec.yaml b/flutter_cache_manager/example/pubspec.yaml index acace8eb..de16453a 100644 --- a/flutter_cache_manager/example/pubspec.yaml +++ b/flutter_cache_manager/example/pubspec.yaml @@ -3,21 +3,21 @@ description: A project that showcases usage of flutter_cache_manager publish_to: none version: 1.0.0+1 environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: baseflow_plugin_template: ^2.1.2 - cupertino_icons: ^1.0.5 + cupertino_icons: ^1.0.8 flutter: sdk: flutter flutter_cache_manager: path: ../ - url_launcher: ^6.1.10 + url_launcher: ^6.2.1 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^2.0.1 + flutter_lints: ^3.0.2 flutter: uses-material-design: true diff --git a/flutter_cache_manager/example/web/index.html b/flutter_cache_manager/example/web/index.html index 8be2c326..1aa025dd 100644 --- a/flutter_cache_manager/example/web/index.html +++ b/flutter_cache_manager/example/web/index.html @@ -18,7 +18,7 @@ - + @@ -31,29 +31,8 @@ example - - - - - + diff --git a/flutter_cache_manager/example/web/manifest.json b/flutter_cache_manager/example/web/manifest.json index 94c8eb03..096edf8f 100644 --- a/flutter_cache_manager/example/web/manifest.json +++ b/flutter_cache_manager/example/web/manifest.json @@ -5,7 +5,7 @@ "display": "standalone", "background_color": "#0175C2", "theme_color": "#0175C2", - "description": "A project that showcases usage of flutter_cache_manager", + "description": "A new Flutter project.", "orientation": "portrait-primary", "prefer_related_applications": false, "icons": [ diff --git a/flutter_cache_manager/example/windows/CMakeLists.txt b/flutter_cache_manager/example/windows/CMakeLists.txt index 13786727..d960948a 100644 --- a/flutter_cache_manager/example/windows/CMakeLists.txt +++ b/flutter_cache_manager/example/windows/CMakeLists.txt @@ -8,7 +8,7 @@ set(BINARY_NAME "example") # Explicitly opt in to modern CMake behaviors to avoid warnings with recent # versions of CMake. -cmake_policy(SET CMP0063 NEW) +cmake_policy(VERSION 3.14...3.25) # Define build configuration option. get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) @@ -87,6 +87,12 @@ if(PLUGIN_BUNDLED_LIBRARIES) COMPONENT Runtime) endif() +# Copy the native assets provided by the build.dart from all packages. +set(NATIVE_ASSETS_DIR "${PROJECT_BUILD_DIR}native_assets/windows/") +install(DIRECTORY "${NATIVE_ASSETS_DIR}" + DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" + COMPONENT Runtime) + # Fully re-copy the assets directory on each build to avoid having stale files # from a previous install. set(FLUTTER_ASSET_DIR_NAME "flutter_assets") diff --git a/flutter_cache_manager/example/windows/flutter/CMakeLists.txt b/flutter_cache_manager/example/windows/flutter/CMakeLists.txt index 930d2071..903f4899 100644 --- a/flutter_cache_manager/example/windows/flutter/CMakeLists.txt +++ b/flutter_cache_manager/example/windows/flutter/CMakeLists.txt @@ -10,6 +10,11 @@ include(${EPHEMERAL_DIR}/generated_config.cmake) # https://github.com/flutter/flutter/issues/57146. set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") +# Set fallback configurations for older versions of the flutter tool. +if (NOT DEFINED FLUTTER_TARGET_PLATFORM) + set(FLUTTER_TARGET_PLATFORM "windows-x64") +endif() + # === Flutter Library === set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") @@ -92,7 +97,7 @@ add_custom_command( COMMAND ${CMAKE_COMMAND} -E env ${FLUTTER_TOOL_ENVIRONMENT} "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" - windows-x64 $ + ${FLUTTER_TARGET_PLATFORM} $ VERBATIM ) add_custom_target(flutter_assemble DEPENDS diff --git a/flutter_cache_manager/example/windows/runner/Runner.rc b/flutter_cache_manager/example/windows/runner/Runner.rc index bae43fce..687e6bd2 100644 --- a/flutter_cache_manager/example/windows/runner/Runner.rc +++ b/flutter_cache_manager/example/windows/runner/Runner.rc @@ -89,11 +89,11 @@ BEGIN BEGIN BLOCK "040904e4" BEGIN - VALUE "CompanyName", "com.baseflow" "\0" + VALUE "CompanyName", "com.example" "\0" VALUE "FileDescription", "example" "\0" VALUE "FileVersion", VERSION_AS_STRING "\0" VALUE "InternalName", "example" "\0" - VALUE "LegalCopyright", "Copyright (C) 2023 com.baseflow. All rights reserved." "\0" + VALUE "LegalCopyright", "Copyright (C) 2024 com.example. All rights reserved." "\0" VALUE "OriginalFilename", "example.exe" "\0" VALUE "ProductName", "example" "\0" VALUE "ProductVersion", VERSION_AS_STRING "\0" diff --git a/flutter_cache_manager/example/windows/runner/flutter_window.cpp b/flutter_cache_manager/example/windows/runner/flutter_window.cpp index b25e363e..955ee303 100644 --- a/flutter_cache_manager/example/windows/runner/flutter_window.cpp +++ b/flutter_cache_manager/example/windows/runner/flutter_window.cpp @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() { this->Show(); }); + // Flutter can complete the first frame before the "show window" callback is + // registered. The following call ensures a frame is pending to ensure the + // window is shown. It is a no-op if the first frame hasn't completed yet. + flutter_controller_->ForceRedraw(); + return true; } diff --git a/flutter_cache_manager/example/windows/runner/utils.cpp b/flutter_cache_manager/example/windows/runner/utils.cpp index b2b08734..3a0b4651 100644 --- a/flutter_cache_manager/example/windows/runner/utils.cpp +++ b/flutter_cache_manager/example/windows/runner/utils.cpp @@ -45,13 +45,13 @@ std::string Utf8FromUtf16(const wchar_t* utf16_string) { if (utf16_string == nullptr) { return std::string(); } - int target_length = ::WideCharToMultiByte( + unsigned int target_length = ::WideCharToMultiByte( CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, -1, nullptr, 0, nullptr, nullptr) -1; // remove the trailing null character int input_length = (int)wcslen(utf16_string); std::string utf8_string; - if (target_length <= 0 || target_length > utf8_string.max_size()) { + if (target_length == 0 || target_length > utf8_string.max_size()) { return utf8_string; } utf8_string.resize(target_length); diff --git a/flutter_cache_manager/lib/flutter_cache_manager.dart b/flutter_cache_manager/lib/flutter_cache_manager.dart index be1d3b26..943d910a 100644 --- a/flutter_cache_manager/lib/flutter_cache_manager.dart +++ b/flutter_cache_manager/lib/flutter_cache_manager.dart @@ -9,5 +9,7 @@ export 'src/config/config.dart'; export 'src/logger.dart'; export 'src/result/result.dart'; export 'src/storage/cache_info_repositories/cache_info_repositories.dart'; +export 'src/storage/cache_object.dart'; +export 'src/storage/file_system/file_system.dart'; export 'src/web/file_service.dart'; export 'src/web/web_helper.dart' show HttpExceptionWithStatus; diff --git a/flutter_cache_manager/lib/src/cache_manager.dart b/flutter_cache_manager/lib/src/cache_manager.dart index 747beb9a..82ac52a9 100644 --- a/flutter_cache_manager/lib/src/cache_manager.dart +++ b/flutter_cache_manager/lib/src/cache_manager.dart @@ -5,7 +5,6 @@ import 'package:file/file.dart'; import 'package:flutter/foundation.dart' show visibleForTesting; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/cache_store.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; import 'package:flutter_cache_manager/src/web/web_helper.dart'; import 'package:uuid/uuid.dart'; @@ -48,6 +47,9 @@ class CacheManager implements BaseCacheManager { final Config _config; + /// Get the config + Config get config => _config; + /// Store helper for cached files final CacheStore _store; @@ -152,6 +154,15 @@ class CacheManager implements BaseCacheManager { if (cacheFile == null && streamController.hasListener) { streamController.addError(e); } + + if (cacheFile != null && + e is HttpExceptionWithStatus && + e.statusCode == 404) { + if (streamController.hasListener) { + streamController.addError(e); + } + await removeFile(key); + } } } streamController.close(); diff --git a/flutter_cache_manager/lib/src/cache_store.dart b/flutter_cache_manager/lib/src/cache_store.dart index 395e3eaf..3ad735ac 100644 --- a/flutter_cache_manager/lib/src/cache_store.dart +++ b/flutter_cache_manager/lib/src/cache_store.dart @@ -1,8 +1,8 @@ import 'dart:async'; +import 'dart:io'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; -import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart'; +import 'dart:io' as io; ///Flutter Cache Manager ///Copyright (c) 2019 Rene Floor @@ -182,14 +182,34 @@ class CacheStore { if (_futureCache.containsKey(cacheObject.key)) { _futureCache.remove(cacheObject.key); } - final file = await fileSystem.createFile(cacheObject.relativePath); - if (await file.exists()) { - await file.delete(); + final file = io.File(cacheObject.relativePath); + + if (file.existsSync()) { + try { + await file.delete(); + // ignore: unused_catch_clause + } on PathNotFoundException catch (e) { + // File has already been deleted. Do nothing #184 + } } } + bool memoryCacheContainsKey(String key) { + return _memCache.containsKey(key); + } + Future dispose() async { final provider = await _cacheInfoRepository; await provider.close(); } + + Future getCacheSize() async { + final provider = await _cacheInfoRepository; + final allObjects = await provider.getAllObjects(); + int total = 0; + for (var cacheObject in allObjects) { + total += cacheObject.length ?? 0; + } + return total; + } } diff --git a/flutter_cache_manager/lib/src/config/_config_io.dart b/flutter_cache_manager/lib/src/config/_config_io.dart index 9ff7eadf..67eb8cb3 100644 --- a/flutter_cache_manager/lib/src/config/_config_io.dart +++ b/flutter_cache_manager/lib/src/config/_config_io.dart @@ -2,8 +2,6 @@ import 'dart:io'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/config/config.dart' as def; -import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart'; -import 'package:flutter_cache_manager/src/storage/file_system/file_system_io.dart'; class Config implements def.Config { Config( diff --git a/flutter_cache_manager/lib/src/config/_config_web.dart b/flutter_cache_manager/lib/src/config/_config_web.dart index 3b1e433c..99e4f3b8 100644 --- a/flutter_cache_manager/lib/src/config/_config_web.dart +++ b/flutter_cache_manager/lib/src/config/_config_web.dart @@ -2,7 +2,6 @@ import 'package:flutter_cache_manager/src/config/config.dart' as def; import 'package:flutter_cache_manager/src/storage/cache_info_repositories/cache_info_repository.dart'; import 'package:flutter_cache_manager/src/storage/cache_info_repositories/non_storing_object_provider.dart'; import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart'; -import 'package:flutter_cache_manager/src/storage/file_system/file_system_web.dart'; import 'package:flutter_cache_manager/src/web/file_service.dart'; class Config implements def.Config { diff --git a/flutter_cache_manager/lib/src/config/config.dart b/flutter_cache_manager/lib/src/config/config.dart index a0dc4894..cd25bbf7 100644 --- a/flutter_cache_manager/lib/src/config/config.dart +++ b/flutter_cache_manager/lib/src/config/config.dart @@ -2,7 +2,6 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/config/_config_unsupported.dart' if (dart.library.html) '_config_web.dart' if (dart.library.io) '_config_io.dart' as impl; -import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart'; abstract class Config { /// Config file for the CacheManager. diff --git a/flutter_cache_manager/lib/src/result/download_progress.dart b/flutter_cache_manager/lib/src/result/download_progress.dart index 4dffb0e6..54b6b576 100644 --- a/flutter_cache_manager/lib/src/result/download_progress.dart +++ b/flutter_cache_manager/lib/src/result/download_progress.dart @@ -2,8 +2,7 @@ import 'package:flutter_cache_manager/src/result/file_response.dart'; /// Progress of the file that is being downloaded from the [originalUrl]. class DownloadProgress extends FileResponse { - const DownloadProgress(String originalUrl, this.totalSize, this.downloaded) - : super(originalUrl); + const DownloadProgress(super.originalUrl, this.totalSize, this.downloaded); /// download progress as an double between 0 and 1. /// When the final size is unknown or the downloaded size exceeds the total diff --git a/flutter_cache_manager/lib/src/result/file_info.dart b/flutter_cache_manager/lib/src/result/file_info.dart index 1023e3ef..ae874830 100644 --- a/flutter_cache_manager/lib/src/result/file_info.dart +++ b/flutter_cache_manager/lib/src/result/file_info.dart @@ -12,7 +12,8 @@ enum FileSource { NA, Cache, Online } /// FileInfo contains the fetch File next to some info on the validity and /// the origin of the file. class FileInfo extends FileResponse { - const FileInfo(this.file, this.source, this.validTill, String originalUrl) + const FileInfo(this.file, this.source, this.validTill, String originalUrl, + {this.statusCode = 200}) : super(originalUrl); /// Fetched file @@ -24,4 +25,6 @@ class FileInfo extends FileResponse { /// Validity date of the file. After this date the validity is not guaranteed /// and the CacheManager will try to update the file. final DateTime validTill; + + final int statusCode; } diff --git a/flutter_cache_manager/lib/src/storage/file_system/file_system.dart b/flutter_cache_manager/lib/src/storage/file_system/file_system.dart index e5bb1427..2cd9764b 100644 --- a/flutter_cache_manager/lib/src/storage/file_system/file_system.dart +++ b/flutter_cache_manager/lib/src/storage/file_system/file_system.dart @@ -1,3 +1,7 @@ +export 'file_system.dart'; +export 'file_system_io.dart'; +export 'file_system_web.dart'; + import 'package:file/file.dart'; abstract class FileSystem { diff --git a/flutter_cache_manager/lib/src/web/web_helper.dart b/flutter_cache_manager/lib/src/web/web_helper.dart index 1b7e53a5..20685484 100644 --- a/flutter_cache_manager/lib/src/web/web_helper.dart +++ b/flutter_cache_manager/lib/src/web/web_helper.dart @@ -6,7 +6,6 @@ import 'package:clock/clock.dart'; import 'package:flutter/foundation.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/cache_store.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; import 'package:flutter_cache_manager/src/web/queue_item.dart'; import 'package:rxdart/rxdart.dart'; import 'package:uuid/uuid.dart'; @@ -101,9 +100,6 @@ class WebHelper { Future _download( CacheObject cacheObject, Map? authHeaders) { final headers = {}; - if (authHeaders != null) { - headers.addAll(authHeaders); - } final etag = cacheObject.eTag; @@ -112,6 +108,10 @@ class WebHelper { headers[HttpHeaders.ifNoneMatchHeader] = etag; } + if (authHeaders != null) { + headers.addAll(authHeaders); + } + return fileFetcher.get(cacheObject.url, headers: headers); } @@ -153,6 +153,7 @@ class WebHelper { FileSource.Online, newCacheObject.validTill, newCacheObject.url, + statusCode: response.statusCode, ); } diff --git a/flutter_cache_manager/pubspec.yaml b/flutter_cache_manager/pubspec.yaml index 903d4c94..cf64132c 100644 --- a/flutter_cache_manager/pubspec.yaml +++ b/flutter_cache_manager/pubspec.yaml @@ -1,29 +1,37 @@ name: flutter_cache_manager description: Generic cache manager for flutter. Saves web files on the storages of the device and saves the cache info using sqflite. -version: 3.3.1 +version: 3.4.0 homepage: https://github.com/Baseflow/flutter_cache_manager/tree/develop/flutter_cache_manager topics: - cache - cache-manager environment: - sdk: '>=2.17.0 <4.0.0' + sdk: '>=3.0.0 <4.0.0' dependencies: - clock: ^1.1.0 - collection: ^1.15.0 - file: '>=6.1.4 <8.0.0' + clock: ^1.1.1 + collection: ^1.18.0 + file: ^7.0.0 flutter: sdk: flutter - http: '>=0.13.0 <2.0.0' - path: ^1.8.0 - path_provider: ^2.0.0 - rxdart: '>=0.26.0 <0.28.0' - sqflite: ^2.0.0+4 - uuid: '>=3.0.0 <5.0.0' + http: ^1.2.0 + path: ^1.9.0 + path_provider: ^2.1.2 + rxdart: '>=0.27.7 <0.29.0' + sqflite: ^2.3.0 + uuid: ^4.4.0 dev_dependencies: - build_runner: ^2.0.0 - flutter_lints: ^2.0.1 + build_runner: ^2.4.11 + flutter_lints: ^4.0.0 flutter_test: sdk: flutter - mockito: ^5.0.0 + mockito: ^5.4.4 + +platforms: + android: + ios: + linux: + macos: + web: + windows: diff --git a/flutter_cache_manager/test/cache_manager_test.dart b/flutter_cache_manager/test/cache_manager_test.dart index 85f5f50b..c4be9381 100644 --- a/flutter_cache_manager/test/cache_manager_test.dart +++ b/flutter_cache_manager/test/cache_manager_test.dart @@ -5,7 +5,6 @@ import 'package:clock/clock.dart'; import 'package:file/memory.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/cache_store.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; import 'package:flutter_cache_manager/src/web/web_helper.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; @@ -216,6 +215,42 @@ void main() { await expectLater(fileStream, emitsError(error)); verify(webHelper.downloadFile(any, key: anyNamed('key'))).called(1); }); + + test( + 'Outdated cacheFile should call to web, where 404 response should add Error to Stream and evict cache', + () async { + var fileName = 'test.jpg'; + var fileUrl = 'baseflow.com/test'; + var validTill = DateTime.now().subtract(const Duration(days: 1)); + + var store = MockCacheStore(); + var file = await createTestConfig().fileSystem.createFile(fileName); + var cachedInfo = FileInfo(file, FileSource.Cache, validTill, fileUrl); + var cacheObject = CacheObject(fileUrl, + relativePath: file.path, validTill: validTill, id: 123); + when(store.getFile(fileUrl)).thenAnswer((_) => Future.value(cachedInfo)); + when(store.retrieveCacheData(fileUrl)) + .thenAnswer((_) => Future.value(cacheObject)); + + var webHelper = MockWebHelper(); + var error = HttpExceptionWithStatus(404, 'Invalid statusCode: 404', + uri: Uri.parse(fileUrl)); + when(webHelper.downloadFile(fileUrl, key: anyNamed('key'))) + .thenThrow(error); + + var cacheManager = TestCacheManager( + createTestConfig(), + store: store, + webHelper: webHelper, + ); + + // ignore: deprecated_member_use_from_same_package + var fileStream = cacheManager.getFile(fileUrl); + await expectLater( + fileStream, emitsInOrder([cachedInfo, emitsError(error)])); + verify(webHelper.downloadFile(any, key: anyNamed('key'))).called(1); + verify(store.removeCachedFile(cacheObject)).called(1); + }); }); group('explicit key', () { test('Valid cacheFile should not call to web', () async { diff --git a/flutter_cache_manager/test/cache_store_test.dart b/flutter_cache_manager/test/cache_store_test.dart index 93a8bd7b..b9a7ccd4 100644 --- a/flutter_cache_manager/test/cache_store_test.dart +++ b/flutter_cache_manager/test/cache_store_test.dart @@ -11,6 +11,27 @@ import 'helpers/mock_cache_info_repository.dart'; import 'helpers/test_configuration.dart'; void main() { + late int fileId; + late String fileName; + late String fileUrl; + late DateTime validTill; + + late CacheObject cacheObject; + + setUp(() { + fileId = 666; + fileName = 'testimage.png'; + fileUrl = 'baseflow.com/test.png'; + validTill = DateTime(2017, 9, 7, 17, 30); + + cacheObject = CacheObject( + fileUrl, + relativePath: fileName, + id: fileId, + validTill: validTill, + ); + }); + group('Retrieving files from store', () { test('Store should return null when file not cached', () async { var repo = MockCacheInfoRepository(); @@ -21,9 +42,6 @@ void main() { }); test('Store should return FileInfo when file is cached', () async { - var fileName = 'testimage.png'; - var fileUrl = 'baseflow.com/test.png'; - var config = createTestConfig(); await config.returnsFile(fileName); config.returnsCacheObject(fileUrl, fileName, DateTime.now()); @@ -36,6 +54,28 @@ void main() { expect(await store.getFile('baseflow.com/test.png'), isNotNull); }); + test('Store should return null if file is not cached', () async { + var config = createTestConfig(); + await config.returnsFile(fileName); + config.returnsCacheObject(fileUrl, fileName, validTill, + id: fileId, key: fileUrl); + + var tempDir = createDir(); + await (await tempDir).childFile('testimage.png').create(); + + final store = CacheStore(config); + + final results = Future.wait([ + store.removeCachedFile(cacheObject), + store.removeCachedFile(cacheObject), + ]); + + expect( + () => results, + returnsNormally, + ); + }); + test('Store should return null when file is no longer cached', () async { var repo = MockCacheInfoRepository(); @@ -59,9 +99,6 @@ void main() { }); test('Store should return CacheInfo when file is cached', () async { - var fileName = 'testimage.png'; - var fileUrl = 'baseflow.com/test.png'; - var config = createTestConfig(); await config.returnsFile(fileName); config.returnsCacheObject(fileUrl, fileName, DateTime.now(), id: 1); @@ -74,8 +111,6 @@ void main() { test('Store should return CacheInfo from memory when asked twice', () async { - var fileName = 'testimage.png'; - var fileUrl = 'baseflow.com/test.png'; var validTill = DateTime.now(); var config = createTestConfig(); @@ -96,8 +131,6 @@ void main() { test( 'Store should return File from memcache only when file is retrieved before', () async { - var fileName = 'testimage.png'; - var fileUrl = 'baseflow.com/test.png'; var validTill = DateTime.now(); var config = createTestConfig(); @@ -110,6 +143,23 @@ void main() { await store.getFile(fileUrl); expect(await store.getFileFromMemory(fileUrl), isNotNull); }); + + test( + 'Store.memoryCacheContainsKey should return true if the key is present in the memory cache', + () async { + var config = createTestConfig(); + var store = CacheStore(config); + + var cacheObject = CacheObject( + 'baseflow.com/test.png', + relativePath: 'testimage.png', + validTill: clock.now().add(const Duration(days: 7)), + ); + await store.putFile(cacheObject); + + expect(store.memoryCacheContainsKey('baseflow.com/test.png'), true); + expect(store.memoryCacheContainsKey('unseen-file'), false); + }); }); group('Storing files in store', () { @@ -155,8 +205,6 @@ void main() { group('Removing files in store', () { test('Store should remove fileinfo from repo on delete', () async { - var fileName = 'testimage.png'; - var fileUrl = 'baseflow.com/test.png'; var validTill = DateTime.now(); var config = createTestConfig(); diff --git a/flutter_cache_manager/test/helpers/json_repo_helpers.dart b/flutter_cache_manager/test/helpers/json_repo_helpers.dart index cf3494c6..c275c0e9 100644 --- a/flutter_cache_manager/test/helpers/json_repo_helpers.dart +++ b/flutter_cache_manager/test/helpers/json_repo_helpers.dart @@ -4,7 +4,6 @@ import 'package:clock/clock.dart'; import 'package:file/file.dart'; import 'package:file/memory.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; const String databaseName = 'test'; const String path = diff --git a/flutter_cache_manager/test/mock.mocks.dart b/flutter_cache_manager/test/mock.mocks.dart index 65312d65..4805ba49 100644 --- a/flutter_cache_manager/test/mock.mocks.dart +++ b/flutter_cache_manager/test/mock.mocks.dart @@ -1,4 +1,4 @@ -// Mocks generated by Mockito 5.4.2 from annotations +// Mocks generated by Mockito 5.4.4 from annotations // in flutter_cache_manager/test/mock.dart. // Do not manually edit this file. @@ -10,13 +10,16 @@ import 'package:flutter_cache_manager/src/cache_store.dart' as _i6; import 'package:flutter_cache_manager/src/storage/cache_object.dart' as _i2; import 'package:flutter_cache_manager/src/storage/file_system/file_system.dart' as _i3; -import 'package:flutter_cache_manager/src/web/web_helper.dart' as _i7; +import 'package:flutter_cache_manager/src/web/web_helper.dart' as _i8; import 'package:mockito/mockito.dart' as _i1; +import 'package:mockito/src/dummies.dart' as _i7; // ignore_for_file: type=lint // ignore_for_file: avoid_redundant_argument_values // ignore_for_file: avoid_setters_without_getters // ignore_for_file: comment_references +// ignore_for_file: deprecated_member_use +// ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: implementation_imports // ignore_for_file: invalid_use_of_visible_for_testing_member // ignore_for_file: prefer_const_constructors @@ -102,6 +105,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future open() => (super.noSuchMethod( Invocation.method( @@ -110,6 +114,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future updateOrInsert(_i2.CacheObject? cacheObject) => (super.noSuchMethod( @@ -119,6 +124,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future<_i2.CacheObject> insert( _i2.CacheObject? cacheObject, { @@ -139,6 +145,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), )), ) as _i5.Future<_i2.CacheObject>); + @override _i5.Future<_i2.CacheObject?> get(String? key) => (super.noSuchMethod( Invocation.method( @@ -147,6 +154,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future<_i2.CacheObject?>.value(), ) as _i5.Future<_i2.CacheObject?>); + @override _i5.Future delete(int? id) => (super.noSuchMethod( Invocation.method( @@ -155,6 +163,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future deleteAll(Iterable? ids) => (super.noSuchMethod( Invocation.method( @@ -163,6 +172,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future update( _i2.CacheObject? cacheObject, { @@ -176,6 +186,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(0), ) as _i5.Future); + @override _i5.Future> getAllObjects() => (super.noSuchMethod( Invocation.method( @@ -185,6 +196,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock returnValue: _i5.Future>.value(<_i2.CacheObject>[]), ) as _i5.Future>); + @override _i5.Future> getObjectsOverCapacity(int? capacity) => (super.noSuchMethod( @@ -195,6 +207,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock returnValue: _i5.Future>.value(<_i2.CacheObject>[]), ) as _i5.Future>); + @override _i5.Future> getOldObjects(Duration? maxAge) => (super.noSuchMethod( @@ -205,6 +218,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock returnValue: _i5.Future>.value(<_i2.CacheObject>[]), ) as _i5.Future>); + @override _i5.Future close() => (super.noSuchMethod( Invocation.method( @@ -213,6 +227,7 @@ class MockCacheInfoRepositoryBase extends _i1.Mock ), returnValue: _i5.Future.value(false), ) as _i5.Future); + @override _i5.Future deleteDataFile() => (super.noSuchMethod( Invocation.method( @@ -240,6 +255,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { Invocation.getter(#cleanupRunMinInterval), ), ) as Duration); + @override set cleanupRunMinInterval(Duration? _cleanupRunMinInterval) => super.noSuchMethod( @@ -249,6 +265,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValueForMissingStub: null, ); + @override _i3.FileSystem get fileSystem => (super.noSuchMethod( Invocation.getter(#fileSystem), @@ -257,6 +274,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { Invocation.getter(#fileSystem), ), ) as _i3.FileSystem); + @override set fileSystem(_i3.FileSystem? _fileSystem) => super.noSuchMethod( Invocation.setter( @@ -265,6 +283,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValueForMissingStub: null, ); + @override DateTime get lastCleanupRun => (super.noSuchMethod( Invocation.getter(#lastCleanupRun), @@ -273,6 +292,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { Invocation.getter(#lastCleanupRun), ), ) as DateTime); + @override set lastCleanupRun(DateTime? _lastCleanupRun) => super.noSuchMethod( Invocation.setter( @@ -281,11 +301,16 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValueForMissingStub: null, ); + @override String get storeKey => (super.noSuchMethod( Invocation.getter(#storeKey), - returnValue: '', + returnValue: _i7.dummyValue( + this, + Invocation.getter(#storeKey), + ), ) as String); + @override _i5.Future<_i4.FileInfo?> getFile( String? key, { @@ -299,6 +324,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValue: _i5.Future<_i4.FileInfo?>.value(), ) as _i5.Future<_i4.FileInfo?>); + @override _i5.Future putFile(_i2.CacheObject? cacheObject) => (super.noSuchMethod( Invocation.method( @@ -308,6 +334,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future<_i2.CacheObject?> retrieveCacheData( String? key, { @@ -321,6 +348,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValue: _i5.Future<_i2.CacheObject?>.value(), ) as _i5.Future<_i2.CacheObject?>); + @override _i5.Future<_i4.FileInfo?> getFileFromMemory(String? key) => (super.noSuchMethod( @@ -330,6 +358,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValue: _i5.Future<_i4.FileInfo?>.value(), ) as _i5.Future<_i4.FileInfo?>); + @override _i5.Future emptyCache() => (super.noSuchMethod( Invocation.method( @@ -339,6 +368,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override void emptyMemoryCache() => super.noSuchMethod( Invocation.method( @@ -347,6 +377,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { ), returnValueForMissingStub: null, ); + @override _i5.Future removeCachedFile(_i2.CacheObject? cacheObject) => (super.noSuchMethod( @@ -357,6 +388,7 @@ class MockCacheStoreBase extends _i1.Mock implements _i6.CacheStore { returnValue: _i5.Future.value(), returnValueForMissingStub: _i5.Future.value(), ) as _i5.Future); + @override _i5.Future dispose() => (super.noSuchMethod( Invocation.method( @@ -381,6 +413,7 @@ class MockFileServiceBase extends _i1.Mock implements _i4.FileService { Invocation.getter(#concurrentFetches), returnValue: 0, ) as int); + @override set concurrentFetches(int? _concurrentFetches) => super.noSuchMethod( Invocation.setter( @@ -389,6 +422,7 @@ class MockFileServiceBase extends _i1.Mock implements _i4.FileService { ), returnValueForMissingStub: null, ); + @override _i5.Future<_i4.FileServiceResponse> get( String? url, { @@ -415,7 +449,7 @@ class MockFileServiceBase extends _i1.Mock implements _i4.FileService { /// A class which mocks [WebHelper]. /// /// See the documentation for Mockito's code generation for more information. -class MockWebHelper extends _i1.Mock implements _i7.WebHelper { +class MockWebHelper extends _i1.Mock implements _i8.WebHelper { MockWebHelper() { _i1.throwOnMissingStub(this); } @@ -428,11 +462,13 @@ class MockWebHelper extends _i1.Mock implements _i7.WebHelper { Invocation.getter(#fileFetcher), ), ) as _i4.FileService); + @override int get concurrentCalls => (super.noSuchMethod( Invocation.getter(#concurrentCalls), returnValue: 0, ) as int); + @override set concurrentCalls(int? _concurrentCalls) => super.noSuchMethod( Invocation.setter( @@ -441,6 +477,7 @@ class MockWebHelper extends _i1.Mock implements _i7.WebHelper { ), returnValueForMissingStub: null, ); + @override _i5.Stream<_i4.FileResponse> downloadFile( String? url, { diff --git a/flutter_cache_manager/test/repositories/migration_test.dart b/flutter_cache_manager/test/repositories/migration_test.dart index 44124637..a4330775 100644 --- a/flutter_cache_manager/test/repositories/migration_test.dart +++ b/flutter_cache_manager/test/repositories/migration_test.dart @@ -1,6 +1,5 @@ import 'package:collection/collection.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/flutter_cache_manager/test/web_helper_test.dart b/flutter_cache_manager/test/web_helper_test.dart index 45bb777d..661ac5ea 100644 --- a/flutter_cache_manager/test/web_helper_test.dart +++ b/flutter_cache_manager/test/web_helper_test.dart @@ -3,7 +3,6 @@ import 'dart:async'; import 'package:clock/clock.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; import 'package:flutter_cache_manager/src/cache_store.dart'; -import 'package:flutter_cache_manager/src/storage/cache_object.dart'; import 'package:flutter_cache_manager/src/web/web_helper.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:mockito/mockito.dart'; diff --git a/flutter_cache_manager_firebase/CHANGELOG.md b/flutter_cache_manager_firebase/CHANGELOG.md index ea848a30..d0d6fa3b 100644 --- a/flutter_cache_manager_firebase/CHANGELOG.md +++ b/flutter_cache_manager_firebase/CHANGELOG.md @@ -1,16 +1,35 @@ +## [2.1.0] - 2024-08-01 + +* Support setting a bucket +* Add retry options +* Updates dependencies + +## [2.0.3] - 2024-07-23 + +* Updates dependencies ([#457](https://github.com/Baseflow/flutter_cache_manager/pull/457)) + +## [2.0.2] - 2024-04-25 + +* Updates dependencies to their latest versions. + ## [2.0.1] - 2021-08-27 + * Update dependencies ## [2.0.0] - 2021-05-28 + * Update to null safety ## [1.1.0] - 2021-01-14 + * Update Firebase dependency ## [1.1.0-beta] - 2020-10-02 + * Update CacheManager dependency to 2.x.x. ## [1.0.1] - Update firebase dependency + * Added support for version 4.x.x ## [1.0.0] - Initial release diff --git a/flutter_cache_manager_firebase/README.md b/flutter_cache_manager_firebase/README.md index 9a2f2c60..28df01a2 100644 --- a/flutter_cache_manager_firebase/README.md +++ b/flutter_cache_manager_firebase/README.md @@ -6,9 +6,16 @@ A Firebase implementation for [flutter_cache_manager](https://pub.dev/packages/f This library contains FirebaseCacheManager and FirebaseHttpFileService. -You can easily fetch a file stored on Firebase with +You can easily fetch a file stored on Firebase with ```dart var file = await FirebaseCacheManager().getSingleFile(url); ``` -You could also write your own CacheManager which uses the FirebaseHttpFileService. \ No newline at end of file +You could also write your own CacheManager which uses the FirebaseHttpFileService. + +### Custom Firebase storage bucket + +You can use a custom bucket by passing `bucket` parameter. For example: +```dart +FirebaseCacheManager(bucket: "my-bucket"); +``` diff --git a/flutter_cache_manager_firebase/analysis_options.yaml b/flutter_cache_manager_firebase/analysis_options.yaml new file mode 100644 index 00000000..f9b30346 --- /dev/null +++ b/flutter_cache_manager_firebase/analysis_options.yaml @@ -0,0 +1 @@ +include: package:flutter_lints/flutter.yaml diff --git a/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart b/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart index 492f9f02..e45ed319 100644 --- a/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart +++ b/flutter_cache_manager_firebase/lib/src/firebase_cache_manager.dart @@ -1,4 +1,5 @@ import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:retry/retry.dart'; import 'firebase_http_file_service.dart'; @@ -7,12 +8,21 @@ import 'firebase_http_file_service.dart'; class FirebaseCacheManager extends CacheManager { static const key = 'firebaseCache'; - static late final FirebaseCacheManager _instance = FirebaseCacheManager._(); + static final FirebaseCacheManager _instance = + FirebaseCacheManager._(retryOptions: retryOptions, bucket: bucket); - factory FirebaseCacheManager() { + static RetryOptions? retryOptions; + + static String? bucket; + + factory FirebaseCacheManager({RetryOptions? retryOptions, String? bucket}) { + bucket = bucket; + retryOptions = retryOptions; return _instance; } - FirebaseCacheManager._() - : super(Config(key, fileService: FirebaseHttpFileService())); + FirebaseCacheManager._({RetryOptions? retryOptions, String? bucket}) + : super(Config(key, + fileService: FirebaseHttpFileService( + retryOptions: retryOptions, bucket: bucket))); } diff --git a/flutter_cache_manager_firebase/lib/src/firebase_http_file_service.dart b/flutter_cache_manager_firebase/lib/src/firebase_http_file_service.dart index bc2c9554..f7a6da5f 100644 --- a/flutter_cache_manager_firebase/lib/src/firebase_http_file_service.dart +++ b/flutter_cache_manager_firebase/lib/src/firebase_http_file_service.dart @@ -1,16 +1,40 @@ import 'package:firebase_storage/firebase_storage.dart'; import 'package:flutter_cache_manager/flutter_cache_manager.dart'; +import 'package:retry/retry.dart'; /// [FirebaseHttpFileService] is another common file service which parses a /// firebase reference into, to standard url which can be passed to the /// standard [HttpFileService]. class FirebaseHttpFileService extends HttpFileService { + final RetryOptions? retryOptions; + + FirebaseHttpFileService({ + this.retryOptions, + this.bucket, + }) : super(); + + final String? bucket; + @override Future get(String url, {Map? headers}) async { - var ref = FirebaseStorage.instance.ref().child(url); - var _url = await ref.getDownloadURL(); + late Reference ref; + if (bucket != null) { + ref = + FirebaseStorage.instanceFor(bucket: "gs://$bucket").ref().child(url); + } else { + ref = FirebaseStorage.instance.ref().child(url); + } - return super.get(_url); + String downloadUrl; + if (retryOptions != null) { + downloadUrl = await retryOptions!.retry( + () async => await ref.getDownloadURL(), + retryIf: (e) => e is FirebaseException, + ); + } else { + downloadUrl = await ref.getDownloadURL(); + } + return super.get(downloadUrl); } } diff --git a/flutter_cache_manager_firebase/pubspec.yaml b/flutter_cache_manager_firebase/pubspec.yaml index aceaa2c4..292a5ef3 100644 --- a/flutter_cache_manager_firebase/pubspec.yaml +++ b/flutter_cache_manager_firebase/pubspec.yaml @@ -1,19 +1,21 @@ name: flutter_cache_manager_firebase description: CacheManager implementation for firebase_storage. Uses the gs:// as key and translates to https:// -version: 2.0.1 +version: 2.1.0 homepage: https://github.com/Baseflow/flutter_cache_manager environment: - sdk: ">=2.12.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" dependencies: flutter: sdk: flutter - flutter_cache_manager: ^3.0.0 - firebase_storage: ">=8.0.0 <11.0.0" - path_provider: ^2.0.0 - path: ^1.8.0 + flutter_cache_manager: ^3.4.0 + firebase_storage: '>=12.0.0 <13.0.0' + path_provider: ^2.1.2 + path: ^1.9.0 + retry: ^3.1.2 dev_dependencies: + flutter_lints: ^4.0.0 flutter_test: sdk: flutter diff --git a/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart b/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart index 0b45f02c..ab73b3a2 100644 --- a/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart +++ b/flutter_cache_manager_firebase/test/flutter_cache_manager_firebase_test.dart @@ -1,5 +1 @@ -import 'package:flutter_test/flutter_test.dart'; - -import 'package:flutter_cache_manager_firebase/flutter_cache_manager_firebase.dart'; - void main() {} diff --git a/icon.png b/icon.png new file mode 100644 index 00000000..06b5d15c Binary files /dev/null and b/icon.png differ