queryRecentCalls method
Future<void>
queryRecentCalls(
- TUICallRecentCallsFilter filter,
- TUIValueCallback callback
override
Implementation
@override
Future<void> queryRecentCalls(TUICallRecentCallsFilter filter, TUIValueCallback callback) async {
try {
if (!kIsWeb && (Platform.isIOS || Platform.isAndroid)) {
var result = await methodChannel.invokeMethod(
"queryRecentCalls", {'filter': filter.toJson()});
List<TUICallRecords> callRecords = [];
final recordList = List<dynamic>.from(result);
for (var recordMap in recordList) {
TUICallRecords record = TUICallRecords();
record.callId = recordMap['callId'];
record.inviter = recordMap['inviter'];
record.inviteList = List<String>.from(recordMap['inviteList']);
record.scene = TUICallScene.values[recordMap['scene']];
record.mediaType = TUICallMediaType.values[recordMap['mediaType']];
record.groupId = recordMap['groupId'];
record.role = TUICallRole.values[recordMap['role']];
record.result = TUICallResultType.values[recordMap['result']];
record.beginTime = recordMap['beginTime'];
record.totalTime = recordMap['totalTime'];
callRecords.add(record);
}
callback.onSuccess!(result);
} else {
callback.onError!(-1, 'This platform is not supported');
}
} on PlatformException catch (error) {
callback.onError!(int.fromEnvironment(error.code), error.message!);
} on Exception catch (error) {
callback.onError!(-1, error.toString());
}
}