File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -365,6 +365,10 @@ class Gleap {
365365 GleapSession . getInstance ( ) . useCookies = useCookies ;
366366 }
367367
368+ static disableLocalStorage ( ) {
369+ GleapSession . getInstance ( ) . localStorageDisabled = true ;
370+ }
371+
368372 /**
369373 * Indentifies the user session
370374 * @param {string } userId
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ export default class GleapSession {
2424 sdkKey = null ;
2525 updatingSession = false ;
2626 useCookies = true ;
27+ localStorageDisabled = false ;
2728 session = {
2829 gleapId : null ,
2930 gleapHash : null ,
@@ -171,10 +172,11 @@ export default class GleapSession {
171172 GleapEventManager . notifyEvent ( 'unregister-pushmessage-group' , `gleapuser-${ this . session . gleapHash } ` ) ;
172173 }
173174
175+ if ( ! this . localStorageDisabled ) {
176+ saveToGleapCache ( `session-${ this . sdkKey } ` , session ) ;
177+ }
174178 if ( this . useCookies ) {
175179 setGleapCookie ( `session-${ this . sdkKey } ` , encodeURIComponent ( JSON . stringify ( session ) ) , 365 ) ;
176- } else {
177- saveToGleapCache ( `session-${ this . sdkKey } ` , session ) ;
178180 }
179181
180182 this . session = session ;
@@ -225,7 +227,7 @@ export default class GleapSession {
225227 } catch ( exp ) { }
226228
227229 // Try to load session from local storage, if not already loaded.
228- if ( ! this . useCookies && ! ( this . session && this . session . gleapId && this . session . gleapId . length > 0 ) ) {
230+ if ( ! this . localStorageDisabled && ! ( this . session && this . session . gleapId && this . session . gleapId . length > 0 ) ) {
229231 const cachedSession = loadFromGleapCache ( `session-${ this . sdkKey } ` ) ;
230232 if ( cachedSession ) {
231233 this . validateSession ( cachedSession ) ;
You can’t perform that action at this time.
0 commit comments