-
Notifications
You must be signed in to change notification settings - Fork 577
/
PushPromptLogicModel.ts
39 lines (35 loc) · 1.66 KB
/
PushPromptLogicModel.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { Action, action } from "easy-peasy"
export interface PushPromptLogicModel {
pushPermissionsRequestedThisSession: boolean
pushNotificationSettingsPromptSeen: boolean
pushNotificationSystemDialogRejected: boolean
pushNotificationSystemDialogSeen: boolean
pushNotificationDialogLastSeenTimestamp: number | null
setPushPermissionsRequestedThisSession: Action<PushPromptLogicModel, boolean>
setPushNotificationSettingsPromptSeen: Action<PushPromptLogicModel, boolean>
setPushNotificationSystemDialogRejected: Action<PushPromptLogicModel, boolean>
setPushNotificationSystemDialogSeen: Action<PushPromptLogicModel, boolean>
setPushNotificationDialogLastSeenTimestamp: Action<PushPromptLogicModel, number>
}
export const getPushPromptLogicModel = (): PushPromptLogicModel => ({
pushPermissionsRequestedThisSession: false,
pushNotificationSettingsPromptSeen: false,
pushNotificationSystemDialogRejected: false,
pushNotificationSystemDialogSeen: false,
pushNotificationDialogLastSeenTimestamp: null,
setPushPermissionsRequestedThisSession: action((state, payload) => {
state.pushPermissionsRequestedThisSession = payload
}),
setPushNotificationSettingsPromptSeen: action((state, payload) => {
state.pushNotificationSettingsPromptSeen = payload
}),
setPushNotificationSystemDialogRejected: action((state, payload) => {
state.pushNotificationSystemDialogRejected = payload
}),
setPushNotificationSystemDialogSeen: action((state, payload) => {
state.pushNotificationSystemDialogSeen = payload
}),
setPushNotificationDialogLastSeenTimestamp: action((state, payload) => {
state.pushNotificationDialogLastSeenTimestamp = payload
}),
})