hoxfon / react-native-twilio-programmable-voice

React Native wrapper for Twilio Programmable Voice SDK
MIT License
181 stars 152 forks source link

Fixed bug on unregistration (ios) #194

Closed ro-mgh closed 3 years ago

ro-mgh commented 3 years ago

Hi guys!

We faced with the following issue: when TwilioVoice.unregister() is called we are not able to register the device again with TwilioVoice.initWithToken().

I found out that it happens because when we try to register device again, we compare if cachedDeviceToken has changed versus actual deviceTokenString. And we are able to register PushNotifications only if our Device tokes was changed.

... (line 245 in RNTwilioVoice.m) if (![cachedDeviceToken isEqualToString:deviceTokenString]) { ...

But when we unregister the device we are not changing the cached token in memory, so when we try to register Pushes again, library compare the cashed token (which was not changed) vs actual deviceTokenString (which is still the same as well). As a result we are not able to register Push notifications.

Proposed solution: when TwilioVoice.unregister() is called, and the unregistration was successfull, we should clear the cashed device token. It allows us to register device again.

Hope you will reply soon. Roma

jdegger commented 3 years ago

Thank you for your PR(s)! We will test and review them ASAP.

jdegger commented 3 years ago

@fabriziomoscon i have fixed the indentation

fabriziomoscon commented 3 years ago

@ro-mgh is this PR applicable #164 ?

ro-mgh commented 3 years ago

Changes included to https://github.com/hoxfon/react-native-twilio-programmable-voice/pull/205 PR against sdk-5

tragicmj commented 2 years ago

@ro-mgh Unregistration not working in iOS, can you please have a look once.

ro-mgh commented 2 years ago

@tragicmj , I think that is because changes from this PR was somehow lost in the main branch, you could use patch package and implement them manually)

tragicmj commented 2 years ago

@ro-mgh thanks for your reply. Facing one issue Simulator Screen Shot - iPhone 11 - 2022-06-08 at 14 24 40 Any way to remove the black outline circle (the green background coming up on top left) after the call is disconnected by the other end in an outbound call??