Gainsight / px-ios

MIT License
2 stars 1 forks source link

Issue getting PX Editor to launch in SwiftUI app #21

Open uknowmeright opened 6 days ago

uknowmeright commented 6 days ago

We are trying to get the PX Editor integrated into our SwiftUI app and having issues.

The URL Scheme has been successfully registered and the link provided from the Product Mapper page does open in the app, however, the only thing that happens is an activity indicator is shown above the rest of the UI and never goes away until the app is restarted again.

We have tried integrating with the AppDelegate methods as instructed here, as well as using the SwiftUI version of these hooks on our SwiftUI rootview itself:

RootView(model: rootModel)
    .onOpenURL { url in
         GainsightPX.shared.enterEditingMode(url: url)
    }
    .onContinueUserActivity(NSUserActivityTypeBrowsingWeb, perform: { userActivity in
        guard let incomingURL = userActivity.webpageURL else { return }
        GainsightPX.shared.enterEditingMode(url: incomingURL)
    })

We are initializing the SDK with following code that we have tried putting in an appDelegate didLaunch method as well as a the .onChange(of: scenePhase) method on our WindowGroup:

let configurations = AnalyticsConfigurations(apiKey: apiKey)
configurations.shouldTrackTapEvents = true
GainsightPX.shared.initialise(configurations: configurations, completionBlock: nil)

Both of these seem to have the same effect and successfully initialize the SDK.

Any Idea why the PX Editor would still not be launching correctly for us? Does it fully support integration with SwiftUI apps?

uknowmeright commented 5 days ago

Just to provide an example, here is a blank project with the SDK implemented how we have it in our app. (with the API key removed)

I left the vanilla SwiftUI implementation uncommented but if you would like to try it using the AppDelegate I included that code as well just commented out.

GainsightTest.zip