feat: add Medium deep link support#87
Conversation
📝 WalkthroughWalkthroughThis PR adds Medium platform support to the deep link generation system by introducing a new platform handler that detects Medium URLs and converts them into platform-specific deep links for iOS and Android devices. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/core/src/platforms/medium.ts`:
- Line 50: The iosDeepLink constant currently builds a custom-scheme URL
(`iosDeepLink = \`medium://${path}\``) which is unsupported by Medium; change
the logic that sets iosDeepLink so it uses the canonical HTTPS webUrl (the
Universal Link) instead of a medium:// scheme, and ensure the function that
returns platform-specific links (referencing iosDeepLink and webUrl) returns
either the webUrl (or null for explicitly unsupported platforms) rather than a
custom-scheme deep link; also remove any ad-hoc leading-slash stripping for iOS
because Universal Links use the standard web path.
🧹 Nitpick comments (1)
packages/core/src/platforms/medium.ts (1)
36-36:matchparameter is unused inbuild.The
buildmethod re-parses the URL fromwebUrlinstead of using the already-captured groups inmatch. While functionally correct, usingmatchgroups directly would be more consistent with theDeepLinkHandlerinterface contract and avoid redundant parsing.
|
@mdsaban Could you please review my PR |
🆕 What's Added
This PR introduces Medium deep-link support.
It enables opening Medium articles and profiles directly in the native Medium app when installed, with safe fallback to the web.
🔗 Supported URL patterns
https://medium.com/@username- User profileshttps://medium.com/@username/article-slug- User articleshttps://medium.com/publication-name/article-slug- Publication articleshttps://username.medium.com/article-slug- Custom domain articles🛠 Implementation details
mediumHandlerfollowing the existing handler patternmedium://scheme with path preservationintent://with packagecom.medium.readerand fallback URLmediumto Platform type union🧪 Testing
pnpm dev → localhost:5173)📝 Files Changed
packages/core/src/platforms/medium.ts- New handler implementationpackages/core/src/types.ts- Added 'medium' to Platform typepackages/core/src/platforms/index.ts- Exported mediumHandlerpackages/core/src/index.ts- Registered mediumHandler in handlers array🙌 Thank You @mdsaban
Happy to contribute Medium platform support to expand the library's coverage. Open to feedback and improvements!
Summary by CodeRabbit
New Features