Skip to content

Bugfix/suppress store popups - #244

Merged
netniV merged 6 commits into
STFC-Mod:devfrom
GingerNinja-STFC:bugfix/suppress-ad-and-tutorial-popups
Oct 10, 2026
Merged

netniV merged 6 commits into
STFC-Mod:devfrom
GingerNinja-STFC:bugfix/suppress-ad-and-tutorial-popups

Conversation

@GingerNinja-STFC

Copy link
Copy Markdown
Contributor

Fix disable_first_popup interstitial suppression and add store offer popup suppression

Background

The disable_first_popup setting was added in PR #37 to suppress the first ad/interstitial popup. It was disabled in PR #139 with the message "temporarily ignore the disable_first_popup option, as it does not work" and hardcoded to if (false ...). The feature has been dead code on dev since.

Why the original approach didn't work

The original hook intercepted InterstitialViewController.AboutToShow and called CloseWhenReady() instead of calling original():

if (Config::Get().disable_first_popup && isFirstInterstitial && _this != nullptr) {
    isFirstInterstitial = false;
    _this->CloseWhenReady();   // <-- called WITHOUT original() first
} else {
    original(_this);
}

How this PR fixes it

The hook now calls original() first to let the popup initialize properly, then immediately closes it:

void InterstitialViewController_AboutToShow(auto original, InterstitialViewController* _this)
{
  original(_this);
  if (Config::Get().disable_first_popup && _this != nullptr) {
    spdlog::debug("InterstitialViewController_AboutToShow: suppressing interstitial popup");
    _this->CloseWhenReady();
  }
}
  • original() runs unconditionally → the view controller goes through its full initialization lifecycle, no empty screen, no unready-state crash.
  • CloseWhenReady() runs after initialization → closes the popup immediately after it appears, so the user never sees it.
  • The isFirstInterstitial one-shot flag is removed → suppression applies to all interstitials, not just the first.

Additional changes

  • Store offer popup suppression — new hook on ShopSceneManager.ShowPlcOfferPopup that drops the call when disable_first_popup is enabled. This popup type doesn't require lifecycle initialization, so skipping the call entirely is safe.
  • Consolidated ShopSceneManager lookup — the class was being resolved twice; now resolved once as static.
  • Updated example config comments (en, de, fr, nl) — disable_first_popup comment changed from "Prevent the first popup advert" to "Prevent ad/interstitial popups from appearing" to reflect that it now suppresses all such popups, not just the first.

How to verify

  1. With disable_first_popup = false (default) — all popups appear as before.
  2. Set disable_first_popup = true, restart:
    • Ad/interstitial popups should close immediately (look for InterstitialViewController_AboutToShow: suppressing interstitial popup in debug logs).
    • Store pack offers should not appear at all (look for ShopSceneManager_ShowPlcOfferPopup: suppressing PLC offer popup).

Risks

  • CloseWhenReady() is still called on every interstitial — while calling it after original() avoids the uninitialized-state crash, it has not been runtime-verified against all popup types. The setting is still marked ⚠️ EXPERIMENTAL in the config and defaults to false.
  • disable_first_popup semantics broadened — the setting previously (when it worked) only suppressed the first interstitial; it now suppresses all interstitials and store offers. The config comment has been updated accordingly.

Broaden the existing disable_first_popup from a single first-only interstitial
to suppress all ad/interstitial popups via InterstitialViewController.AboutToShow.
Add hooks for store pack offer popups (ShopSceneManager.ShowPlcOfferPopup), login
streak popups (LoginStreakManager.TryShowStreakPopupForGameSessionStarted), and
tutorial/hint popups (TutorialManager.ShowTutorialScreen, both no-arg and 2-arg
overloads) behind a new disable_tutorials config setting.

Both settings default to false and are documented in all four localized example
config files (en, de, fr, nl).
@netniV

netniV commented Aug 23, 2026

Copy link
Copy Markdown
Collaborator

Love that you fixed it, great job. Not sure we can merge this as my initial attempt at this was purely to suppress that first one that used to pop up when you signed in. It didn't suppress the rest, but now there's quite a few at times.

I feel this one becomes border-line for suppressing them all, so I'll not just say no. Instead, I'll ask for the opinions of our other regular contributors (feel free to add your own) ...

@Guffawaffle @lightbull-stfc @darbyjack @Bloody142 @ChronoXNL

@a5ehren

a5ehren commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

I'd almost rather have a setting to show the first one only and then suppress it afterwards?

@Bloody142

Copy link
Copy Markdown
Contributor

Agree with @a5ehren, I think blocking the reoccuring would be more okay. On game start (which will be quite often) it can still popup. but blocking the reoccuring probably would be already satisfying for most.

@GingerNinja-STFC

Copy link
Copy Markdown
Contributor Author

Seems reasonable, is added ✅

@Guffawaffle

Copy link
Copy Markdown
Contributor

I'm still a bit skeptical on this. Net, you have communication lines, I think I'd ask for approval first. This will be popular but maybe we can use it as a collab with scopes to find a balance that works for both the player and the company? Not sure, just concerned that scopes would frown upon it.

I do like the direction of show first, not rest though and I think this could gain traction with scopes.

@netniV
netniV merged commit b66f3df into STFC-Mod:dev Oct 10, 2026
6 checks passed
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.

5 participants