diff --git a/lib/actions/alert-actions.js b/lib/actions/alert-actions.js new file mode 100644 --- /dev/null +++ b/lib/actions/alert-actions.js @@ -0,0 +1,5 @@ +// @flow + +const recordNotifPermissionAlertActionType = 'RECORD_NOTIF_PERMISSION_ALERT'; + +export { recordNotifPermissionAlertActionType }; diff --git a/lib/reducers/alert-reducer.js b/lib/reducers/alert-reducer.js --- a/lib/reducers/alert-reducer.js +++ b/lib/reducers/alert-reducer.js @@ -1,8 +1,8 @@ // @flow +import { recordNotifPermissionAlertActionType } from '../actions/alert-actions.js'; import { alertTypes, type AlertStore } from '../types/alert-types.js'; import type { BaseAction } from '../types/redux-types'; -import { recordNotifPermissionAlertActionType } from '../utils/push-alerts.js'; function reduceAlertStore(state: AlertStore, action: BaseAction): AlertStore { if (action.type === recordNotifPermissionAlertActionType) { diff --git a/lib/utils/push-alerts.js b/lib/utils/push-alerts.js --- a/lib/utils/push-alerts.js +++ b/lib/utils/push-alerts.js @@ -2,8 +2,6 @@ import type { AlertInfo } from '../types/alert-types.js'; -const recordNotifPermissionAlertActionType = 'RECORD_NOTIF_PERMISSION_ALERT'; - const msInDay = 24 * 60 * 60 * 1000; const shouldSkipPushPermissionAlert = (alertInfo: AlertInfo): boolean => (alertInfo.totalAlerts > 3 && @@ -13,4 +11,4 @@ (alertInfo.totalAlerts > 9 && alertInfo.lastAlertTime > Date.now() - msInDay * 7); -export { recordNotifPermissionAlertActionType, shouldSkipPushPermissionAlert }; +export { shouldSkipPushPermissionAlert }; diff --git a/native/push/push-handler.react.js b/native/push/push-handler.react.js --- a/native/push/push-handler.react.js +++ b/native/push/push-handler.react.js @@ -6,6 +6,7 @@ import { LogBox, Platform } from 'react-native'; import { Notification as InAppNotification } from 'react-native-in-app-message'; +import { recordNotifPermissionAlertActionType } from 'lib/actions/alert-actions.js'; import type { DeviceTokens, SetDeviceTokenActionPayload, @@ -38,10 +39,7 @@ convertNonPendingIDToNewSchema, convertNotificationMessageInfoToNewIDSchema, } from 'lib/utils/migration-utils.js'; -import { - recordNotifPermissionAlertActionType, - shouldSkipPushPermissionAlert, -} from 'lib/utils/push-alerts.js'; +import { shouldSkipPushPermissionAlert } from 'lib/utils/push-alerts.js'; import { type DispatchActionPromise, useDispatchActionPromise, diff --git a/web/push-notif/push-notifs-handler.js b/web/push-notif/push-notifs-handler.js --- a/web/push-notif/push-notifs-handler.js +++ b/web/push-notif/push-notifs-handler.js @@ -2,6 +2,7 @@ import * as React from 'react'; +import { recordNotifPermissionAlertActionType } from 'lib/actions/alert-actions.js'; import { useSetDeviceTokenFanout, setDeviceTokenActionTypes, @@ -13,10 +14,7 @@ import { isDesktopPlatform } from 'lib/types/device-types.js'; import { getConfig } from 'lib/utils/config.js'; import { convertNonPendingIDToNewSchema } from 'lib/utils/migration-utils.js'; -import { - shouldSkipPushPermissionAlert, - recordNotifPermissionAlertActionType, -} from 'lib/utils/push-alerts.js'; +import { shouldSkipPushPermissionAlert } from 'lib/utils/push-alerts.js'; import { useDispatchActionPromise } from 'lib/utils/redux-promise-utils.js'; import { useDispatch } from 'lib/utils/redux-utils.js';