Skip to content

BugFix - Unable to present when a VC is already presented#43

Open
hassaan4584 wants to merge 9 commits intoformbricks:mainfrom
hassaan4584:main
Open

BugFix - Unable to present when a VC is already presented#43
hassaan4584 wants to merge 9 commits intoformbricks:mainfrom
hassaan4584:main

Conversation

@hassaan4584
Copy link
Copy Markdown

  • Issue fixed where the survey would not be presented when there is a ViewController already presented

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 1, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 4 committers have signed the CLA.

✅ pandeymangg
❌ narjes
❌ narjes-abs
❌ hassaan4584


narjes seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 1, 2026

Walkthrough

This pull request updates FormbricksSDK to version 1.2.0 and refactors the survey presentation logic. The version bump updates the CocoaPods podspec and corresponding git tag reference. PresentSurveyManager.swift's present method now validates the key window and root view controller availability before proceeding. It introduces a helper method to traverse the view controller hierarchy and find the topmost controller for presentation, handles cases where controllers are already presenting, and implements guards to prevent presenting over existing presentations. The presenter is now dynamically selected based on view controller state rather than always using the root controller.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main bugfix: handling survey presentation when a ViewController is already presented, which aligns with the changes in PresentSurveyManager.swift.
Description check ✅ Passed The description directly relates to the changeset, explaining that it fixes an issue with survey presentation when a ViewController is already presented, which matches the implementation changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@Sources/FormbricksSDK/Manager/PresentSurveyManager.swift`:
- Around line 20-25: The helper topViewController(from:) can recurse infinitely
when a UINavigationController has visibleViewController == nil or a
UITabBarController has selectedViewController == nil because the current code
falls back to passing the container (navigation/tabBar) back into
topViewController; fix by checking for the child first (use guard/if let) and if
nil return the container itself (or its top-most child if appropriate) instead
of calling topViewController with the same container; update the branches that
reference UINavigationController.visibleViewController and
UITabBarController.selectedViewController to unwrap into a local
childViewController and only recurse when that child is non-nil.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 49fd7df7-0481-450f-b908-4be857ff926d

📥 Commits

Reviewing files that changed from the base of the PR and between 52a3175 and b7a6beb.

📒 Files selected for processing (2)
  • FormbricksSDK.podspec
  • Sources/FormbricksSDK/Manager/PresentSurveyManager.swift

Comment thread Sources/FormbricksSDK/Manager/PresentSurveyManager.swift Outdated
@mattinannt mattinannt requested a review from pandeymangg April 17, 2026 07:52
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.

4 participants