Fix email confirmation dialog on startup
This commit is contained in:
@@ -11,7 +11,6 @@ import {enableFreeze} from 'react-native-screens'
|
|||||||
import 'view/icons'
|
import 'view/icons'
|
||||||
|
|
||||||
import {init as initPersistedState} from '#/state/persisted'
|
import {init as initPersistedState} from '#/state/persisted'
|
||||||
import {init as initReminders} from '#/state/shell/reminders'
|
|
||||||
import {listenSessionDropped} from './state/events'
|
import {listenSessionDropped} from './state/events'
|
||||||
import {useColorMode} from 'state/shell'
|
import {useColorMode} from 'state/shell'
|
||||||
import {ThemeProvider} from 'lib/ThemeContext'
|
import {ThemeProvider} from 'lib/ThemeContext'
|
||||||
@@ -48,7 +47,6 @@ function InnerApp() {
|
|||||||
|
|
||||||
// init
|
// init
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initReminders()
|
|
||||||
analytics.init()
|
analytics.init()
|
||||||
notifications.init(queryClient)
|
notifications.init(queryClient)
|
||||||
listenSessionDropped(() => {
|
listenSessionDropped(() => {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import {enableFreeze} from 'react-native-screens'
|
|||||||
import 'view/icons'
|
import 'view/icons'
|
||||||
|
|
||||||
import {init as initPersistedState} from '#/state/persisted'
|
import {init as initPersistedState} from '#/state/persisted'
|
||||||
import {init as initReminders} from '#/state/shell/reminders'
|
|
||||||
import {useColorMode} from 'state/shell'
|
import {useColorMode} from 'state/shell'
|
||||||
import * as analytics from 'lib/analytics/analytics'
|
import * as analytics from 'lib/analytics/analytics'
|
||||||
import {Shell} from 'view/shell/index'
|
import {Shell} from 'view/shell/index'
|
||||||
@@ -41,7 +40,6 @@ function InnerApp() {
|
|||||||
|
|
||||||
// init
|
// init
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
initReminders()
|
|
||||||
analytics.init()
|
analytics.init()
|
||||||
const account = persisted.get('session').currentAccount
|
const account = persisted.get('session').currentAccount
|
||||||
resumeSession(account)
|
resumeSession(account)
|
||||||
|
|||||||
@@ -35,6 +35,12 @@ import {bskyTitle} from 'lib/strings/headings'
|
|||||||
import {JSX} from 'react/jsx-runtime'
|
import {JSX} from 'react/jsx-runtime'
|
||||||
import {timeout} from 'lib/async/timeout'
|
import {timeout} from 'lib/async/timeout'
|
||||||
import {useUnreadNotifications} from './state/queries/notifications/unread'
|
import {useUnreadNotifications} from './state/queries/notifications/unread'
|
||||||
|
import {useSession} from './state/session'
|
||||||
|
import {useModalControls} from './state/modals'
|
||||||
|
import {
|
||||||
|
shouldRequestEmailConfirmation,
|
||||||
|
setEmailConfirmationRequested,
|
||||||
|
} from './state/shell/reminders'
|
||||||
|
|
||||||
import {HomeScreen} from './view/screens/Home'
|
import {HomeScreen} from './view/screens/Home'
|
||||||
import {SearchScreen} from './view/screens/Search'
|
import {SearchScreen} from './view/screens/Search'
|
||||||
@@ -464,6 +470,16 @@ const LINKING = {
|
|||||||
|
|
||||||
function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
||||||
const theme = useColorSchemeStyle(DefaultTheme, DarkTheme)
|
const theme = useColorSchemeStyle(DefaultTheme, DarkTheme)
|
||||||
|
const {currentAccount} = useSession()
|
||||||
|
const {openModal} = useModalControls()
|
||||||
|
|
||||||
|
function onReady() {
|
||||||
|
if (currentAccount && shouldRequestEmailConfirmation(currentAccount)) {
|
||||||
|
openModal({name: 'verify-email', showReminder: true})
|
||||||
|
setEmailConfirmationRequested()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NavigationContainer
|
<NavigationContainer
|
||||||
ref={navigationRef}
|
ref={navigationRef}
|
||||||
@@ -472,6 +488,7 @@ function RoutesContainer({children}: React.PropsWithChildren<{}>) {
|
|||||||
onReady={() => {
|
onReady={() => {
|
||||||
SplashScreen.hideAsync()
|
SplashScreen.hideAsync()
|
||||||
logModuleInitTime()
|
logModuleInitTime()
|
||||||
|
onReady()
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
</NavigationContainer>
|
</NavigationContainer>
|
||||||
|
|||||||
@@ -2,17 +2,6 @@ import * as persisted from '#/state/persisted'
|
|||||||
import {toHashCode} from 'lib/strings/helpers'
|
import {toHashCode} from 'lib/strings/helpers'
|
||||||
import {isOnboardingActive} from './onboarding'
|
import {isOnboardingActive} from './onboarding'
|
||||||
import {SessionAccount} from '../session'
|
import {SessionAccount} from '../session'
|
||||||
import {listenSessionLoaded} from '../events'
|
|
||||||
import {unstable__openModal} from '../modals'
|
|
||||||
|
|
||||||
export function init() {
|
|
||||||
listenSessionLoaded(account => {
|
|
||||||
if (shouldRequestEmailConfirmation(account)) {
|
|
||||||
unstable__openModal({name: 'verify-email', showReminder: true})
|
|
||||||
setEmailConfirmationRequested()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export function shouldRequestEmailConfirmation(account: SessionAccount) {
|
export function shouldRequestEmailConfirmation(account: SessionAccount) {
|
||||||
if (!account) {
|
if (!account) {
|
||||||
|
|||||||
Reference in New Issue
Block a user