mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-23 20:49:26 +01:00
Apply 1 suggestion(s) to 1 file(s)
This commit is contained in:
parent
018e434d49
commit
0eba2ae859
@ -834,16 +834,22 @@ class ChatController extends State<Chat> {
|
||||
if (response == OkCancelResult.ok) {
|
||||
final events = room!.pinnedEventIds
|
||||
..removeWhere((oldEvent) => oldEvent == eventId);
|
||||
room!.setPinnedEvents(events);
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room!.setPinnedEvents(events),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void pinEvent() {
|
||||
room!.setPinnedEvents(
|
||||
<String>{
|
||||
...room!.pinnedEventIds,
|
||||
...selectedEvents.map((e) => e.eventId),
|
||||
}.toList(),
|
||||
showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => room!.setPinnedEvents(
|
||||
<String>{
|
||||
...room!.pinnedEventIds,
|
||||
...selectedEvents.map((e) => e.eventId),
|
||||
}.toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2,17 +2,42 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:adaptive_dialog/adaptive_dialog.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
import 'package:matrix/matrix.dart';
|
||||
import 'package:matrix_link_text/link_text.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pages/chat/events/message_content.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions.dart/matrix_locals.dart';
|
||||
import 'package:fluffychat/utils/url_launcher.dart';
|
||||
|
||||
class PinnedEvents extends StatelessWidget {
|
||||
final ChatController controller;
|
||||
|
||||
const PinnedEvents(this.controller, {Key? key}) : super(key: key);
|
||||
|
||||
Future<void> _displayPinnedEventsDialog(
|
||||
BuildContext context, List<Event?> events) async {
|
||||
final eventId = events.length == 1
|
||||
? events.single?.eventId
|
||||
: await showModalActionSheet<String>(
|
||||
context: context,
|
||||
actions: events
|
||||
.map((event) => SheetAction(
|
||||
key: event?.eventId ?? '',
|
||||
label: event?.getLocalizedBody(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
withSenderNamePrefix: true,
|
||||
hideReply: true,
|
||||
) ??
|
||||
'UNKNOWN',
|
||||
))
|
||||
.toList());
|
||||
|
||||
if (eventId != null) controller.scrollToEventId(eventId);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pinnedEventIds = controller.room!.pinnedEventIds;
|
||||
@ -30,39 +55,51 @@ class PinnedEvents extends StatelessWidget {
|
||||
return FutureBuilder<List<Event?>>(
|
||||
future: Future.wait(completers.map((e) => e.future).toList()),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData &&
|
||||
snapshot.data != null &&
|
||||
snapshot.data!.isNotEmpty &&
|
||||
snapshot.data!.first != null) {
|
||||
final pinnedEvents = snapshot.data;
|
||||
final event = (pinnedEvents != null && pinnedEvents.isNotEmpty)
|
||||
? snapshot.data?.last
|
||||
: null;
|
||||
|
||||
if (event != null && pinnedEvents != null) {
|
||||
final fontSize =
|
||||
AppConfig.messageFontSize * AppConfig.fontSizeFactor;
|
||||
return Material(
|
||||
color: Theme.of(context).secondaryHeaderColor,
|
||||
child: ConstrainedBox(
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: 96,
|
||||
color: Theme.of(context).appBarTheme.backgroundColor,
|
||||
elevation: Theme.of(context).appBarTheme.elevation ?? 10,
|
||||
shadowColor: Theme.of(context).appBarTheme.shadowColor,
|
||||
child: ListTile(
|
||||
tileColor: Colors.transparent,
|
||||
onTap: () => _displayPinnedEventsDialog(
|
||||
context,
|
||||
pinnedEvents,
|
||||
),
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
reverse: true,
|
||||
itemBuilder: (c, i) {
|
||||
final event = snapshot.data![i]!;
|
||||
return ListTile(
|
||||
tileColor: Colors.transparent,
|
||||
onTap: () => controller.scrollToEventId(event.eventId),
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.push_pin_outlined),
|
||||
tooltip: L10n.of(context)!.unpin,
|
||||
onPressed: () => controller.unpinEvent(event.eventId),
|
||||
),
|
||||
title: MessageContent(
|
||||
snapshot.data![i]!,
|
||||
textColor:
|
||||
Theme.of(context).brightness == Brightness.dark
|
||||
? Colors.white
|
||||
: Colors.black,
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: snapshot.data!.length,
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
tooltip: L10n.of(context)!.unpin,
|
||||
onPressed: () => controller.unpinEvent(event.eventId),
|
||||
),
|
||||
title: LinkText(
|
||||
text: event.getLocalizedBody(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
withSenderNamePrefix: true,
|
||||
hideReply: true,
|
||||
),
|
||||
maxLines: 3,
|
||||
textStyle: TextStyle(
|
||||
fontSize: fontSize,
|
||||
decoration:
|
||||
event.redacted ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
linkStyle: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText1
|
||||
?.color
|
||||
?.withAlpha(150),
|
||||
fontSize: fontSize,
|
||||
decoration: TextDecoration.underline,
|
||||
),
|
||||
onLinkTap: (url) => UrlLauncher(context, url).launchUrl(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -98,10 +98,10 @@ class HomeserverPickerController extends State<HomeserverPicker> {
|
||||
});
|
||||
|
||||
try {
|
||||
final wellKnown =
|
||||
final summary =
|
||||
await Matrix.of(context).getLoginClient().checkHomeserver(homeserver);
|
||||
|
||||
var jitsi = wellKnown?.additionalProperties
|
||||
var jitsi = summary.discoveryInformation?.additionalProperties
|
||||
.tryGet<Map<String, dynamic>>('im.vector.riot.jitsi')
|
||||
?.tryGet<String>('preferredDomain');
|
||||
if (jitsi != null) {
|
||||
|
@ -119,7 +119,7 @@ class LoginController extends State<Login> {
|
||||
future: () => Matrix.of(context)
|
||||
.getLoginClient()
|
||||
.checkHomeserver(newDomain)
|
||||
.catchError((e) => null),
|
||||
.catchError((e) {}),
|
||||
);
|
||||
if (Matrix.of(context).getLoginClient().homeserver == null) {
|
||||
Matrix.of(context).getLoginClient().homeserver = oldHomeserver;
|
||||
|
28
pubspec.lock
28
pubspec.lock
@ -755,7 +755,7 @@ packages:
|
||||
name: js
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.6.4"
|
||||
version: "0.6.3"
|
||||
latlong2:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -818,16 +818,14 @@ packages:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
version: "0.1.3"
|
||||
matrix:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "."
|
||||
ref: main
|
||||
resolved-ref: "788f8ea2a1fc6c3e417e74750c7200504275700f"
|
||||
url: "https://gitlab.com/famedly/company/frontend/famedlysdk.git"
|
||||
source: git
|
||||
version: "0.8.7"
|
||||
name: matrix
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.9"
|
||||
matrix_api_lite:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -967,7 +965,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.0"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1357,7 +1355,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.8.1"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1420,21 +1418,21 @@ packages:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.20.1"
|
||||
version: "1.19.5"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.9"
|
||||
version: "0.4.8"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.11"
|
||||
version: "0.4.9"
|
||||
timezone:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1602,7 +1600,7 @@ packages:
|
||||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.2"
|
||||
version: "2.1.1"
|
||||
video_compress:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1758,5 +1756,5 @@ packages:
|
||||
source: hosted
|
||||
version: "3.1.0"
|
||||
sdks:
|
||||
dart: ">=2.16.0-100.0.dev <3.0.0"
|
||||
dart: ">=2.15.1 <3.0.0"
|
||||
flutter: ">=2.8.0"
|
||||
|
@ -50,7 +50,7 @@ dependencies:
|
||||
intl: any
|
||||
localstorage: ^4.0.0+1
|
||||
lottie: ^1.2.1
|
||||
matrix: ^0.8.7
|
||||
matrix: ^0.8.9
|
||||
matrix_link_text: ^1.0.2
|
||||
open_noti_settings: ^0.4.0
|
||||
package_info_plus: ^1.2.1
|
||||
@ -118,8 +118,4 @@ dependency_overrides:
|
||||
hosted:
|
||||
name: geolocator_android
|
||||
url: https://hanntech-gmbh.gitlab.io/free2pass/flutter-geolocator-floss
|
||||
matrix:
|
||||
git:
|
||||
url: https://gitlab.com/famedly/company/frontend/famedlysdk.git
|
||||
ref: main
|
||||
provider: 5.0.0
|
||||
|
@ -9,9 +9,6 @@ list(APPEND FLUTTER_PLUGIN_LIST
|
||||
url_launcher_windows
|
||||
)
|
||||
|
||||
list(APPEND FLUTTER_FFI_PLUGIN_LIST
|
||||
)
|
||||
|
||||
set(PLUGIN_BUNDLED_LIBRARIES)
|
||||
|
||||
foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
@ -20,8 +17,3 @@ foreach(plugin ${FLUTTER_PLUGIN_LIST})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})
|
||||
endforeach(plugin)
|
||||
|
||||
foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST})
|
||||
add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin})
|
||||
list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries})
|
||||
endforeach(ffi_plugin)
|
||||
|
Loading…
Reference in New Issue
Block a user