Fix wrong orientation mode on app start.
This commit is contained in:
parent
428b932493
commit
5d8c608876
|
@ -172,6 +172,7 @@ extension View {
|
|||
|
||||
struct ContentView: View {
|
||||
@Environment(\.managedObjectContext) private var viewContext
|
||||
@EnvironmentObject var orientationInfo: OrientationInfo
|
||||
@StateObject private var globalData = GlobalData()
|
||||
@EnvironmentObject var jsi: justSignedIn
|
||||
|
||||
|
@ -200,6 +201,14 @@ struct ContentView: View {
|
|||
}
|
||||
|
||||
func startup() {
|
||||
|
||||
let size = UIScreen.main.bounds.size
|
||||
if size.width < size.height {
|
||||
orientationInfo.orientation = .portrait;
|
||||
} else {
|
||||
orientationInfo.orientation = .landscape;
|
||||
}
|
||||
|
||||
if(_viewDidLoad.wrappedValue) {
|
||||
return
|
||||
}
|
||||
|
|
|
@ -84,6 +84,11 @@ struct EpisodeItemView: View {
|
|||
}
|
||||
|
||||
func loadData() {
|
||||
if(UIDevice.current.orientation.isLandscape) {
|
||||
orientationInfo.orientation = .landscape;
|
||||
} else {
|
||||
orientationInfo.orientation = .portrait;
|
||||
}
|
||||
if(_vc.wrappedValue != nil) {
|
||||
_vc.wrappedValue?._prefersHomeIndicatorAutoHidden = false;
|
||||
_vc.wrappedValue?._orientations = .allButUpsideDown;
|
||||
|
|
|
@ -122,10 +122,12 @@ struct SeriesItemView: View {
|
|||
.fontWeight(.semibold)
|
||||
.foregroundColor(.primary)
|
||||
.lineLimit(1)
|
||||
Text(String(item.ProductionYear))
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
if(item.ProductionYear != 0) {
|
||||
Text(String(item.ProductionYear))
|
||||
.foregroundColor(.secondary)
|
||||
.font(.caption)
|
||||
.fontWeight(.medium)
|
||||
}
|
||||
}.frame(width: 100)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue