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