mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
new: manual icloud sync
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:logging/logging.dart';
|
||||
import '../../data/model/app/error.dart';
|
||||
import '../../data/model/app/json.dart';
|
||||
import '../../data/res/path.dart';
|
||||
import 'platform.dart';
|
||||
|
||||
final _logger = Logger('iCloud');
|
||||
|
||||
@@ -173,3 +174,14 @@ class ICloud {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> syncApple() async {
|
||||
if (!isIOS && !isMacOS) return;
|
||||
final docPath = await docDir;
|
||||
final dir = Directory(docPath);
|
||||
final files = await dir.list().toList();
|
||||
// filter out non-hive(db) files
|
||||
files.removeWhere((e) => !e.path.endsWith('.hive'));
|
||||
final paths = files.map((e) => e.path.replaceFirst('$docPath/', ''));
|
||||
await ICloud.sync(relativePaths: paths);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user