Implement settings
Some checks failed
Build Docker and Deploy / Build Docker Container (push) Successful in 51s
Build Docker and Deploy / Run Unit-Tests (push) Failing after 11m17s
Build Docker and Deploy / Deploy to Server (push) Has been skipped

This commit is contained in:
2025-04-19 01:49:28 +02:00
parent 5417796f3f
commit b91ddc172d
33 changed files with 912 additions and 127 deletions

View File

@@ -1,5 +1,3 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
@@ -14,6 +12,7 @@ import 'package:simplecloudnotifier/pages/keytoken_view/keytoken_channel_modal.d
import 'package:simplecloudnotifier/pages/keytoken_view/keytoken_permission_modal.dart';
import 'package:simplecloudnotifier/state/app_auth.dart';
import 'package:simplecloudnotifier/state/app_bar_state.dart';
import 'package:simplecloudnotifier/state/app_settings.dart';
import 'package:simplecloudnotifier/state/application_log.dart';
import 'package:simplecloudnotifier/state/scn_data_cache.dart';
import 'package:simplecloudnotifier/types/immediate_future.dart';
@@ -45,8 +44,6 @@ enum EditState { none, editing, saving }
enum KeyTokenViewPageInitState { loading, okay, error }
class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
static final _dateFormat = DateFormat('yyyy-MM-dd HH:mm'); //TODO setting
ImmediateFuture<UserPreview> _futureOwner = ImmediateFuture.ofPending();
ImmediateFuture<Map<String, ChannelPreview>> _futureAllChannels = ImmediateFuture.ofPending();
@@ -195,6 +192,8 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
}
Widget _buildOwnedKeyTokenView(BuildContext context, KeyToken keytoken) {
final dateFormat = context.select<AppSettings, AppSettingsDateFormat>((v) => v.dateFormat).dateFormat();
return SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.fromLTRB(24, 16, 24, 16),
@@ -217,13 +216,13 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
context: context,
icon: FontAwesomeIcons.solidClock,
title: 'Created',
values: [_KeyTokenViewPageState._dateFormat.format(DateTime.parse(keytoken.timestampCreated).toLocal())],
values: [dateFormat.format(DateTime.parse(keytoken.timestampCreated).toLocal())],
),
UI.metaCard(
context: context,
icon: FontAwesomeIcons.solidClockTwo,
title: 'Last Used',
values: [(keytoken.timestampLastUsed == null) ? 'Never' : _KeyTokenViewPageState._dateFormat.format(DateTime.parse(keytoken.timestampLastUsed!).toLocal())],
values: [(keytoken.timestampLastUsed == null) ? 'Never' : dateFormat.format(DateTime.parse(keytoken.timestampLastUsed!).toLocal())],
),
_buildOwnerCard(context, true),
UI.metaCard(
@@ -481,8 +480,6 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
}
void _editPermissions() async {
final acc = Provider.of<AppAuth>(context, listen: false);
if (keytokenUserAccAdmin == null || keytokenUserAccAdmin!.keytokenID == keytokenPreview!.keytokenID) {
Toaster.error("Error", "You cannot edit the currently used token");
return;
@@ -502,8 +499,6 @@ class _KeyTokenViewPageState extends State<KeyTokenViewPage> {
}
void _editChannels() async {
final acc = Provider.of<AppAuth>(context, listen: false);
if (keytokenUserAccAdmin == null || keytokenUserAccAdmin!.keytokenID == keytokenPreview!.keytokenID) {
Toaster.error("Error", "You cannot edit the currently used token");
return;