feat: add custom notification title and message for VoIP calls (also stopCallService method)
This commit is contained in:
parent
f722fc0e5f
commit
ab5df9fd28
7 changed files with 106 additions and 26 deletions
|
|
@ -46,11 +46,25 @@ class LiblinphoneFlutter {
|
|||
Future<bool> unregister() async =>
|
||||
LiblinphoneFlutterPlatform.instance.unregister();
|
||||
|
||||
Future<bool> makeCall(String callTo, bool isVideoEnabled) async =>
|
||||
LiblinphoneFlutterPlatform.instance.makeCall(callTo, isVideoEnabled);
|
||||
Future<bool> makeCall(
|
||||
String callTo,
|
||||
bool isVideoEnabled,
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) async => LiblinphoneFlutterPlatform.instance.makeCall(
|
||||
callTo,
|
||||
isVideoEnabled,
|
||||
notificationTitle,
|
||||
notificationMessage,
|
||||
);
|
||||
|
||||
Future<bool> answerCall() async =>
|
||||
LiblinphoneFlutterPlatform.instance.answerCall();
|
||||
Future<bool> answerCall(
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) async => LiblinphoneFlutterPlatform.instance.answerCall(
|
||||
notificationTitle,
|
||||
notificationMessage,
|
||||
);
|
||||
|
||||
Future<bool> hangupCall() async =>
|
||||
LiblinphoneFlutterPlatform.instance.hangupCall();
|
||||
|
|
@ -73,4 +87,7 @@ class LiblinphoneFlutter {
|
|||
|
||||
Future<bool> sendDtmf(String tone) async =>
|
||||
LiblinphoneFlutterPlatform.instance.sendDtmf(tone);
|
||||
|
||||
Future<bool> stopCallService(String tone) async =>
|
||||
LiblinphoneFlutterPlatform.instance.stopCallService();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,16 +42,31 @@ class MethodChannelLiblinphoneFlutter extends LiblinphoneFlutterPlatform {
|
|||
}
|
||||
|
||||
@override
|
||||
Future<bool> makeCall(String callTo, bool isVideoEnabled) async {
|
||||
return (await methodChannel.invokeMethod<bool>(
|
||||
'makeCall',
|
||||
<String, dynamic>{'callTo': callTo, 'isVideoEnabled': isVideoEnabled},
|
||||
))!;
|
||||
Future<bool> makeCall(
|
||||
String callTo,
|
||||
bool isVideoEnabled,
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) async {
|
||||
return (await methodChannel
|
||||
.invokeMethod<bool>('makeCall', <String, dynamic>{
|
||||
'callTo': callTo,
|
||||
'isVideoEnabled': isVideoEnabled,
|
||||
'notificationTitle': notificationTitle,
|
||||
'notificationMessage': notificationMessage,
|
||||
}))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> answerCall() async {
|
||||
return (await methodChannel.invokeMethod<bool>('answerCall'))!;
|
||||
Future<bool> answerCall(
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) async {
|
||||
return (await methodChannel
|
||||
.invokeMethod<bool>('answerCall', <String, dynamic>{
|
||||
'notificationTitle': notificationTitle,
|
||||
'notificationMessage': notificationMessage,
|
||||
}))!;
|
||||
}
|
||||
|
||||
@override
|
||||
|
|
@ -92,8 +107,14 @@ class MethodChannelLiblinphoneFlutter extends LiblinphoneFlutterPlatform {
|
|||
|
||||
@override
|
||||
Future<bool> sendDtmf(String tone) async {
|
||||
return (await methodChannel.invokeMethod<bool>('sendDtmf', <String, dynamic>{
|
||||
'tone': tone,
|
||||
}))!;
|
||||
return (await methodChannel.invokeMethod<bool>(
|
||||
'sendDtmf',
|
||||
<String, dynamic>{'tone': tone},
|
||||
))!;
|
||||
}
|
||||
|
||||
@override
|
||||
Future<bool> stopCallService() async {
|
||||
return (await methodChannel.invokeMethod<bool>('stopCallService'))!;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,11 +46,19 @@ abstract class LiblinphoneFlutterPlatform extends PlatformInterface {
|
|||
throw UnimplementedError('unregister() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<bool> makeCall(String callTo, bool isVideoEnabled) {
|
||||
Future<bool> makeCall(
|
||||
String callTo,
|
||||
bool isVideoEnabled,
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) {
|
||||
throw UnimplementedError('makeCall() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<bool> answerCall() {
|
||||
Future<bool> answerCall(
|
||||
String notificationTitle,
|
||||
String notificationMessage,
|
||||
) {
|
||||
throw UnimplementedError('answerCall() has not been implemented.');
|
||||
}
|
||||
|
||||
|
|
@ -85,4 +93,8 @@ abstract class LiblinphoneFlutterPlatform extends PlatformInterface {
|
|||
Future<bool> sendDtmf(String tone) {
|
||||
throw UnimplementedError('sendDtmf() has not been implemented.');
|
||||
}
|
||||
|
||||
Future<bool> stopCallService() async {
|
||||
throw UnimplementedError('stopCallService() has not been implemented.');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue