Merge branch 'main' into Implement-Apple-Translate

This commit is contained in:
Paul Schuetz 2024-05-13 09:38:20 +02:00
commit 8f06719b23
No known key found for this signature in database
GPG key ID: 4FDE1FB89050039E
2 changed files with 6 additions and 2 deletions

View file

@ -13,6 +13,7 @@ extension View {
@MainActor
private struct SafariRouter: ViewModifier {
@Environment(\.isSecondaryColumn) private var isSecondaryColumn: Bool
@Environment(Theme.self) private var theme
@Environment(UserPreferences.self) private var preferences
@Environment(RouterPath.self) private var routerPath
@ -25,10 +26,12 @@ private struct SafariRouter: ViewModifier {
content
.environment(\.openURL, OpenURLAction { url in
// Open internal URL.
routerPath.handle(url: url)
guard !isSecondaryColumn else { return .discarded }
return routerPath.handle(url: url)
})
.onOpenURL { url in
// Open external URL (from icecubesapp://)
guard !isSecondaryColumn else { return }
let urlString = url.absoluteString.replacingOccurrences(of: AppInfo.scheme, with: "https://")
guard let url = URL(string: urlString), url.host != nil else { return }
_ = routerPath.handleDeepLink(url: url)

View file

@ -111,7 +111,8 @@ struct SideBarView<Content: View>: View {
isInSettings: false),
isParentPresented: .constant(false))
}
if showBadge,
if !userPreferences.isSidebarExpanded,
showBadge,
let token = account.oauthToken,
let notificationsCount = userPreferences.notificationsCount[token],
notificationsCount > 0