-
Notifications
You must be signed in to change notification settings - Fork 7
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
Channel's subscriptions to onMessageAdded and onMessageDeleted not called on iOS #31
Comments
Should be solved in a 2.0.1 quickfix, closing |
Hello @asmodeoux It's not completely fixed yet. Now it's being called sometimes and others no, same code, same circumstances, so I can't know why sometimes the listeners are being called and others not. Thanks in advance for your review |
@hugomc92, you can try to add this and listen for the channel to be synchronized on IOS /// Listen to Twilio client synchronization events
client.onClientSynchronization?.listen((status) {
if (_isSynced(status)) {
/// subscribe to channel.onMessageAdded and channel.onMessageDeleted
}
}
bool _isSynced(ChatClientSynchronizationStatus status) {
return status == ChatClientSynchronizationStatus.CONVERSATIONS_COMPLETED ||
(status == ChatClientSynchronizationStatus.COMPLETED && client.channelsInitialized());
} |
Hello @martintrollip I'm going to give it a try and I'll subscribe to the listeners after the client synchronization are completed. However, the Thanks in advance for your answer! EDIT: I've tried with this function to ensure the client is initialized:
But when I print the |
For the client?.channels != null From the example code, it looks like Android and IOS handles initialization slightly differently, See the example in store.state.chatClient?.onClientSynchronization?.listen((event) async {
// in Android there is a separate event to identify when fully initialized
// in iOS we do check manually
if (event == ChatClientSynchronizationStatus.CONVERSATIONS_COMPLETED ||
(event == ChatClientSynchronizationStatus.COMPLETED &&
store.state.chatClient?.channels != null)) {
....
} |
Hello @martintrollip Thanks for your reply. I was actually checking the channels was not null before subscribing. Anyways I tried your full solution and the problem still persists. There’re sometimes the listeners are being fired and other not on iOS. On Android it works perfect. Thanks for your replies |
Hi @hugomc92, We only used this during initialisation:
Any other checks and listeners on channels / messages will only happen once the client sent the synchronisation status. Other than this I'm not sure how to reproduce the issue for further investigations |
Any update to this bug? i have issue with the LAST_CONSUMED_MESSAGE_INDEX either from channel or member update. The logs are shown from console but my listener callback isn't called. But on the onMessageAdded it is working fine. ` twilioSub.add(client!.onChannelUpdated!.listen((channelUpdate) {
|
It's working fine on Android but on Android it doesn't call the flutter implementation when listen to them
Version 1.1.7+9
Example:
The text was updated successfully, but these errors were encountered: