@umituz/react-native-settings 4.21.24 → 4.21.26

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.24",
3
+ "version": "4.21.26",
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",
@@ -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,180 @@
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
+ NavigationHeader,
17
+ } from "@umituz/react-native-design-system";
18
+ import * as Clipboard from "expo-clipboard";
19
+ import type { EnvConfig } from "../../types";
20
+
21
+ export interface EnvViewerScreenProps {
22
+ /** Environment configuration */
23
+ config: EnvConfig;
24
+ }
25
+
26
+ export const EnvViewerScreen: React.FC<EnvViewerScreenProps> = ({ config }) => {
27
+ const tokens = useAppDesignTokens();
28
+ const { bottom } = useSafeAreaInsets();
29
+ const [revealedKeys, setRevealedKeys] = useState<Set<string>>(new Set());
30
+
31
+ const toggleReveal = (key: string) => {
32
+ setRevealedKeys((prev) => {
33
+ const newSet = new Set(prev);
34
+ if (newSet.has(key)) {
35
+ newSet.delete(key);
36
+ } else {
37
+ newSet.add(key);
38
+ }
39
+ return newSet;
40
+ });
41
+ };
42
+
43
+ const copyToClipboard = async (value: string, key: string) => {
44
+ try {
45
+ await Clipboard.setStringAsync(value);
46
+ AlertService.createSuccessAlert("Copied", `${key} copied to clipboard`);
47
+ } catch {
48
+ AlertService.createErrorAlert("Error", "Failed to copy to clipboard");
49
+ }
50
+ };
51
+
52
+ const renderVariable = (item: typeof config.variables[0]) => {
53
+ const isRevealed = revealedKeys.has(item.key);
54
+ const displayValue = item.sensitive && !isRevealed ? "••••••••" : item.value;
55
+
56
+ return (
57
+ <View
58
+ key={item.key}
59
+ style={[
60
+ styles.variableCard,
61
+ { backgroundColor: tokens.colors.surfaceContainer, borderRadius: tokens.borders.radiusMd },
62
+ ]}
63
+ >
64
+ <View style={styles.variableHeader}>
65
+ <AtomicText type="labelLarge" color="textPrimary">
66
+ {item.key}
67
+ </AtomicText>
68
+ <View style={styles.actions}>
69
+ {item.sensitive && (
70
+ <AtomicIcon
71
+ name={isRevealed ? "eye-off" : "eye"}
72
+ size="sm"
73
+ color="textSecondary"
74
+ onPress={() => toggleReveal(item.key)}
75
+ />
76
+ )}
77
+ <AtomicIcon
78
+ name="copy"
79
+ size="sm"
80
+ color="textSecondary"
81
+ onPress={() => copyToClipboard(item.value, item.key)}
82
+ style={{ marginLeft: tokens.spacing.sm }}
83
+ />
84
+ </View>
85
+ </View>
86
+ <AtomicText type="bodyMedium" color="textSecondary" style={{ marginTop: tokens.spacing.xs }}>
87
+ {displayValue}
88
+ </AtomicText>
89
+ </View>
90
+ );
91
+ };
92
+
93
+ return (
94
+ <View style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}>
95
+ <NavigationHeader title="Environment Variables" onBackPress={() => AppNavigation.goBack()} />
96
+
97
+ <ScrollView
98
+ showsVerticalScrollIndicator={false}
99
+ contentContainerStyle={{ paddingBottom: bottom + tokens.spacing.lg }}
100
+ >
101
+ {config.environmentName && (
102
+ <View style={[styles.infoCard, { backgroundColor: tokens.colors.surfaceContainer }]}>
103
+ <AtomicText type="labelSmall" color="textSecondary">
104
+ Environment
105
+ </AtomicText>
106
+ <AtomicText type="titleMedium" color="textPrimary">
107
+ {config.environmentName}
108
+ </AtomicText>
109
+ </View>
110
+ )}
111
+
112
+ {config.version && (
113
+ <View style={[styles.infoCard, { backgroundColor: tokens.colors.surfaceContainer }]}>
114
+ <AtomicText type="labelSmall" color="textSecondary">
115
+ Version
116
+ </AtomicText>
117
+ <AtomicText type="titleMedium" color="textPrimary">
118
+ {config.version}
119
+ {config.buildNumber && ` (${config.buildNumber})`}
120
+ </AtomicText>
121
+ </View>
122
+ )}
123
+
124
+ <View style={styles.section}>
125
+ <AtomicText type="titleMedium" color="textPrimary" style={{ marginBottom: tokens.spacing.md }}>
126
+ Configuration
127
+ </AtomicText>
128
+ {config.variables.map(renderVariable)}
129
+ </View>
130
+
131
+ <View style={[styles.warningCard, { backgroundColor: tokens.colors.errorContainer }]}>
132
+ <AtomicIcon name="alert-circle" size="sm" color="error" />
133
+ <AtomicText
134
+ type="bodySmall"
135
+ color="error"
136
+ style={{ marginLeft: tokens.spacing.sm, flex: 1 }}
137
+ >
138
+ This screen is only visible in development mode. Never share sensitive values.
139
+ </AtomicText>
140
+ </View>
141
+ </ScrollView>
142
+ </View>
143
+ );
144
+ };
145
+
146
+ const styles = StyleSheet.create({
147
+ container: {
148
+ flex: 1,
149
+ },
150
+ infoCard: {
151
+ padding: 16,
152
+ marginHorizontal: 20,
153
+ marginTop: 12,
154
+ borderRadius: 12,
155
+ },
156
+ section: {
157
+ padding: 20,
158
+ },
159
+ variableCard: {
160
+ padding: 16,
161
+ marginBottom: 12,
162
+ },
163
+ variableHeader: {
164
+ flexDirection: "row",
165
+ justifyContent: "space-between",
166
+ alignItems: "center",
167
+ },
168
+ actions: {
169
+ flexDirection: "row",
170
+ alignItems: "center",
171
+ },
172
+ warningCard: {
173
+ flexDirection: "row",
174
+ padding: 16,
175
+ marginHorizontal: 20,
176
+ marginTop: 20,
177
+ borderRadius: 12,
178
+ alignItems: "flex-start",
179
+ },
180
+ });
@@ -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
+ }