@umituz/react-native-design-system 4.23.39 → 4.23.41
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-design-system",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.41",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/media/index.ts
CHANGED
|
@@ -85,3 +85,58 @@ export const downloadMediaToFile = async (url: string, isVideo: boolean): Promis
|
|
|
85
85
|
|
|
86
86
|
return file.uri;
|
|
87
87
|
};
|
|
88
|
+
|
|
89
|
+
export interface SaveToGalleryResult {
|
|
90
|
+
readonly success: boolean;
|
|
91
|
+
readonly error?: string;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Save image to device gallery
|
|
96
|
+
* Downloads from URL if needed, then saves to media library
|
|
97
|
+
*/
|
|
98
|
+
export const saveImageToGallery = async (uri: string): Promise<SaveToGalleryResult> => {
|
|
99
|
+
try {
|
|
100
|
+
const MediaLibrary = require("expo-media-library");
|
|
101
|
+
|
|
102
|
+
const { status } = await MediaLibrary.requestPermissionsAsync();
|
|
103
|
+
if (status !== "granted") {
|
|
104
|
+
return { success: false, error: "Permission denied" };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Download if URL, otherwise use local path
|
|
108
|
+
const localUri = uri.startsWith("http") ? await downloadMediaToFile(uri, false) : uri;
|
|
109
|
+
await MediaLibrary.saveToLibraryAsync(localUri);
|
|
110
|
+
|
|
111
|
+
return { success: true };
|
|
112
|
+
} catch (error) {
|
|
113
|
+
return {
|
|
114
|
+
success: false,
|
|
115
|
+
error: error instanceof Error ? error.message : "Failed to save",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Save video to device gallery
|
|
122
|
+
*/
|
|
123
|
+
export const saveVideoToGallery = async (uri: string): Promise<SaveToGalleryResult> => {
|
|
124
|
+
try {
|
|
125
|
+
const MediaLibrary = require("expo-media-library");
|
|
126
|
+
|
|
127
|
+
const { status } = await MediaLibrary.requestPermissionsAsync();
|
|
128
|
+
if (status !== "granted") {
|
|
129
|
+
return { success: false, error: "Permission denied" };
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const localUri = uri.startsWith("http") ? await downloadMediaToFile(uri, true) : uri;
|
|
133
|
+
await MediaLibrary.saveToLibraryAsync(localUri);
|
|
134
|
+
|
|
135
|
+
return { success: true };
|
|
136
|
+
} catch (error) {
|
|
137
|
+
return {
|
|
138
|
+
success: false,
|
|
139
|
+
error: error instanceof Error ? error.message : "Failed to save",
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
};
|
|
@@ -28,9 +28,6 @@ export const configureOffline = (config: OfflineConfig): void => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export const useOffline = (config?: OfflineConfig) => {
|
|
31
|
-
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
32
|
-
console.log('[useOffline] Hook called');
|
|
33
|
-
}
|
|
34
31
|
const store = useOfflineStore();
|
|
35
32
|
const isInitialized = useRef(false);
|
|
36
33
|
const previousStateRef = useRef<NetworkState | null>(null);
|
|
@@ -25,9 +25,6 @@ import { type DesignTokens } from '../types/ThemeTypes';
|
|
|
25
25
|
* ```
|
|
26
26
|
*/
|
|
27
27
|
export const useAppDesignTokens = (): DesignTokens => {
|
|
28
|
-
if (typeof __DEV__ !== 'undefined' && __DEV__) {
|
|
29
|
-
console.log('[useAppDesignTokens] Hook called');
|
|
30
|
-
}
|
|
31
28
|
const { themeMode, customColors } = useDesignSystemTheme();
|
|
32
29
|
const { spacingMultiplier, getFontSize } = useResponsive();
|
|
33
30
|
|