callbundle_ios 1.0.9
callbundle_ios: ^1.0.9 copied to clipboard
iOS implementation of the CallBundle plugin using CallKit. Handles PushKit, audio session, and missed call notifications inside the plugin.
callbundle_ios #
The iOS implementation of callbundle.
Usage #
This package is endorsed — simply add callbundle to your pubspec.yaml and this package is included automatically on iOS.
dependencies:
callbundle: ^1.0.0
Architecture #
| Component | File | Responsibility |
|---|---|---|
CallBundlePlugin |
CallbundleIosPlugin.swift |
MethodChannel handler, singleton access, event dispatch |
CallKitController |
CallKitController.swift |
CXProvider + CXCallController for native call UI |
PushKitHandler |
PushKitHandler.swift |
PKPushRegistry delegate, VoIP token management |
AudioSessionManager |
AudioSessionManager.swift |
AVAudioSession with .mixWithOthers |
CallStore |
CallStore.swift |
Thread-safe call tracking + cold-start persistence |
MissedCallNotificationManager |
MissedCallNotificationManager.swift |
UNUserNotificationCenter for missed calls |
Key Features #
PushKit In-Plugin #
PushKit VoIP push is handled inside the plugin. No AppDelegate code needed.
When a VoIP push arrives:
PushKitHandlerreceives the payload viaPKPushRegistryDelegatereportNewIncomingCallis called synchronously (required by iOS — app is terminated if not)- CallKit3. CallKit native incoming call screen3. CallKit3. Ca → event delivered to Dart via MethodChannel
Required Info.plist entry:
<key>UIBackgroundModes</key>
<array>
<string>voip</string>
</array>
CallKit Integration #
Full CXProvider delegate with:
- Incoming call reporting (
reportNewIncomingCall) - Outgoing call initiation (
CXStartCallAction) - Call connected/ended state management
isUserInitiatedon every event (no_isEndingCallKitProgrammaticallyflag)
Audio Session Management #
AudioSessionManager configures AVAudioSession with .mixWithOthers:
- Prevents conflict with HMS/100ms audio sessions
- Activates on call connect, deactivates on call end
- Configures
.playAndRecordcategory with.defaultToSpeakeroption
Cold-Start Persistence #
CallStore CallStore CallStore baCallStore CallStore CallStore baCallStore CallStore CallSsyCallStore CallStore CallStore baCallStore CallStore CallStore baCallStore CallStore configure()viadeliverPendingEvents()`
Thread Safety #
All CallStore operations use a serial DispatchQueue:
private let queue = DispatchQueue(label: "com.callbundle.callstore", qos: .userInitiated)
Permission Checking #
checkPermissions: ReadsUNNotificationCenter.getNotificationSettings()without requesting-
requestPermissions: CallsUNUserNotificationCenter.requestAuthorization- **requestPermissions**: CallsUNUserNotificationCenter.requestAuPurpose CallKitNative incoming/outgoing call UI PushKitVoIP push notification delivery AVFoundationAudio session management UserNotificationsMissed call notifications
Requirements #
| Requirement | Value |
|---|---|
| iOS | 13.0+ |
| Swift | 5.0+ |
| CocoaPods | 1.10+ |