mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2025-02-17 06:20:44 +01:00
chore: update Matrix SDK
Signed-off-by: TheOneWithTheBraid <the-one@with-the-braid.cf>
This commit is contained in:
parent
0dd7ac39c0
commit
b13d1215b4
@ -154,8 +154,7 @@ abstract class FluffyThemes {
|
||||
dividerColor: Colors.blueGrey.shade600,
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: AppConfig.chatColor,
|
||||
onPrimary: Colors.white,
|
||||
foregroundColor: Colors.white, backgroundColor: AppConfig.chatColor,
|
||||
minimumSize: const Size.fromHeight(48),
|
||||
textStyle: const TextStyle(fontSize: 16),
|
||||
padding: const EdgeInsets.all(12),
|
||||
|
@ -22,7 +22,6 @@ import 'config/themes.dart';
|
||||
import 'utils/background_push.dart';
|
||||
import 'utils/custom_scroll_behaviour.dart';
|
||||
import 'utils/localized_exception_extension.dart';
|
||||
import 'utils/platform_infos.dart';
|
||||
import 'widgets/lock_screen.dart';
|
||||
import 'widgets/matrix.dart';
|
||||
|
||||
|
@ -128,8 +128,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).secondaryHeaderColor,
|
||||
onPrimary: Theme.of(context).primaryColor,
|
||||
foregroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||
),
|
||||
icon: const Icon(Icons.check_outlined),
|
||||
label: Text(L10n.of(context)!.next),
|
||||
@ -261,8 +260,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
||||
const SizedBox(height: 32),
|
||||
ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).secondaryHeaderColor,
|
||||
onPrimary: Theme.of(context).primaryColor,
|
||||
foregroundColor: Theme.of(context).primaryColor, backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||
),
|
||||
icon: const Icon(Icons.cast_connected_outlined),
|
||||
label: Text(L10n.of(context)!.transferFromAnotherDevice),
|
||||
@ -284,8 +282,7 @@ class _BootstrapDialogState extends State<BootstrapDialog> {
|
||||
const SizedBox(height: 16),
|
||||
ElevatedButton.icon(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Theme.of(context).secondaryHeaderColor,
|
||||
onPrimary: Colors.red,
|
||||
foregroundColor: Colors.red, backgroundColor: Theme.of(context).secondaryHeaderColor,
|
||||
),
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
label: Text(L10n.of(context)!.securityKeyLost),
|
||||
|
@ -29,10 +29,11 @@ class ChatAppBarTitle extends StatelessWidget {
|
||||
? () => showModalBottomSheet(
|
||||
context: context,
|
||||
builder: (c) => UserBottomSheet(
|
||||
user: room.getUserByMXIDSync(directChatMatrixID),
|
||||
user: room
|
||||
.unsafeGetUserFromMemoryOrFallback(directChatMatrixID),
|
||||
outerContext: context,
|
||||
onMention: () => controller.sendController.text +=
|
||||
'${room.getUserByMXIDSync(directChatMatrixID).mention} ',
|
||||
'${room.unsafeGetUserFromMemoryOrFallback(directChatMatrixID).mention} ',
|
||||
),
|
||||
)
|
||||
: () => VRouter.of(context).toSegments(['rooms', room.id, 'details']),
|
||||
|
@ -348,15 +348,20 @@ class ChatView extends StatelessWidget {
|
||||
context:
|
||||
context,
|
||||
builder: (c) =>
|
||||
UserBottomSheet(
|
||||
user: event
|
||||
.sender,
|
||||
FutureBuilder<User?>(
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return UserBottomSheet(
|
||||
user: user,
|
||||
outerContext:
|
||||
context,
|
||||
context,
|
||||
onMention: () => controller
|
||||
.sendController
|
||||
.text += '${event.sender.mention} ',
|
||||
),
|
||||
.sendController
|
||||
.text += '${user.mention} ',
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
unfold: controller
|
||||
.unfold,
|
||||
|
@ -20,6 +20,7 @@ extension EventInfoDialogExtension on Event {
|
||||
class EventInfoDialog extends StatelessWidget {
|
||||
final Event event;
|
||||
final L10n l10n;
|
||||
|
||||
const EventInfoDialog({
|
||||
required this.event,
|
||||
required this.l10n,
|
||||
@ -46,14 +47,19 @@ class EventInfoDialog extends StatelessWidget {
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
ListTile(
|
||||
leading: Avatar(
|
||||
mxContent: event.sender.avatarUrl,
|
||||
name: event.sender.calcDisplayname(),
|
||||
),
|
||||
title: Text(L10n.of(context)!.sender),
|
||||
subtitle:
|
||||
Text('${event.sender.calcDisplayname()} [${event.senderId}]'),
|
||||
FutureBuilder<User?>(
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return ListTile(
|
||||
leading: Avatar(
|
||||
mxContent: user.avatarUrl,
|
||||
name: user.calcDisplayname(),
|
||||
),
|
||||
title: Text(L10n.of(context)!.sender),
|
||||
subtitle: Text('${user.calcDisplayname()} [${event.senderId}]'),
|
||||
);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text(L10n.of(context)!.time),
|
||||
|
@ -206,8 +206,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
||||
children: [
|
||||
OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
primary: Theme.of(context).textTheme.bodyText1!.color,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyText1!.color, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
icon: const Icon(Icons.download_outlined),
|
||||
onPressed: () => widget.event.saveFile(context),
|
||||
@ -385,8 +384,7 @@ class _ImageBubbleState extends State<ImageBubble> {
|
||||
children: [
|
||||
OutlinedButton(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
primary: Theme.of(context).textTheme.bodyText1!.color,
|
||||
foregroundColor: Theme.of(context).textTheme.bodyText1!.color, backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||
),
|
||||
onPressed: () => onTap(context),
|
||||
child: Text(
|
||||
|
@ -75,7 +75,7 @@ class Message extends StatelessWidget {
|
||||
EventTypes.Sticker,
|
||||
EventTypes.Encrypted,
|
||||
].contains(nextEvent!.type)
|
||||
? nextEvent!.sender.id == event.sender.id && !displayTime
|
||||
? nextEvent!.senderId == event.senderId && !displayTime
|
||||
: false;
|
||||
final textColor = ownMessage
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
@ -125,11 +125,17 @@ class Message extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
))
|
||||
: Avatar(
|
||||
mxContent: event.sender.avatarUrl,
|
||||
name: event.sender.calcDisplayname(),
|
||||
onTap: () => onAvatarTab!(event),
|
||||
),
|
||||
: FutureBuilder<User?>(
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return Avatar(
|
||||
mxContent: user.avatarUrl,
|
||||
name: user.calcDisplayname(),
|
||||
onTap: () => onAvatarTab!(event),
|
||||
);
|
||||
}
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@ -140,14 +146,20 @@ class Message extends StatelessWidget {
|
||||
padding: const EdgeInsets.only(left: 8.0, bottom: 4),
|
||||
child: ownMessage || event.room.isDirectChat
|
||||
? const SizedBox(height: 12)
|
||||
: Text(
|
||||
event.sender.calcDisplayname(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: event.sender.calcDisplayname().color,
|
||||
),
|
||||
),
|
||||
: FutureBuilder<User?>(
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return Text(
|
||||
user.calcDisplayname(),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: user.calcDisplayname().color,
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: alignment,
|
||||
|
@ -34,7 +34,7 @@ class MessageContent extends StatelessWidget {
|
||||
content: Text(
|
||||
event.type == EventTypes.Encrypted
|
||||
? L10n.of(context)!.needPantalaimonWarning
|
||||
: event.getLocalizedBody(
|
||||
: await event.getLocalizedBodyAsync(
|
||||
MatrixLocals(L10n.of(context)!),
|
||||
),
|
||||
)));
|
||||
@ -172,12 +172,19 @@ class MessageContent extends StatelessWidget {
|
||||
textmessage:
|
||||
default:
|
||||
if (event.redacted) {
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!
|
||||
.redactedAnEvent(event.sender.calcDisplayname()),
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
return FutureBuilder<User?>(
|
||||
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!
|
||||
.redactedAnEvent(user.calcDisplayname()),
|
||||
icon: const Icon(Icons.delete_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
final bigEmotes = event.onlyEmotes &&
|
||||
@ -200,19 +207,33 @@ class MessageContent extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
case EventTypes.CallInvite:
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!.startedACall(event.sender.calcDisplayname()),
|
||||
icon: const Icon(Icons.phone_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
return FutureBuilder<User?>(
|
||||
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!.startedACall(user.calcDisplayname()),
|
||||
icon: const Icon(Icons.phone_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
);
|
||||
}
|
||||
);
|
||||
default:
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!
|
||||
.userSentUnknownEvent(event.sender.calcDisplayname(), event.type),
|
||||
icon: const Icon(Icons.info_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
return FutureBuilder<User?>(
|
||||
|
||||
future: event.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? event.senderFromMemoryOrFallback;
|
||||
return _ButtonContent(
|
||||
label: L10n.of(context)!
|
||||
.userSentUnknownEvent(user.calcDisplayname(), event.type),
|
||||
icon: const Icon(Icons.info_outlined),
|
||||
textColor: buttonTextColor,
|
||||
onPressed: () => onInfoTab!(event),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -239,8 +260,7 @@ class _ButtonContent extends StatelessWidget {
|
||||
icon: icon,
|
||||
label: Text(label, overflow: TextOverflow.ellipsis),
|
||||
style: OutlinedButton.styleFrom(
|
||||
primary: textColor,
|
||||
backgroundColor: Colors.white.withAlpha(64),
|
||||
foregroundColor: textColor, backgroundColor: Colors.white.withAlpha(64),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ class MessageReactions extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
reactionMap[key]!.count++;
|
||||
reactionMap[key]!.reactors!.add(e.sender);
|
||||
reactionMap[key]!.reactors!.add(e.senderFromMemoryOrFallback);
|
||||
reactionMap[key]!.reacted |= e.senderId == e.room.client.userID;
|
||||
}
|
||||
}
|
||||
|
@ -83,17 +83,23 @@ class ReplyContent extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
displayEvent.sender.calcDisplayname() + ':',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ownMessage
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onBackground,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
FutureBuilder<User?>(
|
||||
|
||||
future: displayEvent.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ?? displayEvent.senderFromMemoryOrFallback; return Text(
|
||||
user.calcDisplayname() + ':',
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: ownMessage
|
||||
? Theme.of(context).colorScheme.onPrimary
|
||||
: Theme.of(context).colorScheme.onBackground,
|
||||
fontSize: fontSize,
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
replyBody,
|
||||
],
|
||||
|
@ -94,15 +94,18 @@ class ChatEncryptionSettingsView extends StatelessWidget {
|
||||
child: ListTile(
|
||||
leading: Avatar(
|
||||
mxContent: room
|
||||
.getUserByMXIDSync(deviceKeys[i].userId)
|
||||
.unsafeGetUserFromMemoryOrFallback(
|
||||
deviceKeys[i].userId)
|
||||
.avatarUrl,
|
||||
name: room
|
||||
.getUserByMXIDSync(deviceKeys[i].userId)
|
||||
.unsafeGetUserFromMemoryOrFallback(
|
||||
deviceKeys[i].userId)
|
||||
.calcDisplayname(),
|
||||
),
|
||||
title: Text(
|
||||
room
|
||||
.getUserByMXIDSync(deviceKeys[i].userId)
|
||||
.unsafeGetUserFromMemoryOrFallback(
|
||||
deviceKeys[i].userId)
|
||||
.calcDisplayname(),
|
||||
),
|
||||
subtitle: Text(
|
||||
|
@ -108,8 +108,7 @@ class ConnectPageView extends StatelessWidget {
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.loading ? null : controller.signUp,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: controller.loading
|
||||
@ -149,8 +148,7 @@ class ConnectPageView extends StatelessWidget {
|
||||
onPressed: () => controller
|
||||
.ssoLoginAction(identityProviders.single.id!),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: Text(identityProviders.single.name ??
|
||||
@ -177,8 +175,7 @@ class ConnectPageView extends StatelessWidget {
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.loading ? () {} : controller.login,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: Text(L10n.of(context)!.login),
|
||||
|
@ -136,8 +136,7 @@ class HomeserverPickerView extends StatelessWidget {
|
||||
? () {}
|
||||
: controller.checkHomeserverAction,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: controller.isLoading
|
||||
|
@ -38,7 +38,7 @@ class InvitationSelectionController extends State<InvitationSelection> {
|
||||
final participantsIds = participants.map((p) => p.stateKey).toList();
|
||||
final contacts = client.rooms
|
||||
.where((r) => r.isDirectChat)
|
||||
.map((r) => r.getUserByMXIDSync(r.directChatMatrixID!))
|
||||
.map((r) => r.unsafeGetUserFromMemoryOrFallback(r.directChatMatrixID!))
|
||||
.toList()
|
||||
..removeWhere((u) => participantsIds.contains(u.stateKey));
|
||||
contacts.sort(
|
||||
|
@ -111,7 +111,7 @@ class _KeyVerificationPageState extends State<KeyVerificationDialog> {
|
||||
if (directChatId != null) {
|
||||
user = widget.request.client
|
||||
.getRoomById(directChatId)!
|
||||
.getUserByMXIDSync(widget.request.userId);
|
||||
.unsafeGetUserFromMemoryOrFallback(widget.request.userId);
|
||||
}
|
||||
final displayName =
|
||||
user?.calcDisplayname() ?? widget.request.userId.localpart!;
|
||||
|
@ -98,8 +98,7 @@ class LoginView extends StatelessWidget {
|
||||
? null
|
||||
: () => controller.login(context),
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: controller.loading
|
||||
@ -127,8 +126,7 @@ class LoginView extends StatelessWidget {
|
||||
onPressed:
|
||||
controller.loading ? () {} : controller.passwordForgotten,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(156),
|
||||
onPrimary: Colors.red,
|
||||
foregroundColor: Colors.red, backgroundColor: Colors.white.withAlpha(156),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: Text(L10n.of(context)!.passwordForgotten),
|
||||
|
@ -46,13 +46,12 @@ class SearchView extends StatelessWidget {
|
||||
}).then((QueryPublicRoomsResponse res) {
|
||||
final genericSearchTerm = controller.genericSearchTerm;
|
||||
if (genericSearchTerm != null &&
|
||||
!res.chunk.any((room) =>
|
||||
(room.aliases?.contains(controller.genericSearchTerm) ?? false) ||
|
||||
room.canonicalAlias == controller.genericSearchTerm)) {
|
||||
!res.chunk.any(
|
||||
(room) => room.canonicalAlias == controller.genericSearchTerm)) {
|
||||
// we have to tack on the original alias
|
||||
res.chunk.add(
|
||||
PublicRoomsChunk(
|
||||
aliases: [genericSearchTerm],
|
||||
canonicalAlias: genericSearchTerm,
|
||||
name: genericSearchTerm,
|
||||
numJoinedMembers: 0,
|
||||
roomId: '!unknown',
|
||||
|
@ -6,7 +6,6 @@ import 'package:vrouter/vrouter.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import '../../config/app_config.dart';
|
||||
import '../../widgets/content_banner.dart';
|
||||
import 'settings.dart';
|
||||
|
||||
|
@ -107,8 +107,7 @@ class SignupPageView extends StatelessWidget {
|
||||
child: ElevatedButton(
|
||||
onPressed: controller.loading ? () {} : controller.signup,
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.white.withAlpha(200),
|
||||
onPrimary: Colors.black,
|
||||
foregroundColor: Colors.black, backgroundColor: Colors.white.withAlpha(200),
|
||||
shadowColor: Colors.white,
|
||||
),
|
||||
child: controller.loading
|
||||
|
@ -45,6 +45,7 @@ class StoryPageController extends State<StoryPage> {
|
||||
Timeline? timeline;
|
||||
|
||||
Event? get currentEvent => index < events.length ? events[index] : null;
|
||||
|
||||
StoryThemeData get storyThemeData =>
|
||||
StoryThemeData.fromJson(currentEvent?.content
|
||||
.tryGetMap<String, dynamic>(StoryThemeData.contentKey) ??
|
||||
@ -275,6 +276,7 @@ class StoryPageController extends State<StoryPage> {
|
||||
}
|
||||
|
||||
void loadingModeOn() => _setLoadingMode(true);
|
||||
|
||||
void loadingModeOff() => _setLoadingMode(false);
|
||||
|
||||
final Map<String, Future<MatrixFile>> _fileCache = {};
|
||||
@ -366,21 +368,10 @@ class StoryPageController extends State<StoryPage> {
|
||||
})
|
||||
: null;
|
||||
|
||||
Uri? get avatar => Matrix.of(context)
|
||||
Event? get event => Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(roomId)
|
||||
?.getState(EventTypes.RoomCreate)
|
||||
?.sender
|
||||
.avatarUrl;
|
||||
|
||||
String get title =>
|
||||
Matrix.of(context)
|
||||
.client
|
||||
.getRoomById(roomId)
|
||||
?.getState(EventTypes.RoomCreate)
|
||||
?.sender
|
||||
.calcDisplayname() ??
|
||||
'Story not found';
|
||||
?.getState(EventTypes.RoomCreate);
|
||||
|
||||
Future<void>? loadStory;
|
||||
|
||||
@ -485,7 +476,9 @@ class StoryPageController extends State<StoryPage> {
|
||||
case PopupStoryAction.message:
|
||||
final roomIdResult = await showFutureLoadingDialog(
|
||||
context: context,
|
||||
future: () => currentEvent!.sender.startDirectChat(),
|
||||
future: () async => (await currentEvent!.eventSender ??
|
||||
currentEvent!.senderFromMemoryOrFallback)
|
||||
.startDirectChat(),
|
||||
);
|
||||
if (roomIdResult.error != null) return;
|
||||
VRouter.of(context).toSegments(['rooms', roomIdResult.result!]);
|
||||
|
@ -17,6 +17,7 @@ import 'package:fluffychat/widgets/avatar.dart';
|
||||
|
||||
class StoryView extends StatelessWidget {
|
||||
final StoryPageController controller;
|
||||
|
||||
const StoryView(this.controller, {Key? key}) : super(key: key);
|
||||
|
||||
static const List<Shadow> textShadows = [
|
||||
@ -55,19 +56,25 @@ class StoryView extends StatelessWidget {
|
||||
),
|
||||
title: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
controller.title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
title: FutureBuilder<User?>(
|
||||
future: controller.event?.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ??
|
||||
controller.event?.senderFromMemoryOrFallback;
|
||||
return Text(
|
||||
user?.displayName ?? 'Story not found',
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
subtitle: currentEvent != null
|
||||
? Text(
|
||||
currentEvent.originServerTs.localizedTime(context),
|
||||
@ -83,10 +90,16 @@ class StoryView extends StatelessWidget {
|
||||
),
|
||||
)
|
||||
: null,
|
||||
leading: Avatar(
|
||||
mxContent: controller.avatar,
|
||||
name: controller.title,
|
||||
),
|
||||
leading: FutureBuilder<User?>(
|
||||
future: controller.event?.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ??
|
||||
controller.event?.senderFromMemoryOrFallback;
|
||||
return Avatar(
|
||||
mxContent: user?.avatarUrl,
|
||||
name: user?.displayName ?? 'Story not found',
|
||||
);
|
||||
}),
|
||||
),
|
||||
actions: currentEvent == null
|
||||
? null
|
||||
@ -142,11 +155,18 @@ class StoryView extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Avatar(
|
||||
mxContent: controller.avatar,
|
||||
name: controller.title,
|
||||
size: 128,
|
||||
fontSize: 64,
|
||||
FutureBuilder<User?>(
|
||||
future: controller.event?.eventSender,
|
||||
builder: (context, snapshot) {
|
||||
final user = snapshot.data ??
|
||||
controller.event?.senderFromMemoryOrFallback;
|
||||
return Avatar(
|
||||
mxContent: user?.avatarUrl,
|
||||
name: user?.displayName ?? 'Story not found',
|
||||
size: 128,
|
||||
fontSize: 64,
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 32),
|
||||
Text(
|
||||
|
@ -12,7 +12,8 @@ extension ClientStoriesExtension on Client {
|
||||
|
||||
List<User> get contacts => rooms
|
||||
.where((room) => room.isDirectChat)
|
||||
.map((room) => room.getUserByMXIDSync(room.directChatMatrixID!))
|
||||
.map((room) =>
|
||||
room.unsafeGetUserFromMemoryOrFallback(room.directChatMatrixID!))
|
||||
.toList();
|
||||
|
||||
List<Room> get storiesRooms => rooms
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart' hide Key;
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -1,6 +1,7 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
@ -62,7 +62,7 @@ Future<void> pushHelper(
|
||||
final matrixLocals = MatrixLocals(l10n);
|
||||
|
||||
// Calculate the body
|
||||
final body = event.getLocalizedBody(
|
||||
final body = await event.getLocalizedBodyAsync(
|
||||
matrixLocals,
|
||||
plaintextBody: true,
|
||||
withSenderNamePrefix: !event.room.isDirectChat,
|
||||
|
@ -31,7 +31,7 @@ extension LocalNotificationsExtension on MatrixState {
|
||||
final event = Event.fromJson(eventUpdate.content, room);
|
||||
final title =
|
||||
room.getLocalizedDisplayname(MatrixLocals(L10n.of(widget.context)!));
|
||||
final body = event.getLocalizedBody(
|
||||
final body = await event.getLocalizedBodyAsync(
|
||||
MatrixLocals(L10n.of(widget.context)!),
|
||||
withSenderNamePrefix:
|
||||
!room.isDirectChat || room.lastEvent?.senderId == client.userID,
|
||||
@ -40,7 +40,8 @@ extension LocalNotificationsExtension on MatrixState {
|
||||
hideEdit: true,
|
||||
removeMarkdown: true,
|
||||
);
|
||||
final icon = event.sender.avatarUrl?.getThumbnail(client,
|
||||
final sender = await event.eventSender??event.senderFromMemoryOrFallback;
|
||||
final icon = sender.avatarUrl?.getThumbnail(client,
|
||||
width: 64, height: 64, method: ThumbnailMethod.crop) ??
|
||||
room.avatar?.getThumbnail(client,
|
||||
width: 64, height: 64, method: ThumbnailMethod.crop);
|
||||
|
@ -33,7 +33,6 @@ import '../pages/key_verification/key_verification_dialog.dart';
|
||||
import '../utils/account_bundles.dart';
|
||||
import '../utils/background_push.dart';
|
||||
import '../utils/famedlysdk_store.dart';
|
||||
import '../utils/platform_infos.dart';
|
||||
import 'local_notifications_extension.dart';
|
||||
|
||||
// import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
||||
|
@ -17,6 +17,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
|
||||
final String roomAlias;
|
||||
final BuildContext outerContext;
|
||||
final PublicRoomsChunk? chunk;
|
||||
|
||||
const PublicRoomBottomSheet({
|
||||
required this.roomAlias,
|
||||
required this.outerContext,
|
||||
@ -41,9 +42,7 @@ class PublicRoomBottomSheet extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
bool _testRoom(PublicRoomsChunk r) =>
|
||||
r.canonicalAlias == roomAlias ||
|
||||
(r.aliases?.contains(roomAlias) ?? false);
|
||||
bool _testRoom(PublicRoomsChunk r) => r.canonicalAlias == roomAlias;
|
||||
|
||||
Future<PublicRoomsChunk> _search(BuildContext context) async {
|
||||
final chunk = this.chunk;
|
||||
|
72
pubspec.lock
72
pubspec.lock
@ -7,7 +7,7 @@ packages:
|
||||
name: _fe_analyzer_shared
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "31.0.0"
|
||||
version: "36.0.0"
|
||||
adaptive_dialog:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -28,14 +28,14 @@ packages:
|
||||
name: analyzer
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.8.0"
|
||||
version: "3.3.1"
|
||||
analyzer_plugin:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: analyzer_plugin
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
version: "0.9.0"
|
||||
animations:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -56,7 +56,7 @@ packages:
|
||||
name: archive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.11"
|
||||
version: "3.3.0"
|
||||
args:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -77,7 +77,7 @@ packages:
|
||||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.8.2"
|
||||
version: "2.9.0"
|
||||
audio_session:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -147,7 +147,7 @@ packages:
|
||||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -162,20 +162,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.1"
|
||||
cli_util:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: cli_util
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.5"
|
||||
clock:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -240,7 +233,7 @@ packages:
|
||||
name: coverage
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.5.0"
|
||||
cross_file:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -254,7 +247,7 @@ packages:
|
||||
name: crypto
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.1"
|
||||
version: "3.0.2"
|
||||
csslib:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -395,13 +388,20 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "5.0.1"
|
||||
enhanced_enum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: enhanced_enum
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.2"
|
||||
fake_async:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.3.1"
|
||||
ffi:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -788,7 +788,7 @@ packages:
|
||||
name: hive
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
version: "2.2.1"
|
||||
hive_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -932,7 +932,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: null-safety
|
||||
resolved-ref: "2906e65ffaa96afbe6c72e8477d4dfcdfd06c2c3"
|
||||
resolved-ref: a3d4020911860ff091d90638ab708604b71d2c5a
|
||||
url: "https://github.com/TheOneWithTheBraid/keyboard_shortcuts.git"
|
||||
source: git
|
||||
version: "0.1.4"
|
||||
@ -998,35 +998,35 @@ packages:
|
||||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
version: "0.12.12"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.4"
|
||||
version: "0.1.5"
|
||||
matrix:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: matrix
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.9.6"
|
||||
version: "0.9.10"
|
||||
matrix_api_lite:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: matrix_api_lite
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.5.3"
|
||||
version: "1.0.0"
|
||||
matrix_homeserver_recommendations:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: matrix_homeserver_recommendations
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.0"
|
||||
version: "0.2.1"
|
||||
matrix_link_text:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1040,7 +1040,7 @@ packages:
|
||||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.7.0"
|
||||
version: "1.8.0"
|
||||
mgrs_dart:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1161,7 +1161,7 @@ packages:
|
||||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.1"
|
||||
version: "1.8.2"
|
||||
path_drawing:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1618,7 +1618,7 @@ packages:
|
||||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.2"
|
||||
version: "1.9.0"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1653,7 +1653,7 @@ packages:
|
||||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
version: "1.1.1"
|
||||
swipe_to_action:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1667,7 +1667,7 @@ packages:
|
||||
name: sync_http
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.0"
|
||||
version: "0.3.1"
|
||||
synchronized:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1681,28 +1681,28 @@ packages:
|
||||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0"
|
||||
version: "1.2.1"
|
||||
test:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.20.2"
|
||||
version: "1.21.4"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.9"
|
||||
version: "0.4.12"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.11"
|
||||
version: "0.4.16"
|
||||
timezone:
|
||||
dependency: transitive
|
||||
description:
|
||||
@ -1737,7 +1737,7 @@ packages:
|
||||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0"
|
||||
version: "1.3.1"
|
||||
uni_links:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@ -1940,14 +1940,14 @@ packages:
|
||||
name: visibility_detector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.2"
|
||||
version: "0.3.3"
|
||||
vm_service:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vm_service
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "8.2.2"
|
||||
version: "9.0.0"
|
||||
vrouter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -57,7 +57,7 @@ dependencies:
|
||||
keyboard_shortcuts: ^0.1.4
|
||||
localstorage: ^4.0.0+1
|
||||
lottie: ^1.2.2
|
||||
matrix: ^0.9.4
|
||||
matrix: ^0.9.10
|
||||
matrix_homeserver_recommendations: ^0.2.0
|
||||
matrix_link_text: ^1.0.2
|
||||
native_imaging:
|
||||
|
Loading…
x
Reference in New Issue
Block a user