optimize the appicon of iOS
This commit is contained in:
@@ -131,13 +131,25 @@ struct RootView: View {
|
||||
|
||||
private func enterFullscreen() {
|
||||
AppDelegate.orientationLock = UIDevice.current.userInterfaceIdiom == .pad ? .all : .landscape
|
||||
UIViewController.attemptRotationToDeviceOrientation()
|
||||
updateSupportedInterfaceOrientations()
|
||||
showFullscreenPlayer = true
|
||||
}
|
||||
|
||||
private func exitFullscreen() {
|
||||
AppDelegate.orientationLock = UIDevice.current.userInterfaceIdiom == .pad ? .all : .portrait
|
||||
UIViewController.attemptRotationToDeviceOrientation()
|
||||
updateSupportedInterfaceOrientations()
|
||||
showFullscreenPlayer = false
|
||||
}
|
||||
|
||||
private func updateSupportedInterfaceOrientations() {
|
||||
let scenes = UIApplication.shared.connectedScenes.compactMap { $0 as? UIWindowScene }
|
||||
let controllers = scenes.flatMap { $0.windows }.compactMap(\.rootViewController)
|
||||
for controller in controllers {
|
||||
if #available(iOS 16.0, *) {
|
||||
controller.setNeedsUpdateOfSupportedInterfaceOrientations()
|
||||
} else {
|
||||
UIViewController.attemptRotationToDeviceOrientation()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user