@convep_mobilogy/react-native-qms-plugin 0.3.0 → 0.4.0
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/android/build.gradle +20 -7
- package/android/libs/{qmsplugin-release.aar → Qms_plugin-release.aar} +0 -0
- package/android/src/main/java/com/qmsplugin/QmsPluginModule.kt +12 -25
- package/android/src/main/java/com/qmsplugin/QmsPluginPackage.kt +7 -6
- package/ios/QmsPlugin/QmsDashboardViewManager.mm +49 -3
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Info.plist +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/_CodeSignature/CodeResources +3 -3
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/Assets.car +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/Info.plist +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/_CodeSignature/CodeResources +3 -3
- package/lib/module/QmsDashboardView.android.js +29 -0
- package/lib/module/QmsDashboardView.android.js.map +1 -0
- package/lib/module/QmsDashboardView.ios.js +13 -0
- package/lib/module/QmsDashboardView.ios.js.map +1 -0
- package/lib/module/QmsDashboardView.js +36 -7
- package/lib/module/QmsDashboardView.js.map +1 -1
- package/lib/module/QmsDashboardView.types.js +4 -0
- package/lib/module/QmsDashboardView.types.js.map +1 -0
- package/lib/module/index.js +1 -32
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/src/QmsDashboardView.android.d.ts +4 -0
- package/lib/typescript/src/QmsDashboardView.android.d.ts.map +1 -0
- package/lib/typescript/src/QmsDashboardView.d.ts +4 -0
- package/lib/typescript/src/QmsDashboardView.d.ts.map +1 -1
- package/lib/typescript/src/QmsDashboardView.ios.d.ts +4 -0
- package/lib/typescript/src/QmsDashboardView.ios.d.ts.map +1 -0
- package/lib/typescript/src/QmsDashboardView.types.d.ts +9 -0
- package/lib/typescript/src/QmsDashboardView.types.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/QmsDashboardView.android.tsx +32 -0
- package/src/QmsDashboardView.ios.tsx +11 -0
- package/src/QmsDashboardView.tsx +64 -8
- package/src/QmsDashboardView.types.ts +9 -0
- package/src/index.tsx +1 -32
package/android/build.gradle
CHANGED
|
@@ -75,12 +75,25 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
75
75
|
dependencies {
|
|
76
76
|
implementation "com.facebook.react:react-android"
|
|
77
77
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
78
|
-
|
|
79
|
-
implementation files('libs/
|
|
80
|
-
implementation
|
|
81
|
-
|
|
82
|
-
implementation
|
|
83
|
-
|
|
84
|
-
|
|
78
|
+
implementation 'com.facebook.react:react-native:+'
|
|
79
|
+
implementation files('libs/Qms_plugin-release.aar')
|
|
80
|
+
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
81
|
+
|
|
82
|
+
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
|
83
|
+
implementation 'com.google.android.material:material:1.9.0'
|
|
84
|
+
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
|
|
85
|
+
implementation 'com.kizitonwose.calendar:view:2.3.0'
|
|
86
|
+
|
|
87
|
+
// ensure AndroidX Activity and AppCompat (EdgeToEdge lives in activity artifact)
|
|
88
|
+
implementation 'androidx.activity:activity:1.9.0'
|
|
89
|
+
implementation 'androidx.activity:activity-ktx:1.9.0'
|
|
90
|
+
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
91
|
+
implementation 'androidx.core:core-ktx:1.12.0'
|
|
92
|
+
|
|
93
|
+
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
|
|
94
|
+
implementation 'com.squareup.okhttp3:okhttp:4.11.0'
|
|
95
|
+
implementation 'com.squareup.retrofit2:converter-gson:2.9.0'
|
|
96
|
+
implementation 'com.github.bumptech.glide:glide:4.15.1'
|
|
97
|
+
implementation 'com.squareup.okhttp3:logging-interceptor:4.12.0'
|
|
85
98
|
|
|
86
99
|
}
|
|
Binary file
|
|
@@ -3,36 +3,23 @@ package com.qmsplugin
|
|
|
3
3
|
|
|
4
4
|
import android.content.Intent
|
|
5
5
|
import com.facebook.react.bridge.*
|
|
6
|
-
import com.convep.qmsplugin.
|
|
7
|
-
import com.convep.qmsplugin.dashboard.QmsDashboardActivity
|
|
6
|
+
// import com.convep.qmsplugin.dashboard.QmsDashboardActivity
|
|
8
7
|
|
|
9
8
|
class QmsPluginModule(private val ctx: ReactApplicationContext)
|
|
10
9
|
: ReactContextBaseJavaModule(ctx) {
|
|
11
10
|
|
|
12
11
|
override fun getName() = "QmsPlugin"
|
|
13
12
|
|
|
14
|
-
@ReactMethod
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
@ReactMethod
|
|
27
|
-
fun openDashboard(promise: Promise) {
|
|
28
|
-
try {
|
|
29
|
-
val intent = Intent(reactApplicationContext, QmsDashboardActivity::class.java)
|
|
30
|
-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
31
|
-
reactApplicationContext.startActivity(intent)
|
|
32
|
-
promise.resolve(true)
|
|
33
|
-
} catch (e: Exception) {
|
|
34
|
-
promise.reject("QMS_OPEN_DASHBOARD_FAIL", e)
|
|
35
|
-
}
|
|
36
|
-
}
|
|
13
|
+
// @ReactMethod
|
|
14
|
+
// fun openDashboard(promise: Promise) {
|
|
15
|
+
// try {
|
|
16
|
+
// val intent = Intent(reactApplicationContext, QmsDashboardActivity::class.java)
|
|
17
|
+
// intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
|
18
|
+
// reactApplicationContext.startActivity(intent)
|
|
19
|
+
// promise.resolve(true)
|
|
20
|
+
// } catch (e: Exception) {
|
|
21
|
+
// promise.reject("QMS_OPEN_DASHBOARD_FAIL", e)
|
|
22
|
+
// }
|
|
23
|
+
// }
|
|
37
24
|
|
|
38
25
|
}
|
|
@@ -4,13 +4,14 @@ import com.facebook.react.ReactPackage
|
|
|
4
4
|
import com.facebook.react.bridge.NativeModule
|
|
5
5
|
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
6
|
import com.facebook.react.uimanager.ViewManager
|
|
7
|
-
import com.
|
|
7
|
+
import com.example.qms.QmsModule
|
|
8
8
|
|
|
9
9
|
class QmsPluginPackage : ReactPackage {
|
|
10
|
-
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule>
|
|
11
|
-
listOf(
|
|
12
|
-
|
|
13
|
-
override fun createViewManagers(reactContext: ReactApplicationContext)
|
|
14
|
-
= listOf<com.facebook.react.uimanager.ViewManager<*, *>>(QmsDashboardManager())
|
|
10
|
+
override fun createNativeModules(reactContext: ReactApplicationContext): List<NativeModule> {
|
|
11
|
+
return listOf(QmsModule(reactContext))
|
|
12
|
+
}
|
|
15
13
|
|
|
14
|
+
override fun createViewManagers(reactContext: ReactApplicationContext): List<ViewManager<*, *>> {
|
|
15
|
+
return emptyList()
|
|
16
|
+
}
|
|
16
17
|
}
|
|
@@ -5,6 +5,10 @@
|
|
|
5
5
|
@interface QmsDashboardView : UIView
|
|
6
6
|
@property (nonatomic, strong) UIViewController *dashboardVC;
|
|
7
7
|
@property (nonatomic, assign) BOOL didSetupVC;
|
|
8
|
+
// New props
|
|
9
|
+
@property (nonatomic, copy) NSString *ClientID;
|
|
10
|
+
@property (nonatomic, copy) NSString *ClientCode;
|
|
11
|
+
@property (nonatomic, copy) NSString *user_token;
|
|
8
12
|
@end
|
|
9
13
|
|
|
10
14
|
@implementation QmsDashboardView
|
|
@@ -24,17 +28,54 @@
|
|
|
24
28
|
UIViewController *parentVC = [UIApplication sharedApplication].keyWindow.rootViewController;
|
|
25
29
|
if (parentVC) {
|
|
26
30
|
[parentVC addChildViewController:_dashboardVC];
|
|
27
|
-
_dashboardVC.view.frame = parentVC.view.bounds;
|
|
31
|
+
_dashboardVC.view.frame = parentVC.view.bounds;
|
|
28
32
|
_dashboardVC.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
|
|
29
|
-
[parentVC.view addSubview:_dashboardVC.view];
|
|
33
|
+
[parentVC.view addSubview:_dashboardVC.view];
|
|
30
34
|
[_dashboardVC didMoveToParentViewController:parentVC];
|
|
31
35
|
_didSetupVC = YES;
|
|
36
|
+
|
|
37
|
+
// Forward props once the VC is added
|
|
38
|
+
[self forwardPropsToVC];
|
|
32
39
|
}
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
|
|
36
|
-
|
|
43
|
+
#pragma mark - Prop Setters
|
|
44
|
+
|
|
45
|
+
- (void)setClientID:(NSString *)ClientID {
|
|
46
|
+
_ClientID = [ClientID copy];
|
|
47
|
+
[self forwardProp:@"ClientID" value:_ClientID];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
- (void)setClientCode:(NSString *)ClientCode {
|
|
51
|
+
_ClientCode = [ClientCode copy];
|
|
52
|
+
[self forwardProp:@"ClientCode" value:_ClientCode];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
- (void)setUser_token:(NSString *)user_token {
|
|
56
|
+
_user_token = [user_token copy];
|
|
57
|
+
[self forwardProp:@"user_token" value:_user_token];
|
|
58
|
+
}
|
|
37
59
|
|
|
60
|
+
#pragma mark - Forward Props via KVC
|
|
61
|
+
|
|
62
|
+
- (void)forwardProp:(NSString *)key value:(NSString *)value {
|
|
63
|
+
if (_dashboardVC && [_dashboardVC respondsToSelector:NSSelectorFromString(key)]) {
|
|
64
|
+
@try {
|
|
65
|
+
[_dashboardVC setValue:value forKey:key];
|
|
66
|
+
} @catch (NSException *exception) {
|
|
67
|
+
NSLog(@"⚠️ Failed to set %@ on dashboardVC: %@", key, exception);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (void)forwardPropsToVC {
|
|
73
|
+
[self forwardProp:@"ClientID" value:_ClientID];
|
|
74
|
+
[self forwardProp:@"ClientCode" value:_ClientCode];
|
|
75
|
+
[self forwardProp:@"user_token" value:_user_token];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@end
|
|
38
79
|
|
|
39
80
|
@interface QmsDashboardViewManager : RCTViewManager
|
|
40
81
|
@end
|
|
@@ -47,4 +88,9 @@ RCT_EXPORT_MODULE(QmsDashboardView)
|
|
|
47
88
|
return [[QmsDashboardView alloc] init];
|
|
48
89
|
}
|
|
49
90
|
|
|
91
|
+
// ✅ Export the props so JS can pass values
|
|
92
|
+
RCT_EXPORT_VIEW_PROPERTY(ClientID, NSString)
|
|
93
|
+
RCT_EXPORT_VIEW_PROPERTY(ClientCode, NSString)
|
|
94
|
+
RCT_EXPORT_VIEW_PROPERTY(user_token, NSString)
|
|
95
|
+
|
|
50
96
|
@end
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car
CHANGED
|
Binary file
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Info.plist
CHANGED
|
Binary file
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework
CHANGED
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Assets.car</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
mDeq0E4lblXfFuIgkojjE5zY6hk=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</data>
|
|
19
19
|
<key>Info.plist</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
/JZsUWwwr7A+ZF0o001HQXRnzpI=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/module.modulemap</key>
|
|
24
24
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
0+eonZqFOeyimWUH94CuUhfXNEulhfi9YeuUE/wnX0s=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Assets.car</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
mDeq0E4lblXfFuIgkojjE5zY6hk=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
</data>
|
|
19
19
|
<key>Info.plist</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
4pQwOIuYwsUH4Iiw1M402s3Ii8Y=
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/module.modulemap</key>
|
|
24
24
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
0+eonZqFOeyimWUH94CuUhfXNEulhfi9YeuUE/wnX0s=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { View, NativeModules } from 'react-native';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const {
|
|
7
|
+
QmsModule
|
|
8
|
+
} = NativeModules;
|
|
9
|
+
export const QmsDashboardView = ({
|
|
10
|
+
style,
|
|
11
|
+
ClientID,
|
|
12
|
+
ClientCode,
|
|
13
|
+
user_token,
|
|
14
|
+
autoShow = true
|
|
15
|
+
}) => {
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (autoShow && QmsModule?.showQms) {
|
|
18
|
+
// map props to native method args
|
|
19
|
+
QmsModule.showQms(user_token, ClientID, ClientCode);
|
|
20
|
+
}
|
|
21
|
+
}, [ClientID, ClientCode, user_token, autoShow]);
|
|
22
|
+
|
|
23
|
+
// Android doesn’t need to show native UI as a "view" here,
|
|
24
|
+
// we just render an empty container so JSX stays consistent.
|
|
25
|
+
return /*#__PURE__*/_jsx(View, {
|
|
26
|
+
style: style
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=QmsDashboardView.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useEffect","View","NativeModules","jsx","_jsx","QmsModule","QmsDashboardView","style","ClientID","ClientCode","user_token","autoShow","showQms"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,IAAI,EAAEC,aAAa,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGnD,MAAM;EAAEC;AAAU,CAAC,GAAGH,aAQrB;AAED,OAAO,MAAMI,gBAAiD,GAAGA,CAAC;EAChEC,KAAK;EACLC,QAAQ;EACRC,UAAU;EACVC,UAAU;EACVC,QAAQ,GAAG;AACb,CAAC,KAAK;EACJX,SAAS,CAAC,MAAM;IACd,IAAIW,QAAQ,IAAIN,SAAS,EAAEO,OAAO,EAAE;MAClC;MACAP,SAAS,CAACO,OAAO,CAACF,UAAU,EAAEF,QAAQ,EAAEC,UAAU,CAAC;IACrD;EACF,CAAC,EAAE,CAACD,QAAQ,EAAEC,UAAU,EAAEC,UAAU,EAAEC,QAAQ,CAAC,CAAC;;EAEhD;EACA;EACA,oBAAOP,IAAA,CAACH,IAAI;IAACM,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC/B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { requireNativeComponent } from 'react-native';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
// Make sure your iOS native view manager is exported as "QmsDashboardView"
|
|
7
|
+
const NativeQmsDashboardView = requireNativeComponent('QmsDashboardView');
|
|
8
|
+
export const QmsDashboardView = props => {
|
|
9
|
+
return /*#__PURE__*/_jsx(NativeQmsDashboardView, {
|
|
10
|
+
...props
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=QmsDashboardView.ios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,sBAAsB,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtD;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,oBAAOH,IAAA,CAACC,sBAAsB;IAAA,GAAKE;EAAK,CAAG,CAAC;AAC9C,CAAC","ignoreList":[]}
|
|
@@ -1,13 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import { requireNativeComponent, Platform } from 'react-native';
|
|
3
|
+
import React, { useEffect } from 'react';
|
|
4
|
+
import { NativeModules, Platform, requireNativeComponent, View } from 'react-native';
|
|
6
5
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const {
|
|
7
|
+
QmsModule
|
|
8
|
+
} = NativeModules;
|
|
9
|
+
|
|
10
|
+
// Only resolve the native view on iOS to avoid runtime errors on Android
|
|
11
|
+
const NativeQmsDashboardView = Platform.OS === 'ios' ? requireNativeComponent('QmsDashboardView') : null;
|
|
12
|
+
export const showQms = (token, clientID, clientCode) => {
|
|
13
|
+
QmsModule?.showQms?.(token, clientID, clientCode);
|
|
14
|
+
};
|
|
15
|
+
export const QmsDashboardView = ({
|
|
16
|
+
style,
|
|
17
|
+
clientID = '',
|
|
18
|
+
clientCode = '',
|
|
19
|
+
user_token,
|
|
20
|
+
token,
|
|
21
|
+
userToken,
|
|
22
|
+
autoShow = true
|
|
23
|
+
}) => {
|
|
24
|
+
const effectiveToken = user_token ?? token ?? userToken ?? '';
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (Platform.OS === 'android' && autoShow) {
|
|
27
|
+
QmsModule?.showQms?.(effectiveToken, clientID, clientCode);
|
|
28
|
+
}
|
|
29
|
+
}, [effectiveToken, clientID, clientCode, autoShow]);
|
|
30
|
+
if (Platform.OS === 'ios') {
|
|
31
|
+
return NativeQmsDashboardView && /*#__PURE__*/_jsx(NativeQmsDashboardView, {
|
|
32
|
+
style: style,
|
|
33
|
+
ClientID: clientID,
|
|
34
|
+
ClientCode: clientCode,
|
|
35
|
+
user_token: effectiveToken
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return /*#__PURE__*/_jsx(View, {
|
|
39
|
+
style: style
|
|
11
40
|
});
|
|
12
41
|
};
|
|
13
42
|
//# sourceMappingURL=QmsDashboardView.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","
|
|
1
|
+
{"version":3,"names":["React","useEffect","NativeModules","Platform","requireNativeComponent","View","jsx","_jsx","QmsModule","NativeQmsDashboardView","OS","showQms","token","clientID","clientCode","QmsDashboardView","style","user_token","userToken","autoShow","effectiveToken","ClientID","ClientCode"],"sourceRoot":"../../src","sources":["QmsDashboardView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,aAAa,EACbC,QAAQ,EACRC,sBAAsB,EACtBC,IAAI,QACC,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAqBtB,MAAM;EAAEC;AAAU,CAAC,GAAGN,aAAa;;AAEnC;AACA,MAAMO,sBAAsB,GAC1BN,QAAQ,CAACO,EAAE,KAAK,KAAK,GACjBN,sBAAsB,CAAW,kBAAkB,CAAC,GACpD,IAAI;AAEV,OAAO,MAAMO,OAAO,GAAGA,CACrBC,KAAc,EACdC,QAAiB,EACjBC,UAAmB,KAChB;EACHN,SAAS,EAAEG,OAAO,GAAGC,KAAK,EAAEC,QAAQ,EAAEC,UAAU,CAAC;AACnD,CAAC;AAED,OAAO,MAAMC,gBAA6C,GAAGA,CAAC;EAC5DC,KAAK;EACLH,QAAQ,GAAG,EAAE;EACbC,UAAU,GAAG,EAAE;EACfG,UAAU;EACVL,KAAK;EACLM,SAAS;EACTC,QAAQ,GAAG;AACb,CAAC,KAAK;EACJ,MAAMC,cAAc,GAAGH,UAAU,IAAIL,KAAK,IAAIM,SAAS,IAAI,EAAE;EAE7DjB,SAAS,CAAC,MAAM;IACd,IAAIE,QAAQ,CAACO,EAAE,KAAK,SAAS,IAAIS,QAAQ,EAAE;MACzCX,SAAS,EAAEG,OAAO,GAAGS,cAAc,EAAEP,QAAQ,EAAEC,UAAU,CAAC;IAC5D;EACF,CAAC,EAAE,CAACM,cAAc,EAAEP,QAAQ,EAAEC,UAAU,EAAEK,QAAQ,CAAC,CAAC;EAEpD,IAAIhB,QAAQ,CAACO,EAAE,KAAK,KAAK,EAAE;IACzB,OACED,sBAAsB,iBACpBF,IAAA,CAACE,sBAAsB;MACrBO,KAAK,EAAEA,KAAM;MACbK,QAAQ,EAAER,QAAS;MACnBS,UAAU,EAAER,UAAW;MACvBG,UAAU,EAAEG;IAAe,CAC5B,CACF;EAEL;EAEA,oBAAOb,IAAA,CAACF,IAAI;IAACW,KAAK,EAAEA;EAAM,CAAE,CAAC;AAC/B,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["QmsDashboardView.types.ts"],"mappings":"","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
// type Native = {
|
|
6
|
-
// openDashboard(): Promise<boolean>;
|
|
7
|
-
// };
|
|
8
|
-
|
|
9
|
-
// const { QmsPlugin } = NativeModules as { QmsPlugin?: Native };
|
|
10
|
-
|
|
11
|
-
// if (Platform.OS === 'android' && !QmsPlugin) {
|
|
12
|
-
// throw new Error(
|
|
13
|
-
// 'QmsPlugin native module not found. Did autolinking fail? Make sure android builds and the package name is com.convep.qmsplugin.'
|
|
14
|
-
// );
|
|
15
|
-
// }
|
|
16
|
-
|
|
17
|
-
// export { default as QmsPluginDashboard } from './QmsPluginDashboard';
|
|
18
|
-
// export type { QmsPluginDashboardProps } from './QmsPluginDashboard';
|
|
19
|
-
// export default {
|
|
20
|
-
// // Keep your methods too if you like
|
|
21
|
-
// openDashboard: () => (NativeModules as any).QmsPlugin.openDashboard?.(),
|
|
22
|
-
// };
|
|
23
|
-
//log
|
|
24
|
-
|
|
25
|
-
import QmsPlugin from "./NativeQmsPlugin.js";
|
|
26
|
-
export { QmsDashboardView } from "./QmsDashboardView.js";
|
|
27
|
-
export function showPluginUI() {
|
|
28
|
-
QmsPlugin.showPluginUI();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// export default {
|
|
32
|
-
// showPluginUI,
|
|
33
|
-
// QmsDashboardView,
|
|
34
|
-
// };
|
|
3
|
+
export { QmsDashboardView } from './QmsDashboardView';
|
|
35
4
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["QmsDashboardView"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,QAAQ,oBAAoB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.android.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.android.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAYtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAiB5D,CAAC"}
|
|
@@ -4,7 +4,11 @@ export type QmsDashboardProps = {
|
|
|
4
4
|
style?: ViewStyle;
|
|
5
5
|
clientID?: string;
|
|
6
6
|
clientCode?: string;
|
|
7
|
+
user_token?: string;
|
|
8
|
+
token?: string;
|
|
7
9
|
userToken?: string;
|
|
10
|
+
autoShow?: boolean;
|
|
8
11
|
};
|
|
12
|
+
export declare const showQms: (token?: string, clientID?: string, clientCode?: string) => void;
|
|
9
13
|
export declare const QmsDashboardView: React.FC<QmsDashboardProps>;
|
|
10
14
|
//# sourceMappingURL=QmsDashboardView.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QmsDashboardView.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAOzC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAS9C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAUF,eAAO,MAAM,OAAO,WACV,MAAM,aACH,MAAM,eACJ,MAAM,SAGpB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+BxD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAE5D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
export type QmsDashboardViewProps = {
|
|
3
|
+
style?: StyleProp<ViewStyle>;
|
|
4
|
+
ClientID?: string;
|
|
5
|
+
ClientCode?: string;
|
|
6
|
+
user_token?: string;
|
|
7
|
+
autoShow?: boolean;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=QmsDashboardView.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.types.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,YAAY,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { View, NativeModules } from 'react-native';
|
|
3
|
+
import type { QmsDashboardViewProps } from './QmsDashboardView.types';
|
|
4
|
+
|
|
5
|
+
const { QmsModule } = NativeModules as {
|
|
6
|
+
QmsModule?: {
|
|
7
|
+
showQms?: (
|
|
8
|
+
userToken?: string,
|
|
9
|
+
clientID?: string,
|
|
10
|
+
clientCode?: string
|
|
11
|
+
) => void;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
16
|
+
style,
|
|
17
|
+
ClientID,
|
|
18
|
+
ClientCode,
|
|
19
|
+
user_token,
|
|
20
|
+
autoShow = true,
|
|
21
|
+
}) => {
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (autoShow && QmsModule?.showQms) {
|
|
24
|
+
// map props to native method args
|
|
25
|
+
QmsModule.showQms(user_token, ClientID, ClientCode);
|
|
26
|
+
}
|
|
27
|
+
}, [ClientID, ClientCode, user_token, autoShow]);
|
|
28
|
+
|
|
29
|
+
// Android doesn’t need to show native UI as a "view" here,
|
|
30
|
+
// we just render an empty container so JSX stays consistent.
|
|
31
|
+
return <View style={style} />;
|
|
32
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { requireNativeComponent } from 'react-native';
|
|
3
|
+
import type { QmsDashboardViewProps } from './QmsDashboardView.types';
|
|
4
|
+
|
|
5
|
+
// Make sure your iOS native view manager is exported as "QmsDashboardView"
|
|
6
|
+
const NativeQmsDashboardView =
|
|
7
|
+
requireNativeComponent<QmsDashboardViewProps>('QmsDashboardView');
|
|
8
|
+
|
|
9
|
+
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
|
|
10
|
+
return <NativeQmsDashboardView {...props} />;
|
|
11
|
+
};
|
package/src/QmsDashboardView.tsx
CHANGED
|
@@ -1,19 +1,75 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
NativeModules,
|
|
4
|
+
Platform,
|
|
5
|
+
requireNativeComponent,
|
|
6
|
+
View,
|
|
7
|
+
} from 'react-native';
|
|
4
8
|
import type { ViewStyle } from 'react-native';
|
|
5
9
|
|
|
10
|
+
type IOSProps = {
|
|
11
|
+
style?: ViewStyle;
|
|
12
|
+
ClientID?: string;
|
|
13
|
+
ClientCode?: string;
|
|
14
|
+
user_token?: string;
|
|
15
|
+
};
|
|
16
|
+
|
|
6
17
|
export type QmsDashboardProps = {
|
|
7
18
|
style?: ViewStyle;
|
|
8
19
|
clientID?: string;
|
|
9
20
|
clientCode?: string;
|
|
21
|
+
// prefer snake_case to match native expectation; keep others for compatibility
|
|
22
|
+
user_token?: string;
|
|
23
|
+
token?: string;
|
|
10
24
|
userToken?: string;
|
|
25
|
+
autoShow?: boolean;
|
|
11
26
|
};
|
|
12
27
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
28
|
+
const { QmsModule } = NativeModules;
|
|
29
|
+
|
|
30
|
+
// Only resolve the native view on iOS to avoid runtime errors on Android
|
|
31
|
+
const NativeQmsDashboardView =
|
|
32
|
+
Platform.OS === 'ios'
|
|
33
|
+
? requireNativeComponent<IOSProps>('QmsDashboardView')
|
|
34
|
+
: null;
|
|
35
|
+
|
|
36
|
+
export const showQms = (
|
|
37
|
+
token?: string,
|
|
38
|
+
clientID?: string,
|
|
39
|
+
clientCode?: string
|
|
40
|
+
) => {
|
|
41
|
+
QmsModule?.showQms?.(token, clientID, clientCode);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export const QmsDashboardView: React.FC<QmsDashboardProps> = ({
|
|
45
|
+
style,
|
|
46
|
+
clientID = '',
|
|
47
|
+
clientCode = '',
|
|
48
|
+
user_token,
|
|
49
|
+
token,
|
|
50
|
+
userToken,
|
|
51
|
+
autoShow = true,
|
|
52
|
+
}) => {
|
|
53
|
+
const effectiveToken = user_token ?? token ?? userToken ?? '';
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (Platform.OS === 'android' && autoShow) {
|
|
57
|
+
QmsModule?.showQms?.(effectiveToken, clientID, clientCode);
|
|
58
|
+
}
|
|
59
|
+
}, [effectiveToken, clientID, clientCode, autoShow]);
|
|
60
|
+
|
|
61
|
+
if (Platform.OS === 'ios') {
|
|
62
|
+
return (
|
|
63
|
+
NativeQmsDashboardView && (
|
|
64
|
+
<NativeQmsDashboardView
|
|
65
|
+
style={style}
|
|
66
|
+
ClientID={clientID}
|
|
67
|
+
ClientCode={clientCode}
|
|
68
|
+
user_token={effectiveToken}
|
|
69
|
+
/>
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
}
|
|
16
73
|
|
|
17
|
-
|
|
18
|
-
return <NativeQmsDashboardView {...props} />;
|
|
74
|
+
return <View style={style} />;
|
|
19
75
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type QmsDashboardViewProps = {
|
|
4
|
+
style?: StyleProp<ViewStyle>;
|
|
5
|
+
ClientID?: string;
|
|
6
|
+
ClientCode?: string;
|
|
7
|
+
user_token?: string;
|
|
8
|
+
autoShow?: boolean; // optional: Android uses this, iOS can ignore
|
|
9
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
// import { NativeModules, Platform } from 'react-native';
|
|
2
|
-
|
|
3
|
-
// type Native = {
|
|
4
|
-
// openDashboard(): Promise<boolean>;
|
|
5
|
-
// };
|
|
6
|
-
|
|
7
|
-
// const { QmsPlugin } = NativeModules as { QmsPlugin?: Native };
|
|
8
|
-
|
|
9
|
-
// if (Platform.OS === 'android' && !QmsPlugin) {
|
|
10
|
-
// throw new Error(
|
|
11
|
-
// 'QmsPlugin native module not found. Did autolinking fail? Make sure android builds and the package name is com.convep.qmsplugin.'
|
|
12
|
-
// );
|
|
13
|
-
// }
|
|
14
|
-
|
|
15
|
-
// export { default as QmsPluginDashboard } from './QmsPluginDashboard';
|
|
16
|
-
// export type { QmsPluginDashboardProps } from './QmsPluginDashboard';
|
|
17
|
-
// export default {
|
|
18
|
-
// // Keep your methods too if you like
|
|
19
|
-
// openDashboard: () => (NativeModules as any).QmsPlugin.openDashboard?.(),
|
|
20
|
-
// };
|
|
21
|
-
//log
|
|
22
|
-
|
|
23
|
-
import QmsPlugin from './NativeQmsPlugin';
|
|
24
1
|
export { QmsDashboardView } from './QmsDashboardView';
|
|
25
|
-
|
|
26
|
-
export function showPluginUI(): void {
|
|
27
|
-
QmsPlugin.showPluginUI();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// export default {
|
|
31
|
-
// showPluginUI,
|
|
32
|
-
// QmsDashboardView,
|
|
33
|
-
// };
|
|
2
|
+
export type { QmsDashboardViewProps } from './QmsDashboardView.types';
|