Files
SpotiFLAC-Mobile/lib/services/native_cache_maintenance.dart
zarzet 37e21b5712 feat(branding): rename app and native backend to Mornye
Rename the Dart package, Android and iOS identifiers, Rust crates, native libraries, and Discord plugin. Preserve legacy data readers and compatibility aliases.

Update localized branding, documentation, artwork, build tooling, and release artifacts. Route Telegram release notifications to @mornyeupdates and link @mornyecommunity.
2026-10-20 12:00:44 +07:00

30 lines
973 B
Dart

import 'package:mornye/services/platform_bridge.dart';
typedef NativeCacheJobRunner =
Future<Map<String, dynamic>> Function(
Map<String, dynamic> request, {
String? requestId,
});
/// Returns null on the desktop adapter. Mobile filesystem work uses the
/// existing cancellable native worker without changing the public FFI API.
Future<Map<String, dynamic>?> runNativeCacheMaintenance(
Map<String, dynamic> request, {
String? requestId,
NativeCacheJobRunner? nativeJobRunner,
}) async {
if (nativeJobRunner != null) {
return nativeJobRunner(request, requestId: requestId);
}
if (!PlatformBridge.supportsCoreBackend) return null;
return PlatformBridge.runNativeDataJob(request, requestId: requestId);
}
int cacheMaintenanceDeletedCount(Map<String, dynamic> result) {
final deleted = result['deleted'];
if (deleted is! int || deleted < 0) {
throw StateError('Invalid native cache maintenance result');
}
return deleted;
}