@umituz/react-native-settings 4.21.23 → 4.21.25
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-settings",
|
|
3
|
-
"version": "4.21.
|
|
3
|
+
"version": "4.21.25",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/domains/dev/index.ts
CHANGED
|
@@ -9,3 +9,11 @@ export type { DevSettingsProps } from "./presentation/components/DevSettingsSect
|
|
|
9
9
|
|
|
10
10
|
export { StorageClearSetting } from "./presentation/components/StorageClearSetting";
|
|
11
11
|
export type { StorageClearSettingProps } from "./presentation/components/StorageClearSetting";
|
|
12
|
+
|
|
13
|
+
export { EnvViewerSetting } from "./presentation/components/EnvViewerSetting";
|
|
14
|
+
export type { EnvViewerSettingProps } from "./presentation/components/EnvViewerSetting";
|
|
15
|
+
|
|
16
|
+
export { EnvViewerScreen } from "./presentation/screens/EnvViewerScreen";
|
|
17
|
+
export type { EnvViewerScreenProps } from "./presentation/screens/EnvViewerScreen";
|
|
18
|
+
|
|
19
|
+
export type { EnvVariable, EnvConfig } from "./types";
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Viewer Setting Item
|
|
3
|
+
* List item to navigate to environment variables screen
|
|
4
|
+
* DEV-only feature
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { useAppDesignTokens, AppNavigation } from "@umituz/react-native-design-system";
|
|
9
|
+
import { SettingsItemCard } from "../../../../presentation/components/SettingsItemCard";
|
|
10
|
+
import type { EnvConfig } from "../../types";
|
|
11
|
+
|
|
12
|
+
export interface EnvViewerSettingProps {
|
|
13
|
+
/** Environment configuration to pass to viewer screen */
|
|
14
|
+
config: EnvConfig;
|
|
15
|
+
/** Custom title (default: "Environment Variables") */
|
|
16
|
+
title?: string;
|
|
17
|
+
/** Custom description (default: "View app configuration") */
|
|
18
|
+
description?: string;
|
|
19
|
+
/** Screen name to navigate to */
|
|
20
|
+
screenName: string;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const EnvViewerSetting: React.FC<EnvViewerSettingProps> = ({
|
|
24
|
+
config,
|
|
25
|
+
title = "Environment Variables",
|
|
26
|
+
description = "View app configuration",
|
|
27
|
+
screenName,
|
|
28
|
+
}) => {
|
|
29
|
+
const tokens = useAppDesignTokens();
|
|
30
|
+
|
|
31
|
+
const handlePress = () => {
|
|
32
|
+
AppNavigation.navigate(screenName as never, { config } as never);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return (
|
|
36
|
+
<SettingsItemCard
|
|
37
|
+
icon="code"
|
|
38
|
+
title={title}
|
|
39
|
+
description={description}
|
|
40
|
+
onPress={handlePress}
|
|
41
|
+
iconColor={tokens.colors.primary}
|
|
42
|
+
showChevron
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment Variables Viewer Screen
|
|
3
|
+
* Displays environment configuration for debugging
|
|
4
|
+
* DEV-only feature with hardcoded English text
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React, { useState } from "react";
|
|
8
|
+
import { View, ScrollView, StyleSheet } from "react-native";
|
|
9
|
+
import {
|
|
10
|
+
AtomicText,
|
|
11
|
+
AtomicIcon,
|
|
12
|
+
useAppDesignTokens,
|
|
13
|
+
useSafeAreaInsets,
|
|
14
|
+
AppNavigation,
|
|
15
|
+
AlertService,
|
|
16
|
+
} from "@umituz/react-native-design-system";
|
|
17
|
+
import { NavigationHeader } from "@umituz/react-native-design-system";
|
|
18
|
+
import type { EnvConfig } from "../../types";
|
|
19
|
+
|
|
20
|
+
export interface EnvViewerScreenProps {
|
|
21
|
+
/** Environment configuration */
|
|
22
|
+
config: EnvConfig;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const EnvViewerScreen: React.FC<EnvViewerScreenProps> = ({ config }) => {
|
|
26
|
+
const tokens = useAppDesignTokens();
|
|
27
|
+
const { bottom } = useSafeAreaInsets();
|
|
28
|
+
const [revealedKeys, setRevealedKeys] = useState<Set<string>>(new Set());
|
|
29
|
+
|
|
30
|
+
const toggleReveal = (key: string) => {
|
|
31
|
+
setRevealedKeys((prev) => {
|
|
32
|
+
const newSet = new Set(prev);
|
|
33
|
+
if (newSet.has(key)) {
|
|
34
|
+
newSet.delete(key);
|
|
35
|
+
} else {
|
|
36
|
+
newSet.add(key);
|
|
37
|
+
}
|
|
38
|
+
return newSet;
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const copyToClipboard = async (value: string, key: string) => {
|
|
43
|
+
try {
|
|
44
|
+
await navigator.clipboard.writeText(value);
|
|
45
|
+
AlertService.createSuccessAlert("Copied", `${key} copied to clipboard`);
|
|
46
|
+
} catch {
|
|
47
|
+
AlertService.createErrorAlert("Error", "Failed to copy to clipboard");
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const renderVariable = (item: typeof config.variables[0]) => {
|
|
52
|
+
const isRevealed = revealedKeys.has(item.key);
|
|
53
|
+
const displayValue = item.sensitive && !isRevealed ? "••••••••" : item.value;
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<View
|
|
57
|
+
key={item.key}
|
|
58
|
+
style={[
|
|
59
|
+
styles.variableCard,
|
|
60
|
+
{ backgroundColor: tokens.colors.surfaceContainer, borderRadius: tokens.borders.radiusMd },
|
|
61
|
+
]}
|
|
62
|
+
>
|
|
63
|
+
<View style={styles.variableHeader}>
|
|
64
|
+
<AtomicText type="labelLarge" color="textPrimary">
|
|
65
|
+
{item.key}
|
|
66
|
+
</AtomicText>
|
|
67
|
+
<View style={styles.actions}>
|
|
68
|
+
{item.sensitive && (
|
|
69
|
+
<AtomicIcon
|
|
70
|
+
name={isRevealed ? "eye-off" : "eye"}
|
|
71
|
+
size="sm"
|
|
72
|
+
color="textSecondary"
|
|
73
|
+
onPress={() => toggleReveal(item.key)}
|
|
74
|
+
/>
|
|
75
|
+
)}
|
|
76
|
+
<AtomicIcon
|
|
77
|
+
name="copy"
|
|
78
|
+
size="sm"
|
|
79
|
+
color="textSecondary"
|
|
80
|
+
onPress={() => copyToClipboard(item.value, item.key)}
|
|
81
|
+
style={{ marginLeft: tokens.spacing.sm }}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
</View>
|
|
85
|
+
<AtomicText type="bodyMedium" color="textSecondary" style={{ marginTop: tokens.spacing.xs }}>
|
|
86
|
+
{displayValue}
|
|
87
|
+
</AtomicText>
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
|
|
94
|
+
<NavigationHeader title="Environment Variables" onBackPress={() => AppNavigation.goBack()} />
|
|
95
|
+
|
|
96
|
+
<ScrollView
|
|
97
|
+
showsVerticalScrollIndicator={false}
|
|
98
|
+
contentContainerStyle={{ paddingBottom: bottom + tokens.spacing.lg }}
|
|
99
|
+
>
|
|
100
|
+
{config.environmentName && (
|
|
101
|
+
<View style={[styles.infoCard, { backgroundColor: tokens.colors.surfaceContainer }]}>
|
|
102
|
+
<AtomicText type="labelSmall" color="textSecondary">
|
|
103
|
+
Environment
|
|
104
|
+
</AtomicText>
|
|
105
|
+
<AtomicText type="titleMedium" color="textPrimary">
|
|
106
|
+
{config.environmentName}
|
|
107
|
+
</AtomicText>
|
|
108
|
+
</View>
|
|
109
|
+
)}
|
|
110
|
+
|
|
111
|
+
{config.version && (
|
|
112
|
+
<View style={[styles.infoCard, { backgroundColor: tokens.colors.surfaceContainer }]}>
|
|
113
|
+
<AtomicText type="labelSmall" color="textSecondary">
|
|
114
|
+
Version
|
|
115
|
+
</AtomicText>
|
|
116
|
+
<AtomicText type="titleMedium" color="textPrimary">
|
|
117
|
+
{config.version}
|
|
118
|
+
{config.buildNumber && ` (${config.buildNumber})`}
|
|
119
|
+
</AtomicText>
|
|
120
|
+
</View>
|
|
121
|
+
)}
|
|
122
|
+
|
|
123
|
+
<View style={styles.section}>
|
|
124
|
+
<AtomicText type="titleMedium" color="textPrimary" style={{ marginBottom: tokens.spacing.md }}>
|
|
125
|
+
Configuration
|
|
126
|
+
</AtomicText>
|
|
127
|
+
{config.variables.map(renderVariable)}
|
|
128
|
+
</View>
|
|
129
|
+
|
|
130
|
+
<View style={[styles.warningCard, { backgroundColor: tokens.colors.errorContainer }]}>
|
|
131
|
+
<AtomicIcon name="alert-circle" size="sm" color="error" />
|
|
132
|
+
<AtomicText
|
|
133
|
+
type="bodySmall"
|
|
134
|
+
color="error"
|
|
135
|
+
style={{ marginLeft: tokens.spacing.sm, flex: 1 }}
|
|
136
|
+
>
|
|
137
|
+
This screen is only visible in development mode. Never share sensitive values.
|
|
138
|
+
</AtomicText>
|
|
139
|
+
</View>
|
|
140
|
+
</ScrollView>
|
|
141
|
+
</View>
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const styles = StyleSheet.create({
|
|
146
|
+
container: {
|
|
147
|
+
flex: 1,
|
|
148
|
+
},
|
|
149
|
+
infoCard: {
|
|
150
|
+
padding: 16,
|
|
151
|
+
marginHorizontal: 20,
|
|
152
|
+
marginTop: 12,
|
|
153
|
+
borderRadius: 12,
|
|
154
|
+
},
|
|
155
|
+
section: {
|
|
156
|
+
padding: 20,
|
|
157
|
+
},
|
|
158
|
+
variableCard: {
|
|
159
|
+
padding: 16,
|
|
160
|
+
marginBottom: 12,
|
|
161
|
+
},
|
|
162
|
+
variableHeader: {
|
|
163
|
+
flexDirection: "row",
|
|
164
|
+
justifyContent: "space-between",
|
|
165
|
+
alignItems: "center",
|
|
166
|
+
},
|
|
167
|
+
actions: {
|
|
168
|
+
flexDirection: "row",
|
|
169
|
+
alignItems: "center",
|
|
170
|
+
},
|
|
171
|
+
warningCard: {
|
|
172
|
+
flexDirection: "row",
|
|
173
|
+
padding: 16,
|
|
174
|
+
marginHorizontal: 20,
|
|
175
|
+
marginTop: 20,
|
|
176
|
+
borderRadius: 12,
|
|
177
|
+
alignItems: "flex-start",
|
|
178
|
+
},
|
|
179
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dev Domain Types
|
|
3
|
+
* Environment variable types for dev tools
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export interface EnvVariable {
|
|
7
|
+
/** Environment variable key */
|
|
8
|
+
key: string;
|
|
9
|
+
/** Environment variable value (masked if sensitive) */
|
|
10
|
+
value: string;
|
|
11
|
+
/** Whether this is a sensitive value (API keys, secrets) */
|
|
12
|
+
sensitive?: boolean;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface EnvConfig {
|
|
16
|
+
/** List of environment variables to display */
|
|
17
|
+
variables: EnvVariable[];
|
|
18
|
+
/** App version info */
|
|
19
|
+
version?: string;
|
|
20
|
+
/** Build number */
|
|
21
|
+
buildNumber?: string;
|
|
22
|
+
/** Environment name (development, staging, production) */
|
|
23
|
+
environmentName?: string;
|
|
24
|
+
}
|