Skip to content

fix: Unable to present when a VC is already presented#43

Merged
mattinannt merged 9 commits into
formbricks:mainfrom
hassaan4584:main
May 12, 2026
Merged

fix: Unable to present when a VC is already presented#43
mattinannt merged 9 commits into
formbricks:mainfrom
hassaan4584:main

Conversation

@hassaan4584

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

@CLAassistant

CLAassistant commented Apr 1, 2026

Copy link
Copy Markdown

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

coderabbitai Bot commented Apr 1, 2026

Copy link
Copy Markdown

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
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.
Title check ✅ Passed The pull request title 'fix: Unable to present when a VC is already presented' directly and clearly summarizes the main change in PresentSurveyManager.swift, which adds logic to handle cases where a ViewController is already presented.

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

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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
@mattinannt mattinannt changed the title BugFix - Unable to present when a VC is already presented fix: Unable to present when a VC is already presented May 12, 2026
@mattinannt mattinannt merged commit 1d561fd into formbricks:main May 12, 2026
2 of 4 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