@@ -900,23 +900,27 @@ - (void) reset {
900900}
901901
902902#if (TARGET_OS_IPHONE)
903+
904+ static UIInterfaceOrientation GetCurrentInterfaceOrientation (UIApplication* app) {
905+ if (@available (iOS 26.0 , *)) {
906+ UIWindowScene* windowScene = (UIWindowScene*)[[[app connectedScenes ] allObjects ] firstObject ];
907+ return windowScene.effectiveGeometry .interfaceOrientation ;
908+ }
909+ #pragma clang diagnostic push
910+ #pragma clang diagnostic ignored "-Wdeprecated-declarations"
911+ if (@available (iOS 13.0 , *)) {
912+ UIWindowScene* windowScene = [[[app windows ] firstObject ] windowScene ];
913+ return [windowScene interfaceOrientation ];
914+ }
915+ return [app statusBarOrientation ];
916+ #pragma clang diagnostic pop
917+ }
918+
903919/* *
904920 Updates target video orientation.
905921*/
906922- (void )updateOrientation {
907- UIApplication* sharedApplication{[UIApplication sharedApplication ]};
908- UIInterfaceOrientation orientation{UIInterfaceOrientationUnknown};
909- #if (__IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_13_0)
910- UIScene* scene{[[[sharedApplication connectedScenes ] allObjects ] firstObject ]};
911- orientation = [(UIWindowScene*)scene interfaceOrientation ];
912- #else
913- if (@available (iOS 13.0 , *)) {
914- orientation = [[[[sharedApplication windows ] firstObject ] windowScene ] interfaceOrientation ];
915- }
916- else {
917- orientation = [sharedApplication statusBarOrientation ];
918- }
919- #endif
923+ UIInterfaceOrientation orientation = GetCurrentInterfaceOrientation ([UIApplication sharedApplication ]);
920924
921925 // Convert from UIInterfaceOrientation to VideoOrientation.
922926 switch (orientation)
0 commit comments