diff --git a/packages/moxxmpp/lib/src/message.dart b/packages/moxxmpp/lib/src/message.dart index b689b70..c528cd0 100644 --- a/packages/moxxmpp/lib/src/message.dart +++ b/packages/moxxmpp/lib/src/message.dart @@ -16,7 +16,9 @@ import 'package:moxxmpp/src/xeps/xep_0461.dart'; /// A callback that is called whenever a message is sent using /// [MessageManager.sendMessage]. The input the typed map that is passed to /// sendMessage. -typedef MessageSendingCallback = List Function(TypedMap); +typedef MessageSendingCallback = List Function( + TypedMap, +); /// The raw content of the element. class MessageBodyData { @@ -85,7 +87,10 @@ class MessageManager extends XmppManagerBase { /// Send an unawaitable message to [to]. [extensions] is a typed map that contains /// data for building the message. - Future sendMessage(JID to, TypedMap extensions) async { + Future sendMessage( + JID to, + TypedMap extensions, + ) async { await getAttributes().sendStanza( StanzaDetails( Stanza.message( @@ -102,7 +107,9 @@ class MessageManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { if (extensions.get() != null) { return []; } diff --git a/packages/moxxmpp/lib/src/xeps/staging/file_upload_notification.dart b/packages/moxxmpp/lib/src/xeps/staging/file_upload_notification.dart index 0974c56..14cdbf7 100644 --- a/packages/moxxmpp/lib/src/xeps/staging/file_upload_notification.dart +++ b/packages/moxxmpp/lib/src/xeps/staging/file_upload_notification.dart @@ -141,7 +141,9 @@ class FileUploadNotificationManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final fun = extensions.get(); if (fun != null) { return [fun.toXML()]; diff --git a/packages/moxxmpp/lib/src/xeps/xep_0066.dart b/packages/moxxmpp/lib/src/xeps/xep_0066.dart index 90496c9..f69ea06 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0066.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0066.dart @@ -68,7 +68,9 @@ class OOBManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0085.dart b/packages/moxxmpp/lib/src/xeps/xep_0085.dart index b864ed1..b186e4f 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0085.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0085.dart @@ -85,7 +85,7 @@ class ChatStateManager extends XmppManagerBase { try { state.extensions.set(ChatState.fromName(element.tag)); } catch (_) { - logger.finest('Ignoring invalid chat state ${element.tag}'); + logger.finest('Ignoring invalid chat state ${element.tag}'); } return state; @@ -112,7 +112,9 @@ class ChatStateManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0184.dart b/packages/moxxmpp/lib/src/xeps/xep_0184.dart index 597990c..9bf4cc6 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0184.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0184.dart @@ -104,7 +104,9 @@ class MessageDeliveryReceiptManager extends XmppManagerBase { return state..done = true; } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0300.dart b/packages/moxxmpp/lib/src/xeps/xep_0300.dart index 16e8120..f70d104 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0300.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0300.dart @@ -66,7 +66,7 @@ enum HashFunction { return HashFunction.blake2b512; } - throw Exception(); + throw Exception('Invalid hash function $name'); } /// Like [HashFunction.fromName], but returns null if the hash function is unknown diff --git a/packages/moxxmpp/lib/src/xeps/xep_0308.dart b/packages/moxxmpp/lib/src/xeps/xep_0308.dart index 2734587..4871219 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0308.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0308.dart @@ -57,7 +57,9 @@ class LastMessageCorrectionManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0333.dart b/packages/moxxmpp/lib/src/xeps/xep_0333.dart index 0b9532a..8a7adbb 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0333.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0333.dart @@ -17,9 +17,12 @@ enum ChatMarker { factory ChatMarker.fromName(String name) { switch (name) { - case 'received': return ChatMarker.received; - case 'displayed': return ChatMarker.displayed; - case 'acknowledged': return ChatMarker.acknowledged; + case 'received': + return ChatMarker.received; + case 'displayed': + return ChatMarker.displayed; + case 'acknowledged': + return ChatMarker.acknowledged; } throw Exception('Invalid chat marker $name'); @@ -32,7 +35,7 @@ enum ChatMarker { tag = 'received'; break; case ChatMarker.displayed: - tag = 'displayed'; + tag = 'displayed'; break; case ChatMarker.acknowledged: tag = 'acknowledged'; @@ -129,7 +132,9 @@ class ChatMarkerManager extends XmppManagerBase { return state..done = true; } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final children = List.empty(growable: true); final marker = extensions.get(); if (marker != null) { @@ -149,6 +154,8 @@ class ChatMarkerManager extends XmppManagerBase { await super.postRegisterCallback(); // Register the sending callback - getAttributes().getManagerById(messageManager)?.registerMessageSendingCallback(_messageSendingCallback); + getAttributes() + .getManagerById(messageManager) + ?.registerMessageSendingCallback(_messageSendingCallback); } } diff --git a/packages/moxxmpp/lib/src/xeps/xep_0334.dart b/packages/moxxmpp/lib/src/xeps/xep_0334.dart index 071fbcb..34b76c5 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0334.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0334.dart @@ -87,16 +87,18 @@ class MessageProcessingHintManager extends XmppManagerBase { return state ..extensions.set( MessageProcessingHintData( - elements.map((element) => MessageProcessingHint.fromName(element.tag)).toList(), + elements + .map((element) => MessageProcessingHint.fromName(element.tag)) + .toList(), ), ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); - return data != null - ? data.hints.map((hint) => hint.toXML()).toList() - : []; + return data != null ? data.hints.map((hint) => hint.toXML()).toList() : []; } @override diff --git a/packages/moxxmpp/lib/src/xeps/xep_0359.dart b/packages/moxxmpp/lib/src/xeps/xep_0359.dart index 1525cab..ed4f07b 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0359.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0359.dart @@ -123,7 +123,9 @@ class StableIdManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? data.toXML() : []; } diff --git a/packages/moxxmpp/lib/src/xeps/xep_0424.dart b/packages/moxxmpp/lib/src/xeps/xep_0424.dart index f39b2da..859d84b 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0424.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0424.dart @@ -63,7 +63,9 @@ class MessageRetractionManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0444.dart b/packages/moxxmpp/lib/src/xeps/xep_0444.dart index e2162f8..f412bbd 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0444.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0444.dart @@ -69,7 +69,9 @@ class MessageReactionsManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0447.dart b/packages/moxxmpp/lib/src/xeps/xep_0447.dart index bf4e373..baed4f4 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0447.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0447.dart @@ -140,7 +140,9 @@ class SFSManager extends XmppManagerBase { @override Future isSupported() async => true; - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); if (data == null) { return []; diff --git a/packages/moxxmpp/lib/src/xeps/xep_0449.dart b/packages/moxxmpp/lib/src/xeps/xep_0449.dart index b89b607..b37fd76 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0449.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0449.dart @@ -270,7 +270,9 @@ class StickersManager extends XmppManagerBase { ); } - List _messageSendingCallback(TypedMap extensions) { + List _messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/lib/src/xeps/xep_0461.dart b/packages/moxxmpp/lib/src/xeps/xep_0461.dart index c6d6f1d..644b98a 100644 --- a/packages/moxxmpp/lib/src/xeps/xep_0461.dart +++ b/packages/moxxmpp/lib/src/xeps/xep_0461.dart @@ -103,7 +103,9 @@ class MessageRepliesManager extends XmppManagerBase { Future isSupported() async => true; @visibleForTesting - List messageSendingCallback(TypedMap extensions) { + List messageSendingCallback( + TypedMap extensions, + ) { final data = extensions.get(); return data != null ? [ diff --git a/packages/moxxmpp/test/xeps/xep_0447_test.dart b/packages/moxxmpp/test/xeps/xep_0447_test.dart index 8459fb9..d24e627 100644 --- a/packages/moxxmpp/test/xeps/xep_0447_test.dart +++ b/packages/moxxmpp/test/xeps/xep_0447_test.dart @@ -13,7 +13,7 @@ void main() { 3032449 4096x2160 2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU= - 2AfMGH8O7UNPTvUVAM9aK13mpCY= + 2AfMGH8O7UNPTvUVAM9aK13mpCY= Photo from the summit. @@ -28,11 +28,11 @@ void main() { ); expect( - sfs.metadata.hashes['sha3-256'], + sfs.metadata.hashes[HashFunction.sha3_256], '2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=', ); expect( - sfs.metadata.hashes['id-blake2b256'], + sfs.metadata.hashes[HashFunction.blake2b256], '2AfMGH8O7UNPTvUVAM9aK13mpCY=', ); });