From ea6686e5a2ef9bd62878f7da9a4ea277257d1e17 Mon Sep 17 00:00:00 2001 From: Luka S Date: Thu, 5 Dec 2024 22:25:10 +0000 Subject: [PATCH] v9.1.4: fixed comparison bug in `removeTilesOlderThan` (#173) --- CHANGELOG.md | 4 ++++ example/pubspec.yaml | 2 +- .../backend/internal_workers/standard/worker.dart | 2 +- lib/src/backend/interfaces/backend/internal.dart | 10 +++++++++- pubspec.yaml | 2 +- windowsApplicationInstallerSetup.iss | 2 +- 6 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a8d97917..02eac826 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,10 @@ Many thanks to my sponsors, no matter how much or how little they donated. Spons # Changelog +## [9.1.4] - 2024/12/05 + +* Fixed bug in `removeTilesOlderThan` where actually tiles newer than the specified expiry were being removed ([#172](https://github.com/JaffaKetchup/flutter_map_tile_caching/issues/172)) + ## [9.1.3] - 2024/08/19 * Fixed bug where any operation that attempted to delete tiles fatally crashed on some iOS devices diff --git a/example/pubspec.yaml b/example/pubspec.yaml index f9474cce..87622d2d 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: The example application for 'flutter_map_tile_caching', showcasing it's functionality and use-cases. publish_to: "none" -version: 9.1.3 +version: 9.1.4 environment: sdk: ">=3.3.0 <4.0.0" diff --git a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart index 46801c11..51f542af 100644 --- a/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart +++ b/lib/src/backend/impls/objectbox/backend/internal_workers/standard/worker.dart @@ -543,7 +543,7 @@ Future _worker( .build(); final tilesQuery = (root.box().query( ObjectBoxTile_.lastModified - .greaterThan(expiry.millisecondsSinceEpoch), + .lessThan(expiry.millisecondsSinceEpoch), )..linkMany( ObjectBoxTile_.stores, ObjectBoxStore_.name.equals(storeName), diff --git a/lib/src/backend/interfaces/backend/internal.dart b/lib/src/backend/interfaces/backend/internal.dart index 2935697e..b1e1eaf7 100644 --- a/lib/src/backend/interfaces/backend/internal.dart +++ b/lib/src/backend/interfaces/backend/internal.dart @@ -197,7 +197,15 @@ abstract interface class FMTCBackendInternal }); /// {@template fmtc.backend.removeTilesOlderThan} - /// Remove tiles that were last modified after expiry from the specified store + /// Remove tiles that were last modified prior to the expiry timestamp from + /// the specified store + /// + /// For example, to remove tiles last modified over 14 days ago, calculate + /// [expiry] with: + /// + /// ```dart + /// expiry: DateTime.timestamp().subtract(const Duration(days: 14)) + /// ``` /// /// Returns the number of tiles that were actually deleted (they were /// orphaned). See [deleteTile] for more information about orphan tiles. diff --git a/pubspec.yaml b/pubspec.yaml index e479501c..9217c0c6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: flutter_map_tile_caching description: Plugin for 'flutter_map' providing advanced caching functionality, with ability to download map regions for offline use. -version: 9.1.3 +version: 9.1.4 repository: https://github.com/JaffaKetchup/flutter_map_tile_caching issue_tracker: https://github.com/JaffaKetchup/flutter_map_tile_caching/issues diff --git a/windowsApplicationInstallerSetup.iss b/windowsApplicationInstallerSetup.iss index 50d87cc2..476164ee 100644 --- a/windowsApplicationInstallerSetup.iss +++ b/windowsApplicationInstallerSetup.iss @@ -1,7 +1,7 @@ ; Script generated by the Inno Setup Script Wizard #define MyAppName "FMTC Demo" -#define MyAppVersion "for 9.1.3" +#define MyAppVersion "for 9.1.4" #define MyAppPublisher "JaffaKetchup Development" #define MyAppURL "https://github.com/JaffaKetchup/flutter_map_tile_caching" #define MyAppSupportURL "https://github.com/JaffaKetchup/flutter_map_tile_caching/issues"