@umituz/react-native-ai-generation-content 1.61.8 → 1.61.10
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.61.
|
|
3
|
+
"version": "1.61.10",
|
|
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",
|
|
@@ -112,12 +112,26 @@ export class CreationsWriter {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
async updateFavorite(userId: string, creationId: string, isFavorite: boolean): Promise<boolean> {
|
|
115
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
116
|
+
console.log("[CreationsWriter] updateFavorite()", { userId, creationId, isFavorite });
|
|
117
|
+
}
|
|
115
118
|
const docRef = this.pathResolver.getDocRef(userId, creationId);
|
|
116
|
-
if (!docRef)
|
|
119
|
+
if (!docRef) {
|
|
120
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
121
|
+
console.log("[CreationsWriter] updateFavorite() - no docRef");
|
|
122
|
+
}
|
|
123
|
+
return false;
|
|
124
|
+
}
|
|
117
125
|
try {
|
|
118
126
|
await updateDoc(docRef, { isFavorite });
|
|
127
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
128
|
+
console.log("[CreationsWriter] updateFavorite() success");
|
|
129
|
+
}
|
|
119
130
|
return true;
|
|
120
|
-
} catch {
|
|
131
|
+
} catch (error) {
|
|
132
|
+
if (typeof __DEV__ !== "undefined" && __DEV__) {
|
|
133
|
+
console.error("[CreationsWriter] updateFavorite() error", error);
|
|
134
|
+
}
|
|
121
135
|
return false;
|
|
122
136
|
}
|
|
123
137
|
}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Extracts callback handlers from CreationsGalleryScreen
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
declare const __DEV__: boolean;
|
|
7
|
+
|
|
6
8
|
import { useCallback } from "react";
|
|
7
9
|
import { useAlert, AlertType, AlertMode, useSharing } from "@umituz/react-native-design-system";
|
|
8
10
|
import type { Creation } from "../../domain/entities/Creation";
|
|
@@ -72,10 +74,19 @@ export function useGalleryCallbacks(props: UseGalleryCallbacksProps) {
|
|
|
72
74
|
const handleFavorite = useCallback(
|
|
73
75
|
(c: Creation) => {
|
|
74
76
|
void (async () => {
|
|
77
|
+
if (__DEV__) {
|
|
78
|
+
console.log("[handleFavorite] Called", { id: c.id, currentFavorite: c.isFavorite, userId });
|
|
79
|
+
}
|
|
75
80
|
if (!userId) return;
|
|
76
81
|
// Toggle the favorite status
|
|
77
82
|
const newFavoriteStatus = !c.isFavorite;
|
|
83
|
+
if (__DEV__) {
|
|
84
|
+
console.log("[handleFavorite] Toggling", { newFavoriteStatus });
|
|
85
|
+
}
|
|
78
86
|
const success = await repository.updateFavorite(userId, c.id, newFavoriteStatus);
|
|
87
|
+
if (__DEV__) {
|
|
88
|
+
console.log("[handleFavorite] Update result", { success });
|
|
89
|
+
}
|
|
79
90
|
if (success) void refetch();
|
|
80
91
|
})();
|
|
81
92
|
},
|