feat: redirect from mobile browser to app or appstore
This commit is contained in:
parent
622f96c29a
commit
26ff08cfef
4 changed files with 63 additions and 15 deletions
|
|
@ -108,6 +108,19 @@
|
|||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="*/*" />
|
||||
</intent-filter>
|
||||
|
||||
<intent-filter android:autoVerify="true">
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
||||
<data android:scheme="pangea" />
|
||||
<data android:host="app.pangea.chat" />
|
||||
</intent-filter>
|
||||
|
||||
<meta-data
|
||||
android:name="flutter_deeplinking_enabled"
|
||||
android:value="true" />
|
||||
</activity>
|
||||
|
||||
<activity
|
||||
|
|
|
|||
|
|
@ -28,6 +28,14 @@
|
|||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>pangea</string>
|
||||
</array>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>com.talktolearn.chat</string>
|
||||
</dict>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
|
|
@ -113,5 +121,7 @@
|
|||
<false/>
|
||||
<key>io.flutter.embedded_views_preview</key>
|
||||
<true/>
|
||||
<key>FlutterDeepLinkingEnabled</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.associated-domains</key>
|
||||
<array>
|
||||
<string>applinks:example.com</string>
|
||||
</array>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<!-- #Pangea -->
|
||||
<array>
|
||||
<string>group.com.talktolearn.chat</string>
|
||||
</array>
|
||||
<!-- Pangea# -->
|
||||
</dict>
|
||||
</plist>
|
||||
<dict>
|
||||
<key>aps-environment</key>
|
||||
<string>development</string>
|
||||
<key>com.apple.developer.associated-domains</key>
|
||||
<array>
|
||||
<string>applinks:app.pangea.chat</string>
|
||||
</array>
|
||||
<key>com.apple.security.application-groups</key>
|
||||
<array>
|
||||
<string>group.com.talktolearn.chat</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
|
|||
|
|
@ -70,6 +70,33 @@
|
|||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- #Pangea -->
|
||||
<script>
|
||||
(function() {
|
||||
const userAgent = navigator.userAgent || navigator.vendor || window.opera;
|
||||
const isAndroid = /android/i.test(userAgent);
|
||||
const isIOS = /iPhone|iPad|iPod/i.test(userAgent);
|
||||
const isMobile = isAndroid || isIOS;
|
||||
|
||||
if (!isMobile) return; // Exit if not a mobile device
|
||||
|
||||
const appScheme = 'pangea://'; // Replace with your app's scheme
|
||||
const fallbackURL = isIOS
|
||||
? 'https://apps.apple.com/app/pangea-chat/id1445118630'
|
||||
: 'https://play.google.com/store/apps/details?id=com.talktolearn.chat';
|
||||
|
||||
// Try opening the app
|
||||
window.location = appScheme;
|
||||
|
||||
// Fallback to App Store / Play Store if not installed
|
||||
setTimeout(() => {
|
||||
window.location = fallbackURL;
|
||||
}, 1500);
|
||||
})();
|
||||
</script>
|
||||
<!-- Pangea# -->
|
||||
|
||||
<picture id="splash">
|
||||
<!-- #Pangea -->
|
||||
<!-- <source
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue