Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add reconnect status events #191

Merged
merged 6 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## Next release
## 0.1.2
* Added: CallEvents:
* `Reconnected`
* `Reconnecting`

## 0.1.1

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,8 @@ The events sent are the following
- incoming // web, MacOS only
- ringing
- connected
- reconnected
- reconnecting
- callEnded
- unhold
- hold
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,7 @@ class TwilioVoicePlugin : FlutterPlugin, MethodCallHandler, EventChannel.StreamH
}

TVNativeCallEvents.EVENT_RECONNECTING -> {
logEvent("", "Reconnecting...");
logEvent("", "Reconnecting");
}

TVNativeCallEvents.EVENT_RECONNECTED -> {
Expand Down
4 changes: 2 additions & 2 deletions ios/Classes/SwiftTwilioVoicePlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -651,12 +651,12 @@ public class SwiftTwilioVoicePlugin: NSObject, FlutterPlugin, FlutterStreamHand
}

public func call(call: Call, isReconnectingWithError error: Error) {
self.sendPhoneCallEvents(description: "LOG|call:isReconnectingWithError:", isError: false)
self.sendPhoneCallEvents(description: "Reconnecting", isError: false)

}

public func callDidReconnect(call: Call) {
self.sendPhoneCallEvents(description: "LOG|callDidReconnect:", isError: false)
self.sendPhoneCallEvents(description: "Reconnected", isError: false)
}

public func callDidFailToConnect(call: Call, error: Error) {
Expand Down
4 changes: 4 additions & 0 deletions lib/_internal/method_channel/twilio_voice_method_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,8 @@ class MethodChannelTwilioVoice extends TwilioVoicePlatform {
}

return CallEvent.returningCall;
} else if (state.startsWith("Reconnecting")) {
return CallEvent.reconnecting;
}
switch (state) {
case 'Ringing':
Expand Down Expand Up @@ -397,6 +399,8 @@ class MethodChannelTwilioVoice extends TwilioVoicePlatform {
return CallEvent.bluetoothOn;
case 'Bluetooth Off':
return CallEvent.bluetoothOff;
case 'Reconnected':
return CallEvent.reconnected;
default:
if (kDebugMode) {
printDebug('$state is not a valid CallState.');
Expand Down
2 changes: 1 addition & 1 deletion lib/_internal/twilio_voice_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -985,7 +985,7 @@ class Call extends MethodChannelTwilioCall {

/// On active call reconnecting to Twilio network
void _onCallReconnecting(dynamic twilioError) {
Logger.logLocalEvent("Reconnecting...");
Logger.logLocalEvent("Reconnecting");
}

/// On active call reconnecting to Twilio network
Expand Down
2 changes: 2 additions & 0 deletions lib/models/call_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ enum CallEvent {
incoming,
ringing,
connected,
reconnected,
reconnecting,
callEnded,
unhold,
hold,
Expand Down
Loading