Allow OSM offline downloads, disable button for restricted providers

Allow offline area downloads for OSM tile server. Move the "downloads
not permitted" check from inside the download dialog to the download
button itself — the button is now disabled (greyed out) when the
current tile type doesn't support offline downloads.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Doug Borg
2026-03-04 09:47:42 -07:00
parent 2d92214bed
commit f3f40f36ef
4 changed files with 38 additions and 70 deletions
+4 -4
View File
@@ -96,11 +96,11 @@ void main() {
});
group('resolve', () {
test('OSM tile server policy disallows offline download', () {
test('OSM tile server policy allows offline download', () {
final policy = ServicePolicyResolver.resolve(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
);
expect(policy.allowsOfflineDownload, false);
expect(policy.allowsOfflineDownload, true);
});
test('OSM tile server policy requires 7-day min cache TTL', () {
@@ -175,7 +175,7 @@ void main() {
final policy = ServicePolicyResolver.resolve(
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
);
expect(policy.allowsOfflineDownload, false);
expect(policy.allowsOfflineDownload, true);
});
test('handles {quadkey} template variable', () {
@@ -381,7 +381,7 @@ void main() {
group('ServicePolicy', () {
test('osmTileServer policy has correct values', () {
const policy = ServicePolicy.osmTileServer();
expect(policy.allowsOfflineDownload, false);
expect(policy.allowsOfflineDownload, true);
expect(policy.minCacheTtl, const Duration(days: 7));
expect(policy.requiresClientCaching, true);
expect(policy.attributionUrl, 'https://www.openstreetmap.org/copyright');