From bb822c333692f94eb38f7c9a1858fd3984c9d753 Mon Sep 17 00:00:00 2001 From: Bastien Wermeille Date: Sat, 25 Jul 2020 17:07:17 +0200 Subject: [PATCH 1/2] Cancel download should remove currently downloaded map --- .../plugins/offline/offline/OfflineDownloadService.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java index 81bd3dac3..fe3c1b820 100644 --- a/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java +++ b/plugin-offline/src/main/java/com/mapbox/mapboxsdk/plugins/offline/offline/OfflineDownloadService.java @@ -156,10 +156,10 @@ void showNotification(final OfflineDownloadOptions offlineDownload) { createMapSnapshot(offlineDownload.definition(), new MapSnapshotter.SnapshotReadyCallback() { @Override public void onSnapshotReady(MapSnapshot snapshot) { - final int regionId = offlineDownload.uuid().intValue(); + final Long regionId = offlineDownload.uuid(); if (regionLongSparseArray.get(regionId) != null) { notificationBuilder.setLargeIcon(snapshot.getBitmap()); - notificationManager.notify(regionId, notificationBuilder.build()); + notificationManager.notify(regionId.intValue(), notificationBuilder.build()); } } }); @@ -180,7 +180,7 @@ private void createMapSnapshot(OfflineRegionDefinition definition, } private void cancelDownload(final OfflineDownloadOptions offlineDownload) { - int serviceId = offlineDownload.uuid().intValue(); + final Long serviceId = offlineDownload.uuid(); OfflineRegion offlineRegion = regionLongSparseArray.get(serviceId); if (offlineRegion != null) { offlineRegion.setDownloadState(OfflineRegion.STATE_INACTIVE); @@ -198,7 +198,7 @@ public void onError(String error) { }); } OfflineDownloadStateReceiver.dispatchCancelBroadcast(getApplicationContext(), offlineDownload); - removeOfflineRegion(serviceId); + removeOfflineRegion(serviceId.intValue()); } private synchronized void removeOfflineRegion(int regionId) { From e75a8a0b567776e106dfd2a0d0c0b60cada4af33 Mon Sep 17 00:00:00 2001 From: Bastien Wermeille Date: Tue, 28 Jul 2020 13:14:24 +0200 Subject: [PATCH 2/2] Update CHANGELOG --- plugin-offline/CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugin-offline/CHANGELOG.md b/plugin-offline/CHANGELOG.md index e3b330199..b30962357 100644 --- a/plugin-offline/CHANGELOG.md +++ b/plugin-offline/CHANGELOG.md @@ -2,6 +2,10 @@ Mapbox welcomes participation and contributions from everyone. +### mapbox-android-plugin-offline-v9:0.8.0 - XXX +#### Bugs +- Cancel download should remove region definition [#1145](https://github.com/mapbox/mapbox-plugins-android/pull/1145) + ### mapbox-android-plugin-offline-v9:0.7.0 - March 5, 2020 #### Features - Switching all plugins to AndroidX [#1100](https://github.com/mapbox/mapbox-plugins-android/pull/1100)