Skip to content

fix(ios): stop the unhandled-URL log mis-attributing deep-link breakage + add scene-delegate support (#2422)#2429

Open
realmeylisdev wants to merge 3 commits into
flutter-stripe:mainfrom
realmeylisdev:fix/2422-deeplink-diagnostic-and-scene-parity
Open

fix(ios): stop the unhandled-URL log mis-attributing deep-link breakage + add scene-delegate support (#2422)#2429
realmeylisdev wants to merge 3 commits into
flutter-stripe:mainfrom
realmeylisdev:fix/2422-deeplink-diagnostic-and-scene-parity

Conversation

@realmeylisdev

@realmeylisdev realmeylisdev commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Fixes #2422 (same confusion as #2137/#2158).

The debug log I added in #2290 backfired — it prints for every non-Stripe URL and reads like flutter_stripe ate the deep link, so people assume we're blocking app_links. We're not: we return false and the delegate chain keeps going. First commit makes the log only warn for your own Stripe urlScheme and say plainly we don't block other handlers, and adds a README section on coexisting with app_links/go_router.

Second commit is related: we were app-delegate-only, so on UISceneDelegate apps our redirect handling was only reached via the engine's app-delegate fallback, which a custom scene delegate can skip. Now we also register as a FlutterSceneLifeCycleDelegate. Those APIs need Flutter 3.38+, so I bumped the min Flutter — fine to drop that second commit or guard it differently if you'd rather not raise the floor.

I couldn't reproduce the reporter's app_links case without their setup. The log/doc change is behavior-preserving; the new scene handlers still return false for non-Stripe URLs, so other plugins are unaffected.

Summary by CodeRabbit

  • Breaking Changes

    • Minimum Flutter version requirement raised to 3.38.
  • Bug Fixes / Improvements

    • Improved iOS delivery of redirect/deep-link callbacks for scene-based apps.
    • Reduced noisy debug logging for unrelated URL callbacks.
    • Plugin no longer consumes non-Stripe URLs, improving coexistence with other deep-link handlers.
  • Documentation

    • New “Deep linking & coexistence” section with troubleshooting tips and example forwarding code.

…reakage (flutter-stripe#2422)

The debug log fired for every non-Stripe URL and read as if Stripe consumed it, which is what flutter-stripe#2422 was actually about. It now only warns for the app's own configured urlScheme and states plainly that flutter_stripe returns false and does not block other URL handlers/plugins. Adds a deep-linking coexistence section to the README and handleURLCallback docs.
…r UISceneDelegate (flutter-stripe#2422)

flutter_stripe was app-delegate-only, so under a UISceneDelegate app its openURL handling was only reached via the engine's app-delegate fallback, which a custom scene delegate can bypass and break Stripe redirect payments. Conform StripePlugin to FlutterSceneLifeCycleDelegate and addSceneDelegate. These APIs need Flutter >= 3.38, so the min Flutter is bumped from 3.0.
@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 989fa253-705c-4a40-876e-31426d805575

📥 Commits

Reviewing files that changed from the base of the PR and between 9baa7cd and e31b406.

📒 Files selected for processing (1)
  • packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift

📝 Walkthrough

Walkthrough

This PR registers StripePlugin as an iOS UISceneDelegate to receive redirect callbacks, narrows debug logging for unhandled URLs, adds documentation on coexistence with other deep-link plugins, and raises the minimum Flutter SDK to >=3.38.0.

Changes

Deep-Linking & Scene Delegate Coexistence

Layer / File(s) Summary
iOS Scene Delegate Registration and Callback Handling
packages/stripe_ios/ios/stripe_ios/Sources/stripe_ios/StripePlugin.swift
StripePlugin registers as a UISceneDelegate (registrar.addSceneDelegate(instance)), implements scene(_:openURLContexts:) and scene(_:continue:) to forward candidate URLs to StripeAPI.handleURLCallback(...), returns false for non-handled URLs, and limits DEBUG unhandled-URL logs to matching-scheme cases.
Documentation: Deep Linking & Coexistence Guide
README.md, packages/stripe/README.md, packages/stripe/lib/src/stripe.dart
Adds a README and API docs section explaining redirect-based returnURL flow, when flutter_stripe consumes vs. ignores URLs, common pitfalls (app_links UISceneDelegate support, FlutterDeepLinkingEnabled, scheme/returnURL mismatches), and a Dart snippet pointing to the example router-based forwarding approach.
Version Constraints and Release Notes
packages/stripe/pubspec.yaml, packages/stripe_ios/pubspec.yaml, packages/stripe/CHANGELOG.md, packages/stripe_ios/CHANGELOG.md
Bump minimum Flutter SDK to >=3.38.0 and add Unreleased changelog entries describing the breaking change, scene-delegate feature, and adjusted iOS logging semantics.
sequenceDiagram
  participant AppRouter
  participant UIScene
  participant StripeSceneDelegate
  participant StripeAPI

  AppRouter->>UIScene: Receive deep link (custom handler)
  UIScene->>StripeSceneDelegate: scene(_:openURLContexts:) / continueUserActivity
  StripeSceneDelegate->>StripeAPI: handleURLCallback(url)
  alt handled by Stripe
    StripeAPI-->>StripeSceneDelegate: true
  else not handled by Stripe
    StripeAPI-->>StripeSceneDelegate: false
    StripeSceneDelegate-->>AppRouter: allow other handlers to run
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~40 minutes

Suggested reviewers

  • jonasbark
  • remonh87

Poem

🐰 A rabbit hops through scenes at play,

Deep links now find their rightful way,
Stripe listens, forwards, then steps aside,
Other handlers can run with pride,
Hooray for links that no longer collide!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main changes: fixing the unhandled-URL log mis-attribution and adding scene-delegate support for iOS deep-link handling.
Linked Issues check ✅ Passed The PR successfully addresses all objectives from #2422: narrowed logging scope, documented coexistence with other deep-link plugins, added UISceneDelegate support, and explains Stripe returns false for non-Stripe URLs.
Out of Scope Changes check ✅ Passed All changes are directly related to the linked issue objectives: documentation additions, iOS plugin registration for scene delegates, logging improvements, and Flutter version bump for scene-lifecycle API support.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

…so iOS compiles (flutter-stripe#2422)

FlutterSceneLifeCycleDelegate imports scene:continueUserActivity: under the Swift name scene(_:continue:) (UIKit renames the selector). Implement the witness under exactly that name — matching how app_links does it — instead of a custom name + explicit selector, which the compiler rejected as a conflicting requirement.
@realmeylisdev realmeylisdev force-pushed the fix/2422-deeplink-diagnostic-and-scene-parity branch from 9baa7cd to e31b406 Compare June 13, 2026 14:31
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.

flutter_stripe DeepLinking blocking other DeepLinking plugins

1 participant