Removed mandatory loading of firebase messaging as it does not support Safari.
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
import { notification } from "antd";
|
||||
import React, { Component } from "react";
|
||||
import { messaging } from "../../firebase/firebase.utils";
|
||||
import { withApollo } from "react-apollo";
|
||||
import { UPDATE_FCM_TOKEN } from "../../graphql/user.queries";
|
||||
import { connect } from "react-redux";
|
||||
import { createStructuredSelector } from "reselect";
|
||||
import { messaging } from "../../firebase/firebase.utils";
|
||||
import { UPDATE_FCM_TOKEN } from "../../graphql/user.queries";
|
||||
import { selectCurrentUser } from "../../redux/user/user.selectors";
|
||||
const mapStateToProps = createStructuredSelector({
|
||||
currentUser: selectCurrentUser,
|
||||
@@ -16,6 +15,8 @@ const mapDispatchToProps = (dispatch) => ({
|
||||
class FcmNotificationComponent extends Component {
|
||||
async componentDidMount() {
|
||||
const { client, currentUser } = this.props;
|
||||
if (!!!messaging) return; //Skip all of the notification functionality if the firebase SDK could not start.
|
||||
|
||||
messaging
|
||||
.requestPermission()
|
||||
.then(async function () {
|
||||
@@ -31,7 +32,6 @@ class FcmNotificationComponent extends Component {
|
||||
});
|
||||
navigator.serviceWorker.addEventListener("message", (message) => {
|
||||
const { payload } = message.data.firebaseMessaging;
|
||||
// notification["info"]({ message: JSON.stringify(payload) });
|
||||
|
||||
navigator.serviceWorker.getRegistration().then((registration) =>
|
||||
registration.showNotification(payload.notification.title, {
|
||||
@@ -50,7 +50,7 @@ class FcmNotificationComponent extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
return <div></div>;
|
||||
return <span />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user