Skip to content

Commit 772ec84

Browse files
committed
feat: add device registered check during unregister
1 parent 9dc711c commit 772ec84

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/_internal/twilio_voice_web.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,12 @@ class TwilioVoiceWeb extends MethodChannelTwilioVoice {
311311
@override
312312
Future<bool?> unregister({String? accessToken}) async {
313313
if (device == null) {
314-
return false;
314+
return true;
315+
}
316+
final state = getDeviceState(device!);
317+
if(state != DeviceState.registered) {
318+
printDebug("Device is not registered, cannot unregister");
319+
return true;
315320
}
316321
try {
317322
device?.unregister();

0 commit comments

Comments
 (0)