Deep Linking and Sharing Implementation
June 23, 2025 ยท View on GitHub
This document describes the clean implementation of deep linking and sharing functionality in WiSaw, following Expo's modern best practices.
Architecture Overview
The implementation has been simplified and separated into two main modules:
- Linking Helper (
src/utils/linkingHelper.js) - Handles deep linking and navigation - Sharing Helper (
src/utils/sharingHelper.js) - Handles content sharing
Deep Linking
Configuration
iOS Universal Links are configured in app.config.js:
ios: {
associatedDomains: ['applinks:link.wisaw.com', 'applinks:wisaw.com'],
}
Android App Links are configured with simplified intent filters:
android: {
intentFilters: [
{
action: 'VIEW',
autoVerify: true,
data: [{ scheme: 'https', host: 'link.wisaw.com', pathPrefix: '/photos' }],
category: ['BROWSABLE', 'DEFAULT'],
},
// ... similar patterns for friends and both domains
],
}
Well-Known Files
- iOS:
public/.well-known/apple-app-site-association - Android:
public/.well-known/assetlinks.json
These files need to be deployed to your web server and properly configured with your:
- Apple Team ID and Bundle Identifier
- Android Package Name and SHA256 certificates
Supported URL Patterns
https://link.wisaw.com/photos/{photoId}https://wisaw.com/photos/{photoId}https://link.wisaw.com/friends/{friendshipUuid}https://wisaw.com/friends/{friendshipUuid}wisaw://photos/{photoId}(fallback)wisaw://friends/{friendshipUuid}(fallback)
Navigation Integration
The linking is integrated with React Navigation using the linkingConfig:
import { linkingConfig } from './src/utils/linkingHelper'
<NavigationContainer ref={navigationRef} linking={linkingConfig}>
Sharing
Content Creation
The createShareContent function generates appropriate sharing content for different contexts:
const content = createShareContent({
type: 'photo',
photo,
photoDetails,
})
Sharing Methods
- Native Share Sheet:
shareWithNativeSheet()- Uses React Native's built-in Share API - Specific Apps:
shareToSpecificApp()- Direct deep linking to specific social apps - SMS:
shareViaSMS()- Direct SMS sharing using Expo SMS - Comprehensive:
comprehensiveShare()- Smart sharing with fallbacks
Supported Apps
- Social: Facebook, Twitter, Instagram, TikTok, Snapchat, LinkedIn, Pinterest
- Messaging: WhatsApp, Telegram, iMessage, Slack, Discord
- Email: Gmail, Outlook
- Other: Reddit, YouTube
Benefits of the Clean Implementation
- Simplified Configuration: Removed Samsung-specific workarounds and complex intent filters
- Modern Best Practices: Follows Expo's recommended approach for Universal/App Links
- Separation of Concerns: Linking and sharing are handled by separate, focused modules
- Better Maintainability: Cleaner code structure and easier to extend
- Improved Performance: Less complex URL parsing and navigation logic
- Standards Compliance: Uses standard web and mobile linking patterns
Migration from Old Implementation
The old linkingAndSharingHelper.js file has been replaced with:
linkingHelper.js- Modern deep linking implementationsharingHelper.js- Clean sharing functionality
All imports have been updated to use the new modules while maintaining backward compatibility.
Testing
To test deep linking:
- Development: Use Expo CLI's linking testing
- iOS: Test with Safari and Messages app
- Android: Test with Chrome and various messaging apps
- Production: Verify well-known files are accessible
Deployment Notes
- Well-Known Files: Ensure both
.well-knownfiles are deployed and accessible - Certificate Fingerprints: Update
assetlinks.jsonwith actual SHA256 fingerprints - Apple Team ID: Update
apple-app-site-associationwith your actual Team ID - Domain Verification: Verify both domains properly serve the well-known files
Troubleshooting
- iOS: Check domain association in device settings
- Android: Verify app link verification in app info
- Both: Ensure well-known files return correct content-type (application/json for Android, any for iOS)
This implementation is more maintainable, standards-compliant, and should work reliably across all modern devices without device-specific workarounds.