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

Cannot find CustomerCenterView importing RevenuecatUI #4311

Closed
9 of 12 tasks
jesus-mg-ios opened this issue Sep 27, 2024 · 8 comments
Closed
9 of 12 tasks

Cannot find CustomerCenterView importing RevenuecatUI #4311

jesus-mg-ios opened this issue Sep 27, 2024 · 8 comments
Labels

Comments

@jesus-mg-ios
Copy link

jesus-mg-ios commented Sep 27, 2024

Describe the bug

We have been approved to use this alpha feature.

image image
  1. Environment
    1. Platform:
    2. SDK version:
    3. StoreKit version:
      • StoreKit 1 (default on versions <5.0.0. Can be enabled in versions >=5.0.0 with .with(storeKitVersion: .storeKit1))
      • StoreKit 2 (default on versions >=5.0.0)
    4. OS version: any
    5. Xcode version: 15.2
    6. Device and/or simulator:
      • Device
      • Simulator
    7. Environment:
      • Sandbox
      • TestFlight
      • Production
    8. How widespread is the issue. Percentage of devices affected. 100%
  2. Debug logs that reproduce the issue. Complete logs with Purchases.logLevel = .verbose will help us debug this issue.
Logs here
  1. Steps to reproduce, with a description of expected vs. actual behavior

Download the latest revenucatui xcframework from tags. include it in your target, try to use CustomerCenterView.

  1. Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

  2. Additional context
    Add any other context about the problem here.

@RCGitBot
Copy link
Contributor

👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out!

@jesus-mg-ios
Copy link
Author

With SPM the file is available but all related to customer center is surrounded by a directive. Is there any way to build it including the directive anywhere?. I've included in my target but doesn't work. I had to modify each file to remove the compiler directive.

@vegaro
Copy link
Contributor

vegaro commented Sep 27, 2024

@jesus-mg-ios we are just about to make a public beta that removes the directive and will solve this issues you're seeing

#4308

@unxavi
Copy link

unxavi commented Sep 27, 2024

@vegaro we were granted the alpha preview and we are trying to use it, but not sure how

@vegaro
Copy link
Contributor

vegaro commented Sep 27, 2024

@jesus-mg-ios @unxavi we are having some issues with the release of purchases-ios 5.5.0 so we are holding the public beta until next week

That means that if you want to test the alpha before the public beta you have to stick to the latest alpha we released https://github.com/RevenueCat/purchases-ios/releases/tag/5.3.0-customercenter.alpha.4

The alpha version is also available via Cocoapods. Set your pod to the latest alpha version and enable a Swift flag in your Podfile in order to be able to use it:

 pod 'RevenueCat', '5.3.0-customercenter.alpha.4'
 pod 'RevenueCatUI', '5.3.0-customercenter.alpha.4'




 post_install do |installer|
   installer.pods_project.targets.each do |target|
     target.build_configurations.each do |config|
       config.build_settings['OTHER_SWIFT_FLAGS='] = '-DCUSTOMER_CENTER_ENABLED'
     end
   end
 end

There are configuration docs available in our docs site

We are hoping to make the beta public on Monday if everything works as expected, and that means you would be able to use the latest purchases-ios for it.

Sorry about that.

@jesus-mg-ios
Copy link
Author

jesus-mg-ios commented Sep 28, 2024

@vegaro thanks, we opted to modify the code because using cocoapods to test, it wasn't an option. Would be nice if you could create an option for remove the close button on the trailing side of the view, and the navigationCompatibilityView.

Something like this:

applyIf(closeButtonIsNeeded) { view in
    view.toolbar {
            ToolbarItem(placement: .compatibleTopBarTrailing) {
                DismissCircleButton()
            }
        }
}
@ViewBuilder
    func destinationView(configuration: CustomerCenterConfigData, needsPushNavigation: Bool) -> some View {
        let accentColor = Color.from(colorInformation: self.appearance.accentColor, for: self.colorScheme)
        Group {
              if needsPushNavigation {
                  destinationContent(configuration: configuration)
              }  else {
                    CompatibilityNavigationStack {
                          destinationContent(configuration: configuration)
                    }
              }
        }
        .applyIf(accentColor != nil, apply: { $0.tint(accentColor) })
    }

and

if  #available(iOS 16.0, *),  newNavigationIsUsed {
            content
                .navigationDestination(isPresented: .isNotNil(self.$viewModel.feedbackSurveyData)) {
                    if let feedbackSurveyData = self.viewModel.feedbackSurveyData {
                        FeedbackSurveyView(feedbackSurveyData: feedbackSurveyData,
                                           customerCenterActionHandler: self.customerCenterActionHandler)
                    }
                }
        } else {
            content
                .background(NavigationLink(
                    destination: self.viewModel.feedbackSurveyData.map { data in
                        FeedbackSurveyView(feedbackSurveyData: data,
                                           customerCenterActionHandler: self.customerCenterActionHandler)
                    },
                    isActive: .isNotNil(self.$viewModel.feedbackSurveyData)
                ) {
                    EmptyView()
                })
        }

By adding three parameters — newNavigationIsUsed, needsPushNavigation, and closeButtonIsNeeded — to CustomerCenterView, we enable flexibility in the navigation behavior. This approach ensures:

  • Consistency with push navigation: The app will use push-based navigation within navigation stacks instead of presenting new modal views.
  • Avoiding modals over modals: By checking closeButtonIsNeeded, we prevent a new modal presentation when it’s unnecessary, avoiding bad UX from stacking multiple modal views.
  • Fallback for older navigation styles: We handle both old and new navigation APIs, ensuring that the app works consistently across different iOS versions (e.g., iOS 16+ with NavigationStack vs. older versions with NavigationView), because not all people create both ways even NavigationView is deprecated for iOS 16+.

newNavigationIsUsed: Determines if the app should use the iOS 16+ NavigationStack system with .navigationDestination. When false, it falls back to using NavigationLink.
needsPushNavigation: Indicates whether the current view is inside a NavigationView or NavigationStack. When true, the destination content is pushed onto the existing navigation stack, preserving navigation consistency. If false, the content is wrapped in its own navigation stack.
closeButtonIsNeeded: Controls whether a close button (e.g., DismissCircleButton) is added to the toolbar. This prevents the scenario of staying on a stacked view in a push navigation and have the chevron to go back and the close button at the same time.

Take the snippets as example, for sure you can create viewModifiers, models, and reduce code.

Thanks

@vegaro
Copy link
Contributor

vegaro commented Sep 30, 2024

Thank you so much for the detailed feedback. We'll take a look.

Also, we have just released 5.5.0 and enabled the Customer Center for everyone as a public beta

@facumenzella
Copy link
Contributor

@jesus-mg-ios thanks again for the detailed explanation. We've released 5.15.0 that introduces NavigationOptions.

Please let us know if there're any other issues 💪

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

No branches or pull requests

5 participants