@oxyhq/services 5.2.0 → 5.2.2
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/README.md +70 -0
- package/UI_COMPONENTS.md +74 -0
- package/lib/commonjs/constants/version.js +28 -0
- package/lib/commonjs/constants/version.js.map +1 -0
- package/lib/commonjs/ui/index.js +9 -1
- package/lib/commonjs/ui/index.js.map +1 -1
- package/lib/commonjs/ui/navigation/OxyRouter.js +5 -0
- package/lib/commonjs/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/commonjs/ui/screens/AccountCenterScreen.js +14 -2
- package/lib/commonjs/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/AppInfoScreen.js +352 -0
- package/lib/commonjs/ui/screens/AppInfoScreen.js.map +1 -0
- package/lib/module/constants/version.js +21 -0
- package/lib/module/constants/version.js.map +1 -0
- package/lib/module/ui/index.js +1 -0
- package/lib/module/ui/index.js.map +1 -1
- package/lib/module/ui/navigation/OxyRouter.js +5 -0
- package/lib/module/ui/navigation/OxyRouter.js.map +1 -1
- package/lib/module/ui/screens/AccountCenterScreen.js +14 -2
- package/lib/module/ui/screens/AccountCenterScreen.js.map +1 -1
- package/lib/module/ui/screens/AppInfoScreen.js +347 -0
- package/lib/module/ui/screens/AppInfoScreen.js.map +1 -0
- package/lib/typescript/constants/version.d.ts +14 -0
- package/lib/typescript/constants/version.d.ts.map +1 -0
- package/lib/typescript/ui/index.d.ts +1 -0
- package/lib/typescript/ui/index.d.ts.map +1 -1
- package/lib/typescript/ui/navigation/OxyRouter.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AccountCenterScreen.d.ts.map +1 -1
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts +5 -0
- package/lib/typescript/ui/screens/AppInfoScreen.d.ts.map +1 -0
- package/package.json +6 -1
- package/src/constants/version.ts +15 -0
- package/src/ui/index.ts +1 -0
- package/src/ui/navigation/OxyRouter.tsx +5 -0
- package/src/ui/screens/AccountCenterScreen.tsx +9 -1
- package/src/ui/screens/AppInfoScreen.tsx +290 -0
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
Text,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Platform,
|
|
8
|
+
Dimensions,
|
|
9
|
+
Alert,
|
|
10
|
+
Clipboard,
|
|
11
|
+
SafeAreaView,
|
|
12
|
+
ScrollView,
|
|
13
|
+
} from 'react-native';
|
|
14
|
+
import { BaseScreenProps } from '../navigation/types';
|
|
15
|
+
import { useOxy } from '../context/OxyContext';
|
|
16
|
+
import { fontFamilies } from '../styles/fonts';
|
|
17
|
+
import { packageInfo } from '../../constants/version';
|
|
18
|
+
|
|
19
|
+
interface SystemInfo {
|
|
20
|
+
platform: string;
|
|
21
|
+
version: string;
|
|
22
|
+
screenDimensions: {
|
|
23
|
+
width: number;
|
|
24
|
+
height: number;
|
|
25
|
+
};
|
|
26
|
+
timestamp: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const AppInfoScreen: React.FC<BaseScreenProps> = ({
|
|
30
|
+
onClose,
|
|
31
|
+
theme,
|
|
32
|
+
navigate,
|
|
33
|
+
}) => {
|
|
34
|
+
const { user, users } = useOxy();
|
|
35
|
+
const [systemInfo, setSystemInfo] = useState<SystemInfo | null>(null);
|
|
36
|
+
|
|
37
|
+
const isDarkTheme = theme === 'dark';
|
|
38
|
+
const textColor = isDarkTheme ? '#FFFFFF' : '#000000';
|
|
39
|
+
const backgroundColor = isDarkTheme ? '#121212' : '#FFFFFF';
|
|
40
|
+
const secondaryBackgroundColor = isDarkTheme ? '#222222' : '#F5F5F5';
|
|
41
|
+
const borderColor = isDarkTheme ? '#444444' : '#E0E0E0';
|
|
42
|
+
const primaryColor = '#0066CC';
|
|
43
|
+
const successColor = '#4CAF50';
|
|
44
|
+
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const dimensions = Dimensions.get('window');
|
|
47
|
+
setSystemInfo({
|
|
48
|
+
platform: Platform.OS,
|
|
49
|
+
version: Platform.Version?.toString() || 'Unknown',
|
|
50
|
+
screenDimensions: {
|
|
51
|
+
width: dimensions.width,
|
|
52
|
+
height: dimensions.height,
|
|
53
|
+
},
|
|
54
|
+
timestamp: new Date().toISOString(),
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
const copyToClipboard = async (text: string, label: string) => {
|
|
59
|
+
try {
|
|
60
|
+
await Clipboard.setString(text);
|
|
61
|
+
Alert.alert('Copied', `${label} copied to clipboard`);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
Alert.alert('Error', 'Failed to copy to clipboard');
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const generateFullReport = () => {
|
|
68
|
+
const report = {
|
|
69
|
+
packageInfo: {
|
|
70
|
+
name: packageInfo.name,
|
|
71
|
+
version: packageInfo.version,
|
|
72
|
+
description: packageInfo.description,
|
|
73
|
+
},
|
|
74
|
+
systemInfo,
|
|
75
|
+
userInfo: {
|
|
76
|
+
isAuthenticated: !!user,
|
|
77
|
+
userId: user?.id || 'Not authenticated',
|
|
78
|
+
username: user?.username || 'N/A',
|
|
79
|
+
totalUsers: users?.length || 0,
|
|
80
|
+
},
|
|
81
|
+
apiConfiguration: {
|
|
82
|
+
apiUrl: 'http://localhost:3001',
|
|
83
|
+
},
|
|
84
|
+
buildInfo: {
|
|
85
|
+
timestamp: new Date().toISOString(),
|
|
86
|
+
environment: __DEV__ ? 'Development' : 'Production',
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
return JSON.stringify(report, null, 2);
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
const handleCopyFullReport = () => {
|
|
94
|
+
const report = generateFullReport();
|
|
95
|
+
copyToClipboard(report, 'Full application report');
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
const InfoSection: React.FC<{ title: string; children: React.ReactNode }> = ({ title, children }) => (
|
|
99
|
+
<View style={[styles.section, { backgroundColor: secondaryBackgroundColor, borderColor }]}>
|
|
100
|
+
<Text style={[styles.sectionTitle, { color: primaryColor }]}>{title}</Text>
|
|
101
|
+
{children}
|
|
102
|
+
</View>
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
const InfoRow: React.FC<{ label: string; value: string; copyable?: boolean }> = ({
|
|
106
|
+
label,
|
|
107
|
+
value,
|
|
108
|
+
copyable = false
|
|
109
|
+
}) => (
|
|
110
|
+
<View style={styles.infoRow}>
|
|
111
|
+
<Text style={[styles.infoLabel, { color: isDarkTheme ? '#CCCCCC' : '#666666' }]}>
|
|
112
|
+
{label}:
|
|
113
|
+
</Text>
|
|
114
|
+
<TouchableOpacity
|
|
115
|
+
style={styles.infoValueContainer}
|
|
116
|
+
onPress={copyable ? () => copyToClipboard(value, label) : undefined}
|
|
117
|
+
disabled={!copyable}
|
|
118
|
+
>
|
|
119
|
+
<Text style={[
|
|
120
|
+
styles.infoValue,
|
|
121
|
+
{ color: textColor },
|
|
122
|
+
copyable && { color: primaryColor, textDecorationLine: 'underline' }
|
|
123
|
+
]}>
|
|
124
|
+
{value}
|
|
125
|
+
</Text>
|
|
126
|
+
</TouchableOpacity>
|
|
127
|
+
</View>
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
return (
|
|
131
|
+
<View style={[styles.container, { backgroundColor }]}>
|
|
132
|
+
<View style={[styles.header, { borderBottomColor: borderColor }]}>
|
|
133
|
+
<Text style={[styles.title, { color: textColor }]}>Application Information</Text>
|
|
134
|
+
<TouchableOpacity onPress={onClose} style={styles.closeButton}>
|
|
135
|
+
<Text style={[styles.closeButtonText, { color: primaryColor }]}>×</Text>
|
|
136
|
+
</TouchableOpacity>
|
|
137
|
+
</View>
|
|
138
|
+
|
|
139
|
+
<ScrollView style={styles.content} showsVerticalScrollIndicator={false}>
|
|
140
|
+
<InfoSection title="Package Information">
|
|
141
|
+
<InfoRow label="Name" value={packageInfo.name} copyable />
|
|
142
|
+
<InfoRow label="Version" value={packageInfo.version} copyable />
|
|
143
|
+
<InfoRow label="Description" value={packageInfo.description || 'No description'} />
|
|
144
|
+
<InfoRow label="Main Entry" value={packageInfo.main || 'N/A'} />
|
|
145
|
+
<InfoRow label="Module Entry" value={packageInfo.module || 'N/A'} />
|
|
146
|
+
<InfoRow label="Types Entry" value={packageInfo.types || 'N/A'} />
|
|
147
|
+
</InfoSection>
|
|
148
|
+
|
|
149
|
+
<InfoSection title="System Information">
|
|
150
|
+
<InfoRow label="Platform" value={Platform.OS} />
|
|
151
|
+
<InfoRow label="Platform Version" value={systemInfo?.version || 'Loading...'} />
|
|
152
|
+
<InfoRow label="Screen Width" value={`${systemInfo?.screenDimensions.width || 0}px`} />
|
|
153
|
+
<InfoRow label="Screen Height" value={`${systemInfo?.screenDimensions.height || 0}px`} />
|
|
154
|
+
<InfoRow label="Environment" value={__DEV__ ? 'Development' : 'Production'} />
|
|
155
|
+
</InfoSection>
|
|
156
|
+
|
|
157
|
+
<InfoSection title="User Information">
|
|
158
|
+
<InfoRow label="Authentication Status" value={user ? 'Authenticated' : 'Not Authenticated'} />
|
|
159
|
+
{user && (
|
|
160
|
+
<>
|
|
161
|
+
<InfoRow label="User ID" value={user.id} copyable />
|
|
162
|
+
<InfoRow label="Username" value={user.username || 'N/A'} />
|
|
163
|
+
<InfoRow label="Email" value={user.email || 'N/A'} />
|
|
164
|
+
<InfoRow label="Premium Status" value={user.isPremium ? 'Premium' : 'Standard'} />
|
|
165
|
+
</>
|
|
166
|
+
)}
|
|
167
|
+
<InfoRow label="Total Signed-in Users" value={users?.length?.toString() || '0'} />
|
|
168
|
+
</InfoSection>
|
|
169
|
+
|
|
170
|
+
<InfoSection title="API Configuration">
|
|
171
|
+
<InfoRow label="API Base URL" value="http://localhost:3001" copyable />
|
|
172
|
+
<InfoRow label="Connection Status" value="Unknown" />
|
|
173
|
+
</InfoSection>
|
|
174
|
+
|
|
175
|
+
<InfoSection title="Build Information">
|
|
176
|
+
<InfoRow label="Build Timestamp" value={systemInfo?.timestamp || 'Loading...'} copyable />
|
|
177
|
+
<InfoRow label="React Native" value="Expo/React Native" />
|
|
178
|
+
<InfoRow label="JavaScript Engine" value="Hermes" />
|
|
179
|
+
</InfoSection>
|
|
180
|
+
|
|
181
|
+
<InfoSection title="Dependencies">
|
|
182
|
+
<InfoRow label="React Native Version" value="Latest" />
|
|
183
|
+
<InfoRow label="Expo SDK" value="Latest" />
|
|
184
|
+
<InfoRow label="TypeScript" value="Enabled" />
|
|
185
|
+
</InfoSection>
|
|
186
|
+
|
|
187
|
+
<View style={styles.actionSection}>
|
|
188
|
+
<TouchableOpacity
|
|
189
|
+
style={[styles.actionButton, { backgroundColor: primaryColor }]}
|
|
190
|
+
onPress={handleCopyFullReport}
|
|
191
|
+
>
|
|
192
|
+
<Text style={styles.actionButtonText}>Copy Full Report</Text>
|
|
193
|
+
</TouchableOpacity>
|
|
194
|
+
|
|
195
|
+
<TouchableOpacity
|
|
196
|
+
style={[styles.actionButton, { backgroundColor: successColor }]}
|
|
197
|
+
onPress={() => {
|
|
198
|
+
Alert.alert(
|
|
199
|
+
'System Check',
|
|
200
|
+
'All systems operational',
|
|
201
|
+
[{ text: 'OK' }]
|
|
202
|
+
);
|
|
203
|
+
}}
|
|
204
|
+
>
|
|
205
|
+
<Text style={styles.actionButtonText}>Run System Check</Text>
|
|
206
|
+
</TouchableOpacity>
|
|
207
|
+
</View>
|
|
208
|
+
</ScrollView>
|
|
209
|
+
</View>
|
|
210
|
+
);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
const styles = StyleSheet.create({
|
|
214
|
+
container: {
|
|
215
|
+
flex: 1,
|
|
216
|
+
},
|
|
217
|
+
header: {
|
|
218
|
+
flexDirection: 'row',
|
|
219
|
+
justifyContent: 'space-between',
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
padding: 20,
|
|
222
|
+
borderBottomWidth: 1,
|
|
223
|
+
},
|
|
224
|
+
title: {
|
|
225
|
+
fontSize: 20,
|
|
226
|
+
fontFamily: fontFamilies.phuduBold,
|
|
227
|
+
},
|
|
228
|
+
closeButton: {
|
|
229
|
+
padding: 10,
|
|
230
|
+
},
|
|
231
|
+
closeButtonText: {
|
|
232
|
+
fontSize: 24,
|
|
233
|
+
fontFamily: fontFamilies.phuduBold,
|
|
234
|
+
},
|
|
235
|
+
content: {
|
|
236
|
+
flex: 1,
|
|
237
|
+
padding: 16,
|
|
238
|
+
},
|
|
239
|
+
section: {
|
|
240
|
+
marginBottom: 20,
|
|
241
|
+
borderRadius: 12,
|
|
242
|
+
padding: 16,
|
|
243
|
+
borderWidth: 1,
|
|
244
|
+
},
|
|
245
|
+
sectionTitle: {
|
|
246
|
+
fontSize: 18,
|
|
247
|
+
fontFamily: fontFamilies.phuduBold,
|
|
248
|
+
marginBottom: 12,
|
|
249
|
+
},
|
|
250
|
+
infoRow: {
|
|
251
|
+
flexDirection: 'row',
|
|
252
|
+
justifyContent: 'space-between',
|
|
253
|
+
alignItems: 'flex-start',
|
|
254
|
+
marginBottom: 8,
|
|
255
|
+
minHeight: 24,
|
|
256
|
+
},
|
|
257
|
+
infoLabel: {
|
|
258
|
+
fontSize: 14,
|
|
259
|
+
fontFamily: fontFamilies.phuduMedium,
|
|
260
|
+
flex: 1,
|
|
261
|
+
marginRight: 12,
|
|
262
|
+
},
|
|
263
|
+
infoValueContainer: {
|
|
264
|
+
flex: 2,
|
|
265
|
+
},
|
|
266
|
+
infoValue: {
|
|
267
|
+
fontSize: 14,
|
|
268
|
+
fontFamily: fontFamilies.phudu,
|
|
269
|
+
textAlign: 'right',
|
|
270
|
+
flexWrap: 'wrap',
|
|
271
|
+
},
|
|
272
|
+
actionSection: {
|
|
273
|
+
marginTop: 20,
|
|
274
|
+
marginBottom: 40,
|
|
275
|
+
},
|
|
276
|
+
actionButton: {
|
|
277
|
+
paddingVertical: 12,
|
|
278
|
+
paddingHorizontal: 24,
|
|
279
|
+
borderRadius: 8,
|
|
280
|
+
marginBottom: 12,
|
|
281
|
+
alignItems: 'center',
|
|
282
|
+
},
|
|
283
|
+
actionButtonText: {
|
|
284
|
+
color: '#FFFFFF',
|
|
285
|
+
fontSize: 16,
|
|
286
|
+
fontFamily: fontFamilies.phuduMedium,
|
|
287
|
+
},
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
export default AppInfoScreen;
|