Skip to content

Comments

[Oztechan/CCC#4572] Fix iOS too often interstitial Ad issue#4573

Merged
mustafaozhan merged 1 commit intodevelopfrom
4572-Fix-iOS-too-often-interstitial-Ad-issue
Dec 29, 2025
Merged

[Oztechan/CCC#4572] Fix iOS too often interstitial Ad issue#4573
mustafaozhan merged 1 commit intodevelopfrom
4572-Fix-iOS-too-often-interstitial-Ad-issue

Conversation

@mustafaozhan
Copy link
Member

Resolves #4572

@mustafaozhan mustafaozhan requested a review from a team as a code owner December 29, 2025 22:18
Copilot AI review requested due to automatic review settings December 29, 2025 22:18
@mustafaozhan mustafaozhan merged commit b6c0d32 into develop Dec 29, 2025
11 of 12 checks passed
@mustafaozhan mustafaozhan deleted the 4572-Fix-iOS-too-often-interstitial-Ad-issue branch December 29, 2025 22:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR attempts to fix an issue where interstitial ads are shown too frequently on iOS by modifying the scene phase change handling logic in the Application.swift file. However, the changes appear to have unintended consequences.

Key changes:

  • Modified the log message in onScenePhaseChange (contains a typo)
  • Removed the conditional check that prevented onAppBackground() from being called during app foregrounding

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


private func onScenePhaseChange(phase: ScenePhase) {
logger.i(message: { "Application onChange scenePhase \(phase)" })
logger.i(message: { "Application onChange scenePhase ground \(phase)" })
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

The log message contains what appears to be a typo: "scenePhase ground" should likely be just "scenePhase" to match the original intent and maintain consistency with other log messages.

Suggested change
logger.i(message: { "Application onChange scenePhase ground \(phase)" })
logger.i(message: { "Application onChange scenePhase \(phase)" })

Copilot uses AI. Check for mistakes.
if scenePhase == .active {
observable.event.onAppBackground()
}
observable.event.onAppBackground()
Copy link

Copilot AI Dec 29, 2025

Choose a reason for hiding this comment

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

Removing the conditional check causes onAppBackground() to be called during BOTH backgrounding AND foregrounding transitions, which contradicts the PR's goal of fixing "too often interstitial Ad issue."

iOS scene phase lifecycle:

  • When backgrounding: active → inactive → background
  • When foregrounding: background → inactive → active

The old code correctly called onAppBackground() only during backgrounding (active → inactive). The new code calls it during foregrounding too (background → inactive), which will cancel the ad job immediately before onAppForeground() restarts it. This creates unnecessary churn and doesn't align with the Android implementation (which only calls onAppBackground in onPause).

The original conditional logic was correct. If the issue is that ads are showing too frequently, the fix should likely be in the ad timer configuration (interstitialAdPeriod/interstitialAdInitialDelay in MainViewModel.kt) rather than changing when onAppBackground() is called.

Copilot uses AI. Check for mistakes.
@codacy-production
Copy link

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
+0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (48c2709) 3319 1745 52.58%
Head commit (abeabff) 3319 (+0) 1745 (+0) 52.58% (+0.00%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#4573) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@codecov
Copy link

codecov bot commented Dec 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.63%. Comparing base (48c2709) to head (abeabff).
⚠️ Report is 1 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4573   +/-   ##
========================================
  Coverage    55.63%   55.63%           
========================================
  Files          169      169           
  Lines         3013     3013           
  Branches       445      445           
========================================
  Hits          1676     1676           
  Misses        1312     1312           
  Partials        25       25           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sonarqubecloud
Copy link

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.

Fix iOS too often interstitial Ad issue

1 participant