mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-12-25 06:52:35 +01:00
chore: Follow up nicer state events
This commit is contained in:
parent
c365469dc5
commit
7e4a4c88be
@ -28,7 +28,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"acceptedTheInvitation": "{username} accepted the invitation",
|
"acceptedTheInvitation": "👍 {username} accepted the invitation",
|
||||||
"@acceptedTheInvitation": {
|
"@acceptedTheInvitation": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -45,7 +45,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"activatedEndToEndEncryption": "{username} activated end to end encryption",
|
"activatedEndToEndEncryption": "🔐 {username} activated end to end encryption",
|
||||||
"@activatedEndToEndEncryption": {
|
"@activatedEndToEndEncryption": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -702,7 +702,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"createdTheChat": "{username} created the chat",
|
"createdTheChat": "💬 {username} created the chat",
|
||||||
"@createdTheChat": {
|
"@createdTheChat": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -1209,7 +1209,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"invitedUser": "{username} invited {targetName}",
|
"invitedUser": "📩 {username} invited {targetName}",
|
||||||
"@invitedUser": {
|
"@invitedUser": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -1245,7 +1245,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"joinedTheChat": "{username} joined the chat",
|
"joinedTheChat": "👋 {username} joined the chat",
|
||||||
"@joinedTheChat": {
|
"@joinedTheChat": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -1267,7 +1267,7 @@
|
|||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {}
|
"placeholders": {}
|
||||||
},
|
},
|
||||||
"kicked": "{username} kicked {targetName}",
|
"kicked": "👞 {username} kicked {targetName}",
|
||||||
"@kicked": {
|
"@kicked": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -1275,7 +1275,7 @@
|
|||||||
"targetName": {}
|
"targetName": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"kickedAndBanned": "{username} kicked and banned {targetName}",
|
"kickedAndBanned": "🙅 {username} kicked and banned {targetName}",
|
||||||
"@kickedAndBanned": {
|
"@kickedAndBanned": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -2452,7 +2452,7 @@
|
|||||||
"username": {}
|
"username": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"userLeftTheChat": "{username} left the chat",
|
"userLeftTheChat": "🚪 {username} left the chat",
|
||||||
"@userLeftTheChat": {
|
"@userLeftTheChat": {
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
@ -2837,7 +2837,7 @@
|
|||||||
"@youRejectedTheInvitation": {},
|
"@youRejectedTheInvitation": {},
|
||||||
"youJoinedTheChat": "You joined the chat",
|
"youJoinedTheChat": "You joined the chat",
|
||||||
"@youJoinedTheChat": {},
|
"@youJoinedTheChat": {},
|
||||||
"youAcceptedTheInvitation": "You accepted the invitation",
|
"youAcceptedTheInvitation": "👍 You accepted the invitation",
|
||||||
"@youAcceptedTheInvitation": {},
|
"@youAcceptedTheInvitation": {},
|
||||||
"youBannedUser": "You banned {user}",
|
"youBannedUser": "You banned {user}",
|
||||||
"@youBannedUser": {
|
"@youBannedUser": {
|
||||||
@ -2851,25 +2851,25 @@
|
|||||||
"user": {}
|
"user": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"youInvitedBy": "You have been invited by {user}",
|
"youInvitedBy": "📩 You have been invited by {user}",
|
||||||
"@youInvitedBy": {
|
"@youInvitedBy": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"user": {}
|
"user": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"youInvitedUser": "You invited {user}",
|
"youInvitedUser": "📩 You invited {user}",
|
||||||
"@youInvitedUser": {
|
"@youInvitedUser": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"user": {}
|
"user": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"youKicked": "You kicked {user}",
|
"youKicked": "👞 You kicked {user}",
|
||||||
"@youKicked": {
|
"@youKicked": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"user": {}
|
"user": {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"youKickedAndBanned": "You kicked and banned {user}",
|
"youKickedAndBanned": "🙅 You kicked and banned {user}",
|
||||||
"@youKickedAndBanned": {
|
"@youKickedAndBanned": {
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"user": {}
|
"user": {}
|
||||||
|
@ -12,11 +12,6 @@ class StateMessage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (event.unsigned!['im.fluffychat.collapsed_state_event'] == true) {
|
|
||||||
return Container();
|
|
||||||
}
|
|
||||||
final int counter =
|
|
||||||
event.unsigned!['im.fluffychat.collapsed_state_event_count'] ?? 0;
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
horizontal: 8.0,
|
horizontal: 8.0,
|
||||||
@ -26,41 +21,26 @@ class StateMessage extends StatelessWidget {
|
|||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).brightness == Brightness.light
|
color: Theme.of(context).colorScheme.secondaryContainer,
|
||||||
? Colors.white
|
|
||||||
: Colors.grey.shade900,
|
|
||||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
|
borderRadius: BorderRadius.circular(AppConfig.borderRadius / 2),
|
||||||
),
|
),
|
||||||
child: Column(
|
child: FutureBuilder<String>(
|
||||||
mainAxisSize: MainAxisSize.min,
|
future: event.calcLocalizedBody(MatrixLocals(L10n.of(context)!)),
|
||||||
children: [
|
|
||||||
FutureBuilder<String>(
|
|
||||||
future:
|
|
||||||
event.calcLocalizedBody(MatrixLocals(L10n.of(context)!)),
|
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
return Text(
|
return Text(
|
||||||
snapshot.data ??
|
snapshot.data ??
|
||||||
event.calcLocalizedBodyFallback(
|
event.calcLocalizedBodyFallback(
|
||||||
MatrixLocals(L10n.of(context)!)),
|
MatrixLocals(L10n.of(context)!),
|
||||||
|
),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14 * AppConfig.fontSizeFactor,
|
fontSize: 14 * AppConfig.fontSizeFactor,
|
||||||
color: Theme.of(context).textTheme.bodyText2!.color,
|
color: Theme.of(context).colorScheme.onSecondaryContainer,
|
||||||
decoration:
|
decoration:
|
||||||
event.redacted ? TextDecoration.lineThrough : null,
|
event.redacted ? TextDecoration.lineThrough : null,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
if (counter != 0)
|
|
||||||
Text(
|
|
||||||
L10n.of(context)!.moreEvents(counter),
|
|
||||||
style: TextStyle(
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
fontSize: 14 * AppConfig.fontSizeFactor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -22,10 +22,12 @@ extension IsStateExtension on Event {
|
|||||||
(!AppConfig.hideUnimportantStateEvents ||
|
(!AppConfig.hideUnimportantStateEvents ||
|
||||||
!isState ||
|
!isState ||
|
||||||
importantStateEvents.contains(type)) &&
|
importantStateEvents.contains(type)) &&
|
||||||
// hide member events in public rooms
|
// hide simple join/leave member events in public rooms
|
||||||
(!AppConfig.hideUnimportantStateEvents ||
|
(!AppConfig.hideUnimportantStateEvents ||
|
||||||
type != EventTypes.RoomMember ||
|
type != EventTypes.RoomMember ||
|
||||||
room.joinRules != JoinRules.public);
|
room.joinRules != JoinRules.public ||
|
||||||
|
content.tryGet<String>('membership') == 'ban' ||
|
||||||
|
stateKey != senderId);
|
||||||
|
|
||||||
static const Set<String> importantStateEvents = {
|
static const Set<String> importantStateEvents = {
|
||||||
EventTypes.Encryption,
|
EventTypes.Encryption,
|
||||||
|
Loading…
Reference in New Issue
Block a user