diff --git a/src/doc/FixDataService.ts b/src/doc/FixDataService.ts index 35ec81d..b43077b 100644 --- a/src/doc/FixDataService.ts +++ b/src/doc/FixDataService.ts @@ -14,7 +14,7 @@ export class FixDataService { this.fixDataState = { creationDate, key } } - public handleRemoteTitleState(newState: FixDataState): void { + public handleRemoteFixDataState(newState: FixDataState): void { if (!newState.creationDate) { return } diff --git a/src/doc/MetaDataService.ts b/src/doc/MetaDataService.ts index 4cf8723..8861276 100644 --- a/src/doc/MetaDataService.ts +++ b/src/doc/MetaDataService.ts @@ -43,8 +43,8 @@ export class MetaDataService implements Disposable { this.msgToSendToSubject = new Subject() } - initTitle(title: string) { - this.titleService.initTitle(title) + initTitle(title: string, titleLastModification: number) { + this.titleService.initTitle(title, titleLastModification) } initFixMetaData(creationDate: Date, key: string) { @@ -71,7 +71,7 @@ export class MetaDataService implements Disposable { break case MetaDataType.FixData: data.creationDate = new Date(data.creationDate) - this.fixDataService.handleRemoteTitleState(data) + this.fixDataService.handleRemoteFixDataState(data) this.remoteChangeSubject.next({ type: MetaDataType.FixData, data: this.fixDataService.state, @@ -87,7 +87,10 @@ export class MetaDataService implements Disposable { source.pipe(takeUntil(this.disposeSubject)).subscribe((metadata: MetaDataMessage) => { switch (metadata.type) { case MetaDataType.Title: - this.titleService.handleLocalTitleState(metadata.data) + this.titleService.handleLocalTitleState( + metadata.data.title, + metadata.data.titleLastModification + ) this.emitMetaData(MetaDataType.Title, JSON.stringify(this.titleService.asObject)) break case MetaDataType.FixData: diff --git a/src/doc/TitleService.ts b/src/doc/TitleService.ts index ce3b1bd..e5eb556 100644 --- a/src/doc/TitleService.ts +++ b/src/doc/TitleService.ts @@ -14,8 +14,8 @@ export class TitleService { this.titleState = this.register.state() } - public handleLocalTitleState(newTitle: string): void { - this.titleState = this.register.write(Date.now(), newTitle) + public handleLocalTitleState(newTitle: string, newCount: number): void { + this.titleState = this.register.write(newCount, newTitle) } public handleRemoteTitleState(newState: TitleState): void { @@ -23,7 +23,8 @@ export class TitleService { this.titleState = this.register.state() } - public initTitle(init: string): void { + public initTitle(init: string, timestamp: number): void { + this.titleState[0] = timestamp this.titleState[1] = init }