customerio / customerio-android

This is the official Customer.io SDK for Android.
MIT License
11 stars 9 forks source link

fix: ensure messages are only shown once #281

Closed stephen-pope-customer-io closed 6 months ago

stephen-pope-customer-io commented 6 months ago

The idea is to keep track of the shown messages by queueId (which is unique per message) and skip the shown ones

This is based on the same solution applied for gist-web: https://github.com/customerio/gist-web/pull/26

Task: https://github.com/customerio/issues/issues/11967

Complete each step to get your pull request merged in. Learn more about the workflow this project uses.

github-actions[bot] commented 6 months ago
# Sample app builds 📱 Below you will find the list of the latest versions of the sample apps. It's recommended to always download the latest builds of the sample apps to accurately test the pull request. --- * java_layout: `spope/11967-duplicate-messages (1705567797)` * kotlin_compose: `spope/11967-duplicate-messages (1705567799)`
codecov[bot] commented 6 months ago

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (f1bfc22) 53.52% compared to head (8b3ac05) 53.53%.

Files Patch % Lines
...stomer/messaginginapp/gist/data/listeners/Queue.kt 20.00% 4 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #281 +/- ## ============================================ + Coverage 53.52% 53.53% +0.01% Complexity 278 278 ============================================ Files 109 109 Lines 2812 2817 +5 Branches 352 352 ============================================ + Hits 1505 1508 +3 - Misses 1183 1187 +4 + Partials 124 122 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 6 months ago

Build available to test Version: spope-11967-duplicate-messages-SNAPSHOT Repository: https://s01.oss.sonatype.org/content/repositories/snapshots/

BernardGatt commented 6 months ago

I think it would be simpler if the implementation was handled inside Queue.kt instead of GistSdk.kt. It even has a listener to onMessageShown where we can add the queueId to the list.

BernardGatt commented 6 months ago

This has been updated and tested, ready for review.

BernardGatt commented 6 months ago

Yeah, we should eventually implement a retry mechanism on failure and maybe persist this variable into user preferences.