fix(tracker): Option to disable string dictionary

This commit is contained in:
nick-delirium 2023-07-07 12:13:57 +02:00
parent a80bae072d
commit 779dfe9162
3 changed files with 10 additions and 3 deletions

View file

@ -1,5 +1,6 @@
# 9.0.0
- Option to disable string dictionary
- Introduced Feature flags api
- Fixed input durations recorded on programmable autofill

View file

@ -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

View file

@ -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,