implemented a comprehensive client-side demo mode triggered by a "demo@" username prefix, serving curated fixture data for all app modules
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import 'package:nextcloud/nextcloud.dart';
|
||||
|
||||
import '../../../../../api/demo/data/demo_files.dart';
|
||||
import '../../../../../api/demo/demo_mode.dart';
|
||||
import '../../../../../api/marianumcloud/webdav/queries/list_files/list_files_cache.dart';
|
||||
import '../../../../../api/marianumcloud/webdav/queries/list_files/list_files_response.dart';
|
||||
import '../../../../../api/marianumcloud/webdav/webdav_api.dart';
|
||||
@@ -19,20 +21,24 @@ class FilesDataProvider {
|
||||
void Function(Object)? onError,
|
||||
bool renew = false,
|
||||
void Function(int nextAttempt, int maxAttempts)? onRetry,
|
||||
}) => resolveFromCache<ListFilesResponse>(
|
||||
(onUpdate, onError) => ListFilesCache(
|
||||
path: path,
|
||||
onUpdate: onUpdate,
|
||||
onCacheData: onCacheData,
|
||||
}) {
|
||||
if (DemoMode.active) return Future.value(DemoFiles.listing(path));
|
||||
return resolveFromCache<ListFilesResponse>(
|
||||
(onUpdate, onError) => ListFilesCache(
|
||||
path: path,
|
||||
onUpdate: onUpdate,
|
||||
onCacheData: onCacheData,
|
||||
onError: onError,
|
||||
renew: renew,
|
||||
onRetry: onRetry,
|
||||
),
|
||||
onError: onError,
|
||||
renew: renew,
|
||||
onRetry: onRetry,
|
||||
),
|
||||
onError: onError,
|
||||
operationName: 'listFiles',
|
||||
);
|
||||
operationName: 'listFiles',
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> createFolder(String fullPath) async {
|
||||
if (DemoMode.active) return;
|
||||
final webdav = await WebdavApi.webdav;
|
||||
await webdav.mkcol(PathUri.parse(fullPath));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user