Fix subtitle popover not appearing on iPadOS

Also fixes black bars to left and right on devices w/o a notch.
This commit is contained in:
Aiden Vigue 2021-05-22 13:48:46 -04:00
parent 88e6e14b20
commit 428b932493
5 changed files with 15 additions and 7 deletions

View File

@ -115,6 +115,7 @@ class PreferenceUIHostingController: UIHostingController<AnyView> {
@objc required dynamic init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
super.modalPresentationStyle = .fullScreen
}
private class Box {

View File

@ -40,7 +40,7 @@
<key>UIApplicationSceneManifest</key>
<dict>
<key>UIApplicationSupportsMultipleScenes</key>
<true/>
<false/>
</dict>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
@ -57,8 +57,8 @@
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>

View File

@ -11,6 +11,13 @@ class justSignedIn: ObservableObject {
@Published var did: Bool = false
}
extension UIDevice {
var hasNotch: Bool {
let bottom = UIApplication.shared.keyWindow?.safeAreaInsets.bottom ?? 0
return bottom > 0
}
}
class OrientationInfo: ObservableObject {
enum Orientation {
case portrait

View File

@ -390,12 +390,12 @@ struct PlayerDemo: View {
.accentColor(Color(red: 172/255, green: 92/255, blue: 195/255))
Text(timeText).fontWeight(.semibold).frame(width: 80).foregroundColor(.white)
}.padding(EdgeInsets(top: -20, leading: 44, bottom: 42, trailing: 40))
}.transition(.fade)
.padding(EdgeInsets(top: 0, leading: -30, bottom: 0, trailing: -30))
}
.padding(EdgeInsets(top: 0, leading: UIDevice.current.hasNotch ? -30 : 0, bottom: 0, trailing: UIDevice.current.hasNotch ? -30 : 0))
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color(UIColor.black).opacity(0.4))
.isHidden(inactivity)
}.padding(EdgeInsets(top: 0, leading: 34, bottom: 0, trailing: 34))
}.padding(EdgeInsets(top: 0, leading: UIDevice.current.hasNotch ? 34 : 0, bottom: 0, trailing: UIDevice.current.hasNotch ? 34 : 0))
}.frame(minWidth: 0, maxWidth: .infinity, minHeight: 0, maxHeight: .infinity)
.onAppear(perform: startStream)
.navigationBarHidden(true)
@ -409,7 +409,7 @@ struct PlayerDemo: View {
.edgesIgnoringSafeArea(.all)
.onTapGesture(perform: resetTimer)
.overrideViewPreference(.dark)
.popover( isPresented: self.$captionConfiguration, arrowEdge: .bottom) {
.fullScreenCover(isPresented: self.$captionConfiguration) {
NavigationView() {
VStack() {
Form() {

View File

@ -71,8 +71,8 @@ class PlayerUIView: UIView, VLCMediaPlayerDelegate {
mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFontSize:")), with: 14)
mediaPlayer.wrappedValue.perform(Selector(("setTextRendererFont:")), with: "Copperplate")
mediaPlayer.wrappedValue.play()
mediaPlayer.wrappedValue.jumpForward(Int32(startTime/10000000))
mediaPlayer.wrappedValue.play()
}
}