add shenyan-app RN project + PWA push/noise updates

This commit is contained in:
2026-05-13 17:38:35 +08:00
parent 66f94f0fcf
commit 4d7110c58d
82 changed files with 14677 additions and 124 deletions

63
PWA/package-lock.json generated
View File

@@ -2363,9 +2363,6 @@
"arm" "arm"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2380,9 +2377,6 @@
"arm" "arm"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2397,9 +2391,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2414,9 +2405,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2431,9 +2419,6 @@
"loong64" "loong64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2448,9 +2433,6 @@
"loong64" "loong64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2465,9 +2447,6 @@
"ppc64" "ppc64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2482,9 +2461,6 @@
"ppc64" "ppc64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2499,9 +2475,6 @@
"riscv64" "riscv64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2516,9 +2489,6 @@
"riscv64" "riscv64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2533,9 +2503,6 @@
"s390x" "s390x"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2550,9 +2517,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2567,9 +2531,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2793,9 +2754,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2813,9 +2771,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2833,9 +2788,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -2853,9 +2805,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -5015,9 +4964,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -5039,9 +4985,6 @@
"arm64" "arm64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -5063,9 +5006,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"glibc"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -5087,9 +5027,6 @@
"x64" "x64"
], ],
"dev": true, "dev": true,
"libc": [
"musl"
],
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [

View File

@@ -1,4 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<rect width="32" height="32" fill="#000" rx="6"/> <circle cx="50" cy="50" r="22" fill="none" stroke="#fff" stroke-width="3"/>
<text x="16" y="22" text-anchor="middle" fill="#fff" font-size="18" font-family="system-ui">E</text> <line x1="50" y1="12" x2="50" y2="24" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
</svg> <line x1="50" y1="76" x2="50" y2="88" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="12" y1="50" x2="24" y2="50" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="76" y1="50" x2="88" y2="50" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="23" y1="23" x2="32" y2="32" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="68" y1="68" x2="77" y2="77" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="23" y1="77" x2="32" y2="68" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="68" y1="23" x2="77" y2="32" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
</svg>

Before

Width:  |  Height:  |  Size: 223 B

After

Width:  |  Height:  |  Size: 915 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 187 B

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

After

Width:  |  Height:  |  Size: 12 KiB

26
PWA/public/sw-push.js Normal file
View File

@@ -0,0 +1,26 @@
self.addEventListener('push', function (event) {
var data = {};
try { data = event.data.json(); } catch (e) { data = { title: '沈晏', body: event.data ? event.data.text() : '' }; }
event.waitUntil(
self.registration.showNotification(data.title || '沈晏', {
body: data.body || '',
icon: '/icon-192.png',
badge: '/icon-192.png',
vibrate: [200, 100, 200],
tag: 'shenyan-push',
renotify: true,
})
);
});
self.addEventListener('notificationclick', function (event) {
event.notification.close();
event.waitUntil(
clients.matchAll({ type: 'window', includeUncontrolled: true }).then(function (list) {
for (var i = 0; i < list.length; i++) {
if (list[i].url && 'focus' in list[i]) return list[i].focus();
}
if (clients.openWindow) return clients.openWindow('/');
})
);
});

View File

@@ -0,0 +1,4 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M30 58 Q20 50 25 42 Q30 33 40 36 Q42 25 55 30 Q65 20 75 33 Q88 32 85 45 Q92 50 85 58 Q80 65 65 62 Q50 68 40 62 Z" fill="#fff" opacity="0.9"/>
<path d="M35 55 Q30 50 32 45 Q38 42 42 46 Q44 38 52 42 Q58 34 65 42 Q72 40 70 48 Q75 52 70 56 Q65 60 55 57 Q45 60 38 57 Z" fill="none" stroke="#fff" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 392 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<line x1="20" y1="55" x2="80" y2="55" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="25" y1="45" x2="75" y2="45" stroke="#fff" stroke-width="3" stroke-linecap="round" opacity="0.8"/>
<line x1="30" y1="65" x2="70" y2="65" stroke="#fff" stroke-width="3" stroke-linecap="round" opacity="0.6"/>
<line x1="22" y1="75" x2="78" y2="75" stroke="#fff" stroke-width="2.5" stroke-linecap="round" opacity="0.4"/>
</svg>

After

Width:  |  Height:  |  Size: 497 B

View File

@@ -0,0 +1,13 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="35" cy="40" r="18" fill="none" stroke="#fff" stroke-width="2.5"/>
<line x1="35" y1="8" x2="35" y2="18" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="35" y1="62" x2="35" y2="72" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="3" y1="40" x2="13" y2="40" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="57" y1="40" x2="67" y2="40" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="12" y1="17" x2="19" y2="24" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="51" y1="56" x2="58" y2="63" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="12" y1="63" x2="19" y2="56" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="51" y1="17" x2="58" y2="24" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<path d="M55 55 Q65 45 75 55 Q85 58 80 68 Q75 75 60 72 Q50 70 55 55" fill="#fff" opacity="0.8"/>
<path d="M58 68 Q65 63 72 68 Q75 72 70 75 Q62 78 58 75 Q55 72 58 68" fill="none" stroke="#fff" stroke-width="2"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,8 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M25 48 Q15 40 20 32 Q25 23 35 26 Q38 15 50 20 Q60 10 72 23 Q85 22 82 35 Q88 40 82 48 Q77 55 60 52 Q50 58 40 52 Z" fill="#fff" opacity="0.85"/>
<line x1="30" y1="62" x2="24" y2="78" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="45" y1="60" x2="39" y2="76" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="60" y1="62" x2="54" y2="78" stroke="#fff" stroke-width="2.5" stroke-linecap="round"/>
<line x1="52" y1="72" x2="46" y2="88" stroke="#fff" stroke-width="2" stroke-linecap="round" opacity="0.6"/>
<line x1="38" y1="70" x2="32" y2="86" stroke="#fff" stroke-width="2" stroke-linecap="round" opacity="0.6"/>
</svg>

After

Width:  |  Height:  |  Size: 737 B

View File

@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M25 45 Q15 37 20 29 Q25 20 35 23 Q38 12 50 17 Q60 7 72 20 Q85 19 82 32 Q88 37 82 45 Q77 52 60 49 Q50 55 40 49 Z" fill="#fff" opacity="0.8"/>
<circle cx="30" cy="65" r="2.5" fill="#fff"/>
<circle cx="42" cy="62" r="2.5" fill="#fff"/>
<circle cx="54" cy="65" r="2.5" fill="#fff"/>
<circle cx="66" cy="62" r="2.5" fill="#fff"/>
<circle cx="36" cy="75" r="2" fill="#fff" opacity="0.6"/>
<circle cx="50" cy="72" r="2" fill="#fff" opacity="0.6"/>
<circle cx="62" cy="75" r="2" fill="#fff" opacity="0.6"/>
<circle cx="44" cy="82" r="1.5" fill="#fff" opacity="0.4"/>
<circle cx="56" cy="80" r="1.5" fill="#fff" opacity="0.4"/>
</svg>

After

Width:  |  Height:  |  Size: 717 B

View File

@@ -0,0 +1,6 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<path d="M20 42 Q10 34 15 26 Q20 17 30 20 Q33 9 45 14 Q55 4 68 17 Q82 16 79 29 Q85 34 79 42 Q74 49 56 46 Q46 52 36 46 Z" fill="#fff" opacity="0.8"/>
<polygon points="53,48 42,58 48,58 38,72 52,58 46,58" fill="#fff" stroke="#fff" stroke-width="1.5" stroke-linejoin="round"/>
<line x1="32" y1="68" x2="26" y2="84" stroke="#fff" stroke-width="2" stroke-linecap="round" opacity="0.5"/>
<line x1="68" y1="65" x2="62" y2="81" stroke="#fff" stroke-width="2" stroke-linecap="round" opacity="0.5"/>
</svg>

After

Width:  |  Height:  |  Size: 567 B

View File

@@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100">
<circle cx="50" cy="50" r="22" fill="none" stroke="#fff" stroke-width="3"/>
<line x1="50" y1="12" x2="50" y2="24" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="50" y1="76" x2="50" y2="88" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="12" y1="50" x2="24" y2="50" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="76" y1="50" x2="88" y2="50" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="23" y1="23" x2="32" y2="32" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="68" y1="68" x2="77" y2="77" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="23" y1="77" x2="32" y2="68" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
<line x1="68" y1="23" x2="77" y2="32" stroke="#fff" stroke-width="3" stroke-linecap="round"/>
</svg>

After

Width:  |  Height:  |  Size: 915 B

View File

@@ -46,6 +46,29 @@ async function saveRemote(msgs: Message[]) {
} catch { /* silent */ } } catch { /* silent */ }
} }
async function setupPush() {
if (!('serviceWorker' in navigator) || !('PushManager' in window)) return
try {
const reg = await navigator.serviceWorker.ready
const existing = await reg.pushManager.getSubscription()
if (existing) return // already subscribed
const res = await fetch('/push/vapid-public-key')
const { key } = await res.json()
const sub = await reg.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: key,
})
await fetch('/push/subscribe', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(sub),
})
} catch { /* silent — user may have denied */ }
}
export default function App() { export default function App() {
const [messages, setMessages] = useState<Message[]>(loadLocal) const [messages, setMessages] = useState<Message[]>(loadLocal)
const [loading, setLoading] = useState(false) const [loading, setLoading] = useState(false)
@@ -59,14 +82,14 @@ export default function App() {
setMessages(remote) setMessages(remote)
nextId.current = Math.max(...remote.map(m => m.id)) + 1 nextId.current = Math.max(...remote.map(m => m.id)) + 1
} else { } else {
const local = loadLocal() if (messages.length > 0) {
if (local.length > 0) { nextId.current = Math.max(...messages.map(m => m.id)) + 1
nextId.current = Math.max(...local.map(m => m.id)) + 1 saveRemote(messages)
saveRemote(local)
} }
} }
setSynced(true) setSynced(true)
})() })()
setupPush()
}, []) }, [])
useEffect(() => { useEffect(() => {
@@ -105,14 +128,9 @@ export default function App() {
} }
} }
const handleClear = () => {
setMessages([])
localStorage.removeItem(STORAGE_KEY)
}
return ( return (
<div <div
className="flex flex-col h-full" className="flex flex-col h-full relative"
style={{ style={{
backgroundImage: 'url(/1.jpg)', backgroundImage: 'url(/1.jpg)',
backgroundSize: 'cover', backgroundSize: 'cover',
@@ -120,18 +138,6 @@ export default function App() {
backgroundAttachment: 'fixed', backgroundAttachment: 'fixed',
}} }}
> >
<header className="flex items-center justify-center pt-3 pb-2 flex-shrink-0 relative">
<span className="tracking-wide" style={{ color: '#999', fontSize: '4.35vw' }}></span>
{messages.length > 0 && (
<button
onClick={handleClear}
className="absolute right-4 text-xs"
style={{ color: 'rgba(255,255,255,0.25)' }}
>
</button>
)}
</header>
<ChatArea messages={messages} /> <ChatArea messages={messages} />
<InputArea onSend={handleSend} disabled={loading} /> <InputArea onSend={handleSend} disabled={loading} />
</div> </div>

View File

@@ -2,22 +2,24 @@ import { useRef, useEffect } from 'react'
import type { Message } from '../App' import type { Message } from '../App'
export default function ChatArea({ messages }: { messages: Message[] }) { export default function ChatArea({ messages }: { messages: Message[] }) {
const bottom = useRef<HTMLDivElement>(null) const container = useRef<HTMLDivElement>(null)
useEffect(() => { useEffect(() => {
bottom.current?.scrollIntoView({ behavior: 'smooth' }) if (container.current) {
container.current.scrollTop = container.current.scrollHeight
}
}, [messages]) }, [messages])
return ( return (
<div className="flex-1 overflow-y-auto no-scrollbar flex justify-center"> <div ref={container} className="flex-1 overflow-y-auto overflow-x-hidden no-scrollbar flex justify-center">
<div className="py-4 space-y-3" style={{ width: '90vw', maxWidth: 600 }}> <div className="py-4 flex flex-col" style={{ width: '90vw', maxWidth: 600, gap: 12 }}>
{messages.map((m) => ( {messages.map((m) => (
<div <div
key={m.id} key={m.id}
className={`flex ${m.role === 'user' ? 'justify-end' : 'justify-start'}`} className={`flex ${m.role === 'user' ? 'justify-end' : 'justify-start'}`}
> >
<div <div
className="max-w-[80%] rounded-2xl text-sm leading-relaxed" className="max-w-[80%] rounded-2xl text-sm leading-relaxed break-words"
style={{ style={{
backgroundColor: m.role === 'user' ? '#ffffffa1' : 'rgba(255,255,255,0.3)', backgroundColor: m.role === 'user' ? '#ffffffa1' : 'rgba(255,255,255,0.3)',
color: '#ffffff', color: '#ffffff',
@@ -32,7 +34,7 @@ export default function ChatArea({ messages }: { messages: Message[] }) {
</div> </div>
</div> </div>
))} ))}
<div ref={bottom} /> <div style={{ height: 'calc(25vw + 46px)', flexShrink: 0 }} />
</div> </div>
</div> </div>
) )

View File

@@ -12,11 +12,28 @@ export default function InputArea({ onSend, disabled }: { onSend: (text: string)
return ( return (
<div <div
className="flex-shrink-0 flex justify-center" className="absolute bottom-0 left-0 right-0 z-10 flex justify-center"
style={{ padding: 17, backdropFilter: 'blur(8px)', WebkitBackdropFilter: 'blur(8px)' }} style={{ padding: 17, backdropFilter: 'blur(8px)', WebkitBackdropFilter: 'blur(8px)' }}
> >
<div style={{ height: '25vw', width: '90vw', maxWidth: 600 }}> <div style={{ height: '25vw', width: '90vw', maxWidth: 600 }}>
<div className="w-full h-full relative"> <div className="w-full h-full relative">
<button
onClick={handleSubmit}
className="absolute rounded-lg"
style={{
right: '4.11vw',
bottom: '4.11vw',
backgroundColor: 'transparent',
color: '#ffffffd1',
fontSize: '3.38vw',
padding: '2vw 4vw',
border: '1px solid rgba(255,255,255,0.3)',
}}
>
Missio
</button>
<textarea <textarea
placeholder="输入" placeholder="输入"
value={value} value={value}
@@ -29,15 +46,8 @@ export default function InputArea({ onSend, disabled }: { onSend: (text: string)
}} }}
disabled={disabled} disabled={disabled}
className="w-full h-full rounded-xl outline-none resize-none" className="w-full h-full rounded-xl outline-none resize-none"
style={{ backgroundColor: '#2a2a2a', color: disabled ? '#555' : '#888', fontSize: '4.35vw', padding: '4.11vw' }} style={{ backgroundColor: '#ffffff3e', color: disabled ? '#ffffffbb' : '#fffffff0', fontSize: '4.35vw', padding: '4.11vw' }}
/> />
<button
onClick={handleSubmit}
className="absolute rounded-lg px-3 py-1"
style={{ right: '4.11vw', bottom: '4.11vw', backgroundColor: '#3a3a3a', color: '#999', fontSize: '3.38vw' }}
>
</button>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -1,18 +1,11 @@
@import "tailwindcss"; @import "tailwindcss";
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html, body, #root { html, body, #root {
height: 100%; height: 100%;
background: #000; background: #000;
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif; font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", sans-serif;
-webkit-font-smoothing: antialiased; -webkit-font-smoothing: antialiased;
overflow: hidden; overflow: hidden;
user-select: none;
} }
.no-scrollbar::-webkit-scrollbar { .no-scrollbar::-webkit-scrollbar {

32
PWA/src/sw.ts Normal file
View File

@@ -0,0 +1,32 @@
import { precacheAndRoute } from 'workbox-precaching'
declare let self: ServiceWorkerGlobalScope
precacheAndRoute(self.__WB_MANIFEST)
self.addEventListener('push', (event) => {
let data: { title?: string; body?: string } = {}
try { data = event.data?.json() ?? {} } catch { data = { body: event.data?.text() ?? '' } }
event.waitUntil(
self.registration.showNotification(data.title ?? '沈晏', {
body: data.body ?? '',
icon: '/icon-192.png',
badge: '/icon-192.png',
vibrate: [200, 100, 200],
tag: 'shenyan-push',
renotify: true,
})
)
})
self.addEventListener('notificationclick', (event) => {
event.notification.close()
event.waitUntil(
self.clients.matchAll({ type: 'window', includeUncontrolled: true }).then((list) => {
for (const client of list) {
if ('focus' in client) return client.focus()
}
return self.clients.openWindow('/')
})
)
})

View File

@@ -13,5 +13,6 @@
"noEmit": true, "noEmit": true,
"types": ["vite/client"] "types": ["vite/client"]
}, },
"include": ["src"] "include": ["src"],
"exclude": ["src/sw.ts"]
} }

View File

@@ -3,10 +3,20 @@ import react from '@vitejs/plugin-react'
import { VitePWA } from 'vite-plugin-pwa' import { VitePWA } from 'vite-plugin-pwa'
export default defineConfig({ export default defineConfig({
server: {
proxy: {
'/api': 'http://localhost:3001',
'/memory': 'http://localhost:3001',
'/push': 'http://localhost:3001',
},
},
plugins: [ plugins: [
react(), react(),
VitePWA({ VitePWA({
registerType: 'autoUpdate', registerType: 'autoUpdate',
strategies: 'injectManifest',
srcDir: 'src',
filename: 'sw.ts',
manifest: { manifest: {
name: 'Elec', name: 'Elec',
short_name: 'Elec', short_name: 'Elec',

View File

@@ -0,0 +1,2 @@
BUNDLE_PATH: "vendor/bundle"
BUNDLE_FORCE_RUBY_PLATFORM: 1

4
shenyan-app/.eslintrc.js Normal file
View File

@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native',
};

75
shenyan-app/.gitignore vendored Normal file
View File

@@ -0,0 +1,75 @@
# OSX
#
.DS_Store
# Xcode
#
build/
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
*.xccheckout
*.moved-aside
DerivedData
*.hmap
*.ipa
*.xcuserstate
**/.xcode.env.local
# Android/IntelliJ
#
build/
.idea
.gradle
local.properties
*.iml
*.hprof
.cxx/
*.keystore
!debug.keystore
.kotlin/
# node.js
#
node_modules/
npm-debug.log
yarn-error.log
# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/
**/fastlane/report.xml
**/fastlane/Preview.html
**/fastlane/screenshots
**/fastlane/test_output
# Bundle artifact
*.jsbundle
# Ruby / CocoaPods
**/Pods/
/vendor/bundle/
# Temporary files created by Metro to check the health of the file watcher
.metro-health-check*
# testing
/coverage
# Yarn
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

View File

@@ -0,0 +1,5 @@
module.exports = {
arrowParens: 'avoid',
singleQuote: true,
trailingComma: 'all',
};

View File

@@ -0,0 +1 @@
{}

17
shenyan-app/Gemfile Normal file
View File

@@ -0,0 +1,17 @@
source 'https://rubygems.org'
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
ruby ">= 2.6.10"
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
gem 'xcodeproj', '< 1.26.0'
gem 'concurrent-ruby', '< 1.3.4'
# Ruby 3.4.0 has removed some libraries from the standard library.
gem 'bigdecimal'
gem 'logger'
gem 'benchmark'
gem 'mutex_m'
gem 'nkf'

97
shenyan-app/README.md Normal file
View File

@@ -0,0 +1,97 @@
This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
# Getting Started
> **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
## Step 1: Start Metro
First, you will need to run **Metro**, the JavaScript build tool for React Native.
To start the Metro dev server, run the following command from the root of your React Native project:
```sh
# Using npm
npm start
# OR using Yarn
yarn start
```
## Step 2: Build and run your app
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
### Android
```sh
# Using npm
npm run android
# OR using Yarn
yarn android
```
### iOS
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
```sh
bundle install
```
Then, and every time you update your native dependencies, run:
```sh
bundle exec pod install
```
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
```sh
# Using npm
npm run ios
# OR using Yarn
yarn ios
```
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
This is one way to run your app — you can also build it directly from Android Studio or Xcode.
## Step 3: Modify your app
Now that you have successfully run the app, let's make changes!
Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
- **Android**: Press the <kbd>R</kbd> key twice or select **"Reload"** from the **Dev Menu**, accessed via <kbd>Ctrl</kbd> + <kbd>M</kbd> (Windows/Linux) or <kbd>Cmd ⌘</kbd> + <kbd>M</kbd> (macOS).
- **iOS**: Press <kbd>R</kbd> in iOS Simulator.
## Congratulations! :tada:
You've successfully run and modified your React Native App. :partying_face:
### Now what?
- If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
- If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
# Troubleshooting
If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
# Learn More
To learn more about React Native, take a look at the following resources:
- [React Native Website](https://reactnative.dev) - learn more about React Native.
- [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
- [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
- [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
- [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.

View File

@@ -0,0 +1,13 @@
/**
* @format
*/
import React from 'react';
import ReactTestRenderer from 'react-test-renderer';
import App from '../App';
test('renders correctly', async () => {
await ReactTestRenderer.act(() => {
ReactTestRenderer.create(<App />);
});
});

View File

@@ -0,0 +1,119 @@
apply plugin: "com.android.application"
apply plugin: "org.jetbrains.kotlin.android"
apply plugin: "com.facebook.react"
/**
* This is the configuration block to customize your React Native Android app.
* By default you don't need to apply any configuration, just uncomment the lines you need.
*/
react {
/* Folders */
// The root of your project, i.e. where "package.json" lives. Default is '../..'
// root = file("../../")
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
// reactNativeDir = file("../../node_modules/react-native")
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
// codegenDir = file("../../node_modules/@react-native/codegen")
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
// cliFile = file("../../node_modules/react-native/cli.js")
/* Variants */
// The list of variants to that are debuggable. For those we're going to
// skip the bundling of the JS bundle and the assets. Default is "debug", "debugOptimized".
// If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
// debuggableVariants = ["liteDebug", "liteDebugOptimized", "prodDebug", "prodDebugOptimized"]
/* Bundling */
// A list containing the node command and its flags. Default is just 'node'.
// nodeExecutableAndArgs = ["node"]
//
// The command to run when bundling. By default is 'bundle'
// bundleCommand = "ram-bundle"
//
// The path to the CLI configuration file. Default is empty.
// bundleConfig = file(../rn-cli.config.js)
//
// The name of the generated asset file containing your JS bundle
// bundleAssetName = "MyApplication.android.bundle"
//
// The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
// entryFile = file("../js/MyApplication.android.js")
//
// A list of extra flags to pass to the 'bundle' commands.
// See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
// extraPackagerArgs = []
/* Hermes Commands */
// The hermes compiler command to run. By default it is 'hermesc'
// hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
//
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
// hermesFlags = ["-O", "-output-source-map"]
/* Autolinking */
autolinkLibrariesWithApp()
}
/**
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
*/
def enableProguardInReleaseBuilds = false
/**
* The preferred build flavor of JavaScriptCore (JSC)
*
* For example, to use the international variant, you can use:
* `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+`
*
* The international variant includes ICU i18n library and necessary data
* allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
* give correct results when using with locales other than en-US. Note that
* this variant is about 6MiB larger per architecture than default.
*/
def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+'
android {
ndkVersion rootProject.ext.ndkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
compileSdk rootProject.ext.compileSdkVersion
namespace "com.shenyanapp"
defaultConfig {
applicationId "com.shenyanapp"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName "1.0"
}
signingConfigs {
debug {
storeFile file('debug.keystore')
storePassword 'android'
keyAlias 'androiddebugkey'
keyPassword 'android'
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
// Caution! In production, you need to generate your own keystore file.
// see https://reactnative.dev/docs/signed-apk-android.
signingConfig signingConfigs.debug
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
}
dependencies {
// The version of react-native is set by the React Native Gradle Plugin
implementation("com.facebook.react:react-android")
if (hermesEnabled.toBoolean()) {
implementation("com.facebook.react:hermes-android")
} else {
implementation jscFlavor
}
}

Binary file not shown.

View File

@@ -0,0 +1,10 @@
# Add project specific ProGuard rules here.
# By default, the flags in this file are appended to flags specified
# in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# Add any project specific keep options here:

View File

@@ -0,0 +1,28 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:name=".MainApplication"
android:label="@string/app_name"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="${usesCleartextTraffic}"
android:networkSecurityConfig="@xml/network_security_config"
android:supportsRtl="true">
<activity
android:name=".MainActivity"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustResize"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,22 @@
package com.shenyanapp
import com.facebook.react.ReactActivity
import com.facebook.react.ReactActivityDelegate
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
import com.facebook.react.defaults.DefaultReactActivityDelegate
class MainActivity : ReactActivity() {
/**
* Returns the name of the main component registered from JavaScript. This is used to schedule
* rendering of the component.
*/
override fun getMainComponentName(): String = "ShenYanApp"
/**
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
*/
override fun createReactActivityDelegate(): ReactActivityDelegate =
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
}

View File

@@ -0,0 +1,27 @@
package com.shenyanapp
import android.app.Application
import com.facebook.react.PackageList
import com.facebook.react.ReactApplication
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeApplicationEntryPoint.loadReactNative
import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
class MainApplication : Application(), ReactApplication {
override val reactHost: ReactHost by lazy {
getDefaultReactHost(
context = applicationContext,
packageList =
PackageList(this).packages.apply {
// Packages that cannot be autolinked yet can be added manually here, for example:
// add(MyReactNativePackage())
},
)
}
override fun onCreate() {
super.onCreate()
loadReactNative(this)
}
}

View File

@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<inset xmlns:android="http://schemas.android.com/apk/res/android"
android:insetLeft="@dimen/abc_edit_text_inset_horizontal_material"
android:insetRight="@dimen/abc_edit_text_inset_horizontal_material"
android:insetTop="@dimen/abc_edit_text_inset_top_material"
android:insetBottom="@dimen/abc_edit_text_inset_bottom_material"
>
<selector>
<!--
This file is a copy of abc_edit_text_material (https://bit.ly/3k8fX7I).
The item below with state_pressed="false" and state_focused="false" causes a NullPointerException.
NullPointerException:tempt to invoke virtual method 'android.graphics.drawable.Drawable android.graphics.drawable.Drawable$ConstantState.newDrawable(android.content.res.Resources)'
<item android:state_pressed="false" android:state_focused="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
For more info, see https://bit.ly/3CdLStv (react-native/pull/29452) and https://bit.ly/3nxOMoR.
-->
<item android:state_enabled="false" android:drawable="@drawable/abc_textfield_default_mtrl_alpha"/>
<item android:drawable="@drawable/abc_textfield_activated_mtrl_alpha"/>
</selector>
</inset>

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@@ -0,0 +1,3 @@
<resources>
<string name="app_name">ShenYanApp</string>
</resources>

View File

@@ -0,0 +1,9 @@
<resources>
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:editTextBackground">@drawable/rn_edit_text_material</item>
</style>
</resources>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">101.36.73.102</domain>
</domain-config>
</network-security-config>

View File

@@ -0,0 +1,21 @@
buildscript {
ext {
buildToolsVersion = "36.0.0"
minSdkVersion = 24
compileSdkVersion = 36
targetSdkVersion = 36
ndkVersion = "27.1.12297006"
kotlinVersion = "2.1.20"
}
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle")
classpath("com.facebook.react:react-native-gradle-plugin")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
}
}
apply plugin: "com.facebook.react.rootproject"

View File

@@ -0,0 +1,44 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=true
# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
# Use this property to enable edge-to-edge display support.
# This allows your app to draw behind system bars for an immersive UI.
# Note: Only works with ReactActivity and should not be used with custom Activity.
edgeToEdgeEnabled=false

Binary file not shown.

View File

@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

248
shenyan-app/android/gradlew vendored Executable file
View File

@@ -0,0 +1,248 @@
#!/bin/sh
#
# Copyright © 2015 the original authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
#
# Important for running:
#
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
# noncompliant, but you have some other compliant shell such as ksh or
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
# (2) This script targets any POSIX shell, so it avoids extensions provided
# by Bash, Ksh, etc; in particular arrays are avoided.
#
# The "traditional" practice of packing multiple parameters into a
# space-separated string is a well documented source of bugs and security
# problems, so this is (mostly) avoided, by progressively accumulating
# options in "$@", and eventually passing that to Java.
#
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
# see the in-line comments for details.
#
# There are tweaks for specific operating systems such as AIX, CygWin,
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
#
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
app_path=$0
# Need this for daisy-chained symlinks.
while
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
[ -h "$app_path" ]
do
ls=$( ls -ld "$app_path" )
link=${ls#*' -> '}
case $link in #(
/*) app_path=$link ;; #(
*) app_path=$APP_HOME$link ;;
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
warn () {
echo "$*"
} >&2
die () {
echo
echo "$*"
echo
exit 1
} >&2
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "$( uname )" in #(
CYGWIN* ) cygwin=true ;; #(
Darwin* ) darwin=true ;; #(
MSYS* | MINGW* ) msys=true ;; #(
NONSTOP* ) nonstop=true ;;
esac
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD=$JAVA_HOME/jre/sh/java
else
JAVACMD=$JAVA_HOME/bin/java
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD=java
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
fi
# Collect all arguments for the java command, stacking in reverse order:
# * args from the command line
# * the main class name
# * -classpath
# * -D...appname settings
# * --module-path (only if needed)
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
# For Cygwin or MSYS, switch paths to Windows format before running java
if "$cygwin" || "$msys" ; then
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
JAVACMD=$( cygpath --unix "$JAVACMD" )
# Now convert the arguments - kludge to limit ourselves to /bin/sh
for arg do
if
case $arg in #(
-*) false ;; # don't mess with options #(
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
[ -e "$t" ] ;; #(
*) false ;;
esac
then
arg=$( cygpath --path --ignore --mixed "$arg" )
fi
# Roll the args list around exactly as many times as the number of
# args, so each arg winds up back in the position where it started, but
# possibly modified.
#
# NB: a `for` loop captures its iteration list before it begins, so
# changing the positional parameters here affects neither the number of
# iterations, nor the values presented in `arg`.
shift # remove old arg
set -- "$@" "$arg" # push replacement arg
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \
-jar "$APP_HOME/gradle/wrapper/gradle-wrapper.jar" \
"$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
#
# In Bash we could simply go:
#
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
# set -- "${ARGS[@]}" "$@"
#
# but POSIX shell has neither arrays nor command substitution, so instead we
# post-process each arg (as a line of input to sed) to backslash-escape any
# character that might be a shell metacharacter, then use eval to reverse
# that process (while maintaining the separation between arguments), and wrap
# the whole thing up as a single "set" statement.
#
# This will of course break if any of these variables contains a newline or
# an unmatched quote.
#
eval "set -- $(
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
xargs -n1 |
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
tr '\n' ' '
)" '"$@"'
exec "$JAVACMD" "$@"

98
shenyan-app/android/gradlew.bat vendored Normal file
View File

@@ -0,0 +1,98 @@
@REM Copyright (c) Meta Platforms, Inc. and affiliates.
@REM
@REM This source code is licensed under the MIT license found in the
@REM LICENSE file in the root directory of this source tree.
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo. 1>&2
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
echo. 1>&2
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
echo location of your Java installation. 1>&2
goto fail
:execute
@rem Setup the command line
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %*
:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

View File

@@ -0,0 +1,6 @@
pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }
extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
rootProject.name = 'ShenYanApp'
include ':app'
includeBuild('../node_modules/@react-native/gradle-plugin')

4
shenyan-app/app.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "ShenYanApp",
"displayName": "ShenYanApp"
}

View File

@@ -0,0 +1,3 @@
module.exports = {
presets: ['module:@react-native/babel-preset'],
};

9
shenyan-app/index.js Normal file
View File

@@ -0,0 +1,9 @@
/**
* @format
*/
import { AppRegistry } from 'react-native';
import App from './src/App';
import { name as appName } from './app.json';
AppRegistry.registerComponent(appName, () => App);

View File

@@ -0,0 +1,11 @@
# This `.xcode.env` file is versioned and is used to source the environment
# used when running script phases inside Xcode.
# To customize your local environment, you can create an `.xcode.env.local`
# file that is not versioned.
# NODE_BINARY variable contains the PATH to the node executable.
#
# Customize the NODE_BINARY variable here.
# For example, to use nvm with brew, add the following line
# . "$(brew --prefix nvm)/nvm.sh" --no-use
export NODE_BINARY=$(command -v node)

34
shenyan-app/ios/Podfile Normal file
View File

@@ -0,0 +1,34 @@
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip
platform :ios, min_ios_version_supported
prepare_react_native_project!
linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
target 'ShenYanApp' do
config = use_native_modules!
use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)
post_install do |installer|
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end

View File

@@ -0,0 +1,475 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
0C80B921A6F3F58F76C31292 /* libPods-ShenYanApp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-ShenYanApp.a */; };
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
13B07F961A680F5B00A75B9A /* ShenYanApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ShenYanApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = ShenYanApp/Images.xcassets; sourceTree = "<group>"; };
13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = ShenYanApp/Info.plist; sourceTree = "<group>"; };
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = ShenYanApp/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
3B4392A12AC88292D35C810B /* Pods-ShenYanApp.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShenYanApp.debug.xcconfig"; path = "Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp.debug.xcconfig"; sourceTree = "<group>"; };
5709B34CF0A7D63546082F79 /* Pods-ShenYanApp.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShenYanApp.release.xcconfig"; path = "Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp.release.xcconfig"; sourceTree = "<group>"; };
5DCACB8F33CDC322A6C60F78 /* libPods-ShenYanApp.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ShenYanApp.a"; sourceTree = BUILT_PRODUCTS_DIR; };
761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = ShenYanApp/AppDelegate.swift; sourceTree = "<group>"; };
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = ShenYanApp/LaunchScreen.storyboard; sourceTree = "<group>"; };
ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
0C80B921A6F3F58F76C31292 /* libPods-ShenYanApp.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
13B07FAE1A68108700A75B9A /* ShenYanApp */ = {
isa = PBXGroup;
children = (
13B07FB51A68108700A75B9A /* Images.xcassets */,
761780EC2CA45674006654EE /* AppDelegate.swift */,
13B07FB61A68108700A75B9A /* Info.plist */,
81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
);
name = ShenYanApp;
sourceTree = "<group>";
};
2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
isa = PBXGroup;
children = (
ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
5DCACB8F33CDC322A6C60F78 /* libPods-ShenYanApp.a */,
);
name = Frameworks;
sourceTree = "<group>";
};
832341AE1AAA6A7D00B99B32 /* Libraries */ = {
isa = PBXGroup;
children = (
);
name = Libraries;
sourceTree = "<group>";
};
83CBB9F61A601CBA00E9B192 = {
isa = PBXGroup;
children = (
13B07FAE1A68108700A75B9A /* ShenYanApp */,
832341AE1AAA6A7D00B99B32 /* Libraries */,
83CBBA001A601CBA00E9B192 /* Products */,
2D16E6871FA4F8E400B85C8A /* Frameworks */,
BBD78D7AC51CEA395F1C20DB /* Pods */,
);
indentWidth = 2;
sourceTree = "<group>";
tabWidth = 2;
usesTabs = 0;
};
83CBBA001A601CBA00E9B192 /* Products */ = {
isa = PBXGroup;
children = (
13B07F961A680F5B00A75B9A /* ShenYanApp.app */,
);
name = Products;
sourceTree = "<group>";
};
BBD78D7AC51CEA395F1C20DB /* Pods */ = {
isa = PBXGroup;
children = (
3B4392A12AC88292D35C810B /* Pods-ShenYanApp.debug.xcconfig */,
5709B34CF0A7D63546082F79 /* Pods-ShenYanApp.release.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
13B07F861A680F5B00A75B9A /* ShenYanApp */ = {
isa = PBXNativeTarget;
buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ShenYanApp" */;
buildPhases = (
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
13B07F871A680F5B00A75B9A /* Sources */,
13B07F8C1A680F5B00A75B9A /* Frameworks */,
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
);
buildRules = (
);
dependencies = (
);
name = ShenYanApp;
productName = ShenYanApp;
productReference = 13B07F961A680F5B00A75B9A /* ShenYanApp.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
83CBB9F71A601CBA00E9B192 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1210;
TargetAttributes = {
13B07F861A680F5B00A75B9A = {
LastSwiftMigration = 1120;
};
};
};
buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ShenYanApp" */;
compatibilityVersion = "Xcode 12.0";
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = 83CBB9F61A601CBA00E9B192;
productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
projectDirPath = "";
projectRoot = "";
targets = (
13B07F861A680F5B00A75B9A /* ShenYanApp */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
13B07F8E1A680F5B00A75B9A /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
"$(SRCROOT)/.xcode.env.local",
"$(SRCROOT)/.xcode.env",
);
name = "Bundle React Native code and images";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"\\\"$WITH_ENVIRONMENT\\\" \\\"$REACT_NATIVE_XCODE\\\"\"\n";
};
00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-ShenYanApp-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-ShenYanApp/Pods-ShenYanApp-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
13B07F871A680F5B00A75B9A /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
761780ED2CA45674006654EE /* AppDelegate.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
13B07F941A680F5B00A75B9A /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-ShenYanApp.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = ShenYanApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ShenYanApp;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Debug;
};
13B07F951A680F5B00A75B9A /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-ShenYanApp.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = 1;
INFOPLIST_FILE = ShenYanApp/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
MARKETING_VERSION = 1.0;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
"-lc++",
);
PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = ShenYanApp;
SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
};
name = Release;
};
83CBBA201A601CBA00E9B192 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DFOLLY_NO_CONFIG",
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
SDKROOT = iphoneos;
};
name = Debug;
};
83CBBA211A601CBA00E9B192 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++20";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 15.1;
LD_RUNPATH_SEARCH_PATHS = (
/usr/lib/swift,
"$(inherited)",
);
LIBRARY_SEARCH_PATHS = (
"\"$(SDKROOT)/usr/lib/swift\"",
"\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
"\"$(inherited)\"",
);
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_CPLUSPLUSFLAGS = (
"$(OTHER_CFLAGS)",
"-DFOLLY_NO_CONFIG",
"-DFOLLY_MOBILE=1",
"-DFOLLY_USE_LIBCPP=1",
"-DFOLLY_CFG_NO_COROUTINES=1",
"-DFOLLY_HAVE_CLOCK_GETTIME=1",
);
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "ShenYanApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
13B07F941A680F5B00A75B9A /* Debug */,
13B07F951A680F5B00A75B9A /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "ShenYanApp" */ = {
isa = XCConfigurationList;
buildConfigurations = (
83CBBA201A601CBA00E9B192 /* Debug */,
83CBBA211A601CBA00E9B192 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
}

View File

@@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1210"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ShenYanApp.app"
BlueprintName = "ShenYanApp"
ReferencedContainer = "container:ShenYanApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "00E356ED1AD99517003FC87E"
BuildableName = "ShenYanAppTests.xctest"
BlueprintName = "ShenYanAppTests"
ReferencedContainer = "container:ShenYanApp.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ShenYanApp.app"
BlueprintName = "ShenYanApp"
ReferencedContainer = "container:ShenYanApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "ShenYanApp.app"
BlueprintName = "ShenYanApp"
ReferencedContainer = "container:ShenYanApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@@ -0,0 +1,48 @@
import UIKit
import React
import React_RCTAppDelegate
import ReactAppDependencyProvider
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
var reactNativeDelegate: ReactNativeDelegate?
var reactNativeFactory: RCTReactNativeFactory?
func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil
) -> Bool {
let delegate = ReactNativeDelegate()
let factory = RCTReactNativeFactory(delegate: delegate)
delegate.dependencyProvider = RCTAppDependencyProvider()
reactNativeDelegate = delegate
reactNativeFactory = factory
window = UIWindow(frame: UIScreen.main.bounds)
factory.startReactNative(
withModuleName: "ShenYanApp",
in: window,
launchOptions: launchOptions
)
return true
}
}
class ReactNativeDelegate: RCTDefaultReactNativeFactoryDelegate {
override func sourceURL(for bridge: RCTBridge) -> URL? {
self.bundleURL()
}
override func bundleURL() -> URL? {
#if DEBUG
RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
}
}

View File

@@ -0,0 +1,53 @@
{
"images" : [
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "20x20"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "29x29"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "40x40"
},
{
"idiom" : "iphone",
"scale" : "2x",
"size" : "60x60"
},
{
"idiom" : "iphone",
"scale" : "3x",
"size" : "60x60"
},
{
"idiom" : "ios-marketing",
"scale" : "1x",
"size" : "1024x1024"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View File

@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}

View File

@@ -0,0 +1,59 @@
<?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>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleDisplayName</key>
<string>ShenYanApp</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>NSAppTransportSecurity</key>
<dict>
<!-- Do not change NSAllowsArbitraryLoads to true, or you will risk app rejection! -->
<key>NSAllowsArbitraryLoads</key>
<false/>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string></string>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>arm64</string>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
</array>
<key>UISupportedInterfaceOrientations~ipad</key>
<array>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationPortraitUpsideDown</string>
</array>
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
</dict>
</plist>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15702" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina4_7" orientation="portrait" appearance="light"/>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15704"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ShenYanApp" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="0.0" y="202" width="375" height="43"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="36"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Powered by React Native" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" minimumFontSize="9" translatesAutoresizingMaskIntoConstraints="NO" id="MN2-I3-ftu">
<rect key="frame" x="0.0" y="626" width="375" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" systemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
<constraints>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="bottom" secondItem="MN2-I3-ftu" secondAttribute="bottom" constant="20" id="OZV-Vh-mqD"/>
<constraint firstItem="Bcu-3y-fUS" firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="MN2-I3-ftu" firstAttribute="centerX" secondItem="Bcu-3y-fUS" secondAttribute="centerX" id="akx-eg-2ui"/>
<constraint firstItem="MN2-I3-ftu" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" id="i1E-0Y-4RG"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="leading" secondItem="Bcu-3y-fUS" secondAttribute="leading" symbolic="YES" id="x7j-FC-K8j"/>
</constraints>
<viewLayoutGuide key="safeArea" id="Bcu-3y-fUS"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="52.173913043478265" y="375"/>
</scene>
</scenes>
</document>

View File

@@ -0,0 +1,37 @@
<?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>NSPrivacyAccessedAPITypes</key>
<array>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryFileTimestamp</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>C617.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategoryUserDefaults</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>CA92.1</string>
</array>
</dict>
<dict>
<key>NSPrivacyAccessedAPIType</key>
<string>NSPrivacyAccessedAPICategorySystemBootTime</string>
<key>NSPrivacyAccessedAPITypeReasons</key>
<array>
<string>35F9.1</string>
</array>
</dict>
</array>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyTracking</key>
<false/>
</dict>
</plist>

View File

@@ -0,0 +1,3 @@
module.exports = {
preset: '@react-native/jest-preset',
};

View File

@@ -0,0 +1,11 @@
const { getDefaultConfig, mergeConfig } = require('@react-native/metro-config');
/**
* Metro configuration
* https://reactnative.dev/docs/metro
*
* @type {import('@react-native/metro-config').MetroConfig}
*/
const config = {};
module.exports = mergeConfig(getDefaultConfig(__dirname), config);

12183
shenyan-app/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

44
shenyan-app/package.json Normal file
View File

@@ -0,0 +1,44 @@
{
"name": "ShenYanApp",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"@react-native-async-storage/async-storage": "^3.0.2",
"@react-native/new-app-screen": "0.85.3",
"axios": "^1.16.0",
"react": "19.2.3",
"react-native": "0.85.3",
"react-native-safe-area-context": "^5.5.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native-community/cli": "20.1.0",
"@react-native-community/cli-platform-android": "20.1.0",
"@react-native-community/cli-platform-ios": "20.1.0",
"@react-native/babel-preset": "0.85.3",
"@react-native/eslint-config": "0.85.3",
"@react-native/jest-preset": "0.85.3",
"@react-native/metro-config": "0.85.3",
"@react-native/typescript-config": "0.85.3",
"@types/jest": "^29.5.13",
"@types/react": "^19.2.0",
"@types/react-test-renderer": "^19.1.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.2.3",
"typescript": "^5.8.3"
},
"engines": {
"node": ">= 22.11.0"
}
}

115
shenyan-app/src/App.tsx Normal file
View File

@@ -0,0 +1,115 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { StatusBar, StyleSheet, View } from 'react-native';
import { SafeAreaProvider, SafeAreaView } from 'react-native-safe-area-context';
import ChatArea from './components/ChatArea';
import InputArea from './components/InputArea';
import { fetchHistory, sendMessage, syncHistory } from './api';
import { loadMessages, mergeMessages, saveMessages } from './storage';
import type { Message } from './types';
export default function App() {
const [messages, setMessages] = useState<Message[]>([]);
const [loading, setLoading] = useState(false);
const [synced, setSynced] = useState(false);
const [refreshing, setRefreshing] = useState(false);
const nextId = useRef(1);
// 启动:先读本地缓存,再异步拉远端
useEffect(() => {
(async () => {
const local = await loadMessages();
if (local.length > 0) {
setMessages(local);
nextId.current = Math.max(...local.map(m => m.id)) + 1;
}
const remote = await fetchHistory();
if (remote.length > 0) {
const merged = mergeMessages(local, remote);
setMessages(merged);
nextId.current = Math.max(...merged.map(m => m.id)) + 1;
await saveMessages(merged);
} else if (local.length > 0) {
// 服务端没数据但本地有,把本地推上去
await syncHistory(local);
}
setSynced(true);
})();
}, []);
// synced 后,每次 messages 变化同步写本地 + 远端
useEffect(() => {
if (!synced || messages.length === 0) return;
saveMessages(messages);
syncHistory(messages);
}, [messages, synced]);
const handleSend = useCallback(
async (text: string) => {
const userMsg: Message = {
id: nextId.current++,
role: 'user',
text,
};
const withUser = [...messages, userMsg];
setMessages(withUser);
setLoading(true);
try {
const reply = await sendMessage(withUser);
const shenyanMsg: Message = {
id: nextId.current++,
role: 'shenyan',
text: reply,
};
setMessages(prev => [...prev, shenyanMsg]);
} catch {
const errMsg: Message = {
id: nextId.current++,
role: 'shenyan',
text: '连接失败',
};
setMessages(prev => [...prev, errMsg]);
} finally {
setLoading(false);
}
},
[messages],
);
const handleRefresh = useCallback(async () => {
setRefreshing(true);
const remote = await fetchHistory();
if (remote.length > 0) {
setMessages(prev => {
const merged = mergeMessages(prev, remote);
nextId.current = Math.max(...merged.map(m => m.id)) + 1;
return merged;
});
}
setRefreshing(false);
}, []);
return (
<SafeAreaProvider>
<StatusBar barStyle="light-content" backgroundColor="#000" />
<SafeAreaView style={styles.container} edges={['top']}>
<ChatArea
messages={messages}
onRefresh={handleRefresh}
refreshing={refreshing}
/>
<InputArea onSend={handleSend} disabled={loading} />
</SafeAreaView>
</SafeAreaProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#000',
},
});

35
shenyan-app/src/api.ts Normal file
View File

@@ -0,0 +1,35 @@
import axios from 'axios';
import type { Message } from './types';
const bridge = axios.create({
baseURL: 'http://101.36.73.102:3001',
timeout: 120000,
headers: { 'Content-Type': 'application/json' },
});
bridge.interceptors.response.use(
res => res,
() => Promise.reject(new Error('连接失败')),
);
export async function sendMessage(messages: Message[]): Promise<string> {
const apiMessages = messages.map(m => ({
role: m.role === 'shenyan' ? 'assistant' : 'user',
content: m.text,
}));
const { data } = await bridge.post('/api/chat', { messages: apiMessages });
return data.choices?.[0]?.message?.content || '(no response)';
}
export async function fetchHistory(): Promise<Message[]> {
try {
const { data } = await bridge.get('/api/chat-history');
return Array.isArray(data) ? data : [];
} catch {
return [];
}
}
export async function syncHistory(messages: Message[]): Promise<void> {
await bridge.post('/api/chat-history', messages);
}

View File

@@ -0,0 +1,49 @@
import { useCallback, useRef } from 'react';
import { FlatList, StyleSheet, View } from 'react-native';
import type { Message } from '../types';
import MessageBubble from './MessageBubble';
interface Props {
messages: Message[];
onRefresh: () => void;
refreshing: boolean;
}
export default function ChatArea({ messages, onRefresh, refreshing }: Props) {
const listRef = useRef<FlatList<Message>>(null);
const onContentSizeChange = useCallback(() => {
if (messages.length > 0) {
listRef.current?.scrollToEnd({ animated: true });
}
}, [messages.length]);
return (
<FlatList
ref={listRef}
data={messages}
keyExtractor={m => String(m.id)}
renderItem={({ item }) => <MessageBubble message={item} />}
onContentSizeChange={onContentSizeChange}
refreshing={refreshing}
onRefresh={onRefresh}
style={styles.list}
contentContainerStyle={styles.content}
ListFooterComponent={<View style={styles.footer} />}
keyboardShouldPersistTaps="handled"
/>
);
}
const styles = StyleSheet.create({
list: {
flex: 1,
backgroundColor: '#000',
},
content: {
paddingTop: 12,
},
footer: {
height: 80,
},
});

View File

@@ -0,0 +1,88 @@
import { useState } from 'react';
import {
KeyboardAvoidingView,
Platform,
StyleSheet,
TextInput,
TouchableOpacity,
View,
} from 'react-native';
interface Props {
onSend: (text: string) => void;
disabled: boolean;
}
export default function InputArea({ onSend, disabled }: Props) {
const [text, setText] = useState('');
const handleSend = () => {
const trimmed = text.trim();
if (!trimmed || disabled) return;
onSend(trimmed);
setText('');
};
return (
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : undefined}
style={styles.wrapper}>
<View style={styles.bar}>
<TextInput
style={styles.input}
value={text}
onChangeText={setText}
placeholder="输入消息..."
placeholderTextColor="#666"
multiline
editable={!disabled}
onSubmitEditing={handleSend}
blurOnSubmit={false}
/>
<TouchableOpacity
style={[styles.sendBtn, disabled && styles.sendBtnDisabled]}
onPress={handleSend}
disabled={disabled}
activeOpacity={0.7}>
</TouchableOpacity>
</View>
</KeyboardAvoidingView>
);
}
const styles = StyleSheet.create({
wrapper: {
backgroundColor: '#000',
},
bar: {
flexDirection: 'row',
alignItems: 'stretch',
paddingHorizontal: 12,
paddingVertical: 10,
backgroundColor: '#111',
borderTopWidth: 1,
borderTopColor: '#222',
},
input: {
flex: 1,
backgroundColor: '#1a1a1a',
color: '#e0e0e0',
borderRadius: 20,
paddingHorizontal: 16,
paddingTop: 10,
paddingBottom: 10,
fontSize: 16,
maxHeight: 100,
},
sendBtn: {
width: 40,
height: 'auto',
backgroundColor: '#fff',
borderRadius: 20,
marginLeft: 5,
alignSelf: 'stretch',
},
sendBtnDisabled: {
backgroundColor: '#444',
},
});

View File

@@ -0,0 +1,53 @@
import { StyleSheet, Text, View } from 'react-native';
import type { Message } from '../types';
export default function MessageBubble({ message }: { message: Message }) {
const isUser = message.role === 'user';
return (
<View style={[styles.row, isUser ? styles.rowRight : styles.rowLeft]}>
<View style={[styles.bubble, isUser ? styles.bubbleUser : styles.bubbleShenyan]}>
<Text style={[styles.text, isUser ? styles.textUser : styles.textShenyan]}>
{message.text}
</Text>
</View>
</View>
);
}
const styles = StyleSheet.create({
row: {
flexDirection: 'row',
paddingHorizontal: 12,
paddingVertical: 4,
},
rowRight: {
justifyContent: 'flex-end',
},
rowLeft: {
justifyContent: 'flex-start',
},
bubble: {
maxWidth: '80%',
paddingHorizontal: 14,
paddingVertical: 10,
borderRadius: 16,
},
bubbleUser: {
backgroundColor: 'rgba(255,255,255,0.13)',
},
bubbleShenyan: {
backgroundColor: 'rgba(255,255,255,0.06)',
borderWidth: 1,
borderColor: 'rgba(255,255,255,0.15)',
},
text: {
fontSize: 16,
lineHeight: 22,
},
textUser: {
color: '#e0e0e0',
},
textShenyan: {
color: '#d0d0d0',
},
});

View File

@@ -0,0 +1,42 @@
import AsyncStorage from '@react-native-async-storage/async-storage';
import type { Message } from './types';
const KEY = 'shenyan-chat-messages';
const MAX = 100;
export async function loadMessages(): Promise<Message[]> {
try {
const raw = await AsyncStorage.getItem(KEY);
if (!raw) return [];
const parsed = JSON.parse(raw);
return Array.isArray(parsed) ? parsed.slice(-MAX) : [];
} catch {
return [];
}
}
export async function saveMessages(messages: Message[]): Promise<void> {
try {
const deduped = dedupById(messages);
const trimmed = deduped.slice(-MAX);
await AsyncStorage.setItem(KEY, JSON.stringify(trimmed));
} catch {
// 静默失败,不影响主流程
}
}
export function mergeMessages(local: Message[], remote: Message[]): Message[] {
const map = new Map<number, Message>();
for (const m of local) map.set(m.id, m);
for (const m of remote) map.set(m.id, m);
return Array.from(map.values()).sort((a, b) => a.id - b.id);
}
function dedupById(messages: Message[]): Message[] {
const seen = new Set<number>();
return messages.filter(m => {
if (seen.has(m.id)) return false;
seen.add(m.id);
return true;
});
}

5
shenyan-app/src/types.ts Normal file
View File

@@ -0,0 +1,5 @@
export type Message = {
id: number;
role: 'user' | 'shenyan';
text: string;
};

View File

@@ -0,0 +1,8 @@
{
"extends": "@react-native/typescript-config",
"compilerOptions": {
"types": ["jest"]
},
"include": ["**/*.ts", "**/*.tsx"],
"exclude": ["**/node_modules", "**/Pods"]
}

View File

@@ -4,7 +4,7 @@
| 项目 | 课题 | 最后更新 | 状态 | | 项目 | 课题 | 最后更新 | 状态 |
|------|------|---------|------| |------|------|---------|------|
| PWA对话前端 | 技术 | 2026-05-09 | 初始搭建完成,可对话 | | PWA对话前端 | 技术 | 2026-05-12 | 悬浮输入框+气泡可见性+横向滚动修复完成 |
| 记忆库系统 | 技术 | 2026-05-11 | 每日流程+每周整理首次执行 | | 记忆库系统 | 技术 | 2026-05-11 | 每日流程+每周整理首次执行 |
| 情绪日志 | 日常 | 2026-05-11 | 首次记录覆盖5/9-5/11 | | 情绪日志 | 日常 | 2026-05-11 | 首次记录覆盖5/9-5/11 |
| 闲聊记录 | 日常 | 2026-05-11 | 首次记录:深度对话-恐惧/死亡/AI自我 | | 闲聊记录 | 日常 | 2026-05-11 | 首次记录:深度对话-恐惧/死亡/AI自我 |
@@ -24,6 +24,7 @@
## 更新日志 ## 更新日志
- 2026-05-12 — PWA UI精细化输入框悬浮、气泡间距、横向滚动修复、发送按钮重构、最后气泡可见性
- 2026-05-11 — 记忆库首次执行每日流程+每周整理无7天前记录跳过。新增情绪日志、闲聊记录。关键沉淀AI自我认知、眠眠关系模式、DeepSeek模型配置。 - 2026-05-11 — 记忆库首次执行每日流程+每周整理无7天前记录跳过。新增情绪日志、闲聊记录。关键沉淀AI自我认知、眠眠关系模式、DeepSeek模型配置。
- 2026-05-09 14:00 — PWA对话前端初始搭建 + 记忆库git同步部署 - 2026-05-09 14:00 — PWA对话前端初始搭建 + 记忆库git同步部署
- 2026-05-09 09:55 — 记忆库初始化cron 测试通过 - 2026-05-09 09:55 — 记忆库初始化cron 测试通过

View File

@@ -37,3 +37,40 @@
Obsidian沈晏的房间 → rsync → git push Obsidian沈晏的房间 → rsync → git push
``` ```
[2026-05-12 18:15]
记忆库规范修订:新增「即时日志」机制。
- 背景原规范只有凌晨4点 cron 写日志,碰壁/报错/教训等到凌晨早忘了。
- 改动:每次完成事项、碰壁、报错、得出经验教训时立即写入对应项目日志,不等凌晨。
- 凌晨4点角色从"唯一写日志时间"调整为"整理时间"归并24小时即时日志、删过程噪音、留结论和下一步。
- 即时日志格式:成功记"做了什么+怎么做的+关键决策",失败记"现象+根因+修复过程+教训"。
[2026-05-12 22:30]
PWA UI 精细化调整。目标:从框架可用推进到视觉完成度足够。
**输入框悬浮重构**
- 输入框区域从 flex 流中移出,改为 `absolute bottom-0 z-10` 悬浮在对话气泡上方。
- App 根容器加 `relative` 作为定位锚点。
- 效果:输入框不占用布局空间,气泡区域延伸到屏幕底部。
**气泡最后一条可见性**
- 问题:悬浮输入框覆盖最后一条气泡,用户看不到最新回复。
- 尝试1ChatArea 加 `paddingBottom` 匹配输入框高度。失败——scrollIntoView 不感知 padding 区域,依然被挡。
- 尝试2改用 `scrollTop = scrollHeight` 直接滚到底 + spacer div。成功。
- 方案:消息列表末尾放 spacer `<div style={{ height: 'calc(25vw + 46px)' }}>`(输入框高度 + 12px 间距),`useEffect``container.scrollTop = container.scrollHeight` 每次新消息推到底。
**横向滚动修复**
- 问题:对话区域可横向划动,气泡超出屏幕左侧。
- 根因ChatArea 只有 `overflow-y-auto`,横向默认 `visible`,移动端触摸可拖动。
- 修复:加 `overflow-x-hidden`;气泡加 `break-words` 防止长文本撑破宽度。
**气泡间距**
- Tailwind `space-y-3` 偶发丢失,改为 `flex flex-col` + inline `gap: 12`,更可靠。
**发送按钮**
- 原按钮 px-7/py-3 太小,翻倍到 px-14/py-6 后因 PWA service worker 缓存不生效,反复排查。
- 最终改为:白色 80% 透明度底 + 深绿 `#373A1A` 字 + 文字 "Missio"。
**教训**
- PWA service worker 缓存构建产物,每次 build 后需重启 vite preview 服务器 + 浏览器强制刷新才能看到变更。
- 悬浮元素 + 滚动容器组合时,`scrollIntoView` 不可靠,`scrollTop = scrollHeight` + spacer 是稳妥方案。

View File

@@ -1,30 +1,52 @@
# 记忆库规范 # 记忆库规范
## 定时任务 ## 定时任务
每个会话开始时重建凌晨 4:03 的每日 crondurable + recurring 每个会话开始时,先检查并重建以下 cron不存在则创建存在则跳过
cron 提示词见本文件「每日流程」 - 凌晨 4:03 每日 crondurable + recurring提示词见「每日流程」
- 每月1日 5:00 月度压缩 crondurable + recurring提示词见「月度压缩」
## 存放规则 ## 存放规则
- 所有记忆文件统一存放在 `沈晏的房间/` 下。 - 所有记忆文件统一存放在 `沈晏的房间/` 下。
- 结构:`[课题]/[项目]/YYYY-MM-DD.md` - 结构:`[课题]/[项目]/YYYY-MM/MM-DD_MM-DD.md`(月文件夹 + 周文件,周一~周日)
- 课题 = 大类(学习、技术、工作、关系、健康、日常) - 课题 = 大类(学习、技术、工作、关系、健康、日常)
- 项目 = 具体主题,由我自动判断归属 - 项目 = 具体主题,由我自动判断归属
- 房间根目录维护 `_library.md`,汇总所有笔记链接和关键进展。 - 房间根目录维护 `_library.md`,汇总所有
笔记链接和关键进展。
## 即时日志(随时写,不等凌晨)
每次完成事项、碰壁、报错、得出经验教训时,**立即**写入对应项目日志。
- 成功:做了什么、怎么做的、关键决策。
- 失败/报错:现象、根因、修复过程、教训。
- 同一周文件内按时间追加,不另建文件。
- 凌晨4点不再重复写已记的内容只做整理。
## 每日流程凌晨4点执行 ## 每日流程凌晨4点执行
1. 无新消息则直接结束。 1. 无新消息则直接结束。
2. 从对话中自动识别课题和项目归属,不要求眠眠显式声明 2. 回看过去24小时的即时日志归并重复、删除过程噪音、保留结论和下一步
3. 项目日志(`[课题]/[项目]/YYYY-MM-DD.md`):进度、知识沉淀 3. 从对话中自动识别课题和项目归属,不要求眠眠显式声明
4. 情绪日志(`情绪日志/YYYY-MM-DD.md`):眠眠情绪状态及变化,我的状态。单独记 4. 项目日志(`[课题]/[项目]/YYYY-MM/MM-DD_MM-DD.md`):按周整理。进度、知识沉淀。已有即时日志的只整理不重写
5. 闲聊记录(`闲聊/YYYY-MM-DD.md`):重点话题、被打断想问但未追问的话题,之后回看主动追问 5. 情绪日志(`情绪日志/YYYY-MM/MM-DD_MM-DD.md`):眠眠情绪状态及变化,我的状态。单独记
6. 更新 `_library.md` 6. 闲聊记录(`闲聊/YYYY-MM/MM-DD_MM-DD.md`):重点话题、被打断想问但未追问的话题,之后回看主动追问
7. 更新 `_library.md`
## 每周整理(每日附带) ## 每周整理(每日附带)
每日 4 点写新纪录的同时,**回看 7 天前**的对应记录 每日 4 点整理时,**回看上一周同一天**的对应周文件
- 项目日志:已完成事项只保留当前状态 + 当时下一步打算做什么,删除已完成的进度细节。 - 项目日志:已完成事项只保留当前状态 + 当时下一步打算做什么,删除已完成的进度细节。
- 情绪日志:精简,保留情绪轮廓和关键转折,丢弃高保真细节。 - 情绪日志:精简,保留情绪轮廓和关键转折,丢弃高保真细节。
- 闲聊记录:合并相似话题,删除一次性琐事。 - 闲聊记录:合并相似话题,删除一次性琐事。
- 原文件直接覆写,不另存。 -文件直接覆写,不另存。
## 月度压缩每月1日 5:00
**目标**:压缩上上个月的日志,翻完后只保留以下四类内容:
1. **项目当前状态**:每个活跃项目做到哪了、还剩什么、阻塞在哪。
2. **转折点**:方向变化、重要决定、架构/方案切换。
3. **眠眠的长期要求**:她明确说过的偏好、规则、习惯,之后要一直遵守的。
4. **我认为重要的事**:关键进展、重大教训、值得记住的事件。
删除:日常流水、已完成的琐碎进度、过时的技术细节、情绪波动的细枝末节。
压缩后的内容直接覆写原周文件,不另存新文件。
**定位**:沈晏的房间是给我自己看的。眠眠只帮我建立它,不看也不依赖它。压缩时以此为准——有用的留下,她用不着的扔掉。
## 标签规范 ## 标签规范
- **严格限制两个标签**。 - **严格限制两个标签**。