refactor: Switch to Hive Collections DB

This commit is contained in:
Christian Pauly 2022-05-30 13:44:05 +02:00
commit c249ebb97c
29 changed files with 347 additions and 216 deletions

View file

@ -262,32 +262,47 @@ class ChatListItem extends StatelessWidget {
),
softWrap: false,
)
: Text(
room.membership == Membership.invite
? L10n.of(context)!.youAreInvitedToThisChat
: room.lastEvent?.getLocalizedBody(
MatrixLocals(L10n.of(context)!),
hideReply: true,
hideEdit: true,
plaintextBody: true,
removeMarkdown: true,
withSenderNamePrefix: !room.isDirectChat ||
room.directChatMatrixID !=
room.lastEvent?.senderId,
) ??
L10n.of(context)!.emptyChat,
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: unread
? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2!.color,
decoration: room.lastEvent?.redacted == true
? TextDecoration.lineThrough
: null,
),
),
: FutureBuilder<String>(
future: room.lastEvent?.calcLocalizedBody(
MatrixLocals(L10n.of(context)!),
hideReply: true,
hideEdit: true,
plaintextBody: true,
removeMarkdown: true,
withSenderNamePrefix: !room.isDirectChat ||
room.directChatMatrixID !=
room.lastEvent?.senderId,
) ??
Future.value(L10n.of(context)!.emptyChat),
builder: (context, snapshot) {
return Text(
room.membership == Membership.invite
? L10n.of(context)!.youAreInvitedToThisChat
: snapshot.data ??
room.lastEvent?.calcLocalizedBodyFallback(
MatrixLocals(L10n.of(context)!),
hideReply: true,
hideEdit: true,
plaintextBody: true,
removeMarkdown: true,
withSenderNamePrefix: !room.isDirectChat ||
room.directChatMatrixID !=
room.lastEvent?.senderId,
) ??
L10n.of(context)!.emptyChat,
softWrap: false,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: unread
? Theme.of(context).colorScheme.secondary
: Theme.of(context).textTheme.bodyText2!.color,
decoration: room.lastEvent?.redacted == true
? TextDecoration.lineThrough
: null,
),
);
}),
),
const SizedBox(width: 8),
AnimatedContainer(

View file

@ -48,7 +48,7 @@ class ClientChooserButton extends StatelessWidget {
(client) => PopupMenuItem(
value: client,
child: FutureBuilder<Profile>(
future: client!.ownProfile,
future: client!.fetchOwnProfile(),
builder: (context, snapshot) => Row(
children: [
Avatar(
@ -90,7 +90,7 @@ class ClientChooserButton extends StatelessWidget {
matrix.accountBundles.forEach((key, value) => clientCount += value.length);
return Center(
child: FutureBuilder<Profile>(
future: matrix.client.ownProfile,
future: matrix.client.fetchOwnProfile(),
builder: (context, snapshot) => Stack(
alignment: Alignment.center,
children: [