feat(content): add rich content rendering with @mentions and vote segments
- Add PostContentRenderer component for rendering posts/comments with segments - Add PostMentionInput component for @mention support in post/comment creation - Add VoteSegmentData and vote segment type for unified post creation API - Update post and comment services to support segments in API requests - Fix auth service to clear tokens before login/register - Improve database initialization with proper close/retry logic - Add verification check before allowing post creation - Add metro web shims for react-native-webrtc full package and requireNativeComponent - Update build config with git hash based version numbers
This commit is contained in:
94
web-shims/react-native-webrtc/index.js
vendored
Normal file
94
web-shims/react-native-webrtc/index.js
vendored
Normal file
@@ -0,0 +1,94 @@
|
||||
const React = require('react');
|
||||
|
||||
const RTCView = React.forwardRef((props, ref) => {
|
||||
const { streamURL, mirror, objectFit, style, ...rest } = props;
|
||||
const src = streamURL || (props.stream && props.stream.toURL ? props.stream.toURL() : '');
|
||||
|
||||
if (src) {
|
||||
return React.createElement('video', {
|
||||
...rest,
|
||||
ref,
|
||||
src,
|
||||
autoPlay: true,
|
||||
playsInline: true,
|
||||
muted: props.muted || false,
|
||||
style: {
|
||||
...style,
|
||||
transform: mirror ? 'scaleX(-1)' : undefined,
|
||||
objectFit: objectFit || 'cover',
|
||||
width: '100%',
|
||||
height: '100%',
|
||||
},
|
||||
});
|
||||
}
|
||||
return React.createElement('div', { ...rest, ref, style });
|
||||
});
|
||||
RTCView.displayName = 'RTCView';
|
||||
|
||||
const ScreenCapturePickerView = React.forwardRef((props, ref) => {
|
||||
return React.createElement('div', { ...props, ref, 'data-native-component': 'ScreenCapturePickerView' });
|
||||
});
|
||||
ScreenCapturePickerView.displayName = 'ScreenCapturePickerView';
|
||||
|
||||
const mediaDevices = typeof navigator !== 'undefined' && navigator.mediaDevices
|
||||
? navigator.mediaDevices
|
||||
: {
|
||||
getUserMedia: () => Promise.reject(new Error('mediaDevices not available')),
|
||||
getDisplayMedia: () => Promise.reject(new Error('mediaDevices not available')),
|
||||
enumerateDevices: () => Promise.resolve([]),
|
||||
};
|
||||
|
||||
const RTCPeerConnection = typeof window !== 'undefined' ? window.RTCPeerConnection : function () {};
|
||||
const RTCSessionDescription = typeof window !== 'undefined' ? window.RTCSessionDescription : function () {};
|
||||
const RTCIceCandidate = typeof window !== 'undefined' ? window.RTCIceCandidate : function () {};
|
||||
const MediaStream = typeof window !== 'undefined' ? window.MediaStream : function () {};
|
||||
const MediaStreamTrack = typeof window !== 'undefined' ? window.MediaStreamTrack : function () {};
|
||||
|
||||
function registerGlobals() {}
|
||||
|
||||
const permissions = {
|
||||
request: () => Promise.resolve(true),
|
||||
check: () => Promise.resolve(true),
|
||||
};
|
||||
|
||||
const RTCAudioSession = {
|
||||
setCategory: () => {},
|
||||
setActive: () => {},
|
||||
setMode: () => {},
|
||||
};
|
||||
|
||||
const RTCRtpReceiver = typeof window !== 'undefined' ? window.RTCRtpReceiver : function () {};
|
||||
const RTCRtpSender = typeof window !== 'undefined' ? window.RTCRtpSender : function () {};
|
||||
const RTCRtpTransceiver = typeof window !== 'undefined' ? window.RTCRtpTransceiver : function () {};
|
||||
const RTCErrorEvent = typeof window !== 'undefined' ? window.RTCErrorEvent : function () {};
|
||||
const MediaStreamTrackEvent = typeof window !== 'undefined' ? window.MediaStreamTrackEvent : function () {};
|
||||
|
||||
const RTCPIPView = React.forwardRef((props, ref) => {
|
||||
return React.createElement('div', { ...props, ref, 'data-native-component': 'RTCPIPView' });
|
||||
});
|
||||
RTCPIPView.displayName = 'RTCPIPView';
|
||||
|
||||
function startIOSPIP() {}
|
||||
function stopIOSPIP() {}
|
||||
|
||||
module.exports = {
|
||||
RTCView,
|
||||
ScreenCapturePickerView,
|
||||
RTCPeerConnection,
|
||||
RTCSessionDescription,
|
||||
RTCIceCandidate,
|
||||
MediaStream,
|
||||
MediaStreamTrack,
|
||||
MediaStreamTrackEvent,
|
||||
mediaDevices,
|
||||
permissions,
|
||||
registerGlobals,
|
||||
RTCAudioSession,
|
||||
RTCRtpReceiver,
|
||||
RTCRtpSender,
|
||||
RTCRtpTransceiver,
|
||||
RTCErrorEvent,
|
||||
RTCPIPView,
|
||||
startIOSPIP,
|
||||
stopIOSPIP,
|
||||
};
|
||||
18
web-shims/react-native/Libraries/ReactNative/requireNativeComponent.js
vendored
Normal file
18
web-shims/react-native/Libraries/ReactNative/requireNativeComponent.js
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
const React = require('react');
|
||||
|
||||
function requireNativeComponent(componentName) {
|
||||
const componentNameClean = componentName
|
||||
.replace(/^RNC/, '')
|
||||
.replace(/^RNS/, '')
|
||||
.replace(/^RN/, '');
|
||||
|
||||
const NativeComponent = React.forwardRef((props, ref) => {
|
||||
const { children, ...rest } = props;
|
||||
return React.createElement('div', { ...rest, ref, 'data-native-component': componentNameClean }, children);
|
||||
});
|
||||
NativeComponent.displayName = componentName;
|
||||
|
||||
return NativeComponent;
|
||||
}
|
||||
|
||||
module.exports = requireNativeComponent;
|
||||
Reference in New Issue
Block a user