From 7f23ec40b7dfb904c7f5597a3ed15c611eddf009 Mon Sep 17 00:00:00 2001 From: Pierre-Monier <65488471+Pierre-Monier@users.noreply.github.com> Date: Fri, 29 Jan 2021 12:44:17 +0100 Subject: [PATCH] hasDefaultPhoneAccount give feedback about the user choice (#49) * fix: change parameter handle to number , call.argument("number") was undefined in HandleMethodCall for startCall case * fix(ios): change handle to number * feat: make hasDefaultPhoneAccount return a bool to have feedback on the telecom manager request --- lib/src/api.dart | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/src/api.dart b/lib/src/api.dart index 8bdd47f..51b2222 100644 --- a/lib/src/api.dart +++ b/lib/src/api.dart @@ -53,13 +53,15 @@ class FlutterCallkeep extends EventManager { return _channel.invokeMethod('registerEvents', {}); } - Future hasDefaultPhoneAccount( + Future hasDefaultPhoneAccount( BuildContext context, Map options) async { _context = context; if (!isIOS) { - return _hasDefaultPhoneAccount(options); + return await _hasDefaultPhoneAccount(options); } - return; + + // return true on iOS because we don't want to block the endUser + return true; } Future _checkDefaultPhoneAccount() async { @@ -67,12 +69,14 @@ class FlutterCallkeep extends EventManager { .invokeMethod('checkDefaultPhoneAccount', {}); } - Future _hasDefaultPhoneAccount(Map options) async { + Future _hasDefaultPhoneAccount(Map options) async { final hasDefault = await _checkDefaultPhoneAccount(); final shouldOpenAccounts = await _alert(options, hasDefault); - if (shouldOpenAccounts == true) { + if (shouldOpenAccounts) { await _openPhoneAccounts(); + return true; } + return false; } Future displayIncomingCall(String uuid, String handle,