Notifications: Full media size + autoplay

This commit is contained in:
Thomas Ricouard 2024-01-21 19:46:29 +01:00
parent 0b96b76641
commit 2b446833da
5 changed files with 14 additions and 2 deletions

View file

@ -13,6 +13,10 @@ private struct IsCompact: EnvironmentKey {
static let defaultValue: Bool = false
}
private struct IsMediaCompact: EnvironmentKey {
static let defaultValue: Bool = false
}
private struct IsModal: EnvironmentKey {
static let defaultValue: Bool = false
}
@ -53,6 +57,11 @@ public extension EnvironmentValues {
set { self[IsCompact.self] = newValue }
}
var isMediaCompact: Bool {
get { self[IsMediaCompact.self] }
set { self[IsMediaCompact.self] = newValue }
}
var isModal: Bool {
get { self[IsModal.self] }
set { self[IsModal.self] = newValue }

View file

@ -75,7 +75,7 @@ import SwiftUI
@MainActor
public struct MediaUIAttachmentVideoView: View {
@Environment(\.scenePhase) private var scenePhase
@Environment(\.isCompact) private var isCompact
@Environment(\.isMediaCompact) private var isCompact
@Environment(UserPreferences.self) private var preferences
@Environment(Theme.self) private var theme

View file

@ -160,6 +160,7 @@ struct NotificationRowView: View {
client: client,
routerPath: routerPath,
showActions: true))
.environment(\.isMediaCompact, false)
} else {
StatusRowView(viewModel: .init(status: status,
client: client,
@ -167,6 +168,7 @@ struct NotificationRowView: View {
showActions: false,
textDisabled: true))
.lineLimit(4)
.environment(\.isMediaCompact, true)
}
Spacer()
}

View file

@ -29,6 +29,7 @@ public struct StatusEmbeddedView: View {
showActions: false))
.accessibilityLabel(status.content.asRawText)
.environment(\.isCompact, true)
.environment(\.isMediaCompact, true)
.environment(\.isStatusFocused, false)
}
Spacer()

View file

@ -10,7 +10,7 @@ import SwiftUI
public struct StatusRowMediaPreviewView: View {
@Environment(\.openWindow) private var openWindow
@Environment(\.extraLeadingInset) private var extraLeadingInset: CGFloat
@Environment(\.isCompact) private var isCompact: Bool
@Environment(\.isMediaCompact) private var isCompact: Bool
@Environment(\.horizontalSizeClass) private var horizontalSizeClass
@Environment(SceneDelegate.self) private var sceneDelegate
@Environment(UserPreferences.self) private var preferences