Create codemod for updating Toast calls to v2 (#10045)
This commit is contained in:
@@ -5,7 +5,7 @@ import {useLingui} from '@lingui/react'
|
||||
import {logger} from '#/logger'
|
||||
import {type SessionAccount, useSessionApi} from '#/state/session'
|
||||
import {useLoggedOutViewControls} from '#/state/shell/logged-out'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {useAnalytics} from '#/analytics'
|
||||
import {type Metrics} from '#/analytics/metrics'
|
||||
import {IS_WEB} from '#/env'
|
||||
@@ -42,20 +42,18 @@ export function useAccountSwitcher() {
|
||||
Toast.show(_(msg`Signed in as @${account.handle}`))
|
||||
} else {
|
||||
requestSwitchToAccount({requestedAccount: account.did})
|
||||
Toast.show(
|
||||
_(msg`Please sign in as @${account.handle}`),
|
||||
'circle-exclamation',
|
||||
)
|
||||
Toast.show(_(msg`Please sign in as @${account.handle}`), {
|
||||
type: 'warning',
|
||||
})
|
||||
}
|
||||
} catch (e: any) {
|
||||
logger.error(`switch account: selectAccount failed`, {
|
||||
message: e.message,
|
||||
})
|
||||
requestSwitchToAccount({requestedAccount: account.did})
|
||||
Toast.show(
|
||||
_(msg`Please sign in as @${account.handle}`),
|
||||
'circle-exclamation',
|
||||
)
|
||||
Toast.show(_(msg`Please sign in as @${account.handle}`), {
|
||||
type: 'warning',
|
||||
})
|
||||
} finally {
|
||||
setPendingDid(null)
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import {
|
||||
import {t} from '@lingui/core/macro'
|
||||
|
||||
import {type ImageMeta} from '#/state/gallery'
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {IS_IOS, IS_WEB} from '#/env'
|
||||
import {VIDEO_MAX_DURATION_MS} from '../constants'
|
||||
import {getDataUriSize} from './util'
|
||||
@@ -30,7 +30,9 @@ export async function openPicker(opts?: ImagePickerOptions) {
|
||||
return (response.assets ?? [])
|
||||
.filter(asset => {
|
||||
if (asset.mimeType?.startsWith('image/')) return true
|
||||
Toast.show(t`Only image files are supported`, 'exclamation-circle')
|
||||
Toast.show(t`Only image files are supported`, {
|
||||
type: 'warning',
|
||||
})
|
||||
return false
|
||||
})
|
||||
.map(image => ({
|
||||
|
||||
+7
-3
@@ -3,7 +3,7 @@ import {Share} from 'react-native'
|
||||
import {setStringAsync} from 'expo-clipboard'
|
||||
import {t} from '@lingui/core/macro'
|
||||
|
||||
import * as Toast from '#/view/com/util/Toast'
|
||||
import * as Toast from '#/components/Toast'
|
||||
import {IS_ANDROID, IS_IOS} from '#/env'
|
||||
|
||||
/**
|
||||
@@ -21,7 +21,9 @@ export async function shareUrl(url: string) {
|
||||
// React Native Share is not supported by web. Web Share API
|
||||
// has increasing but not full support, so default to clipboard
|
||||
setStringAsync(url)
|
||||
Toast.show(t`Copied to clipboard`, 'clipboard-check')
|
||||
Toast.show(t`Copied to clipboard`, {
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +39,8 @@ export async function shareText(text: string) {
|
||||
await Share.share({message: text})
|
||||
} else {
|
||||
await setStringAsync(text)
|
||||
Toast.show(t`Copied to clipboard`, 'clipboard-check')
|
||||
Toast.show(t`Copied to clipboard`, {
|
||||
type: 'success',
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user