mattermost-mobile/app/components/root/root_container.js
enahum 6324f22095 PLT-5630 Implement push notifications and unread badge on app icon (#338)
* enable ios push notifications

* enable android push notifications

* NOTICE for push notification and message bar

* include message in noty

* re-wording notices

* feedback review
2017-03-13 09:51:21 -04:00

47 lines
1.3 KiB
JavaScript

// Copyright (c) 2016 Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';
import Config from 'assets/config.json';
import {flushToStorage} from 'app/actions/storage';
import {goToNotification, loadConfigAndLicense, queueNotification} from 'app/actions/views/root';
import {setAppState, setDeviceToken} from 'service/actions/general';
import Root from './root';
function mapStateToProps(state, ownProps) {
const users = state.entities.users;
const currentUserId = users.currentId;
const {currentId: currentTeamId} = state.entities.teams;
const {currentId: currentChannelId} = state.entities.channels;
let locale = Config.DefaultLocale;
if (currentUserId && users.profiles[currentUserId]) {
locale = users.profiles[currentUserId].locale;
}
return {
...ownProps,
currentTeamId,
currentChannelId,
locale
};
}
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
loadConfigAndLicense,
goToNotification,
queueNotification,
setAppState,
setDeviceToken,
flushToStorage
}, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps)(Root);