@capgo/capacitor-updater 7.1.0 → 7.2.0
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_updater/CapacitorUpdater.java +2 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/CapacitorUpdaterPlugin.java +1 -1
- package/android/src/main/java/ee/forgr/capacitor_updater/DownloadWorkerManager.java +23 -7
- package/ios/Plugin/CapacitorUpdaterPlugin.swift +1 -1
- package/package.json +1 -1
|
@@ -57,7 +57,7 @@ public class CapacitorUpdaterPlugin extends Plugin {
|
|
|
57
57
|
private static final String statsUrlDefault = "https://plugin.capgo.app/stats";
|
|
58
58
|
private static final String channelUrlDefault = "https://plugin.capgo.app/channel_self";
|
|
59
59
|
|
|
60
|
-
private final String PLUGIN_VERSION = "7.
|
|
60
|
+
private final String PLUGIN_VERSION = "7.2.0";
|
|
61
61
|
private static final String DELAY_CONDITION_PREFERENCES = "";
|
|
62
62
|
|
|
63
63
|
private SharedPreferences.Editor editor;
|
|
@@ -46,7 +46,8 @@ public class DownloadWorkerManager {
|
|
|
46
46
|
String sessionKey,
|
|
47
47
|
String checksum,
|
|
48
48
|
String publicKey,
|
|
49
|
-
boolean isManifest
|
|
49
|
+
boolean isManifest,
|
|
50
|
+
boolean isEmulator
|
|
50
51
|
) {
|
|
51
52
|
initializeIfNeeded(context.getApplicationContext());
|
|
52
53
|
|
|
@@ -70,18 +71,33 @@ public class DownloadWorkerManager {
|
|
|
70
71
|
.putString(DownloadService.PUBLIC_KEY, publicKey)
|
|
71
72
|
.build();
|
|
72
73
|
|
|
73
|
-
// Create network constraints
|
|
74
|
-
Constraints
|
|
74
|
+
// Create network constraints - be more lenient on emulators
|
|
75
|
+
Constraints.Builder constraintsBuilder = new Constraints.Builder();
|
|
76
|
+
if (isEmulator) {
|
|
77
|
+
Log.i(TAG, "Emulator detected - using lenient network constraints");
|
|
78
|
+
// On emulators, use UNMETERED to avoid background network issues
|
|
79
|
+
constraintsBuilder.setRequiredNetworkType(NetworkType.UNMETERED);
|
|
80
|
+
} else {
|
|
81
|
+
constraintsBuilder.setRequiredNetworkType(NetworkType.CONNECTED);
|
|
82
|
+
}
|
|
83
|
+
Constraints constraints = constraintsBuilder.build();
|
|
75
84
|
|
|
76
85
|
// Create work request with tags for tracking
|
|
77
|
-
OneTimeWorkRequest
|
|
86
|
+
OneTimeWorkRequest.Builder workRequestBuilder = new OneTimeWorkRequest.Builder(DownloadService.class)
|
|
78
87
|
.setConstraints(constraints)
|
|
79
88
|
.setInputData(inputData)
|
|
80
89
|
.addTag(id)
|
|
81
90
|
.addTag(version) // Add version tag for tracking
|
|
82
|
-
.addTag("capacitor_updater_download")
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
.addTag("capacitor_updater_download");
|
|
92
|
+
|
|
93
|
+
// More aggressive retry policy for emulators
|
|
94
|
+
if (isEmulator) {
|
|
95
|
+
workRequestBuilder.setBackoffCriteria(BackoffPolicy.EXPONENTIAL, 30, TimeUnit.SECONDS);
|
|
96
|
+
} else {
|
|
97
|
+
workRequestBuilder.setBackoffCriteria(BackoffPolicy.LINEAR, WorkRequest.MIN_BACKOFF_MILLIS, TimeUnit.MILLISECONDS);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
OneTimeWorkRequest workRequest = workRequestBuilder.build();
|
|
85
101
|
|
|
86
102
|
// Enqueue work
|
|
87
103
|
WorkManager.getInstance(context).enqueue(workRequest);
|
|
@@ -45,7 +45,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin, CAPBridgedPlugin {
|
|
|
45
45
|
CAPPluginMethod(name: "getNextBundle", returnType: CAPPluginReturnPromise)
|
|
46
46
|
]
|
|
47
47
|
public var implementation = CapacitorUpdater()
|
|
48
|
-
private let PLUGIN_VERSION: String = "7.
|
|
48
|
+
private let PLUGIN_VERSION: String = "7.2.0"
|
|
49
49
|
static let updateUrlDefault = "https://plugin.capgo.app/updates"
|
|
50
50
|
static let statsUrlDefault = "https://plugin.capgo.app/stats"
|
|
51
51
|
static let channelUrlDefault = "https://plugin.capgo.app/channel_self"
|