Adapt medias view to secondary column
This commit is contained in:
parent
979ba61b07
commit
e0d6340a9d
|
@ -119,6 +119,7 @@ struct IceCubesApp: App {
|
|||
currentAccount.account?.id != nil {
|
||||
Divider().edgesIgnoringSafeArea(.all)
|
||||
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil, isSecondaryColumn: true)
|
||||
.environment(\.isSecondaryColumn, true)
|
||||
.frame(maxWidth: 360)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
private struct SecondaryColumnKey: EnvironmentKey {
|
||||
static let defaultValue = false
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
public var isSecondaryColumn: Bool {
|
||||
get { self[SecondaryColumnKey.self] }
|
||||
set { self[SecondaryColumnKey.self] = newValue }
|
||||
}
|
||||
}
|
|
@ -7,6 +7,7 @@ import SwiftUI
|
|||
|
||||
public struct StatusMediaPreviewView: View {
|
||||
@Environment(\.openURL) private var openURL
|
||||
@Environment(\.isSecondaryColumn) private var isSecondaryColumn
|
||||
|
||||
@EnvironmentObject var sceneDelegate: SceneDelegate
|
||||
@EnvironmentObject private var preferences: UserPreferences
|
||||
|
@ -65,7 +66,7 @@ public struct StatusMediaPreviewView: View {
|
|||
}
|
||||
|
||||
private func imageSize(from: CGSize, newWidth: CGFloat) -> CGSize {
|
||||
if isNotifications || theme.statusDisplayStyle == .compact {
|
||||
if isNotifications || theme.statusDisplayStyle == .compact || isSecondaryColumn {
|
||||
return .init(width: imageMaxHeight, height: imageMaxHeight)
|
||||
}
|
||||
let ratio = newWidth / from.width
|
||||
|
|
Loading…
Reference in New Issue