mirror of
https://github.com/immich-app/immich.git
synced 2024-12-24 10:37:28 +02:00
7489db9481
* refactor(mobile): app settings * Font size * refactor(mobile): backup settings ui (#7771) * refactor: SettingsButtonListTile * refactor: Backup settings to App settings --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> * fix: invalidate appsettingsprovider on timeline setting change * styling --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
70 lines
2.8 KiB
Dart
70 lines
2.8 KiB
Dart
import 'dart:io';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_hooks/flutter_hooks.dart' hide Store;
|
|
import 'package:immich_mobile/modules/settings/ui/local_storage_settings.dart';
|
|
import 'package:immich_mobile/modules/settings/ui/settings_slider_list_tile.dart';
|
|
import 'package:immich_mobile/modules/settings/ui/settings_sub_page_scaffold.dart';
|
|
import 'package:immich_mobile/modules/settings/ui/settings_switch_list_tile.dart';
|
|
import 'package:immich_mobile/modules/settings/utils/app_settings_update_hook.dart';
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
import 'package:immich_mobile/modules/settings/services/app_settings.service.dart';
|
|
import 'package:immich_mobile/shared/providers/user.provider.dart';
|
|
import 'package:immich_mobile/shared/services/immich_logger.service.dart';
|
|
import 'package:immich_mobile/utils/http_ssl_cert_override.dart';
|
|
import 'package:logging/logging.dart';
|
|
|
|
class AdvancedSettings extends HookConsumerWidget {
|
|
const AdvancedSettings({super.key});
|
|
@override
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
bool isLoggedIn = ref.read(currentUserProvider) != null;
|
|
|
|
final advancedTroubleshooting =
|
|
useAppSettingsState(AppSettingsEnum.advancedTroubleshooting);
|
|
final levelId = useAppSettingsState(AppSettingsEnum.logLevel);
|
|
final preferRemote = useAppSettingsState(AppSettingsEnum.preferRemoteImage);
|
|
final allowSelfSignedSSLCert =
|
|
useAppSettingsState(AppSettingsEnum.allowSelfSignedSSLCert);
|
|
|
|
final logLevel = Level.LEVELS[levelId.value].name;
|
|
|
|
useValueChanged(
|
|
levelId.value,
|
|
(_, __) => ImmichLogger().level = Level.LEVELS[levelId.value],
|
|
);
|
|
|
|
final advancedSettings = [
|
|
SettingsSwitchListTile(
|
|
enabled: true,
|
|
valueNotifier: advancedTroubleshooting,
|
|
title: "advanced_settings_troubleshooting_title".tr(),
|
|
subtitle: "advanced_settings_troubleshooting_subtitle".tr(),
|
|
),
|
|
SettingsSliderListTile(
|
|
text: "advanced_settings_log_level_title".tr(args: [logLevel]),
|
|
valueNotifier: levelId,
|
|
maxValue: 8,
|
|
minValue: 1,
|
|
noDivisons: 7,
|
|
label: logLevel,
|
|
),
|
|
SettingsSwitchListTile(
|
|
valueNotifier: preferRemote,
|
|
title: "advanced_settings_prefer_remote_title".tr(),
|
|
subtitle: "advanced_settings_prefer_remote_subtitle".tr(),
|
|
),
|
|
const LocalStorageSettings(),
|
|
SettingsSwitchListTile(
|
|
enabled: !isLoggedIn,
|
|
valueNotifier: allowSelfSignedSSLCert,
|
|
title: "advanced_settings_self_signed_ssl_title".tr(),
|
|
subtitle: "advanced_settings_self_signed_ssl_subtitle".tr(),
|
|
onChanged: (_) => HttpOverrides.global = HttpSSLCertOverride(),
|
|
),
|
|
];
|
|
|
|
return SettingsSubPageScaffold(settings: advancedSettings);
|
|
}
|
|
}
|