feat: separate prettier from eslint

This commit is contained in:
Rainer Killinger
2023-01-11 13:25:18 +01:00
committed by Thea Schöbl
parent 939fb6ef0f
commit a88d000ccd
381 changed files with 17952 additions and 38411 deletions

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {StorageProvider} from '../../storage/storage.provider';
@@ -18,9 +18,7 @@ import {StorageProvider} from '../../storage/storage.provider';
export const CALENDAR_SYNC_SETTINGS_KEY = 'calendarSettings';
export const CALENDAR_SYNC_ENABLED_KEY = 'sync';
export const CALENDAR_NOTIFICATIONS_ENABLED_KEY = 'notifications';
export type CALENDAR_SYNC_KEYS =
| typeof CALENDAR_SYNC_ENABLED_KEY
| typeof CALENDAR_NOTIFICATIONS_ENABLED_KEY;
export type CALENDAR_SYNC_KEYS = typeof CALENDAR_SYNC_ENABLED_KEY | typeof CALENDAR_NOTIFICATIONS_ENABLED_KEY;
/**
*

View File

@@ -1,16 +1,16 @@
/*
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Component, OnInit} from '@angular/core';
@@ -63,18 +63,11 @@ export class CalendarSyncSettingsComponent implements OnInit {
this.isWeb = it.platform === 'web';
});
this.getSetting(CALENDAR_SYNC_ENABLED_KEY).then(
it => (this.syncEnabled = it),
);
this.getSetting(CALENDAR_NOTIFICATIONS_ENABLED_KEY).then(
it => (this.notificationsEnabled = it),
);
this.getSetting(CALENDAR_SYNC_ENABLED_KEY).then(it => (this.syncEnabled = it));
this.getSetting(CALENDAR_NOTIFICATIONS_ENABLED_KEY).then(it => (this.notificationsEnabled = it));
}
async getSetting(
key: CALENDAR_SYNC_KEYS,
defaultValue = false,
): Promise<boolean> {
async getSetting(key: CALENDAR_SYNC_KEYS, defaultValue = false): Promise<boolean> {
return getCalendarSetting(this.storageProvider, key, defaultValue);
}
@@ -82,11 +75,8 @@ export class CalendarSyncSettingsComponent implements OnInit {
this.syncEnabled = sync;
if (sync) {
const uuids = this.scheduleProvider.partialEvents$.value.map(
it => it.uid,
);
const dateSeries = (await this.scheduleProvider.getDateSeries(uuids))
.dates;
const uuids = this.scheduleProvider.partialEvents$.value.map(it => it.uid);
const dateSeries = (await this.scheduleProvider.getDateSeries(uuids)).dates;
await this.calendarService.syncEvents(
getNativeCalendarExport(dateSeries, this.thingTranslator.translator),
@@ -132,31 +122,19 @@ export class CalendarSyncSettingsComponent implements OnInit {
const uuids = JSON.parse(await file.text()) as SCUuid[] | unknown;
if (!Array.isArray(uuids) || uuids.some(it => typeof it !== 'string')) {
return Dialog.alert({
title: this.translator.instant(
'settings.calendar.export.dialogs.restore.rejectFile.title',
),
message: this.translator.instant(
'settings.calendar.export.dialogs.restore.rejectFile.message',
),
title: this.translator.instant('settings.calendar.export.dialogs.restore.rejectFile.title'),
message: this.translator.instant('settings.calendar.export.dialogs.restore.rejectFile.message'),
});
}
const dateSeries = await this.scheduleProvider.restore(uuids);
return dateSeries
? Dialog.confirm({
title: this.translator.instant(
'settings.calendar.export.dialogs.restore.success.title',
),
message: this.translator.instant(
'settings.calendar.export.dialogs.restore.success.message',
),
title: this.translator.instant('settings.calendar.export.dialogs.restore.success.title'),
message: this.translator.instant('settings.calendar.export.dialogs.restore.success.message'),
})
: Dialog.alert({
title: this.translator.instant(
'settings.calendar.export.dialogs.restore.error.title',
),
message: this.translator.instant(
'settings.calendar.export.dialogs.restore.error.message',
),
title: this.translator.instant('settings.calendar.export.dialogs.restore.error.title'),
message: this.translator.instant('settings.calendar.export.dialogs.restore.error.message'),
});
}
@@ -166,13 +144,9 @@ export class CalendarSyncSettingsComponent implements OnInit {
}
async backup() {
const uuids = JSON.stringify(
this.scheduleProvider.partialEvents$.value.map(it => it.uid),
);
const uuids = JSON.stringify(this.scheduleProvider.partialEvents$.value.map(it => it.uid));
const fileName = `${this.translator.instant(
'settings.calendar.export.fileName',
)}.json`;
const fileName = `${this.translator.instant('settings.calendar.export.fileName')}.json`;
const info = await Device.getInfo();
if (info.platform === 'web') {
const blob = new Blob([uuids], {type: 'application/json'});
@@ -191,16 +165,10 @@ export class CalendarSyncSettingsComponent implements OnInit {
});
await Share.share({
title: this.translator.instant(
'settings.calendar.export.dialogs.backup.save.title',
),
text: this.translator.instant(
'settings.calendar.export.dialogs.backup.save.message',
),
title: this.translator.instant('settings.calendar.export.dialogs.backup.save.title'),
text: this.translator.instant('settings.calendar.export.dialogs.backup.save.message'),
url: result.uri,
dialogTitle: this.translator.instant(
'settings.calendar.export.dialogs.backup.save.title',
),
dialogTitle: this.translator.instant('settings.calendar.export.dialogs.backup.save.title'),
});
}
}

View File

@@ -1,32 +1,28 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ Copyright (C) 2023 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-card>
<ion-card-header>
<ion-card-subtitle>{{
'settings.calendar.title' | translate
}}</ion-card-subtitle>
<ion-card-subtitle>{{ 'settings.calendar.title' | translate }}</ion-card-subtitle>
</ion-card-header>
<ion-card-content>
<ion-list lines="none">
<ion-item-group>
<ion-item-divider>
<ion-label>{{
'settings.calendar.sync.title' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.sync.title' | translate }}</ion-label>
</ion-item-divider>
<ion-item>
<ion-toggle
@@ -40,9 +36,7 @@
"
>
</ion-toggle>
<ion-label>{{
'settings.calendar.sync.syncWithCalendar' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.sync.syncWithCalendar' | translate }}</ion-label>
</ion-item>
<!--
~ TODO:
@@ -67,49 +61,35 @@
</ion-item>
-->
<ion-item *ngIf="!isWeb">
<ion-button
[disabled]="isWeb || !syncEnabled"
fill="clear"
(click)="syncCalendar(true)"
>
<ion-button [disabled]="isWeb || !syncEnabled" fill="clear" (click)="syncCalendar(true)">
<ion-label>Sync Now</ion-label>
<ion-icon slot="end" name="sync"></ion-icon>
</ion-button>
</ion-item>
<ion-item *ngIf="isWeb">
<ion-label color="medium" class="ion-text-wrap"
><b>{{
'settings.calendar.sync.unavailableWeb' | translate
}}</b></ion-label
><b>{{ 'settings.calendar.sync.unavailableWeb' | translate }}</b></ion-label
>
</ion-item>
</ion-item-group>
<ion-item-group>
<ion-item-divider>
<ion-label>{{
'settings.calendar.export.title' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.export.title' | translate }}</ion-label>
</ion-item-divider>
<ion-item>
<ion-button fill="clear" (click)="export()">
<ion-label>{{
'settings.calendar.export.exportEvents' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.export.exportEvents' | translate }}</ion-label>
<ion-icon slot="end" name="download"></ion-icon>
</ion-button>
</ion-item>
<ion-item>
<ion-button fill="clear" (click)="backup()">
<ion-label>{{
'settings.calendar.export.backup' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.export.backup' | translate }}</ion-label>
<ion-icon slot="end" name="save"></ion-icon>
</ion-button>
<ion-button fill="clear" (click)="restoreInput.click()">
<ion-label>{{
'settings.calendar.export.restore' | translate
}}</ion-label>
<ion-label>{{ 'settings.calendar.export.restore' | translate }}</ion-label>
<ion-icon slot="end" name="settings_backup_restore"></ion-icon>
</ion-button>
<!--suppress CheckEmptyScriptTag -->

View File

@@ -1,5 +1,5 @@
/*
* Copyright (C) 2018, 2019, 2020 StApps
* Copyright (C) 2022 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
@@ -98,18 +98,10 @@ export class SettingsPageComponent implements OnInit {
* Presents an alert to the user to reset settings to default values
*/
async presentResetAlert() {
const cancelText = await this.translateService
.get('settings.resetAlert.buttonCancel')
.toPromise();
const yesText = await this.translateService
.get('settings.resetAlert.buttonYes')
.toPromise();
const title = await this.translateService
.get('settings.resetAlert.title')
.toPromise();
const message = await this.translateService
.get('settings.resetAlert.message')
.toPromise();
const cancelText = await this.translateService.get('settings.resetAlert.buttonCancel').toPromise();
const yesText = await this.translateService.get('settings.resetAlert.buttonYes').toPromise();
const title = await this.translateService.get('settings.resetAlert.title').toPromise();
const message = await this.translateService.get('settings.resetAlert.message').toPromise();
const alert = await this.alertController.create({
buttons: [
@@ -147,9 +139,7 @@ export class SettingsPageComponent implements OnInit {
buttons: [
{
role: 'cancel',
text: this.translateService.instant(
'settings.resetAlert.buttonCancel',
),
text: this.translateService.instant('settings.resetAlert.buttonCancel'),
},
{
handler: async () => {

View File

@@ -1,16 +1,16 @@
<!--
~ Copyright (C) 2022 StApps
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~ This program is free software: you can redistribute it and/or modify it
~ under the terms of the GNU General Public License as published by the Free
~ Software Foundation, version 3.
~
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~ This program is distributed in the hope that it will be useful, but WITHOUT
~ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
~ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
~ more details.
~
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
~ You should have received a copy of the GNU General Public License along with
~ this program. If not, see <https://www.gnu.org/licenses/>.
-->
<ion-header>
@@ -31,18 +31,14 @@
'categories[0]'
| thingTranslate
: $any(
settingsCache[categoryKey]?.settings[
objectKeys(settingsCache[categoryKey]?.settings)[0]
]
settingsCache[categoryKey]?.settings[objectKeys(settingsCache[categoryKey]?.settings)[0]]
)
| titlecase
}}
</h5>
</ion-item-divider>
<stapps-settings-item
*ngFor="
let settingKeys of objectKeys(settingsCache[categoryKey].settings)
"
*ngFor="let settingKeys of objectKeys(settingsCache[categoryKey].settings)"
[setting]="settingsCache[categoryKey].settings[settingKeys]"
></stapps-settings-item>
</div>
@@ -50,12 +46,7 @@
<calendar-sync-settings></calendar-sync-settings>
<ion-button
color="medium"
expand="block"
fill="outline"
(click)="presentResetAlert()"
>
<ion-button color="medium" expand="block" fill="outline" (click)="presentResetAlert()">
{{ 'settings.resetSettings' | translate }}
<ion-icon slot="start" name="device_reset"></ion-icon>
</ion-button>