Skip to content

Instantly share code, notes, and snippets.

@Ayush783
Last active March 8, 2024 05:05
Show Gist options
  • Save Ayush783/66a091de7b4e34bd69fbbf46032bd4fd to your computer and use it in GitHub Desktop.
Save Ayush783/66a091de7b4e34bd69fbbf46032bd4fd to your computer and use it in GitHub Desktop.
updated calling kit service
class CallingKitService {
static final CallingKitService _instance = CallingKitService._internal();
factory CallingKitService() {
return _instance;
}
CallingKitService._internal() {
MethodChannel('YOUR_CHANNEL_NAME').setMethodCallHandler(
(call) async {
if (call.method == 'CALL_ACCEPTED_INTENT') {
final data = call.arguments;
if (data != null) {
_completer.complete(data);
} else {
_completer.completeError('No data found');
}
}
},
);
}
Completer<Map> _completer = Completer();
Future<Map> getAppLaunchedData() async {
try {
return await _completer.future;
} catch (e) {
log('$_logName Either data is empty or No call received in killed state: ${e.toString()}');
return {};
}
}
static void showCallkitIncoming(...) async {
...
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment