Skip to content

Commit

Permalink
Merge pull request #191 from cybex-dev/feat_event_reconnected
Browse files Browse the repository at this point in the history
Feat: Add reconnect status events
  • Loading branch information
cybex-dev authored Nov 7, 2023
2 parents bce5d30 + 1a3c88f commit bb002d0
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 5 deletions.
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

0 comments on commit bb002d0

Please sign in to comment.