Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
JGeek00 committed Dec 9, 2023
2 parents e2f3fe9 + 5a12c4c commit 3bc8fce
Show file tree
Hide file tree
Showing 56 changed files with 3,516 additions and 3,336 deletions.
4 changes: 3 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -688,5 +688,7 @@
"yourVersion": "Your version: {version}",
"minimumRequiredVersion": "Minimum required version: {version}",
"topUpstreams": "Top upstreams",
"averageUpstreamResponseTime": "Average upstream response time"
"averageUpstreamResponseTime": "Average upstream response time",
"dhcpNotAvailable": "The DHCP server is not available.",
"osServerInstalledIncompatible": "The OS where the server is installed is not compatible with this feature."
}
4 changes: 3 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -688,5 +688,7 @@
"yourVersion": "Tu versión: {version}",
"minimumRequiredVersion": "Versión mínima requerida: {version}",
"topUpstreams": "DNS de subida más frecuentes",
"averageUpstreamResponseTime": "Tiempo promedio de respuesta upstream"
"averageUpstreamResponseTime": "Tiempo promedio de respuesta upstream",
"dhcpNotAvailable": "El servidor DHCP no está disponible.",
"osServerInstalledIncompatible": "El SO donde el servidor está instalado no es compatible con esta característica."
}
2 changes: 2 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:provider/provider.dart';
import 'package:flutter_displaymode/flutter_displaymode.dart';
Expand Down Expand Up @@ -35,6 +36,7 @@ import 'package:adguard_home_manager/services/db/database.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);

if (Platform.isWindows || Platform.isLinux || Platform.isMacOS) {
setWindowMinSize(const Size(500, 500));
Expand Down
4 changes: 3 additions & 1 deletion lib/models/dhcp.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import 'dart:convert';
class DhcpModel {
bool dhcpAvailable;
List<NetworkInterface> networkInterfaces;
DhcpStatus dhcpStatus;
DhcpStatus? dhcpStatus;

DhcpModel({
required this.dhcpAvailable,
required this.networkInterfaces,
required this.dhcpStatus,
});
Expand Down
4 changes: 2 additions & 2 deletions lib/providers/dhcp_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class DhcpProvider with ChangeNotifier {

if (result.successful == true) {
DhcpModel data = dhcp!;
data.dhcpStatus.staticLeases = data.dhcpStatus.staticLeases.where((l) => l.mac != lease.mac).toList();
data.dhcpStatus!.staticLeases = data.dhcpStatus!.staticLeases.where((l) => l.mac != lease.mac).toList();
setDhcpData(data);
return true;
}
Expand All @@ -90,7 +90,7 @@ class DhcpProvider with ChangeNotifier {

if (result.successful == true) {
DhcpModel data = dhcp!;
data.dhcpStatus.staticLeases.add(lease);
data.dhcpStatus!.staticLeases.add(lease);
setDhcpData(data);
return result;
}
Expand Down
58 changes: 30 additions & 28 deletions lib/screens/clients/client/client_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,34 +185,36 @@ class _ClientScreenState extends State<ClientScreen> {
),
actions: actions(),
),
body: ClientForm(
isFullScreen: true,
client: widget.client,
nameController: nameController,
updateValidValues: (v) => setState(() => validValues = v),
identifiersControllers: identifiersControllers,
selectedTags: selectedTags,
useGlobalSettingsFiltering: useGlobalSettingsFiltering,
enableFiltering: enableFiltering,
enableParentalControl: enableParentalControl,
enableSafeBrowsing: enableSafeBrowsing,
enableSafeSearch: enableSafeSearch,
safeSearch: safeSearch,
blockedServices: blockedServices,
updateBlockedServices: (v) => setState(() => blockedServices = v),
upstreamServers: upstreamServers,
updateUpstreamServers: (v) => setState(() => upstreamServers = v),
defaultSafeSearch: defaultSafeSearch,
useGlobalSettingsServices: useGlobalSettingsServices,
updateSelectedTags: (v) => setState(() => selectedTags = v),
updateIdentifiersControllers: (v) => setState(() => identifiersControllers = v),
enableDisableGlobalSettingsFiltering: enableDisableGlobalSettingsFiltering,
updateEnableFiltering: (v) => setState(() => enableFiltering = v),
updateEnableParentalControl: (v) => setState(() => enableParentalControl = v),
updateEnableSafeBrowsing: (v) => setState(() => enableSafeBrowsing = v),
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
updateSafeSearch: (v) => setState(() => safeSearch = v),
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
body: SafeArea(
child: ClientForm(
isFullScreen: true,
client: widget.client,
nameController: nameController,
updateValidValues: (v) => setState(() => validValues = v),
identifiersControllers: identifiersControllers,
selectedTags: selectedTags,
useGlobalSettingsFiltering: useGlobalSettingsFiltering,
enableFiltering: enableFiltering,
enableParentalControl: enableParentalControl,
enableSafeBrowsing: enableSafeBrowsing,
enableSafeSearch: enableSafeSearch,
safeSearch: safeSearch,
blockedServices: blockedServices,
updateBlockedServices: (v) => setState(() => blockedServices = v),
upstreamServers: upstreamServers,
updateUpstreamServers: (v) => setState(() => upstreamServers = v),
defaultSafeSearch: defaultSafeSearch,
useGlobalSettingsServices: useGlobalSettingsServices,
updateSelectedTags: (v) => setState(() => selectedTags = v),
updateIdentifiersControllers: (v) => setState(() => identifiersControllers = v),
enableDisableGlobalSettingsFiltering: enableDisableGlobalSettingsFiltering,
updateEnableFiltering: (v) => setState(() => enableFiltering = v),
updateEnableParentalControl: (v) => setState(() => enableParentalControl = v),
updateEnableSafeBrowsing: (v) => setState(() => enableSafeBrowsing = v),
updateEnableSafeSearch: (v) => setState(() => enableSafeSearch = v),
updateSafeSearch: (v) => setState(() => safeSearch = v),
updateUseGlobalSettingsServices: (v) => setState(() => useGlobalSettingsServices = v),
),
),
),
);
Expand Down
218 changes: 110 additions & 108 deletions lib/screens/clients/client/logs_list_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,125 +149,127 @@ class _LogsListClientState extends State<LogsListClient> {
]
],
),
body: Builder(
builder: (context) {
switch (loadStatus) {
case 0:
return SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const CircularProgressIndicator(),
const SizedBox(height: 30),
Text(
AppLocalizations.of(context)!.loadingLogs,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
)
],
),
);

case 1:
if (logsData!.data.isNotEmpty) {
return RefreshIndicator(
onRefresh: fetchLogs,
child: ListView.builder(
controller: scrollController,
padding: const EdgeInsets.only(top: 0),
itemCount: isLoadingMore == true
? logsData!.data.length+1
: logsData!.data.length,
itemBuilder: (context, index) {
if (isLoadingMore == true && index == logsData!.data.length) {
return const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Center(
child: CircularProgressIndicator(),
),
);
}
else {
return LogTile(
log: logsData!.data[index],
index: index,
length: logsData!.data.length,
useAlwaysNormalTile: true,
onLogTap: (log) => {
if (width > 700) {
showDialog(
context: context,
builder: (context) => LogDetailsScreen(
log: log,
dialog: true
)
)
}
else {
Navigator.of(context).push(
MaterialPageRoute(
body: SafeArea(
child: Builder(
builder: (context) {
switch (loadStatus) {
case 0:
return SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const CircularProgressIndicator(),
const SizedBox(height: 30),
Text(
AppLocalizations.of(context)!.loadingLogs,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
)
],
),
);

case 1:
if (logsData!.data.isNotEmpty) {
return RefreshIndicator(
onRefresh: fetchLogs,
child: ListView.builder(
controller: scrollController,
padding: const EdgeInsets.only(top: 0),
itemCount: isLoadingMore == true
? logsData!.data.length+1
: logsData!.data.length,
itemBuilder: (context, index) {
if (isLoadingMore == true && index == logsData!.data.length) {
return const Padding(
padding: EdgeInsets.symmetric(vertical: 20),
child: Center(
child: CircularProgressIndicator(),
),
);
}
else {
return LogTile(
log: logsData!.data[index],
index: index,
length: logsData!.data.length,
useAlwaysNormalTile: true,
onLogTap: (log) => {
if (width > 700) {
showDialog(
context: context,
builder: (context) => LogDetailsScreen(
log: log,
dialog: false
dialog: true
)
)
}
else {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => LogDetailsScreen(
log: log,
dialog: false
)
)
)
)
}
},
twoColumns: widget.splitView,
);
}
},
twoColumns: widget.splitView,
);
}
}
}
),
);
}
else {
return Center(
child: Text(
AppLocalizations.of(context)!.noLogsDisplay,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
),
);
}

case 2:
return SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icons.error,
color: Colors.red,
size: 50,
),
const SizedBox(height: 30),
Text(
AppLocalizations.of(context)!.logsNotLoaded,
);
}
else {
return Center(
child: Text(
AppLocalizations.of(context)!.noLogsDisplay,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
)
],
),
);

default:
return const SizedBox();
}
},
),
);
}

case 2:
return SizedBox(
width: double.maxFinite,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(
Icons.error,
color: Colors.red,
size: 50,
),
const SizedBox(height: 30),
Text(
AppLocalizations.of(context)!.logsNotLoaded,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 22,
color: Theme.of(context).colorScheme.onSurfaceVariant,
),
)
],
),
);

default:
return const SizedBox();
}
},
),
)
);
}
Expand Down
Loading

0 comments on commit 3bc8fce

Please sign in to comment.