- Update app name, package name (skin.carrot.bbs → cn.qczlit.withyou), and bundle identifier - Update API endpoints (bbs.littlelan.cn → withyou.littlelan.cn) - Update URL scheme (carrotbbs:// → withyou://) - Rename database from carrot_bbs to with_you - Update CI/CD pipeline image names and artifact naming - Add Android signing configuration for release builds - Update all UI text and comments throughout the codebase - Refactor registerStore to use in-memory state instead of AsyncStorage persistence - Improve WebRTC track handling and call stream management - Add metro platform resolution for native platform support BREAKING app package, database, and URLs are no longer valid
56 lines
1.2 KiB
TypeScript
56 lines
1.2 KiB
TypeScript
import React, { useEffect, useMemo } from 'react';
|
|
import { Share as RNShare, Platform } from 'react-native';
|
|
|
|
export interface ShareSheetProps {
|
|
visible: boolean;
|
|
postUrl?: string;
|
|
postTitle?: string;
|
|
onClose: () => void;
|
|
onShareAction?: (actionKey: string) => void;
|
|
}
|
|
|
|
const ShareSheet: React.FC<ShareSheetProps> = ({
|
|
visible,
|
|
postUrl,
|
|
postTitle,
|
|
onClose,
|
|
onShareAction,
|
|
}) => {
|
|
|
|
const shareText = useMemo(() => {
|
|
const title = postTitle || '威友帖子';
|
|
return `${title} ${postUrl || ''}`;
|
|
}, [postTitle, postUrl]);
|
|
|
|
useEffect(() => {
|
|
if (!visible) return;
|
|
|
|
const doShare = async () => {
|
|
try {
|
|
await RNShare.share(
|
|
{
|
|
message: shareText,
|
|
url: Platform.OS === 'ios' ? postUrl : undefined,
|
|
title: postTitle || '分享帖子',
|
|
},
|
|
{
|
|
subject: postTitle,
|
|
dialogTitle: '分享到',
|
|
}
|
|
);
|
|
onShareAction?.('system_share');
|
|
} catch {
|
|
// User cancelled
|
|
} finally {
|
|
onClose();
|
|
}
|
|
};
|
|
|
|
doShare();
|
|
}, [visible, shareText, postUrl, postTitle, onShareAction, onClose]);
|
|
|
|
return null;
|
|
};
|
|
|
|
export default ShareSheet;
|