From a9d503427e1b38472c7799283b853543f6c9f943 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 26 Sep 2024 18:26:55 +0200 Subject: [PATCH] refactor(sdk): disable recurrent development session notifications --- packages/snack-sdk/src/DevSession.ts | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/snack-sdk/src/DevSession.ts b/packages/snack-sdk/src/DevSession.ts index 659d07a5..cf22738b 100644 --- a/packages/snack-sdk/src/DevSession.ts +++ b/packages/snack-sdk/src/DevSession.ts @@ -6,10 +6,12 @@ export default class DevSession { private apiURL: string; private logger?: Logger; private onSendBeaconCloseRequest: (request: SnackSendBeaconRequest) => any; - private notifyInterval: number = 40000; - private notifyTimer?: any; private focusedAt?: number; + // NOTE(cedric): recurrent development session alive notifications are disabled + // private notifyInterval: number = 40000; + // private notifyTimer?: any; + constructor(options: { apiURL: string; logger?: Logger; @@ -75,10 +77,11 @@ export default class DevSession { private async notify(state: SnackState, setFocus?: boolean) { const { user, online, url: onlineURL, deviceId, onlineName } = state; - if (this.notifyTimer) { - clearTimeout(this.notifyTimer); - this.notifyTimer = undefined; - } + // NOTE(cedric): recurrent development session alive notifications are disabled + // if (this.notifyTimer) { + // clearTimeout(this.notifyTimer); + // this.notifyTimer = undefined; + // } if (!online || (!user && !deviceId)) { this.focusedAt = undefined; @@ -89,9 +92,10 @@ export default class DevSession { this.focusedAt = Date.now(); } - if (!this.notifyTimer) { - this.notifyTimer = setTimeout(() => this.notify(state), this.notifyInterval); - } + // NOTE(cedric): recurrent development session alive notifications are disabled + // if (!this.notifyTimer) { + // this.notifyTimer = setTimeout(() => this.notify(state), this.notifyInterval); + // } try { const { url, ...data } = this.getRequest(false, user, deviceId);