braze-inc / braze-swift-sdk

Braze SDK for the Apple ecosystem, including: iOS, macOS, iPadOS, visionOS, tvOS
https://www.braze.com
Other
52 stars 19 forks source link

[Feature]: Restore unviewedContentCardCount #68

Closed WedgeSparda closed 1 year ago

WedgeSparda commented 1 year ago

What problem are you facing?

Hi, we just migrated to this new SDK from AppBoy and one of the features we use and has completely disappear is unviewedContentCardCount provided by ABKContentCardsController.

Could we get a similar functionality from BrazeKit.Braze.ContentCards?, currently the only option we have is accessing the Braze instance and call .contentCards.cards.count, but that's providing the whole count, not just the unread ones.

Is there any other way to get the unviewed cards count?

Thanks

Workarounds

We don't see a viable workaround for this

Ideal Solution

Provide a similar property to unviewedContentCardCount from AppBoy's ABKContentCardsController

Other Information

No response

hokstuff commented 1 year ago

Hi @WedgeSparda,

You can grab the array of Content Cards and filter them based off the viewed property to achieve the same behavior as unviewedContentCardCount. Reference the code snippet below:

braze?.contentCards.cards.filter { !$0.viewed}.count

We will look to adding a convenience method for unviewedContentCardCount to make it easier in a future release.

Thanks!

WedgeSparda commented 1 year ago

Great, thanks for the hint 👍

hokstuff commented 1 year ago

Hi @WedgeSparda,

We released SDK version 6.4.0 which add the convenience property Braze.ContentCards.unviewedCards which will make it easier to fetch the unviewed content cards (and the count).

Thanks!