From 27f76600931963c686dbb7476765473bc0620ce1 Mon Sep 17 00:00:00 2001 From: Matiss Jurevics Date: Fri, 23 Jan 2026 20:10:16 +0000 Subject: [PATCH] feat: sharelinik --- app/share/[code]/page.tsx | 69 ++++++++++++++++++++++++++++++ public/.well-known/assetlinks.json | 14 ++++++ 2 files changed, 83 insertions(+) create mode 100644 app/share/[code]/page.tsx create mode 100644 public/.well-known/assetlinks.json diff --git a/app/share/[code]/page.tsx b/app/share/[code]/page.tsx new file mode 100644 index 0000000..f7ecdec --- /dev/null +++ b/app/share/[code]/page.tsx @@ -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 ( + <> + + Shared Deck | Nemia + + + +
+

Nemia Flashcards

+

Redirecting you to the app...

+

+ Go to Homepage +

+
+ + ); +} diff --git a/public/.well-known/assetlinks.json b/public/.well-known/assetlinks.json new file mode 100644 index 0000000..70a2d4b --- /dev/null +++ b/public/.well-known/assetlinks.json @@ -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" + ] + } + } +] \ No newline at end of file