diff --git a/src/app/app.component.ts b/src/app/app.component.ts index f038e27002f..f772baf3b4a 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -29,6 +29,7 @@ import {LanguageService} from './core/language/language.service'; import {ElectronService} from './core/electron/electron.service'; import {AttachmentService} from './features/attachment/attachment.service'; import {WorkContextService} from './features/work-context/work-context.service'; +import {TagService} from './features/tag/tag.service'; @Component({ @@ -76,6 +77,7 @@ export class AppComponent implements OnDestroy { private _languageService: LanguageService, private _attachmentService: AttachmentService, private _workContextService: WorkContextService, + private _tagService: TagService, public readonly layoutService: LayoutService, public readonly bookmarkService: BookmarkService, public readonly taskService: TaskService, @@ -106,6 +108,7 @@ export class AppComponent implements OnDestroy { this._projectService.load(); this._configService.load(); this._workContextService.load(); + this._tagService.load(); // init theme and body class handlers this._globalThemeService.init(); diff --git a/src/app/core/persistence/persistence.service.ts b/src/app/core/persistence/persistence.service.ts index 59059119229..6dc23531e88 100644 --- a/src/app/core/persistence/persistence.service.ts +++ b/src/app/core/persistence/persistence.service.ts @@ -84,10 +84,10 @@ export class PersistenceService { ); // TASK_RELATED_MODELS - taskTag = this._cmProject( + taskTag = this._cmBase( LS_TASK_TAG_STATE, - 'taskTag', - tagReducer); + 'tag' + ); taskAttachment = this._cmBase( LS_TASK_ATTACHMENT_STATE, 'taskAttachment', diff --git a/src/app/features/project/store/project.effects.ts b/src/app/features/project/store/project.effects.ts index a51b235a69e..fdfd157516e 100644 --- a/src/app/features/project/store/project.effects.ts +++ b/src/app/features/project/store/project.effects.ts @@ -33,7 +33,6 @@ import {Router} from '@angular/router'; import {BannerId} from '../../../core/banner/banner.model'; import {GlobalConfigService} from '../../config/global-config.service'; import {TaskRepeatCfgService} from '../../task-repeat-cfg/task-repeat-cfg.service'; -import {TagService} from '../../tag/tag.service'; import {T} from '../../../t.const'; import {isShowFinishDayNotification} from '../util/is-show-finish-day-notification'; @@ -179,7 +178,6 @@ export class ProjectEffects { // TODO automatize this._noteService.loadStateForProject(projectId), this._bookmarkService.loadStateForProject(projectId), - this._tagService.loadStateForProject(projectId), this._taskService.loadStateForProject(projectId), this._metricService.loadStateForProject(projectId), this._improvementService.loadStateForProject(projectId), @@ -307,7 +305,6 @@ export class ProjectEffects { private _bannerService: BannerService, private _globalConfigService: GlobalConfigService, private _attachmentService: AttachmentService, - private _tagService: TagService, private _reminderService: ReminderService, private _metricService: MetricService, private _obstructionService: ObstructionService, diff --git a/src/app/features/tag/store/tag.effects.ts b/src/app/features/tag/store/tag.effects.ts index 4e67744d010..e0d74be8cc3 100644 --- a/src/app/features/tag/store/tag.effects.ts +++ b/src/app/features/tag/store/tag.effects.ts @@ -34,7 +34,7 @@ export class TagEffects { private _saveToLs([action, currentProjectId, tagState]) { if (currentProjectId) { this._persistenceService.saveLastActive(); - this._persistenceService.taskTag.save(currentProjectId, tagState); + this._persistenceService.taskTag.saveState(tagState); } else { throw new Error('No current project id'); } diff --git a/src/app/features/tag/tag-list/tag-list.component.ts b/src/app/features/tag/tag-list/tag-list.component.ts index af21bcc35de..7a42e34b480 100644 --- a/src/app/features/tag/tag-list/tag-list.component.ts +++ b/src/app/features/tag/tag-list/tag-list.component.ts @@ -34,7 +34,6 @@ export class TagListComponent implements OnInit, AfterViewInit { @ViewChild('tagListEl', {static: true}) tagListEl; - counter = 0; editingTag: undefined | Partial = undefined; private _tagIds; private _tagIds$ = new BehaviorSubject([]); diff --git a/src/app/features/tag/tag.service.ts b/src/app/features/tag/tag.service.ts index 70520015e94..9815d399f28 100644 --- a/src/app/features/tag/tag.service.ts +++ b/src/app/features/tag/tag.service.ts @@ -40,8 +40,8 @@ export class TagService { return this._store$.pipe(select(selectTagByName, {name})); } - public async loadStateForProject(projectId) { - const lsTagState = await this._persistenceService.taskTag.load(projectId) || initialTagState; + async load() { + const lsTagState = await this._persistenceService.taskTag.loadState() || initialTagState; this.loadState(lsTagState || initialTagState); } diff --git a/src/app/features/tasks/migrate-task-state.util.ts b/src/app/features/tasks/migrate-task-state.util.ts index f1f51cc11d8..ec128f9f10d 100644 --- a/src/app/features/tasks/migrate-task-state.util.ts +++ b/src/app/features/tasks/migrate-task-state.util.ts @@ -5,7 +5,7 @@ import {MODEL_VERSION_KEY, WORKLOG_DATE_STR_FORMAT} from '../../app.constants'; import * as moment from 'moment'; import {convertToWesternArabic} from '../../util/numeric-converter'; -const MODEL_VERSION = 3.1; +const MODEL_VERSION = 3.13; export const LEGACY_GITHUB_TYPE = 'GIT'; export const migrateTaskState = (taskState: TaskState): TaskState => { diff --git a/src/app/imex/sync/sync.model.ts b/src/app/imex/sync/sync.model.ts index 2a04181d8cc..5fe8b6cf569 100644 --- a/src/app/imex/sync/sync.model.ts +++ b/src/app/imex/sync/sync.model.ts @@ -20,6 +20,7 @@ export interface AppBaseData { globalConfig: GlobalConfigState; reminders?: Reminder[]; task: TaskState; + tag: TagState; taskArchive: TaskArchive; taskAttachment: AttachmentState; context: WorkContextState; @@ -30,9 +31,6 @@ export interface AppDataForProjects { note?: { [key: string]: NoteState; }; - taskTag?: { - [key: string]: TagState - }; bookmark?: { [key: string]: BookmarkState; };