diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index ea10ad6..ad74def 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -138,7 +138,7 @@ <entry key="build_runner_core"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/build_runner_core-7.2.9/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/build_runner_core-7.2.8/lib" /> </list> </value> </entry> @@ -152,7 +152,7 @@ <entry key="built_value"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/built_value-8.6.0/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/built_value-8.5.0/lib" /> </list> </value> </entry> @@ -257,7 +257,7 @@ <entry key="csslib"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/csslib-0.17.3/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/csslib-0.17.2/lib" /> </list> </value> </entry> @@ -299,7 +299,7 @@ <entry key="dynamite_runtime"> <value> <list> - <option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-3f80f9f6ded0a077464e825cd3c1c60aa797c743/packages/dynamite/dynamite_runtime/lib" /> + <option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-35eb2d65799f3e6a5f53b62da8cac868d3e52f86/packages/dynamite/dynamite_runtime/lib" /> </list> </value> </entry> @@ -327,7 +327,7 @@ <entry key="file_picker"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.1/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.0/lib" /> </list> </value> </entry> @@ -460,7 +460,7 @@ <entry key="graphs"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/graphs-2.3.1/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/graphs-2.3.0/lib" /> </list> </value> </entry> @@ -509,7 +509,7 @@ <entry key="image_picker_android"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+17/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+16/lib" /> </list> </value> </entry> @@ -551,7 +551,7 @@ <entry key="jiffy"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/jiffy-6.1.0/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/jiffy-6.2.1/lib" /> </list> </value> </entry> @@ -607,7 +607,7 @@ <entry key="logging"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/logging-1.2.0/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/logging-1.1.1/lib" /> </list> </value> </entry> @@ -649,7 +649,7 @@ <entry key="nextcloud"> <value> <list> - <option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-3f80f9f6ded0a077464e825cd3c1c60aa797c743/packages/nextcloud/lib" /> + <option value="$USER_HOME$/.pub-cache/git/nextcloud-neon-35eb2d65799f3e6a5f53b62da8cac868d3e52f86/packages/nextcloud/lib" /> </list> </value> </entry> @@ -705,7 +705,7 @@ <entry key="path_provider_linux"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.11/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/lib" /> </list> </value> </entry> @@ -971,7 +971,7 @@ <entry key="syncfusion_flutter_calendar"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_calendar-21.2.8/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_calendar-21.2.5/lib" /> </list> </value> </entry> @@ -985,7 +985,7 @@ <entry key="syncfusion_flutter_datepicker"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_datepicker-21.2.8/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_datepicker-21.2.5/lib" /> </list> </value> </entry> @@ -1055,7 +1055,7 @@ <entry key="timezone"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/timezone-0.9.2/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/timezone-0.9.1/lib" /> </list> </value> </entry> @@ -1090,7 +1090,7 @@ <entry key="url_launcher_android"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.35/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.34/lib" /> </list> </value> </entry> @@ -1125,7 +1125,7 @@ <entry key="url_launcher_web"> <value> <list> - <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.17/lib" /> + <option value="$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.16/lib" /> </list> </value> </entry> @@ -1210,8 +1210,8 @@ </properties> <CLASSES> <root url="file://$USER_HOME$/.pub-cache/git/flowder-1ddd171a763c4f1ba09b95e34e35e2e5cf0d1bba//lib" /> - <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-3f80f9f6ded0a077464e825cd3c1c60aa797c743/packages/dynamite/dynamite_runtime/lib" /> - <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-3f80f9f6ded0a077464e825cd3c1c60aa797c743/packages/nextcloud/lib" /> + <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-35eb2d65799f3e6a5f53b62da8cac868d3e52f86/packages/dynamite/dynamite_runtime/lib" /> + <root url="file://$USER_HOME$/.pub-cache/git/nextcloud-neon-35eb2d65799f3e6a5f53b62da8cac868d3e52f86/packages/nextcloud/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/_fe_analyzer_shared-61.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/analyzer-5.13.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/animated_digit-3.2.1/lib" /> @@ -1231,9 +1231,9 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/build_daemon-4.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/build_resolvers-2.2.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/build_runner-2.4.4/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/build_runner_core-7.2.9/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/build_runner_core-7.2.8/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/built_collection-5.1.1/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/built_value-8.6.0/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/built_value-8.5.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cached_network_image-3.2.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cached_network_image_platform_interface-2.0.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cached_network_image_web-1.0.2/lib" /> @@ -1248,7 +1248,7 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cross_file-0.3.3+4/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/crypto-3.0.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/crypton-2.1.0/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/csslib-0.17.3/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/csslib-0.17.2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/dart_style-2.3.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/device_info_plus-8.2.2/lib" /> @@ -1257,7 +1257,7 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/fake_async-1.3.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/ffi-2.0.2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file-6.1.4/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.1/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/filesize-2.0.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/fixnum-1.1.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/flutter_blurhash-0.7.0/lib" /> @@ -1271,20 +1271,20 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/font_awesome_flutter-10.4.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/frontend_server_client-3.2.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/glob-2.1.2/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/graphs-2.3.1/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/graphs-2.3.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/html-0.15.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/http-0.13.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/http_multi_server-3.2.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/http_parser-4.0.2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image-4.0.17/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker-0.8.7+5/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+17/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+16/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_for_web-2.1.12/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.7+4/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_platform_interface-2.6.3/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/intl-0.18.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/io-1.0.4/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/jiffy-6.1.0/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/jiffy-6.2.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/js-0.6.7/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/json_annotation-4.8.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/json_serializable-6.7.0/lib" /> @@ -1292,7 +1292,7 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/lints-2.1.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/loader_overlay-2.2.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/localstore-1.3.5/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/logging-1.2.0/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/logging-1.1.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/matcher-0.12.15/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/material_color_utilities-0.2.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/meta-1.9.1/lib" /> @@ -1305,7 +1305,7 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider-2.0.15/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_android-2.0.27/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_foundation-2.2.3/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.11/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_platform_interface-2.0.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/pedantic-1.11.1/lib" /> @@ -1342,9 +1342,9 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/stream_channel-2.1.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/stream_transform-2.1.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/string_scanner-1.2.0/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_calendar-21.2.8/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_calendar-21.2.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_core-21.2.8/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_datepicker-21.2.8/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_datepicker-21.2.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdf-21.2.8/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-21.2.8/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_macos-21.2.8/lib" /> @@ -1354,17 +1354,17 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/synchronized-3.1.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/term_glyph-1.2.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/test_api-0.5.1/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/timezone-0.9.2/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/timezone-0.9.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/timing-1.0.1/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/typed_data-1.3.2/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/universal_io-2.2.0/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher-6.1.11/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.35/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.34/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_ios-6.1.4/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_linux-3.0.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_macos-3.0.5/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_platform_interface-2.1.2/lib" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.17/lib" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.16/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_windows-3.0.6/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/uuid-3.0.7/lib" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib" /> diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml index dd17680..8024f0a 100644 --- a/.idea/libraries/Flutter_Plugins.xml +++ b/.idea/libraries/Flutter_Plugins.xml @@ -22,15 +22,15 @@ <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/shared_preferences-2.1.1" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.7+4" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_windows-2.1.6" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.16" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.34" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+16" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.10" /> + <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.0" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/device_info_plus-8.2.2" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_pdfviewer_web-21.2.8" /> <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/syncfusion_flutter_pdfviewer-21.2.8" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.17" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/url_launcher_android-6.0.35" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/image_picker_android-0.8.6+17" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/path_provider_linux-2.1.11" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/better_open_file-3.6.4" /> - <root url="file://$USER_HOME$/.pub-cache/hosted/pub.dev/file_picker-5.3.1" /> </CLASSES> <JAVADOC /> <SOURCES /> diff --git a/lib/api/marianumcloud/autocomplete/autocompleteApi.dart b/lib/api/marianumcloud/autocomplete/autocompleteApi.dart index 3618b97..bc35f78 100644 --- a/lib/api/marianumcloud/autocomplete/autocompleteApi.dart +++ b/lib/api/marianumcloud/autocomplete/autocompleteApi.dart @@ -1,5 +1,5 @@ import 'dart:convert'; -import 'dart:developer'; +import 'dart:io'; import 'package:http/http.dart' as http; import 'package:http/http.dart'; @@ -9,7 +9,6 @@ import 'autocompleteResponse.dart'; class AutocompleteApi { Future<AutocompleteResponse> find(String query) async { - log("query starting"); var preferences = await SharedPreferences.getInstance(); Map<String, dynamic> getParameters = { "search": query, @@ -24,13 +23,10 @@ class AutocompleteApi { headers.putIfAbsent("OCS-APIRequest", () => "true"); Uri endpoint = Uri.https("${preferences.getString("username")!}:${preferences.getString("password")!}@cloud.marianum-fulda.de", "/ocs/v2.php/core/autocomplete/get", getParameters); - log(endpoint.query); Response response = await http.get(endpoint, headers: headers); - log(response.statusCode.toString()); + if(response.statusCode != HttpStatus.ok) throw Exception("Api call failed with ${response.statusCode}: ${response.body}"); String result = response.body; - log(result); - return AutocompleteResponse.fromJson(jsonDecode(result)['ocs']); } diff --git a/lib/view/pages/talk/chatList.dart b/lib/view/pages/talk/chatList.dart index 600816f..4d26340 100644 --- a/lib/view/pages/talk/chatList.dart +++ b/lib/view/pages/talk/chatList.dart @@ -2,16 +2,14 @@ import 'dart:async'; import 'package:flutter/material.dart'; import 'package:jiffy/jiffy.dart'; +import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoom.dart'; +import 'package:marianum_mobile/api/marianumcloud/talk/room/getRoomParams.dart'; +import 'package:marianum_mobile/view/pages/talk/chatTile.dart'; +import 'package:marianum_mobile/view/pages/talk/searchChat.dart'; import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; import 'package:provider/provider.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import '../../../api/marianumcloud/talk/chat/richObjectStringProcessor.dart'; -import '../../../api/marianumcloud/talk/leaveRoom/leaveRoom.dart'; -import '../../../api/marianumcloud/talk/room/getRoomResponse.dart'; -import '../../../api/marianumcloud/talk/setFavorite/setFavorite.dart'; -import '../../../api/marianumcloud/talk/setReadMarker/setReadMarker.dart'; -import '../../../api/marianumcloud/talk/setReadMarker/setReadMarkerParams.dart'; import '../../../model/chatList/chatListProps.dart'; import '../../../widget/confirmDialog.dart'; import '../../../widget/unimplementedDialog.dart'; @@ -26,16 +24,11 @@ class ChatList extends StatefulWidget { } class _ChatListState extends State<ChatList> { - late String username; @override void initState() { super.initState(); - SharedPreferences.getInstance().then((value) => { - username = value.getString("username")! - }); - WidgetsBinding.instance.addPostFrameCallback((timeStamp) { _query(); }); @@ -54,8 +47,8 @@ class _ChatListState extends State<ChatList> { actions: [ IconButton( icon: const Icon(Icons.search), - onPressed: () => { - UnimplementedDialog.show(context) + onPressed: () async { + showSearch(context: context, delegate: SearchChat((await GetRoom(GetRoomParams(includeStatus: true)).run()).data.toList())); }, ) ], @@ -74,145 +67,10 @@ class _ChatListState extends State<ChatList> { return const Center(child: CircularProgressIndicator()); } - List<ListTile> chats = List<ListTile>.empty(growable: true); + List<ChatTile> chats = List<ChatTile>.empty(growable: true); for (var chatRoom in data.getRoomsResponse.sortByLastActivity()) { - - setCurrentAsRead() { - SetReadMarker( - chatRoom.token, - true, - setReadMarkerParams: SetReadMarkerParams( - lastReadMessage: chatRoom.lastMessage.id - ) - ).run().then((value) => _query(renew: true)); - } - - CircleAvatar circleAvatar = CircleAvatar( - foregroundImage: chatRoom.type == GetRoomResponseObjectConversationType.oneToOne ? Image.network("https://cloud.marianum-fulda.de/avatar/${chatRoom.name}/128").image : null, - backgroundColor: Theme.of(context).primaryColor, - foregroundColor: Colors.white, - child: chatRoom.type == GetRoomResponseObjectConversationType.group ? const Icon(Icons.group) : const Icon(Icons.person), - ); - - chats.add(ListTile( - leading: Stack( - children: [ - circleAvatar, - Visibility( - visible: chatRoom.isFavorite, - child: Positioned( - right: 0, - bottom: 0, - child: Container( - padding: const EdgeInsets.all(1), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor.withAlpha(200), - borderRadius: BorderRadius.circular(90.0), - ), - child: const Icon(Icons.star, color: Colors.amberAccent, size: 15), - ), - ), - ) - ], - ), - title: Text(chatRoom.displayName), - subtitle: Text("${Jiffy.parseFromMillisecondsSinceEpoch(chatRoom.lastMessage.timestamp * 1000).fromNow()}: ${RichObjectStringProcessor.parseToString(chatRoom.lastMessage.message.replaceAll("\n", " "), chatRoom.lastMessage.messageParameters)}", overflow: TextOverflow.ellipsis), - trailing: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Visibility( - visible: chatRoom.unreadMessages > 0, - child: Container( - padding: const EdgeInsets.all(1), - decoration: BoxDecoration( - color: Theme.of(context).primaryColor, - borderRadius: BorderRadius.circular(30), - ), - constraints: const BoxConstraints( - minWidth: 20, - minHeight: 20, - ), - child: Text( - "${chatRoom.unreadMessages}", - style: const TextStyle( - color: Colors.white, - fontSize: 15, - ), - textAlign: TextAlign.center, - ), - ), - ), - ], - ), - onTap: () async { - setCurrentAsRead(); - PersistentNavBarNavigator.pushNewScreen( - context, - screen: ChatView(room: chatRoom, selfId: username, avatar: circleAvatar), - withNavBar: false - ); - }, - onLongPress: () { - showDialog(context: context, builder: (context) => SimpleDialog( - children: [ - Visibility( - visible: chatRoom.unreadMessages > 0, - replacement: ListTile( - leading: const Icon(Icons.mark_chat_unread_outlined), - title: const Text("Als ungelesen markieren"), - onTap: () { - SetReadMarker(chatRoom.token, false).run().then((value) => _query(renew: true)); - Navigator.of(context).pop(); - }, - ), - child: ListTile( - leading: const Icon(Icons.mark_chat_read_outlined), - title: const Text("Als gelesen markieren"), - onTap: () { - setCurrentAsRead(); - Navigator.of(context).pop(); - }, - ), - ), - Visibility( - visible: chatRoom.isFavorite, - replacement: ListTile( - leading: const Icon(Icons.star_outline), - title: const Text("Zu favoriten hinzufügen"), - onTap: () { - SetFavorite(chatRoom.token, true).run().then((value) => _query(renew: true)); - Navigator.of(context).pop(); - }, - ), - child: ListTile( - leading: const Icon(Icons.stars_outlined), - title: const Text("Von favoriten entfernen"), - onTap: () { - SetFavorite(chatRoom.token, false).run().then((value) => _query(renew: true)); - Navigator.of(context).pop(); - }, - ), - ), - ListTile( - leading: const Icon(Icons.delete_outline), - title: const Text("Konversation verlassen"), - onTap: () { - ConfirmDialog( - title: "Chat verlassen", - content: "Du benötigst ggf. eine Einladung um erneut beizutreten.", - confirmButton: "Löschen", - onConfirm: () { - LeaveRoom(chatRoom.token).run().then((value) => _query(renew: true)); - Navigator.of(context).pop(); - }, - ).asDialog(context); - }, - ), - ], - )); - }, - )); + chats.add(ChatTile(data: chatRoom, query: _query)); } return RefreshIndicator( diff --git a/lib/view/pages/talk/joinChat.dart b/lib/view/pages/talk/joinChat.dart index fb58e9f..edc27b2 100644 --- a/lib/view/pages/talk/joinChat.dart +++ b/lib/view/pages/talk/joinChat.dart @@ -46,7 +46,6 @@ class JoinChat extends SearchDelegate<String> { Widget buildResults(BuildContext context) { if(future != null) future!.cancel(); - log("search started"); if(query.isEmpty) { return const ErrorView( text: "Suche nach benutzern",