mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 18:21:00 +00:00
Adapt medias view to secondary column
This commit is contained in:
parent
979ba61b07
commit
e0d6340a9d
3 changed files with 16 additions and 1 deletions
|
@ -119,6 +119,7 @@ struct IceCubesApp: App {
|
||||||
currentAccount.account?.id != nil {
|
currentAccount.account?.id != nil {
|
||||||
Divider().edgesIgnoringSafeArea(.all)
|
Divider().edgesIgnoringSafeArea(.all)
|
||||||
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil, isSecondaryColumn: true)
|
NotificationsTab(popToRootTab: $popToRootTab, lockedType: nil, isSecondaryColumn: true)
|
||||||
|
.environment(\.isSecondaryColumn, true)
|
||||||
.frame(maxWidth: 360)
|
.frame(maxWidth: 360)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
Packages/Env/Sources/Env/CustomEnvValues.swift
Normal file
13
Packages/Env/Sources/Env/CustomEnvValues.swift
Normal file
|
@ -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 {
|
public struct StatusMediaPreviewView: View {
|
||||||
@Environment(\.openURL) private var openURL
|
@Environment(\.openURL) private var openURL
|
||||||
|
@Environment(\.isSecondaryColumn) private var isSecondaryColumn
|
||||||
|
|
||||||
@EnvironmentObject var sceneDelegate: SceneDelegate
|
@EnvironmentObject var sceneDelegate: SceneDelegate
|
||||||
@EnvironmentObject private var preferences: UserPreferences
|
@EnvironmentObject private var preferences: UserPreferences
|
||||||
|
@ -65,7 +66,7 @@ public struct StatusMediaPreviewView: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
private func imageSize(from: CGSize, newWidth: CGFloat) -> CGSize {
|
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)
|
return .init(width: imageMaxHeight, height: imageMaxHeight)
|
||||||
}
|
}
|
||||||
let ratio = newWidth / from.width
|
let ratio = newWidth / from.width
|
||||||
|
|
Loading…
Reference in a new issue