downloadUpdate static method
Trigger patch download and staging using the Shorebird engine.
Implementation
static Future<bool> downloadUpdate({
Future<bool> Function()? customDownloader,
}) async {
_setStatus(BloomOtaStatus.downloading);
try {
if (customDownloader != null) {
final success = await customDownloader();
if (success) {
_setStatus(BloomOtaStatus.updateReady);
return true;
}
_setStatus(BloomOtaStatus.error);
return false;
}
if (_updater.isAvailable) {
await _updater.update();
_setStatus(BloomOtaStatus.updateReady);
return true;
}
logger.warn('BloomOTA: Cannot download update because app is not running on Shorebird engine.');
_setStatus(BloomOtaStatus.error);
return false;
} catch (e) {
logger.error('BloomOTA download failed: $e');
_setStatus(BloomOtaStatus.error);
return false;
}
}