Skip to content

Commit 7f23ec4

Browse files
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
1 parent 4aede74 commit 7f23ec4

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

lib/src/api.dart

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,26 +53,30 @@ class FlutterCallkeep extends EventManager {
5353
return _channel.invokeMethod<void>('registerEvents', <String, dynamic>{});
5454
}
5555

56-
Future<void> hasDefaultPhoneAccount(
56+
Future<bool> hasDefaultPhoneAccount(
5757
BuildContext context, Map<String, dynamic> options) async {
5858
_context = context;
5959
if (!isIOS) {
60-
return _hasDefaultPhoneAccount(options);
60+
return await _hasDefaultPhoneAccount(options);
6161
}
62-
return;
62+
63+
// return true on iOS because we don't want to block the endUser
64+
return true;
6365
}
6466

6567
Future<bool> _checkDefaultPhoneAccount() async {
6668
return await _channel
6769
.invokeMethod<bool>('checkDefaultPhoneAccount', <String, dynamic>{});
6870
}
6971

70-
Future<void> _hasDefaultPhoneAccount(Map<String, dynamic> options) async {
72+
Future<bool> _hasDefaultPhoneAccount(Map<String, dynamic> options) async {
7173
final hasDefault = await _checkDefaultPhoneAccount();
7274
final shouldOpenAccounts = await _alert(options, hasDefault);
73-
if (shouldOpenAccounts == true) {
75+
if (shouldOpenAccounts) {
7476
await _openPhoneAccounts();
77+
return true;
7578
}
79+
return false;
7680
}
7781

7882
Future<void> displayIncomingCall(String uuid, String handle,

0 commit comments

Comments
 (0)