initialize static method
Future<void>
initialize({
- String channel = 'production',
- String branch = 'main',
- String? deviceId,
- String? runtimeFingerprint,
- BloomUpdateClientAdapter? adapter,
- WatchdogStorage? watchdogStorage,
- String? currentPatchId,
- bool autoHookErrorHandlers = true,
Initializes the BloomUpdates runtime engine.
Implementation
static Future<void> initialize({
String channel = 'production',
String branch = 'main',
String? deviceId,
String? runtimeFingerprint,
BloomUpdateClientAdapter? adapter,
WatchdogStorage? watchdogStorage,
String? currentPatchId,
bool autoHookErrorHandlers = true,
}) async {
_activeChannel = channel;
_activeBranch = branch;
_deviceId = deviceId ?? _deviceId;
// Automatically derive runtime fingerprint from environment if not explicitly provided
_localRuntimeFingerprint = runtimeFingerprint ??
BloomRuntimeFingerprint.current().computeHash();
if (adapter != null) _adapter = adapter;
_watchdog = StartupCrashWatchdog(
storage: watchdogStorage,
onRollbackTriggered: (faultyId, reason) {
rollback(reason: reason);
},
);
_watchdog.recordAppLaunch(currentPatchId);
// Auto-hook startup error handlers for crash detection
if (autoHookErrorHandlers) {
_hookStartupErrorHandlers();
}
logger.info('BloomUpdates: Initialized (Channel: "$_activeChannel", Fingerprint: "${_localRuntimeFingerprint.length >= 8 ? _localRuntimeFingerprint.substring(0, 8) : _localRuntimeFingerprint}...")');
}