forked from Nexus/nexus
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
603f83a86a |
|||
|
43ce320987 |
|||
|
3cfe6a3681 |
|||
|
a14a7dd5c5 |
|||
|
e178746e51 |
18 changed files with 213 additions and 268 deletions
176
flake.lock
generated
176
flake.lock
generated
|
|
@ -1,101 +1,5 @@
|
|||
{
|
||||
"nodes": {
|
||||
"advisory-db": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1793979272,
|
||||
"narHash": "sha256-oUcBtPbtS7PlEMuSrgTAN4wv49cXYbwKbQqhH2pah5w=",
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"rev": "309392b18f6b17022f82c701f300433126901068",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rustsec",
|
||||
"repo": "advisory-db",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"continuwuity": {
|
||||
"inputs": {
|
||||
"advisory-db": "advisory-db",
|
||||
"crane": "crane",
|
||||
"fenix": "fenix",
|
||||
"flake-compat": "flake-compat",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1795410322,
|
||||
"narHash": "sha256-uYlRzQBYsOahNA1VgL0WeAtpGorPbnez9ybyhQnCgyo=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "c82aba6f5a324ac008f7bb2088d99034baced702",
|
||||
"revCount": 8293,
|
||||
"type": "git",
|
||||
"url": "https://forgejo.ellis.link/Continuwuation/Continuwuity"
|
||||
},
|
||||
"original": {
|
||||
"type": "git",
|
||||
"url": "https://forgejo.ellis.link/Continuwuation/Continuwuity"
|
||||
}
|
||||
},
|
||||
"crane": {
|
||||
"locked": {
|
||||
"lastModified": 1793836618,
|
||||
"narHash": "sha256-TREenflwEjxOSq292FYwbc3kEm7TDRtXCZRNWEdjBmg=",
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"rev": "79fd63528501446749c09f08cad486a58c7d173e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ipetkov",
|
||||
"repo": "crane",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"fenix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"continuwuity",
|
||||
"nixpkgs"
|
||||
],
|
||||
"rust-analyzer-src": "rust-analyzer-src"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1794142885,
|
||||
"narHash": "sha256-xWFSr7q8IerDAVRk4W7/CgTmi05hMy2qjZ0z3VYpOVk=",
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"rev": "f7d416b5073152c7f2e4de1a28d1a4330dd30a26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "fenix",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"ref": "master",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib"
|
||||
|
|
@ -114,24 +18,6 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-parts_2": {
|
||||
"inputs": {
|
||||
"nixpkgs-lib": "nixpkgs-lib_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1793576659,
|
||||
"narHash": "sha256-V1h85lUaJBQoHFrB2vpXZOE0Ju1MYSnIpsehoVZYlDo=",
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"rev": "ea2630b7470978622c7689a1ff75d2b389175399",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hercules-ci",
|
||||
"repo": "flake-parts",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
|
|
@ -173,11 +59,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1795234589,
|
||||
"narHash": "sha256-f/VVvxf5RsQgWVhUtefoca5ktVg0DA2bnkMOcmSnozo=",
|
||||
"lastModified": 1796087880,
|
||||
"narHash": "sha256-P2MPChVGraSc3Lt8RCUpTwu07reSinLxqmVV/rzq2io=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "2786a2a72088ecf32aea5b3ec52099e6a7cff78f",
|
||||
"rev": "c555305170f8bdcc9d420912c04cdf3d6d61d08c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
@ -202,46 +88,13 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs-lib_2": {
|
||||
"locked": {
|
||||
"lastModified": 1793504054,
|
||||
"narHash": "sha256-ThkfL3D/FhCiZFc9+3BtxwuMmpuK+/bGtXCSo1+yVew=",
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"rev": "7851ba61fd862b277cb6a9cef37394bc18bb94e4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "nixpkgs.lib",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"continuwuity": "continuwuity",
|
||||
"flake-parts": "flake-parts_2",
|
||||
"flake-parts": "flake-parts",
|
||||
"nix2flatpak": "nix2flatpak",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"rust-analyzer-src": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1794096810,
|
||||
"narHash": "sha256-dWC+YtMX+cwH3e9ndiFB77ijTsKtO5I2OxfcvUY4j3k=",
|
||||
"owner": "rust-lang",
|
||||
"repo": "rust-analyzer",
|
||||
"rev": "03ae6be57aa063bb373f69eead3b8e15168a45d2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "rust-lang",
|
||||
"ref": "nightly",
|
||||
"repo": "rust-analyzer",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
|
|
@ -256,27 +109,6 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"treefmt-nix": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"continuwuity",
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1791885023,
|
||||
"narHash": "sha256-C3alQ2MEt0zVrUSho5NUDo3jmhbff72++bfwoqT9Omo=",
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"rev": "0d6d739a833ba9a9c93034862e4a7b061a062a1c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "treefmt-nix",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
|
|
@ -9,11 +9,6 @@
|
|||
url = "github:neobrain/nix2flatpak";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
# TEMPORARY: the e2e tests against Continuwuity from the forge, till there's a new full release in nixpkgs
|
||||
continuwuity = {
|
||||
url = "git+https://forgejo.ellis.link/Continuwuation/Continuwuity";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import "package:nexus/controllers/rooms.dart";
|
|||
import "package:nexus/models/content/content.dart";
|
||||
import "package:nexus/models/content/message.dart";
|
||||
import "package:nexus/models/composer_params.dart";
|
||||
import "package:path/path.dart";
|
||||
|
||||
typedef AttachmentParams = ({ComposerParams composer, int? editingRowId});
|
||||
|
||||
|
|
@ -15,8 +14,7 @@ class AttachmentController(final AttachmentParams params)
|
|||
Null build() => null;
|
||||
|
||||
Future<void> add(XFile file) async {
|
||||
final filename = basename(file.path);
|
||||
state = (filename, null);
|
||||
state = (file.name, null);
|
||||
|
||||
final isEncrypted = ref.read(
|
||||
RoomsController.provider.select(
|
||||
|
|
@ -30,9 +28,11 @@ class AttachmentController(final AttachmentParams params)
|
|||
|
||||
final content = await ref
|
||||
.read(ClientController.provider.notifier)
|
||||
.uploadMedia(.new(path: file.path, encrypt: isEncrypted));
|
||||
.uploadMedia(
|
||||
.new(path: file.path, encrypt: isEncrypted, filename: file.name),
|
||||
);
|
||||
|
||||
state = (filename, content);
|
||||
state = (file.name, content);
|
||||
}
|
||||
|
||||
void set((String, MessageContent?)? attachment) => state = attachment;
|
||||
|
|
|
|||
|
|
@ -43,11 +43,10 @@ class ComposerDraftController(final ComposerParams composer)
|
|||
final (:commands, :text) = TextCommand.parse(
|
||||
event?.localContent?.editSource ??
|
||||
switch (content) {
|
||||
TextMessageContent(:final body) ||
|
||||
ImageMessageContent(:final body) ||
|
||||
VideoMessageContent(:final body) ||
|
||||
AudioMessageContent(:final body) ||
|
||||
FileMessageContent(:final body) => body,
|
||||
TextMessageContent(:final body) => body,
|
||||
// Media's body is its filename unless it has a caption
|
||||
final MessageContent content when content.isMedia =>
|
||||
content.caption ?? "",
|
||||
_ => "",
|
||||
},
|
||||
);
|
||||
|
|
@ -75,7 +74,7 @@ class ComposerDraftController(final ComposerParams composer)
|
|||
)
|
||||
.set(
|
||||
content is MessageContent && content.isMedia
|
||||
? (content.filename ?? content.body ?? "Attachment", content)
|
||||
? (content.displayFilename ?? "Attachment", content)
|
||||
: null,
|
||||
);
|
||||
_botCommand.clear();
|
||||
|
|
|
|||
|
|
@ -81,6 +81,7 @@ class SpacesController extends AsyncNotifier<IList<Space>> {
|
|||
room: room,
|
||||
children: .new(
|
||||
collectDescendants(childId)
|
||||
.where((id) => !childrenById.containsKey(id))
|
||||
.map((id) => rooms[id])
|
||||
.nonNulls,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import "package:nexus/models/content/message.dart";
|
||||
import "package:nexus/helpers/extensions/is_media.dart";
|
||||
|
||||
extension GetFilename on MessageContent {
|
||||
String? get filename => switch (this) {
|
||||
|
|
@ -8,4 +9,16 @@ extension GetFilename on MessageContent {
|
|||
FileMessageContent(:final filename) => filename,
|
||||
_ => null,
|
||||
};
|
||||
|
||||
/// The file's name. Per the spec, the body is the filename if there's no
|
||||
/// separate filename.
|
||||
String? get displayFilename => isMedia ? filename ?? body : null;
|
||||
|
||||
/// The caption of media, or the body of other messages. Per the spec, the
|
||||
/// body of media is only a caption if there's a different filename.
|
||||
String? get caption => switch (filename) {
|
||||
_ when !isMedia => body,
|
||||
final filename? when filename != body => body,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class FileDialogHelper(final Ref ref) {
|
|||
.toList(),
|
||||
);
|
||||
|
||||
final filenameWithExtension = mimeType == null
|
||||
// Only add an extension if the filename doesn't already have a known one
|
||||
final filenameWithExtension =
|
||||
mimeType == null || lookupMimeType(filename) != null
|
||||
? filename
|
||||
: "$filename.${extensionFromMime(mimeType)}";
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class const RoomOverlay(
|
|||
onTap: () {
|
||||
final alias = room.metadata?.canonicalAlias;
|
||||
addTag(
|
||||
id: alias == null
|
||||
id: alias == null || alias.isEmpty
|
||||
? "[#$name](matrix:roomid/${room.metadata?.id.substring(1)}${ref.read(ViaController.provider(room)).viaQuery})"
|
||||
: "[#$name](matrix:r/${alias.substring(1)})",
|
||||
name:
|
||||
|
|
|
|||
|
|
@ -45,7 +45,9 @@ class const EmojiPicker({
|
|||
const .empty();
|
||||
|
||||
return upstream.EmojiPicker(
|
||||
searchHint: "Search or send emoji...",
|
||||
searchHint: allowFreeText
|
||||
? "Search emoji or react with text..."
|
||||
: "Search emoji...",
|
||||
onSelection: (emoji) async {
|
||||
final image = switch (emoji.data) {
|
||||
final PackImage image => image,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,11 @@ class const VideoPlayer(
|
|||
PlayerConfiguration(
|
||||
aspectRatio: aspectRatio,
|
||||
fit: .contain,
|
||||
autoDetectFullscreenDeviceOrientation: true,
|
||||
// Follow the system's rotation setting rather than locking to the
|
||||
// video's orientation, so users can rotate freely while watching
|
||||
autoDetectFullscreenAspectRatio: true,
|
||||
deviceOrientationsOnFullScreen: const [],
|
||||
deviceOrientationsAfterFullScreen: const [],
|
||||
routePageBuilder:
|
||||
(context, animation, secondaryAnimation, provider) => HookBuilder(
|
||||
builder: (context) {
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ class const EventRenderer(
|
|||
final colorScheme = theme.colorScheme;
|
||||
final focusNode = useFocusNode();
|
||||
useListenable(focusNode);
|
||||
final pointerDown = useRef<(Offset, Duration)?>(null);
|
||||
final senderRecognizer = useTapRecognizer();
|
||||
|
||||
final (event, previousEvent) = ref.watch(
|
||||
|
|
@ -135,7 +136,10 @@ class const EventRenderer(
|
|||
(threadRoot == null || previousEvent?.eventId != threadRoot) &&
|
||||
(previousEvent?.isShownAsMessage ?? false) &&
|
||||
event.sender == previousEvent?.sender &&
|
||||
event.pmp?.id == previousEvent?.pmp?.id;
|
||||
event.pmp?.id == previousEvent?.pmp?.id &&
|
||||
// Start a new group after a pause, so it's clear when messages were sent
|
||||
event.timestamp.difference(previousEvent!.timestamp).abs() <
|
||||
const .new(minutes: 5);
|
||||
|
||||
// For what a state event changed, from and to
|
||||
final removedColor = colorScheme.error;
|
||||
|
|
@ -209,6 +213,7 @@ class const EventRenderer(
|
|||
? null
|
||||
: () => onOpenThread!(event.eventId),
|
||||
isGrouped: isGrouped,
|
||||
showTime: focusNode.hasPrimaryFocus,
|
||||
maxLines: maxLines,
|
||||
textOnly: textOnly,
|
||||
)
|
||||
|
|
@ -582,51 +587,88 @@ class const EventRenderer(
|
|||
if (textOnly)
|
||||
child
|
||||
else ...[
|
||||
Builder(
|
||||
builder: (context) => FocusableActionDetector(
|
||||
focusNode: focusNode,
|
||||
actions: contextMenuCallback == null
|
||||
? null
|
||||
: {
|
||||
ActivateIntent: CallbackAction(
|
||||
onInvoke: (_) {
|
||||
final renderBox =
|
||||
context.findRenderObject() as RenderBox;
|
||||
final topLeft = renderBox.localToGlobal(
|
||||
Offset.zero,
|
||||
);
|
||||
context.showAdaptiveMenu(
|
||||
getEventOptions!(event).toList(),
|
||||
globalPosition: topLeft,
|
||||
);
|
||||
return null;
|
||||
},
|
||||
),
|
||||
// Spacing between groups is outside the highlight, so it's even
|
||||
Padding(
|
||||
padding: .only(top: isGrouped ? 0 : 4),
|
||||
child: Builder(
|
||||
builder: (context) => FocusableActionDetector(
|
||||
focusNode: focusNode,
|
||||
actions: contextMenuCallback == null
|
||||
? null
|
||||
: {
|
||||
ActivateIntent: CallbackAction(
|
||||
onInvoke: (_) {
|
||||
final renderBox =
|
||||
context.findRenderObject() as RenderBox;
|
||||
final topLeft = renderBox.localToGlobal(
|
||||
Offset.zero,
|
||||
);
|
||||
context.showAdaptiveMenu(
|
||||
getEventOptions!(event).toList(),
|
||||
globalPosition: topLeft,
|
||||
);
|
||||
return null;
|
||||
},
|
||||
),
|
||||
},
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
decoration: BoxDecoration(
|
||||
// Rounds every corner, as HighlightWrapper's clip only
|
||||
// reaches the ones at the row's edges
|
||||
borderRadius: .circular(12),
|
||||
color: focusNode.hasPrimaryFocus
|
||||
? theme.colorScheme.surfaceContainerHighest
|
||||
: null,
|
||||
),
|
||||
// Tapping focuses the event, e.g. showing when grouped
|
||||
// messages were sent. A Listener, unlike a GestureDetector,
|
||||
// sees taps without taking them from links, media and the
|
||||
// like.
|
||||
child: Listener(
|
||||
behavior: .translucent,
|
||||
onPointerDown: (pointer) => pointerDown.value = (
|
||||
pointer.position,
|
||||
pointer.timeStamp,
|
||||
),
|
||||
onPointerUp: (pointer) {
|
||||
if (pointerDown.value
|
||||
case (final position, final timeStamp)
|
||||
when (pointer.position - position).distance <
|
||||
kTouchSlop &&
|
||||
pointer.timeStamp - timeStamp <
|
||||
kLongPressTimeout) {
|
||||
focusNode.hasPrimaryFocus
|
||||
? focusNode.unfocus()
|
||||
: focusNode.requestFocus();
|
||||
}
|
||||
pointerDown.value = null;
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: focusNode.hasPrimaryFocus
|
||||
? theme.colorScheme.surfaceContainerHighest
|
||||
: null,
|
||||
),
|
||||
child: GestureDetector(
|
||||
onSecondaryTapUp: contextMenuCallback,
|
||||
onLongPressStart: contextMenuCallback,
|
||||
child: SwipeToReply(
|
||||
onSwipe: onSwipe,
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8)
|
||||
.copyWith(top: isGrouped ? 0 : 8),
|
||||
child: Wrap(
|
||||
verticalDirection: .up,
|
||||
spacing: 6,
|
||||
crossAxisAlignment: .center,
|
||||
children: [
|
||||
child,
|
||||
if (child is! MessageRenderer &&
|
||||
child is! GenericEventRenderer)
|
||||
Timestamp(event.timestamp),
|
||||
],
|
||||
onPointerCancel: (_) => pointerDown.value = null,
|
||||
child: GestureDetector(
|
||||
onSecondaryTapUp: contextMenuCallback,
|
||||
onLongPressStart: contextMenuCallback,
|
||||
child: SwipeToReply(
|
||||
onSwipe: onSwipe,
|
||||
Padding(
|
||||
// Even on every side, so the highlight's centered. Lists
|
||||
// add more space at their edges.
|
||||
padding: .symmetric(
|
||||
horizontal: 4,
|
||||
vertical: child is MessageRenderer ? 4 : 0,
|
||||
),
|
||||
child: Wrap(
|
||||
verticalDirection: .up,
|
||||
spacing: 6,
|
||||
crossAxisAlignment: .center,
|
||||
children: [
|
||||
child,
|
||||
if (child is! MessageRenderer &&
|
||||
child is! GenericEventRenderer)
|
||||
Timestamp(event.timestamp),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import "package:collection/collection.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:flutter_riverpod/flutter_riverpod.dart";
|
||||
import "package:flutter_hooks/flutter_hooks.dart";
|
||||
import "package:hooks_riverpod/hooks_riverpod.dart";
|
||||
import "package:linkify/linkify.dart";
|
||||
import "package:nexus/controllers/client_state.dart";
|
||||
import "package:nexus/controllers/event.dart";
|
||||
|
|
@ -37,9 +38,13 @@ class const MessageRenderer(
|
|||
final VoidCallback? onTapThread,
|
||||
final bool textOnly = false,
|
||||
final bool isGrouped = false,
|
||||
|
||||
/// Whether grouped messages show when they were sent, which they otherwise
|
||||
/// only do on hover.
|
||||
final bool showTime = false,
|
||||
final int? maxLines,
|
||||
super.key,
|
||||
}) extends ConsumerWidget {
|
||||
}) extends HookConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = Theme.of(context);
|
||||
|
|
@ -53,6 +58,8 @@ class const MessageRenderer(
|
|||
fontStyle: event.content is EmoteMessageContent ? .italic : null,
|
||||
);
|
||||
|
||||
final hovered = useState(false);
|
||||
|
||||
final rendered = switch (event.content) {
|
||||
_ when event.redactedBy != null => Text(
|
||||
"Redacted event",
|
||||
|
|
@ -110,6 +117,9 @@ class const MessageRenderer(
|
|||
maxLines: maxLines,
|
||||
overflow: maxLines == null ? null : .ellipsis,
|
||||
)
|
||||
// Media without a caption has its filename as its body
|
||||
: content.caption == null
|
||||
? SizedBox.shrink()
|
||||
: format == .html && formattedBody != null
|
||||
? Html(
|
||||
roomId: event.roomId,
|
||||
|
|
@ -117,7 +127,7 @@ class const MessageRenderer(
|
|||
formattedBody.linkifiedHtml,
|
||||
)
|
||||
: LinkifiedText(
|
||||
body.isEmpty ? content.filename ?? "" : body,
|
||||
body,
|
||||
roomId: event.roomId,
|
||||
style: textStyle,
|
||||
maxLines: maxLines,
|
||||
|
|
@ -133,7 +143,7 @@ class const MessageRenderer(
|
|||
if (event.lastEditRowId != 0)
|
||||
Text("(edited)", style: theme.textTheme.labelSmall),
|
||||
|
||||
if (linkify(body)
|
||||
if (linkify(content.caption ?? "")
|
||||
.firstWhereOrNull((element) => element is UrlElement)
|
||||
case final UrlElement link?)
|
||||
if (Uri.tryParse(link.url) case final Uri url?) UrlPreview(url),
|
||||
|
|
@ -160,14 +170,36 @@ class const MessageRenderer(
|
|||
_ => throw Exception("This is impossible"),
|
||||
};
|
||||
|
||||
return Row(
|
||||
final row = Row(
|
||||
crossAxisAlignment: .start,
|
||||
mainAxisSize: .min,
|
||||
spacing: 6,
|
||||
children: [
|
||||
if (!textOnly)
|
||||
if (isGrouped)
|
||||
SizedBox(width: 40)
|
||||
// When the message was sent, as grouped messages have no header
|
||||
SizedBox(
|
||||
width: 40,
|
||||
child: Visibility.maintain(
|
||||
visible: hovered.value || showTime,
|
||||
child: Padding(
|
||||
padding: .only(top: 14),
|
||||
child: Tooltip(
|
||||
message: event.timestamp.toString(),
|
||||
child: FittedBox(
|
||||
fit: .scaleDown,
|
||||
child: Text(
|
||||
TimeOfDay.fromDateTime(event.timestamp).format(context),
|
||||
maxLines: 1,
|
||||
style: theme.textTheme.labelSmall?.copyWith(
|
||||
color: Colors.grey,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
MessageAvatar(event, height: 40),
|
||||
Flexible(
|
||||
|
|
@ -184,7 +216,7 @@ class const MessageRenderer(
|
|||
],
|
||||
),
|
||||
Card(
|
||||
margin: textOnly ? .zero : .only(bottom: 4),
|
||||
margin: .zero,
|
||||
color: textOnly
|
||||
? Colors.transparent
|
||||
: ref.watch(
|
||||
|
|
@ -253,5 +285,13 @@ class const MessageRenderer(
|
|||
),
|
||||
],
|
||||
);
|
||||
|
||||
return isGrouped && !textOnly
|
||||
? MouseRegion(
|
||||
onEnter: (_) => hovered.value = true,
|
||||
onExit: (_) => hovered.value = false,
|
||||
child: row,
|
||||
)
|
||||
: row;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,8 +35,14 @@ final class const MessageMedia(final MessageContent content, {super.key})
|
|||
encrypted: file != null,
|
||||
filename: filename ?? body,
|
||||
),
|
||||
FileMessageContent(:final url, :final info, :final filename, :final file) =>
|
||||
FileCard(url, info, filename: filename, encrypted: file != null),
|
||||
FileMessageContent(
|
||||
:final url,
|
||||
:final info,
|
||||
:final file,
|
||||
:final filename,
|
||||
:final body,
|
||||
) =>
|
||||
FileCard(url, info, filename: filename ?? body, encrypted: file != null),
|
||||
ImageMessageContent(
|
||||
:final url,
|
||||
:final info,
|
||||
|
|
|
|||
|
|
@ -24,24 +24,28 @@ class const ChatTimeline({
|
|||
int eventRowId,
|
||||
int? previousEventRowId, {
|
||||
required Key key,
|
||||
}) => HighlightWrapper(
|
||||
// To work around an AWFUL SuperSliverList bug
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: 0.01),
|
||||
child: EventRenderer(
|
||||
eventRowId,
|
||||
previousEventRowId: previousEventRowId,
|
||||
roomId: chat.roomId,
|
||||
jumpToEvent: jumpToEvent,
|
||||
onOpenThread: onOpenThread,
|
||||
getEventOptions: getEventOptions,
|
||||
onSwipe: onSwipe == null ? null : () => onSwipe!(eventRowId),
|
||||
readReceiptsChat: chat,
|
||||
threadRoot: chat.threadRoot,
|
||||
),
|
||||
),
|
||||
}) => Padding(
|
||||
key: key,
|
||||
isHighlighted: scroll.highlightedEvent == eventRowId,
|
||||
// Spacing at the edges, outside events' focus highlight
|
||||
padding: .symmetric(horizontal: 4),
|
||||
child: HighlightWrapper(
|
||||
// To work around an AWFUL SuperSliverList bug
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(minHeight: 0.01),
|
||||
child: EventRenderer(
|
||||
eventRowId,
|
||||
previousEventRowId: previousEventRowId,
|
||||
roomId: chat.roomId,
|
||||
jumpToEvent: jumpToEvent,
|
||||
onOpenThread: onOpenThread,
|
||||
getEventOptions: getEventOptions,
|
||||
onSwipe: onSwipe == null ? null : () => onSwipe!(eventRowId),
|
||||
readReceiptsChat: chat,
|
||||
threadRoot: chat.threadRoot,
|
||||
),
|
||||
),
|
||||
isHighlighted: scroll.highlightedEvent == eventRowId,
|
||||
),
|
||||
);
|
||||
|
||||
@override
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ final class const PinnedEventsDrawer(
|
|||
jumpToEvent(rowId);
|
||||
},
|
||||
child: Padding(
|
||||
padding: .symmetric(vertical: 4),
|
||||
padding: .symmetric(vertical: 4, horizontal: 4),
|
||||
child: IgnorePointer(
|
||||
child: EventRenderer(
|
||||
rowId,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ final class const SearchDrawer(
|
|||
jumpToEvent(rowId);
|
||||
},
|
||||
child: Padding(
|
||||
padding: .symmetric(vertical: 4),
|
||||
padding: .symmetric(vertical: 4, horizontal: 4),
|
||||
child: IgnorePointer(
|
||||
child: EventRenderer(
|
||||
rowId,
|
||||
|
|
|
|||
|
|
@ -170,8 +170,14 @@ class const NotificationsList({super.key})
|
|||
|
||||
await ref.focusRoom(roomId, rowId);
|
||||
},
|
||||
child: IgnorePointer(
|
||||
child: EventRenderer(rowId, roomId: roomId),
|
||||
child: Padding(
|
||||
padding: .symmetric(horizontal: 4),
|
||||
child: IgnorePointer(
|
||||
child: EventRenderer(
|
||||
rowId,
|
||||
roomId: roomId,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
isHighlighted: isHighlighted,
|
||||
|
|
|
|||
|
|
@ -117,8 +117,7 @@
|
|||
runtimeInputs =
|
||||
buildEnv.packages
|
||||
++ (with pkgs; [
|
||||
# TEMPORARY: matrix-continuwuity, once the local fixes are released
|
||||
(inputs.continuwuity.packages.${system}.default.overrideAttrs { doCheck = false; })
|
||||
matrix-continuwuity
|
||||
curl
|
||||
dbus
|
||||
]);
|
||||
|
|
|
|||
Loading…
Reference in a new issue