From 8edfc3384a0c6aac95e9707d6eea44dd5452dfb2 Mon Sep 17 00:00:00 2001 From: Gabriel Borlea Date: Fri, 25 Aug 2023 13:48:18 +0300 Subject: [PATCH] format files using dart format --- .../plugin_integration_test.dart | 1 - example/lib/main.dart | 161 ++++++++---------- example/test/widget_test.dart | 4 +- lib/jitsi_meet_flutter_sdk.dart | 2 +- lib/src/jitsi_meet.dart | 48 +++--- lib/src/jitsi_meet_conference_options.dart | 22 ++- lib/src/jitsi_meet_event_listener.dart | 61 +++---- lib/src/jitsi_meet_method_channel.dart | 64 ++++--- lib/src/jitsi_meet_platform_interface.dart | 38 +++-- lib/src/jitsi_meet_user_info.dart | 2 +- lib/src/method_response.dart | 4 +- test/jitsi_meet_method_channel_test.dart | 6 +- test/jitsi_meet_test.dart | 10 +- 13 files changed, 205 insertions(+), 218 deletions(-) diff --git a/example/integration_test/plugin_integration_test.dart b/example/integration_test/plugin_integration_test.dart index 75062e9..115ec31 100644 --- a/example/integration_test/plugin_integration_test.dart +++ b/example/integration_test/plugin_integration_test.dart @@ -6,7 +6,6 @@ // For more information about Flutter integration tests, please see // https://docs.flutter.dev/cookbook/testing/integration/introduction - import 'package:flutter_test/flutter_test.dart'; import 'package:integration_test/integration_test.dart'; diff --git a/example/lib/main.dart b/example/lib/main.dart index df0cb2a..34a3c8f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:jitsi_meet_flutter_sdk/jitsi_meet_flutter_sdk.dart'; @@ -21,13 +20,13 @@ class _MyAppState extends State { List participants = []; final _jitsiMeetPlugin = JitsiMeet(); - join() async{ + join() async { var options = JitsiMeetConferenceOptions( room: "testgabigabi", configOverrides: { "startWithAudioMuted": false, "startWithVideoMuted": false, - "subject" : "Lipitori" + "subject": "Lipitori" }, featureFlags: { "unsaferoomwarning.enabled": false, @@ -36,71 +35,57 @@ class _MyAppState extends State { userInfo: JitsiMeetUserInfo( displayName: "Gabi", email: "gabi.borlea.1@gmail.com", - avatar: "https://avatars.githubusercontent.com/u/57035818?s=400&u=02572f10fe61bca6fc20426548f3920d53f79693&v=4" - ), + avatar: + "https://avatars.githubusercontent.com/u/57035818?s=400&u=02572f10fe61bca6fc20426548f3920d53f79693&v=4"), ); var listener = JitsiMeetEventListener( conferenceJoined: (url) { debugPrint("conferenceJoined: url: $url"); }, - conferenceTerminated: (url, error) { debugPrint("conferenceTerminated: url: $url, error: $error"); }, - conferenceWillJoin: (url) { debugPrint("conferenceWillJoin: url: $url"); }, - participantJoined: (email, name, role, participantId) { debugPrint( "participantJoined: email: $email, name: $name, role: $role, " - "participantId: $participantId", + "participantId: $participantId", ); participants.add(participantId!); }, - participantLeft: (participantId) { debugPrint("participantLeft: participantId: $participantId"); }, - audioMutedChanged: (muted) { debugPrint("audioMutedChanged: isMuted: $muted"); }, - videoMutedChanged: (muted) { debugPrint("videoMutedChanged: isMuted: $muted"); }, - endpointTextMessageReceived: (senderId, message) { debugPrint( - "endpointTextMessageReceived: senderId: $senderId, message: $message" - ); + "endpointTextMessageReceived: senderId: $senderId, message: $message"); }, - screenShareToggled: (participantId, sharing) { debugPrint( "screenShareToggled: participantId: $participantId, " - "isSharing: $sharing", + "isSharing: $sharing", ); }, - chatMessageReceived: (senderId, message, isPrivate, timestamp) { debugPrint( "chatMessageReceived: senderId: $senderId, message: $message, " - "isPrivate: $isPrivate, timestamp: $timestamp", + "isPrivate: $isPrivate, timestamp: $timestamp", ); }, - chatToggled: (isOpen) => debugPrint("chatToggled: isOpen: $isOpen"), - participantsInfoRetrieved: (participantsInfo) { debugPrint( - "participantsInfoRetrieved: participantsInfo: $participantsInfo, " - ); + "participantsInfoRetrieved: participantsInfo: $participantsInfo, "); }, - readyToClose: () { debugPrint("readyToClose"); }, @@ -111,8 +96,8 @@ class _MyAppState extends State { hangUp() async { await _jitsiMeetPlugin.hangUp(); } - - setAudioMuted(bool? muted) async{ + + setAudioMuted(bool? muted) async { var a = await _jitsiMeetPlugin.setAudioMuted(muted!); debugPrint("$a"); setState(() { @@ -120,7 +105,7 @@ class _MyAppState extends State { }); } - setVideoMuted(bool? muted) async{ + setVideoMuted(bool? muted) async { var a = await _jitsiMeetPlugin.setVideoMuted(muted!); debugPrint("$a"); setState(() { @@ -128,17 +113,18 @@ class _MyAppState extends State { }); } - sendEndpointTextMessage() async{ + sendEndpointTextMessage() async { var a = await _jitsiMeetPlugin.sendEndpointTextMessage(message: "HEY"); debugPrint("$a"); for (var p in participants) { - var b = await _jitsiMeetPlugin.sendEndpointTextMessage(to: p, message: "HEY"); + var b = + await _jitsiMeetPlugin.sendEndpointTextMessage(to: p, message: "HEY"); debugPrint("$b"); } } - toggleScreenShare(bool? enabled) async{ + toggleScreenShare(bool? enabled) async { await _jitsiMeetPlugin.toggleScreenShare(enabled!); setState(() { @@ -146,11 +132,11 @@ class _MyAppState extends State { }); } - openChat() async{ + openChat() async { await _jitsiMeetPlugin.openChat(); } - sendChatMessage() async{ + sendChatMessage() async { var a = await _jitsiMeetPlugin.sendChatMessage(message: "HEY1"); debugPrint("$a"); @@ -160,11 +146,11 @@ class _MyAppState extends State { } } - closeChat() async{ + closeChat() async { await _jitsiMeetPlugin.closeChat(); } - retrieveParticipantsInfo() async{ + retrieveParticipantsInfo() async { var a = await _jitsiMeetPlugin.retrieveParticipantsInfo(); debugPrint("$a"); } @@ -173,65 +159,54 @@ class _MyAppState extends State { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( - appBar: AppBar( - title: const Text('Plugin example app'), - ), - body: Center(child: Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - children: [ - - TextButton( - onPressed: join, - child: const Text("Join"), - ), - TextButton( - onPressed: hangUp, - child: const Text("Hang Up") - ), - Row(children: [ - const Text("Set Audio Muted"), - Checkbox( - value: audioMuted, - onChanged: setAudioMuted, - ), - ]), - Row(children: [ - const Text("Set Video Muted"), - Checkbox( - value: videoMuted, - onChanged: setVideoMuted, - ), - ]), - TextButton( - onPressed: sendEndpointTextMessage, - child: const Text("Send Hey Endpoint Message To All") - ), - Row(children: [ - const Text("Toggle Screen Share"), - Checkbox( - value: screenShareOn, - onChanged: toggleScreenShare, - ), - ]), - TextButton( - onPressed: openChat, - child: const Text("Open Chat") - ), - TextButton( - onPressed: sendChatMessage, - child: const Text("Send Chat Message to All") - ), - TextButton( - onPressed: closeChat, - child: const Text("Close Chat") - ), - - TextButton( - onPressed: retrieveParticipantsInfo, - child: const Text("Retrieve Participants Info") - ), - ]), - )), + appBar: AppBar( + title: const Text('Plugin example app'), + ), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + TextButton( + onPressed: join, + child: const Text("Join"), + ), + TextButton(onPressed: hangUp, child: const Text("Hang Up")), + Row(children: [ + const Text("Set Audio Muted"), + Checkbox( + value: audioMuted, + onChanged: setAudioMuted, + ), + ]), + Row(children: [ + const Text("Set Video Muted"), + Checkbox( + value: videoMuted, + onChanged: setVideoMuted, + ), + ]), + TextButton( + onPressed: sendEndpointTextMessage, + child: const Text("Send Hey Endpoint Message To All")), + Row(children: [ + const Text("Toggle Screen Share"), + Checkbox( + value: screenShareOn, + onChanged: toggleScreenShare, + ), + ]), + TextButton( + onPressed: openChat, child: const Text("Open Chat")), + TextButton( + onPressed: sendChatMessage, + child: const Text("Send Chat Message to All")), + TextButton( + onPressed: closeChat, child: const Text("Close Chat")), + TextButton( + onPressed: retrieveParticipantsInfo, + child: const Text("Retrieve Participants Info")), + ]), + )), ); } } diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index b1fab52..a855e17 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -18,8 +18,8 @@ void main() { // Verify that platform version is retrieved. expect( find.byWidgetPredicate( - (Widget widget) => widget is Text && - widget.data!.startsWith('Running on:'), + (Widget widget) => + widget is Text && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/lib/jitsi_meet_flutter_sdk.dart b/lib/jitsi_meet_flutter_sdk.dart index fff94ce..b81f22b 100644 --- a/lib/jitsi_meet_flutter_sdk.dart +++ b/lib/jitsi_meet_flutter_sdk.dart @@ -1,4 +1,4 @@ export 'src/jitsi_meet.dart' show JitsiMeet; export 'src/jitsi_meet_conference_options.dart' show JitsiMeetConferenceOptions; export 'src/jitsi_meet_event_listener.dart' show JitsiMeetEventListener; -export 'src/jitsi_meet_user_info.dart' show JitsiMeetUserInfo; \ No newline at end of file +export 'src/jitsi_meet_user_info.dart' show JitsiMeetUserInfo; diff --git a/lib/src/jitsi_meet.dart b/lib/src/jitsi_meet.dart index 43bb67d..86a1369 100644 --- a/lib/src/jitsi_meet.dart +++ b/lib/src/jitsi_meet.dart @@ -3,44 +3,45 @@ import 'jitsi_meet_event_listener.dart'; import 'jitsi_meet_conference_options.dart'; import 'method_response.dart'; -/// The entry point for the sdk. It is used to launch the meeting screen, +/// The entry point for the sdk. It is used to launch the meeting screen, /// to send and receive all the events. class JitsiMeet { Future getPlatformVersion() { return JitsiMeetPlatform.instance.getPlatformVersion(); } - /// Joins a meeting with the given meeting [options] and + /// Joins a meeting with the given meeting [options] and /// optionally a [listener] is given for listening to events triggered by the native sdks. - Future join(JitsiMeetConferenceOptions options, [JitsiMeetEventListener? listener]) async{ - return await JitsiMeetPlatform.instance.join( - options, - listener ?? JitsiMeetEventListener() - ); + Future join(JitsiMeetConferenceOptions options, + [JitsiMeetEventListener? listener]) async { + return await JitsiMeetPlatform.instance + .join(options, listener ?? JitsiMeetEventListener()); } /// The localParticipant leaves the current meeting. - Future hangUp() async{ + Future hangUp() async { return await JitsiMeetPlatform.instance.hangUp(); } /// Sets the state of the localParticipant audio [muted] according to the muted parameter. - Future setAudioMuted(bool muted) async{ + Future setAudioMuted(bool muted) async { return await JitsiMeetPlatform.instance.setAudioMuted(muted); } /// Sets the state of the localParticipant video [muted] according to the muted parameter. - Future setVideoMuted(bool muted) async{ + Future setVideoMuted(bool muted) async { return await JitsiMeetPlatform.instance.setVideoMuted(muted); } - /// Sends a message via the data channel [to] one particular participant or to all of them. + /// Sends a message via the data channel [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. - Future sendEndpointTextMessage({String? to, required String message}) async { - return await JitsiMeetPlatform.instance.sendEndpointTextMessage(to: to, message:message); + Future sendEndpointTextMessage( + {String? to, required String message}) async { + return await JitsiMeetPlatform.instance + .sendEndpointTextMessage(to: to, message: message); } /// Sets the state of the localParticipant screen sharing according to the [enabled] parameter. @@ -48,19 +49,21 @@ class JitsiMeet { return await JitsiMeetPlatform.instance.toggleScreenShare(enabled); } - /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that + /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that /// particular participant will be opened. Future openChat([String? to]) async { return await JitsiMeetPlatform.instance.openChat(to); } - /// Sends a chat message via [to] one particular participant or to all of them. + /// Sends a chat message via [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. - Future sendChatMessage({String? to, required String message}) async { - return await JitsiMeetPlatform.instance.sendChatMessage(to: to, message:message); + Future sendChatMessage( + {String? to, required String message}) async { + return await JitsiMeetPlatform.instance + .sendChatMessage(to: to, message: message); } /// Closes the chat dialog. @@ -74,6 +77,3 @@ class JitsiMeet { return await JitsiMeetPlatform.instance.retrieveParticipantsInfo(); } } - - - diff --git a/lib/src/jitsi_meet_conference_options.dart b/lib/src/jitsi_meet_conference_options.dart index f635355..6259c51 100644 --- a/lib/src/jitsi_meet_conference_options.dart +++ b/lib/src/jitsi_meet_conference_options.dart @@ -4,23 +4,27 @@ import 'jitsi_meet_user_info.dart'; class JitsiMeetConferenceOptions { /// Server where the conference should take place. final String? serverURL; + /// Room name. final String room; + /// JWT token used for authentication. final String? token; + /// Config overrides See: https://github.com/jitsi/jitsi-meet/blob/master/config.js. late final Map? configOverrides; + /// Feature flags. See: https://github.com/jitsi/jitsi-meet/blob/master/react/features/base/flags/constants.ts. final Map? featureFlags; + /// Information about the local user. It will be used in absence of a token. final JitsiMeetUserInfo? userInfo; - JitsiMeetConferenceOptions({ - this.serverURL, - required this.room, - this.token, - this.configOverrides, - this.featureFlags, - this.userInfo - }); -} \ No newline at end of file + JitsiMeetConferenceOptions( + {this.serverURL, + required this.room, + this.token, + this.configOverrides, + this.featureFlags, + this.userInfo}); +} diff --git a/lib/src/jitsi_meet_event_listener.dart b/lib/src/jitsi_meet_event_listener.dart index 736d562..e4d049e 100644 --- a/lib/src/jitsi_meet_event_listener.dart +++ b/lib/src/jitsi_meet_event_listener.dart @@ -1,89 +1,92 @@ class JitsiMeetEventListener { /// Called when a conference was joined. - /// + /// /// [url] : the conference URL final Function(String url)? conferenceJoined; /// Called when the active conference ends, be it because of user choice or because of a failure. - /// + /// /// [url] : the conference URL /// [error] : missing if the conference finished gracefully, otherwise contains the error message final Function(String url, Object? error)? conferenceTerminated; /// Called before a conference is joined. - /// + /// /// [url] : the conference URL final Function(String url)? conferenceWillJoin; /// Called when a participant has joined the conference. - /// + /// /// [email] : the email of the participant. It may not be set if the remote participant didn't set one. /// [name] : the name of the participant. /// [role] : the role of the participant. /// [participantId] : the id of the participant. - final Function(String? email, String? name, String? role, String? participantId)? participantJoined; + final Function( + String? email, String? name, String? role, String? participantId)? + participantJoined; /// Called when a participant has left the conference. - /// + /// /// [participantId] : the id of the participant that left. final Function(String? participantId)? participantLeft; /// Called when the local participant's audio is muted or unmuted. - /// + /// /// [muted] : a boolean indicating whether the audio is muted or not. final Function(bool muted)? audioMutedChanged; /// Called when the local participant's video is muted or unmuted. - /// + /// /// [muted] : a boolean indicating whether the video is muted or not. final Function(bool muted)? videoMutedChanged; /// Called when an endpoint text message is received. - /// + /// /// [senderId] : the id of the participant that sent the message. /// [message] : the content of the message. final Function(String senderId, String message)? endpointTextMessageReceived; /// Called when a participant starts or stops sharing his screen. - /// + /// /// [participantId] : the id of the participant /// [sharing] : the state of screen share final Function(String participantId, bool sharing)? screenShareToggled; /// Called when a chat text message is received. - /// + /// /// [senderId] : the id of the participant that sent the message. /// [message] : the content of the message. /// [isPrivate] : `true` if the message is private, `false` otherwise. /// [timestamp] : the (optional) timestamp of the message. - final Function(String senderId, String message, bool isPrivate, String? timestamp)? chatMessageReceived; + final Function( + String senderId, String message, bool isPrivate, String? timestamp)? + chatMessageReceived; /// Called when the chat dialog is opened or closed. - /// + /// /// [isOpen] : `true` if the chat dialog is open, `false` otherwise. final Function(bool isOpen)? chatToggled; /// Called when `retrieveParticipantsInfo` action is called. - /// + /// /// [participantsInfo] : a list of participants information as a string. final Function(String participantsInfo)? participantsInfoRetrieved; /// Called when the SDK is ready to be closed. No meeting is happening at this point. final Function()? readyToClose; - JitsiMeetEventListener({ - this.conferenceJoined, - this.conferenceTerminated, - this.conferenceWillJoin, - this.participantJoined, - this.participantLeft, - this.audioMutedChanged, - this.videoMutedChanged, - this.endpointTextMessageReceived, - this.screenShareToggled, - this.participantsInfoRetrieved, - this.chatMessageReceived, - this.chatToggled, - this.readyToClose - }); + JitsiMeetEventListener( + {this.conferenceJoined, + this.conferenceTerminated, + this.conferenceWillJoin, + this.participantJoined, + this.participantLeft, + this.audioMutedChanged, + this.videoMutedChanged, + this.endpointTextMessageReceived, + this.screenShareToggled, + this.participantsInfoRetrieved, + this.chatMessageReceived, + this.chatToggled, + this.readyToClose}); } diff --git a/lib/src/jitsi_meet_method_channel.dart b/lib/src/jitsi_meet_method_channel.dart index 545751d..4a22f5f 100644 --- a/lib/src/jitsi_meet_method_channel.dart +++ b/lib/src/jitsi_meet_method_channel.dart @@ -21,14 +21,16 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { @override Future getPlatformVersion() async { - final version = await methodChannel.invokeMethod('getPlatformVersion'); + final version = + await methodChannel.invokeMethod('getPlatformVersion'); return version; } - /// Joins a meeting with the given meeting [options] and + /// Joins a meeting with the given meeting [options] and /// optionally a [listener] is given for listening to events triggered by the native sdks. @override - Future join(JitsiMeetConferenceOptions options, JitsiMeetEventListener? listener) async { + Future join(JitsiMeetConferenceOptions options, + JitsiMeetEventListener? listener) async { _listener = listener; if (!_eventChannelIsInitialized) { _initialize(); @@ -59,12 +61,10 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { }); } - /// The localParticipant leaves the current meeting. + /// The localParticipant leaves the current meeting. @override Future hangUp() async { - return await methodChannel - .invokeMethod('hangUp') - .then((message) { + return await methodChannel.invokeMethod('hangUp').then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -78,9 +78,8 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { /// Sets the state of the localParticipant audio [muted] according to the muted parameter. @override Future setAudioMuted(bool muted) async { - return await methodChannel - .invokeMethod('setAudioMuted', {'muted': muted}) - .then((message) { + return await methodChannel.invokeMethod( + 'setAudioMuted', {'muted': muted}).then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -94,9 +93,8 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { /// Sets the state of the localParticipant video [muted] according to the muted parameter. @override Future setVideoMuted(bool muted) async { - return await methodChannel - .invokeMethod('setVideoMuted', {'muted': muted}) - .then((message) { + return await methodChannel.invokeMethod( + 'setVideoMuted', {'muted': muted}).then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -107,17 +105,16 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { }); } - /// Sends a message via the data channel [to] one particular participant or to all of them. + /// Sends a message via the data channel [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. @override - Future sendEndpointTextMessage({String? to, required String message}) async { - return await methodChannel.invokeMethod('sendEndpointTextMessage', { - 'to': to ?? '', - 'message': message - }).then((message) { + Future sendEndpointTextMessage( + {String? to, required String message}) async { + return await methodChannel.invokeMethod('sendEndpointTextMessage', + {'to': to ?? '', 'message': message}).then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -131,9 +128,8 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { /// Sets the state of the localParticipant screen sharing according to the [enabled] parameter. @override Future toggleScreenShare(bool enabled) async { - return await methodChannel.invokeMethod('toggleScreenShare', { - 'enabled': enabled - }).then((message) { + return await methodChannel.invokeMethod( + 'toggleScreenShare', {'enabled': enabled}).then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -144,7 +140,7 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { }); } - /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that + /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that /// particular participant will be opened. @override Future openChat([String? to]) async { @@ -161,17 +157,16 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { }); } - /// Sends a chat message via [to] one particular participant or to all of them. + /// Sends a chat message via [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. @override - Future sendChatMessage({String? to, required String message}) async { - return await methodChannel.invokeMethod('sendChatMessage', { - 'to': to ?? '', - 'message': message - }).then((message) { + Future sendChatMessage( + {String? to, required String message}) async { + return await methodChannel.invokeMethod('sendChatMessage', + {'to': to ?? '', 'message': message}).then((message) { return MethodResponse(isSuccess: true, message: message); }).catchError((error) { return MethodResponse( @@ -253,7 +248,8 @@ class MethodChannelJitsiMeet extends JitsiMeetPlatform { break; case "endpointTextMessageReceived": - _listener?.endpointTextMessageReceived?.call(data["senderId"], data["message"]); + _listener?.endpointTextMessageReceived + ?.call(data["senderId"], data["message"]); break; case "screenShareToggled": diff --git a/lib/src/jitsi_meet_platform_interface.dart b/lib/src/jitsi_meet_platform_interface.dart index e1ca7f5..3ef2615 100644 --- a/lib/src/jitsi_meet_platform_interface.dart +++ b/lib/src/jitsi_meet_platform_interface.dart @@ -30,9 +30,10 @@ abstract class JitsiMeetPlatform extends PlatformInterface { throw UnimplementedError('platformVersion() has not been implemented.'); } - /// Joins a meeting with the given meeting [options] and + /// Joins a meeting with the given meeting [options] and /// optionally a [listener] is given for listening to events triggered by the native sdks. - Future join(JitsiMeetConferenceOptions options, JitsiMeetEventListener? listener) { + Future join( + JitsiMeetConferenceOptions options, JitsiMeetEventListener? listener) { throw UnimplementedError('join() has not been implemented.'); } @@ -41,7 +42,7 @@ abstract class JitsiMeetPlatform extends PlatformInterface { throw UnimplementedError('hangUp() has not been implemented.'); } - /// Sets the state of the localParticipant audio [muted] according to the muted parameter. + /// Sets the state of the localParticipant audio [muted] according to the muted parameter. Future setAudioMuted(bool muted) { throw UnimplementedError('setAudioMuted() has not been implemented.'); } @@ -50,33 +51,37 @@ abstract class JitsiMeetPlatform extends PlatformInterface { Future setVideoMuted(bool muted) { throw UnimplementedError('setVideoMuted() has not been implemented.'); } - - /// Sends a message via the data channel [to] one particular participant or to all of them. + + /// Sends a message via the data channel [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. - Future sendEndpointTextMessage({String? to, required String message}) async { - throw UnimplementedError('sendEndpointTextMessage() has not been implemented.'); + Future sendEndpointTextMessage( + {String? to, required String message}) async { + throw UnimplementedError( + 'sendEndpointTextMessage() has not been implemented.'); } /// Sets the state of the localParticipant screen sharing according to the [enabled] parameter. Future toggleScreenShare(bool enabled) async { - throw UnimplementedError('sendEndpointTextMessage() has not been implemented.'); + throw UnimplementedError( + 'sendEndpointTextMessage() has not been implemented.'); } - /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that + /// Opens the chat dialog. If [to] contains a valid participantId, the private chat with that /// particular participant will be opened. Future openChat([String? to]) async { throw UnimplementedError('openChat() has not been implemented.'); } - /// Sends a chat message via [to] one particular participant or to all of them. + /// Sends a chat message via [to] one particular participant or to all of them. /// If the [to] param is empty, the [message] will be sent to all the participants in the conference. - /// - /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] + /// + /// In order to get the participantId for the [to] parameter, the [JitsiMeetEventListener.participantsJoined] /// event should be listened for, which have as a parameter the participantId and this should be stored somehow. - Future sendChatMessage({String? to, required String message}) async { + Future sendChatMessage( + {String? to, required String message}) async { throw UnimplementedError('sendChatMessage() has not been implemented.'); } @@ -88,6 +93,7 @@ abstract class JitsiMeetPlatform extends PlatformInterface { /// Sends and event that will trigger the [JitsiMeetEventListener.participantsInfoRetrieved] event /// which will contain participants information. Future retrieveParticipantsInfo() async { - throw UnimplementedError('retrieveParticipantsInfo() has not been implemented.'); + throw UnimplementedError( + 'retrieveParticipantsInfo() has not been implemented.'); } } diff --git a/lib/src/jitsi_meet_user_info.dart b/lib/src/jitsi_meet_user_info.dart index 441780e..d08ff53 100644 --- a/lib/src/jitsi_meet_user_info.dart +++ b/lib/src/jitsi_meet_user_info.dart @@ -10,4 +10,4 @@ class JitsiMeetUserInfo { final String? avatar; JitsiMeetUserInfo({this.displayName, this.email, this.avatar}); -} \ No newline at end of file +} diff --git a/lib/src/method_response.dart b/lib/src/method_response.dart index 1b1aa54..9d9426b 100644 --- a/lib/src/method_response.dart +++ b/lib/src/method_response.dart @@ -1,4 +1,4 @@ -class MethodResponse{ +class MethodResponse { final bool isSuccess; final String? message; final dynamic error; @@ -14,4 +14,4 @@ class MethodResponse{ return 'MethodResponse{isSuccess: $isSuccess, ' 'message: $message, error: $error}'; } -} \ No newline at end of file +} diff --git a/test/jitsi_meet_method_channel_test.dart b/test/jitsi_meet_method_channel_test.dart index 98c11b7..462c658 100644 --- a/test/jitsi_meet_method_channel_test.dart +++ b/test/jitsi_meet_method_channel_test.dart @@ -9,7 +9,8 @@ void main() { const MethodChannel channel = MethodChannel('jitsi_meet_flutter_sdk'); setUp(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler( + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler( channel, (MethodCall methodCall) async { return '42'; @@ -18,7 +19,8 @@ void main() { }); tearDown(() { - TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null); + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger + .setMockMethodCallHandler(channel, null); }); test('getPlatformVersion', () async { diff --git a/test/jitsi_meet_test.dart b/test/jitsi_meet_test.dart index 9ba8e7e..5873ecc 100644 --- a/test/jitsi_meet_test.dart +++ b/test/jitsi_meet_test.dart @@ -10,12 +10,12 @@ import 'package:plugin_platform_interface/plugin_platform_interface.dart'; class MockJitsiMeetPlatform with MockPlatformInterfaceMixin implements JitsiMeetPlatform { - @override Future getPlatformVersion() => Future.value('42'); @override - Future join(JitsiMeetConferenceOptions options, JitsiMeetEventListener? listener) { + Future join( + JitsiMeetConferenceOptions options, JitsiMeetEventListener? listener) { // TODO: implement join throw UnimplementedError(); } @@ -39,7 +39,8 @@ class MockJitsiMeetPlatform } @override - Future sendEndpointTextMessage({String? to, required String message}) { + Future sendEndpointTextMessage( + {String? to, required String message}) { // TODO: implement sendEndpointTextMessage throw UnimplementedError(); } @@ -57,7 +58,8 @@ class MockJitsiMeetPlatform } @override - Future sendChatMessage({String? to, required String message}) { + Future sendChatMessage( + {String? to, required String message}) { // TODO: implement sendChatMessage throw UnimplementedError(); }