Changeset View
Changeset View
Standalone View
Standalone View
lib/socket/socket.react.js
Show First 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | type Props = { | ||||
+preRequestUserState: PreRequestUserState, | +preRequestUserState: PreRequestUserState, | ||||
+noDataAfterPolicyAcknowledgment?: boolean, | +noDataAfterPolicyAcknowledgment?: boolean, | ||||
// Redux dispatch functions | // Redux dispatch functions | ||||
+dispatch: Dispatch, | +dispatch: Dispatch, | ||||
+dispatchActionPromise: DispatchActionPromise, | +dispatchActionPromise: DispatchActionPromise, | ||||
// async functions that hit server APIs | // async functions that hit server APIs | ||||
+logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>, | +logOut: (preRequestUserState: PreRequestUserState) => Promise<LogOutResult>, | ||||
+socketCrashLoopRecovery?: () => Promise<void>, | +socketCrashLoopRecovery?: () => Promise<void>, | ||||
// keyserver olm sessions specific props | |||||
+getInitialNotificationsEncryptedMessage?: () => Promise<string>, | |||||
}; | }; | ||||
type State = { | type State = { | ||||
+inflightRequests: ?InflightRequests, | +inflightRequests: ?InflightRequests, | ||||
}; | }; | ||||
class Socket extends React.PureComponent<Props, State> { | class Socket extends React.PureComponent<Props, State> { | ||||
state: State = { | state: State = { | ||||
inflightRequests: null, | inflightRequests: null, | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 343 Lines • ▼ Show 20 Lines | if (message.type === serverSocketMessageTypes.ERROR) { | ||||
const cookie = sessionChange ? sessionChange.cookie : this.props.cookie; | const cookie = sessionChange ? sessionChange.cookie : this.props.cookie; | ||||
this.invalidationRecoveryInProgress = true; | this.invalidationRecoveryInProgress = true; | ||||
const recoverySessionChange = await fetchNewCookieFromNativeCredentials( | const recoverySessionChange = await fetchNewCookieFromNativeCredentials( | ||||
this.props.dispatch, | this.props.dispatch, | ||||
cookie, | cookie, | ||||
this.props.urlPrefix, | this.props.urlPrefix, | ||||
logInActionSources.socketAuthErrorResolutionAttempt, | logInActionSources.socketAuthErrorResolutionAttempt, | ||||
this.props.getInitialNotificationsEncryptedMessage, | |||||
); | ); | ||||
if (!recoverySessionChange && sessionChange) { | if (!recoverySessionChange && sessionChange) { | ||||
// This should only happen in the cookieSources.BODY (native) case when | // This should only happen in the cookieSources.BODY (native) case when | ||||
// the resolution attempt failed | // the resolution attempt failed | ||||
const { cookie: newerCookie, currentUserInfo } = sessionChange; | const { cookie: newerCookie, currentUserInfo } = sessionChange; | ||||
this.props.dispatch({ | this.props.dispatch({ | ||||
type: setNewSessionActionType, | type: setNewSessionActionType, | ||||
▲ Show 20 Lines • Show All 299 Lines • Show Last 20 Lines |