fluffychat merge

pull/1186/head
ggurdin 1 year ago
commit ce3a88e7a7

@ -1058,10 +1058,6 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"@noGoogleServicesWarning": {
"type": "text",
"placeholders": {}
},
"none": "Ništa", "none": "Ništa",
"@none": { "@none": {
"type": "text", "type": "text",
@ -2294,7 +2290,7 @@
"type": "text", "type": "text",
"placeholders": {} "placeholders": {}
}, },
"reportErrorDescription": "Dogodila se greška. Pokušaj ponovo kasnije. Ako želiš, grešku možeš prijaviti programerima.", "reportErrorDescription": "😭 Joj! Dogodila se greška. Pokušaj ponovo kasnije. Ako želiš, grešku možeš prijaviti programerima.",
"@reportErrorDescription": {}, "@reportErrorDescription": {},
"signInWithPassword": "Prijavi se s lozinkom", "signInWithPassword": "Prijavi se s lozinkom",
"@signInWithPassword": {}, "@signInWithPassword": {},
@ -2392,7 +2388,7 @@
"seconds": {} "seconds": {}
} }
}, },
"hasKnocked": "{user} je pokucao/la", "hasKnocked": "🚪 {user} je pokucao/la",
"@hasKnocked": { "@hasKnocked": {
"placeholders": { "placeholders": {
"user": {} "user": {}
@ -2400,17 +2396,10 @@
}, },
"pleaseEnterANumber": "Upiši broj veći od 0", "pleaseEnterANumber": "Upiši broj veći od 0",
"@pleaseEnterANumber": {}, "@pleaseEnterANumber": {},
"@banUserDescription": {},
"@removeDevicesDescription": {},
"@unbanUserDescription": {},
"pushNotificationsNotAvailable": "Automatsko slanje obavijesti nije dostupno", "pushNotificationsNotAvailable": "Automatsko slanje obavijesti nije dostupno",
"@pushNotificationsNotAvailable": {}, "@pushNotificationsNotAvailable": {},
"@makeAdminDescription": {},
"@archiveRoomDescription": {},
"learnMore": "Saznaj više", "learnMore": "Saznaj više",
"@learnMore": {}, "@learnMore": {},
"@roomUpgradeDescription": {},
"@kickUserDescription": {},
"createGroupAndInviteUsers": "Stvori grupu i pozovi korisnike", "createGroupAndInviteUsers": "Stvori grupu i pozovi korisnike",
"@createGroupAndInviteUsers": {}, "@createGroupAndInviteUsers": {},
"startConversation": "Pokreni konverzaciju", "startConversation": "Pokreni konverzaciju",
@ -2419,7 +2408,7 @@
"@blockedUsers": {}, "@blockedUsers": {},
"groupCanBeFoundViaSearch": "Grupa se može pronaći putem pretrage", "groupCanBeFoundViaSearch": "Grupa se može pronaći putem pretrage",
"@groupCanBeFoundViaSearch": {}, "@groupCanBeFoundViaSearch": {},
"block": "blokiraj", "block": "Blokiraj",
"@block": {}, "@block": {},
"yourGlobalUserIdIs": "Tvoj globalni korisnički ID je: ", "yourGlobalUserIdIs": "Tvoj globalni korisnički ID je: ",
"@yourGlobalUserIdIs": {}, "@yourGlobalUserIdIs": {},
@ -2436,5 +2425,29 @@
"searchChatsRooms": "Traži #chats, @users …", "searchChatsRooms": "Traži #chats, @users …",
"@searchChatsRooms": {}, "@searchChatsRooms": {},
"databaseMigrationBody": "Pričekaj. Ovo može potrajati.", "databaseMigrationBody": "Pričekaj. Ovo može potrajati.",
"@databaseMigrationBody": {} "@databaseMigrationBody": {},
"transparent": "Prozirno",
"@transparent": {},
"formattedMessages": "Formatirane poruke",
"@formattedMessages": {},
"incomingMessages": "Dolazne poruke",
"@incomingMessages": {},
"passwordsDoNotMatch": "Lozinke se ne poklapaju",
"@passwordsDoNotMatch": {},
"accessAndVisibility": "Pristup i vidljivost",
"@accessAndVisibility": {},
"calls": "Pozivi",
"@calls": {},
"customEmojisAndStickers": "Prilagođeni emojiji i naljepnice",
"@customEmojisAndStickers": {},
"customEmojisAndStickersBody": "Dodaj ili dijeli prilagođene emojije ili naljepnice koje se mogu koristiti u bilo kojem razgovoru.",
"@customEmojisAndStickersBody": {},
"accessAndVisibilityDescription": "Tko se smije pridružiti ovom razgovoru i kako se razgovor može otkriti.",
"@accessAndVisibilityDescription": {},
"stickers": "Naljepnice",
"@stickers": {},
"discover": "Otkrij",
"@discover": {},
"formattedMessagesDescription": "Prikaži formatirani sadržaj poruke poput podebljanog teksta koristeći markdown.",
"@formattedMessagesDescription": {}
} }

@ -969,7 +969,7 @@ class ChatController extends State<ChatPageWithRoom>
); );
} }
for (final event in selectedEvents) { for (final event in selectedEvents) {
await event.remove(); await event.cancelSend();
} }
setState(selectedEvents.clear); setState(selectedEvents.clear);
} catch (e, s) { } catch (e, s) {
@ -1019,7 +1019,7 @@ class ChatController extends State<ChatPageWithRoom>
); );
} }
} else { } else {
await event.remove(); await event.cancelSend();
} }
}, },
); );

@ -58,22 +58,6 @@ class HtmlMessage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
// riot-web is notorious for creating bad reply fallback events from invalid messages which, if
// not handled properly, can lead to impersination. As such, we strip the entire `<mx-reply>` tags
// here already, to prevent that from happening.
// We do *not* do this in an AST and just with simple regex here, as riot-web tends to create
// miss-matching tags, and this way we actually correctly identify what we want to strip and, well,
// strip it.
final renderHtml = html.replaceAll(
RegExp(
'<mx-reply>.*</mx-reply>',
caseSensitive: false,
multiLine: false,
dotAll: true,
),
'',
);
final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor; final fontSize = AppConfig.messageFontSize * AppConfig.fontSizeFactor;
final linkColor = textColor.withAlpha(150); final linkColor = textColor.withAlpha(150);
@ -88,7 +72,7 @@ class HtmlMessage extends StatelessWidget {
padding: HtmlPaddings.only(left: 6, bottom: 0), padding: HtmlPaddings.only(left: 6, bottom: 0),
); );
final element = _linkifyHtml(HtmlParser.parseHTML(renderHtml)); final element = _linkifyHtml(HtmlParser.parseHTML(html));
// there is no need to pre-validate the html, as we validate it while rendering // there is no need to pre-validate the html, as we validate it while rendering
// #Pangea // #Pangea

@ -7,7 +7,6 @@ import 'package:fluffychat/pages/chat_list/utils/on_chat_tap.dart';
import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart'; import 'package:fluffychat/pages/user_bottom_sheet/user_bottom_sheet.dart';
import 'package:fluffychat/pangea/widgets/chat_list/chat_list_body_text.dart'; import 'package:fluffychat/pangea/widgets/chat_list/chat_list_body_text.dart';
import 'package:fluffychat/utils/adaptive_bottom_sheet.dart'; import 'package:fluffychat/utils/adaptive_bottom_sheet.dart';
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
import 'package:fluffychat/utils/stream_extension.dart'; import 'package:fluffychat/utils/stream_extension.dart';
import 'package:fluffychat/widgets/avatar.dart'; import 'package:fluffychat/widgets/avatar.dart';
import 'package:fluffychat/widgets/public_room_bottom_sheet.dart'; import 'package:fluffychat/widgets/public_room_bottom_sheet.dart';
@ -40,7 +39,7 @@ class ChatListViewBody extends StatelessWidget {
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100); Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(100);
final subtitleColor = final subtitleColor =
Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50); Theme.of(context).textTheme.bodyLarge!.color!.withAlpha(50);
final filter = controller.searchController.text.toLowerCase();
return PageTransitionSwitcher( return PageTransitionSwitcher(
transitionBuilder: ( transitionBuilder: (
Widget child, Widget child,
@ -245,35 +244,23 @@ class ChatListViewBody extends StatelessWidget {
), ),
), ),
if (client.prevBatch != null) if (client.prevBatch != null)
SliverList( SliverList.builder(
delegate: SliverChildBuilderDelegate( itemCount: rooms.length,
(BuildContext context, int i) { itemBuilder: (BuildContext context, int i) {
if (!rooms[i] return ChatListItem(
.getLocalizedDisplayname( rooms[i],
MatrixLocals(L10n.of(context)!), key: Key('chat_list_item_${rooms[i].id}'),
) filter: filter,
.toLowerCase() selected:
.contains( controller.selectedRoomIds.contains(rooms[i].id),
controller.searchController.text.toLowerCase(), onTap: controller.selectMode == SelectMode.select
)) { ? () => controller.toggleSelection(rooms[i].id)
return const SizedBox.shrink(); : () => onChatTap(rooms[i], context),
} onLongPress: () =>
final activeChat = controller.activeChat == rooms[i].id; controller.toggleSelection(rooms[i].id),
return ChatListItem( activeChat: controller.activeChat == rooms[i].id,
rooms[i], );
key: Key('chat_list_item_${rooms[i].id}'), },
selected:
controller.selectedRoomIds.contains(rooms[i].id),
onTap: controller.selectMode == SelectMode.select
? () => controller.toggleSelection(rooms[i].id)
: () => onChatTap(rooms[i], context),
onLongPress: () =>
controller.toggleSelection(rooms[i].id),
activeChat: activeChat,
);
},
childCount: rooms.length,
),
), ),
], ],
), ),

@ -94,11 +94,6 @@ class ChatListItem extends StatelessWidget {
if (filter != null && !displayname.toLowerCase().contains(filter)) { if (filter != null && !displayname.toLowerCase().contains(filter)) {
return const SizedBox.shrink(); return const SizedBox.shrink();
} }
final needLastEventSender = lastEvent == null
? false
: room.getState(EventTypes.RoomMember, lastEvent.senderId) == null;
return Padding( return Padding(
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(
horizontal: 8, horizontal: 8,
@ -239,21 +234,20 @@ class ChatListItem extends StatelessWidget {
maxLines: 1, maxLines: 1,
softWrap: false, softWrap: false,
) )
: FutureBuilder( : FutureBuilder<String>(
key: ValueKey(lastEvent?.eventId),
// #Pangea // #Pangea
// future: needLastEventSender // future: room.lastEvent?.calcLocalizedBody(
// ? lastEvent.calcLocalizedBody( // MatrixLocals(L10n.of(context)!),
// MatrixLocals(L10n.of(context)!), // hideReply: true,
// hideReply: true, // hideEdit: true,
// hideEdit: true, // plaintextBody: true,
// plaintextBody: true, // removeMarkdown: true,
// removeMarkdown: true, // withSenderNamePrefix: !isDirectChat ||
// withSenderNamePrefix: !isDirectChat || // directChatMatrixId !=
// directChatMatrixId != // room.lastEvent?.senderId,
// room.lastEvent?.senderId, // ) ??
// ) // Future.value(L10n.of(context)!.emptyChat),
// : null, // Pangea#
future: room.lastEvent != null future: room.lastEvent != null
? GetChatListItemSubtitle().getSubtitle( ? GetChatListItemSubtitle().getSubtitle(
L10n.of(context)!, L10n.of(context)!,
@ -261,37 +255,39 @@ class ChatListItem extends StatelessWidget {
MatrixState.pangeaController, MatrixState.pangeaController,
) )
: Future.value(L10n.of(context)!.emptyChat), : Future.value(L10n.of(context)!.emptyChat),
// Pangea# builder: (context, snapshot) {
initialData: lastEvent?.calcLocalizedBodyFallback( return Text(
MatrixLocals(L10n.of(context)!), room.membership == Membership.invite
hideReply: true, ? isDirectChat
hideEdit: true, ? L10n.of(context)!.invitePrivateChat
plaintextBody: true, : L10n.of(context)!.inviteGroupChat
removeMarkdown: true, : snapshot.data ??
withSenderNamePrefix: !isDirectChat || room.lastEvent
directChatMatrixId != ?.calcLocalizedBodyFallback(
room.lastEvent?.senderId, MatrixLocals(L10n.of(context)!),
), hideReply: true,
builder: (context, snapshot) => Text( hideEdit: true,
room.membership == Membership.invite plaintextBody: true,
? isDirectChat removeMarkdown: true,
? L10n.of(context)!.invitePrivateChat withSenderNamePrefix: !isDirectChat ||
: L10n.of(context)!.inviteGroupChat directChatMatrixId !=
: snapshot.data ?? room.lastEvent?.senderId,
L10n.of(context)!.emptyChat, ) ??
softWrap: false, L10n.of(context)!.emptyChat,
maxLines: 1, softWrap: false,
overflow: TextOverflow.ellipsis, maxLines: 1,
style: TextStyle( overflow: TextOverflow.ellipsis,
fontWeight: unread || room.hasNewMessages style: TextStyle(
? FontWeight.bold fontWeight: unread || room.hasNewMessages
: null, ? FontWeight.bold
color: theme.colorScheme.onSurfaceVariant, : null,
decoration: room.lastEvent?.redacted == true color: theme.colorScheme.onSurfaceVariant,
? TextDecoration.lineThrough decoration: room.lastEvent?.redacted == true
: null, ? TextDecoration.lineThrough
), : null,
), ),
);
},
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),

@ -30,13 +30,13 @@ class ChatListView extends StatelessWidget {
badgePosition: badgePosition, badgePosition: badgePosition,
filter: filter:
controller.getRoomFilterByActiveFilter(ActiveFilter.messages), controller.getRoomFilterByActiveFilter(ActiveFilter.messages),
child: const Icon(Icons.forum_outlined), child: const Icon(Icons.chat_outlined),
), ),
selectedIcon: UnreadRoomsBadge( selectedIcon: UnreadRoomsBadge(
badgePosition: badgePosition, badgePosition: badgePosition,
filter: filter:
controller.getRoomFilterByActiveFilter(ActiveFilter.messages), controller.getRoomFilterByActiveFilter(ActiveFilter.messages),
child: const Icon(Icons.forum), child: const Icon(Icons.chat),
), ),
//#Pangea //#Pangea
// label: L10n.of(context)!.messages, // label: L10n.of(context)!.messages,
@ -62,13 +62,13 @@ class ChatListView extends StatelessWidget {
badgePosition: badgePosition, badgePosition: badgePosition,
filter: filter:
controller.getRoomFilterByActiveFilter(ActiveFilter.allChats), controller.getRoomFilterByActiveFilter(ActiveFilter.allChats),
child: const Icon(Icons.forum_outlined), child: const Icon(Icons.chat_outlined),
), ),
selectedIcon: UnreadRoomsBadge( selectedIcon: UnreadRoomsBadge(
badgePosition: badgePosition, badgePosition: badgePosition,
filter: filter:
controller.getRoomFilterByActiveFilter(ActiveFilter.allChats), controller.getRoomFilterByActiveFilter(ActiveFilter.allChats),
child: const Icon(Icons.forum), child: const Icon(Icons.chat),
), ),
// #Pangea // #Pangea
// label: L10n.of(context)!.chats, // label: L10n.of(context)!.chats,
@ -222,8 +222,7 @@ class ChatListView extends StatelessWidget {
? NavigationBar( ? NavigationBar(
elevation: 4, elevation: 4,
labelBehavior: labelBehavior:
NavigationDestinationLabelBehavior.alwaysHide, NavigationDestinationLabelBehavior.alwaysShow,
height: 64,
shadowColor: shadowColor:
Theme.of(context).colorScheme.onSurface, Theme.of(context).colorScheme.onSurface,
surfaceTintColor: surfaceTintColor:

@ -25,9 +25,9 @@ class MultipleEmotesSettingsView extends StatelessWidget {
builder: (context, snapshot) { builder: (context, snapshot) {
final packStateEvents = room.states['im.ponies.room_emotes']; final packStateEvents = room.states['im.ponies.room_emotes'];
// we need to manually convert the map using Map.of, otherwise assigning null will throw a type error. // we need to manually convert the map using Map.of, otherwise assigning null will throw a type error.
final Map<String, Event?> packs = packStateEvents != null final packs = packStateEvents != null
? Map<String, Event?>.of(packStateEvents) ? Map<String, StrippedStateEvent?>.of(packStateEvents)
: <String, Event?>{}; : <String, StrippedStateEvent?>{};
if (!packs.containsKey('')) { if (!packs.containsKey('')) {
packs[''] = null; packs[''] = null;
} }

@ -127,11 +127,12 @@ class UserBottomSheetController extends State<UserBottomSheet> {
textFields: [DialogTextField(hintText: L10n.of(context)!.reason)], textFields: [DialogTextField(hintText: L10n.of(context)!.reason)],
); );
if (reason == null || reason.single.isEmpty) return; if (reason == null || reason.single.isEmpty) return;
final result = await showFutureLoadingDialog( final result = await showFutureLoadingDialog(
context: context, context: context,
future: () => Matrix.of(widget.outerContext).client.reportContent( future: () => Matrix.of(widget.outerContext).client.reportContent(
user.roomId!, user.room.id,
user.eventId, user.id,
reason: reason.single, reason: reason.single,
score: score, score: score,
), ),

@ -60,7 +60,10 @@ extension ClassAndExchangeSettingsRoomExtension on Room {
if (ownPowerLevel < ClassDefaultValues.powerLevelOfAdmin) { if (ownPowerLevel < ClassDefaultValues.powerLevelOfAdmin) {
return; return;
} }
final Event? currentPower = getState(EventTypes.RoomPowerLevels); final dynamic currentPower = getState(EventTypes.RoomPowerLevels);
if (currentPower is! Event?) {
return;
}
final Map<String, dynamic>? currentPowerContent = final Map<String, dynamic>? currentPowerContent =
currentPower?.content["events"] as Map<String, dynamic>?; currentPower?.content["events"] as Map<String, dynamic>?;
final spaceChildPower = currentPowerContent?[EventTypes.SpaceChild]; final spaceChildPower = currentPowerContent?[EventTypes.SpaceChild];
@ -113,10 +116,21 @@ extension ClassAndExchangeSettingsRoomExtension on Room {
} }
} }
Event? get _languageSettingsStateEvent => Event? get _languageSettingsStateEvent {
getState(PangeaEventTypes.classSettings); final dynamic classSettings = getState(PangeaEventTypes.classSettings);
if (classSettings is Event) {
return classSettings;
}
return null;
}
Event? get _pangeaRoomRulesStateEvent => getState(PangeaEventTypes.rules); Event? get _pangeaRoomRulesStateEvent {
final dynamic roomRules = getState(PangeaEventTypes.rules);
if (roomRules is Event) {
return roomRules;
}
return null;
}
ClassSettingsModel? get _firstLanguageSettings => ClassSettingsModel? get _firstLanguageSettings =>
classSettings ?? classSettings ??

@ -12,8 +12,11 @@ extension RoomInformationRoomExtension on Room {
.length; .length;
} }
DateTime? get _creationTime => DateTime? get _creationTime {
getState(EventTypes.RoomCreate)?.originServerTs; final dynamic roomCreate = getState(EventTypes.RoomCreate);
if (roomCreate is! Event) return null;
return roomCreate.originServerTs;
}
String? get _creatorId => getState(EventTypes.RoomCreate)?.senderId; String? get _creatorId => getState(EventTypes.RoomCreate)?.senderId;

@ -21407,11 +21407,6 @@
"createNewGroup", "createNewGroup",
"editChatPermissions", "editChatPermissions",
"globalChatId", "globalChatId",
"accessAndVisibility",
"accessAndVisibilityDescription",
"calls",
"customEmojisAndStickers",
"customEmojisAndStickersBody",
"enterAGroupName", "enterAGroupName",
"enterASpacepName", "enterASpacepName",
"groupDescription", "groupDescription",
@ -22210,7 +22205,6 @@
"pleaseEnterYourCurrentPassword", "pleaseEnterYourCurrentPassword",
"newPassword", "newPassword",
"pleaseChooseAStrongPassword", "pleaseChooseAStrongPassword",
"passwordsDoNotMatch",
"passwordIsWrong", "passwordIsWrong",
"publicLink", "publicLink",
"publicChatAddresses", "publicChatAddresses",
@ -22255,8 +22249,6 @@
"sendReadReceipts", "sendReadReceipts",
"sendTypingNotificationsDescription", "sendTypingNotificationsDescription",
"sendReadReceiptsDescription", "sendReadReceiptsDescription",
"formattedMessages",
"formattedMessagesDescription",
"verifyOtherUser", "verifyOtherUser",
"verifyOtherUserDescription", "verifyOtherUserDescription",
"verifyOtherDevice", "verifyOtherDevice",
@ -22287,10 +22279,6 @@
"refresh", "refresh",
"autoPlayTitle", "autoPlayTitle",
"autoPlayDesc", "autoPlayDesc",
"transparent",
"incomingMessages",
"stickers",
"discover",
"commandHint_ignore", "commandHint_ignore",
"commandHint_unignore", "commandHint_unignore",
"unreadChatsInApp", "unreadChatsInApp",

@ -1409,10 +1409,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: matrix name: matrix
sha256: "32c21a2ac2c221ce887b00a87f965bd8df1a3a4ba8794bbe86be8b56214051fb" sha256: b9aa3c1bdb1ca16c2365bb3681f861eeeb86acd0ea2df9c9ba453fdbcb564076
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.28.1" version: "0.29.1"
meta: meta:
dependency: transitive dependency: transitive
description: description:

@ -70,7 +70,7 @@ dependencies:
keyboard_shortcuts: ^0.1.4 keyboard_shortcuts: ^0.1.4
latlong2: ^0.9.1 latlong2: ^0.9.1
linkify: ^5.0.0 linkify: ^5.0.0
matrix: ^0.28.1 matrix: ^0.29.1
native_imaging: ^0.1.0 native_imaging: ^0.1.0
package_info_plus: ^6.0.0 package_info_plus: ^6.0.0
pasteboard: ^0.2.0 pasteboard: ^0.2.0

Loading…
Cancel
Save