add a `Login` notifications request (#4006)
parent
fce65b74ff
commit
fd704bfd44
|
@ -72,7 +72,7 @@ export function useRequestNotificationsPermission() {
|
|||
const gate = useGate()
|
||||
|
||||
return React.useCallback(
|
||||
async (context: 'StartOnboarding' | 'AfterOnboarding') => {
|
||||
async (context: 'StartOnboarding' | 'AfterOnboarding' | 'Login') => {
|
||||
const permissions = await Notifications.getPermissionsAsync()
|
||||
|
||||
if (
|
||||
|
@ -97,6 +97,7 @@ export function useRequestNotificationsPermission() {
|
|||
|
||||
const res = await Notifications.requestPermissionsAsync()
|
||||
logEvent('notifications:request', {
|
||||
context: context,
|
||||
status: res.status,
|
||||
})
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ export type LogEvents = {
|
|||
}
|
||||
'notifications:openApp': {}
|
||||
'notifications:request': {
|
||||
context: 'StartOnboarding' | 'AfterOnboarding' | 'Login'
|
||||
status: 'granted' | 'denied' | 'undetermined'
|
||||
}
|
||||
'state:background': {
|
||||
|
|
|
@ -19,6 +19,7 @@ import {cleanError} from '#/lib/strings/errors'
|
|||
import {createFullHandle} from '#/lib/strings/handles'
|
||||
import {logger} from '#/logger'
|
||||
import {useSessionApi} from '#/state/session'
|
||||
import {useRequestNotificationsPermission} from 'lib/notifications/notifications'
|
||||
import {atoms as a, useTheme} from '#/alf'
|
||||
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
|
||||
import {FormError} from '#/components/forms/FormError'
|
||||
|
@ -65,6 +66,7 @@ export const LoginForm = ({
|
|||
const passwordInputRef = useRef<TextInput>(null)
|
||||
const {_} = useLingui()
|
||||
const {login} = useSessionApi()
|
||||
const requestNotificationsPermission = useRequestNotificationsPermission()
|
||||
|
||||
const onPressSelectService = React.useCallback(() => {
|
||||
Keyboard.dismiss()
|
||||
|
@ -111,6 +113,7 @@ export const LoginForm = ({
|
|||
},
|
||||
'LoginForm',
|
||||
)
|
||||
requestNotificationsPermission('Login')
|
||||
} catch (e: any) {
|
||||
const errMsg = e.toString()
|
||||
LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut)
|
||||
|
|
Loading…
Reference in New Issue