@umituz/react-native-ai-generation-content 1.84.1 → 1.84.3
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 +1 -1
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +5 -2
- package/src/domains/creations/presentation/screens/creations-gallery.types.ts +3 -0
- package/src/exports/infrastructure.ts +1 -0
- package/src/infrastructure/utils/couple-input.util.ts +39 -0
- package/src/infrastructure/utils/index.ts +1 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.84.
|
|
3
|
+
"version": "1.84.3",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native with result preview components",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -34,6 +34,7 @@ export function CreationsGalleryScreen({
|
|
|
34
34
|
onCreationPress,
|
|
35
35
|
onEdit,
|
|
36
36
|
onEditVideo,
|
|
37
|
+
onShareToFeed,
|
|
37
38
|
}: CreationsGalleryScreenProps) {
|
|
38
39
|
const tokens = useAppDesignTokens();
|
|
39
40
|
const [viewMode, setViewMode] = useState<"list" | "grid">("list");
|
|
@@ -97,15 +98,17 @@ export function CreationsGalleryScreen({
|
|
|
97
98
|
onShare: async () => callbacks.handleShareCard(item),
|
|
98
99
|
onDelete: () => callbacks.handleDelete(item),
|
|
99
100
|
onFavorite: () => callbacks.handleFavorite(item),
|
|
100
|
-
|
|
101
|
+
onPostToFeed: onShareToFeed ? () => onShareToFeed(item) : undefined,
|
|
102
|
+
}), [callbacks, onCreationPress, onShareToFeed]);
|
|
101
103
|
|
|
102
104
|
const renderItem = useCallback(({ item }: { item: Creation }) => (
|
|
103
105
|
<CreationCard
|
|
104
106
|
creation={item}
|
|
105
107
|
titleText={getItemTitle(item)}
|
|
106
108
|
callbacks={getItemCallbacks(item)}
|
|
109
|
+
canPostToFeed={!!onShareToFeed && item.status === "completed"}
|
|
107
110
|
/>
|
|
108
|
-
), [getItemTitle, getItemCallbacks]);
|
|
111
|
+
), [getItemTitle, getItemCallbacks, onShareToFeed]);
|
|
109
112
|
|
|
110
113
|
const renderGridItems = useCallback((items: Creation[]) => {
|
|
111
114
|
const rows: Array<{ left: Creation; right: Creation | null }> = [];
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Creations Gallery Screen Types
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
+
import type { Creation } from "../../domain/entities/Creation";
|
|
5
6
|
import type { CreationsConfig } from "../../domain/value-objects/CreationsConfig";
|
|
6
7
|
import type { ICreationsRepository } from "../../domain/repositories/ICreationsRepository";
|
|
7
8
|
|
|
@@ -26,4 +27,6 @@ export interface CreationsGalleryScreenProps {
|
|
|
26
27
|
readonly onEdit?: (imageUrl: string) => void;
|
|
27
28
|
/** Called when the user taps the Edit button in the creation detail view. Receives the video URL. Only shown for video creations. */
|
|
28
29
|
readonly onEditVideo?: (videoUrl: string) => void;
|
|
30
|
+
/** Called when the user taps the "Post to Feed" button on a creation card. Shows a filled send icon. */
|
|
31
|
+
readonly onShareToFeed?: (creation: Creation) => void;
|
|
29
32
|
}
|
|
@@ -35,6 +35,7 @@ export {
|
|
|
35
35
|
isValidBase64, getBase64Size, getBase64SizeMB, prepareImage, createDevCallbacks, createFeatureUtils,
|
|
36
36
|
showVideoGenerationSuccess, handleGenerationError, showContentModerationWarning,
|
|
37
37
|
mapJobStatusToGenerationStatus, intensityToStrength,
|
|
38
|
+
resolveCoupleInput, prependContext,
|
|
38
39
|
} from "../infrastructure/utils";
|
|
39
40
|
export type {
|
|
40
41
|
IntervalOptions, StatusCheckResult, ResultValidation, ValidateResultOptions,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { GenerationTarget } from "../../presentation/hooks/generation/useImageGenerationExecutor";
|
|
2
|
+
|
|
3
|
+
interface CoupleInputResult {
|
|
4
|
+
readonly target: GenerationTarget;
|
|
5
|
+
readonly imageUrls: string[];
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves generation target and image URLs based on couple/single mode.
|
|
10
|
+
* Eliminates non-null assertions by narrowing partner2PhotoUri internally.
|
|
11
|
+
*/
|
|
12
|
+
export function resolveCoupleInput(
|
|
13
|
+
partner1PhotoUri: string,
|
|
14
|
+
partner2PhotoUri: string | null,
|
|
15
|
+
isCoupleMode: boolean,
|
|
16
|
+
singleTarget: GenerationTarget,
|
|
17
|
+
coupleTarget: GenerationTarget,
|
|
18
|
+
): CoupleInputResult {
|
|
19
|
+
if (isCoupleMode && partner2PhotoUri) {
|
|
20
|
+
return {
|
|
21
|
+
target: coupleTarget,
|
|
22
|
+
imageUrls: [partner1PhotoUri, partner2PhotoUri],
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
target: singleTarget,
|
|
27
|
+
imageUrls: [partner1PhotoUri],
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Prepends optional context (e.g. appearance analysis) to a base prompt.
|
|
33
|
+
*/
|
|
34
|
+
export function prependContext(
|
|
35
|
+
basePrompt: string,
|
|
36
|
+
context: string | undefined | null,
|
|
37
|
+
): string {
|
|
38
|
+
return context ? `${context}\n\n${basePrompt}` : basePrompt;
|
|
39
|
+
}
|