Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import React from 'react'
import { InAppNotificationProvider, withInAppNotification } from 'react-native-in-app-notification'
import { messenger as messengerpb } from '@berty-tech/api/index.js'
import { useMsgrContext } from '@berty-tech/store/hooks'
import NotificationBody from './NotificationBody'
const NotificationBridge: React.FC = withInAppNotification(({ showNotification }: any) => {
const {
addNotificationListener,
removeNotificationListener,
contacts,
persistentOptions,
} = useMsgrContext()
React.useEffect(() => {
const listener = (evt: any) => {
const contact = Object.values(contacts).find(
(c: any) => c.conversationPublicKey === evt.payload.publicKey,
)
const isValid =
contact.state !== messengerpb.Contact.State.IncomingRequest &&
contact.state !== messengerpb.Contact.State.Undefined
// check if message comes from valid contact
/>
handleSetGlobalError(false)} />
handleSetSocialLoginError('')}
/>
);
};
NetworkInterceptor.propTypes = {
children: PropTypes.any,
showNotification: PropTypes.func
};
export default withInAppNotification(NetworkInterceptor);
const styles = StyleSheet.create({
container: {
backgroundColor: '#fff',
flex: 1
}
});