Merge pull request #1091 from esteemapp/hotfix/notification

Added a workaround solution for notification issue
This commit is contained in:
uğur erdal 2019-08-27 10:35:04 +03:00 committed by GitHub
commit 11d321889e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -61,6 +61,7 @@ import {
isPinCodeOpen,
setPinCode as savePinCode,
} from '../../../redux/actions/applicationActions';
import { updateActiveBottomTab } from '../../../redux/actions/uiAction';
import { encryptKey } from '../../../utils/crypto';
@ -553,12 +554,18 @@ class ApplicationContainer extends Component {
};
_connectNotificationServer = username => {
const { dispatch, unreadActivityCount } = this.props;
const ws = new WebSocket(`${Config.ACTIVITY_WEBSOCKET_URL}?user=${username}`);
ws.onmessage = () => {
// a message was received
const { activeBottomTab, unreadActivityCount, dispatch } = this.props;
dispatch(updateUnreadActivityCount(unreadActivityCount + 1));
// Workaround
if (activeBottomTab === ROUTES.TABBAR.NOTIFICATION) {
dispatch(updateActiveBottomTab(''));
dispatch(updateActiveBottomTab(ROUTES.TABBAR.NOTIFICATION));
}
};
};
@ -677,6 +684,7 @@ export default connect(
// UI
toastNotification: state.ui.toastNotification,
activeBottomTab: state.ui.activeBottomTab,
}),
dispatch => ({
dispatch,