2020-09-29 18:59:57 +00:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import {observer, inject} from "mobx-react"
|
2020-08-31 17:31:05 +00:00
|
|
|
|
2020-09-29 18:59:57 +00:00
|
|
|
class CollaborationController extends Component {
|
|
|
|
constructor(props){
|
2021-02-11 23:34:01 +00:00
|
|
|
super(props);
|
2020-09-29 18:59:57 +00:00
|
|
|
|
2021-02-18 15:40:54 +00:00
|
|
|
Common.Notifications.on('configOptionsFill', () => {
|
|
|
|
const api = Common.EditorApi.get();
|
2020-09-29 18:59:57 +00:00
|
|
|
// this.api = api;
|
|
|
|
api.asc_registerCallback('asc_onAuthParticipantsChanged', this.onChangeEditUsers.bind(this));
|
|
|
|
api.asc_registerCallback('asc_onParticipantsChanged', this.onChangeEditUsers.bind(this));
|
2021-02-25 16:26:42 +00:00
|
|
|
api.asc_registerCallback('asc_onConnectionStateChanged', this.onUserConnection.bind(this));
|
2020-09-29 18:59:57 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
onChangeEditUsers(users) {
|
|
|
|
const storeUsers = this.props.users;
|
|
|
|
storeUsers.reset(users);
|
2021-02-18 15:40:54 +00:00
|
|
|
storeUsers.setCurrentUser(this.props.storeAppOptions.user.id);
|
2021-02-25 16:26:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
onUserConnection(change) {
|
|
|
|
this.props.users.connection(change);
|
|
|
|
}
|
2020-09-01 08:42:25 +00:00
|
|
|
|
2020-09-29 18:59:57 +00:00
|
|
|
render() {
|
|
|
|
return null
|
2020-08-31 17:31:05 +00:00
|
|
|
}
|
2021-02-11 23:34:01 +00:00
|
|
|
}
|
2020-08-31 17:31:05 +00:00
|
|
|
|
2021-02-18 15:40:54 +00:00
|
|
|
export default inject('users', 'storeAppOptions')(observer(CollaborationController));
|