Skip to content

Conversation

@Jaypatelbond
Copy link

Summary

Removes the hardcoded Toast message that is displayed when network is unavailable while loading Content Cards in ContentCardsFragment.

Problem

The [ContentCardsFragment](https://github.com/braze-inc/braze-android-sdk/blob/master/android-sdk-ui/src/main/java/com/braze/ui/contentcards/ContentCardsFragment.kt#L344-L355) was showing a Toast.makeText() message with R.string.com_braze_feed_connection_error_title whenever network was unavailable. This hardcoded behavior impacts all SDK consumers and may not align with their app's UX/UI guidelines or error handling strategy.

Solution

Removed the Toast.makeText() call from the [networkUnavailable()](https://github.com/braze-inc/braze-android-sdk/blob/master/android-sdk-ui/src/main/java/com/braze/ui/contentcards/ContentCardsFragment.kt#L344) function. The function now only:

  • Logs the network unavailability event
  • Shows the empty cards adapter
  • Stops the refresh indicator

This aligns the behavior with the Jetpack Compose [ContentCardsList](https://github.com/braze-inc/braze-android-sdk/blob/master/android-sdk-jetpack-compose/src/main/java/com/braze/jetpackcompose/contentcards/ContentCardsList.kt#L132-L136) implementation, which also only logs network unavailability without displaying a Toast.

Changes

Modified:

Customization

SDK consumers who need to display custom network error UI can subclass ContentCardsFragment and override the protected suspend fun networkUnavailable() function.

Testing

  • Verified Content Cards displays empty adapter when network is unavailable
  • Verified no Toast is shown to the user
  • Verified refresh indicator stops spinning appropriately
  • Verified existing functionality remains intact

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant