Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Suppress errors globally
pipelineManager.addSuppressedErrors([
errorCodes.EACCESS,
errorCodes.ENOTFOUND,
errorCodes.EVALIDATION,
]);
// Map the error events into the Observable streams.
errorEmitter.addListener(SOURCE_APP, error => dispatch(appError(error)));
errorEmitter.addListener(SOURCE_PIPELINE, error => dispatch(pipelineError(error)));
/** @returns {*} */
const viewVisibility = () => events.emit(UI_VISIBILITY_CHANGE);
event.addCallback('routeDidChange', viewVisibility);
event.addCallback(APP_EVENT_VIEW_DID_DISAPPEAR, () => {
dispatch(pwaDidDisappear());
viewVisibility();
});
event.addCallback(APP_EVENT_VIEW_DID_APPEAR, () => {
dispatch(pwaDidAppear());
clearUpInAppBrowser(isAndroid(getState()));
});
});
pipelineManager.addSuppressedErrors([
errorCodes.EACCESS,
errorCodes.ENOTFOUND,
errorCodes.EVALIDATION,
]);
// Map the error events into the Observable streams.
errorEmitter.addListener(SOURCE_APP, error => dispatch(appError(error)));
errorEmitter.addListener(SOURCE_PIPELINE, error => dispatch(pipelineError(error)));
/** @returns {*} */
const viewVisibility = () => events.emit(UI_VISIBILITY_CHANGE);
event.addCallback('routeDidChange', viewVisibility);
event.addCallback(APP_EVENT_VIEW_DID_DISAPPEAR, () => {
dispatch(pwaDidDisappear());
viewVisibility();
});
event.addCallback(APP_EVENT_VIEW_DID_APPEAR, () => {
dispatch(pwaDidAppear());
clearUpInAppBrowser(isAndroid(getState()));
});
});
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('connectivityDidChange', (data) => {
dispatch(receiveClientConnectivity(data));
});
/**
* The following events are sometimes sent by the app, but don't need to be handled right now.
* To avoid console warnings from the event system, empty handlers are registered here.
*/
event.addCallback(APP_EVENT_VIEW_WILL_DISAPPEAR, () => {
// Stop all playing video
embeddedMedia.stop();
});
event.addCallback('pageInsetsChanged', () => {});
/*
* Onload must be send AFTER app did start.
* Interjections events (like openPushMessage) would not work if this command is sent
* before registering to interjections.
*/
onload();
});
pathname: data.redirectTo,
}));
}
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('connectivityDidChange', (data) => {
dispatch(receiveClientConnectivity(data));
});
/**
* The following events are sometimes sent by the app, but don't need to be handled right now.
* To avoid console warnings from the event system, empty handlers are registered here.
*/
event.addCallback(APP_EVENT_VIEW_WILL_DISAPPEAR, () => {
// Stop all playing video
embeddedMedia.stop();
});
event.addCallback('pageInsetsChanged', () => {});
/*
* Onload must be send AFTER app did start.
* Interjections events (like openPushMessage) would not work if this command is sent
* before registering to interjections.
*/
onload();
});
// Register for custom events
registerEvents([
EVENT_KEYBOARD_WILL_CHANGE,
'showPreviousTab',
'closeInAppBrowser',
// TODO The iOS apps don't emit the event to the webviews without registration till Lib 15.2.
// This needs to be removed, when IOS-1886 is done and the the iOS apps are updated.
'httpResponse',
'connectivityDidChange',
]);
// Add event callbacks
event.addCallback('pageContext', pageContext);
// Handle native/legacy navigation bar
event.addCallback(APP_EVENT_VIEW_WILL_APPEAR, prepareLegacyNavigation);
event.addCallback('showPreviousTab', showPreviousTab);
/**
* This event is triggered form the desktop shop in the inAppBrowser.
* We have to close the inAppBrowser and redirect the user to the given url.
*/
event.addCallback('closeInAppBrowser', (data = {}) => {
if (data.redirectTo) {
dispatch(historyPush({
pathname: data.redirectTo,
}));
}
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('connectivityDidChange', (data) => {
dispatch(receiveClientConnectivity(data));
subscribe(appDidStart$, ({ dispatch, getState }) => {
// Register for custom events
registerEvents([
EVENT_KEYBOARD_WILL_CHANGE,
'showPreviousTab',
'closeInAppBrowser',
// TODO The iOS apps don't emit the event to the webviews without registration till Lib 15.2.
// This needs to be removed, when IOS-1886 is done and the the iOS apps are updated.
'httpResponse',
'connectivityDidChange',
]);
// Add event callbacks
event.addCallback('pageContext', pageContext);
// Handle native/legacy navigation bar
event.addCallback(APP_EVENT_VIEW_WILL_APPEAR, prepareLegacyNavigation);
event.addCallback('showPreviousTab', showPreviousTab);
/**
* This event is triggered form the desktop shop in the inAppBrowser.
* We have to close the inAppBrowser and redirect the user to the given url.
*/
event.addCallback('closeInAppBrowser', (data = {}) => {
if (data.redirectTo) {
dispatch(historyPush({
pathname: data.redirectTo,
}));
}
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('showPreviousTab', showPreviousTab);
/**
* This event is triggered form the desktop shop in the inAppBrowser.
* We have to close the inAppBrowser and redirect the user to the given url.
*/
event.addCallback('closeInAppBrowser', (data = {}) => {
if (data.redirectTo) {
dispatch(historyPush({
pathname: data.redirectTo,
}));
}
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('connectivityDidChange', (data) => {
dispatch(receiveClientConnectivity(data));
});
/**
* The following events are sometimes sent by the app, but don't need to be handled right now.
* To avoid console warnings from the event system, empty handlers are registered here.
*/
event.addCallback(APP_EVENT_VIEW_WILL_DISAPPEAR, () => {
// Stop all playing video
embeddedMedia.stop();
});
event.addCallback('pageInsetsChanged', () => {});
/*
* Onload must be send AFTER app did start.
* Interjections events (like openPushMessage) would not work if this command is sent
subscribe(appDidStart$, ({ dispatch, getState }) => {
// Register for custom events
registerEvents([
EVENT_KEYBOARD_WILL_CHANGE,
'showPreviousTab',
'closeInAppBrowser',
// TODO The iOS apps don't emit the event to the webviews without registration till Lib 15.2.
// This needs to be removed, when IOS-1886 is done and the the iOS apps are updated.
'httpResponse',
'connectivityDidChange',
]);
// Add event callbacks
event.addCallback('pageContext', pageContext);
// Handle native/legacy navigation bar
event.addCallback(APP_EVENT_VIEW_WILL_APPEAR, prepareLegacyNavigation);
event.addCallback('showPreviousTab', showPreviousTab);
/**
* This event is triggered form the desktop shop in the inAppBrowser.
* We have to close the inAppBrowser and redirect the user to the given url.
*/
event.addCallback('closeInAppBrowser', (data = {}) => {
if (data.redirectTo) {
dispatch(historyPush({
pathname: data.redirectTo,
}));
}
closeInAppBrowser(isAndroid(getState()));
});
event.addCallback('connectivityDidChange', (data) => {
registerEvents([
'openPushNotification',
'openDeepLink',
'openUniversalLink',
]);
event.addCallback('openPushNotification', payload => (
dispatch(handlePushNotification(payload))
));
event.addCallback('openDeepLink', payload => (
dispatch(handleDeepLink(payload))
));
event.addCallback('openUniversalLink', payload => (
dispatch(handleUniversalLink(payload))
));
dispatch(didRegisterLinkEvents());
};
}
return (dispatch) => {
dispatch(willRegisterLinkEvents());
registerEvents([
'openPushNotification',
'openDeepLink',
'openUniversalLink',
]);
event.addCallback('openPushNotification', payload => (
dispatch(handlePushNotification(payload))
));
event.addCallback('openDeepLink', payload => (
dispatch(handleDeepLink(payload))
));
event.addCallback('openUniversalLink', payload => (
dispatch(handleUniversalLink(payload))
));
dispatch(didRegisterLinkEvents());
};
}