Skip to content

Commit

Permalink
Merge branch 'beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
JGeek00 committed Jan 22, 2025
2 parents 1f23f1f + 7f6f686 commit 4766d19
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 27 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"cSpell.ignorePaths": [
"/pubspec.yaml",
"/.github/workflows"
]
],
"dart.flutterRunAdditionalArgs": [ "--no-enable-impeller" ]
}
2 changes: 1 addition & 1 deletion debian/debian.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ flutter_app:

control:
Package: AdGuardHomeManager
Version: 2.20.0
Version: 2.20.1
Architecture: amd64
Essential: no
Priority: optional
Expand Down
10 changes: 10 additions & 0 deletions lib/functions/open_url.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@ import 'package:url_launcher/url_launcher.dart' as url_launcher;
import 'package:sentry_flutter/sentry_flutter.dart';

void openUrl(String url) async {
if (!(url.startsWith("http") || url.startsWith("https"))) {
try {
url_launcher.launchUrl(Uri.parse(url));
} catch (e, stackTrace) {
Sentry.captureException(e, stackTrace: stackTrace);
}
return;
}

if (Platform.isAndroid || Platform.isIOS) {
try {
await flutter_custom_tabs.launchUrl(
Expand All @@ -20,6 +29,7 @@ void openUrl(String url) async {
),
);
} catch (e, stackTrace) {
url_launcher.launchUrl(Uri.parse(url));
Sentry.captureException(e, stackTrace: stackTrace);
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@
"hereWillAppearRealtimeLogs": "Here there will appear the logs on realtime.",
"applicationDetails": "Application details",
"applicationDetailsDescription": "App repository, stores where it's available, and more",
"myOtherApps": "Check my other apps",
"myOtherAppsDescription": "Created by JGeek00",
"myOtherApps": "My other apps",
"myOtherAppsDescription": "Check my other apps, make a donation, contact support, and more",
"topToBottom": "From top to bottom",
"bottomToTop": "From bottom to top"
}
4 changes: 2 additions & 2 deletions lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,8 @@
"hereWillAppearRealtimeLogs": "Aquí aparecerán los registros en tiempo real.",
"applicationDetails": "Detalles de la aplicación",
"applicationDetailsDescription": "Repositorio de la app, tiendas donde está disponible, y más",
"myOtherApps": "Comprueba mis otras apps",
"myOtherAppsDescription": "Creadas por JGeek00",
"myOtherApps": "Mis otras apps",
"myOtherAppsDescription": "Comprueba mis otras apps, hacer una donación, contactar al soporte, y más",
"topToBottom": "Desde arriba hacia abajo",
"bottomToTop": "Desde abajo hacia arriba"
}
13 changes: 12 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,22 @@ void main() async {
return null;
}

if (event.message?.formatted.contains("HttpException") == true) {
return null;
}

if (
event.message?.formatted.contains("Unexpected character") ?? false ||
(event.throwable != null && event.throwable!.toString().contains("Unexpected character"))
) {
return null; // Exclude this event
return null;
}

if (
event.message?.formatted.contains("Unexpected end of input") ?? false ||
(event.throwable != null && event.throwable!.toString().contains("Unexpected end of input"))
) {
return null;
}

return event;
Expand Down
6 changes: 3 additions & 3 deletions lib/models/dns_statistics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class DnsStatistics {

factory DnsStatistics.fromJson(Map<String, dynamic> json) => DnsStatistics(
timeUnits: json["time_units"],
topQueriedDomains: List<Map<String, int>>.from(json["top_queried_domains"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))),
topClients: List<Map<String, int>>.from(json["top_clients"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))),
topBlockedDomains: List<Map<String, int>>.from(json["top_blocked_domains"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))),
topQueriedDomains: json["top_queried_domains"] != null ? List<Map<String, int>>.from(json["top_queried_domains"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))) : [],
topClients: json["top_clients"] != null ? List<Map<String, int>>.from(json["top_clients"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))) : [],
topBlockedDomains: json["top_blocked_domains"] != null ? List<Map<String, int>>.from(json["top_blocked_domains"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))): [],
topUpstreamResponses: json["top_upstreams_responses"] != null ? List<Map<String, int>>.from(json["top_upstreams_responses"].map((x) => Map.from(x).map((k, v) => MapEntry<String, int>(k, v)))) : null,
topUpstreamsAvgTime: json["top_upstreams_avg_time"] != null ? List<Map<String, double>>.from(json["top_upstreams_avg_time"].map((x) => Map.from(x).map((k, v) => MapEntry<String, double>(k, v)))) : null,
dnsQueries: List<int>.from(json["dns_queries"].map((x) => x)),
Expand Down
4 changes: 4 additions & 0 deletions lib/screens/clients/fab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@ class ClientsFab extends StatelessWidget {
final width = MediaQuery.of(context).size.width;

void confirmAddClient(Client client) async {
if (!context.mounted) return;

ProcessModal processModal = ProcessModal();
processModal.open(AppLocalizations.of(context)!.addingClient);

final result = await clientsProvider.addClient(client);

if (!context.mounted) return;

processModal.close();

Expand Down
4 changes: 4 additions & 0 deletions lib/screens/filters/add_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ class AddFiltersButton extends StatelessWidget {
final width = MediaQuery.of(context).size.width;

void confirmAddRule(String rule) async {
if (!context.mounted) return;

ProcessModal processModal = ProcessModal();
processModal.open(AppLocalizations.of(context)!.addingRule);

Expand All @@ -58,6 +60,8 @@ class AddFiltersButton extends StatelessWidget {
}

void confirmEditCustomRules(List<String> rules) async {
if (!context.mounted) return;

ProcessModal processModal = ProcessModal();
processModal.open(AppLocalizations.of(context)!.savingCustomRules);

Expand Down
2 changes: 2 additions & 0 deletions lib/screens/logs/log_tile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ class LogTile extends StatelessWidget {
}

void blockUnblockRuleClient() async {
if (!context.mounted) return;

ProcessModal processModal = ProcessModal();
processModal.open(AppLocalizations.of(context)!.addingRule);

Expand Down
1 change: 1 addition & 0 deletions lib/screens/logs/logs_list_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class LogsListAppBar extends StatelessWidget {
}

void openLiveLogsScreen() {
if (!context.mounted) return;
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) => MultiProvider(
Expand Down
34 changes: 18 additions & 16 deletions lib/widgets/add_server/add_server_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ class _AddServerModalState extends State<AddServerModal> {
final ApiClientV2 apiClient2 = ApiClientV2(server: serverObj);
final serverStatus = await apiClient2.getServerStatus();

if (!context.mounted) return;

// If something goes wrong when fetching server status
if (serverStatus.successful == false) {
statusProvider.setServerStatusLoad(LoadStatus.error);
Expand Down Expand Up @@ -203,16 +205,16 @@ class _AddServerModalState extends State<AddServerModal> {

final serverCreated = await serversProvider.createServer(serverObj);

if (!context.mounted) return;

// If something goes wrong when saving the connection on the db
if (serverCreated != null) {
if (mounted) setState(() => isConnecting = false);
if (mounted) {
showSnackbar(
appConfigProvider: appConfigProvider,
label: AppLocalizations.of(context)!.connectionNotCreated,
color: Colors.red
);
}
setState(() => isConnecting = false);
showSnackbar(
appConfigProvider: appConfigProvider,
label: AppLocalizations.of(context)!.connectionNotCreated,
color: Colors.red
);
return;
}

Expand Down Expand Up @@ -295,24 +297,24 @@ class _AddServerModalState extends State<AddServerModal> {
}

final serverSaved = await serversProvider.editServer(serverObj);

if (!mounted) return;

// If something goes wrong when saving the connection on the db
if (serverSaved != null) {
if (mounted) setState(() => isConnecting = false);
setState(() => isConnecting = false);
appConfigProvider.addLog(
AppLog(
type: 'save_connection_db',
dateTime: DateTime.now(),
message: serverSaved.toString()
)
);
if (mounted) {
showSnackbar(
appConfigProvider: appConfigProvider,
label: AppLocalizations.of(context)!.connectionNotCreated,
color: Colors.red
);
}
showSnackbar(
appConfigProvider: appConfigProvider,
label: AppLocalizations.of(context)!.connectionNotCreated,
color: Colors.red
);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.20.0+147
version: 2.20.1+148

environment:
sdk: '>=2.18.1 <3.0.0'
Expand Down

0 comments on commit 4766d19

Please sign in to comment.