From 5860422d835193a14e31ec51e6ef5cb64e52d108 Mon Sep 17 00:00:00 2001 From: Nicolas Constant Date: Mon, 20 Apr 2020 00:19:56 -0400 Subject: [PATCH] added timeline header settings --- .../settings/settings.component.html | 31 ++++++++++++++++++- .../settings/settings.component.ts | 15 ++++++++- src/app/services/tools.service.ts | 7 ++++- src/app/states/settings.state.ts | 10 ++++++ 4 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/app/components/floating-column/settings/settings.component.html b/src/app/components/floating-column/settings/settings.component.html index c4dcf825..039ab411 100644 --- a/src/app/components/floating-column/settings/settings.component.html +++ b/src/app/components/floating-column/settings/settings.component.html @@ -97,6 +97,35 @@

Timelines

+ header display:
+ + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + this settings needs a reload to be effective. + loading behavior:
-
+

About

diff --git a/src/app/components/floating-column/settings/settings.component.ts b/src/app/components/floating-column/settings/settings.component.ts index c3caa4ad..b8aacd77 100644 --- a/src/app/components/floating-column/settings/settings.component.ts +++ b/src/app/components/floating-column/settings/settings.component.ts @@ -6,7 +6,7 @@ import { environment } from '../../../../environments/environment'; import { ToolsService } from '../../../services/tools.service'; import { UserNotificationService, NotificationSoundDefinition } from '../../../services/user-notification.service'; import { ServiceWorkerService } from '../../../services/service-worker.service'; -import { ContentWarningPolicy, ContentWarningPolicyEnum, TimeLineModeEnum } from '../../../states/settings.state'; +import { ContentWarningPolicy, ContentWarningPolicyEnum, TimeLineModeEnum, TimeLineHeaderEnum } from '../../../states/settings.state'; @Component({ selector: 'app-settings', @@ -29,6 +29,9 @@ export class SettingsComponent implements OnInit { columnShortcutEnabled: ColumnShortcut = ColumnShortcut.Ctrl; columnShortcutChanged = false; + timeLineHeader: TimeLineHeaderEnum = TimeLineHeaderEnum.Title_DomainName; + timeLineHeaderChanged = false; + timeLineMode: TimeLineModeEnum = TimeLineModeEnum.OnTop; timeLineModeChanged = false; @@ -95,6 +98,7 @@ export class SettingsComponent implements OnInit { this.removeCwOnContent = settings.contentWarningPolicy.removeCwOnContent.join(';'); this.contentHidedCompletely = settings.contentWarningPolicy.hideCompletlyContent.join(';'); + this.timeLineHeader = settings.timelineHeader; this.timeLineMode = settings.timelineMode; } @@ -107,6 +111,15 @@ export class SettingsComponent implements OnInit { this.toolsService.saveSettings(settings); } + onTimeLineHeaderChange(id: TimeLineHeaderEnum){ + this.timeLineHeader = id; + this.timeLineHeaderChanged = true; + + let settings = this.toolsService.getSettings(); + settings.timelineHeader = id; + this.toolsService.saveSettings(settings); + } + onTimeLineModeChange(id: TimeLineModeEnum){ this.timeLineMode = id; this.timeLineModeChanged = true; diff --git a/src/app/services/tools.service.ts b/src/app/services/tools.service.ts index 38095258..c9da9260 100644 --- a/src/app/services/tools.service.ts +++ b/src/app/services/tools.service.ts @@ -5,7 +5,7 @@ import { AccountInfo } from '../states/accounts.state'; import { MastodonWrapperService } from './mastodon-wrapper.service'; import { Account, Results, Status, Emoji } from "./models/mastodon.interfaces"; import { StatusWrapper } from '../models/common.model'; -import { AccountSettings, SaveAccountSettings, GlobalSettings, SaveSettings, ContentWarningPolicy, SaveContentWarningPolicy, ContentWarningPolicyEnum, TimeLineModeEnum } from '../states/settings.state'; +import { AccountSettings, SaveAccountSettings, GlobalSettings, SaveSettings, ContentWarningPolicy, SaveContentWarningPolicy, ContentWarningPolicyEnum, TimeLineModeEnum, TimeLineHeaderEnum } from '../states/settings.state'; import { AppInfo, RegisteredAppsStateModel } from '../states/registered-apps.state'; @Injectable({ @@ -160,6 +160,11 @@ export class ToolsService { this.saveSettings(settings); } + if(!settings.timelineHeader){ + settings.timelineHeader = TimeLineHeaderEnum.Title_DomainName; + this.saveSettings(settings); + } + return settings; } diff --git a/src/app/states/settings.state.ts b/src/app/states/settings.state.ts index 2fbd7ebb..3b71a199 100644 --- a/src/app/states/settings.state.ts +++ b/src/app/states/settings.state.ts @@ -46,6 +46,14 @@ export enum TimeLineModeEnum { SlowMode = 3 } +export enum TimeLineHeaderEnum { + Title_DomainName = 1, + Title_Username_DomainName = 2, + Title_AccountIcon_DomainName = 3, + Title_AccountIcon = 4, + Title = 5 +} + export class ContentWarningPolicy { policy: ContentWarningPolicyEnum = ContentWarningPolicyEnum.None; addCwOnContent: string[] = []; @@ -61,6 +69,7 @@ export class GlobalSettings { notificationSoundFileId: string = '0'; + timelineHeader: TimeLineHeaderEnum = TimeLineHeaderEnum.Title_DomainName; timelineMode: TimeLineModeEnum = TimeLineModeEnum.OnTop; contentWarningPolicy: ContentWarningPolicy = new ContentWarningPolicy(); @@ -153,6 +162,7 @@ export class SettingsState { newSettings.notificationSoundFileId = oldSettings.notificationSoundFileId; newSettings.columnSwitchingWinAlt = oldSettings.columnSwitchingWinAlt; newSettings.disableRemoteStatusFetching = oldSettings.disableRemoteStatusFetching; + newSettings.timelineHeader = oldSettings.timelineHeader; newSettings.timelineMode = oldSettings.timelineMode; return newSettings;