remove comments
This commit is contained in:
@@ -13,7 +13,7 @@ import {Trending2_Stroke2_Corner2_Rounded as Trending} from '#/components/icons/
|
|||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
import {useOnboardingDispatch} from '#/state/shell'
|
import {useOnboardingDispatch} from '#/state/shell'
|
||||||
import {Loader} from '#/components/Loader'
|
import {Loader} from '#/components/Loader'
|
||||||
// import {useSetSaveFeedsMutation} from '#/state/queries/preferences'
|
import {useSetSaveFeedsMutation} from '#/state/queries/preferences'
|
||||||
import {getAgent} from '#/state/session'
|
import {getAgent} from '#/state/session'
|
||||||
import {useAnalytics} from '#/lib/analytics/analytics'
|
import {useAnalytics} from '#/lib/analytics/analytics'
|
||||||
|
|
||||||
@@ -25,10 +25,10 @@ import {
|
|||||||
} from '#/screens/Onboarding/Layout'
|
} from '#/screens/Onboarding/Layout'
|
||||||
import {IconCircle} from '#/components/IconCircle'
|
import {IconCircle} from '#/components/IconCircle'
|
||||||
import {uploadBlob} from 'lib/api'
|
import {uploadBlob} from 'lib/api'
|
||||||
// import {
|
import {
|
||||||
// bulkWriteFollows,
|
bulkWriteFollows,
|
||||||
// sortPrimaryAlgorithmFeeds,
|
sortPrimaryAlgorithmFeeds,
|
||||||
// } from '#/screens/Onboarding/util'
|
} from '#/screens/Onboarding/util'
|
||||||
|
|
||||||
export function StepFinished() {
|
export function StepFinished() {
|
||||||
const {_} = useLingui()
|
const {_} = useLingui()
|
||||||
@@ -38,38 +38,37 @@ export function StepFinished() {
|
|||||||
const {state, dispatch} = React.useContext(Context)
|
const {state, dispatch} = React.useContext(Context)
|
||||||
const onboardDispatch = useOnboardingDispatch()
|
const onboardDispatch = useOnboardingDispatch()
|
||||||
const [saving, setSaving] = React.useState(false)
|
const [saving, setSaving] = React.useState(false)
|
||||||
// const {mutateAsync: saveFeeds} = useSetSaveFeedsMutation()
|
const {mutateAsync: saveFeeds} = useSetSaveFeedsMutation()
|
||||||
|
|
||||||
const finishOnboarding = React.useCallback(async () => {
|
const finishOnboarding = React.useCallback(async () => {
|
||||||
setSaving(true)
|
setSaving(true)
|
||||||
|
|
||||||
// TODO uncomment
|
// TODO uncomment
|
||||||
const {
|
const {
|
||||||
// interestsStepResults,
|
interestsStepResults,
|
||||||
// suggestedAccountsStepResults,
|
suggestedAccountsStepResults,
|
||||||
// algoFeedsStepResults,
|
algoFeedsStepResults,
|
||||||
// topicalFeedsStepResults,
|
topicalFeedsStepResults,
|
||||||
profileStepResults,
|
profileStepResults,
|
||||||
} = state
|
} = state
|
||||||
// const {selectedInterests} = interestsStepResults
|
const {selectedInterests} = interestsStepResults
|
||||||
// const selectedFeeds = [
|
const selectedFeeds = [
|
||||||
// ...sortPrimaryAlgorithmFeeds(algoFeedsStepResults.feedUris),
|
...sortPrimaryAlgorithmFeeds(algoFeedsStepResults.feedUris),
|
||||||
// ...topicalFeedsStepResults.feedUris,
|
...topicalFeedsStepResults.feedUris,
|
||||||
// ]
|
]
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// TODO uncomment!
|
await Promise.all([
|
||||||
// await Promise.all([
|
bulkWriteFollows(suggestedAccountsStepResults.accountDids),
|
||||||
// bulkWriteFollows(suggestedAccountsStepResults.accountDids),
|
// these must be serial
|
||||||
// // these must be serial
|
(async () => {
|
||||||
// (async () => {
|
await getAgent().setInterestsPref({tags: selectedInterests})
|
||||||
// await getAgent().setInterestsPref({tags: selectedInterests})
|
await saveFeeds({
|
||||||
// await saveFeeds({
|
saved: selectedFeeds,
|
||||||
// saved: selectedFeeds,
|
pinned: selectedFeeds,
|
||||||
// pinned: selectedFeeds,
|
})
|
||||||
// })
|
})(),
|
||||||
// })(),
|
])
|
||||||
// ])
|
|
||||||
|
|
||||||
await getAgent().upsertProfile(async existing => {
|
await getAgent().upsertProfile(async existing => {
|
||||||
existing = existing ?? {}
|
existing = existing ?? {}
|
||||||
@@ -99,7 +98,7 @@ export function StepFinished() {
|
|||||||
onboardDispatch({type: 'finish'})
|
onboardDispatch({type: 'finish'})
|
||||||
track('OnboardingV2:StepFinished:End')
|
track('OnboardingV2:StepFinished:End')
|
||||||
track('OnboardingV2:Complete')
|
track('OnboardingV2:Complete')
|
||||||
}, [dispatch, onboardDispatch, state, track])
|
}, [dispatch, onboardDispatch, saveFeeds, state, track])
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
track('OnboardingV2:StepFinished:Start')
|
track('OnboardingV2:StepFinished:Start')
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import {useTheme} from '#/alf'
|
|||||||
import {usePhotoLibraryPermission} from 'lib/hooks/usePermissions'
|
import {usePhotoLibraryPermission} from 'lib/hooks/usePermissions'
|
||||||
import {openPicker} from 'lib/media/picker.shared'
|
import {openPicker} from 'lib/media/picker.shared'
|
||||||
import {openCropper} from 'lib/media/picker'
|
import {openCropper} from 'lib/media/picker'
|
||||||
|
import {compressIfNeeded} from 'lib/media/manip'
|
||||||
|
import {isWeb} from 'platform/detection'
|
||||||
|
|
||||||
export function SelectImageButton() {
|
export function SelectImageButton() {
|
||||||
const t = useTheme()
|
const t = useTheme()
|
||||||
@@ -23,6 +25,17 @@ export function SelectImageButton() {
|
|||||||
const item = items[0]
|
const item = items[0]
|
||||||
if (!item) return
|
if (!item) return
|
||||||
|
|
||||||
|
// TODO we need an alf modal for the cropper
|
||||||
|
if (isWeb) {
|
||||||
|
const compressedImage = await compressIfNeeded(item)
|
||||||
|
|
||||||
|
setAvatar(prev => ({
|
||||||
|
...prev,
|
||||||
|
image: compressedImage,
|
||||||
|
}))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const croppedImage = await openCropper({
|
const croppedImage = await openCropper({
|
||||||
mediaType: 'photo',
|
mediaType: 'photo',
|
||||||
cropperCircleOverlay: true,
|
cropperCircleOverlay: true,
|
||||||
@@ -31,9 +44,11 @@ export function SelectImageButton() {
|
|||||||
path: item.path,
|
path: item.path,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const compressedImage = await compressIfNeeded(croppedImage)
|
||||||
|
|
||||||
setAvatar(prev => ({
|
setAvatar(prev => ({
|
||||||
...prev,
|
...prev,
|
||||||
image: croppedImage,
|
image: compressedImage,
|
||||||
}))
|
}))
|
||||||
}, [requestPhotoAccessIfNeeded, setAvatar])
|
}, [requestPhotoAccessIfNeeded, setAvatar])
|
||||||
|
|
||||||
|
|||||||
@@ -62,20 +62,9 @@ export function StepProfile() {
|
|||||||
placeholder: emojiItems.smile,
|
placeholder: emojiItems.smile,
|
||||||
backgroundColor: '#338388',
|
backgroundColor: '#338388',
|
||||||
})
|
})
|
||||||
const [uri, setUri] = React.useState('')
|
|
||||||
|
|
||||||
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
const canvasRef = React.useRef<PlaceholderCanvasRef>(null)
|
||||||
|
|
||||||
// React.useEffect(() => {
|
|
||||||
// // TODO remove, this is for testing
|
|
||||||
// ;(async () => {
|
|
||||||
// const res = await canvasRef.current?.capture()
|
|
||||||
// if (res) {
|
|
||||||
// setUri(res)
|
|
||||||
// }
|
|
||||||
// })()
|
|
||||||
// }, [avatar])
|
|
||||||
|
|
||||||
React.useEffect(() => {
|
React.useEffect(() => {
|
||||||
track('OnboardingV2:StepProfile:Start')
|
track('OnboardingV2:StepProfile:Start')
|
||||||
}, [track])
|
}, [track])
|
||||||
@@ -123,12 +112,6 @@ export function StepProfile() {
|
|||||||
</View>
|
</View>
|
||||||
<Items type="emojis" />
|
<Items type="emojis" />
|
||||||
<Items type="colors" />
|
<Items type="colors" />
|
||||||
{/* TODO remove, testing */}
|
|
||||||
<Image
|
|
||||||
source={uri}
|
|
||||||
style={{height: 100, width: 100}}
|
|
||||||
accessibilityIgnoresInvertColors
|
|
||||||
/>
|
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<OnboardingControls.Portal>
|
<OnboardingControls.Portal>
|
||||||
|
|||||||
Reference in New Issue
Block a user