mirror of
https://github.com/immich-app/immich.git
synced 2026-04-27 11:39:53 -04:00
24 lines
790 B
Dart
24 lines
790 B
Dart
import 'dart:async';
|
|
|
|
import 'package:hooks_riverpod/legacy.dart';
|
|
import 'package:immich_mobile/models/server_info/server_disk_info.model.dart';
|
|
import 'package:immich_mobile/services/server_info.service.dart';
|
|
|
|
final backupProvider = StateNotifierProvider<BackupNotifier, ServerDiskInfo>((ref) {
|
|
return BackupNotifier(ref.watch(serverInfoServiceProvider));
|
|
});
|
|
|
|
class BackupNotifier extends StateNotifier<ServerDiskInfo> {
|
|
BackupNotifier(this._serverInfoService)
|
|
: super(const ServerDiskInfo(diskAvailable: "0", diskSize: "0", diskUse: "0", diskUsagePercentage: 0));
|
|
|
|
final ServerInfoService _serverInfoService;
|
|
|
|
Future<void> updateDiskInfo() async {
|
|
final diskInfo = await _serverInfoService.getDiskInfo();
|
|
if (diskInfo != null) {
|
|
state = diskInfo;
|
|
}
|
|
}
|
|
}
|