File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed
ip-messaging/reachability-indicator/process-user-updates Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 11{
2- "title" : " Process a UserInfo Update " ,
3- "description" : " Process a UserInfo Update and process the Reachability Indicators" ,
2+ "title" : " Process an UpdateReason " ,
3+ "description" : " Handle an UpdateReason change and process the Reachability Indicators" ,
44 "type" : " server"
5- }
5+ }
Original file line number Diff line number Diff line change 11// function called after client init to set up event handlers
22function registerEventHandlers ( ) {
3- // Register UserInfo specific event handler
4- chatClient . on ( 'userUpdated' , handleUserUpdate ( user ) ) ;
3+ user = chatClient . user ;
4+ // Register User updated event handler
5+ user . on ( 'updated' , event => handleUserUpdate ( event . user , event . updateReasons ) ) ;
56}
67
7- // function to handle any UserInfo updates
8- function handleUserUpdate ( user ) {
9- // handle reachability indicator
10- if ( chatClient . reachabilityEnabled ) {
11- // call a function which will update the relevant UI elements to show the Reachability state for the User
12- renderUserReachability ( user . online , user . notifiable ) ;
13- }
8+ // function to handle User updates
9+ function handleUserUpdate ( user , updateReasons ) {
10+ // loop over each reason and check for reachability change
11+ updateReasons . forEach ( reason =>
12+ if ( reason == 'online' ) {
13+ //do something
14+ }
15+ )
1416}
You can’t perform that action at this time.
0 commit comments