Skip to content

hotfix/cp-10490-android-sdk-issue-while-testing-in-app-banners#328

Merged
gbhrdt-cp merged 1 commit intomasterfrom
hotfix/cp-10490-android-sdk-issue-while-testing-in-app-banners
Dec 22, 2025
Merged

hotfix/cp-10490-android-sdk-issue-while-testing-in-app-banners#328
gbhrdt-cp merged 1 commit intomasterfrom
hotfix/cp-10490-android-sdk-issue-while-testing-in-app-banners

Conversation

@unnaticleverpush
Copy link
Contributor

@unnaticleverpush unnaticleverpush commented Dec 22, 2025

fix HTML banner crash and remove deprecated ConstraintLayout attr


Note

Prevents concurrent in-app banner display with a new APP_BANNER_SHOWING_IN_PROGRESS flag, fixes HTML banner JS injection using safe regex replacement, and removes a deprecated ConstraintLayout attribute.

  • App Banner display control:
    • Add and use CleverPushPreferences.APP_BANNER_SHOWING_IN_PROGRESS to gate showing banners (AppBannerModule, AppBannerPopup).
    • Set/reset flag around showBanner lifecycle and on exceptions; skip when showing or in-progress.
  • HTML banner stability:
    • Replace String.replaceAll with Pattern/Matcher.replaceAll + Matcher.quoteReplacement when injecting JS before </body> in AppBannerCarouselAdapter and InboxDetailBannerCarouselAdapter.
  • Layout:
    • Remove deprecated app:layout_constraintWidth_default from res/layout/app_banner_html.xml.

Written by Cursor Bugbot for commit 2085db7. This will update automatically on new commits. Configure here.


Summary by cubic

Fix crash when rendering HTML app banners and prevent overlapping banner displays. Addresses Linear CP-10490 during in-app banner testing.

  • Bug Fixes
    • Safely inject JS into HTML by using Pattern/Matcher with quoteReplacement when replacing (updated both carousel adapters).
    • Add APP_BANNER_SHOWING_IN_PROGRESS flag to block concurrent shows; set/reset around the show lifecycle and queue pending banners.
    • Remove deprecated ConstraintLayout attribute from app_banner_html.xml.

Written for commit 2085db7. Summary will update automatically on new commits.

fix HTML banner crash and remove deprecated ConstraintLayout attr
@unnaticleverpush unnaticleverpush self-assigned this Dec 22, 2025
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 6 files

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

bannerPopup.init();
bannerPopup.show();

sharedPreferences.edit().putBoolean(CleverPushPreferences.APP_BANNER_SHOWING_IN_PROGRESS, true).apply();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Race condition: flag set after show instead of before

The APP_BANNER_SHOWING_IN_PROGRESS flag is set at line 1910 after bannerPopup.show() is called, but it's checked at lines 1860-1861 to prevent concurrent banner display. Since show() starts an AsyncTask and the flag is set afterward, there's a window where multiple concurrent calls could pass the check before any of them sets the flag. This defeats the intended purpose of preventing overlapping banner displays. The flag needs to be set before calling show() to properly protect the critical section.

Additional Locations (1)

Fix in Cursor Fix in Web

bannerPopup.init();
bannerPopup.show();

sharedPreferences.edit().putBoolean(CleverPushPreferences.APP_BANNER_SHOWING_IN_PROGRESS, true).apply();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flag stuck true when async banner display fails

The APP_BANNER_SHOWING_IN_PROGRESS flag is set to true at line 1910 but only reset in synchronous catch blocks and toggleShowing(false). If the tryShowSafe AsyncTask fails — either because the activity becomes invalid (finishing/destroyed) before the banner loads, or an exception occurs in displayBanner/animateBody — the popup never displays, the dismiss listener never fires, and the flag remains true. This blocks all future non-forced banners until app restart when the flag is reset in the constructor.

Additional Locations (1)

Fix in Cursor Fix in Web

@gbhrdt-cp gbhrdt-cp merged commit a8d20fa into master Dec 22, 2025
4 of 7 checks passed
@gbhrdt-cp gbhrdt-cp deleted the hotfix/cp-10490-android-sdk-issue-while-testing-in-app-banners branch December 22, 2025 12:56
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.

3 participants