Skip to content

feat: tvOS support for url_launcher - #23

Open
TheNoumanDev wants to merge 2 commits into
fluttertv:mainfrom
TheNoumanDev:feat/url-launcher-tvos
Open

feat: tvOS support for url_launcher#23
TheNoumanDev wants to merge 2 commits into
fluttertv:mainfrom
TheNoumanDev:feat/url-launcher-tvos

Conversation

@TheNoumanDev

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds url_launcher_tvos, the federated tvOS implementation of url_launcher, ported from url_launcher_ios 6.4.1. canLaunchUrl and external launchUrl work on tvOS via UIApplication.canOpenURL / open(_:options:); the in-app browser modes rely on SFSafariViewController (SafariServices), which does not exist on tvOS, so those are reported unsupported rather than crashing.

Closes #16.

Package(s) touched: url_launcher_tvos (new) + root README ports table.

How was it tested?

  • Ran the package's example/ app

  • Verified on tvOS simulator (version: 26.2)

  • Verified on a physical Apple TV (Apple TV 4K 3rd gen / tvOS 26.6)

  • dart analyze is clean for the package

  • All four Pigeon channels round-trip on the simulator with no MissingPluginException.

  • Real external launch confirmed two ways: on the simulator a registered app URL scheme launched a separate app (its AppDelegate logged the delivered URL); on a physical Apple TV 4K, launchUrl opened the App Store.

  • In-app browser modes throw PlatformException(no_ui_available); supportsMode returns false for them.

Versioning & changelog

  • version: set to 0.0.1 (new package)
  • Matching ## 0.0.1 entry at the top of CHANGELOG.md
  • Behaviour documented: in-app browser modes unsupported on tvOS
  • Semver 0.x: initial 0.0.1

Checklist

  • Only url_launcher_tvos files touched (+ the root README ports row, required by the R1 gate)
  • No secrets, absolute local paths, or TODO/debug leftovers
  • README.md documents the tvOS constraint (no in-app browser / no WebKit)
  • Sibling note below

Notes for reviewers

  • Generated Pigeon kept upstream-verbatim: messages.g.dart is byte-identical to 6.4.1; messages.g.swift differs only by the import gate (#if os(iOS) || os(tvOS)). The porter had wrapped UrlLauncherApiSetup.setUp in #if !os(tvOS) (it matched SFSafariViewController in a doc comment) — that would have unregistered every channel on tvOS; reverted.
  • Native divergence is minimal + honest: URLLaunchSession (SafariServices) is #if !os(tvOS); openUrlInSafariViewController returns .noUI and closeSafariViewController is a no-op on tvOS. canLaunchUrl / launchUrl are untouched, and Launcher.swift / ViewPresenter.swift are byte-identical to upstream.
  • Dart re-declares tvOS-honest supportsMode / supportsCloseForMode / platformDefault (this Dart runs only on tvOS, so no platform guards).
  • Ships both a podspec and tvos/Package.swift (SPM), matching the pure-Swift method-channel plugins from feat(spm): add Package.swift to the Swift method-channel plugins #1.
  • Version floor kept at the repo-standard flutter: >=3.13.0 — upstream 6.4.1 raised its floor to Flutter 3.38 / Dart 3.10 (in 6.4.0), but nothing in this tvOS slice needs it (it builds and dart analyzes clean on the lower floor), and it stays consistent with the sibling _tvos packages.
  • Note: on tvOS canLaunchUrl can return true for a web URL even when nothing handles it, so callers should rely on the launchUrl return value (documented in the README). This PR also removes url_launcher from the README's "Evaluated but not provided" table, since it is now provided.

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.

Port url_launcher to tvOS

1 participant