mirror of https://github.com/vector-im/riot-web
				
				
				
			Fix the force TURN option
The call object is created within the js-sdk for inbound calls, so we never got the chance to set it.pull/21833/head
							parent
							
								
									6fd09bc09a
								
							
						
					
					
						commit
						6d23182f5f
					
				|  | @ -52,7 +52,6 @@ limitations under the License. | |||
|  */ | ||||
| 
 | ||||
| import MatrixClientPeg from './MatrixClientPeg'; | ||||
| import UserSettingsStore from './UserSettingsStore'; | ||||
| import PlatformPeg from './PlatformPeg'; | ||||
| import Modal from './Modal'; | ||||
| import sdk from './index'; | ||||
|  | @ -245,9 +244,7 @@ function _onAction(payload) { | |||
|                 return; | ||||
|             } else if (members.length === 2) { | ||||
|                 console.log("Place %s call in %s", payload.type, payload.room_id); | ||||
|                 const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id, { | ||||
|                     forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false), | ||||
|                 }); | ||||
|                 const call = Matrix.createNewMatrixCall(MatrixClientPeg.get(), payload.room_id); | ||||
|                 placeCall(call); | ||||
|             } else { // > 2
 | ||||
|                 dis.dispatch({ | ||||
|  |  | |||
|  | @ -136,6 +136,9 @@ class MatrixClientPeg { | |||
|     } | ||||
| 
 | ||||
|     _createClient(creds: MatrixClientCreds) { | ||||
|         // XXX: This is here and as a require because apparently circular dependencies
 | ||||
|         // are just broken in webpack (https://github.com/webpack/webpack/issues/1788)
 | ||||
|         const UserSettingsStore = require('./UserSettingsStore'); | ||||
|         const opts = { | ||||
|             baseUrl: creds.homeserverUrl, | ||||
|             idBaseUrl: creds.identityServerUrl, | ||||
|  | @ -143,6 +146,7 @@ class MatrixClientPeg { | |||
|             userId: creds.userId, | ||||
|             deviceId: creds.deviceId, | ||||
|             timelineSupport: true, | ||||
|             forceTURN: UserSettingsStore.getLocalSetting('webRtcForceTURN', false), | ||||
|         }; | ||||
| 
 | ||||
|         this.matrixClient = createMatrixClient(opts, this.indexedDbWorkerScript); | ||||
|  |  | |||
|  | @ -877,6 +877,11 @@ module.exports = React.createClass({ | |||
|         // TODO: this ought to be a separate component so that we don't need
 | ||||
|         // to rebind the onChange each time we render
 | ||||
|         const onChange = (e) => { | ||||
|             // XXX: awful, but at time of writing, granular settings has landed on
 | ||||
|             // develop which will almost certainly mean we'll handle this differently.
 | ||||
|             if (setting.id === 'webRtcForceTURN') { | ||||
|                 MatrixClientPeg.get().setForceTURN(e.target.checked); | ||||
|             } | ||||
|             UserSettingsStore.setLocalSetting(setting.id, e.target.checked); | ||||
|             if (setting.fn) setting.fn(e.target.checked); | ||||
|         }; | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 David Baker
						David Baker