clearActiveCall static method

  1. @Deprecated('No longer needed: the Calls SDK clears its own session state when a call ends')
Future<void> clearActiveCall()

Clears the locally stored active call session.

Migration Note: Migrated from platform channels to native Dart implementation. Uses CallRepository for clearing active call. Behavior and signature remain identical for backward compatibility.

Android Reference: CometChat.clearActiveCall()

Implementation

@Deprecated(
    'No longer needed: the Calls SDK clears its own session state when a call ends')
static Future<void> clearActiveCall() async {
  try {
    // Drop the cached initial call alongside the active-call state so a stale
    // joinedAt cannot leak into the next session.
    _initialCall = null;

    // Get SDK instance
    final sdk = SdkRegistry.getInstance();

    // Call native Dart call repository
    await sdk.calls.clearActiveCall();
  } catch (e) {
    // Silently fail (matches original behavior)
    _errorCallbackHandler(null, null, e, null);
  }
}