Implemented basic Fileviewing
This commit is contained in:
parent
b51928ecf1
commit
3fa4731713
@ -1,46 +1,32 @@
|
|||||||
// import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
// import 'package:webdav_client/webdav_client.dart';
|
import 'package:nextcloud/nextcloud.dart';
|
||||||
//
|
|
||||||
// part 'cacheableFile.g.dart';
|
part 'cacheableFile.g.dart';
|
||||||
//
|
|
||||||
// @JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
// class CacheableFile {
|
class CacheableFile {
|
||||||
// String? path;
|
late String path;
|
||||||
// bool? isDir;
|
late bool isDirectory;
|
||||||
// String? name;
|
late String name;
|
||||||
// String? mimeType;
|
String? mimeType;
|
||||||
// int? size;
|
int? size;
|
||||||
// String? eTag;
|
String? eTag;
|
||||||
// DateTime? cTime;
|
DateTime? createdAt;
|
||||||
// DateTime? mTime;
|
DateTime? modifiedAt;
|
||||||
//
|
|
||||||
// CacheableFile(this.path, this.isDir, this.name, this.mimeType, this.size,
|
CacheableFile(this.path, this.isDirectory, this.name, {this.mimeType, this.size, this.eTag, this.createdAt, this.modifiedAt});
|
||||||
// this.eTag, this.cTime, this.mTime);
|
|
||||||
//
|
CacheableFile.fromDavFile(WebDavFile file) {
|
||||||
// CacheableFile.fromDavFile(File file) {
|
path = file.path;
|
||||||
// path = file.path;
|
isDirectory = file.isDirectory;
|
||||||
// isDir = file.isDir;
|
name = file.name;
|
||||||
// name = file.name;
|
mimeType = file.mimeType;
|
||||||
// mimeType = file.mimeType;
|
size = file.size;
|
||||||
// size = file.size;
|
eTag = file.etag;
|
||||||
// eTag = file.eTag;
|
createdAt = file.createdDate;
|
||||||
// cTime = file.cTime;
|
modifiedAt = file.lastModified;
|
||||||
// mTime = file.mTime;
|
}
|
||||||
// }
|
|
||||||
//
|
factory CacheableFile.fromJson(Map<String, dynamic> json) => _$CacheableFileFromJson(json);
|
||||||
// File toDavFile() {
|
Map<String, dynamic> toJson() => _$CacheableFileToJson(this);
|
||||||
// return File(
|
}
|
||||||
// path: path,
|
|
||||||
// isDir: isDir,
|
|
||||||
// name: name,
|
|
||||||
// mimeType: mimeType,
|
|
||||||
// size: size,
|
|
||||||
// eTag: eTag,
|
|
||||||
// cTime: cTime,
|
|
||||||
// mTime: mTime
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// factory CacheableFile.fromJson(Map<String, dynamic> json) => _$CacheableFileFromJson(json);
|
|
||||||
// Map<String, dynamic> toJson() => _$CacheableFileToJson(this);
|
|
||||||
// }
|
|
@ -0,0 +1,35 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'cacheableFile.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
CacheableFile _$CacheableFileFromJson(Map<String, dynamic> json) =>
|
||||||
|
CacheableFile(
|
||||||
|
json['path'] as String,
|
||||||
|
json['isDirectory'] as bool,
|
||||||
|
json['name'] as String,
|
||||||
|
mimeType: json['mimeType'] as String?,
|
||||||
|
size: json['size'] as int?,
|
||||||
|
eTag: json['eTag'] as String?,
|
||||||
|
createdAt: json['createdAt'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['createdAt'] as String),
|
||||||
|
modifiedAt: json['modifiedAt'] == null
|
||||||
|
? null
|
||||||
|
: DateTime.parse(json['modifiedAt'] as String),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$CacheableFileToJson(CacheableFile instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'path': instance.path,
|
||||||
|
'isDirectory': instance.isDirectory,
|
||||||
|
'name': instance.name,
|
||||||
|
'mimeType': instance.mimeType,
|
||||||
|
'size': instance.size,
|
||||||
|
'eTag': instance.eTag,
|
||||||
|
'createdAt': instance.createdAt?.toIso8601String(),
|
||||||
|
'modifiedAt': instance.modifiedAt?.toIso8601String(),
|
||||||
|
};
|
@ -1,21 +1,18 @@
|
|||||||
//
|
|
||||||
// import 'package:marianum_mobile/api/apiParams.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/webdavApi.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/webdavApi.dart';
|
class ListFiles extends WebdavApi<ListFilesParams> {
|
||||||
// import 'package:webdav_client/webdav_client.dart';
|
ListFilesParams params;
|
||||||
//
|
|
||||||
// class ListFiles extends WebdavApi<ListFilesParams> {
|
ListFiles(this.params) : super(params);
|
||||||
// ListFilesParams params;
|
|
||||||
//
|
@override
|
||||||
// ListFiles(this.params) : super(params);
|
Future<ListFilesResponse> run() async {
|
||||||
//
|
Set<CacheableFile> files = (await (await WebdavApi.webdav).ls(params.path)).map((e) => CacheableFile.fromDavFile(e)).toSet();
|
||||||
// @override
|
|
||||||
// Future<ListFilesResponse> run() async {
|
return ListFilesResponse(files);
|
||||||
// Set<CacheableFile> files = (await (await WebdavApi.webdav).readDir(params.path)).map((e) => CacheableFile.fromDavFile(e)).toSet();
|
}
|
||||||
//
|
}
|
||||||
// return ListFilesResponse(files);
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,33 +1,32 @@
|
|||||||
// import 'dart:convert';
|
import 'dart:convert';
|
||||||
// import 'dart:developer';
|
import 'dart:developer';
|
||||||
//
|
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFiles.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFiles.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||||
// import 'package:marianum_mobile/api/requestCache.dart';
|
import 'package:marianum_mobile/api/requestCache.dart';
|
||||||
// import 'package:webdav_client/webdav_client.dart';
|
|
||||||
//
|
class ListFilesCache extends RequestCache<ListFilesResponse> {
|
||||||
// class ListFilesCache extends RequestCache<ListFilesResponse> {
|
String path;
|
||||||
// String path;
|
|
||||||
//
|
ListFilesCache({required onUpdate, required this.path}) : super(RequestCache.cacheNothing, onUpdate) {
|
||||||
// ListFilesCache({required onUpdate, required this.path}) : super(RequestCache.cacheNothing, onUpdate) {
|
String cacheName = path.replaceAll(RegExp("[^A-Za-z0-9]"), "_"); //TODO this is very evil, "/ü/" > "___" also "/ä/" > "___"
|
||||||
// String cacheName = path.replaceAll(RegExp("[^A-Za-z0-9]"), "_"); //TODO this is very evil, "/ü/" > "___" also "/ä/" > "___"
|
log(cacheName);
|
||||||
// log(cacheName);
|
|
||||||
//
|
start("MarianumMobile", "wd-folder-$cacheName");
|
||||||
// start("MarianumMobile", "wd-folder-$cacheName");
|
}
|
||||||
// }
|
|
||||||
//
|
@override
|
||||||
// @override
|
Future<ListFilesResponse> onLoad() async {
|
||||||
// Future<ListFilesResponse> onLoad() async {
|
log("Loading remote data");
|
||||||
// log("Loading remote data");
|
ListFilesResponse data = await ListFiles(ListFilesParams(path)).run();
|
||||||
// ListFilesResponse data = await ListFiles(ListFilesParams(path)).run();
|
return data;
|
||||||
// return data;
|
}
|
||||||
// }
|
|
||||||
//
|
@override
|
||||||
// @override
|
ListFilesResponse onLocalData(String json) {
|
||||||
// ListFilesResponse onLocalData(String json) {
|
log("Loading local data");
|
||||||
// log("Loading local data");
|
return ListFilesResponse.fromJson(jsonDecode(json));
|
||||||
// return ListFilesResponse.fromJson(jsonDecode(json));
|
}
|
||||||
// }
|
|
||||||
//
|
}
|
||||||
// }
|
|
@ -1,16 +1,16 @@
|
|||||||
// import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||||
//
|
|
||||||
// import 'cacheableFile.dart';
|
import 'cacheableFile.dart';
|
||||||
//
|
|
||||||
// part 'listFilesResponse.g.dart';
|
part 'listFilesResponse.g.dart';
|
||||||
//
|
|
||||||
// @JsonSerializable(explicitToJson: true)
|
@JsonSerializable(explicitToJson: true)
|
||||||
// class ListFilesResponse extends ApiResponse {
|
class ListFilesResponse extends ApiResponse {
|
||||||
// Set<CacheableFile> files;
|
Set<CacheableFile> files;
|
||||||
//
|
|
||||||
// ListFilesResponse(this.files);
|
ListFilesResponse(this.files);
|
||||||
//
|
|
||||||
// factory ListFilesResponse.fromJson(Map<String, dynamic> json) => _$ListFilesResponseFromJson(json);
|
factory ListFilesResponse.fromJson(Map<String, dynamic> json) => _$ListFilesResponseFromJson(json);
|
||||||
// Map<String, dynamic> toJson() => _$ListFilesResponseToJson(this);
|
Map<String, dynamic> toJson() => _$ListFilesResponseToJson(this);
|
||||||
// }
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'listFilesResponse.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
ListFilesResponse _$ListFilesResponseFromJson(Map<String, dynamic> json) =>
|
||||||
|
ListFilesResponse(
|
||||||
|
(json['files'] as List<dynamic>)
|
||||||
|
.map((e) => CacheableFile.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toSet(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ListFilesResponseToJson(ListFilesResponse instance) =>
|
||||||
|
<String, dynamic>{
|
||||||
|
'files': instance.files.map((e) => e.toJson()).toList(),
|
||||||
|
};
|
@ -1,43 +1,23 @@
|
|||||||
// import 'dart:developer';
|
import 'package:marianum_mobile/api/apiRequest.dart';
|
||||||
//
|
import 'package:nextcloud/nextcloud.dart';
|
||||||
// import 'package:marianum_mobile/api/apiParams.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
// import 'package:marianum_mobile/api/apiRequest.dart';
|
|
||||||
// import 'package:marianum_mobile/api/webuntis/queries/authenticate/authenticate.dart';
|
import '../../apiResponse.dart';
|
||||||
// import 'package:shared_preferences/shared_preferences.dart';
|
|
||||||
// import 'package:webdav_client/webdav_client.dart';
|
abstract class WebdavApi<T> extends ApiRequest {
|
||||||
//
|
T genericParams;
|
||||||
// import '../../apiResponse.dart';
|
|
||||||
//
|
WebdavApi(this.genericParams) {
|
||||||
// abstract class WebdavApi<T> extends ApiRequest {
|
establishWebdavConnection();
|
||||||
// T genericParams;
|
}
|
||||||
//
|
|
||||||
// WebdavApi(this.genericParams) {
|
Future<ApiResponse> run();
|
||||||
// establishWebdavConnection();
|
|
||||||
// }
|
static Future<WebDavClient> webdav = establishWebdavConnection();
|
||||||
//
|
|
||||||
// Future<ApiResponse> run();
|
static Future<WebDavClient> establishWebdavConnection() async {
|
||||||
//
|
SharedPreferences preferences = await SharedPreferences.getInstance();
|
||||||
// static Future<Client> webdav = establishWebdavConnection();
|
|
||||||
//
|
return NextcloudClient("https://cloud.marianum-fulda.de/", username: preferences.getString("username"), password: preferences.getString("password"), loginName: preferences.getString("username")).webdav;
|
||||||
// static Future<Client> establishWebdavConnection() async {
|
}
|
||||||
// SharedPreferences preferences = await SharedPreferences.getInstance();
|
}
|
||||||
//
|
|
||||||
// // Client client = newClient(
|
|
||||||
// // "https://cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***/",
|
|
||||||
// // user: "***REMOVED***",
|
|
||||||
// // password: "***REMOVED***",
|
|
||||||
// // debug: true
|
|
||||||
// // );
|
|
||||||
// //
|
|
||||||
// // client.setHeaders(
|
|
||||||
// // {
|
|
||||||
// // "Authorization": "Bearer",
|
|
||||||
// // "User-Agent": "Marianum Fulda/Alpha0.1 (Development build) ; https://mhsl.eu/id.html",
|
|
||||||
// // }
|
|
||||||
// // );
|
|
||||||
//
|
|
||||||
// throw UnimplementedError();
|
|
||||||
// //return client;
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
// }
|
|
@ -1,31 +1,38 @@
|
|||||||
// import 'dart:developer';
|
import 'dart:developer';
|
||||||
//
|
|
||||||
// import 'package:marianum_mobile/api/apiResponse.dart';
|
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesCache.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesCache.dart';
|
||||||
// import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||||
// import 'package:marianum_mobile/data/dataHolder.dart';
|
import 'package:marianum_mobile/data/dataHolder.dart';
|
||||||
//
|
|
||||||
// class FilesProps extends DataHolder {
|
class FilesProps extends DataHolder {
|
||||||
//
|
String _path = "/";
|
||||||
// ListFilesResponse? _listFilesResponse;
|
|
||||||
// ListFilesResponse get listFilesResponse => _listFilesResponse!;
|
ListFilesResponse? _listFilesResponse;
|
||||||
//
|
ListFilesResponse get listFilesResponse => _listFilesResponse!;
|
||||||
// @override
|
|
||||||
// List<ApiResponse?> properties() {
|
@override
|
||||||
// return [_listFilesResponse];
|
List<ApiResponse?> properties() {
|
||||||
// }
|
return [_listFilesResponse];
|
||||||
//
|
}
|
||||||
// @override
|
|
||||||
// void run() {
|
@override
|
||||||
// log("Query Cache");
|
void run() {
|
||||||
// ListFilesCache(
|
notifyListeners();
|
||||||
// path: "/",
|
ListFilesCache(
|
||||||
// onUpdate: (ListFilesResponse data) => {
|
path: _path,
|
||||||
// log("Got cache response"),
|
onUpdate: (ListFilesResponse data) => {
|
||||||
// _listFilesResponse = data,
|
log("Got cache response"),
|
||||||
// notifyListeners(),
|
_listFilesResponse = data,
|
||||||
// }
|
notifyListeners(),
|
||||||
// );
|
}
|
||||||
// }
|
);
|
||||||
//
|
}
|
||||||
// }
|
|
||||||
|
void setPath(String path) {
|
||||||
|
_listFilesResponse = null;
|
||||||
|
_path = path;
|
||||||
|
run();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,6 +1,4 @@
|
|||||||
|
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:marianum_mobile/api/apiResponse.dart';
|
import 'package:marianum_mobile/api/apiResponse.dart';
|
||||||
import 'package:marianum_mobile/api/webuntis/queries/getHolidays/getHolidaysCache.dart';
|
import 'package:marianum_mobile/api/webuntis/queries/getHolidays/getHolidaysCache.dart';
|
||||||
@ -31,7 +29,7 @@ class TimetableProps extends DataHolder {
|
|||||||
late DateTime endDate = getDate(_queryWeek.add(Duration(days: DateTime.daysPerWeek - _queryWeek.weekday)));
|
late DateTime endDate = getDate(_queryWeek.add(Duration(days: DateTime.daysPerWeek - _queryWeek.weekday)));
|
||||||
|
|
||||||
GetTimetableResponse? _getTimetableResponse;
|
GetTimetableResponse? _getTimetableResponse;
|
||||||
GetTimetableResponse get getTimetableResponse => _getTimetableResponse!;
|
GetTimetableResponse get getTimetableResponse => _getTimetableResponse!; //TODO failed null check when no cache
|
||||||
|
|
||||||
GetRoomsResponse? _getRoomsResponse;
|
GetRoomsResponse? _getRoomsResponse;
|
||||||
GetRoomsResponse get getRoomsResponse => _getRoomsResponse!;
|
GetRoomsResponse get getRoomsResponse => _getRoomsResponse!;
|
||||||
|
@ -13,6 +13,7 @@ import 'app.dart';
|
|||||||
import 'data/chatList/chatListProps.dart';
|
import 'data/chatList/chatListProps.dart';
|
||||||
import 'data/chatList/chatProps.dart';
|
import 'data/chatList/chatProps.dart';
|
||||||
import 'data/accountModel.dart';
|
import 'data/accountModel.dart';
|
||||||
|
import 'data/files/filesProps.dart';
|
||||||
|
|
||||||
Future<void> main() async {
|
Future<void> main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -27,6 +28,7 @@ Future<void> main() async {
|
|||||||
ChangeNotifierProvider(create: (context) => TimetableProps()),
|
ChangeNotifierProvider(create: (context) => TimetableProps()),
|
||||||
ChangeNotifierProvider(create: (context) => ChatListProps()),
|
ChangeNotifierProvider(create: (context) => ChatListProps()),
|
||||||
ChangeNotifierProvider(create: (context) => ChatProps()),
|
ChangeNotifierProvider(create: (context) => ChatProps()),
|
||||||
|
ChangeNotifierProvider(create: (context) => FilesProps()),
|
||||||
],
|
],
|
||||||
child: const Main(),
|
child: const Main(),
|
||||||
)
|
)
|
||||||
|
@ -1,5 +1,16 @@
|
|||||||
|
|
||||||
|
import 'dart:developer';
|
||||||
|
|
||||||
|
import 'package:filesize/filesize.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:jiffy/jiffy.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cacheableFile.dart';
|
||||||
|
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/listFilesParams.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../../api/marianumcloud/webdav/queries/listFiles/listFiles.dart';
|
||||||
|
import '../../../api/marianumcloud/webdav/queries/listFiles/listFilesResponse.dart';
|
||||||
|
import '../../../data/files/filesProps.dart';
|
||||||
|
|
||||||
class Files extends StatefulWidget {
|
class Files extends StatefulWidget {
|
||||||
const Files({Key? key}) : super(key: key);
|
const Files({Key? key}) : super(key: key);
|
||||||
@ -13,7 +24,7 @@ class _FilesState extends State<Files> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
//Provider.of<FilesProps>(context, listen: false).run();
|
Provider.of<FilesProps>(context, listen: false).run();
|
||||||
});
|
});
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
@ -22,50 +33,31 @@ class _FilesState extends State<Files> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
Future<ListFilesResponse> files = ListFiles(ListFilesParams("/")).run();
|
||||||
|
files.then((value) => log(value.toJson().toString()));
|
||||||
|
|
||||||
// log("NEW CLIENT");
|
return Consumer<FilesProps>(
|
||||||
// Client client = newClient(
|
builder: (context, value, child) {
|
||||||
// "https://***REMOVED***:***REMOVED***@cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***/",
|
if(value.primaryLoading()) return const Center(child: CircularProgressIndicator());
|
||||||
// user: "***REMOVED***",
|
|
||||||
// password: "***REMOVED***",
|
|
||||||
// debug: true
|
|
||||||
// );
|
|
||||||
//
|
|
||||||
// // client.setHeaders(
|
|
||||||
// // {
|
|
||||||
// // "User-Agent": "Marianum Fulda/Alpha0.1 (Development build) ; https://mhsl.eu/id.html",
|
|
||||||
// // }
|
|
||||||
// // );
|
|
||||||
//
|
|
||||||
// log("DATA");
|
|
||||||
// log(client.readDir("/").toString());
|
|
||||||
|
|
||||||
// Future<List<FileInfo>> files = Client("https://cloud.marianum-fulda.de/remote.php/dav/files/***REMOVED***", "***REMOVED***", "***REMOVED***").ls();
|
return ListView.builder(
|
||||||
// log(files.toString());
|
itemCount: value.listFilesResponse.files.length,
|
||||||
// log("REQUEST FINISH");
|
itemBuilder: (context, index) {
|
||||||
//
|
CacheableFile file = value.listFilesResponse.files.skip(index).first;
|
||||||
// files.then((asd) => {
|
return ListTile(
|
||||||
// asd.forEach((element) {
|
leading: Icon(file.isDirectory ? Icons.folder : Icons.file_open_outlined),
|
||||||
// log(element.name);
|
title: Text(file.name),
|
||||||
// }),
|
subtitle: file.isDirectory ? Text("geändert ${Jiffy(file.modifiedAt).fromNow()}") : Text("${filesize(file.size)}, ${Jiffy(file.modifiedAt).fromNow()}}"),
|
||||||
// });
|
trailing: Icon(file.isDirectory ? Icons.arrow_right : Icons.open_in_new),
|
||||||
|
onTap: () {
|
||||||
// var client = NextcloudClient("https://cloud.marianum-fulda.de", username: "***REMOVED***", password: "***REMOVED***");
|
if(file.isDirectory) {
|
||||||
//
|
Provider.of<FilesProps>(context, listen: false).setPath(file.path);
|
||||||
// //client.baseHeaders.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
}
|
||||||
// //client.authentication?.headers.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
},
|
||||||
// //client.webdav.rootClient.baseHeaders.putIfAbsent("Authorization", () => "Basic ***REMOVED***");
|
);
|
||||||
//
|
},
|
||||||
// client.webdav.ls("/").then((value) => () {
|
);
|
||||||
// log("TEST");
|
}
|
||||||
// value.forEach((element) {
|
|
||||||
// log(element.name);
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
|
|
||||||
|
|
||||||
return const Center(
|
|
||||||
child: Text("Currently not implemented!"),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
// return Consumer<FilesProps>(
|
// return Consumer<FilesProps>(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:bubble/bubble.dart';
|
import 'package:bubble/bubble.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:jiffy/jiffy.dart';
|
import 'package:jiffy/jiffy.dart';
|
||||||
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatResponse.dart';
|
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatResponse.dart';
|
||||||
import 'package:marianum_mobile/screen/pages/talk/chatMessage.dart';
|
import 'package:marianum_mobile/screen/pages/talk/chatMessage.dart';
|
||||||
@ -123,17 +124,25 @@ class ChatBubble {
|
|||||||
showDialog(context: context, builder: (context) {
|
showDialog(context: context, builder: (context) {
|
||||||
return SimpleDialog(
|
return SimpleDialog(
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
Visibility(
|
||||||
leading: Icon(Icons.copy),
|
visible: !message.containsFile && bubbleData.messageType == GetRoomResponseObjectMessageType.comment,
|
||||||
title: Text("Nachricht kopieren"),
|
child: ListTile(
|
||||||
|
leading: const Icon(Icons.copy),
|
||||||
|
title: const Text("Nachricht kopieren"),
|
||||||
|
onTap: () => {
|
||||||
|
Clipboard.setData(ClipboardData(text: bubbleData.message)),
|
||||||
|
Navigator.of(context).pop(),
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.person),
|
leading: const Icon(Icons.person),
|
||||||
title: Text("Zu '${bubbleData.actorDisplayName}' wechseln"),
|
title: Text("Zu '${bubbleData.actorDisplayName}' wechseln"),
|
||||||
|
onTap: () => {},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: Icon(Icons.bug_report_outlined),
|
leading: const Icon(Icons.bug_report_outlined),
|
||||||
title: Text("Debugdaten anzeigen"),
|
title: const Text("Debugdaten anzeigen"),
|
||||||
onTap: () => JsonViewer.asDialog(context, bubbleData.toJson()),
|
onTap: () => JsonViewer.asDialog(context, bubbleData.toJson()),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user