Giter Site home page Giter Site logo

Comments (6)

hokstuff avatar hokstuff commented on July 18, 2024

Hi @kbalani12,

The method requestImmediateDataFlush actually just flushes the local data to the server for the current user. Since you are looking to get the latest content cards, can you try using requestContentCardsRefresh instead?

from appboy-ios-sdk.

kbalani12 avatar kbalani12 commented on July 18, 2024

This is exactly what we do, the problem is that it doesn't work for the very first launch. The sequence that we need to enforce is that current user is set first and then content card is refreshed. we can't enforce this because we don't know when local data is flushed to server. If we call refreshContentCards prior to it then all we get is empty result.

from appboy-ios-sdk.

hokstuff avatar hokstuff commented on July 18, 2024

Hi @kbalani12,

Sorry about the delay! After calling changeUser, the local data is automatically flushed to the server (regardless of the ProcessingPolicy since this behavior is needed for proper functionality), so no need to call requestImmediateDataFlush after changing user.

Depending on when you attempt to display the content cards after changing user, you may be displaying it prior to the content card payload coming back. Also, depending on how your campaign is set up and which experiments you are running, you may want to update your campaign settings to set when to re-evaluate eligibility for the content card to get the appropriate cards at display time. To have our team look at your integration + your campaign settings further, please contact [email protected] with the relevant campaigns and our Support team can follow up with the issues you are facing.

Thanks!

from appboy-ios-sdk.

kbalani12 avatar kbalani12 commented on July 18, 2024

This isn't specific to campaign, most of iOS API that are async (via network or computing delay) needs to be accompanied with a success/failure notification callbacks or delegate.

This is done via WebSDK of Braze.
Their method signature:

requestImmediateDataFlush(callback?: (success: boolean) => void): void

If we refresh content cards using this sequences:

 Appboy.sharedInstance().changeUser("user id")
 Appboy.sharedInstance().requestContentCardsRefresh()

Content cards returns stale response. However, the below one returns the correct response

 Appboy.sharedInstance().changeUser("user id")
 DispatchQueue.main.asyncAfter(deadline: .now() + 2.0) { 
   Appboy.sharedInstance().requestContentCardsRefresh()
}

Ideally what we would like to do instead.

Appboy.sharedInstance().changeUser("user id", completion: { error in
  if (!error) {
          Appboy.sharedInstance().requestContentCardsRefresh()
  }
})

The request for this is to at minimum provide a callback for requestImmediateDataFlush.

from appboy-ios-sdk.

hokstuff avatar hokstuff commented on July 18, 2024

Hi @kbalani12,

The proposed solution above actually would not address your use case because the endpoints for user data and Content Cards are separated out, meaning that changeUser / requestImmediateDataFlush is communicating with a separate endpoint than what refreshContentCards is. This means that even if we accepted a completion to the first couple APIs, we would not be able to guarantee it is executed in the manner you describe.

However, the current default implementation of Content Cards should be adequate to handle your use case, as it will automatically refresh Content Cards in a few places. First, whenever a Content Card feed is about to be displayed, it will request for the latest cards if it is outside of a timeout. Also, if you monitor the requests that come to your device using a tool such as Proxyman, you will notice that immediately after changing a user, there will be another request from the /content_cards endpoint which contains the new data for that user.

Let me know if that answers your questions!

from appboy-ios-sdk.

hokstuff avatar hokstuff commented on July 18, 2024

I'm closing this issue due to inactivity. Feel free to contact our Support team at [email protected] if you continue to run into issues or have more details related to this thread.

Thanks!

from appboy-ios-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.