mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-19 11:21:41 +03:00
showing toast on foreground notification with notification title
This commit is contained in:
parent
b6c1c8ff01
commit
dac6ac9b7f
@ -75,7 +75,11 @@ import {
|
||||
setPinCode as savePinCode,
|
||||
isRenderRequired,
|
||||
} from '../../../redux/actions/applicationActions';
|
||||
import { hideActionModal, updateActiveBottomTab } from '../../../redux/actions/uiAction';
|
||||
import {
|
||||
hideActionModal,
|
||||
toastNotification,
|
||||
updateActiveBottomTab,
|
||||
} from '../../../redux/actions/uiAction';
|
||||
|
||||
import { encryptKey } from '../../../utils/crypto';
|
||||
|
||||
@ -457,6 +461,15 @@ class ApplicationContainer extends Component {
|
||||
}
|
||||
};
|
||||
|
||||
_showNotificationToast = (remoteMessage) => {
|
||||
const { dispatch } = this.props;
|
||||
|
||||
if (remoteMessage && remoteMessage.notification) {
|
||||
const { title } = remoteMessage.notification;
|
||||
dispatch(toastNotification(title));
|
||||
}
|
||||
};
|
||||
|
||||
_createPushListener = () => {
|
||||
(async () => await messaging().requestPermission())();
|
||||
|
||||
@ -464,6 +477,7 @@ class ApplicationContainer extends Component {
|
||||
PushNotification.cancelAllLocalNotifications();
|
||||
|
||||
firebaseOnMessageListener = messaging().onMessage((remoteMessage) => {
|
||||
this._showNotificationToast(remoteMessage);
|
||||
this._pushNavigate(remoteMessage);
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user