mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-25 11:22:23 +00:00
Changed url launcher
This commit is contained in:
parent
340ef4f00e
commit
d92d755381
12 changed files with 99 additions and 17 deletions
|
@ -1,21 +1,33 @@
|
|||
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter_custom_tabs/flutter_custom_tabs.dart' as flutter_custom_tabs;
|
||||
import 'package:url_launcher/url_launcher.dart' as url_launcher;
|
||||
import 'package:sentry_flutter/sentry_flutter.dart';
|
||||
|
||||
void openUrl(String url) async {
|
||||
try {
|
||||
await launchUrl(
|
||||
Uri.parse(url),
|
||||
customTabsOptions: const CustomTabsOptions(
|
||||
shareState: CustomTabsShareState.browserDefault,
|
||||
urlBarHidingEnabled: true,
|
||||
showTitle: true,
|
||||
),
|
||||
safariVCOptions: const SafariViewControllerOptions(
|
||||
barCollapsingEnabled: true,
|
||||
dismissButtonStyle: SafariViewControllerDismissButtonStyle.close,
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
if (Platform.isAndroid || Platform.isIOS) {
|
||||
try {
|
||||
await flutter_custom_tabs.launchUrl(
|
||||
Uri.parse(url),
|
||||
customTabsOptions: const flutter_custom_tabs.CustomTabsOptions(
|
||||
shareState: flutter_custom_tabs.CustomTabsShareState.browserDefault,
|
||||
urlBarHidingEnabled: true,
|
||||
showTitle: true,
|
||||
),
|
||||
safariVCOptions: const flutter_custom_tabs.SafariViewControllerOptions(
|
||||
barCollapsingEnabled: true,
|
||||
dismissButtonStyle: flutter_custom_tabs.SafariViewControllerDismissButtonStyle.close,
|
||||
),
|
||||
);
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
url_launcher.launchUrl(Uri.parse(url));
|
||||
} catch (e, stackTrace) {
|
||||
Sentry.captureException(e, stackTrace: stackTrace);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -151,7 +151,8 @@ class HomeAppBar extends StatelessWidget {
|
|||
),
|
||||
)
|
||||
]
|
||||
)
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue