From 779dfe91626d947896dfdd28fd2762730a102dc7 Mon Sep 17 00:00:00 2001 From: nick-delirium Date: Fri, 7 Jul 2023 12:13:57 +0200 Subject: [PATCH] fix(tracker): Option to disable string dictionary --- tracker/tracker/CHANGELOG.md | 1 + tracker/tracker/src/main/app/index.ts | 4 +++- tracker/tracker/src/main/modules/attributeSender.ts | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/tracker/tracker/CHANGELOG.md b/tracker/tracker/CHANGELOG.md index 013157009..792f695d4 100644 --- a/tracker/tracker/CHANGELOG.md +++ b/tracker/tracker/CHANGELOG.md @@ -1,5 +1,6 @@ # 9.0.0 +- Option to disable string dictionary - Introduced Feature flags api - Fixed input durations recorded on programmable autofill diff --git a/tracker/tracker/src/main/app/index.ts b/tracker/tracker/src/main/app/index.ts index 8abd67c39..b4be6b283 100644 --- a/tracker/tracker/src/main/app/index.ts +++ b/tracker/tracker/src/main/app/index.ts @@ -82,6 +82,7 @@ type AppOptions = { localStorage: Storage | null sessionStorage: Storage | null forceSingleTab?: boolean + disableStringDict?: boolean // @deprecated onStart?: StartCallback @@ -144,6 +145,7 @@ export default class App { __debug_report_edp: null, localStorage: null, sessionStorage: null, + disableStringDict: false, forceSingleTab: false, }, options, @@ -164,7 +166,7 @@ export default class App { this.debug = new Logger(this.options.__debug__) this.notify = new Logger(this.options.verbose ? LogLevel.Warnings : LogLevel.Silent) this.session = new Session(this, this.options) - this.attributeSender = new AttributeSender(this) + this.attributeSender = new AttributeSender(this, Boolean(this.options.disableStringDict)) this.session.attachUpdateCallback(({ userID, metadata }) => { if (userID != null) { // TODO: nullable userID diff --git a/tracker/tracker/src/main/modules/attributeSender.ts b/tracker/tracker/src/main/modules/attributeSender.ts index 9b99a1552..562dc0600 100644 --- a/tracker/tracker/src/main/modules/attributeSender.ts +++ b/tracker/tracker/src/main/modules/attributeSender.ts @@ -1,4 +1,4 @@ -import { SetNodeAttributeDict, Type } from '../../common/messages.gen.js' +import { SetNodeAttributeDict, SetNodeAttribute, Type } from '../../common/messages.gen.js' import App from '../app/index.js' export class StringDictionary { @@ -18,9 +18,13 @@ export class StringDictionary { export default class AttributeSender { private dict = new StringDictionary() - constructor(private readonly app: App) {} + constructor(private readonly app: App, private readonly isDictDisabled: boolean) {} public sendSetAttribute(id: number, name: string, value: string) { + if (this.isDictDisabled) { + const msg: SetNodeAttribute = [Type.SetNodeAttribute, id, name, value] + this.app.send(msg) + } const message: SetNodeAttributeDict = [ Type.SetNodeAttributeDict, id,