showNexusIncomingCall function
Show the native incoming-call UI directly from a voice push payload.
Only needed on Android, where the incoming-call push is an FCM data message the SDK handles in a background Dart isolate. On iOS the ring is raised natively from the APNs VoIP (PushKit) payload before Dart is involved at all, so nothing here runs on that path.
The SDK wires its own FCM background handler, so apps do not normally call this; it stays public for apps that own their FCM handler end to end.
Implementation
Future<void> showNexusIncomingCall(Map<dynamic, dynamic> data) async {
final id = (data['sessionId'] ?? data['session_id'] ?? '') as String? ?? '';
if (id.isEmpty) return;
final from = (data['from'] ?? data['callerNumber'] ?? '') as String? ?? '';
final name = data['callerName'] as String?;
final avatar = (data['callerAvatar'] ?? data['avatarUrl']) as String?;
try {
await NexusPlatform.instance
.voiceReportIncoming(callId: id, from: from, displayName: name, avatarUrl: avatar);
} catch (e) {
// Background isolate — NexusLog isn't configured here; keep a minimal
// failure breadcrumb (visible in logcat as I/flutter) for field debugging.
// ignore: avoid_print
print('[NexusVoice] voiceReportIncoming failed: $e');
NexusLog.warn('voice: native incoming ring failed: $e');
}
}