mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-20 08:00:39 +01:00
Merge branch 'krille/stories-profiles' into 'main'
fix: Load story avatars faster See merge request famedly/fluffychat!750
This commit is contained in:
commit
5b91bc3a27
@ -121,22 +121,31 @@ class StoriesHeader extends StatelessWidget {
|
|||||||
...client.storiesRooms.map(
|
...client.storiesRooms.map(
|
||||||
(room) => Opacity(
|
(room) => Opacity(
|
||||||
opacity: room.hasPosts ? 1 : 0.75,
|
opacity: room.hasPosts ? 1 : 0.75,
|
||||||
child: _StoryButton(
|
child: FutureBuilder<Profile>(
|
||||||
label: room.creatorDisplayname,
|
future: room.getCreatorProfile(),
|
||||||
child: Avatar(
|
builder: (context, snapshot) {
|
||||||
mxContent: room
|
final displayname = snapshot.data?.displayName ??
|
||||||
|
room
|
||||||
.getState(EventTypes.RoomCreate)!
|
.getState(EventTypes.RoomCreate)!
|
||||||
.sender
|
.senderId
|
||||||
.avatarUrl,
|
.localpart!;
|
||||||
name: room.creatorDisplayname,
|
final avatarUrl = snapshot.data?.avatarUrl;
|
||||||
|
return _StoryButton(
|
||||||
|
label: displayname,
|
||||||
|
child: Avatar(
|
||||||
|
mxContent: avatarUrl,
|
||||||
|
name: displayname,
|
||||||
size: 100,
|
size: 100,
|
||||||
fontSize: 24,
|
fontSize: 24,
|
||||||
),
|
),
|
||||||
unread: room.membership == Membership.invite ||
|
unread: room.membership == Membership.invite ||
|
||||||
room.hasNewMessages,
|
room.hasNewMessages,
|
||||||
onPressed: () => _goToStoryAction(context, room.id),
|
onPressed: () =>
|
||||||
onLongPressed: () => _contextualActions(context, room),
|
_goToStoryAction(context, room.id),
|
||||||
),
|
onLongPressed: () =>
|
||||||
|
_contextualActions(context, room),
|
||||||
|
);
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -148,8 +157,8 @@ class StoriesHeader extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
extension on Room {
|
extension on Room {
|
||||||
String get creatorDisplayname =>
|
Future<Profile> getCreatorProfile() =>
|
||||||
getState(EventTypes.RoomCreate)!.sender.calcDisplayname();
|
client.getProfileFromUserId(getState(EventTypes.RoomCreate)!.senderId);
|
||||||
|
|
||||||
bool get hasPosts {
|
bool get hasPosts {
|
||||||
if (membership == Membership.invite) return true;
|
if (membership == Membership.invite) return true;
|
||||||
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
|
|
||||||
|
import 'package:desktop_lifecycle/desktop_lifecycle.dart';
|
||||||
import 'package:desktop_notifications/desktop_notifications.dart';
|
import 'package:desktop_notifications/desktop_notifications.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
@ -17,7 +18,10 @@ import 'package:fluffychat/widgets/matrix.dart';
|
|||||||
extension LocalNotificationsExtension on MatrixState {
|
extension LocalNotificationsExtension on MatrixState {
|
||||||
void showLocalNotification(EventUpdate eventUpdate) async {
|
void showLocalNotification(EventUpdate eventUpdate) async {
|
||||||
final roomId = eventUpdate.roomID;
|
final roomId = eventUpdate.roomID;
|
||||||
if (webHasFocus && activeRoomId == roomId) return;
|
if (activeRoomId == roomId) {
|
||||||
|
if (kIsWeb && webHasFocus) return;
|
||||||
|
if (Platform.isLinux && DesktopLifecycle.instance.isActive.value) return;
|
||||||
|
}
|
||||||
final room = client.getRoomById(roomId);
|
final room = client.getRoomById(roomId);
|
||||||
if (room == null) {
|
if (room == null) {
|
||||||
Logs().w('Can not display notification for unknown room $roomId');
|
Logs().w('Can not display notification for unknown room $roomId');
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#include "generated_plugin_registrant.h"
|
#include "generated_plugin_registrant.h"
|
||||||
|
|
||||||
#include <desktop_drop/desktop_drop_plugin.h>
|
#include <desktop_drop/desktop_drop_plugin.h>
|
||||||
|
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
|
||||||
#include <file_selector_linux/file_selector_plugin.h>
|
#include <file_selector_linux/file_selector_plugin.h>
|
||||||
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
#include <flutter_secure_storage_linux/flutter_secure_storage_linux_plugin.h>
|
||||||
#include <url_launcher_linux/url_launcher_plugin.h>
|
#include <url_launcher_linux/url_launcher_plugin.h>
|
||||||
@ -15,6 +16,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
|
|||||||
g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
|
g_autoptr(FlPluginRegistrar) desktop_drop_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopDropPlugin");
|
||||||
desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);
|
desktop_drop_plugin_register_with_registrar(desktop_drop_registrar);
|
||||||
|
g_autoptr(FlPluginRegistrar) desktop_lifecycle_registrar =
|
||||||
|
fl_plugin_registry_get_registrar_for_plugin(registry, "DesktopLifecyclePlugin");
|
||||||
|
desktop_lifecycle_plugin_register_with_registrar(desktop_lifecycle_registrar);
|
||||||
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
|
||||||
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
|
||||||
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
desktop_drop
|
desktop_drop
|
||||||
|
desktop_lifecycle
|
||||||
file_selector_linux
|
file_selector_linux
|
||||||
flutter_secure_storage_linux
|
flutter_secure_storage_linux
|
||||||
url_launcher_linux
|
url_launcher_linux
|
||||||
|
@ -316,6 +316,13 @@ packages:
|
|||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.2"
|
version: "0.3.2"
|
||||||
|
desktop_lifecycle:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: desktop_lifecycle
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.0"
|
||||||
desktop_notifications:
|
desktop_notifications:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -20,6 +20,7 @@ dependencies:
|
|||||||
connectivity_plus: ^2.2.0
|
connectivity_plus: ^2.2.0
|
||||||
cupertino_icons: any
|
cupertino_icons: any
|
||||||
desktop_drop: ^0.3.2
|
desktop_drop: ^0.3.2
|
||||||
|
desktop_lifecycle: ^0.1.0
|
||||||
desktop_notifications: ^0.6.3
|
desktop_notifications: ^0.6.3
|
||||||
device_info_plus: ^3.2.1
|
device_info_plus: ^3.2.1
|
||||||
email_validator: ^2.0.1
|
email_validator: ^2.0.1
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
|
#include <connectivity_plus_windows/connectivity_plus_windows_plugin.h>
|
||||||
#include <desktop_drop/desktop_drop_plugin.h>
|
#include <desktop_drop/desktop_drop_plugin.h>
|
||||||
|
#include <desktop_lifecycle/desktop_lifecycle_plugin.h>
|
||||||
#include <file_selector_windows/file_selector_plugin.h>
|
#include <file_selector_windows/file_selector_plugin.h>
|
||||||
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
#include <flutter_secure_storage_windows/flutter_secure_storage_windows_plugin.h>
|
||||||
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
|
#include <flutter_webrtc/flutter_web_r_t_c_plugin.h>
|
||||||
@ -18,6 +19,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
|
|||||||
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
registry->GetRegistrarForPlugin("ConnectivityPlusWindowsPlugin"));
|
||||||
DesktopDropPluginRegisterWithRegistrar(
|
DesktopDropPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
|
registry->GetRegistrarForPlugin("DesktopDropPlugin"));
|
||||||
|
DesktopLifecyclePluginRegisterWithRegistrar(
|
||||||
|
registry->GetRegistrarForPlugin("DesktopLifecyclePlugin"));
|
||||||
FileSelectorPluginRegisterWithRegistrar(
|
FileSelectorPluginRegisterWithRegistrar(
|
||||||
registry->GetRegistrarForPlugin("FileSelectorPlugin"));
|
registry->GetRegistrarForPlugin("FileSelectorPlugin"));
|
||||||
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
FlutterSecureStorageWindowsPluginRegisterWithRegistrar(
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
list(APPEND FLUTTER_PLUGIN_LIST
|
list(APPEND FLUTTER_PLUGIN_LIST
|
||||||
connectivity_plus_windows
|
connectivity_plus_windows
|
||||||
desktop_drop
|
desktop_drop
|
||||||
|
desktop_lifecycle
|
||||||
file_selector_windows
|
file_selector_windows
|
||||||
flutter_secure_storage_windows
|
flutter_secure_storage_windows
|
||||||
flutter_webrtc
|
flutter_webrtc
|
||||||
|
Loading…
x
Reference in New Issue
Block a user