Open links on system browser

This commit is contained in:
Juan Gilsanz Polo
2024-06-11 15:14:21 +02:00
parent 3ee194c50a
commit edf49edfa8
19 changed files with 243 additions and 53 deletions

View File

@@ -160,15 +160,19 @@ class Bookmarks extends _$Bookmarks {
}
void selectBookmark(Bookmark bookmark, double width) {
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
} else if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == false) {
openUrl(bookmark.url!);
} else if (bookmark != state.selectedBookmark) {
state.webViewRouter.go(_webViewRoutePath, extra: bookmark);
if (ref.watch(appStatusProvider).openLinksBrowser == OpenLinksBrowser.browserCustomTab) {
openUrlCustomTab(bookmark.url!);
} else if (ref.watch(appStatusProvider).openLinksBrowser == OpenLinksBrowser.systemBrowser) {
openUrlSystemBrowser(bookmark.url!);
} else {
if (width <= Sizes.tabletBreakpoint) {
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
} else if (bookmark != state.selectedBookmark) {
state.webViewRouter.go(_webViewRoutePath, extra: bookmark);
}
state.selectedBookmark = bookmark;
ref.notifyListeners();
}
state.selectedBookmark = bookmark;
ref.notifyListeners();
}
Future<void> refresh() async {

View File

@@ -132,15 +132,19 @@ class SearchBookmarks extends _$SearchBookmarks {
}
void selectBookmark(Bookmark bookmark, double width) {
if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == true) {
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
} else if (width <= Sizes.tabletBreakpoint && ref.watch(appStatusProvider).useInAppBrowser == false) {
openUrl(bookmark.url!);
} else if (bookmark != state.selectedBookmark) {
state.webViewRouter.go(_webViewRoutePath, extra: bookmark);
if (ref.watch(appStatusProvider).openLinksBrowser == OpenLinksBrowser.browserCustomTab) {
openUrlCustomTab(bookmark.url!);
} else if (ref.watch(appStatusProvider).openLinksBrowser == OpenLinksBrowser.systemBrowser) {
openUrlSystemBrowser(bookmark.url!);
} else {
if (width <= Sizes.tabletBreakpoint) {
ref.watch(routerProvider).push(RoutesPaths.webview, extra: bookmark);
} else if (bookmark != state.selectedBookmark) {
state.webViewRouter.go(_webViewRoutePath, extra: bookmark);
}
state.selectedBookmark = bookmark;
ref.notifyListeners();
}
state.selectedBookmark = bookmark;
ref.notifyListeners();
}
void deleteBookmark(Bookmark bookmark) async {