mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
rm: refresh key (#291)
This commit is contained in:
@@ -17,12 +17,12 @@ abstract final class ICloud {
|
|||||||
|
|
||||||
/// Upload file to iCloud
|
/// Upload file to iCloud
|
||||||
///
|
///
|
||||||
/// - [relativePath] is the path relative to [docDir],
|
/// - [relativePath] is the path relative to [Paths.doc],
|
||||||
/// must not starts with `/`
|
/// must not starts with `/`
|
||||||
/// - [localPath] has higher priority than [relativePath], but only apply
|
/// - [localPath] has higher priority than [relativePath], but only apply
|
||||||
/// to the local path instead of iCloud path
|
/// to the local path instead of iCloud path
|
||||||
///
|
///
|
||||||
/// Return `null` if upload success, `ICloudErr` otherwise
|
/// Return [null] if upload success, [ICloudErr] otherwise
|
||||||
static Future<ICloudErr?> upload({
|
static Future<ICloudErr?> upload({
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
String? localPath,
|
String? localPath,
|
||||||
@@ -70,12 +70,12 @@ abstract final class ICloud {
|
|||||||
|
|
||||||
/// Download file from iCloud
|
/// Download file from iCloud
|
||||||
///
|
///
|
||||||
/// - [relativePath] is the path relative to [docDir],
|
/// - [relativePath] is the path relative to [Paths.doc],
|
||||||
/// must not starts with `/`
|
/// must not starts with `/`
|
||||||
/// - [localPath] has higher priority than [relativePath], but only apply
|
/// - [localPath] has higher priority than [relativePath], but only apply
|
||||||
/// to the local path instead of iCloud path
|
/// to the local path instead of iCloud path
|
||||||
///
|
///
|
||||||
/// Return `null` if upload success, `ICloudErr` otherwise
|
/// Return `null` if upload success, [ICloudErr] otherwise
|
||||||
static Future<ICloudErr?> download({
|
static Future<ICloudErr?> download({
|
||||||
required String relativePath,
|
required String relativePath,
|
||||||
String? localPath,
|
String? localPath,
|
||||||
@@ -105,12 +105,12 @@ abstract final class ICloud {
|
|||||||
|
|
||||||
/// Sync file between iCloud and local
|
/// Sync file between iCloud and local
|
||||||
///
|
///
|
||||||
/// - [relativePath] is the path relative to [docDir],
|
/// - [relativePaths] is the path relative to [Paths.doc],
|
||||||
/// must not starts with `/`
|
/// must not starts with `/`
|
||||||
/// - [bakSuffix] is the suffix of backup file, default to [null].
|
/// - [bakPrefix] is the suffix of backup file, default to [null].
|
||||||
/// All files downloaded from cloud will be suffixed with [bakSuffix].
|
/// All files downloaded from cloud will be suffixed with [bakPrefix].
|
||||||
///
|
///
|
||||||
/// Return `null` if upload success, `ICloudErr` otherwise
|
/// Return `null` if upload success, [ICloudErr] otherwise
|
||||||
static Future<SyncResult<String, ICloudErr>> syncFiles({
|
static Future<SyncResult<String, ICloudErr>> syncFiles({
|
||||||
required Iterable<String> relativePaths,
|
required Iterable<String> relativePaths,
|
||||||
String? bakPrefix,
|
String? bakPrefix,
|
||||||
|
|||||||
@@ -149,8 +149,6 @@ class ServerProvider extends ChangeNotifier {
|
|||||||
return await _getData(s.spi);
|
return await _getData(s.spi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static final refreshKey = GlobalKey<RefreshIndicatorState>();
|
|
||||||
|
|
||||||
Future<void> startAutoRefresh() async {
|
Future<void> startAutoRefresh() async {
|
||||||
var duration = Stores.setting.serverStatusUpdateInterval.fetch();
|
var duration = Stores.setting.serverStatusUpdateInterval.fetch();
|
||||||
stopAutoRefresh();
|
stopAutoRefresh();
|
||||||
@@ -159,7 +157,6 @@ class ServerProvider extends ChangeNotifier {
|
|||||||
duration = 3;
|
duration = 3;
|
||||||
Loggers.app.warning('Invalid duration: $duration, use default 3');
|
Loggers.app.warning('Invalid duration: $duration, use default 3');
|
||||||
}
|
}
|
||||||
refreshKey.currentState?.show();
|
|
||||||
_timer = Timer.periodic(Duration(seconds: duration), (_) async {
|
_timer = Timer.periodic(Duration(seconds: duration), (_) async {
|
||||||
await refresh();
|
await refresh();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,7 +105,6 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
if (isDesktop) return child;
|
if (isDesktop) return child;
|
||||||
|
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
key: ServerProvider.refreshKey,
|
|
||||||
onRefresh: () async => await Pros.server.refresh(onlyFailed: true),
|
onRefresh: () async => await Pros.server.refresh(onlyFailed: true),
|
||||||
child: child,
|
child: child,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user