From 4ea44a5267b53fb9a067b9eaa240c87dbc73c25e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 21 Aug 2022 16:53:46 +0200 Subject: [PATCH] Fixed issue with portrait lock on launch (fix #274) --- Shared/YatteeApp.swift | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Shared/YatteeApp.swift b/Shared/YatteeApp.swift index 3284f269..ccfa2cc3 100644 --- a/Shared/YatteeApp.swift +++ b/Shared/YatteeApp.swift @@ -170,12 +170,6 @@ struct YatteeApp: App { SDImageCodersManager.shared.addCoder(SDImageWebPCoder.shared) SDWebImageManager.defaultImageCache = PINCache(name: "stream.yattee.app") - #if os(iOS) - if Defaults[.lockPortraitWhenBrowsing] { - Orientation.lockOrientation(.portrait, andRotateTo: .portrait) - } - #endif - if !Defaults[.lastAccountIsPublic] { accounts.configureAccount() } @@ -243,5 +237,13 @@ struct YatteeApp: App { if player.presentingPlayer { player.presentingPlayer = false } + + #if os(iOS) + DispatchQueue.main.asyncAfter(deadline: .now() + 1) { + if Defaults[.lockPortraitWhenBrowsing] { + Orientation.lockOrientation(.portrait, andRotateTo: .portrait) + } + } + #endif } }