refactor: Update to Matrix Dart SDK 0.29.9

This commit is contained in:
Krille 2024-05-29 11:20:32 +02:00
commit 3d35a6adcf
No known key found for this signature in database
GPG key ID: E067ECD60F1A0652
10 changed files with 62 additions and 17 deletions

View file

@ -266,6 +266,10 @@ extension JoinRulesDisplayString on JoinRules {
return l10n.usersMustKnock;
case JoinRules.private:
return l10n.noOneCanJoin;
case JoinRules.restricted:
return l10n.restricted;
case JoinRules.knockRestricted:
return l10n.knockRestricted;
}
}
}

View file

@ -62,8 +62,14 @@ class SettingsIgnoreListView extends StatelessWidget {
),
Expanded(
child: StreamBuilder<Object>(
stream: client.onAccountData.stream
.where((a) => a.type == 'm.ignored_user_list'),
stream: client.onSync.stream.where(
(syncUpdate) =>
syncUpdate.accountData?.any(
(accountData) =>
accountData.type == 'm.ignored_user_list',
) ??
false,
),
builder: (context, snapshot) {
return ListView.builder(
itemCount: client.ignoredUsers.length,

View file

@ -22,11 +22,13 @@ class SettingsNotificationsView extends StatelessWidget {
),
body: MaxWidthBody(
child: StreamBuilder(
stream: Matrix.of(context)
.client
.onAccountData
.stream
.where((event) => event.type == 'm.push_rules'),
stream: Matrix.of(context).client.onSync.stream.where(
(syncUpdate) =>
syncUpdate.accountData?.any(
(accountData) => accountData.type == 'm.push_rules',
) ??
false,
),
builder: (BuildContext context, _) {
return Column(
children: [

View file

@ -205,10 +205,14 @@ class SettingsStyleView extends StatelessWidget {
),
),
StreamBuilder(
stream: client.onAccountData.stream.where(
(data) =>
data.type ==
ApplicationAccountConfigExtension.accountDataKey,
stream: client.onSync.stream.where(
(syncUpdate) =>
syncUpdate.accountData?.any(
(accountData) =>
accountData.type ==
ApplicationAccountConfigExtension.accountDataKey,
) ??
false,
),
builder: (context, snapshot) {
final accountConfig = client.applicationAccountConfig;

View file

@ -37,9 +37,15 @@ class ChatSettingsPopupMenuState extends State<ChatSettingsPopupMenu> {
Widget build(BuildContext context) {
notificationChangeSub ??= Matrix.of(context)
.client
.onAccountData
.onSync
.stream
.where((u) => u.type == 'm.push_rules')
.where(
(syncUpdate) =>
syncUpdate.accountData?.any(
(accountData) => accountData.type == 'm.push_rules',
) ??
false,
)
.listen(
(u) => setState(() {}),
);