Skip to content

Commit

Permalink
Dispatch setDeviceToken after hydration (#3056)
Browse files Browse the repository at this point in the history
  • Loading branch information
migbot authored and enahum committed Jul 31, 2019
1 parent a99d6f8 commit cb912bb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/screens/entry/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export default class Entry extends PureComponent {
initializeModules: PropTypes.func,
actions: PropTypes.shape({
autoUpdateTimezone: PropTypes.func.isRequired,
setDeviceToken: PropTypes.func.isRequired,
}).isRequired,
};

Expand Down Expand Up @@ -108,6 +109,7 @@ export default class Entry extends PureComponent {
const {
actions: {
autoUpdateTimezone,
setDeviceToken,
},
enableTimezone,
deviceTimezone,
Expand Down Expand Up @@ -136,6 +138,10 @@ export default class Entry extends PureComponent {
Client4.setUserId(currentUserId);
}

if (app.deviceToken) {
setDeviceToken(app.deviceToken);
}

this.setStartupThemes();
this.handleNotification();
this.loadSystemEmojis();
Expand Down
2 changes: 2 additions & 0 deletions app/screens/entry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import {bindActionCreators} from 'redux';
import {connect} from 'react-redux';

import {setDeviceToken} from 'mattermost-redux/actions/general';
import {autoUpdateTimezone} from 'mattermost-redux/actions/timezone';
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
import {isTimezoneEnabled} from 'mattermost-redux/selectors/entities/timezone';
Expand Down Expand Up @@ -30,6 +31,7 @@ function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
autoUpdateTimezone,
setDeviceToken,
}, dispatch),
};
}
Expand Down

0 comments on commit cb912bb

Please sign in to comment.