@@ -167,7 +167,6 @@ export default class Plugin {
167167 rhsId ?: string
168168 boardSelectorId ?: string
169169 registry ?: PluginRegistry
170- activityFunc ?: ( ) => void
171170
172171 // eslint-disable-next-line @typescript-eslint/no-unused-vars, @typescript-eslint/no-empty-function
173172 async initialize ( registry : PluginRegistry , mmStore : Store < GlobalState , Action < Record < string , unknown > > > ) : Promise < void > {
@@ -231,8 +230,6 @@ export default class Plugin {
231230 } )
232231 }
233232
234- this . userActivityWatch ( )
235-
236233 let lastViewedChannel = mmStore . getState ( ) . entities . channels . currentChannelId
237234 let prevTeamID : string
238235
@@ -394,36 +391,6 @@ export default class Plugin {
394391 }
395392 }
396393
397- userActivityWatch ( ) : void {
398- let lastActivityTime = Number . MAX_SAFE_INTEGER
399- const activityTimeout = 60 * 60 * 1000 // 1 hour
400-
401- this . activityFunc = ( ) => {
402- const now = new Date ( ) . getTime ( )
403- if ( now - lastActivityTime > activityTimeout ) {
404- this . notifyConnect ( )
405- }
406- lastActivityTime = now
407- }
408- document . addEventListener ( 'click' , this . activityFunc )
409- }
410-
411- async notifyConnect ( ) : Promise < void > {
412- try {
413- const response = await fetch ( `${ windowAny . baseURL } /api/v1/keepalive` , {
414- method : 'GET' ,
415- headers : {
416- 'X-Timezone-Offset' : ( - new Date ( ) . getTimezoneOffset ( ) / 60 ) . toString ( ) ,
417- } ,
418- } )
419- if ( ! response . ok ) {
420- Utils . logError ( `Keep-alive request failed: ${ response . status } ` )
421- }
422- } catch ( error ) {
423- Utils . logError ( `Keep-alive request error: ${ error } ` )
424- }
425- }
426-
427394 uninitialize ( ) : void {
428395 if ( this . channelHeaderButtonId ) {
429396 this . registry ?. unregisterComponent ( this . channelHeaderButtonId )
@@ -435,11 +402,6 @@ export default class Plugin {
435402 this . registry ?. unregisterComponent ( this . boardSelectorId )
436403 }
437404
438- // Clean up activity watch
439- if ( this . activityFunc ) {
440- document . removeEventListener ( 'click' , this . activityFunc )
441- }
442-
443405 // unregister websocket handlers
444406 this . registry ?. unregisterWebSocketEventHandler ( wsClient . clientPrefix + ACTION_UPDATE_BLOCK )
445407 }
0 commit comments