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