-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(prosody-auth): Don't loose initial tracks. #14358
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,12 +5,12 @@ import { connect as reduxConnect } from 'react-redux'; | |
import { IReduxState, IStore } from '../../../app/types'; | ||
import { IJitsiConference } from '../../../base/conference/reducer'; | ||
import { IConfig } from '../../../base/config/configType'; | ||
import { connect } from '../../../base/connection/actions.web'; | ||
import { toJid } from '../../../base/connection/functions'; | ||
import { translate, translateToHTML } from '../../../base/i18n/functions'; | ||
import { JitsiConnectionErrors } from '../../../base/lib-jitsi-meet'; | ||
import Dialog from '../../../base/ui/components/web/Dialog'; | ||
import Input from '../../../base/ui/components/web/Input'; | ||
import { joinConference } from '../../../prejoin/actions.web'; | ||
import { | ||
authenticateAndUpgradeRole, | ||
cancelLogin | ||
|
@@ -134,9 +134,7 @@ class LoginDialog extends Component<IProps, IState> { | |
if (conference) { | ||
dispatch(authenticateAndUpgradeRole(jid, password, conference)); | ||
} else { | ||
// dispatch(connect(jid, password)); | ||
// FIXME: Workaround for the web version. To be removed once we get rid of conference.js | ||
dispatch(joinConference(undefined, false, jid, password)); | ||
dispatch(connect(jid, password)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Has this been tested with XMPP auth? I recall we've broken it a number of times in the past. |
||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { batch } from 'react-redux'; | ||
|
||
import { IStore } from '../app/types'; | ||
import { APP_WILL_NAVIGATE } from '../base/app/actionTypes'; | ||
import { | ||
|
@@ -13,7 +15,9 @@ import { | |
JitsiConferenceErrors, | ||
JitsiConnectionErrors | ||
} from '../base/lib-jitsi-meet'; | ||
import { gumPending, setInitialGUMPromise } from '../base/media/actions'; | ||
import { MEDIA_TYPE } from '../base/media/constants'; | ||
import { IGUMPendingState } from '../base/media/types'; | ||
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; | ||
import { isLocalTrackMuted } from '../base/tracks/functions.any'; | ||
import { parseURIString } from '../base/util/uri'; | ||
|
@@ -143,7 +147,8 @@ MiddlewareRegistry.register(store => next => action => { | |
|
||
case CONNECTION_FAILED: { | ||
const { error } = action; | ||
const state = store.getState(); | ||
const { dispatch, getState } = store; | ||
const state = getState(); | ||
const { jwt } = state['features/base/jwt']; | ||
|
||
if (error | ||
|
@@ -153,6 +158,11 @@ MiddlewareRegistry.register(store => next => action => { | |
error.recoverable = true; | ||
|
||
_handleLogin(store); | ||
} else { | ||
batch(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This feeels like the wrong place to be handling this. Authentication should not be handling track stuff. You can handle this in the media middleware, since the recoverable flag will already be set once you calll |
||
dispatch(gumPending([ MEDIA_TYPE.AUDIO, MEDIA_TYPE.VIDEO ], IGUMPendingState.NONE)); | ||
dispatch(setInitialGUMPromise()); | ||
}); | ||
} | ||
|
||
break; | ||
|
@@ -264,6 +274,11 @@ function _handleLogin({ dispatch, getState }: IStore) { | |
const videoMuted = isLocalTrackMuted(state['features/base/tracks'], MEDIA_TYPE.VIDEO); | ||
|
||
if (!room) { | ||
batch(() => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
dispatch(setInitialGUMPromise()); | ||
dispatch(gumPending([ MEDIA_TYPE.AUDIO, MEDIA_TYPE.VIDEO ], IGUMPendingState.NONE)); | ||
}); | ||
|
||
logger.warn('Cannot handle login, room is undefined!'); | ||
|
||
return; | ||
|
@@ -275,6 +290,8 @@ function _handleLogin({ dispatch, getState }: IStore) { | |
return; | ||
} | ||
|
||
dispatch(setInitialGUMPromise()); | ||
|
||
getTokenAuthUrl( | ||
config, | ||
locationURL, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ import LocalRecordingManager from '../../recording/components/Recording/LocalRec | |
import { iAmVisitor } from '../../visitors/functions'; | ||
import { overwriteConfig } from '../config/actions'; | ||
import { CONNECTION_ESTABLISHED, CONNECTION_FAILED } from '../connection/actionTypes'; | ||
import { connect, connectionDisconnected, disconnect } from '../connection/actions'; | ||
import { connectionDisconnected, disconnect } from '../connection/actions'; | ||
import { validateJwt } from '../jwt/functions'; | ||
import { JitsiConferenceErrors, JitsiConferenceEvents, JitsiConnectionErrors } from '../lib-jitsi-meet'; | ||
import { PARTICIPANT_UPDATED, PIN_PARTICIPANT } from '../participants/actionTypes'; | ||
|
@@ -37,7 +37,6 @@ import { | |
import MiddlewareRegistry from '../redux/MiddlewareRegistry'; | ||
import StateListenerRegistry from '../redux/StateListenerRegistry'; | ||
import { TRACK_ADDED, TRACK_REMOVED } from '../tracks/actionTypes'; | ||
import { getLocalTracks } from '../tracks/functions.any'; | ||
|
||
import { | ||
CONFERENCE_FAILED, | ||
|
@@ -204,17 +203,7 @@ function _conferenceFailed({ dispatch, getState }: IStore, next: Function, actio | |
dispatch(overwriteConfig(newConfig)) // @ts-ignore | ||
.then(() => dispatch(conferenceWillLeave(conference))) | ||
.then(() => conference.leave()) | ||
.then(() => dispatch(disconnect())) | ||
.then(() => dispatch(connect())) | ||
.then(() => { | ||
// FIXME: Workaround for the web version. To be removed once we get rid of conference.js | ||
if (typeof APP !== 'undefined') { | ||
const localTracks = getLocalTracks(getState()['features/base/tracks']); | ||
const jitsiTracks = localTracks.map((t: any) => t.jitsiTrack); | ||
|
||
APP.conference.startConference(jitsiTracks).catch(logger.error); | ||
} | ||
}); | ||
.then(() => dispatch(disconnect())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When will the connection begin again? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see some of the logic got moved to base/conference, but only to the web middleware. When does mobile start connecting again? |
||
} | ||
|
||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't need to be. It doesn't even need access to the store so it doesn't even need to be async.
You could rewrite this to take the store as a parameter and just call it, since it's not really an action. Then in there you can batch-dispatch the actual actions.