MOBILE-3068 analytics: Don't call logEvent if user disabled
parent
587a8e4114
commit
44f2122298
|
@ -342,6 +342,10 @@ export class CorePushNotificationsProvider {
|
||||||
const win = <any> window; // This feature is only present in our fork of the plugin.
|
const win = <any> window; // This feature is only present in our fork of the plugin.
|
||||||
|
|
||||||
if (CoreConfigConstants.enableanalytics && win.PushNotification && win.PushNotification.logEvent) {
|
if (CoreConfigConstants.enableanalytics && win.PushNotification && win.PushNotification.logEvent) {
|
||||||
|
|
||||||
|
// Check if the analytics is enabled by the user.
|
||||||
|
return this.configProvider.get(CoreConstants.SETTINGS_ANALYTICS_ENABLED, true).then((enabled) => {
|
||||||
|
if (enabled) {
|
||||||
return new Promise((resolve, reject): void => {
|
return new Promise((resolve, reject): void => {
|
||||||
win.PushNotification.logEvent(resolve, (error) => {
|
win.PushNotification.logEvent(resolve, (error) => {
|
||||||
this.logger.error('Error logging firebase event', name, error);
|
this.logger.error('Error logging firebase event', name, error);
|
||||||
|
@ -349,6 +353,8 @@ export class CorePushNotificationsProvider {
|
||||||
}, name, data, !!filter);
|
}, name, data, !!filter);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue