chat-sdk / chat-sdk-ios

Chat SDK iOS - Open Source Mobile Messenger
http://sdk.chat
Other
913 stars 276 forks source link

Chat Thread List Not getting loaded properly after login #474

Open chintanMaisuriya opened 3 years ago

chintanMaisuriya commented 3 years ago

Hello, I have noticed this behavior that after login the app would fetch all the chat threads with the setting "config.showEmptyChats = true". Now I don't want to show empty threads to the users, so, if I set that setting to "config.showEmptyChats = false" and do login into the app then the thread list will be empty. The list will only visible if I change the tab and back to the threads tab. Can you guys please look into this

  1. Is the bug present in the demo Chat SDK project?

    • Yes
  2. What modifications have you made to the Chat SDK?

    • No
  3. iOS Version? Device or simulator?

    • iOS 14.4, Simulator - iPhone 12
  4. Steps taken to reproduce the problem:

    • Set "config.showEmptyChats = false" in the BConfiguration
    • Logout from the app and delete the app
    • Install the app again
    • Login with the same user
    • Oops! List not visible unless and until I changed the tab and back to the same tab
  5. Expected result:

    • List should be visible without empty threads directly when the user visits the view controller initially. A user don't have to visit the view controller again to get the threads list.

I'm getting this result with the security rules as follows:

{ "rules": { ".read": true, ".write": true } }

If I set the securoty rules from the "https://github.com/chat-sdk/chat-sdk-firebase/blob/master/database.rules.json" link then I got the log printed as follows:

ReconnectingView: bConnectionStatus(rawValue: 0) last nil 2021-05-06 10:02:49.055515+0530 ChatSDKSwift[13738:101772] Connected 2021-05-06 10:02:49.344162+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038012] Listener at /Development/V1/users/XUBKlDQbgvN957cLugrYMBkSbou2/threads failed: permission_denied 2021-05-06 10:02:49.344528+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038012] Listener at /Development/V1/public-threads failed: permission_denied 2021-05-06 10:02:49.348766+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038012] Listener at /Development/V1/users/XUBKlDQbgvN957cLugrYMBkSbou2/contacts failed: permission_denied 2021-05-06 10:02:49.349085+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038008] onDisconnectSetValue: or onDisconnectRemoveValue: at /Development/V1/users/XUBKlDQbgvN957cLugrYMBkSbou2/online failed: permission_denied 2021-05-06 10:02:49.349319+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038012] Listener at /Development/V1/flagged/messages failed: permission_denied 2021-05-06 10:02:49.349689+0530 ChatSDKSwift[13738:102684] 7.10.0 - [Firebase/Database][I-RDB038012] setValue: or removeValue: at /Development/V1/users/XUBKlDQbgvN957cLugrYMBkSbou2/online failed: permission_denied


Thanks.