mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-23 15:29:13 +00:00
Fixed updater
This commit is contained in:
parent
d23e26c8d7
commit
645ec6eb0b
3 changed files with 70 additions and 84 deletions
|
@ -50,6 +50,7 @@ class _BaseState extends State<Base> with WidgetsBindingObserver {
|
||||||
if (Platform.isAndroid) {
|
if (Platform.isAndroid) {
|
||||||
if (
|
if (
|
||||||
widget.appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE ||
|
widget.appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE ||
|
||||||
|
widget.appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_PLAY_PACKAGE_INSTALLER ||
|
||||||
widget.appConfigProvider.installationSource == Source.UNKNOWN
|
widget.appConfigProvider.installationSource == Source.UNKNOWN
|
||||||
) {
|
) {
|
||||||
return result['body'];
|
return result['body'];
|
||||||
|
|
|
@ -10,6 +10,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
import 'package:adguard_home_manager/widgets/custom_list_tile.dart';
|
||||||
import 'package:adguard_home_manager/screens/settings/app_logs/app_logs.dart';
|
import 'package:adguard_home_manager/screens/settings/app_logs/app_logs.dart';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/functions/snackbar.dart';
|
||||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
|
|
||||||
class AdvancedSettings extends StatelessWidget {
|
class AdvancedSettings extends StatelessWidget {
|
||||||
|
@ -21,50 +22,32 @@ class AdvancedSettings extends StatelessWidget {
|
||||||
|
|
||||||
final width = MediaQuery.of(context).size.width;
|
final width = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
Future updateSslCheck(bool newStatus) async {
|
Future updateSettings({
|
||||||
final result = await appConfigProvider.setOverrideSslCheck(newStatus);
|
required bool newStatus,
|
||||||
|
required Future Function(bool) function
|
||||||
|
}) async {
|
||||||
|
final result = await function(newStatus);
|
||||||
if (result == true) {
|
if (result == true) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnacbkar(
|
||||||
SnackBar(
|
appConfigProvider: appConfigProvider,
|
||||||
content: Text(AppLocalizations.of(context)!.restartAppTakeEffect),
|
label: AppLocalizations.of(context)!.settingsUpdatedSuccessfully,
|
||||||
backgroundColor: Colors.green,
|
color: Colors.green
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
showSnacbkar(
|
||||||
SnackBar(
|
appConfigProvider: appConfigProvider,
|
||||||
content: Text(AppLocalizations.of(context)!.cannotUpdateSettings),
|
label: AppLocalizations.of(context)!.cannotUpdateSettings,
|
||||||
backgroundColor: Colors.red,
|
color: Colors.red
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: NestedScrollView(
|
appBar: AppBar(
|
||||||
headerSliverBuilder: (context, innerBoxIsScrolled) => [
|
title: Text(AppLocalizations.of(context)!.advancedSettings),
|
||||||
SliverOverlapAbsorber(
|
|
||||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
|
||||||
sliver: SliverAppBar(
|
|
||||||
pinned: true,
|
|
||||||
floating: true,
|
|
||||||
centerTitle: false,
|
|
||||||
forceElevated: innerBoxIsScrolled,
|
|
||||||
title: Text(AppLocalizations.of(context)!.generalSettings),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
],
|
|
||||||
body: SafeArea(
|
|
||||||
top: false,
|
|
||||||
bottom: false,
|
|
||||||
child: Builder(
|
|
||||||
builder: (context) => CustomScrollView(
|
|
||||||
slivers: [
|
|
||||||
SliverOverlapInjector(
|
|
||||||
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
|
|
||||||
),
|
),
|
||||||
SliverList.list(
|
body: ListView(
|
||||||
children: [
|
children: [
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
icon: Icons.lock,
|
icon: Icons.lock,
|
||||||
|
@ -72,9 +55,15 @@ class AdvancedSettings extends StatelessWidget {
|
||||||
subtitle: AppLocalizations.of(context)!.dontCheckCertificateDescription,
|
subtitle: AppLocalizations.of(context)!.dontCheckCertificateDescription,
|
||||||
trailing: Switch(
|
trailing: Switch(
|
||||||
value: appConfigProvider.overrideSslCheck,
|
value: appConfigProvider.overrideSslCheck,
|
||||||
onChanged: updateSslCheck,
|
onChanged: (value) => updateSettings(
|
||||||
|
newStatus: value,
|
||||||
|
function: appConfigProvider.setOverrideSslCheck
|
||||||
|
),
|
||||||
|
),
|
||||||
|
onTap: () => updateSettings(
|
||||||
|
newStatus: !appConfigProvider.overrideSslCheck,
|
||||||
|
function: appConfigProvider.setOverrideSslCheck
|
||||||
),
|
),
|
||||||
onTap: () => updateSslCheck(!appConfigProvider.overrideSslCheck),
|
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
top: 10,
|
top: 10,
|
||||||
bottom: 10,
|
bottom: 10,
|
||||||
|
@ -107,11 +96,6 @@ class AdvancedSettings extends StatelessWidget {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -207,9 +207,10 @@ class _GeneralSettingsState extends State<GeneralSettings> {
|
||||||
if (
|
if (
|
||||||
!(Platform.isAndroid || Platform.isIOS) ||
|
!(Platform.isAndroid || Platform.isIOS) ||
|
||||||
(Platform.isAndroid && (
|
(Platform.isAndroid && (
|
||||||
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE) ||
|
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_LOCAL_SOURCE ||
|
||||||
|
appConfigProvider.installationSource == Source.IS_INSTALLED_FROM_PLAY_PACKAGE_INSTALLER ||
|
||||||
appConfigProvider.installationSource == Source.UNKNOWN
|
appConfigProvider.installationSource == Source.UNKNOWN
|
||||||
)
|
))
|
||||||
) ...[
|
) ...[
|
||||||
SectionLabel(label: AppLocalizations.of(context)!.application),
|
SectionLabel(label: AppLocalizations.of(context)!.application),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
|
|
Loading…
Add table
Reference in a new issue