@umituz/react-native-ai-generation-content 1.26.2 → 1.26.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/src/domains/generation/application/feature-registry.ts +101 -0
- package/src/domains/generation/application/generation-strategy.factory.ts +128 -0
- package/src/domains/generation/domain/feature-config.types.ts +61 -0
- package/src/domains/generation/domain/generation.types.ts +74 -0
- package/src/domains/generation/index.ts +37 -0
- package/src/domains/generation/presentation/useAIGeneration.hook.ts +106 -0
- package/src/domains/wizard/infrastructure/strategies/wizard-strategy.factory.ts +3 -4
- package/src/index.ts +1 -25
- package/src/infrastructure/executors/executor-factory.ts +53 -0
- package/src/infrastructure/executors/image-executor.ts +133 -0
- package/src/infrastructure/executors/video-executor.ts +130 -0
- package/src/features/ai-hug/README.md +0 -438
- package/src/features/ai-hug/domain/index.ts +0 -5
- package/src/features/ai-hug/domain/types/ai-hug.types.ts +0 -25
- package/src/features/ai-hug/domain/types/index.ts +0 -7
- package/src/features/ai-hug/index.ts +0 -19
- package/src/features/ai-hug/presentation/components/AIHugFeature.tsx +0 -77
- package/src/features/ai-hug/presentation/components/index.ts +0 -2
- package/src/features/ai-hug/presentation/hooks/index.ts +0 -9
- package/src/features/ai-hug/presentation/hooks/useAIHugFeature.ts +0 -34
- package/src/features/ai-hug/presentation/index.ts +0 -6
- package/src/features/ai-kiss/README.md +0 -445
- package/src/features/ai-kiss/domain/index.ts +0 -5
- package/src/features/ai-kiss/domain/types/ai-kiss.types.ts +0 -25
- package/src/features/ai-kiss/domain/types/index.ts +0 -7
- package/src/features/ai-kiss/index.ts +0 -19
- package/src/features/ai-kiss/presentation/components/AIKissFeature.tsx +0 -77
- package/src/features/ai-kiss/presentation/components/index.ts +0 -2
- package/src/features/ai-kiss/presentation/hooks/index.ts +0 -9
- package/src/features/ai-kiss/presentation/hooks/useAIKissFeature.ts +0 -34
- package/src/features/ai-kiss/presentation/index.ts +0 -6
- package/src/features/anime-selfie/README.md +0 -396
- package/src/features/anime-selfie/domain/index.ts +0 -5
- package/src/features/anime-selfie/domain/types/anime-selfie.types.ts +0 -52
- package/src/features/anime-selfie/domain/types/index.ts +0 -8
- package/src/features/anime-selfie/index.ts +0 -20
- package/src/features/anime-selfie/presentation/components/AnimeSelfieFeature.tsx +0 -86
- package/src/features/anime-selfie/presentation/components/index.ts +0 -2
- package/src/features/anime-selfie/presentation/hooks/index.ts +0 -9
- package/src/features/anime-selfie/presentation/hooks/useAnimeSelfieFeature.ts +0 -59
- package/src/features/anime-selfie/presentation/index.ts +0 -6
- package/src/features/couple-future/README.md +0 -445
- package/src/features/couple-future/domain/types.ts +0 -63
- package/src/features/couple-future/domain/wizard-config.adapter.ts +0 -76
- package/src/features/couple-future/domain/wizard.types.ts +0 -121
- package/src/features/couple-future/index.ts +0 -83
- package/src/features/couple-future/infrastructure/coupleFeatureRegistry.ts +0 -76
- package/src/features/couple-future/infrastructure/couplePromptEnhancer.ts +0 -100
- package/src/features/couple-future/infrastructure/executor.ts +0 -188
- package/src/features/couple-future/infrastructure/generationUtils.ts +0 -228
- package/src/features/couple-future/presentation/components/ArtStyleSelector.tsx +0 -146
- package/src/features/couple-future/presentation/components/ArtistStyleSelector.tsx +0 -122
- package/src/features/couple-future/presentation/components/CoupleFutureWizard.tsx +0 -239
- package/src/features/couple-future/presentation/components/GeneratingStepContent.tsx +0 -86
- package/src/features/couple-future/presentation/components/RomanticMoodSelector.tsx +0 -147
- package/src/features/couple-future/presentation/components/WardrobeSelector.tsx +0 -141
- package/src/features/couple-future/presentation/components/index.ts +0 -12
- package/src/features/couple-future/presentation/hooks/useCoupleFutureFlow.ts +0 -166
- package/src/features/couple-future/presentation/hooks/useCoupleFutureFlow.types.ts +0 -69
- package/src/features/couple-future/presentation/hooks/useCoupleFutureHandlers.ts +0 -117
- package/src/features/couple-future/presentation/screens/CoupleFeatureScreen.tsx +0 -113
- package/src/features/face-swap/README.md +0 -431
- package/src/features/face-swap/domain/index.ts +0 -5
- package/src/features/face-swap/domain/types/face-swap.types.ts +0 -26
- package/src/features/face-swap/domain/types/index.ts +0 -7
- package/src/features/face-swap/index.ts +0 -19
- package/src/features/face-swap/presentation/components/FaceSwapFeature.tsx +0 -87
- package/src/features/face-swap/presentation/components/index.ts +0 -2
- package/src/features/face-swap/presentation/hooks/index.ts +0 -6
- package/src/features/face-swap/presentation/hooks/useFaceSwapFeature.ts +0 -35
- package/src/features/face-swap/presentation/index.ts +0 -6
- package/src/features/hd-touch-up/README.md +0 -396
- package/src/features/hd-touch-up/domain/index.ts +0 -1
- package/src/features/hd-touch-up/domain/types/hd-touch-up.types.ts +0 -62
- package/src/features/hd-touch-up/domain/types/index.ts +0 -9
- package/src/features/hd-touch-up/index.ts +0 -21
- package/src/features/hd-touch-up/presentation/components/HDTouchUpFeature.tsx +0 -86
- package/src/features/hd-touch-up/presentation/components/index.ts +0 -2
- package/src/features/hd-touch-up/presentation/hooks/index.ts +0 -1
- package/src/features/hd-touch-up/presentation/hooks/useHDTouchUpFeature.ts +0 -23
- package/src/features/hd-touch-up/presentation/index.ts +0 -2
- package/src/features/image-to-image/README.md +0 -459
- package/src/features/image-to-image/domain/index.ts +0 -1
- package/src/features/image-to-image/domain/types/base.types.ts +0 -48
- package/src/features/image-to-image/domain/types/index.ts +0 -1
- package/src/features/image-to-image/domain/types/partials/config.types.ts +0 -37
- package/src/features/image-to-image/domain/types/partials/hook.types.ts +0 -53
- package/src/features/image-to-image/domain/types/partials/metadata.types.ts +0 -32
- package/src/features/image-to-image/domain/types/partials/result.types.ts +0 -44
- package/src/features/image-to-image/domain/types/partials/state.types.ts +0 -34
- package/src/features/image-to-image/domain/types/partials/translation.types.ts +0 -57
- package/src/features/image-to-image/index.ts +0 -2
- package/src/features/image-to-image/presentation/hooks/index.ts +0 -3
- package/src/features/image-to-image/presentation/hooks/useDualImageFeature.ts +0 -204
- package/src/features/image-to-image/presentation/hooks/useImageWithPromptFeature.ts +0 -223
- package/src/features/image-to-image/presentation/hooks/useSingleImageFeature.ts +0 -166
- package/src/features/image-to-image/presentation/index.ts +0 -1
- package/src/features/image-to-video/README.md +0 -414
- package/src/features/image-to-video/domain/constants/animation.constants.ts +0 -47
- package/src/features/image-to-video/domain/constants/duration.constants.ts +0 -13
- package/src/features/image-to-video/domain/constants/form.constants.ts +0 -22
- package/src/features/image-to-video/domain/constants/index.ts +0 -23
- package/src/features/image-to-video/domain/constants/music.constants.ts +0 -53
- package/src/features/image-to-video/domain/index.ts +0 -5
- package/src/features/image-to-video/domain/types/animation.types.ts +0 -20
- package/src/features/image-to-video/domain/types/config.types.ts +0 -56
- package/src/features/image-to-video/domain/types/duration.types.ts +0 -11
- package/src/features/image-to-video/domain/types/form.types.ts +0 -35
- package/src/features/image-to-video/domain/types/image-to-video.types.ts +0 -122
- package/src/features/image-to-video/domain/types/index.ts +0 -39
- package/src/features/image-to-video/domain/types/music.types.ts +0 -21
- package/src/features/image-to-video/index.ts +0 -116
- package/src/features/image-to-video/infrastructure/index.ts +0 -1
- package/src/features/image-to-video/infrastructure/services/image-to-video-executor.ts +0 -154
- package/src/features/image-to-video/infrastructure/services/index.ts +0 -5
- package/src/features/image-to-video/presentation/components/AddMoreCard.tsx +0 -52
- package/src/features/image-to-video/presentation/components/AnimationStyleSelector.tsx +0 -135
- package/src/features/image-to-video/presentation/components/DurationSelector.tsx +0 -110
- package/src/features/image-to-video/presentation/components/EmptyGridState.tsx +0 -69
- package/src/features/image-to-video/presentation/components/GridImageItem.tsx +0 -64
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.styles.ts +0 -84
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.tsx +0 -77
- package/src/features/image-to-video/presentation/components/ImageSelectionGrid.types.ts +0 -18
- package/src/features/image-to-video/presentation/components/MusicMoodSelector.tsx +0 -181
- package/src/features/image-to-video/presentation/components/index.ts +0 -30
- package/src/features/image-to-video/presentation/hooks/index.ts +0 -27
- package/src/features/image-to-video/presentation/hooks/useFormState.ts +0 -116
- package/src/features/image-to-video/presentation/hooks/useGeneration.ts +0 -85
- package/src/features/image-to-video/presentation/hooks/useGenerationExecution.ts +0 -143
- package/src/features/image-to-video/presentation/hooks/useImageToVideoFeature.ts +0 -107
- package/src/features/image-to-video/presentation/hooks/useImageToVideoForm.ts +0 -119
- package/src/features/image-to-video/presentation/hooks/useImageToVideoValidation.ts +0 -46
- package/src/features/image-to-video/presentation/index.ts +0 -5
- package/src/features/love-message/domain/constants.ts +0 -162
- package/src/features/love-message/domain/types.ts +0 -58
- package/src/features/love-message/index.ts +0 -37
- package/src/features/love-message/infrastructure/persistence/PartnerProfileRepository.ts +0 -52
- package/src/features/love-message/infrastructure/prompts/messagePromptBuilder.ts +0 -109
- package/src/features/love-message/infrastructure/services/LoveMessageService.ts +0 -35
- package/src/features/love-message/presentation/components/CategoryGrid.tsx +0 -88
- package/src/features/love-message/presentation/components/DetailsInput.tsx +0 -74
- package/src/features/love-message/presentation/components/ExploreHeader.tsx +0 -67
- package/src/features/love-message/presentation/components/FieldInput.tsx +0 -83
- package/src/features/love-message/presentation/components/GeneratorHeader.tsx +0 -88
- package/src/features/love-message/presentation/components/LoveMessageHeroSection.tsx +0 -114
- package/src/features/love-message/presentation/components/MessageListItem.tsx +0 -77
- package/src/features/love-message/presentation/components/MessageResult.tsx +0 -105
- package/src/features/love-message/presentation/components/PartnerInput.tsx +0 -78
- package/src/features/love-message/presentation/components/ProgressDots.tsx +0 -48
- package/src/features/love-message/presentation/components/StepDetails.tsx +0 -23
- package/src/features/love-message/presentation/components/StepPartner.tsx +0 -116
- package/src/features/love-message/presentation/components/StepVibe.tsx +0 -30
- package/src/features/love-message/presentation/components/ToneSelector.tsx +0 -100
- package/src/features/love-message/presentation/components/TrendingSection.tsx +0 -130
- package/src/features/love-message/presentation/components/TypeSelector.tsx +0 -99
- package/src/features/love-message/presentation/hooks/useLoveMessageGenerator.ts +0 -114
- package/src/features/love-message/presentation/hooks/usePartnerProfile.ts +0 -43
- package/src/features/love-message/presentation/navigation/LoveMessageStack.tsx +0 -39
- package/src/features/love-message/presentation/screens/LoveMessageExploreScreen.tsx +0 -53
- package/src/features/love-message/presentation/screens/LoveMessageGeneratorScreen.tsx +0 -169
- package/src/features/love-message/presentation/screens/MessageListScreen.tsx +0 -127
- package/src/features/love-message/presentation/screens/PartnerProfileScreen.tsx +0 -119
- package/src/features/meme-generator/README.md +0 -408
- package/src/features/meme-generator/index.ts +0 -3
- package/src/features/meme-generator/infrastructure/services/MemeGenerationService.ts +0 -87
- package/src/features/meme-generator/presentation/components/MemeGeneratorFeature.tsx +0 -180
- package/src/features/meme-generator/presentation/components/index.ts +0 -2
- package/src/features/meme-generator/presentation/screens/MemeGeneratorScreen.tsx +0 -168
- package/src/features/meme-generator/presentation/screens/index.ts +0 -1
- package/src/features/partner-upload/domain/types.ts +0 -59
- package/src/features/partner-upload/index.ts +0 -30
- package/src/features/partner-upload/presentation/components/PartnerInfoInput.tsx +0 -112
- package/src/features/partner-upload/presentation/components/PhotoTips.tsx +0 -53
- package/src/features/partner-upload/presentation/components/index.ts +0 -4
- package/src/features/partner-upload/presentation/hooks/index.ts +0 -7
- package/src/features/partner-upload/presentation/hooks/usePartnerStep.ts +0 -130
- package/src/features/partner-upload/presentation/screens/PartnerStepScreen.tsx +0 -231
- package/src/features/partner-upload/presentation/screens/index.ts +0 -6
- package/src/features/photo-restoration/README.md +0 -399
- package/src/features/photo-restoration/domain/index.ts +0 -1
- package/src/features/photo-restoration/domain/types/index.ts +0 -9
- package/src/features/photo-restoration/domain/types/photo-restore.types.ts +0 -64
- package/src/features/photo-restoration/index.ts +0 -22
- package/src/features/photo-restoration/presentation/components/PhotoRestoreFeature.tsx +0 -88
- package/src/features/photo-restoration/presentation/components/PhotoRestoreResultView.tsx +0 -86
- package/src/features/photo-restoration/presentation/components/index.ts +0 -4
- package/src/features/photo-restoration/presentation/hooks/index.ts +0 -1
- package/src/features/photo-restoration/presentation/hooks/usePhotoRestoreFeature.ts +0 -23
- package/src/features/photo-restoration/presentation/index.ts +0 -2
- package/src/features/remove-background/README.md +0 -393
- package/src/features/remove-background/domain/index.ts +0 -5
- package/src/features/remove-background/domain/types/index.ts +0 -7
- package/src/features/remove-background/domain/types/remove-background.types.ts +0 -28
- package/src/features/remove-background/index.ts +0 -19
- package/src/features/remove-background/presentation/components/RemoveBackgroundFeature.tsx +0 -86
- package/src/features/remove-background/presentation/components/index.ts +0 -2
- package/src/features/remove-background/presentation/hooks/index.ts +0 -1
- package/src/features/remove-background/presentation/hooks/useRemoveBackgroundFeature.ts +0 -28
- package/src/features/remove-background/presentation/index.ts +0 -6
- package/src/features/remove-object/README.md +0 -405
- package/src/features/remove-object/domain/index.ts +0 -5
- package/src/features/remove-object/domain/types/index.ts +0 -7
- package/src/features/remove-object/domain/types/remove-object.types.ts +0 -54
- package/src/features/remove-object/index.ts +0 -23
- package/src/features/remove-object/presentation/components/RemoveObjectFeature.tsx +0 -136
- package/src/features/remove-object/presentation/components/index.ts +0 -2
- package/src/features/remove-object/presentation/hooks/index.ts +0 -9
- package/src/features/remove-object/presentation/hooks/useRemoveObjectFeature.ts +0 -221
- package/src/features/remove-object/presentation/index.ts +0 -6
- package/src/features/replace-background/README.md +0 -405
- package/src/features/replace-background/domain/types/index.ts +0 -7
- package/src/features/replace-background/domain/types/replace-background.types.ts +0 -33
- package/src/features/replace-background/index.ts +0 -23
- package/src/features/replace-background/presentation/components/ReplaceBackgroundFeature.tsx +0 -105
- package/src/features/replace-background/presentation/components/index.ts +0 -6
- package/src/features/replace-background/presentation/hooks/index.ts +0 -9
- package/src/features/replace-background/presentation/hooks/useReplaceBackgroundFeature.ts +0 -55
- package/src/features/scenarios/domain/types.ts +0 -147
- package/src/features/scenarios/index.ts +0 -64
- package/src/features/scenarios/presentation/components/InspirationChips.tsx +0 -82
- package/src/features/scenarios/presentation/components/MagicPromptHeadline.tsx +0 -79
- package/src/features/scenarios/presentation/components/ScenarioGrid.tsx +0 -224
- package/src/features/scenarios/presentation/components/ScenarioHeader.tsx +0 -55
- package/src/features/scenarios/presentation/components/StyleSelector.tsx +0 -119
- package/src/features/scenarios/presentation/components/index.ts +0 -18
- package/src/features/scenarios/presentation/containers/CategoryNavigationContainer.tsx +0 -178
- package/src/features/scenarios/presentation/screens/HierarchicalScenarioListScreen.tsx +0 -266
- package/src/features/scenarios/presentation/screens/MagicPromptScreen.tsx +0 -242
- package/src/features/scenarios/presentation/screens/MainCategoryScreen.tsx +0 -198
- package/src/features/scenarios/presentation/screens/ScenarioPreviewScreen.tsx +0 -164
- package/src/features/scenarios/presentation/screens/ScenarioSelectorScreen.tsx +0 -66
- package/src/features/scenarios/presentation/screens/SubCategoryScreen.tsx +0 -216
- package/src/features/script-generator/README.md +0 -433
- package/src/features/script-generator/domain/constants/index.ts +0 -10
- package/src/features/script-generator/domain/types/script.types.ts +0 -30
- package/src/features/script-generator/index.ts +0 -5
- package/src/features/script-generator/infrastructure/services/ScriptGenerationService.ts +0 -62
- package/src/features/script-generator/presentation/components/ScriptDisplay.tsx +0 -158
- package/src/features/script-generator/presentation/components/VideoTypeSelector.tsx +0 -102
- package/src/features/script-generator/presentation/components/index.ts +0 -2
- package/src/features/script-generator/presentation/hooks/index.ts +0 -1
- package/src/features/script-generator/presentation/hooks/useScriptGenerator.ts +0 -77
- package/src/features/shared/README.md +0 -311
- package/src/features/shared/dual-image-video/domain/types/dual-image-video.types.ts +0 -88
- package/src/features/shared/dual-image-video/domain/types/index.ts +0 -14
- package/src/features/shared/dual-image-video/index.ts +0 -17
- package/src/features/shared/dual-image-video/presentation/hooks/index.ts +0 -5
- package/src/features/shared/dual-image-video/presentation/hooks/useDualImageVideoFeature.ts +0 -185
- package/src/features/shared/index.ts +0 -6
- package/src/features/text-to-image/README.md +0 -394
- package/src/features/text-to-image/domain/constants/index.ts +0 -8
- package/src/features/text-to-image/domain/constants/options.constants.ts +0 -39
- package/src/features/text-to-image/domain/constants/styles.constants.ts +0 -34
- package/src/features/text-to-image/domain/index.ts +0 -7
- package/src/features/text-to-image/domain/types/config.types.ts +0 -75
- package/src/features/text-to-image/domain/types/form.types.ts +0 -58
- package/src/features/text-to-image/domain/types/index.ts +0 -38
- package/src/features/text-to-image/domain/types/text-to-image.types.ts +0 -58
- package/src/features/text-to-image/index.ts +0 -116
- package/src/features/text-to-image/infrastructure/index.ts +0 -1
- package/src/features/text-to-image/infrastructure/services/index.ts +0 -5
- package/src/features/text-to-image/infrastructure/services/text-to-image-executor.ts +0 -147
- package/src/features/text-to-image/presentation/components/index.ts +0 -30
- package/src/features/text-to-image/presentation/hooks/index.ts +0 -30
- package/src/features/text-to-image/presentation/hooks/useFormState.ts +0 -103
- package/src/features/text-to-image/presentation/hooks/useGeneration.ts +0 -139
- package/src/features/text-to-image/presentation/hooks/useTextToImageFeature.ts +0 -111
- package/src/features/text-to-image/presentation/hooks/useTextToImageForm.ts +0 -58
- package/src/features/text-to-image/presentation/index.ts +0 -7
- package/src/features/text-to-video/README.md +0 -412
- package/src/features/text-to-video/domain/index.ts +0 -1
- package/src/features/text-to-video/domain/types/callback.types.ts +0 -69
- package/src/features/text-to-video/domain/types/component.types.ts +0 -106
- package/src/features/text-to-video/domain/types/config.types.ts +0 -61
- package/src/features/text-to-video/domain/types/index.ts +0 -56
- package/src/features/text-to-video/domain/types/request.types.ts +0 -36
- package/src/features/text-to-video/domain/types/state.types.ts +0 -53
- package/src/features/text-to-video/index.ts +0 -68
- package/src/features/text-to-video/infrastructure/index.ts +0 -1
- package/src/features/text-to-video/infrastructure/services/index.ts +0 -5
- package/src/features/text-to-video/infrastructure/services/text-to-video-executor.ts +0 -141
- package/src/features/text-to-video/presentation/components/FrameSelector.tsx +0 -153
- package/src/features/text-to-video/presentation/components/GenerationTabs.tsx +0 -73
- package/src/features/text-to-video/presentation/components/HeroSection.tsx +0 -61
- package/src/features/text-to-video/presentation/components/HintCarousel.tsx +0 -96
- package/src/features/text-to-video/presentation/components/OptionsPanel.tsx +0 -121
- package/src/features/text-to-video/presentation/components/index.ts +0 -10
- package/src/features/text-to-video/presentation/hooks/index.ts +0 -17
- package/src/features/text-to-video/presentation/hooks/useTextToVideoFeature.ts +0 -225
- package/src/features/text-to-video/presentation/hooks/useTextToVideoForm.ts +0 -134
- package/src/features/text-to-video/presentation/index.ts +0 -7
- package/src/features/text-to-voice/README.md +0 -445
- package/src/features/text-to-voice/domain/index.ts +0 -1
- package/src/features/text-to-voice/domain/types/component.types.ts +0 -91
- package/src/features/text-to-voice/domain/types/config.types.ts +0 -34
- package/src/features/text-to-voice/domain/types/form.types.ts +0 -39
- package/src/features/text-to-voice/domain/types/generation.types.ts +0 -43
- package/src/features/text-to-voice/domain/types/index.ts +0 -38
- package/src/features/text-to-voice/index.ts +0 -53
- package/src/features/text-to-voice/infrastructure/index.ts +0 -1
- package/src/features/text-to-voice/infrastructure/services/index.ts +0 -4
- package/src/features/text-to-voice/infrastructure/services/text-to-voice-executor.ts +0 -103
- package/src/features/text-to-voice/presentation/components/TextToVoiceAudioPlayer.tsx +0 -81
- package/src/features/text-to-voice/presentation/components/index.ts +0 -7
- package/src/features/text-to-voice/presentation/hooks/index.ts +0 -6
- package/src/features/text-to-voice/presentation/hooks/useTextToVoiceForm.ts +0 -91
- package/src/features/text-to-voice/presentation/hooks/useTextToVoiceGeneration.ts +0 -116
- package/src/features/text-to-voice/presentation/index.ts +0 -2
- package/src/features/upscaling/README.md +0 -396
- package/src/features/upscaling/domain/index.ts +0 -1
- package/src/features/upscaling/domain/types/index.ts +0 -1
- package/src/features/upscaling/domain/types/upscale.types.ts +0 -23
- package/src/features/upscaling/index.ts +0 -20
- package/src/features/upscaling/presentation/components/ComparisonSlider.tsx +0 -200
- package/src/features/upscaling/presentation/components/UpscaleFeature.tsx +0 -89
- package/src/features/upscaling/presentation/components/UpscaleResultView.tsx +0 -98
- package/src/features/upscaling/presentation/components/index.ts +0 -6
- package/src/features/upscaling/presentation/hooks/index.ts +0 -1
- package/src/features/upscaling/presentation/hooks/useUpscaleFeature.ts +0 -28
- package/src/features/upscaling/presentation/index.ts +0 -2
- package/src/features/wizard/domain/types.ts +0 -154
- package/src/features/wizard/index.ts +0 -43
- package/src/features/wizard/presentation/components/AIFeatureWizard.tsx +0 -231
- package/src/features/wizard/presentation/components/AIGenerationWizard.tsx +0 -132
- package/src/features/wizard/presentation/hooks/useWizard.ts +0 -120
- package/src/features/wizard/presentation/store/useWizardStore.ts +0 -82
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import React, { useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
View,
|
|
4
|
-
StyleSheet,
|
|
5
|
-
Image,
|
|
6
|
-
Alert,
|
|
7
|
-
} from "react-native";
|
|
8
|
-
import {
|
|
9
|
-
AtomicButton,
|
|
10
|
-
useAppDesignTokens,
|
|
11
|
-
AtomicIcon,
|
|
12
|
-
AtomicInput,
|
|
13
|
-
AtomicSpinner,
|
|
14
|
-
ScreenLayout,
|
|
15
|
-
ScreenHeader,
|
|
16
|
-
} from "@umituz/react-native-design-system";
|
|
17
|
-
import { useLocalization } from "@umituz/react-native-localization";
|
|
18
|
-
|
|
19
|
-
export interface MemeGeneratorScreenProps {
|
|
20
|
-
onGenerate: (prompt: string) => Promise<string>;
|
|
21
|
-
onSave: (imageUrl: string) => Promise<void>;
|
|
22
|
-
onBackPress: () => void;
|
|
23
|
-
title?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export const MemeGeneratorScreen: React.FC<MemeGeneratorScreenProps> = ({
|
|
27
|
-
onGenerate,
|
|
28
|
-
onSave,
|
|
29
|
-
onBackPress,
|
|
30
|
-
title,
|
|
31
|
-
}) => {
|
|
32
|
-
const { t } = useLocalization();
|
|
33
|
-
const tokens = useAppDesignTokens();
|
|
34
|
-
|
|
35
|
-
const [prompt, setPrompt] = useState("");
|
|
36
|
-
const [generatedImage, setGeneratedImage] = useState<string | null>(null);
|
|
37
|
-
const [isGenerating, setIsGenerating] = useState(false);
|
|
38
|
-
const [isSaving, setIsSaving] = useState(false);
|
|
39
|
-
|
|
40
|
-
const handleGenerate = async () => {
|
|
41
|
-
if (!prompt.trim()) return;
|
|
42
|
-
setIsGenerating(true);
|
|
43
|
-
try {
|
|
44
|
-
const url = await onGenerate(prompt);
|
|
45
|
-
setGeneratedImage(url);
|
|
46
|
-
} catch (error: unknown) {
|
|
47
|
-
const errorMessage = error instanceof Error ? error.message : "Failed to generate";
|
|
48
|
-
Alert.alert(t("common.error"), errorMessage);
|
|
49
|
-
} finally {
|
|
50
|
-
setIsGenerating(false);
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const handleSave = async () => {
|
|
55
|
-
if (!generatedImage) return;
|
|
56
|
-
setIsSaving(true);
|
|
57
|
-
try {
|
|
58
|
-
await onSave(generatedImage);
|
|
59
|
-
setGeneratedImage(null);
|
|
60
|
-
setPrompt("");
|
|
61
|
-
} catch (error: unknown) {
|
|
62
|
-
const errorMessage = error instanceof Error ? error.message : "Failed to save";
|
|
63
|
-
Alert.alert(t("common.error"), errorMessage);
|
|
64
|
-
} finally {
|
|
65
|
-
setIsSaving(false);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const styles = StyleSheet.create({
|
|
70
|
-
content: {
|
|
71
|
-
flex: 1,
|
|
72
|
-
padding: tokens.spacing.lg,
|
|
73
|
-
},
|
|
74
|
-
previewContainer: {
|
|
75
|
-
aspectRatio: 1,
|
|
76
|
-
width: "100%",
|
|
77
|
-
backgroundColor: tokens.colors.backgroundSecondary,
|
|
78
|
-
borderRadius: tokens.radius.lg,
|
|
79
|
-
justifyContent: "center",
|
|
80
|
-
alignItems: "center",
|
|
81
|
-
marginBottom: tokens.spacing.xl,
|
|
82
|
-
overflow: "hidden",
|
|
83
|
-
borderWidth: 1,
|
|
84
|
-
borderColor: tokens.colors.border,
|
|
85
|
-
},
|
|
86
|
-
previewImage: {
|
|
87
|
-
width: "100%",
|
|
88
|
-
height: "100%",
|
|
89
|
-
},
|
|
90
|
-
inputSection: {
|
|
91
|
-
gap: tokens.spacing.lg,
|
|
92
|
-
paddingBottom: tokens.spacing.xxl,
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
return (
|
|
97
|
-
<ScreenLayout
|
|
98
|
-
header={
|
|
99
|
-
<ScreenHeader
|
|
100
|
-
title={title || t("home.create_title")}
|
|
101
|
-
onBackPress={onBackPress}
|
|
102
|
-
/>
|
|
103
|
-
}
|
|
104
|
-
scrollable={true}
|
|
105
|
-
contentContainerStyle={{ paddingHorizontal: 0 }}
|
|
106
|
-
keyboardAvoiding={true}
|
|
107
|
-
>
|
|
108
|
-
<View style={styles.content}>
|
|
109
|
-
<View style={styles.previewContainer}>
|
|
110
|
-
{isGenerating ? (
|
|
111
|
-
<AtomicSpinner size="lg" color="primary" />
|
|
112
|
-
) : generatedImage ? (
|
|
113
|
-
<Image
|
|
114
|
-
source={{ uri: generatedImage }}
|
|
115
|
-
style={styles.previewImage}
|
|
116
|
-
resizeMode="contain"
|
|
117
|
-
/>
|
|
118
|
-
) : (
|
|
119
|
-
<AtomicIcon
|
|
120
|
-
name="color-wand-outline"
|
|
121
|
-
size={80}
|
|
122
|
-
color="secondary"
|
|
123
|
-
style={{ opacity: 0.3 }}
|
|
124
|
-
/>
|
|
125
|
-
)}
|
|
126
|
-
</View>
|
|
127
|
-
|
|
128
|
-
<View style={styles.inputSection}>
|
|
129
|
-
<AtomicInput
|
|
130
|
-
label={t("wizard.prompt_label")}
|
|
131
|
-
placeholder={t("wizard.prompt_placeholder")}
|
|
132
|
-
value={prompt}
|
|
133
|
-
onChangeText={setPrompt}
|
|
134
|
-
multiline
|
|
135
|
-
numberOfLines={3}
|
|
136
|
-
/>
|
|
137
|
-
|
|
138
|
-
{!generatedImage ? (
|
|
139
|
-
<AtomicButton
|
|
140
|
-
onPress={handleGenerate}
|
|
141
|
-
disabled={isGenerating}
|
|
142
|
-
fullWidth
|
|
143
|
-
>
|
|
144
|
-
{isGenerating ? t("common.loading") : t("wizard.generate_button")}
|
|
145
|
-
</AtomicButton>
|
|
146
|
-
) : (
|
|
147
|
-
<View style={{ flexDirection: "row", gap: tokens.spacing.md }}>
|
|
148
|
-
<AtomicButton
|
|
149
|
-
variant="secondary"
|
|
150
|
-
onPress={() => setGeneratedImage(null)}
|
|
151
|
-
style={{ flex: 1 }}
|
|
152
|
-
>
|
|
153
|
-
{t("common.reset")}
|
|
154
|
-
</AtomicButton>
|
|
155
|
-
<AtomicButton
|
|
156
|
-
onPress={handleSave}
|
|
157
|
-
disabled={isSaving}
|
|
158
|
-
style={{ flex: 2 }}
|
|
159
|
-
>
|
|
160
|
-
{t("common.save")}
|
|
161
|
-
</AtomicButton>
|
|
162
|
-
</View>
|
|
163
|
-
)}
|
|
164
|
-
</View>
|
|
165
|
-
</View>
|
|
166
|
-
</ScreenLayout>
|
|
167
|
-
);
|
|
168
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./MemeGeneratorScreen";
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Partner Upload Types
|
|
3
|
-
* Generic partner/photo upload feature types
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export interface UploadedImage {
|
|
7
|
-
readonly uri: string;
|
|
8
|
-
readonly base64?: string;
|
|
9
|
-
readonly previewUrl: string;
|
|
10
|
-
readonly width?: number;
|
|
11
|
-
readonly height?: number;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface PartnerStepConfig {
|
|
15
|
-
readonly titleKey: string;
|
|
16
|
-
readonly subtitleKey: string;
|
|
17
|
-
readonly showFaceDetection?: boolean;
|
|
18
|
-
readonly showNameInput?: boolean;
|
|
19
|
-
readonly showPhotoTips?: boolean;
|
|
20
|
-
readonly maxNameLength?: number;
|
|
21
|
-
readonly namePlaceholderKey?: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export interface PartnerStepTranslations {
|
|
25
|
-
readonly tapToUpload: string;
|
|
26
|
-
readonly selectPhoto: string;
|
|
27
|
-
readonly change: string;
|
|
28
|
-
readonly analyzing: string;
|
|
29
|
-
readonly continue: string;
|
|
30
|
-
readonly faceDetectionLabel?: string;
|
|
31
|
-
readonly namePlaceholder?: string;
|
|
32
|
-
readonly photoTip1?: string;
|
|
33
|
-
readonly photoTip2?: string;
|
|
34
|
-
readonly photoTip3?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface PhotoTipsConfig {
|
|
38
|
-
readonly tips: readonly string[];
|
|
39
|
-
readonly icon?: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const DEFAULT_PARTNER_STEP_CONFIG: PartnerStepConfig = {
|
|
43
|
-
titleKey: "partner.upload.title",
|
|
44
|
-
subtitleKey: "partner.upload.subtitle",
|
|
45
|
-
showFaceDetection: false,
|
|
46
|
-
showNameInput: true,
|
|
47
|
-
showPhotoTips: true,
|
|
48
|
-
maxNameLength: 50,
|
|
49
|
-
namePlaceholderKey: "partner.upload.namePlaceholder",
|
|
50
|
-
} as const;
|
|
51
|
-
|
|
52
|
-
export const DEFAULT_PHOTO_TIPS: PhotoTipsConfig = {
|
|
53
|
-
tips: [
|
|
54
|
-
"photoTips.tip1",
|
|
55
|
-
"photoTips.tip2",
|
|
56
|
-
"photoTips.tip3",
|
|
57
|
-
],
|
|
58
|
-
icon: "lightbulb",
|
|
59
|
-
} as const;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Partner Upload Feature
|
|
3
|
-
* Generic partner/photo upload screens and components
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
export type {
|
|
7
|
-
UploadedImage,
|
|
8
|
-
PartnerStepConfig,
|
|
9
|
-
PartnerStepTranslations,
|
|
10
|
-
PhotoTipsConfig,
|
|
11
|
-
} from "./domain/types";
|
|
12
|
-
export { DEFAULT_PARTNER_STEP_CONFIG, DEFAULT_PHOTO_TIPS } from "./domain/types";
|
|
13
|
-
|
|
14
|
-
export { PhotoTips, PartnerInfoInput } from "./presentation/components";
|
|
15
|
-
export type { PhotoTipsProps, PhotoTipConfig, PartnerInfoInputProps } from "./presentation/components";
|
|
16
|
-
|
|
17
|
-
export { usePartnerStep } from "./presentation/hooks";
|
|
18
|
-
export type {
|
|
19
|
-
UsePartnerStepConfig,
|
|
20
|
-
UsePartnerStepTranslations,
|
|
21
|
-
UsePartnerStepOptions,
|
|
22
|
-
UsePartnerStepReturn,
|
|
23
|
-
} from "./presentation/hooks";
|
|
24
|
-
|
|
25
|
-
export { PartnerStepScreen } from "./presentation/screens";
|
|
26
|
-
export type {
|
|
27
|
-
PartnerStepScreenProps,
|
|
28
|
-
PartnerStepScreenTranslations,
|
|
29
|
-
PartnerStepScreenConfig,
|
|
30
|
-
} from "./presentation/screens";
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PartnerInfoInput Component
|
|
3
|
-
* Name and optional description input for partner
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useMemo } from "react";
|
|
7
|
-
import { View, StyleSheet } from "react-native";
|
|
8
|
-
import { AtomicInput, AtomicText, useAppDesignTokens } from "@umituz/react-native-design-system";
|
|
9
|
-
|
|
10
|
-
export interface PartnerInfoInputProps {
|
|
11
|
-
readonly t: (key: string) => string;
|
|
12
|
-
readonly name: string;
|
|
13
|
-
readonly onNameChange: (name: string) => void;
|
|
14
|
-
readonly description?: string;
|
|
15
|
-
readonly onDescriptionChange?: (description: string) => void;
|
|
16
|
-
readonly showName?: boolean;
|
|
17
|
-
readonly showDescription?: boolean;
|
|
18
|
-
readonly maxNameLength?: number;
|
|
19
|
-
readonly maxDescriptionLength?: number;
|
|
20
|
-
readonly nameLabelKey?: string;
|
|
21
|
-
readonly namePlaceholderKey?: string;
|
|
22
|
-
readonly descriptionLabelKey?: string;
|
|
23
|
-
readonly descriptionPlaceholderKey?: string;
|
|
24
|
-
readonly optionalKey?: string;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const PartnerInfoInput: React.FC<PartnerInfoInputProps> = ({
|
|
28
|
-
t,
|
|
29
|
-
name,
|
|
30
|
-
onNameChange,
|
|
31
|
-
description = "",
|
|
32
|
-
onDescriptionChange,
|
|
33
|
-
showName = false,
|
|
34
|
-
showDescription = false,
|
|
35
|
-
maxNameLength = 30,
|
|
36
|
-
maxDescriptionLength = 200,
|
|
37
|
-
nameLabelKey = "photoUpload.nameLabel",
|
|
38
|
-
namePlaceholderKey = "photoUpload.namePlaceholder",
|
|
39
|
-
descriptionLabelKey = "photoUpload.descriptionLabel",
|
|
40
|
-
descriptionPlaceholderKey = "photoUpload.descriptionPlaceholder",
|
|
41
|
-
optionalKey = "common.optional",
|
|
42
|
-
}) => {
|
|
43
|
-
const tokens = useAppDesignTokens();
|
|
44
|
-
|
|
45
|
-
const styles = useMemo(
|
|
46
|
-
() =>
|
|
47
|
-
StyleSheet.create({
|
|
48
|
-
container: {
|
|
49
|
-
paddingHorizontal: 24,
|
|
50
|
-
gap: 16,
|
|
51
|
-
},
|
|
52
|
-
optionalLabel: {
|
|
53
|
-
flexDirection: "row",
|
|
54
|
-
alignItems: "center",
|
|
55
|
-
gap: 8,
|
|
56
|
-
marginBottom: 8,
|
|
57
|
-
},
|
|
58
|
-
optional: {
|
|
59
|
-
fontSize: 12,
|
|
60
|
-
color: tokens.colors.textTertiary,
|
|
61
|
-
fontStyle: "italic",
|
|
62
|
-
},
|
|
63
|
-
label: {
|
|
64
|
-
fontSize: 14,
|
|
65
|
-
fontWeight: "600",
|
|
66
|
-
color: tokens.colors.textSecondary,
|
|
67
|
-
},
|
|
68
|
-
}),
|
|
69
|
-
[tokens],
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
if (!showName && !showDescription) {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
return (
|
|
77
|
-
<View style={styles.container}>
|
|
78
|
-
{showName && (
|
|
79
|
-
<AtomicInput
|
|
80
|
-
label={t(nameLabelKey)}
|
|
81
|
-
value={name}
|
|
82
|
-
onChangeText={onNameChange}
|
|
83
|
-
placeholder={t(namePlaceholderKey)}
|
|
84
|
-
maxLength={maxNameLength}
|
|
85
|
-
showCharacterCount
|
|
86
|
-
variant="outlined"
|
|
87
|
-
size="md"
|
|
88
|
-
/>
|
|
89
|
-
)}
|
|
90
|
-
|
|
91
|
-
{showDescription && onDescriptionChange && (
|
|
92
|
-
<View>
|
|
93
|
-
<View style={styles.optionalLabel}>
|
|
94
|
-
<AtomicText style={styles.label}>{t(descriptionLabelKey)}</AtomicText>
|
|
95
|
-
<AtomicText style={styles.optional}>({t(optionalKey)})</AtomicText>
|
|
96
|
-
</View>
|
|
97
|
-
<AtomicInput
|
|
98
|
-
value={description}
|
|
99
|
-
onChangeText={onDescriptionChange}
|
|
100
|
-
placeholder={t(descriptionPlaceholderKey)}
|
|
101
|
-
multiline
|
|
102
|
-
numberOfLines={3}
|
|
103
|
-
maxLength={maxDescriptionLength}
|
|
104
|
-
showCharacterCount
|
|
105
|
-
variant="outlined"
|
|
106
|
-
inputStyle={{ minHeight: 100, textAlignVertical: "top" }}
|
|
107
|
-
/>
|
|
108
|
-
</View>
|
|
109
|
-
)}
|
|
110
|
-
</View>
|
|
111
|
-
);
|
|
112
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PhotoTips Component
|
|
3
|
-
* Displays photo upload tips in a grid layout
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import React, { useMemo } from "react";
|
|
7
|
-
import { InfoGrid, type InfoGridItem } from "@umituz/react-native-design-system";
|
|
8
|
-
|
|
9
|
-
export interface PhotoTipConfig {
|
|
10
|
-
readonly icon: string;
|
|
11
|
-
readonly textKey: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface PhotoTipsProps {
|
|
15
|
-
readonly t: (key: string) => string;
|
|
16
|
-
readonly titleKey?: string;
|
|
17
|
-
readonly headerIcon?: string;
|
|
18
|
-
readonly tips?: readonly PhotoTipConfig[];
|
|
19
|
-
readonly style?: object;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const DEFAULT_TIPS: readonly PhotoTipConfig[] = [
|
|
23
|
-
{ icon: "sunny-outline", textKey: "photoUpload.tips.lighting" },
|
|
24
|
-
{ icon: "person-outline", textKey: "photoUpload.tips.faceForward" },
|
|
25
|
-
{ icon: "eye-outline", textKey: "photoUpload.tips.clearFace" },
|
|
26
|
-
{ icon: "diamond-outline", textKey: "photoUpload.tips.goodQuality" },
|
|
27
|
-
] as const;
|
|
28
|
-
|
|
29
|
-
export const PhotoTips: React.FC<PhotoTipsProps> = ({
|
|
30
|
-
t,
|
|
31
|
-
titleKey = "photoUpload.tips.title",
|
|
32
|
-
headerIcon = "bulb",
|
|
33
|
-
tips = DEFAULT_TIPS,
|
|
34
|
-
style,
|
|
35
|
-
}) => {
|
|
36
|
-
const gridItems: InfoGridItem[] = useMemo(
|
|
37
|
-
() =>
|
|
38
|
-
tips.map((tip) => ({
|
|
39
|
-
icon: tip.icon,
|
|
40
|
-
text: t(tip.textKey),
|
|
41
|
-
})),
|
|
42
|
-
[tips, t],
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
return (
|
|
46
|
-
<InfoGrid
|
|
47
|
-
title={t(titleKey)}
|
|
48
|
-
headerIcon={headerIcon}
|
|
49
|
-
items={gridItems}
|
|
50
|
-
style={style ?? { marginHorizontal: 24, marginBottom: 20 }}
|
|
51
|
-
/>
|
|
52
|
-
);
|
|
53
|
-
};
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* usePartnerStep Hook
|
|
3
|
-
* Manages partner photo upload step logic
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import { useState, useCallback } from "react";
|
|
7
|
-
import { Alert } from "react-native";
|
|
8
|
-
import { useMedia, MediaLibraryPermission, readFileAsBase64 } from "@umituz/react-native-design-system";
|
|
9
|
-
import type { UploadedImage } from "../../domain/types";
|
|
10
|
-
|
|
11
|
-
export interface UsePartnerStepConfig {
|
|
12
|
-
readonly maxFileSizeMB?: number;
|
|
13
|
-
readonly imageQuality?: number;
|
|
14
|
-
readonly allowsEditing?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface UsePartnerStepTranslations {
|
|
18
|
-
readonly fileTooLarge: string;
|
|
19
|
-
readonly maxFileSize: string;
|
|
20
|
-
readonly error: string;
|
|
21
|
-
readonly uploadFailed: string;
|
|
22
|
-
readonly permissionDenied?: string;
|
|
23
|
-
readonly permissionRequired?: string;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface UsePartnerStepOptions {
|
|
27
|
-
readonly initialName?: string;
|
|
28
|
-
readonly config?: UsePartnerStepConfig;
|
|
29
|
-
readonly translations: UsePartnerStepTranslations;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
interface PartnerStepState {
|
|
33
|
-
image: UploadedImage | null;
|
|
34
|
-
name: string;
|
|
35
|
-
description: string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const DEFAULT_CONFIG: UsePartnerStepConfig = {
|
|
39
|
-
maxFileSizeMB: 10,
|
|
40
|
-
imageQuality: 0.7,
|
|
41
|
-
allowsEditing: true,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const usePartnerStep = (options: UsePartnerStepOptions) => {
|
|
45
|
-
const { initialName = "", config = DEFAULT_CONFIG, translations } = options;
|
|
46
|
-
const { pickImage, requestMediaLibraryPermission, getMediaLibraryPermissionStatus, isLoading: isPickerLoading } = useMedia();
|
|
47
|
-
|
|
48
|
-
const [state, setState] = useState<PartnerStepState>({
|
|
49
|
-
image: null,
|
|
50
|
-
name: initialName,
|
|
51
|
-
description: "",
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const setName = useCallback((name: string) => {
|
|
55
|
-
setState((prev) => ({ ...prev, name }));
|
|
56
|
-
}, []);
|
|
57
|
-
|
|
58
|
-
const setDescription = useCallback((description: string) => {
|
|
59
|
-
setState((prev) => ({ ...prev, description }));
|
|
60
|
-
}, []);
|
|
61
|
-
|
|
62
|
-
const handlePickImage = useCallback(async () => {
|
|
63
|
-
try {
|
|
64
|
-
// Check permission first
|
|
65
|
-
let permission = await getMediaLibraryPermissionStatus();
|
|
66
|
-
if (permission !== MediaLibraryPermission.GRANTED) {
|
|
67
|
-
permission = await requestMediaLibraryPermission();
|
|
68
|
-
if (permission !== MediaLibraryPermission.GRANTED) {
|
|
69
|
-
Alert.alert(
|
|
70
|
-
translations.error,
|
|
71
|
-
translations.permissionDenied ?? "Photo library access is required to upload images.",
|
|
72
|
-
);
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
const maxFileSizeMB = config.maxFileSizeMB ?? 10;
|
|
78
|
-
const result = await pickImage({
|
|
79
|
-
allowsEditing: config.allowsEditing ?? true,
|
|
80
|
-
quality: config.imageQuality ?? 0.7,
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
if (result.canceled || !result.assets?.[0]) return;
|
|
84
|
-
|
|
85
|
-
const asset = result.assets[0];
|
|
86
|
-
|
|
87
|
-
if (asset.fileSize && asset.fileSize > maxFileSizeMB * 1024 * 1024) {
|
|
88
|
-
Alert.alert(
|
|
89
|
-
translations.fileTooLarge,
|
|
90
|
-
translations.maxFileSize.replace("{size}", String(maxFileSizeMB)),
|
|
91
|
-
);
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const base64 = await readFileAsBase64(asset.uri);
|
|
96
|
-
if (!base64) {
|
|
97
|
-
Alert.alert(translations.error, translations.uploadFailed);
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
const uploadedImage: UploadedImage = {
|
|
102
|
-
uri: asset.uri,
|
|
103
|
-
previewUrl: asset.uri,
|
|
104
|
-
base64: `data:image/jpeg;base64,${base64}`,
|
|
105
|
-
width: asset.width,
|
|
106
|
-
height: asset.height,
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
setState((prev) => ({
|
|
110
|
-
...prev,
|
|
111
|
-
image: uploadedImage,
|
|
112
|
-
}));
|
|
113
|
-
} catch {
|
|
114
|
-
Alert.alert(translations.error, translations.uploadFailed);
|
|
115
|
-
}
|
|
116
|
-
}, [config, translations, pickImage, requestMediaLibraryPermission, getMediaLibraryPermissionStatus]);
|
|
117
|
-
|
|
118
|
-
const canContinue = state.image !== null;
|
|
119
|
-
|
|
120
|
-
return {
|
|
121
|
-
...state,
|
|
122
|
-
setName,
|
|
123
|
-
setDescription,
|
|
124
|
-
handlePickImage,
|
|
125
|
-
canContinue,
|
|
126
|
-
isLoading: isPickerLoading,
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export type UsePartnerStepReturn = ReturnType<typeof usePartnerStep>;
|