@capgo/capacitor-downloader 8.1.14 → 8.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/android/src/main/java/ee/forgr/capacitor/plugin/downloader/CapacitorDownloaderPlugin.java
CHANGED
|
@@ -23,7 +23,7 @@ import java.util.Map;
|
|
|
23
23
|
@CapacitorPlugin(name = "CapacitorDownloader")
|
|
24
24
|
public class CapacitorDownloaderPlugin extends Plugin {
|
|
25
25
|
|
|
26
|
-
private final String pluginVersion = "8.1.
|
|
26
|
+
private final String pluginVersion = "8.1.15";
|
|
27
27
|
|
|
28
28
|
private DownloadManager downloadManager;
|
|
29
29
|
private final Map<String, Long> downloads = new HashMap<>();
|
|
@@ -126,7 +126,13 @@ public class CapacitorDownloaderPlugin extends Plugin {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
private boolean checkDownloadStatus(String id) {
|
|
129
|
-
|
|
129
|
+
Long downloadId = downloads.get(id);
|
|
130
|
+
|
|
131
|
+
if (downloadId == null) {
|
|
132
|
+
return false; // Download was removed, stop polling
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
DownloadManager.Query query = new DownloadManager.Query().setFilterById(downloadId);
|
|
130
136
|
try (Cursor cursor = downloadManager.query(query)) {
|
|
131
137
|
if (cursor.moveToFirst()) {
|
|
132
138
|
int status = cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS));
|
|
@@ -152,6 +158,8 @@ public class CapacitorDownloaderPlugin extends Plugin {
|
|
|
152
158
|
notifyListeners("downloadFailed", failedData);
|
|
153
159
|
return false; // Stop checking progress
|
|
154
160
|
}
|
|
161
|
+
} else {
|
|
162
|
+
return false; // Download no longer in DownloadManager, stop polling
|
|
155
163
|
}
|
|
156
164
|
}
|
|
157
165
|
return true; // Continue checking progress
|
|
@@ -8,7 +8,7 @@ import Capacitor
|
|
|
8
8
|
|
|
9
9
|
@objc(CapacitorDownloaderPlugin)
|
|
10
10
|
public class CapacitorDownloaderPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
11
|
-
private let pluginVersion: String = "8.1.
|
|
11
|
+
private let pluginVersion: String = "8.1.15"
|
|
12
12
|
public let identifier = "CapacitorDownloaderPlugin"
|
|
13
13
|
public let jsName = "CapacitorDownloader"
|
|
14
14
|
public let pluginMethods: [CAPPluginMethod] = [
|