feat: sharelinik

This commit is contained in:
2026-01-23 20:10:16 +00:00
parent 00d744f309
commit 27f7660093
2 changed files with 83 additions and 0 deletions

69
app/share/[code]/page.tsx Normal file
View File

@@ -0,0 +1,69 @@
"use client";
import { useEffect } from "react";
import Head from "next/head";
export default function SharePage({ params }: { params: { code: string } }) {
const code = params.code;
useEffect(() => {
const deepLink = "nemia://share/" + code;
const playStoreLink = "https://play.google.com/store/apps/details?id=app.nemia.android";
const waitlistLink = "https://nemia.app/waitlist";
const landingPage = "https://nemia.app";
const userAgent = navigator.userAgent || navigator.vendor || (window as any).opera;
// iOS Detection
if (/iPad|iPhone|iPod/.test(userAgent) && !(window as any).MSStream) {
window.location.href = waitlistLink;
return;
}
// Android Detection
if (/android/i.test(userAgent)) {
// Try to open the app via Intent Scheme
const intentUrl =
"intent://share/" +
code +
"#Intent;scheme=nemia;package=app.nemia.android;S.browser_fallback_url=" +
encodeURIComponent(landingPage) +
";end";
window.location.href = intentUrl;
// Fallback attempt (optional, if intent fails)
// setTimeout(() => {
// window.location.href = playStoreLink;
// }, 2000);
return;
}
// Desktop / Other: Stay on the page or redirect to landing
// window.location.href = landingPage;
}, [code]);
return (
<>
<Head>
<title>Shared Deck | Nemia</title>
<meta property="og:title" content="Join my Flashcard Deck on Nemia" />
<meta property="og:description" content="Click to view this deck in the Nemia app." />
</Head>
<div
style={{
display: "flex",
flexDirection: "column",
alignItems: "center",
paddingTop: "50px",
fontFamily: "sans-serif",
}}
>
<h1>Nemia Flashcards</h1>
<p>Redirecting you to the app...</p>
<p>
<a href="https://nemia.app">Go to Homepage</a>
</p>
</div>
</>
);
}

View File

@@ -0,0 +1,14 @@
[
{
"relation": [
"delegate_permission/common.handle_all_urls"
],
"target": {
"namespace": "android_app",
"package_name": "app.nemia.android",
"sha256_cert_fingerprints": [
"1A:BB:7F:59:1F:90:D2:12:44:8D:C5:B0:BF:46:52:72:7F:42:32:E5:31:90:5F:D8:DE:2A:80:D0:2E:87:E9:6A"
]
}
}
]