pendo-io / pendo-mobile-sdk

Pendo captures product usage data, gathers user feedback, and lets you communicate in-app to onboard, educate, and guide users to value
https://www.pendo.io
Other
57 stars 2 forks source link

iOS, PendoManager.shared().pauseGuides(true) doesn't work #72

Closed vadimux closed 10 months ago

vadimux commented 12 months ago

Platform + Version IOS 16.6

SDK Version SDK version identified: '2.22.1.7434'

Framework Native

Describe the bug We use internal flag for showing/hiding Pendo Guides, but it looks SDK doesn't stop showing any guides if our flag is false

We call PendoManager.shared().pauseGuides(true) or PendoManager.shared().dismissVisibleGuides(), but guide is appeared anyway. It works as expected for Android SDK.

To Reproduce Steps to reproduce the behavior:

  1. Init Pendo SDK
  2. call PendoManager.shared().pauseGuides(true)
  3. See Pendo guide

Expected behavior no any Pendo guides after calling PendoManager.shared().pauseGuides(true)

Logs

[Pendo] [Friday, 1 September 2023 at 11:45] ✅ canDisplay set to 1
[Pendo] [Friday, 1 September 2023 at 11:45] ✅ UserDefaults successfully written to file
[Pendo] [Friday, 1 September 2023 at 11:45] ✅ UserDefaults Synchronization Finished
[Pendo] [Friday, 1 September 2023 at 11:45] ✅ Assets were loaded successfully
[Pendo] [Friday, 1 September 2023 at 11:45] ✅ Window (address: 0x1053c8f10) of type PopupWindow has set window level to: 2004.000000
[Pendo] [Friday, 1 September 2023 at 11:45] ✅ Guide successfully displayed, guideId: S___8

Sample Code

 @objc func initSDK() {
      PendoManager.shared().setup(KEY)
      isPendoGuidesEnabled ? PendoManager.shared().resumeGuides() : PendoManager.shared().pauseGuides(true)
}

Additional context looks like PendoManager.shared().pauseGuides(true) doesn't affect hiding of the guide and guide is appeared anyway

MikePendo commented 12 months ago

@vadimux The issue here is that u call them right after setup. Setup call doesnt fetch any guides , the api that fetches the guides is startSession. If there is no session pause guides has no effect. Basically if u want to pause guides u will need to call it after StartSession

vadimux commented 12 months ago

@MikePendo thank you for clarification, I did it after StartSession, but I still have the guide as appeared

    @objc func visitor(userId: String, accountId: String) {
        let visitorData = prepareVisitorData()
        PendoManager.shared().startSession(userId,
                                           accountId: accountId,
                                           visitorData: visitorData,
                                           accountData: nil)

        PendoManager.shared().pauseGuides(true)
    }
MikePendo commented 12 months ago

@vadimux I see, unfortunately its essentially the same issue I will internally open a bug on our end. I manage to reproduce this bug. The calls of Setup and StartSession are async the pauseGuide is sync and eventually happens before them if they are executed in order one after another . We can only pause guides after we have received them, so basically the pauseGuides immediately after startSession has no effect. (we will fix it). The current work around I can think of is to pause the guides on pndDidSuccessfullyInitializeSD something like that:

NotificationCenter.default.addObserver(self, selector: #selector(pendoSucceffulyinitiated), name: NSNotification.Name.pndDidSuccessfullyInitializeSDK, object: nil)
@objc func pendoSucceffulyinitiated() {
        PendoManager.shared().pauseGuides(true)
    }

Can you explain about your use case?(until we fix the issue) I mean if u want to pause guides immediately after start session why do u need an app lunch guide in that case?

vadimux commented 12 months ago

@MikePendo cool, thanks for workaround.

About your question - PendoManager.shared().pauseGuides(true) doesn't stop/pause any guides even when we use a guide in the middle of our application (like at the end of some flow), not an app launch only. When I use Test Full Flow on Device feature (connect device with QR code) and check some Track Event, I still see guide, but I expect don't see it, because PendoManager.shared().pauseGuides(true) has been called for this session.

MikePendo commented 12 months ago

@vadimux yes, you are correct the bug not only related to app launch guides. it relates to all guides if pauseGuide get called before startSession has finished its full guide initialization (I edited my previous comment) Regarding pauseGuide api when you are in the Test Full Flow (pairing mode). I see no reason why to call this api as the test full flow should simulate the appearance of the guide. In any case I will add it to our bug description so we will check that case also