Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content flickering issue when using AdaptyUI PaywallConfiguration with SwiftUI #110

Open
Sun-Woo-Kim opened this issue Feb 12, 2025 · 4 comments

Comments

@Sun-Woo-Kim
Copy link

Sun-Woo-Kim commented Feb 12, 2025

Description

Current Behavior

When using AdaptyUI's PaywallConfiguration with SwiftUI's conditional rendering, content flickers during the initialization process:

if let paywall = optionalPaywall {
    content
        .paywall(
            isPresented: $isPresented,
            paywallConfiguration: paywall
        )
} else {
    content
}

Issue Details

  1. The content momentarily shows and then disappears when PaywallConfiguration is nil
  2. This creates a poor user experience with visible UI flickering
  3. The issue occurs specifically when using .paywall modifier from AdaptyUI

Expected Behavior

The content should be rendered smoothly without any flickering when applying AdaptyUI's .paywall modifier.

Proposed Solutions

  1. Allow PaywallConfiguration to be created with mock data or through an initializer for testing and pre-loading scenarios
  2. Make PaywallConfiguration optional in the .paywall modifier and handle visibility internally, removing the need for external conditional rendering

Example of proposed API:

// Solution 1: Mock/Init constructor
let mockConfig = PaywallConfiguration.mock()
// or
let config = PaywallConfiguration(id: "test", ...)

// Solution 2: Optional configuration
content.paywall(
    isPresented: $isPresented,
    paywallConfiguration: optionalConfig // handles nil internally
)
@x401om
Copy link
Contributor

x401om commented Feb 14, 2025

Hi @Sun-Woo-Kim! Thank you for the detailed explanation! We will take a look.

@x401om
Copy link
Contributor

x401om commented Feb 18, 2025

Hi @Sun-Woo-Kim, I made several commits to fix the issue. If you have time, please try out the new implementation and confirm whether it helps.

  • the paywallConfiguration parameter is now optional.
  • if a paywall is presented before paywallConfiguration is loaded, a placeholder will be shown.
  • you can override the default placeholder by passing a placeholderBuilder.

Please use this commit. Don't go live with it please!

@Sun-Woo-Kim
Copy link
Author

Hi @x401om ,

Everything works perfectly! 🚀 Thank you for the quick feedback and fixes. Really appreciate the fast turnaround.

@x401om
Copy link
Contributor

x401om commented Feb 19, 2025

@Sun-Woo-Kim thank you for confirmation! In that case we are going to release it possibly in the 3.4.0, I will keep the issue opened until then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants