treewide sweepfixes
This commit is contained in:
parent
8fda43ccf8
commit
012ecd9249
41 changed files with 270 additions and 386 deletions
|
|
@ -34,7 +34,7 @@ extension BuildEventOptions on Event {
|
|||
)).notifier;
|
||||
|
||||
final isPinned = ref
|
||||
.watch(PinnedIdsController.provider(roomId))
|
||||
.read(PinnedIdsController.provider(roomId))
|
||||
.contains(eventId);
|
||||
|
||||
void showReasonDialog({
|
||||
|
|
@ -86,7 +86,7 @@ extension BuildEventOptions on Event {
|
|||
}
|
||||
|
||||
return .new([
|
||||
if (ref.watch(
|
||||
if (ref.read(
|
||||
PowerLevelController.provider(
|
||||
.new(eventType: .reaction, roomId: roomId),
|
||||
),
|
||||
|
|
@ -98,30 +98,33 @@ extension BuildEventOptions on Event {
|
|||
child: Row(
|
||||
mainAxisAlignment: .center,
|
||||
children: [
|
||||
for (final emoji in {
|
||||
...ref
|
||||
.watch(RecentEmojiController.provider)
|
||||
.map((entry) => entry.emoji),
|
||||
"👍",
|
||||
"🤣",
|
||||
"😭",
|
||||
"🤔",
|
||||
}.take(3))
|
||||
IconButton(
|
||||
icon: Text(emoji),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
await ref
|
||||
.watch(notifier)
|
||||
.sendReaction(emoji, this)
|
||||
.onError(showError);
|
||||
...{
|
||||
...ref
|
||||
.read(RecentEmojiController.provider)
|
||||
.map((entry) => entry.emoji),
|
||||
"👍",
|
||||
"🤣",
|
||||
"😭",
|
||||
"🤔",
|
||||
}
|
||||
.take(3)
|
||||
.map(
|
||||
(emoji) => IconButton(
|
||||
icon: Text(emoji),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
await ref
|
||||
.read(notifier)
|
||||
.sendReaction(emoji, this)
|
||||
.onError(showError);
|
||||
|
||||
await ref
|
||||
.read(RecentEmojiController.provider.notifier)
|
||||
.add(emoji)
|
||||
.onError(showError);
|
||||
},
|
||||
),
|
||||
await ref
|
||||
.read(RecentEmojiController.provider.notifier)
|
||||
.add(emoji)
|
||||
.onError(showError);
|
||||
},
|
||||
),
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.emoji_emotions),
|
||||
onPressed: () {
|
||||
|
|
@ -135,7 +138,7 @@ extension BuildEventOptions on Event {
|
|||
onSelection: (emoji) {
|
||||
Navigator.of(context).pop();
|
||||
ref
|
||||
.watch(notifier)
|
||||
.read(notifier)
|
||||
.sendReaction(emoji, this)
|
||||
.onError(showError);
|
||||
},
|
||||
|
|
@ -148,7 +151,7 @@ extension BuildEventOptions on Event {
|
|||
),
|
||||
),
|
||||
|
||||
if (ref.watch(
|
||||
if (ref.read(
|
||||
PowerLevelController.provider(
|
||||
.new(eventType: .message, roomId: roomId),
|
||||
),
|
||||
|
|
@ -167,7 +170,7 @@ extension BuildEventOptions on Event {
|
|||
child: const ListTile(leading: Icon(Icons.edit), title: Text("Edit")),
|
||||
),
|
||||
|
||||
if (ref.watch(
|
||||
if (ref.read(
|
||||
PowerLevelController.provider(
|
||||
.state(eventType: .pinnedEvents, roomId: roomId),
|
||||
),
|
||||
|
|
@ -225,7 +228,7 @@ extension BuildEventOptions on Event {
|
|||
),
|
||||
),
|
||||
|
||||
if (ref.watch(
|
||||
if (ref.read(
|
||||
PowerLevelController.provider(
|
||||
.redaction(targetUser: sender, roomId: roomId),
|
||||
),
|
||||
|
|
@ -239,7 +242,7 @@ extension BuildEventOptions on Event {
|
|||
"This cannot be reversed.",
|
||||
action: "Delete",
|
||||
onConfirm: (reason) =>
|
||||
ref.watch(notifier).deleteMessage(this, reason: reason),
|
||||
ref.read(notifier).deleteMessage(this, reason: reason),
|
||||
),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.delete, color: danger),
|
||||
|
|
@ -249,7 +252,7 @@ extension BuildEventOptions on Event {
|
|||
|
||||
if (eventId.isFake)
|
||||
PopupMenuItem(
|
||||
onTap: () => ref.watch(notifier).hideClientSticky(rowId),
|
||||
onTap: () => ref.read(notifier).hideClientSticky(rowId),
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.delete, color: danger),
|
||||
title: Text("Hide", style: .new(color: danger)),
|
||||
|
|
@ -260,7 +263,7 @@ extension BuildEventOptions on Event {
|
|||
onTap: () => showReasonDialog(
|
||||
title: "Report",
|
||||
description:
|
||||
"Report this this to your server administrators, "
|
||||
"Report this event to your server administrators, "
|
||||
"who can take action like banning this server or room.",
|
||||
action: "Report",
|
||||
onConfirm: (reason) => ref
|
||||
|
|
|
|||
23
lib/helpers/extensions/room_destinations.dart
Normal file
23
lib/helpers/extensions/room_destinations.dart
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:navigation_rail_m3e/navigation_rail_m3e.dart";
|
||||
import "package:nexus/models/room.dart";
|
||||
import "package:nexus/widgets/avatar_or_hash.dart";
|
||||
|
||||
extension RoomDestinations on IList<Room> {
|
||||
List<NavigationRailM3EDestination> toDestinations({required bool isDm}) =>
|
||||
map(
|
||||
(room) => NavigationRailM3EDestination(
|
||||
label: room.metadata?.name ?? "Unnamed Room",
|
||||
badgeCount: switch (room.metadata?.unreadNotifications) {
|
||||
0 || null => room.metadata?.unreadMessages == 0 ? null : 0,
|
||||
int unread => unread,
|
||||
},
|
||||
icon: AvatarOrHash(
|
||||
room.metadata?.avatar,
|
||||
room.metadata?.name ?? "Unnamed Room",
|
||||
fallback: isDm ? null : const Icon(Icons.numbers),
|
||||
),
|
||||
),
|
||||
).toList();
|
||||
}
|
||||
|
|
@ -51,7 +51,7 @@ extension ShowAboutDialog on BuildContext {
|
|||
),
|
||||
M3ECardColumn(
|
||||
onTap: (index) =>
|
||||
ref.watch(LaunchHelper.provider).launchUrl(switch (index) {
|
||||
ref.read(LaunchHelper.provider).launchUrl(switch (index) {
|
||||
0 => .https("git.federated.nexus", "nexus/nexus"),
|
||||
_ => .https("liberapay.com", "QuadRadical"),
|
||||
}),
|
||||
|
|
|
|||
Loading…
Reference in a new issue