diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js new file mode 100644 --- /dev/null +++ b/lib/components/keyserver-connection-handler.js @@ -0,0 +1,25 @@ +// @flow + +import * as React from 'react'; + +import type { BaseSocketProps } from '../socket/socket.react.js'; +import { ashoatKeyserverID } from '../utils/validation-utils.js'; + +type Props = { + ...BaseSocketProps, + +keyserverID: string, + +socketComponent: React.ComponentType, +}; +function KeyserverConnectionHandler(props: Props) { + const { socketComponent: Socket, keyserverID, ...rest } = props; + if (keyserverID !== ashoatKeyserverID) { + return null; + } + return ; +} + +const Handler: React.ComponentType = React.memo( + KeyserverConnectionHandler, +); + +export default Handler; diff --git a/lib/components/keyserver-connections-handler.js b/lib/components/keyserver-connections-handler.js new file mode 100644 --- /dev/null +++ b/lib/components/keyserver-connections-handler.js @@ -0,0 +1,22 @@ +// @flow + +import * as React from 'react'; + +import KeyserverConnectionHandler from './keyserver-connection-handler.js'; +import { type BaseSocketProps } from '../socket/socket.react.js'; +import { useSelector } from '../utils/redux-utils.js'; + +type Props = { + ...BaseSocketProps, + +socketComponent: React.ComponentType, +}; +function KeyserverConnectionsHandler(props: Props): React.Node { + const keyserverIDs = useSelector(state => + Object.keys(state.keyserverStore.keyserverInfos), + ); + return keyserverIDs.map(id => ( + + )); +} + +export default KeyserverConnectionsHandler; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -27,6 +27,7 @@ import { EditUserAvatarProvider } from 'lib/components/edit-user-avatar-provider.react.js'; import { ENSCacheProvider } from 'lib/components/ens-cache-provider.react.js'; import IntegrityHandler from 'lib/components/integrity-handler.react.js'; +import KeyserverConnectionsHandler from 'lib/components/keyserver-connections-handler.js'; import { MediaCacheProvider } from 'lib/components/media-cache-provider.react.js'; import { TunnelbrokerProvider } from 'lib/tunnelbroker/tunnelbroker-context.js'; import { actionLogger } from 'lib/utils/action-logger.js'; @@ -320,7 +321,8 @@ {gated} - - +