added timeline header settings

This commit is contained in:
Nicolas Constant 2020-04-20 00:19:56 -04:00
parent e2d1e1893a
commit 5860422d83
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
4 changed files with 60 additions and 3 deletions

View File

@ -97,6 +97,35 @@
<h4 class="panel__subtitle">Timelines</h4>
<div class="sub-section">
<span class="sub-section__title">header display:</span><br />
<input class="sub-section__checkbox" [checked]="timeLineHeader === 1" (change)="onTimeLineHeaderChange(1)"
type="radio" name="timelineheader-1" value="timelineheader-1" id="timelineheader-1">
<label class="noselect sub-section__label" for="timelineheader-1">Title - Domain Name</label>
<br>
<input class="sub-section__checkbox" [checked]="timeLineHeader === 2" (change)="onTimeLineHeaderChange(2)"
type="radio" name="timelineheader-2" value="timelineheader-2" id="timelineheader-2">
<label class="noselect sub-section__label" for="timelineheader-2">Title - Username - Domain Name</label>
<br>
<input class="sub-section__checkbox" [checked]="timeLineHeader === 3" (change)="onTimeLineHeaderChange(3)"
type="radio" name="timelineheader-3" value="timelineheader-3" id="timelineheader-3">
<label class="noselect sub-section__label" for="timelineheader-3">Title - Account Icon - Domain Name</label>
<br>
<input class="sub-section__checkbox" [checked]="timeLineHeader === 4" (change)="onTimeLineHeaderChange(4)"
type="radio" name="timelineheader-4" value="timelineheader-4" id="timelineheader-4">
<label class="noselect sub-section__label" for="timelineheader-4">Title - Account Icon</label>
<br>
<input class="sub-section__checkbox" [checked]="timeLineHeader === 5" (change)="onTimeLineHeaderChange(5)"
type="radio" name="timelineheader-5" value="timelineheader-5" id="timelineheader-5">
<label class="noselect sub-section__label" for="timelineheader-5">Title</label>
<br>
<span class="sub-section__title" *ngIf="timeLineHeaderChanged">this settings needs a <a href
(click)="reload()">reload</a> to be effective.</span>
<span class="sub-section__title">loading behavior:</span><br />
<input class="sub-section__checkbox" [checked]="timeLineMode === 1" (change)="onTimeLineModeChange(1)"

View File

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

View File

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

View File

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