@jescon-technologies/react-native-ui-kit 0.0.4 → 0.0.5

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.
Files changed (177) hide show
  1. package/index.d.ts +66 -0
  2. package/index.js +0 -4
  3. package/package.json +3 -2
  4. package/src/Alerts/AAlert.js +3 -3
  5. package/src/Alerts/AAlertIOS.js +3 -3
  6. package/src/{common → Common}/NetworkServiceCall.js +1 -1
  7. package/src/CommonStyle/CommonTheme.js +11 -0
  8. package/src/CommonStyle/ComponentFunctions.js +632 -0
  9. package/src/CommonStyle/PopupStyle.js +146 -0
  10. package/src/CommonStyle/commonStyle.js +93 -0
  11. package/src/CommonStyle/componentStyle.js +545 -0
  12. package/src/CommonStyle/optionListStyles.js +175 -0
  13. package/src/Components/ByProductPage.js +200 -0
  14. package/src/Components/CDropDownListNew.js +153 -0
  15. package/src/Components/CSupplierList.js +88 -0
  16. package/src/Components/CVerificationCard.js +2822 -0
  17. package/src/Components/CustomButton.js +67 -0
  18. package/src/Components/CustomCard.js +127 -0
  19. package/src/Components/CustomTextInput.js +47 -0
  20. package/src/Components/EquipmentPage.js +313 -0
  21. package/src/Components/FilterInput.Copy.js +723 -0
  22. package/src/Components/FilterInput.js +569 -0
  23. package/src/Components/HSubHeading.js +68 -0
  24. package/src/Components/HeaderCard.js +40 -0
  25. package/src/Components/MoreOptionsScreen.js +251 -0
  26. package/src/Components/NonSwipableProductCard.js +226 -0
  27. package/src/Components/NonSwipableSupplierCard.js +348 -0
  28. package/src/Components/ProductCard.js +1336 -0
  29. package/src/Components/QualityProductCard.js +1059 -0
  30. package/src/Components/RateProductCard.js +1452 -0
  31. package/src/Components/RawMaterial.js +261 -0
  32. package/src/Components/SDropDownEdited.js +549 -0
  33. package/src/Components/SDropDownNew.js +529 -0
  34. package/src/Components/SHelpDescription.js +147 -0
  35. package/src/Components/STextInputNew.js +510 -0
  36. package/src/Components/SearchProductCard.js +470 -0
  37. package/src/Components/StageByProduct.js +199 -0
  38. package/src/Components/SupplierCard.js +243 -0
  39. package/src/Components/SupplierInvoiceCard.js +405 -0
  40. package/src/Components/SwipableSupplierCard.js +136 -0
  41. package/src/Components/TagTemplate.js +74 -0
  42. package/src/Components/WrappedComponent.js +25 -0
  43. package/src/Custom/CBooking.js +944 -0
  44. package/src/Custom/CBookingPostpone.js +1822 -0
  45. package/src/Custom/CCalendar.js +560 -0
  46. package/src/Custom/CCard.js +880 -0
  47. package/src/Custom/CDetailCard.js +205 -0
  48. package/src/Custom/CHelpImage.js +52 -0
  49. package/src/Custom/CReport.js +569 -0
  50. package/src/Custom/CScrollView.js +73 -0
  51. package/src/Custom/CSignature.js +112 -0
  52. package/src/Custom/CSliderMenu.js +339 -0
  53. package/src/Custom/CSupplierCard.js +99 -0
  54. package/src/Custom/CTemplateCard.js +438 -0
  55. package/src/Custom/CTokenAllocation.js +1402 -0
  56. package/src/Custom/CTokenListOverlay.js +122 -0
  57. package/src/Custom/CWardStatus.js +444 -0
  58. package/src/Custom/Charts/CBarChart.js +218 -0
  59. package/src/Custom/Charts/CDashBoardList.js +133 -0
  60. package/src/Custom/Charts/CDashBoardTable.js +172 -0
  61. package/src/Custom/Charts/CLineChart.js +193 -0
  62. package/src/Custom/Charts/CPieChart.js +186 -0
  63. package/src/Custom/Loader.js +182 -0
  64. package/src/Custom/OUserView.js +1121 -0
  65. package/src/Custom/PreviewDosage.js +115 -0
  66. package/src/Custom/SearchLoader.js +32 -0
  67. package/src/Custom/TableComponent/CActivityTable.js +707 -0
  68. package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
  69. package/src/Custom/TableComponent/CTable.js +185 -0
  70. package/src/Custom/TableComponent/CTextBody.js +40 -0
  71. package/src/Custom/TableComponent/CTextHeader.js +17 -0
  72. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
  73. package/src/Custom/TableComponent/SDropdownTable.js +491 -0
  74. package/src/Custom/TableComponent/TagTable.js +1200 -0
  75. package/src/CustomComponents/CAddColumn.js +140 -0
  76. package/src/CustomComponents/CAssessmentDelete.js +307 -0
  77. package/src/CustomComponents/CAwesomeButton.js +83 -0
  78. package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
  79. package/src/CustomComponents/CBackHandler.js +273 -0
  80. package/src/CustomComponents/CCalendar.js +243 -0
  81. package/src/CustomComponents/CCommentOverlay.js +202 -0
  82. package/src/CustomComponents/CComments.js +162 -0
  83. package/src/CustomComponents/CContainerView.js +24 -0
  84. package/src/CustomComponents/CCustomTextInput.js +336 -0
  85. package/src/CustomComponents/CDetailView.js +40 -0
  86. package/src/CustomComponents/CDropDownList.js +153 -0
  87. package/src/CustomComponents/CDropdownSelect.js +555 -0
  88. package/src/CustomComponents/CFooterView.js +42 -0
  89. package/src/CustomComponents/CImagePickerSave.js +316 -0
  90. package/src/CustomComponents/CModalOverlay.js +91 -0
  91. package/src/CustomComponents/CNetworkStatus.js +327 -0
  92. package/src/CustomComponents/CNotesInstructions.js +1000 -0
  93. package/src/CustomComponents/COverlay.js +81 -0
  94. package/src/CustomComponents/CRemarks.js +176 -0
  95. package/src/CustomComponents/CRowAdd.js +143 -0
  96. package/src/CustomComponents/CSummaryDropDown.js +327 -0
  97. package/src/CustomComponents/CText.js +9 -0
  98. package/src/CustomComponents/CVectorIcon.js +34 -0
  99. package/src/CustomComponents/HtmlContentViewer.js +65 -0
  100. package/src/CustomComponents/PdfContentViewer.js +90 -0
  101. package/src/CustomComponents/SDropDownDosage.js +1087 -0
  102. package/src/CustomComponents/SwipableProductCard.js +246 -0
  103. package/src/CustomComponents/SwipableProductImageCard.js +254 -0
  104. package/src/CustomComponents/WorkOrderDetails.js +1216 -0
  105. package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
  106. package/src/HOC/ConfirmOverlay.js +2 -2
  107. package/src/HOC/HMoreButton.js +1 -1
  108. package/src/HOC/HNatureHeading.js +1 -1
  109. package/src/HOC/HShadowButton.js +1 -1
  110. package/src/HOC/HShadowCountButton.js +1 -1
  111. package/src/Json/Chart.json +818 -0
  112. package/src/Json/Consultation.json +622 -0
  113. package/src/Json/CreditBill.json +490 -0
  114. package/src/Json/Dropdown.json +216 -0
  115. package/src/Json/DropdownConsultation.json +228 -0
  116. package/src/Json/DynamicReports.json +623 -0
  117. package/src/Json/Footer.json +79 -0
  118. package/src/Media/AudioScreen.js +2 -7
  119. package/src/Media/CCaptureImageWithoutEdit.js +1 -1
  120. package/src/Media/CImageGallery.js +2 -2
  121. package/src/Media/CSingleImage.js +2 -2
  122. package/src/Media/CVideoPlay.js +1 -1
  123. package/src/Media/DocumentScreen.js +2 -7
  124. package/src/Media/DrawingScreen.js +2 -6
  125. package/src/Media/ImageScreen.js +2 -6
  126. package/src/Media/VideoScreen.js +2 -7
  127. package/src/Navigation/PageNavigation.js +224 -0
  128. package/src/Navigation/useFocusEffect.js +2 -0
  129. package/src/Navigation/useFocusEffect.native.js +1 -0
  130. package/src/Navigation/useFocusEffect.web.js +1 -0
  131. package/src/Navigation/useIsFocused.js +1 -0
  132. package/src/Navigation/useIsFocused.native.js +1 -0
  133. package/src/Navigation/useIsFocused.web.js +1 -0
  134. package/src/Navigation/useNavigation.js +2 -0
  135. package/src/Navigation/useNavigation.native.js +1 -0
  136. package/src/Navigation/useNavigation.web.js +1 -0
  137. package/src/Screens/CMedications.js +528 -0
  138. package/src/Screens/CWebViewGallery.js +203 -0
  139. package/src/Screens/ChartScan.js +279 -0
  140. package/src/Screens/ChartScreenNew.js +1579 -0
  141. package/src/Screens/Consultation.js +1500 -0
  142. package/src/Screens/Dashboard.js +778 -0
  143. package/src/Screens/FileExplorer.js +288 -0
  144. package/src/Screens/Footer.js +340 -0
  145. package/src/Screens/ForgotPassword.js +288 -0
  146. package/src/Screens/HeaderBlock.js +353 -0
  147. package/src/Screens/Login.js +328 -0
  148. package/src/Screens/Notification.js +149 -0
  149. package/src/Screens/OcrScreen.js +20 -0
  150. package/src/Screens/PdfPreview.js +507 -0
  151. package/src/Screens/RegistrationDetails.js +467 -0
  152. package/src/Screens/SearchScreen.js +582 -0
  153. package/src/Screens/Splash.js +788 -0
  154. package/src/Screens/SwipeLeftView.js +1867 -0
  155. package/src/StaticComponents/SDatePickerLabel.js +1 -1
  156. package/src/StaticComponents/SDatePickerNew.js +1 -1
  157. package/src/StaticComponents/SDateTimePickerNew.js +2 -2
  158. package/src/StaticComponents/SDropDownGenerate.js +3 -3
  159. package/src/StaticComponents/SDropDownHoc.js +4 -4
  160. package/src/StaticComponents/SDropDownIcon.js +1 -1
  161. package/src/StaticComponents/SMenuBox.js +2 -2
  162. package/src/StaticComponents/SSearch.js +2 -2
  163. package/src/StaticComponents/STextInput.js +1 -1
  164. package/src/StaticComponents/STimePicker.js +1 -1
  165. package/src/StaticComponents/STimingDropDownNew.js +2 -6
  166. package/src/StaticComponents/STimingSwitch.js +1 -1
  167. package/src/layout/CContainerView.js +1 -1
  168. package/src/layout/CDetailView.js +3 -3
  169. package/src/layout/HeaderBlock.js +5 -5
  170. package/src/layout/INVLoginLayout.js +3 -4
  171. package/src/layout/Loader.js +2 -2
  172. package/src/HOC/HAbsolute.js +0 -56
  173. package/src/HOC/HDiscontinue.js +0 -105
  174. package/src/HOC/HOverlay.js +0 -99
  175. package/src/layout/FooterBlock.js +0 -821
  176. /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
  177. /package/src/{common → Common}/Icons.js +0 -0
@@ -0,0 +1,788 @@
1
+ import React, { useContext, useEffect, useState } from 'react';
2
+ import {
3
+ View,
4
+ StatusBar,
5
+ Text,
6
+ Image,
7
+ TouchableOpacity,
8
+ KeyboardAvoidingView,
9
+ BackHandler,
10
+ Modal,
11
+ Dimensions,
12
+ Platform,
13
+ StyleSheet
14
+ } from 'react-native';
15
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
16
+ import AsyncStorage from '@react-native-async-storage/async-storage';
17
+ import RNExitApp from 'react-native-exit-app';
18
+ import RNFS from 'react-native-fs';
19
+ import { normalize } from '../CommonStyle/componentStyle';
20
+ import { isNU, isNUQ, notifyMessage } from '../CommonStyle/ComponentFunctions';
21
+ import { Global } from '../../../../../src/Common/Global';
22
+ import Icons from '../Common/Icons';
23
+ import NetworkServiceCall from '../Common/NetworkServiceCall';
24
+ import { APIURL } from '../../../../../src/Common/apiConstants';
25
+ import HOCIcons from '../HOC/HOCIcons';
26
+ import CBackHandler from '../CustomComponents/CBackHandler';
27
+ import ApkInstaller from 'react-native-installer'
28
+ import { useNavigation } from '../Navigation/useNavigation';
29
+ import packageJson from '../../package.json';
30
+
31
+ const ThemeColors = [
32
+ {
33
+ primary_color: '#094485',
34
+ secondary_color: 'black',
35
+ text_color: '#fff',
36
+ heading_text_color: 'darkblue',
37
+ bg_button: '#fff',
38
+ icon_color: 'darkblue',
39
+ selected_color: "#d7ffbc",
40
+ blur_color: 'rgba(255,255,255,0.6)',
41
+ error_color: '#D32F2F',
42
+ },
43
+ {
44
+ primary_color: 'black',
45
+ secondary_color: 'black',
46
+ text_color: '#fff',
47
+ heading_text_color: 'black',
48
+ bg_button: 'black',
49
+ icon_color: '#fff',
50
+ selected_color: "#d7ffbc",
51
+ blur_color: 'rgba(255,255,255,0.6)',
52
+ error_color: '#D32F2F',
53
+ },
54
+ {
55
+ primary_color: '#00008B',
56
+ secondary_color: 'black',
57
+ text_color: '#fff',
58
+ heading_text_color: '#00008B',
59
+ bg_button: '#fff',
60
+ icon_color: '#00008B',
61
+ selected_color: "#d7ffbc",
62
+ blur_color: 'rgba(255,255,255,0.6)',
63
+ error_color: '#D32F2F',
64
+ },
65
+ {
66
+ primary_color: '#e54495',
67
+ secondary_color: 'black',
68
+ text_color: '#fff',
69
+ heading_text_color: '#fc5dac',
70
+ bg_button: '#fff',
71
+ icon_color: '#fc5dac',
72
+ selected_color: "#d7ffbc",
73
+ blur_color: 'rgba(255,255,255,0.6)',
74
+ error_color: '#D32F2F',
75
+ },
76
+ {
77
+ primary_color: 'purple',
78
+ secondary_color: 'purple',
79
+ text_color: '#fff',
80
+ heading_text_color: 'purple',
81
+ bg_button: 'purple',
82
+ icon_color: '#fff',
83
+ selected_color: "#d7ffbc",
84
+ blur_color: 'rgba(255,255,255,0.6)',
85
+ error_color: '#D32F2F',
86
+ },
87
+ {
88
+ primary_color: '#0d910d',
89
+ secondary_color: '#0d910d',
90
+ text_color: '#fff',
91
+ heading_text_color: '#0d910d',
92
+ bg_button: '#fff',
93
+ icon_color: '#fff',
94
+ selected_color: "#d7ffbc",
95
+ blur_color: 'rgba(255,255,255,0.6)',
96
+ error_color: '#D32F2F',
97
+ },
98
+ {
99
+ primary_color: '#f70404',
100
+ secondary_color: '#f70404',
101
+ text_color: '#fff',
102
+ heading_text_color: '#f70404',
103
+ bg_button: '#fff',
104
+ icon_color: '#fff',
105
+ selected_color: "#d7ffbc",
106
+ blur_color: 'rgba(255,255,255,0.6)',
107
+ error_color: '#D32F2F',
108
+ },
109
+ {
110
+ primary_color: '#3489a8',
111
+ secondary_color: '#3489a8',
112
+ text_color: '#fff',
113
+ heading_text_color: '#3489a8',
114
+ bg_button: '#fff',
115
+ icon_color: '#fff',
116
+ selected_color: "#d7ffbc",
117
+ blur_color: 'rgba(255,255,255,0.6)',
118
+ error_color: '#D32F2F',
119
+ },
120
+ {
121
+ primary_color: 'grey',
122
+ secondary_color: 'grey',
123
+ text_color: '#fff',
124
+ heading_text_color: 'grey',
125
+ bg_button: '#fff',
126
+ icon_color: '#fff',
127
+ selected_color: "#d7ffbc",
128
+ blur_color: 'rgba(255,255,255,0.6)',
129
+ error_color: '#D32F2F',
130
+ },
131
+ {
132
+ primary_color: '#bab10e',
133
+ secondary_color: '#bab10e',
134
+ text_color: '#fff',
135
+ heading_text_color: '#bab10e',
136
+ bg_button: '#fff',
137
+ icon_color: '#fff',
138
+ selected_color: "#d7ffbc",
139
+ blur_color: 'rgba(255,255,255,0.6)',
140
+ error_color: '#D32F2F',
141
+ },
142
+ {
143
+ primary_color: '#9e331e',
144
+ secondary_color: '#9e331e',
145
+ text_color: '#fff',
146
+ heading_text_color: '#9e331e',
147
+ bg_button: '#fff',
148
+ icon_color: '#fff',
149
+ selected_color: "#d7ffbc",
150
+ blur_color: 'rgba(255,255,255,0.6)',
151
+ error_color: '#D32F2F',
152
+ }
153
+ ];
154
+
155
+ export default function Splash(props) {
156
+ const [loading, setLoading] = useState(false);
157
+ const [backHandler, setBackHandler] = useState(false);
158
+ const [refresh, setRefresh] = useState(0);
159
+ const [progress, setProgress] = useState(null);
160
+ const [isLoading, setIsLoading] = useState(false);
161
+ const [showText, setShowText] = useState();
162
+ const [updateVersion, setUpdateVersion] = useState();
163
+ const [retry, setRetry] = useState(false);
164
+ const navigation = useNavigation()
165
+
166
+ useEffect(() => {
167
+ if (Platform.OS === 'android') {
168
+ getApiVersionCheck();
169
+ } else if (Platform.OS === 'web') {
170
+ getData();
171
+ } else {
172
+ getData();
173
+ }
174
+ }, []);
175
+
176
+
177
+ useEffect(() => {
178
+ const backAction = () => {
179
+ RNExitApp.exitApp();
180
+ return true;
181
+ };
182
+
183
+ const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);
184
+ return () => backHandler.remove();
185
+ }, []);
186
+
187
+ const isValidUrl = (string) => {
188
+ try {
189
+ new URL(string);
190
+ return true;
191
+ } catch (err) {
192
+ return false;
193
+ }
194
+ };
195
+
196
+ const goBackFunction = (showText, retry, isLoading) => {
197
+ if (isNU(showText) && !retry && isLoading) {
198
+ RNExitApp.exitApp();
199
+ }
200
+ };
201
+
202
+ const getApiVersionCheck = () => {
203
+ setIsLoading(true);
204
+ setShowText();
205
+ setUpdateVersion();
206
+ setRetry(false);
207
+ setProgress(null);
208
+
209
+ const buttonapi = `${APIURL}insuranceadvanceget/emrcommonget/rnmoduleversioncheck ${Global.hospitalcode},${Global.module}`;
210
+ console.log('getApiVersionCheck buttonapi ', JSON.stringify(buttonapi));
211
+
212
+ NetworkServiceCall('get', buttonapi).then(function (response) {
213
+ if (
214
+ response.httpstatus === 200 &&
215
+ isNU(response.data) &&
216
+ isNUQ(response.data.version) &&
217
+ isNUQ(response.data.apkVersion) &&
218
+ isNUQ(response.data.bundleUrl) &&
219
+ isValidUrl(response.data.bundleUrl) &&
220
+ isNUQ(response.data.apkUrl) &&
221
+ isValidUrl(response.data.apkUrl) &&
222
+ isNU(response.data.descriptions)
223
+ ) {
224
+ console.log('getApiVersionCheck response @@@@@@@@@@@', JSON.stringify(response));
225
+ console.log('New version available:', response.data.version,Global.version);
226
+ console.log('New APK version available:', response.data.apkVersion,packageJson.version);
227
+ if (Global.version !== response.data.version) {
228
+ setUpdateVersion(response.data.version);
229
+ downloadBundleWithProgress(
230
+ (p) => setProgress(p),
231
+ response.data.bundleUrl,
232
+ response.data.version,
233
+ response.data.descriptions
234
+ );
235
+ } else if (packageJson.version !== response.data.apkVersion) {
236
+ downloadApkWithProgress(
237
+ (p) => setProgress(p),
238
+ response.data.apkUrl,
239
+ response.data.apkVersion,
240
+ response.data.descriptions
241
+ );
242
+ } else {
243
+ getData();
244
+ }
245
+ } else {
246
+ setIsLoading(false);
247
+ setRetry(true);
248
+ notifyMessage('Network Error.Please try again.', 2);
249
+ }
250
+ });
251
+ };
252
+
253
+ const downloadBundleWithProgress = async (onProgressUpdate, url, newversion, desc) => {
254
+ console.log('Starting bundle download from:', url);
255
+ return new Promise((resolve, reject) => {
256
+ const downloadDest = `${RNFS.ExternalDirectoryPath}/update.apk`;
257
+ const download = RNFS.downloadFile({
258
+ fromUrl: url,
259
+ toFile: downloadDest,
260
+ progressInterval: 500,
261
+ progress: (res) => {
262
+ const percentage = Math.floor((res.bytesWritten / res.contentLength) * 100);
263
+ console.log(`[OTA] Download progress: ${percentage}%`);
264
+ onProgressUpdate?.(percentage);
265
+ }
266
+ });
267
+
268
+ download.promise
269
+ .then(async (res) => {
270
+ console.log('[OTA] Download complete! Moving file...');
271
+ try {
272
+ ApkInstaller.install(downloadDest);
273
+ console.log('[OTA] File moved to final destination!');
274
+ setShowText(desc);
275
+ resolve(true);
276
+ RNExitApp.exitApp();
277
+ } catch (moveErr) {
278
+ console.warn('[OTA] Failed to move file:', moveErr.message);
279
+ reject(moveErr);
280
+ setRetry(true);
281
+ }
282
+ })
283
+ .catch((err) => {
284
+ console.warn('[OTA] Download failed:', err.message);
285
+ reject(err);
286
+ setRetry(true);
287
+ });
288
+ });
289
+ };
290
+
291
+ const downloadApkWithProgress = async (onProgressUpdate, url, newversion, desc) => {
292
+ console.log('Starting APK download from:', url);
293
+ return new Promise((resolve, reject) => {
294
+ const downloadDest = `${RNFS.ExternalDirectoryPath}/insure${newversion}.apk`;
295
+ const download = RNFS.downloadFile({
296
+ fromUrl: url,
297
+ toFile: downloadDest,
298
+ progressInterval: 500,
299
+ progress: (res) => {
300
+ const percentage = Math.floor((res.bytesWritten / res.contentLength) * 100);
301
+ console.log(`[APK] Download progress: ${percentage}%`);
302
+ onProgressUpdate?.(percentage);
303
+ }
304
+ });
305
+
306
+ download.promise
307
+ .then(async (res) => {
308
+ console.log('[APK] Download complete! Moving file...');
309
+ try {
310
+ ApkInstaller.install(downloadDest);
311
+ console.log('[APK] File moved to final destination!');
312
+ setShowText(desc);
313
+ resolve(true);
314
+ RNExitApp.exitApp();
315
+ } catch (moveErr) {
316
+ console.warn('[APK] Failed to move file:', moveErr.message);
317
+ reject(moveErr);
318
+ setRetry(true);
319
+ }
320
+ })
321
+ .catch((err) => {
322
+ console.warn('[APK] Download failed:', err.message);
323
+ reject(err);
324
+ setRetry(true);
325
+ });
326
+ });
327
+ };
328
+
329
+ const removeValue = async () => {
330
+ try {
331
+ await AsyncStorage.removeItem(Global.asyncStorageAppKey);
332
+ } catch (e) {
333
+ // remove error
334
+ }
335
+ };
336
+
337
+ const getLoginPageData = (object, key) => {
338
+ setLoading(true);
339
+ const buttonapi = `http://${object.APIP}:${object.PortNumber}/${object.ApiLink} '${key}',${object.ApiVersion}`;
340
+ console.log('getLoginPageData buttonpai ', JSON.stringify(buttonapi));
341
+
342
+ NetworkServiceCall('get', buttonapi, '').then(function (response) {
343
+ if (response.httpstatus === 200) {
344
+ if (object.ValidationStatus === true) {
345
+ Global.HospitalData = response.data.hospitalInfo;
346
+ Global.InstallationKey = key;
347
+ // props.navigation.navigate('Login', { data: response.data });
348
+ navigation.navigate('Login', { data: response.data });
349
+ setLoading(false);
350
+ } else {
351
+ setBackHandler(false);
352
+ notifyMessage('Install validation failed...', 3);
353
+ setLoading(false);
354
+ }
355
+ } else {
356
+ setBackHandler(false);
357
+ notifyMessage('Network Error... ', 4);
358
+ setLoading(false);
359
+ }
360
+ });
361
+ };
362
+
363
+ const getValidation = (otp) => {
364
+ const buttonapi = `${Global.licenseIp}'${otp}'`;
365
+ console.log('getValidation buttonapi', buttonapi);
366
+
367
+ setLoading(true);
368
+ NetworkServiceCall('get', buttonapi, '').then(function (response) {
369
+ console.log('getValidation response @@@@@@@@@@@', JSON.stringify(response));
370
+
371
+ if (response.httpstatus === 200) {
372
+ if (response.data?.ValidationStatus === true) {
373
+ setBackHandler(false);
374
+ storeData(otp, response.data);
375
+ getLoginPageData(response.data, otp);
376
+ } else {
377
+ setLoading(false);
378
+ setBackHandler(false);
379
+ notifyMessage('Validation Failed...Please enter right key', 3);
380
+ }
381
+ } else {
382
+ setLoading(false);
383
+ notifyMessage('Network Error... ', 4);
384
+ }
385
+ });
386
+ };
387
+
388
+ const storeData = async (value, response) => {
389
+ try {
390
+ const newValue = {
391
+ key: value,
392
+ hospitaldata: response
393
+ };
394
+ const jsonValue = JSON.stringify(newValue);
395
+ await AsyncStorage.setItem(Global.asyncStorageAppKey, jsonValue);
396
+ } catch (e) {
397
+ // saving error
398
+ }
399
+ };
400
+
401
+ const setTheme = async (item) => {
402
+ try {
403
+ const jsonValue = JSON.stringify(item);
404
+ await AsyncStorage.setItem(Global.asyncStorageThemeKey, jsonValue);
405
+ Global.AppTheme = item;
406
+ setRefresh(refresh + 1);
407
+ } catch (e) {
408
+ // saving error
409
+ }
410
+ removeValue();
411
+ setBackHandler(false);
412
+ };
413
+
414
+ const getStorageItem = async (key) => {
415
+ if (Platform.OS === 'web' || Platform.OS === 'windows' || Platform.OS === 'macos') {
416
+ // Check if we're in Electron
417
+ if (window && window.process && window.process.type === 'renderer') {
418
+ // For Electron renderer process
419
+ console.log('Getting from localStorage for key (Electron):', key);
420
+ return localStorage.getItem(key);
421
+ //return 'emr@amala'
422
+ }
423
+ return localStorage.getItem(key);
424
+ } else {
425
+ const AsyncStorage = require('@react-native-async-storage/async-storage').default;
426
+ return await AsyncStorage.getItem(key);
427
+ }
428
+ };
429
+
430
+
431
+
432
+ const getData = async () => {
433
+ try {
434
+ const jsonValue = await getStorageItem(Global.asyncStorageAppKey);
435
+ console.log('Retrieved value:', jsonValue);
436
+
437
+ if (!jsonValue) {
438
+ return getValidation(Global.preinstallationkey);
439
+ console.log("Hello");
440
+ }
441
+
442
+ const InstallationData = JSON.parse(jsonValue);
443
+ console.log('installation', JSON.stringify(InstallationData));
444
+
445
+ setBackHandler(false);
446
+ return getLoginPageData(InstallationData.hospitaldata, InstallationData.key);
447
+ } catch (e) {
448
+ console.error('Error in getData:', e);
449
+ return getValidation(Global.preinstallationkey);
450
+ }
451
+ };
452
+
453
+ const renderUpdateModal = () => (
454
+ <Modal
455
+ animationType="none"
456
+ transparent={true}
457
+ visible={isLoading}
458
+ onRequestClose={() => goBackFunction(showText, retry, isLoading)}
459
+ style={styles.modal}
460
+ >
461
+ <View style={styles.modalContainer}>
462
+ <View style={styles.modalContent}>
463
+ {retry ? (
464
+ <View style={styles.retryContainer}>
465
+ <TouchableOpacity
466
+ onPress={getApiVersionCheck}
467
+ style={styles.retryButton}
468
+ >
469
+ <HOCIcons.MaterialCommunityIcons
470
+ name={'reload'}
471
+ color={'red'}
472
+ size={normalize(30)}
473
+ style={styles.retryIcon}
474
+ />
475
+ <Text style={styles.retryText}>Retry</Text>
476
+ </TouchableOpacity>
477
+ </View>
478
+ ) : (
479
+ <View style={styles.downloadContainer}>
480
+ {!showText && (
481
+ <Image
482
+ style={styles.downloadGif}
483
+ source={{ uri: APIURL + 'insurancefile/getCommonFile/image/transfer.gif' }}
484
+ />
485
+ )}
486
+ {!showText && (
487
+ <Text style={styles.progressText}>
488
+ {isNU(progress) ? `${progress} % Downloading` : null}
489
+ </Text>
490
+ )}
491
+ {showText && (
492
+ <View style={styles.descriptionContainer}>
493
+ <Text style={styles.descriptionText}>
494
+ {showText}
495
+ </Text>
496
+ </View>
497
+ )}
498
+ {updateVersion && (
499
+ <Text style={styles.versionText}>
500
+ <Text style={styles.versionLabel}>Latest Version: </Text>
501
+ {updateVersion}
502
+ </Text>
503
+ )}
504
+ </View>
505
+ )}
506
+ {!showText && (
507
+ <View>
508
+ <Text style={styles.currentVersionText}>
509
+ <Text style={styles.versionLabel}>Current Version: </Text>
510
+ {Global.version}
511
+ </Text>
512
+ </View>
513
+ )}
514
+ </View>
515
+ </View>
516
+ </Modal>
517
+ );
518
+
519
+ const renderThemeSelector = () => (
520
+ <View style={styles.themeContainer}>
521
+ <Text style={[styles.themeLabel, { color: Global.AppTheme.text_color }]}>
522
+ Choose Theme:
523
+ </Text>
524
+ <View style={styles.themeRow}>
525
+ {ThemeColors.map((item, i) => (
526
+ <TouchableOpacity
527
+ key={i}
528
+ onPress={() => setTheme(item)}
529
+ style={styles.themeButton}
530
+ >
531
+ <Icons.FontAwesome
532
+ name="circle"
533
+ color={item.primary_color}
534
+ size={normalize(20)}
535
+ />
536
+ </TouchableOpacity>
537
+ ))}
538
+ </View>
539
+ </View>
540
+ );
541
+
542
+ const renderSocialIcons = () => (
543
+ <View style={styles.socialContainer}>
544
+ {['facebook', 'web', 'linkedin'].map((item, i) => (
545
+ <TouchableOpacity
546
+ key={i}
547
+ onPress={removeValue}
548
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
549
+ >
550
+ <MaterialCommunityIcons
551
+ name={item}
552
+ color={Global.AppTheme.text_color}
553
+ size={normalize(15)}
554
+ />
555
+ </TouchableOpacity>
556
+ ))}
557
+ </View>
558
+ );
559
+
560
+ const renderAppLogo = () => (
561
+ <TouchableOpacity onPress={() => setBackHandler(false)}>
562
+ <View style={styles.logoContainer}>
563
+ <Image
564
+ style={styles.logo}
565
+ source={require('../../android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png')}
566
+ />
567
+ <Text style={styles.appName}>
568
+ {Global.SplashHeading || 'HOMES'}
569
+ </Text>
570
+ </View>
571
+ </TouchableOpacity>
572
+ );
573
+
574
+ const renderCompanyInfo = () => (
575
+ <View style={styles.companyContainer}>
576
+ <Text style={styles.fromText}>from,</Text>
577
+ <Text style={styles.companyName}>JESCON TECHNOLOGIES PVT LTD</Text>
578
+
579
+ {renderSocialIcons()}
580
+
581
+ {Platform.OS !== 'ios' && (
582
+ <View style={styles.versionContainer}>
583
+ <Text style={styles.codePushVersion}>
584
+ {Global.CodePushVersion}
585
+ </Text>
586
+ </View>
587
+ )}
588
+
589
+ <Text style={styles.versionText}>
590
+ {isNU(Global.version) ? `V ${Global.version}` : null}
591
+ </Text>
592
+
593
+ <TouchableOpacity
594
+ disabled={loading}
595
+ onPress={() => Platform.OS === 'android' ? getApiVersionCheck() : getData()}
596
+ style={styles.refreshButton}
597
+ >
598
+ <Icons.FontAwesome name={'refresh'} color={'#fff'} size={normalize(25)} />
599
+ <Text style={styles.refreshText}>Refresh</Text>
600
+ </TouchableOpacity>
601
+ </View>
602
+ );
603
+
604
+ return (
605
+ <KeyboardAvoidingView
606
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
607
+ style={[styles.container, { backgroundColor: Global.AppTheme.primary_color }]}
608
+ >
609
+ <StatusBar
610
+ backgroundColor={Global.AppTheme.primary_color}
611
+ barStyle={Platform.OS === 'ios' ? 'dark-content' : 'light-content'}
612
+ />
613
+
614
+ {isLoading && renderUpdateModal()}
615
+
616
+ {renderAppLogo()}
617
+ {renderCompanyInfo()}
618
+ {renderThemeSelector()}
619
+
620
+ {backHandler && (
621
+ <CBackHandler
622
+ type={1}
623
+ close={(val) => val && setBackHandler(val)}
624
+ callBack={(val) => val && getValidation(val)}
625
+ />
626
+ )}
627
+ </KeyboardAvoidingView>
628
+ );
629
+ }
630
+
631
+ const styles = StyleSheet.create({
632
+ container: {
633
+ flex: 1,
634
+ alignItems: 'center',
635
+ justifyContent: 'center',
636
+ },
637
+ // Modal Styles
638
+ modal: {
639
+ alignSelf: 'center',
640
+ padding: 0
641
+ },
642
+ modalContainer: {
643
+ height: Dimensions.get('window').height,
644
+ width: Dimensions.get('screen').width,
645
+ justifyContent: 'center',
646
+ alignItems: 'center',
647
+ paddingBottom: normalize(50)
648
+ },
649
+ modalContent: {
650
+ backgroundColor: 'white',
651
+ borderWidth: 1,
652
+ elevation: 5,
653
+ borderColor: 'grey',
654
+ borderRadius: 3,
655
+ alignItems: 'center',
656
+ alignSelf: 'center',
657
+ justifyContent: 'center',
658
+ height: Dimensions.get('screen').height * 0.2,
659
+ minWidth: Dimensions.get('screen').width * 0.8
660
+ },
661
+ retryContainer: {
662
+ flex: 1,
663
+ justifyContent: 'center',
664
+ alignItems: 'center'
665
+ },
666
+ retryButton: {
667
+ justifyContent: 'center',
668
+ alignItems: 'center'
669
+ },
670
+ retryIcon: {
671
+ marginHorizontal: normalize(8)
672
+ },
673
+ retryText: {
674
+ fontSize: normalize(12),
675
+ fontWeight: 'bold',
676
+ color: 'red'
677
+ },
678
+ downloadContainer: {
679
+ flex: 1,
680
+ justifyContent: 'center',
681
+ alignItems: 'center'
682
+ },
683
+ downloadGif: {
684
+ width: normalize(150),
685
+ height: normalize(100)
686
+ },
687
+ progressText: {
688
+ color: 'black'
689
+ },
690
+ descriptionContainer: {
691
+ flex: 1,
692
+ justifyContent: 'center',
693
+ alignItems: 'center'
694
+ },
695
+ descriptionText: {
696
+ color: '#cf1818',
697
+ fontSize: normalize(12),
698
+ textAlign: 'center'
699
+ },
700
+ versionText: {
701
+ color: Global.AppTheme.primary_color,
702
+ fontSize: normalize(10)
703
+ },
704
+ currentVersionText: {
705
+ color: Global.AppTheme.primary_color,
706
+ fontSize: normalize(10)
707
+ },
708
+ versionLabel: {
709
+ color: 'black',
710
+ fontSize: normalize(10)
711
+ },
712
+ // Logo Styles
713
+ logoContainer: {
714
+ alignItems: 'center',
715
+ justifyContent: 'center'
716
+ },
717
+ logo: {
718
+ width: normalize(70),
719
+ height: normalize(70),
720
+ resizeMode: 'contain',
721
+ borderRadius: normalize(30)
722
+ },
723
+ appName: {
724
+ color: Global.AppTheme.text_color,
725
+ fontWeight: 'bold',
726
+ fontSize: normalize(25),
727
+ textAlign: 'center'
728
+ },
729
+ // Company Info Styles
730
+ companyContainer: {
731
+ paddingTop: normalize(40),
732
+ alignItems: 'center',
733
+ justifyContent: 'center'
734
+ },
735
+ fromText: {
736
+ color: Global.AppTheme.text_color,
737
+ paddingBottom: normalize(8)
738
+ },
739
+ companyName: {
740
+ color: Global.AppTheme.text_color,
741
+ fontWeight: 'bold',
742
+ fontSize: normalize(16)
743
+ },
744
+ versionContainer: {
745
+ alignItems: 'center'
746
+ },
747
+ codePushVersion: {
748
+ color: 'white',
749
+ fontSize: normalize(16),
750
+ paddingTop: normalize(20)
751
+ },
752
+ refreshButton: {
753
+ marginTop: normalize(20),
754
+ alignItems: 'center'
755
+ },
756
+ refreshText: {
757
+ color: '#fff',
758
+ fontSize: normalize(7)
759
+ },
760
+ // Social Icons Styles
761
+ socialContainer: {
762
+ flexDirection: 'row',
763
+ width: normalize(90),
764
+ paddingTop: normalize(10),
765
+ justifyContent: 'space-between'
766
+ },
767
+ // Theme Selector Styles
768
+ themeContainer: {
769
+ paddingTop: normalize(50),
770
+ alignSelf: 'flex-start',
771
+ paddingHorizontal: normalize(20)
772
+ },
773
+ themeLabel: {
774
+ paddingBottom: normalize(2),
775
+ fontSize: normalize(14),
776
+ fontWeight: '500'
777
+ },
778
+ themeRow: {
779
+ flexDirection: 'row',
780
+ paddingTop: normalize(4),
781
+ alignItems: 'center',
782
+ flexWrap: 'wrap'
783
+ },
784
+ themeButton: {
785
+ paddingLeft: normalize(10),
786
+ paddingBottom: normalize(5)
787
+ }
788
+ });