issue: ENG-9403
I considered using threadWatcher, but it seems like it has a different purpose:
Overall threadWatcher represents threads that are bing watched by the user. For thick sidebars we want to always receive all updates.
More datailed explanation:
threadWatcher is currently only used in the context of keyservers. It is used to listen for chat updates when the user is either
- viewing a chat they are not a member of (this is not possible in thick threads, other than sidebars. But for sidebars with this code we will be getting all updates anyway)
- viewing a list of sidebars / subchannels of a chat they are not a mamber of (this is not possible in thick threads)
- viewing settings of a chat they are not a member of (this is not possible in thick threads)
Then, keyserver specific actions, keyserver specific selector, and this reducer use the ids from thread watcher.
We definitely should return something from this lambda since otherwise it is useless to assign it to variable.
If we find that we don't have permissions then just calling await this.requestAndroidNotificationsPermission(); would result in a prompt asking for notifications permissions. However if the user grants those permissions then hasPermissions is still falsy (since promise returned nothing), so deviceToken will be set to null. Nevertheless permissions are actually granted byt the OS, so the state on the device and keyserver would heal itself on next render.
This differential fixes this case so that if user grants permissions correct state is achieved immediately without need for additional re-render to heal the state.