@convep_mobilogy/react-native-qms-plugin 0.9.1 → 0.9.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.
@@ -75,7 +75,7 @@ dependencies {
75
75
  implementation "com.facebook.react:react-android"
76
76
  implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
77
77
  implementation 'com.facebook.react:react-native:+'
78
- implementation "com.convep.qms:qms-plugin:1.9.8"
78
+ implementation "com.convep.qms:qms-plugin:1.9.15"
79
79
  implementation 'androidx.appcompat:appcompat:1.6.1'
80
80
 
81
81
  implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
@@ -6,43 +6,75 @@
6
6
  @interface QmsDashboardView : UIView
7
7
  @property (nonatomic, strong) UIViewController *dashboardVC;
8
8
  @property (nonatomic, assign) BOOL didSetupVC;
9
- // New props
9
+
10
10
  @property (nonatomic, copy) NSString *ClientID;
11
11
  @property (nonatomic, copy) NSString *ClientCode;
12
12
  @property (nonatomic, copy) NSString *user_token;
13
+
14
+ @property (nonatomic, copy) RCTDirectEventBlock onClose;
13
15
  @end
14
16
 
15
17
  @implementation QmsDashboardView
16
18
 
17
19
  - (instancetype)initWithFrame:(CGRect)frame {
18
20
  if (self = [super initWithFrame:frame]) {
19
- _dashboardVC = [QmsPluginUI makeViewController];
21
+ _dashboardVC = [QmsPluginUI makeViewController];
20
22
  _didSetupVC = NO;
21
23
  _dashboardVC.view.backgroundColor = [UIColor whiteColor];
24
+
25
+ // Listen for native dashboard close notification
26
+ [[NSNotificationCenter defaultCenter] addObserver:self
27
+ selector:@selector(handleDashboardClose:)
28
+ name:@"QmsDashboardDidCloseNotification"
29
+ object:nil];
22
30
  }
23
31
  return self;
24
32
  }
25
33
 
26
34
  - (void)didMoveToWindow {
27
- [super didMoveToWindow];
28
- if (self.window && !_didSetupVC) {
29
- UIViewController *parentVC = [UIApplication sharedApplication].keyWindow.rootViewController;
30
- if (parentVC) {
31
- [parentVC addChildViewController:_dashboardVC];
32
- _dashboardVC.view.frame = parentVC.view.bounds;
33
- _dashboardVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
34
- [parentVC.view addSubview:_dashboardVC.view];
35
- [_dashboardVC didMoveToParentViewController:parentVC];
36
- _didSetupVC = YES;
37
-
38
- // Forward props once the VC is added
39
- [self forwardPropsToVC];
35
+ [super didMoveToWindow];
36
+ if (self.window && !_didSetupVC) {
37
+ UIViewController *parentVC = [UIApplication sharedApplication].keyWindow.rootViewController;
38
+ if (parentVC) {
39
+
40
+ // 1️⃣ create VC with props
41
+ _dashboardVC = [QmsPluginUI makeViewController];
42
+
43
+ [parentVC addChildViewController:_dashboardVC];
44
+ _dashboardVC.view.frame = parentVC.view.bounds;
45
+ _dashboardVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
46
+ [parentVC.view addSubview:_dashboardVC.view];
47
+ [_dashboardVC didMoveToParentViewController:parentVC];
48
+ _didSetupVC = YES;
49
+
50
+ // 2️⃣ forward props again if needed
51
+ [self forwardPropsToVC];
52
+ }
40
53
  }
41
- }
42
54
  }
43
55
 
44
- #pragma mark - Prop Setters
56
+ - (void)handleDashboardClose:(NSNotification *)note {
57
+ // 1️⃣ Notify JS
58
+ if (self.onClose) {
59
+ self.onClose(@{});
60
+ }
61
+
62
+ // 2️⃣ Clean up the native view controller
63
+ [self cleanupDashboard];
64
+ }
45
65
 
66
+ - (void)cleanupDashboard {
67
+ if (!_dashboardVC) return;
68
+
69
+ [_dashboardVC willMoveToParentViewController:nil];
70
+ [_dashboardVC.view removeFromSuperview];
71
+ [_dashboardVC removeFromParentViewController];
72
+
73
+ _dashboardVC = nil;
74
+ _didSetupVC = NO;
75
+ }
76
+
77
+ #pragma mark - Prop Setters
46
78
  - (void)setClientID:(NSString *)ClientID {
47
79
  _ClientID = [ClientID copy];
48
80
  [self forwardProp:@"ClientID" value:_ClientID];
@@ -59,7 +91,6 @@
59
91
  }
60
92
 
61
93
  #pragma mark - Forward Props via KVC
62
-
63
94
  - (void)forwardProp:(NSString *)key value:(NSString *)value {
64
95
  if (_dashboardVC && [_dashboardVC respondsToSelector:NSSelectorFromString(key)]) {
65
96
  @try {
@@ -76,6 +107,11 @@
76
107
  [self forwardProp:@"user_token" value:_user_token];
77
108
  }
78
109
 
110
+ - (void)removeFromSuperview {
111
+ [self cleanupDashboard];
112
+ [super removeFromSuperview];
113
+ }
114
+
79
115
  @end
80
116
 
81
117
  @interface QmsDashboardViewManager : RCTViewManager
@@ -69,6 +69,7 @@ RCT_EXPORT_MODULE()
69
69
  });
70
70
  }
71
71
 
72
+
72
73
  // TurboModule boilerplate
73
74
  - (std::shared_ptr<facebook::react::TurboModule>)getTurboModule:
74
75
  (const facebook::react::ObjCTurboModule::InitParams &)params
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>QmsPluginFramework.framework/QmsPluginFramework</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_x86_64-simulator</string>
11
+ <string>ios-arm64</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>QmsPluginFramework.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
- <string>x86_64</string>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>QmsPluginFramework.framework/QmsPluginFramework</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>QmsPluginFramework.framework</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@convep_mobilogy/react-native-qms-plugin",
3
- "version": "0.9.1",
3
+ "version": "0.9.2",
4
4
  "description": "To handle defect managment",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",