diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index 4eb975c..9f978a4 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -5,14 +5,14 @@
-
+
-
+
@@ -33,7 +33,7 @@
-
+
@@ -61,7 +61,7 @@
-
+
@@ -250,7 +250,7 @@
-
+
@@ -432,7 +432,7 @@
-
+
@@ -544,7 +544,7 @@
-
+
@@ -572,21 +572,21 @@
-
+
-
+
-
+
@@ -607,7 +607,7 @@
-
+
@@ -649,7 +649,7 @@
-
+
@@ -712,49 +712,49 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
@@ -775,7 +775,7 @@
-
+
@@ -810,14 +810,14 @@
-
+
-
+
@@ -852,7 +852,7 @@
-
+
@@ -908,28 +908,28 @@
-
+
-
+
-
+
-
+
@@ -950,7 +950,7 @@
-
+
@@ -985,14 +985,14 @@
-
+
-
+
@@ -1010,6 +1010,13 @@
+
+
+
+
+
+
+
@@ -1021,16 +1028,16 @@
-
-
-
+
+
+
-
+
-
+
@@ -1057,7 +1064,7 @@
-
+
@@ -1079,7 +1086,7 @@
-
+
@@ -1098,18 +1105,18 @@
-
-
-
+
+
+
-
+
-
+
@@ -1118,26 +1125,26 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
@@ -1145,21 +1152,22 @@
-
-
-
-
+
+
+
+
-
+
-
-
+
+
+
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
index 1a53683..52f4a21 100644
--- a/.idea/libraries/Flutter_Plugins.xml
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -2,26 +2,26 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 639900d..6e86672 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,4 +1,3 @@
-
diff --git a/android/.idea/.gitignore b/android/.idea/.gitignore
new file mode 100644
index 0000000..26d3352
--- /dev/null
+++ b/android/.idea/.gitignore
@@ -0,0 +1,3 @@
+# Default ignored files
+/shelf/
+/workspace.xml
diff --git a/android/.idea/compiler.xml b/android/.idea/compiler.xml
new file mode 100644
index 0000000..b589d56
--- /dev/null
+++ b/android/.idea/compiler.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/.idea/gradle.xml b/android/.idea/gradle.xml
new file mode 100644
index 0000000..7fef957
--- /dev/null
+++ b/android/.idea/gradle.xml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/.idea/jarRepositories.xml b/android/.idea/jarRepositories.xml
new file mode 100644
index 0000000..2cb85bc
--- /dev/null
+++ b/android/.idea/jarRepositories.xml
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/.idea/kotlinc.xml b/android/.idea/kotlinc.xml
new file mode 100644
index 0000000..4515aa3
--- /dev/null
+++ b/android/.idea/kotlinc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/.idea/misc.xml b/android/.idea/misc.xml
new file mode 100644
index 0000000..0ad17cb
--- /dev/null
+++ b/android/.idea/misc.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/.idea/vcs.xml b/android/.idea/vcs.xml
new file mode 100644
index 0000000..6c0b863
--- /dev/null
+++ b/android/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/lib/api/marianumcloud/webdav/queries/listFiles/listFiles.dart b/lib/api/marianumcloud/webdav/queries/listFiles/listFiles.dart
index fd3a472..a9e6490 100644
--- a/lib/api/marianumcloud/webdav/queries/listFiles/listFiles.dart
+++ b/lib/api/marianumcloud/webdav/queries/listFiles/listFiles.dart
@@ -3,6 +3,7 @@ import 'package:marianum_mobile/api/marianumcloud/webdav/queries/listFiles/cache
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/webdavApi.dart';
+import 'package:nextcloud/nextcloud.dart';
class ListFiles extends WebdavApi {
ListFilesParams params;
@@ -11,7 +12,8 @@ class ListFiles extends WebdavApi {
@override
Future run() async {
- Set files = (await (await WebdavApi.webdav).ls(params.path)).map((e) => CacheableFile.fromDavFile(e)).toSet();
+ //Set files = (await (await WebdavApi.webdav).ls(params.path)).map((e) => CacheableFile.fromDavFile(e)).toSet();
+ Set files = (await (await WebdavApi.webdav).ls(params.path)).toWebDavFiles((await WebdavApi.webdav)).map((e) => CacheableFile.fromDavFile(e)).toSet();
return ListFilesResponse(files);
}
diff --git a/lib/screen/pages/files/fileElement.dart b/lib/screen/pages/files/fileElement.dart
index 25fa159..d03d019 100644
--- a/lib/screen/pages/files/fileElement.dart
+++ b/lib/screen/pages/files/fileElement.dart
@@ -20,16 +20,7 @@ class FileElement extends StatefulWidget {
List path;
FileElement(this.file, this.path, {Key? key}) : super(key: key);
- @override
- State createState() => _FileElementState();
-}
-
-class _FileElementState extends State {
- late DownloaderCore core;
- double percent = 0;
-
- void download(String remotePath, String name) async {
-
+ static void download(String remotePath, String name, Function(double) onProgress, Function(OpenResult) onDone) async {
Directory paths = await getApplicationDocumentsDirectory();
String local = paths.path + Platform.pathSeparator + name;
@@ -37,9 +28,7 @@ class _FileElementState extends State {
DownloaderUtils options = DownloaderUtils(
progressCallback: (current, total) {
final progress = (current / total) * 100;
- setState(() => {
- percent = progress,
- });
+ onProgress(progress);
},
file: File(local),
progress: ProgressImplementation(),
@@ -48,29 +37,26 @@ class _FileElementState extends State {
Future result = OpenFile.open(local);
result.then((value) => {
- if(value.type != ResultType.done) {
- showDialog(context: context, builder: (context) {
- return AlertDialog(
- title: Text("Download"),
- content: Text(value.message),
- );
- })
- }
+ onDone(value)
});
-
- widget.file.currentlyDownloading = false;
- percent = 0;
},
);
log(local);
- core = await Flowder.download(
+ await Flowder.download(
"${await WebdavApi.webdavConnectString}$remotePath",
options,
);
}
+ @override
+ State createState() => _FileElementState();
+}
+
+class _FileElementState extends State {
+ double percent = 0;
+
Widget getSubtitle() {
if(widget.file.currentlyDownloading) {
return Row(
@@ -114,7 +100,25 @@ class _FileElementState extends State {
log("Download: ${widget.file.path} to ${widget.file.name}");
- download(widget.file.path, widget.file.name);
+ FileElement.download(widget.file.path, widget.file.name, (progress) {
+ setState(() => {
+ percent = progress,
+ });
+ }, (result) {
+ if(result.type != ResultType.done) {
+ showDialog(context: context, builder: (context) {
+ return AlertDialog(
+ title: Text("Download"),
+ content: Text(result.message),
+ );
+ });
+
+ setState(() {
+ widget.file.currentlyDownloading = false;
+ percent = 0;
+ });
+ }
+ });
}
},
diff --git a/lib/screen/pages/talk/chatBubble.dart b/lib/screen/pages/talk/chatBubble.dart
index d6f4ff5..c96dff9 100644
--- a/lib/screen/pages/talk/chatBubble.dart
+++ b/lib/screen/pages/talk/chatBubble.dart
@@ -1,8 +1,10 @@
+import 'package:better_open_file/better_open_file.dart';
import 'package:bubble/bubble.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:jiffy/jiffy.dart';
import 'package:marianum_mobile/api/marianumcloud/talk/chat/getChatResponse.dart';
+import 'package:marianum_mobile/screen/pages/files/fileElement.dart';
import 'package:marianum_mobile/screen/pages/talk/chatMessage.dart';
import '../../../api/marianumcloud/talk/room/getRoomResponse.dart';
@@ -43,6 +45,7 @@ class ChatBubble {
bool isSender;
GetChatResponseObject bubbleData;
GetRoomResponseObject chatData;
+ double downloadProgress = 0;
late ChatMessage message;
ChatBubble({
@@ -109,11 +112,19 @@ class ChatBubble {
child: Positioned(
bottom: 0,
right: 0,
- child: Text(
- Jiffy.unixFromSecondsSinceEpoch(bubbleData.timestamp).format("HH:mm"),
- textAlign: TextAlign.end,
- style: const TextStyle(color: Colors.grey, fontSize: 12),
- ),
+ child: Row(
+ children: [
+ Visibility(
+ visible: downloadProgress > 0,
+ child: LinearProgressIndicator(value: downloadProgress),
+ ),
+ Text(
+ Jiffy.unixFromSecondsSinceEpoch(bubbleData.timestamp).format("HH:mm"),
+ textAlign: TextAlign.end,
+ style: const TextStyle(color: Colors.grey, fontSize: 12),
+ ),
+ ],
+ )
),
),
],
@@ -135,10 +146,13 @@ class ChatBubble {
},
),
),
- ListTile(
- leading: const Icon(Icons.person),
- title: Text("Zu '${bubbleData.actorDisplayName}' wechseln"),
- onTap: () => {},
+ Visibility(
+ visible: !isSender && chatData.type != GetRoomResponseObjectConversationType.oneToOne,
+ child: ListTile(
+ leading: const Icon(Icons.person),
+ title: Text("Private Nachricht an '${bubbleData.actorDisplayName}'"),
+ onTap: () => {},
+ ),
),
ListTile(
leading: const Icon(Icons.bug_report_outlined),
@@ -149,10 +163,24 @@ class ChatBubble {
);
});
},
+ onTap: () {
+ FileElement.download(message.file!.path!, message.file?.name ?? "Datei", (progress) => {
+ downloadProgress = progress,
+ }, (result) => {
+ downloadProgress = 0,
+ if(result.type != ResultType.done) {
+ showDialog(context: context, builder: (context) {
+ return AlertDialog(
+ content: Text(result.message),
+ );
+ })
+ }
+ });
+
+ },
);
}
-
Size _textSize(String text, TextStyle style) {
final TextPainter textPainter = TextPainter(
text: TextSpan(text: text, style: style),
diff --git a/lib/screen/pages/talk/chatMessage.dart b/lib/screen/pages/talk/chatMessage.dart
index f20f2f9..1be542a 100644
--- a/lib/screen/pages/talk/chatMessage.dart
+++ b/lib/screen/pages/talk/chatMessage.dart
@@ -53,7 +53,7 @@ class ChatMessage {
fadeInDuration: const Duration(seconds: 1),
imageUrl: "https://cloud.marianum-fulda.de/core/preview?fileId=${file!.id}&x=100&y=-1&a=1",
httpHeaders: {
- "Authorization": "Basic ${base64.encode(utf8.encode("${preferences.getString("username")}:${preferences.getString("password")}"))}"
+ "Authorization": "Basic ${base64.encode(utf8.encode("${preferences.getString("username")}:${preferences.getString("password")}"))}" // TODO move authentication
},
);
}