mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-06-14 22:55:12 +10:00
add icon, also misc improvments
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'dart:typed_data';
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
import '../helpers/smaz.dart';
|
||||
|
||||
enum ChannelMessageStatus { pending, sent, failed }
|
||||
@@ -38,6 +39,7 @@ class ChannelMessage {
|
||||
final String? replyToMessageId;
|
||||
final String? replyToSenderName;
|
||||
final String? replyToText;
|
||||
final Map<String, int> reactions;
|
||||
|
||||
ChannelMessage({
|
||||
this.senderKey,
|
||||
@@ -56,7 +58,9 @@ class ChannelMessage {
|
||||
this.replyToMessageId,
|
||||
this.replyToSenderName,
|
||||
this.replyToText,
|
||||
Map<String, int>? reactions,
|
||||
}) : messageId = messageId ?? '${timestamp.millisecondsSinceEpoch}_${senderName.hashCode}_${text.hashCode}',
|
||||
reactions = reactions ?? {},
|
||||
pathBytes = pathBytes ?? Uint8List(0),
|
||||
pathVariants = _mergePathVariants(
|
||||
pathBytes ?? Uint8List(0),
|
||||
@@ -75,6 +79,7 @@ class ChannelMessage {
|
||||
String? replyToMessageId,
|
||||
String? replyToSenderName,
|
||||
String? replyToText,
|
||||
Map<String, int>? reactions,
|
||||
}) {
|
||||
return ChannelMessage(
|
||||
senderKey: senderKey,
|
||||
@@ -93,6 +98,7 @@ class ChannelMessage {
|
||||
replyToMessageId: replyToMessageId ?? this.replyToMessageId,
|
||||
replyToSenderName: replyToSenderName ?? this.replyToSenderName,
|
||||
replyToText: replyToText ?? this.replyToText,
|
||||
reactions: reactions ?? this.reactions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -233,6 +239,10 @@ class ChannelMessage {
|
||||
actualMessage: match.group(2)!,
|
||||
);
|
||||
}
|
||||
|
||||
static ReactionInfo? parseReaction(String text) {
|
||||
return ReactionHelper.parseReaction(text);
|
||||
}
|
||||
}
|
||||
|
||||
class ReplyInfo {
|
||||
|
||||
+11
-4
@@ -1,5 +1,6 @@
|
||||
import 'dart:typed_data';
|
||||
import '../connector/meshcore_protocol.dart';
|
||||
import '../helpers/reaction_helper.dart';
|
||||
|
||||
enum MessageStatus { pending, sent, delivered, failed }
|
||||
|
||||
@@ -19,9 +20,9 @@ class Message {
|
||||
final DateTime? sentAt;
|
||||
final DateTime? deliveredAt;
|
||||
final int? tripTimeMs;
|
||||
final bool forceFlood;
|
||||
final int? pathLength;
|
||||
final Uint8List pathBytes;
|
||||
final Map<String, int> reactions;
|
||||
|
||||
Message({
|
||||
required this.senderKey,
|
||||
@@ -37,10 +38,11 @@ class Message {
|
||||
this.sentAt,
|
||||
this.deliveredAt,
|
||||
this.tripTimeMs,
|
||||
this.forceFlood = false,
|
||||
this.pathLength,
|
||||
Uint8List? pathBytes,
|
||||
}) : pathBytes = pathBytes ?? Uint8List(0);
|
||||
Map<String, int>? reactions,
|
||||
}) : pathBytes = pathBytes ?? Uint8List(0),
|
||||
reactions = reactions ?? {};
|
||||
|
||||
String get senderKeyHex => pubKeyToHex(senderKey);
|
||||
|
||||
@@ -55,6 +57,7 @@ class Message {
|
||||
int? pathLength,
|
||||
Uint8List? pathBytes,
|
||||
bool? isCli,
|
||||
Map<String, int>? reactions,
|
||||
}) {
|
||||
return Message(
|
||||
senderKey: senderKey,
|
||||
@@ -70,9 +73,9 @@ class Message {
|
||||
sentAt: sentAt ?? this.sentAt,
|
||||
deliveredAt: deliveredAt ?? this.deliveredAt,
|
||||
tripTimeMs: tripTimeMs ?? this.tripTimeMs,
|
||||
forceFlood: forceFlood,
|
||||
pathLength: pathLength ?? this.pathLength,
|
||||
pathBytes: pathBytes ?? this.pathBytes,
|
||||
reactions: reactions ?? this.reactions,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -122,4 +125,8 @@ class Message {
|
||||
pathBytes: pathBytes,
|
||||
);
|
||||
}
|
||||
|
||||
static ReactionInfo? parseReaction(String text) {
|
||||
return ReactionHelper.parseReaction(text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user