react-native-mytatva-rn-sdk 1.2.5 → 1.2.7

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 (25) hide show
  1. package/android/build.gradle +4 -2
  2. package/android/src/main/AndroidManifestNew.xml +21 -10
  3. package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +6 -6
  4. package/android/src/main/java/com/mytatvarnsdk/MainApplication.kt +4 -6
  5. package/android/src/main/java/com/mytatvarnsdk/activity/SearchTransmitterActivity.kt +412 -363
  6. package/android/src/main/java/com/mytatvarnsdk/activity/SensorConnectSuccessActivity.kt +1 -1
  7. package/android/src/main/res/drawable/bg_dark_blue.xml +6 -0
  8. package/android/src/main/res/drawable/bg_green_progress.xml +6 -0
  9. package/android/src/main/res/drawable/bg_grey.xml +6 -0
  10. package/android/src/main/res/layout/activity_connect_sensor.xml +98 -1
  11. package/android/src/main/res/layout/activity_permission.xml +106 -8
  12. package/android/src/main/res/layout/activity_place_sensor.xml +98 -1
  13. package/android/src/main/res/layout/activity_place_transmitter.xml +98 -1
  14. package/android/src/main/res/layout/activity_search_transmitter.xml +99 -4
  15. package/android/src/main/res/layout/activity_sensor_connect_success.xml +98 -1
  16. package/android/src/main/res/values/strings.xml +1 -0
  17. package/android/src/main/res/values/styles.xml +71 -58
  18. package/ios/MyReactNativeBridge.h +4 -1
  19. package/ios/MyReactNativeBridge.m +124 -2
  20. package/ios/Support/API.swift +3 -1
  21. package/ios/ViewControllers/AttachTransmitterViewController.swift +3 -1
  22. package/ios/ViewControllers/ConnectToSensorViewController.swift +21 -10
  23. package/ios/ViewControllers/ConnectToTransmitterViewController.swift +24 -1
  24. package/ios/ViewControllers/ProvidePermissionViewController.swift +12 -0
  25. package/package.json +1 -1
@@ -13,12 +13,109 @@
13
13
  app:layout_constraintStart_toStartOf="parent"
14
14
  app:layout_constraintTop_toTopOf="parent" />
15
15
 
16
+ <androidx.constraintlayout.widget.ConstraintLayout
17
+ android:id="@+id/llProgress"
18
+ android:layout_width="match_parent"
19
+ android:layout_height="wrap_content"
20
+ app:layout_constraintTop_toBottomOf="@+id/toolbar">
21
+
22
+ <View
23
+ android:id="@+id/view1"
24
+ android:layout_width="0dp"
25
+ android:layout_height="4dp"
26
+ android:layout_marginHorizontal="5dp"
27
+ android:layout_marginVertical="10dp"
28
+ android:background="@drawable/bg_green_progress"
29
+ app:layout_constraintEnd_toStartOf="@id/view2"
30
+ app:layout_constraintHorizontal_chainStyle="spread"
31
+ app:layout_constraintHorizontal_weight="1.3"
32
+ app:layout_constraintStart_toStartOf="parent"
33
+ app:layout_constraintTop_toTopOf="parent" />
34
+
35
+ <TextView
36
+ android:id="@+id/tvDivide1"
37
+ android:layout_width="wrap_content"
38
+ android:layout_height="wrap_content"
39
+ android:layout_marginTop="5dp"
40
+ android:fontFamily="@font/roboto_semibold"
41
+ android:text="Connect Sensor"
42
+ android:textColor="#299D6B"
43
+ android:textSize="11sp"
44
+ app:layout_constraintEnd_toEndOf="@+id/view3"
45
+ app:layout_constraintStart_toStartOf="@+id/view3"
46
+ app:layout_constraintTop_toBottomOf="@+id/view3" />
47
+
48
+ <View
49
+ android:id="@+id/view2"
50
+ android:layout_width="0dp"
51
+ android:layout_height="4dp"
52
+ android:layout_marginHorizontal="5dp"
53
+ android:layout_marginVertical="10dp"
54
+ android:background="@drawable/bg_green_progress"
55
+ app:layout_constraintEnd_toStartOf="@id/view3"
56
+ app:layout_constraintHorizontal_weight="1.3"
57
+ app:layout_constraintStart_toEndOf="@id/view1"
58
+ app:layout_constraintTop_toTopOf="parent" />
59
+
60
+ <TextView
61
+ android:id="@+id/tvDivide2"
62
+ android:layout_width="wrap_content"
63
+ android:layout_height="wrap_content"
64
+ android:layout_marginTop="5dp"
65
+ android:fontFamily="@font/roboto_semibold"
66
+ android:text="Place Sensor"
67
+ android:textColor="#D0D5DD"
68
+ android:textSize="11sp"
69
+ app:layout_constraintEnd_toEndOf="@+id/view4"
70
+ app:layout_constraintStart_toStartOf="@+id/view4"
71
+ app:layout_constraintTop_toBottomOf="@+id/view4" />
72
+
73
+ <View
74
+ android:id="@+id/view3"
75
+ android:layout_width="0dp"
76
+ android:layout_height="4dp"
77
+ android:layout_marginHorizontal="5dp"
78
+ android:layout_marginVertical="10dp"
79
+ android:background="@drawable/bg_green_progress"
80
+ app:layout_constraintEnd_toStartOf="@id/view4"
81
+ app:layout_constraintHorizontal_weight="3"
82
+ app:layout_constraintStart_toEndOf="@id/view2"
83
+ app:layout_constraintTop_toTopOf="parent" />
84
+
85
+ <View
86
+ android:id="@+id/view4"
87
+ android:layout_width="0dp"
88
+ android:layout_height="4dp"
89
+ android:layout_marginHorizontal="5dp"
90
+ android:layout_marginVertical="10dp"
91
+ android:background="@drawable/bg_grey"
92
+ app:layout_constraintEnd_toStartOf="@id/view5"
93
+ app:layout_constraintHorizontal_weight="3"
94
+ app:layout_constraintStart_toEndOf="@id/view3"
95
+ app:layout_constraintTop_toTopOf="parent" />
96
+
97
+ <View
98
+ android:id="@+id/view5"
99
+ android:layout_width="0dp"
100
+ android:layout_height="4dp"
101
+ android:layout_marginHorizontal="5dp"
102
+ android:layout_marginVertical="10dp"
103
+ android:background="@drawable/bg_grey"
104
+ app:layout_constraintEnd_toEndOf="parent"
105
+ app:layout_constraintHorizontal_weight="1.3"
106
+ app:layout_constraintStart_toEndOf="@id/view4"
107
+ app:layout_constraintTop_toTopOf="parent" />
108
+
109
+ </androidx.constraintlayout.widget.ConstraintLayout>
110
+
111
+
16
112
  <View
17
113
  android:id="@+id/divider"
18
114
  android:layout_width="match_parent"
19
115
  android:layout_height="2dp"
116
+ android:layout_marginTop="5dp"
20
117
  android:background="#F2F4F7"
21
- app:layout_constraintTop_toBottomOf="@+id/toolbar" />
118
+ app:layout_constraintTop_toBottomOf="@+id/llProgress" />
22
119
 
23
120
 
24
121
  <androidx.constraintlayout.widget.ConstraintLayout
@@ -198,5 +198,6 @@
198
198
  <string name="qr_wrong">The QR code version is wrong, please scan another QR code.</string>
199
199
  <string name="verification_fail">verification failed</string>
200
200
  <string name="txt_provide_camera_permisison"><u>Provide Camera Permissions</u></string>
201
+ <string name="txt_know_more"><u>Know More</u></string>
201
202
 
202
203
  </resources>
@@ -1,62 +1,73 @@
1
1
  <resources xmlns:tools="http://schemas.android.com/tools">
2
- <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
3
- <!-- <style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen">-->
4
- <!-- 底部导航栏透明,但是会有一层灰度-->
5
- <!-- <item name="android:windowTranslucentNavigation">false</item>-->
6
-
7
- <!-- <item name="android:windowFullscreen">true</item>-->
8
- <!-- 顶部状态栏透明,但是会有一层灰度-->
9
- <!-- <item name="android:windowTranslucentStatus">false</item>-->
10
- <!-- 界面控件文字显示在顶部状态栏直下,底部导航栏之上-->
11
- <!-- <item name="android:fitsSystemWindows">true</item>-->
12
- <!-- ActionBar 标题栏的颜色-->
13
- <!-- <item name="android:windowBackground">@drawable/star</item>-->
14
- <item name="colorPrimary">@color/transparent</item>
15
- <!-- 顶部状态栏的背景颜色-->
16
- <item name="colorPrimaryDark">@color/color_33353F67</item>
17
- <!-- statusBarColor colorPrimaryDark高级,同时存在时会覆盖 colorPrimaryDark-->
18
- <item name="android:statusBarColor">@color/color_33353F67</item>
19
- <!-- 底部导航栏的颜色-->
20
- <item name="android:navigationBarColor">@color/color_33353F67</item>
21
- <!-- 默认控件的颜色 比如说CheckBox 等-->
22
- <item name="colorAccent">@color/colorAccent</item>
23
- <!-- 默认按钮的颜色-->
24
- <item name="colorButtonNormal">@color/colorAccent</item>
25
- <!-- 默认文字的颜色-->
26
- <item name="android:textColor">@color/textColor</item>
27
- <!-- 是否默认文字全部大写-->
28
- <item name="textAllCaps">false</item>
29
-
30
- <item name="android:autofilledHighlight" tools:targetApi="o">@color/transparent</item>
31
- </style>
32
-
33
- <style name="AnimBottom" parent="@android:style/Animation">
34
- <item name="android:windowEnterAnimation">@anim/pop_up_in</item>
35
- <item name="android:windowExitAnimation">@anim/pop_down_out</item>
36
- </style>
37
-
38
- <style name="AnimSide" parent="@android:style/Animation">
39
- <item name="android:windowEnterAnimation">@anim/pop_left_right</item>
40
- <item name="android:windowExitAnimation">@anim/pop_right_left</item>
41
- </style>
42
-
43
- <style name="WarnDialog" parent="android:style/Theme.Dialog">
44
- <!--背景颜色及和透明程度-->
45
- <item name="android:background">@android:color/transparent</item>
46
- <item name="android:windowBackground">@android:color/transparent</item>
47
- <!--是否去除标题 -->
48
- <item name="android:windowNoTitle">true</item>
49
- <!--是否去除边框-->
50
- <item name="android:windowFrame">@null</item>
51
- <!--是否浮现在activity之上-->
52
- <item name="android:windowIsFloating">true</item>
53
- <!--是否模糊-->
54
- <item name="android:backgroundDimEnabled">true</item>
55
- </style>
56
-
57
- <declare-styleable name="MaxHeightRecyclerView">
58
- <attr name="maxHeight" format="dimension" />
59
- </declare-styleable>
2
+
3
+ <style name="MyTheme" parent="Theme.AppCompat.Light.NoActionBar">
4
+ <!-- <style name="MyTheme" parent="@android:style/Theme.Holo.NoActionBar.Fullscreen">-->
5
+ <!-- 底部导航栏透明,但是会有一层灰度-->
6
+ <!-- <item name="android:windowTranslucentNavigation">false</item>-->
7
+
8
+ <!-- <item name="android:windowFullscreen">true</item>-->
9
+ <!-- 顶部状态栏透明,但是会有一层灰度-->
10
+ <!-- <item name="android:windowTranslucentStatus">false</item>-->
11
+ <!-- 界面控件文字显示在顶部状态栏直下,底部导航栏之上-->
12
+ <!-- <item name="android:fitsSystemWindows">true</item>-->
13
+ <!-- ActionBar 标题栏的颜色-->
14
+ <!-- <item name="android:windowBackground">@drawable/star</item>-->
15
+ <item name="colorPrimary">@color/transparent</item>
16
+ <!-- 顶部状态栏的背景颜色-->
17
+ <item name="colorPrimaryDark">@color/color_33353F67</item>
18
+ <!-- statusBarColor 比 colorPrimaryDark高级,同时存在时会覆盖 colorPrimaryDark-->
19
+ <item name="android:statusBarColor">@color/color_33353F67</item>
20
+ <!-- 底部导航栏的颜色-->
21
+ <item name="android:navigationBarColor">@color/color_33353F67</item>
22
+ <!-- 默认控件的颜色 比如说CheckBox 等-->
23
+ <item name="colorAccent">@color/colorAccent</item>
24
+ <!-- 默认按钮的颜色-->
25
+ <item name="colorButtonNormal">@color/colorAccent</item>
26
+ <!-- 默认文字的颜色-->
27
+ <item name="android:textColor">@color/textColor</item>
28
+ <!-- 是否默认文字全部大写-->
29
+ <item name="textAllCaps">false</item>
30
+
31
+ <item name="android:autofilledHighlight" tools:targetApi="o">@color/transparent</item>
32
+
33
+ <item name="android:windowAnimationStyle">@style/Animation.None</item>
34
+
35
+ </style>
36
+
37
+ <style name="Animation.None" parent="@android:style/Animation">
38
+ <item name="android:activityOpenEnterAnimation">@null</item>
39
+ <item name="android:activityOpenExitAnimation">@null</item>
40
+ <item name="android:activityCloseEnterAnimation">@null</item>
41
+ <item name="android:activityCloseExitAnimation">@null</item>
42
+ </style>
43
+
44
+ <style name="AnimBottom" parent="@android:style/Animation">
45
+ <item name="android:windowEnterAnimation">@anim/pop_up_in</item>
46
+ <item name="android:windowExitAnimation">@anim/pop_down_out</item>
47
+ </style>
48
+
49
+ <style name="AnimSide" parent="@android:style/Animation">
50
+ <item name="android:windowEnterAnimation">@anim/pop_left_right</item>
51
+ <item name="android:windowExitAnimation">@anim/pop_right_left</item>
52
+ </style>
53
+
54
+ <style name="WarnDialog" parent="android:style/Theme.Dialog">
55
+ <!--背景颜色及和透明程度-->
56
+ <item name="android:background">@android:color/transparent</item>
57
+ <item name="android:windowBackground">@android:color/transparent</item>
58
+ <!--是否去除标题 -->
59
+ <item name="android:windowNoTitle">true</item>
60
+ <!--是否去除边框-->
61
+ <item name="android:windowFrame">@null</item>
62
+ <!--是否浮现在activity之上-->
63
+ <item name="android:windowIsFloating">true</item>
64
+ <!--是否模糊-->
65
+ <item name="android:backgroundDimEnabled">true</item>
66
+ </style>
67
+
68
+ <declare-styleable name="MaxHeightRecyclerView">
69
+ <attr name="maxHeight" format="dimension" />
70
+ </declare-styleable>
60
71
 
61
72
  <style name="RoundedCornerImage">
62
73
  <item name="cornerFamily">rounded</item>
@@ -95,4 +106,6 @@
95
106
  <item name="android:fontFamily">@font/roboto_regular</item>
96
107
  <item name="android:textColor">@color/radio_text_selector</item>
97
108
  </style>
109
+
110
+
98
111
  </resources>
@@ -13,7 +13,10 @@
13
13
 
14
14
  #import <Foundation/Foundation.h>
15
15
  #import <React/RCTBridgeModule.h>
16
+ #import <React/RCTEventEmitter.h>
16
17
 
17
- @interface MyReactNativeBridge : NSObject <RCTBridgeModule>
18
+ @interface MyReactNativeBridge : RCTEventEmitter <RCTBridgeModule>
18
19
 
19
20
  @end
21
+ @interface EventEmitterManager : RCTEventEmitter <RCTBridgeModule>
22
+ @end
@@ -8,20 +8,82 @@
8
8
  #import <Foundation/Foundation.h>
9
9
  #import "MyReactNativeBridge.h"
10
10
  #import <UIKit/UIKit.h>
11
+ #import <React/RCTEventDispatcher.h>
12
+ #import <React/RCTEventEmitter.h>
13
+
14
+ @implementation EventEmitterManager
15
+
16
+ RCT_EXPORT_MODULE();
17
+
18
+ // Define the supported events
19
+ - (NSArray<NSString *> *)supportedEvents {
20
+ return @[@"cgmDeviceEvent"]; // Event names to listen to in JS
21
+ }
22
+
23
+ // Example method to emit an event from native to JS
24
+ RCT_EXPORT_METHOD(emitEvent:(NSString *)message) {
25
+ // Send an event with the name "EventName" and a message payload
26
+ [self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": message}];
27
+ }
28
+
29
+ @end
30
+
11
31
 
12
32
  @implementation MyReactNativeBridge
13
33
 
34
+ // static FinalViewModel *sharedViewModel = nil;
35
+
14
36
  RCT_EXPORT_MODULE();
15
37
 
16
- RCT_EXPORT_METHOD(openNativeFlow)
38
+ // This method returns the list of events the module supports
39
+ - (NSArray<NSString *> *)supportedEvents
40
+ {
41
+ return @[@"cgmDeviceEvent"];
42
+ }
43
+
44
+ // Start listening for notifications
45
+ - (instancetype)init
17
46
  {
47
+ if (self = [super init]) {
48
+ // Add observer for the notification from UIViewController
49
+ [[NSNotificationCenter defaultCenter] addObserver:self
50
+ selector:@selector(handleNotification:)
51
+ name:@"cgmDeviceEvent"
52
+ object:nil];
53
+ }
54
+ return self;
55
+ }
56
+
57
+
58
+ // Handle the incoming notification and emit the event to React Native
59
+ - (void)handleNotification:(NSNotification *)notification
60
+ {
61
+ // Extract data from the notification
62
+ NSDictionary *userInfo = notification.userInfo;
63
+
64
+ // Send the data to React Native via event emitter
65
+ [self sendEventWithName:@"cgmDeviceEvent" body:@{@"status": @"WARM_PERIOD_STARTED"}];
66
+ }
67
+
68
+ // Clean up the observer when the module is deallocated
69
+ - (void)dealloc
70
+ {
71
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
72
+ }
73
+
74
+
75
+ RCT_EXPORT_METHOD(startCgmTracky:(NSString *)token)
76
+ {
77
+ [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
78
+ [[NSUserDefaults standardUserDefaults] synchronize];
79
+
18
80
  dispatch_async(dispatch_get_main_queue(), ^{
19
81
  UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
20
82
  UIViewController *rootVC = keyWindow.rootViewController;
21
83
 
22
84
  // Try to get the topmost navigation controller
23
85
 
24
- UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainCGM" bundle:nil];
86
+ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
25
87
  UIViewController *nativeVC = [storyboard instantiateViewControllerWithIdentifier:@"StartConnectionViewController"];
26
88
 
27
89
 
@@ -33,4 +95,64 @@ RCT_EXPORT_METHOD(openNativeFlow)
33
95
  });
34
96
  }
35
97
 
98
+ RCT_EXPORT_METHOD(reconnectCgmTracky)
99
+ {
100
+ dispatch_async(dispatch_get_main_queue(), ^{
101
+ UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
102
+ UIViewController *rootVC = keyWindow.rootViewController;
103
+
104
+ // Load the storyboard
105
+ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
106
+
107
+ // Instantiate the target ViewController
108
+ UIViewController *reconnectVC = [storyboard instantiateViewControllerWithIdentifier:@"ConnectToTransmitterViewController"];
109
+
110
+ // Set presentation style
111
+ reconnectVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
112
+ // Set isForReconnect = YES
113
+ if ([reconnectVC respondsToSelector:@selector(setIsForReconnect:)]) {
114
+ [reconnectVC setValue:@(YES) forKey:@"isForReconnect"];
115
+ }
116
+ // Present it directly without navigation
117
+ if (reconnectVC) {
118
+ [rootVC presentViewController:reconnectVC animated:YES completion:nil];
119
+ }
120
+ });
121
+ }
122
+
123
+
124
+ RCT_EXPORT_METHOD(openHelpSupport)
125
+ {
126
+ dispatch_async(dispatch_get_main_queue(), ^{
127
+ UIWindow *keyWindow = [UIApplication sharedApplication].delegate.window;
128
+ UIViewController *rootVC = keyWindow.rootViewController;
129
+
130
+ // Load the storyboard
131
+ UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
132
+
133
+ // Instantiate the target ViewController
134
+ UIViewController *chatWithExpertVC = [storyboard instantiateViewControllerWithIdentifier:@"ChatWithExpertViewController"];
135
+
136
+ // Set presentation style
137
+ chatWithExpertVC.modalPresentationStyle = UIModalPresentationOverFullScreen;
138
+
139
+ // Present it directly without navigation
140
+ if (chatWithExpertVC) {
141
+ [rootVC presentViewController:chatWithExpertVC animated:YES completion:nil];
142
+ }
143
+ });
144
+ }
145
+
146
+ RCT_EXPORT_METHOD(observeAllGlucoseData:(NSString *)token)
147
+ {
148
+ // [[NSUserDefaults standardUserDefaults] setObject:token forKey:@"authToken"];
149
+ // [[NSUserDefaults standardUserDefaults] synchronize];
150
+
151
+
152
+ // if (!sharedViewModel) {
153
+ // sharedViewModel = [[FinalViewModel alloc] init];
154
+ // }
155
+ // [sharedViewModel initialize];
156
+ }
157
+
36
158
  @end
@@ -20,7 +20,9 @@ let STAGE_ENC_KEY = "9Ddyaf6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IDPvBEZFj8fZgQV4z8/yzayDcfqZQPc9Wrw8JNrFLCd8emvo7QHFfGttnIsAtmR8Yp3x49sjEn3hFW6nEKl9FRtRT1r3LzHmIdokL5tz3nO/T3FzLn5sqfp5QBJKKK2dgJdmAz0KC6vKtJ0PtVR4shL7pqjoZuJimFObYKyQbQudW7gLH8WjqORNG2dsplOLzDQ0y7nQdQ0tWrLJtnAch0p5PyTXtunlkNWeuzrldkqVMTUPaAtGcEnmS4RFncD3C6sq9V6lpBKLdrh99vnH3EX81DTH2Hrqm0bN5Tl3UqzUJ7n/JQCR3phDmOo+Uk81y3z3ikiGZZpZikN7c3DtSP34Vc+cNUosWrChqj1gLL4Eg/jMDxE4+bdAGr03ALxEAj2uLGEsDaZRuio6e8/iMcA0z3oqhtAxQ0nU1ivAK7cHeddjRFtvrNb0l+TgrcQI9UVffMOoGDEfAQNUpT2+R5dIysw=="
25
+ let TOKEN = UserDefaults.standard.string(forKey: "authToken") ?? defaultToken
24
26
 
25
27
 
26
28
  /*TatvaEncryptionConfig {
@@ -58,7 +58,9 @@ class AttachTransmitterViewController: UIViewController {
58
58
  self.viewModel.uploadData(data: arrayFromInitial)
59
59
  }
60
60
 
61
-
61
+ NotificationCenter.default.post(name: Notification.Name("cgmDeviceEvent"), object: nil, userInfo: ["a":"a"])
62
+ self.navigationController?.presentingViewController?.dismiss(animated: true, completion: nil)
63
+
62
64
  //let vc = ConnectToTransmitterViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
63
65
  //self.navigationController?.pushViewController(vc, animated: true)
64
66
  }
@@ -42,7 +42,8 @@ class ConnectToSensorViewController: UIViewController {
42
42
  case success
43
43
  case error
44
44
  }
45
-
45
+
46
+ var connectedTime: Date?
46
47
  var connected:(()->())?
47
48
  var screenType: enumScreenType = .camera
48
49
  var isCodeDetected = false
@@ -222,7 +223,7 @@ class ConnectToSensorViewController: UIViewController {
222
223
  let btStatus: BluetoothManagerStatus = BluetoothManagerStatus(rawValue: newValue) ?? .scanStart
223
224
 
224
225
  if btStatus == .initialStart {
225
-
226
+ self.connectedTime = Date()
226
227
  print("Success")
227
228
  screenType = .success
228
229
  tableView.reloadData()
@@ -329,15 +330,25 @@ extension ConnectToSensorViewController: UITableViewDelegate, UITableViewDataSou
329
330
  return cell
330
331
  }
331
332
  case .success:
332
- switch enumSuccessTableRow(rawValue: indexPath.row)! {
333
- case .success:
334
- let cell: ConnectSuccessTVC = tableView.dequeueReusableCell(for: indexPath)
335
- cell.labelDate.text = "Connected on 12:00PM, 03:00 PM"
336
- cell.labelDesc.isHidden = true
337
- cell.labelTitle.text = "Sensor Connected Successfully"
338
- cell.setImageForCGM()
339
- return cell
333
+ switch enumSuccessTableRow(rawValue: indexPath.row)! {
334
+ case .success:
335
+ let cell: ConnectSuccessTVC = tableView.dequeueReusableCell(for: indexPath)
336
+ let dateFormatter = DateFormatter()
337
+ dateFormatter.dateFormat = "dd-MM-yyyy hh:mm a"
338
+ dateFormatter.timeZone = TimeZone.current
339
+
340
+ if let connectedTime = connectedTime {
341
+ // Convert the Date to a String
342
+ let dateString = dateFormatter.string(from: connectedTime)
343
+ cell.labelDate.text = "Connected on \(String(describing: dateString))"
344
+ } else {
345
+ cell.labelDate.text = ""
340
346
  }
347
+ cell.labelDesc.isHidden = true
348
+ cell.labelTitle.text = "Sensor Connected Successfully"
349
+ cell.setImageForCGM()
350
+ return cell
351
+ }
341
352
  case .error:
342
353
  switch enumFailureTableRow(rawValue: indexPath.row)! {
343
354
  case .failAnimation:
@@ -51,7 +51,8 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
51
51
 
52
52
  var screenType: enumScreenType = .searching
53
53
  var devices: [(peripheral: CBPeripheral,name: String)] = []
54
- var isForReconnect: Bool = false
54
+ @objc var isForReconnect: Bool = false
55
+ var connectedTime: Date?
55
56
 
56
57
  var foundDevices: NSMutableArray = []
57
58
  let manager = KLTBluetoothManager.shared()
@@ -91,11 +92,17 @@ class ConnectToTransmitterViewController: UIViewController, KLTBluetoothDelegate
91
92
  bottomButton.hideRightArrow()
92
93
  }
93
94
  bottomButton.buttonTapCallback = {
95
+ if self.isForReconnect {
96
+ NotificationCenter.default.post(name: Notification.Name("cgmDeviceEvent"), object: nil, userInfo: ["a":"a"])
97
+ self.navigationController?.presentingViewController?.dismiss(animated: true, completion: nil)
98
+ } else {
99
+
94
100
  let vc = ConnectToSensorViewController.instantiate(fromStoryboard: Enum_stroyboard.Main.rawValue)
95
101
  vc.connected = {
96
102
  //self.showConfirmInsulinUser()
97
103
  }
98
104
  self.navigationController?.pushViewController(vc, animated: false)
105
+ }
99
106
  }
100
107
 
101
108
  customTopView.onCloseTapped = {
@@ -227,6 +234,7 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
227
234
  let peripheral = self.foundDevices[indexPath.row] as! CBPeripheral
228
235
  if let device = KLTDatabaseHandler.shared().queryDevice(withId: peripheral.identifier.uuidString) {
229
236
  //let snLocalName = device.advertise?.localName?.trimmingCharacters(in: .whitespacesAndNewlines)
237
+ self.connectedTime = Date()
230
238
  print("Connected device", device)
231
239
  self.manager?.readyToConnectedPeripheral = peripheral
232
240
  self.screenType = .success
@@ -240,6 +248,21 @@ extension ConnectToTransmitterViewController: UITableViewDelegate, UITableViewDa
240
248
  switch enumSuccessTableRow(rawValue: indexPath.row)! {
241
249
  case .success:
242
250
  let cell: ConnectSuccessTVC = tableView.dequeueReusableCell(for: indexPath)
251
+ if let device = KLTDatabaseHandler.shared().queryDevice(withId: manager?.readyToConnectedPeripheral.identifier.uuidString) {
252
+ let name = device.advertise?.localName?.trimmingCharacters(in: .whitespacesAndNewlines) ?? ""
253
+ let dateFormatter = DateFormatter()
254
+ dateFormatter.dateFormat = "dd-MM-yyyy hh:mm a"
255
+ dateFormatter.timeZone = TimeZone.current
256
+
257
+ if let connectedTime = connectedTime {
258
+ // Convert the Date to a String
259
+ let dateString = dateFormatter.string(from: connectedTime)
260
+ cell.labelDate.text = "Connected on \(String(describing: dateString))"
261
+ } else {
262
+ cell.labelDate.text = ""
263
+ }
264
+ cell.labelDesc.text = "Sno: \(name)"
265
+ }
243
266
  return cell
244
267
  case .importantNote:
245
268
  let cell: NoteTVC = tableView.dequeueReusableCell(for: indexPath)
@@ -59,6 +59,18 @@ class ProvidePermissionViewController: UIViewController {
59
59
  self.navigationController?.pushViewController(vc, animated: false)
60
60
  }
61
61
  updateBottomButtonState()
62
+
63
+ // Initialize the CBCentralManager with the current view controller as the delegate
64
+ centralManager = CBCentralManager(delegate: self, queue: nil)
65
+ // If the switch is turned on, check if Bluetooth is powered on
66
+ checkBluetoothPermission()
67
+
68
+ // Initialize the CLLocationManager
69
+ locationManager = CLLocationManager()
70
+ locationManager?.delegate = self
71
+ locationManager?.requestWhenInUseAuthorization()
72
+ // Check location permission on view load
73
+ checkLocationPermission()
62
74
  }
63
75
 
64
76
  private func updateBottomButtonState() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-mytatva-rn-sdk",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "a package to inject data into visit health pwa",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",