From f110fe36b9616a019738451e59499c7f21492ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yusuf=20To=CC=88r?= <3296904+yusuftor@users.noreply.github.com> Date: Wed, 7 Oct 2026 16:26:14 +0200 Subject: [PATCH] Show the test mode sheet on the window the user can see The sheet was presented from the first connected scene and its first window. Scenes come from a set, so that could be a background or external-display scene, or another SDK's overlay window. Use the same active window lookup that paywalls already use. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 1 + Sources/SuperwallKit/Config/ConfigManager.swift | 5 +---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f3920ba0..320e05127 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The changelog for `SuperwallKit`. Also see the [releases](https://github.com/sup ### Fixes - Fixes the SDK getting stuck in test mode when a sheet such as the Customer Center is already open as it finishes loading. +- Fixes the test mode sheet not showing in apps with more than one scene or window. ## 4.17.0 diff --git a/Sources/SuperwallKit/Config/ConfigManager.swift b/Sources/SuperwallKit/Config/ConfigManager.swift index 8c71f0a7e..354f3bf27 100644 --- a/Sources/SuperwallKit/Config/ConfigManager.swift +++ b/Sources/SuperwallKit/Config/ConfigManager.swift @@ -826,10 +826,7 @@ class ConfigManager { @MainActor private func presentTestModeModal(reason: TestModeReason, config: Config) async { - guard - let windowScene = UIApplication.shared.connectedScenes.first as? UIWindowScene, - let rootVC = windowScene.windows.first?.rootViewController - else { + guard let rootVC = UIApplication.sharedApplication?.activeWindow?.rootViewController else { return }