Skip to content

fix: [duplicate] Unable to present when a VC is already presented#45

Open
pandeymangg wants to merge 9 commits intomainfrom
hassaan4584/main
Open

fix: [duplicate] Unable to present when a VC is already presented#45
pandeymangg wants to merge 9 commits intomainfrom
hassaan4584/main

Conversation

@pandeymangg
Copy link
Copy Markdown
Contributor

Duplicate of #43

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 8, 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
❌ hassaan4584
❌ narjes-abs


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 May 8, 2026

Review Change Stack

Walkthrough

This pull request modifies survey presentation and environment configuration in the Formbricks iOS SDK. The PresentSurveyManager is updated to present surveys from the app's topmost view controller rather than always from the window root, includes a helper method to traverse UIKit hierarchies, handles UIAlertController as a special case by aborting presentation, switches the modal presentation style from .overCurrentContext to .pageSheet, and adds lifecycle logging via a deinit method. Additionally, FormbricksEnvironment.getEnvironmentRequestEndpoint is refactored to assign the joined URL path to a local variable before returning.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing presentation issues when a view controller is already presented, which aligns with the PresentSurveyManager refactoring to use top-most view controller instead of root view controller.
Description check ✅ Passed The description 'Duplicate of #43' is related to the changeset as it explains the PR's purpose, though minimal in detail.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ 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.

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 current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Sources/FormbricksSDK/Manager/PresentSurveyManager.swift`:
- Around line 17-30: topMostViewController currently follows
viewController.presentedViewController even when that presented VC is
mid-dismissal; change the first branch in topMostViewController(from:) to skip
descending into a presented view controller that isBeingDismissed (i.e. guard
let presented = viewController.presentedViewController,
!presented.isBeingDismissed { return topMostViewController(from: presented) } ),
and if the presented VC is being dismissed return the current viewController so
we don't attempt to present on a mid‑dismissal VC.
🪄 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: 6ecc45a5-768e-4c16-9e28-59f29eacf1d8

📥 Commits

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

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

Comment thread Sources/FormbricksSDK/Manager/PresentSurveyManager.swift
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 8, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
22.5% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

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