Skip to content

Commit

Permalink
Merge pull request #142 from edwinnyawoli/patch/active_calls_android
Browse files Browse the repository at this point in the history
MethodChannel does not support custom type Data
  • Loading branch information
hiennguyen92 authored Jul 14, 2022
2 parents 97af9e1 + 69acb38 commit d4a9948
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ class FlutterCallkitIncomingPlugin : FlutterPlugin, MethodCallHandler, ActivityA
result.success("OK")
}
"activeCalls" -> {
result.success(getDataActiveCalls(context))
result.success(getDataActiveCallsForFlutter(context))
}
"getDevicePushTokenVoIP" -> {
result.success("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ fun getDataActiveCalls(context: Context?): ArrayList<Data> {
.fromJson(json, object : TypeToken<ArrayList<Data>>() {}.type)
}

fun getDataActiveCallsForFlutter(context: Context?): ArrayList<Map<String, Any?>> {
val json = getString(context, "ACTIVE_CALLS", "[]")
return Utils.getGsonInstance().fromJson(json, object: TypeToken<ArrayList<Map<String, Any?>>>() {}.type)
}

fun putString(context: Context?, key: String, value: String?) {
if (context == null) return
Expand Down
2 changes: 1 addition & 1 deletion lib/flutter_callkit_incoming.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class FlutterCallkitIncoming {
/// Get active calls.
/// On iOS: return active calls from Callkit.
/// On Android: only return last call
static Future activeCalls() async {
static Future<dynamic> activeCalls() async {
return await _channel.invokeMethod("activeCalls");
}

Expand Down

0 comments on commit d4a9948

Please sign in to comment.