diff --git a/lib/socket/report-handler.react.js b/lib/components/report-handler.react.js rename from lib/socket/report-handler.react.js rename to lib/components/report-handler.react.js diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js --- a/lib/socket/socket.react.js +++ b/lib/socket/socket.react.js @@ -10,7 +10,6 @@ import CalendarQueryHandler from './calendar-query-handler.react.js'; import { InflightRequests } from './inflight-requests.js'; import MessageHandler from './message-handler.react.js'; -import ReportHandler from './report-handler.react.js'; import RequestResponseHandler from './request-response-handler.react.js'; import UpdateHandler from './update-handler.react.js'; import { updateActivityActionTypes } from '../actions/activity-actions.js'; @@ -99,7 +98,6 @@ +urlPrefix: string, +connection: ConnectionInfo, +currentCalendarQuery: () => CalendarQuery, - +canSendReports: boolean, +frozen: boolean, +preRequestUserState: PreRequestUserState, +noDataAfterPolicyAcknowledgment?: boolean, @@ -375,7 +373,6 @@ frozen={this.props.frozen} keyserverID={this.props.keyserverID} /> - ); } diff --git a/native/components/report-handler.react.js b/native/components/report-handler.react.js new file mode 100644 --- /dev/null +++ b/native/components/report-handler.react.js @@ -0,0 +1,21 @@ +// @flow + +import * as React from 'react'; + +import BaseReportHandler from 'lib/components/report-handler.react.js'; + +import { InputStateContext } from '../input/input-state.js'; +import { useSelector } from '../redux/redux-utils.js'; + +function ReportHandler(): React.Node { + const inputState = React.useContext(InputStateContext); + const canSendReports = useSelector( + state => + !state.frozen && + state.connectivity.hasWiFi && + (!inputState || !inputState.uploadInProgress()), + ); + return ; +} + +export default ReportHandler; diff --git a/native/root.react.js b/native/root.react.js --- a/native/root.react.js +++ b/native/root.react.js @@ -46,6 +46,7 @@ import AccessTokenHandler from './components/access-token-handler.react.js'; import { FeatureFlagsProvider } from './components/feature-flags-provider.react.js'; import PersistedStateGate from './components/persisted-state-gate.js'; +import ReportHandler from './components/report-handler.react.js'; import VersionSupportedChecker from './components/version-supported.react.js'; import ConnectedStatusBar from './connected-status-bar.react.js'; import { SQLiteDataHandler } from './data/sqlite-data-handler.js'; @@ -341,6 +342,7 @@ /> + {navigation} diff --git a/native/socket.react.js b/native/socket.react.js --- a/native/socket.react.js +++ b/native/socket.react.js @@ -21,7 +21,6 @@ import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; -import { InputStateContext } from './input/input-state.js'; import { activeMessageListSelector, nativeCalendarQuery, @@ -40,7 +39,6 @@ const NativeSocket: React.ComponentType = React.memo(function NativeSocket(props: BaseSocketProps) { - const inputState = React.useContext(InputStateContext); const navContext = React.useContext(NavContext); const { keyserverID } = props; @@ -94,13 +92,6 @@ }), ); - const canSendReports = useSelector( - state => - !state.frozen && - state.connectivity.hasWiFi && - (!inputState || !inputState.uploadInProgress()), - ); - const activeThread = React.useMemo(() => { if (!active) { return null; @@ -162,7 +153,6 @@ urlPrefix={urlPrefix} connection={connection} currentCalendarQuery={currentCalendarQuery} - canSendReports={canSendReports} frozen={frozen} preRequestUserState={preRequestUserState} dispatch={dispatch} diff --git a/web/root.js b/web/root.js --- a/web/root.js +++ b/web/root.js @@ -12,6 +12,7 @@ import IntegrityHandler from 'lib/components/integrity-handler.react.js'; import KeyserverConnectionsHandler from 'lib/components/keyserver-connections-handler.js'; import PrekeysHandler from 'lib/components/prekeys-handler.react.js'; +import ReportHandler from 'lib/components/report-handler.react.js'; import { CallKeyserverEndpointProvider } from 'lib/keyserver-conn/call-keyserver-endpoint-provider.react.js'; import { reduxLoggerMiddleware } from 'lib/utils/action-logger.js'; @@ -56,6 +57,7 @@ + diff --git a/web/socket.react.js b/web/socket.react.js --- a/web/socket.react.js +++ b/web/socket.react.js @@ -117,7 +117,6 @@ urlPrefix={urlPrefix} connection={connection} currentCalendarQuery={currentCalendarQuery} - canSendReports={true} frozen={false} preRequestUserState={preRequestUserState} dispatch={dispatch}