This commit is contained in:
PaperCube
2024-02-15 11:13:34 +00:00
16 changed files with 245 additions and 617 deletions

View File

@@ -21,7 +21,6 @@ import 'package:toolbox/view/page/storage/local.dart';
import '../data/model/server/snippet.dart';
import '../view/page/debug.dart';
import '../view/page/editor.dart';
import '../view/page/full_screen.dart';
import '../view/page/process.dart';
import '../view/page/server/edit.dart';
import '../view/page/server/tab.dart';
@@ -175,9 +174,9 @@ class AppRoute {
'editor');
}
static AppRoute fullscreen({Key? key}) {
return AppRoute(FullScreenPage(key: key), 'fullscreen');
}
// static AppRoute fullscreen({Key? key}) {
// return AppRoute(FullScreenPage(key: key), 'fullscreen');
// }
static AppRoute home({Key? key}) {
return AppRoute(HomePage(key: key), 'home');

View File

@@ -28,20 +28,26 @@ abstract final class ICloud {
String? localPath,
}) async {
final completer = Completer<ICloudErr?>();
await ICloudStorage.upload(
containerId: _containerId,
filePath: localPath ?? '${await Paths.doc}/$relativePath',
destinationRelativePath: relativePath,
onProgress: (stream) {
stream.listen(
null,
onDone: () => completer.complete(null),
onError: (e) => completer.complete(
ICloudErr(type: ICloudErrType.generic, message: '$e'),
),
);
},
);
try {
await ICloudStorage.upload(
containerId: _containerId,
filePath: localPath ?? '${await Paths.doc}/$relativePath',
destinationRelativePath: relativePath,
onProgress: (stream) {
stream.listen(
null,
onDone: () => completer.complete(null),
onError: (e) => completer.complete(
ICloudErr(type: ICloudErrType.generic, message: '$e'),
),
);
},
);
} catch (e, s) {
_logger.warning('Upload $relativePath failed', e, s);
completer.complete(ICloudErr(type: ICloudErrType.generic, message: '$e'));
}
return completer.future;
}
@@ -52,10 +58,14 @@ abstract final class ICloud {
}
static Future<void> delete(String relativePath) async {
await ICloudStorage.delete(
containerId: _containerId,
relativePath: relativePath,
);
try {
await ICloudStorage.delete(
containerId: _containerId,
relativePath: relativePath,
);
} catch (e, s) {
_logger.warning('Delete $relativePath failed', e, s);
}
}
/// Download file from iCloud