2017-03-28 04:40:44 +08:00
|
|
|
import React, { Component } from 'react';
|
|
|
|
import { createContainer } from 'meteor/react-meteor-data';
|
2017-05-02 03:52:57 +08:00
|
|
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
|
|
|
|
|
|
|
import Service from './service';
|
2017-03-28 04:40:44 +08:00
|
|
|
import Audio from './component';
|
2017-05-02 03:52:57 +08:00
|
|
|
import AudioModal from './audio-modal/component';
|
2017-03-28 04:40:44 +08:00
|
|
|
|
|
|
|
class AudioContainer extends Component {
|
|
|
|
render() {
|
|
|
|
return (
|
2017-05-02 03:52:57 +08:00
|
|
|
<Audio {...this.props}>
|
2017-04-20 04:42:48 +08:00
|
|
|
{this.props.children}
|
2017-04-21 03:57:35 +08:00
|
|
|
</Audio>
|
2017-03-28 04:40:44 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-05-04 05:39:07 +08:00
|
|
|
let didMountedAutoJoin = false;
|
|
|
|
|
2017-05-02 03:52:57 +08:00
|
|
|
export default withModalMounter(createContainer(({ mountModal }) => {
|
2017-04-20 04:42:48 +08:00
|
|
|
const APP_CONFIG = Meteor.settings.public.app;
|
2017-03-28 04:40:44 +08:00
|
|
|
|
|
|
|
return {
|
2017-05-02 03:52:57 +08:00
|
|
|
init: () => {
|
|
|
|
Service.init();
|
2017-05-04 05:39:07 +08:00
|
|
|
if (didMountedAutoJoin) return;
|
|
|
|
mountModal(<AudioModal handleJoinListenOnly={Service.joinListenOnly} />);
|
|
|
|
didMountedAutoJoin = true;
|
2017-05-02 03:52:57 +08:00
|
|
|
},
|
2017-03-28 04:40:44 +08:00
|
|
|
};
|
2017-05-02 03:52:57 +08:00
|
|
|
}, AudioContainer));
|