checkForUpdate method
Probe the server for a new patch WITHOUT downloading. The result
carries the patch label, size, sha256, signed download URL, and
SankofaUpdate.isMandatory flag — enough to drive a confirmation
dialog. Hosts then call downloadKbcUpdate when ready.
final result = await Sankofa.instance.deploy?.checkForUpdate(
endpoint: 'https://api.sankofa.dev',
apiKey: 'sk_live_…',
appVersion: '1.2.0',
engineVersion: '3.44.0+sankofa-1',
distinctId: await getOrCreateDistinctId(),
);
if (result?.hasUpdate == true) {
if (result!.update!.isMandatory) {
await Sankofa.instance.deploy?.downloadUpdate(result.update!);
} else {
final yes = await showUpdateDialog(context, result.update!);
if (yes) await Sankofa.instance.deploy?.downloadUpdate(result.update!);
}
}
Locally-banned labels (previously auto-rolled-back on this
device) are filtered automatically — the result's status is
SankofaUpdateStatus.bannedLocally in that case.
Implementation
Future<SankofaUpdateCheckResult> checkForUpdate({
String? endpoint,
String? apiKey,
String? appVersion,
String? engineVersion,
String? distinctId,
String? platform,
String? currentLabel,
String? flavor,
Duration timeout = const Duration(seconds: 30),
}) async {
final banned = await getBannedKbcLabels();
return kbc_fetch.checkForKbcUpdate(
endpoint: _resolveEndpoint(endpoint),
apiKey: _resolveApiKey(apiKey),
appVersion: _resolveAppVersion(appVersion),
engineVersion: _resolveEngineVersion(engineVersion),
distinctId: _resolveDistinctId(distinctId),
platform: platform ?? _effectivePlatform,
currentLabel: currentLabel,
flavor: _resolveFlavor(flavor),
timeout: timeout,
bannedLabels: banned.isEmpty ? null : banned,
);
}