Remove flutter chat #26
3 changed files with 9 additions and 5 deletions
don't try to render redacted events
commit
e7ecae4606
|
|
@ -3,13 +3,14 @@ import "package:nexus/models/content/content.dart";
|
||||||
part "reaction.freezed.dart";
|
part "reaction.freezed.dart";
|
||||||
part "reaction.g.dart";
|
part "reaction.g.dart";
|
||||||
|
|
||||||
String? keyFromJson(Map<String, dynamic> json) => json["key"];
|
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class ReactionContent extends Content with _$ReactionContent {
|
abstract class ReactionContent extends Content with _$ReactionContent {
|
||||||
ReactionContent._();
|
ReactionContent._();
|
||||||
|
static String? keyJsonFromJson(Map<dynamic, dynamic> json, String key) =>
|
||||||
|
json["m.relates_to"]?["key"];
|
||||||
|
|
||||||
factory ReactionContent({
|
factory ReactionContent({
|
||||||
@JsonKey(fromJson: keyFromJson, name: "m.relates_to") String? key,
|
@JsonKey(readValue: ReactionContent.keyJsonFromJson) String? key,
|
||||||
}) = _ReactionContent;
|
}) = _ReactionContent;
|
||||||
|
|
||||||
factory ReactionContent.fromJson(Map<String, Object?> json) =>
|
factory ReactionContent.fromJson(Map<String, Object?> json) =>
|
||||||
|
|
|
||||||
|
|
@ -62,12 +62,14 @@ class RenderEvent extends ConsumerWidget {
|
||||||
children: getEventOptions!(event).toList(),
|
children: getEventOptions!(event).toList(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (event.redactedBy != null) return SizedBox.shrink();
|
||||||
|
|
||||||
final child = switch (event.content) {
|
final child = switch (event.content) {
|
||||||
Content(:final parseError?) => SelectableText(
|
Content(:final parseError?) => SelectableText(
|
||||||
"An error occurred while parsing this event:\n$parseError",
|
"An error occurred while parsing this event:\n$parseError\n${parseError.stackTrace}",
|
||||||
style: errorStyle,
|
style: errorStyle,
|
||||||
),
|
),
|
||||||
EncryptedContent() => Text("Unable to decrypt event"),
|
EncryptedContent() => Text("Unable to decrypt event", style: errorStyle),
|
||||||
MessageContent() => Row(
|
MessageContent() => Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
spacing: 8,
|
spacing: 8,
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ class LinkPreview extends ConsumerWidget {
|
||||||
.watch(LaunchHelper.provider)
|
.watch(LaunchHelper.provider)
|
||||||
.launchUrl(Uri.parse(link)),
|
.launchUrl(Uri.parse(link)),
|
||||||
child: Card(
|
child: Card(
|
||||||
|
margin: EdgeInsets.symmetric(vertical: 4),
|
||||||
color: Theme.of(
|
color: Theme.of(
|
||||||
context,
|
context,
|
||||||
).colorScheme.surfaceContainerHighest,
|
).colorScheme.surfaceContainerHighest,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue