@convep_mobilogy/react-native-qms-plugin 0.9.4 → 0.10.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 +1 -1
- package/ios/QmsPlugin/QmsDashboardViewManager.mm +31 -0
- package/ios/QmsPluginFramework.xcframework/Info.plist +5 -5
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
- 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/QmsPluginFramework +0 -0
- package/ios/QmsPluginFramework.xcframework/ios-arm64_x86_64-simulator/QmsPluginFramework.framework/_CodeSignature/CodeResources +2 -2
- package/lib/module/QmsDashboardView.android.js +45 -4
- package/lib/module/QmsDashboardView.android.js.map +1 -1
- package/lib/module/QmsDashboardView.ios.js +2 -0
- package/lib/module/QmsDashboardView.ios.js.map +1 -1
- package/lib/typescript/src/QmsDashboardView.android.d.ts.map +1 -1
- package/lib/typescript/src/QmsDashboardView.ios.d.ts.map +1 -1
- package/lib/typescript/src/QmsDashboardView.types.d.ts +7 -0
- package/lib/typescript/src/QmsDashboardView.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/QmsDashboardView.android.tsx +76 -3
- package/src/QmsDashboardView.ios.tsx +2 -0
- package/src/QmsDashboardView.types.ts +7 -0
package/android/build.gradle
CHANGED
|
@@ -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.11.
|
|
78
|
+
implementation "com.convep.qms:qms-plugin:1.11.25"
|
|
79
79
|
|
|
80
80
|
implementation 'androidx.appcompat:appcompat:1.6.1'
|
|
81
81
|
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
@property (nonatomic, copy) NSString *ClientID;
|
|
11
11
|
@property (nonatomic, copy) NSString *ClientCode;
|
|
12
12
|
@property (nonatomic, copy) NSString *user_token;
|
|
13
|
+
@property (nonatomic, copy) NSString *headerTextColor;
|
|
14
|
+
@property (nonatomic, copy) NSString *headerIconColor;
|
|
15
|
+
@property (nonatomic, copy) NSString *accentColor;
|
|
16
|
+
@property (nonatomic, copy) NSString *fontFamily;
|
|
13
17
|
|
|
14
18
|
@property (nonatomic, copy) RCTDirectEventBlock onClose;
|
|
15
19
|
@end
|
|
@@ -90,6 +94,25 @@
|
|
|
90
94
|
[self forwardProp:@"user_token" value:_user_token];
|
|
91
95
|
}
|
|
92
96
|
|
|
97
|
+
- (void)setHeaderTextColor:(NSString *)headerTextColor {
|
|
98
|
+
_headerTextColor = [headerTextColor copy];
|
|
99
|
+
[self forwardProp:@"headerTextColor" value:_headerTextColor];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
- (void)setHeaderIconColor:(NSString *)headerIconColor {
|
|
103
|
+
_headerIconColor = [headerIconColor copy];
|
|
104
|
+
[self forwardProp:@"headerIconColor" value:_headerIconColor];
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
- (void)setAccentColor:(NSString *)accentColor {
|
|
108
|
+
_accentColor = [accentColor copy];
|
|
109
|
+
[self forwardProp:@"accentColor" value:_accentColor];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
- (void)setFontFamily:(NSString *)fontFamily {
|
|
113
|
+
_fontFamily = [fontFamily copy];
|
|
114
|
+
[self forwardProp:@"fontFamily" value:_fontFamily];
|
|
115
|
+
}
|
|
93
116
|
#pragma mark - Forward Props via KVC
|
|
94
117
|
- (void)forwardProp:(NSString *)key value:(NSString *)value {
|
|
95
118
|
if (_dashboardVC && [_dashboardVC respondsToSelector:NSSelectorFromString(key)]) {
|
|
@@ -105,6 +128,10 @@
|
|
|
105
128
|
[self forwardProp:@"ClientID" value:_ClientID];
|
|
106
129
|
[self forwardProp:@"ClientCode" value:_ClientCode];
|
|
107
130
|
[self forwardProp:@"user_token" value:_user_token];
|
|
131
|
+
[self forwardProp:@"headerTextColor" value:_headerTextColor];
|
|
132
|
+
[self forwardProp:@"headerIconColor" value:_headerIconColor];
|
|
133
|
+
[self forwardProp:@"accentColor" value:_accentColor];
|
|
134
|
+
[self forwardProp:@"fontFamily" value:_fontFamily];
|
|
108
135
|
}
|
|
109
136
|
|
|
110
137
|
- (void)removeFromSuperview {
|
|
@@ -129,6 +156,10 @@ RCT_EXPORT_MODULE(QmsDashboardView)
|
|
|
129
156
|
RCT_EXPORT_VIEW_PROPERTY(ClientID, NSString)
|
|
130
157
|
RCT_EXPORT_VIEW_PROPERTY(ClientCode, NSString)
|
|
131
158
|
RCT_EXPORT_VIEW_PROPERTY(user_token, NSString)
|
|
159
|
+
RCT_EXPORT_VIEW_PROPERTY(headerTextColor, NSString)
|
|
160
|
+
RCT_EXPORT_VIEW_PROPERTY(headerIconColor, NSString)
|
|
161
|
+
RCT_EXPORT_VIEW_PROPERTY(accentColor, NSString)
|
|
162
|
+
RCT_EXPORT_VIEW_PROPERTY(fontFamily, NSString)
|
|
132
163
|
|
|
133
164
|
@end
|
|
134
165
|
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
11
|
+
<string>ios-arm64_x86_64-simulator</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>
|
|
17
18
|
</array>
|
|
18
19
|
<key>SupportedPlatform</key>
|
|
19
20
|
<string>ios</string>
|
|
21
|
+
<key>SupportedPlatformVariant</key>
|
|
22
|
+
<string>simulator</string>
|
|
20
23
|
</dict>
|
|
21
24
|
<dict>
|
|
22
25
|
<key>BinaryPath</key>
|
|
23
26
|
<string>QmsPluginFramework.framework/QmsPluginFramework</string>
|
|
24
27
|
<key>LibraryIdentifier</key>
|
|
25
|
-
<string>ios-
|
|
28
|
+
<string>ios-arm64</string>
|
|
26
29
|
<key>LibraryPath</key>
|
|
27
30
|
<string>QmsPluginFramework.framework</string>
|
|
28
31
|
<key>SupportedArchitectures</key>
|
|
29
32
|
<array>
|
|
30
33
|
<string>arm64</string>
|
|
31
|
-
<string>x86_64</string>
|
|
32
34
|
</array>
|
|
33
35
|
<key>SupportedPlatform</key>
|
|
34
36
|
<string>ios</string>
|
|
35
|
-
<key>SupportedPlatformVariant</key>
|
|
36
|
-
<string>simulator</string>
|
|
37
37
|
</dict>
|
|
38
38
|
</array>
|
|
39
39
|
<key>CFBundlePackageType</key>
|
package/ios/QmsPluginFramework.xcframework/ios-arm64/QmsPluginFramework.framework/Assets.car
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
|
+
1i2tuf6x04oClRQdI25h80iAWww=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Assets.car</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
1i2tuf6x04oClRQdI25h80iAWww=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Headers/QmsPlugin.h</key>
|
|
12
12
|
<data>
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
<dict>
|
|
32
32
|
<key>hash2</key>
|
|
33
33
|
<data>
|
|
34
|
-
|
|
34
|
+
1mZEAflZoNOaTXIhGRR7gPGBZ99fx2jFZ147Fkro4WM=
|
|
35
35
|
</data>
|
|
36
36
|
</dict>
|
|
37
37
|
<key>Headers/QmsPlugin.h</key>
|
|
@@ -9,6 +9,7 @@ const {
|
|
|
9
9
|
export const QmsDashboardView = ({
|
|
10
10
|
style,
|
|
11
11
|
onClose,
|
|
12
|
+
onLogout,
|
|
12
13
|
clientID,
|
|
13
14
|
clientCode,
|
|
14
15
|
ClientID,
|
|
@@ -17,30 +18,70 @@ export const QmsDashboardView = ({
|
|
|
17
18
|
token,
|
|
18
19
|
userToken,
|
|
19
20
|
autoShow = true,
|
|
20
|
-
themeColor
|
|
21
|
+
themeColor,
|
|
22
|
+
headerTextColor,
|
|
23
|
+
headerIconColor,
|
|
24
|
+
accentColor,
|
|
25
|
+
fontFamily,
|
|
26
|
+
isOrigin = false,
|
|
27
|
+
payload
|
|
21
28
|
}) => {
|
|
22
29
|
useEffect(() => {
|
|
23
30
|
const resolvedClientID = clientID ?? ClientID ?? '';
|
|
24
31
|
const resolvedClientCode = clientCode ?? ClientCode ?? '';
|
|
25
32
|
const resolvedToken = user_token ?? token ?? userToken ?? '';
|
|
33
|
+
const hasPayload = payload != null && Object.keys(payload).length > 0;
|
|
26
34
|
if (autoShow && QmsModule?.showQms) {
|
|
27
35
|
if (themeColor && QmsModule?.setPrimaryColor) {
|
|
28
36
|
QmsModule.setPrimaryColor(themeColor);
|
|
29
37
|
}
|
|
38
|
+
if (headerTextColor && QmsModule?.setHeaderTextColor) {
|
|
39
|
+
QmsModule.setHeaderTextColor(headerTextColor);
|
|
40
|
+
}
|
|
41
|
+
if (headerIconColor && QmsModule?.setHeaderIconColor) {
|
|
42
|
+
QmsModule.setHeaderIconColor(headerIconColor);
|
|
43
|
+
}
|
|
44
|
+
if (accentColor && QmsModule?.setAccentColor) {
|
|
45
|
+
QmsModule.setAccentColor(accentColor);
|
|
46
|
+
}
|
|
47
|
+
if (QmsModule?.setFontFamily) {
|
|
48
|
+
QmsModule.setFontFamily(fontFamily ?? '');
|
|
49
|
+
}
|
|
30
50
|
// map props to native method args
|
|
31
|
-
|
|
51
|
+
if (hasPayload && QmsModule?.showQmsWithPayload) {
|
|
52
|
+
QmsModule.showQmsWithPayload(resolvedToken, resolvedClientID, resolvedClientCode, isOrigin, payload);
|
|
53
|
+
} else {
|
|
54
|
+
QmsModule.showQms(resolvedToken, resolvedClientID, resolvedClientCode, isOrigin);
|
|
55
|
+
}
|
|
32
56
|
}
|
|
33
|
-
}, [clientID, clientCode, ClientID, ClientCode, user_token, token, userToken, autoShow, themeColor]);
|
|
57
|
+
}, [clientID, clientCode, ClientID, ClientCode, user_token, token, userToken, autoShow, themeColor, headerTextColor, headerIconColor, accentColor, fontFamily, isOrigin, payload]);
|
|
34
58
|
useEffect(() => {
|
|
35
59
|
if (themeColor && QmsModule?.setPrimaryColor) {
|
|
36
60
|
QmsModule.setPrimaryColor(themeColor);
|
|
37
61
|
}
|
|
38
|
-
|
|
62
|
+
if (headerTextColor && QmsModule?.setHeaderTextColor) {
|
|
63
|
+
QmsModule.setHeaderTextColor(headerTextColor);
|
|
64
|
+
}
|
|
65
|
+
if (headerIconColor && QmsModule?.setHeaderIconColor) {
|
|
66
|
+
QmsModule.setHeaderIconColor(headerIconColor);
|
|
67
|
+
}
|
|
68
|
+
if (accentColor && QmsModule?.setAccentColor) {
|
|
69
|
+
QmsModule.setAccentColor(accentColor);
|
|
70
|
+
}
|
|
71
|
+
if (QmsModule?.setFontFamily) {
|
|
72
|
+
QmsModule.setFontFamily(fontFamily ?? '');
|
|
73
|
+
}
|
|
74
|
+
}, [themeColor, headerTextColor, headerIconColor, accentColor, fontFamily]);
|
|
39
75
|
useEffect(() => {
|
|
40
76
|
if (!onClose) return;
|
|
41
77
|
const subscription = DeviceEventEmitter.addListener('QmsSdkOnClose', () => onClose());
|
|
42
78
|
return () => subscription.remove();
|
|
43
79
|
}, [onClose]);
|
|
80
|
+
useEffect(() => {
|
|
81
|
+
if (!onLogout) return;
|
|
82
|
+
const subscription = DeviceEventEmitter.addListener('QmsSdkOnLogout', () => onLogout());
|
|
83
|
+
return () => subscription.remove();
|
|
84
|
+
}, [onLogout]);
|
|
44
85
|
|
|
45
86
|
// Android doesn’t need to show native UI as a "view" here,
|
|
46
87
|
// we just render an empty container so JSX stays consistent.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","DeviceEventEmitter","NativeModules","View","jsx","_jsx","QmsModule","QmsDashboardView","style","onClose","clientID","clientCode","ClientID","ClientCode","user_token","token","userToken","autoShow","themeColor","resolvedClientID","resolvedClientCode","resolvedToken","showQms","setPrimaryColor","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SAASC,kBAAkB,EAAEC,aAAa,EAAEC,IAAI,QAAQ,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGvE,MAAM;EAAEC;AAAU,CAAC,GAAGJ,
|
|
1
|
+
{"version":3,"names":["React","useEffect","DeviceEventEmitter","NativeModules","View","jsx","_jsx","QmsModule","QmsDashboardView","style","onClose","onLogout","clientID","clientCode","ClientID","ClientCode","user_token","token","userToken","autoShow","themeColor","headerTextColor","headerIconColor","accentColor","fontFamily","isOrigin","payload","resolvedClientID","resolvedClientCode","resolvedToken","hasPayload","Object","keys","length","showQms","setPrimaryColor","setHeaderTextColor","setHeaderIconColor","setAccentColor","setFontFamily","showQmsWithPayload","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.android.tsx"],"mappings":"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","ignoreList":[]}
|
|
@@ -8,6 +8,7 @@ const NativeQmsDashboardView = requireNativeComponent('QmsDashboardView');
|
|
|
8
8
|
export const QmsDashboardView = props => {
|
|
9
9
|
const {
|
|
10
10
|
onClose,
|
|
11
|
+
// onLogout,
|
|
11
12
|
clientID,
|
|
12
13
|
clientCode,
|
|
13
14
|
ClientID,
|
|
@@ -15,6 +16,7 @@ export const QmsDashboardView = props => {
|
|
|
15
16
|
user_token,
|
|
16
17
|
userToken,
|
|
17
18
|
token,
|
|
19
|
+
// isOrigin,
|
|
18
20
|
// autoShow is Android-only; ignored on iOS
|
|
19
21
|
...rest
|
|
20
22
|
} = props;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","useEffect","NativeEventEmitter","NativeModules","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","onClose","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","rest","resolvedClientID","resolvedClientCode","resolvedToken","nativeEmitterModule","QmsDashboardEmitter","emitter","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,QACjB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,MAAM;IACJC,OAAO;
|
|
1
|
+
{"version":3,"names":["React","useEffect","NativeEventEmitter","NativeModules","requireNativeComponent","jsx","_jsx","NativeQmsDashboardView","QmsDashboardView","props","onClose","clientID","clientCode","ClientID","ClientCode","user_token","userToken","token","rest","resolvedClientID","resolvedClientCode","resolvedToken","nativeEmitterModule","QmsDashboardEmitter","emitter","subscription","addListener","remove"],"sourceRoot":"../../src","sources":["QmsDashboardView.ios.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAQ,OAAO;AACxC,SACEC,kBAAkB,EAClBC,aAAa,EACbC,sBAAsB,QACjB,cAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAGtB;AACA,MAAMC,sBAAsB,GAC1BH,sBAAsB,CAAwB,kBAAkB,CAAC;AAEnE,OAAO,MAAMI,gBAAiD,GAAIC,KAAK,IAAK;EAC1E,MAAM;IACJC,OAAO;IACP;IACAC,QAAQ;IACRC,UAAU;IACVC,QAAQ;IACRC,UAAU;IACVC,UAAU;IACVC,SAAS;IACTC,KAAK;IACL;IACA;IACA,GAAGC;EACL,CAAC,GAAGT,KAAK;EAET,MAAMU,gBAAgB,GAAGR,QAAQ,IAAIE,QAAQ,IAAI,EAAE;EACnD,MAAMO,kBAAkB,GAAGR,UAAU,IAAIE,UAAU,IAAI,EAAE;EACzD,MAAMO,aAAa,GAAGN,UAAU,IAAIE,KAAK,IAAID,SAAS,IAAI,EAAE;EAE5Df,SAAS,CAAC,MAAM;IACd,IAAI,CAACS,OAAO,EAAE;IACd,MAAMY,mBAAmB,GAAGnB,aAAa,CAACoB,mBAAmB;IAC7D,IAAI,CAACD,mBAAmB,EAAE;IAC1B,MAAME,OAAO,GAAG,IAAItB,kBAAkB,CAACoB,mBAAmB,CAAC;IAC3D,MAAMG,YAAY,GAAGD,OAAO,CAACE,WAAW,CAAC,SAAS,EAAEhB,OAAO,CAAC;IAC5D,OAAO,MAAMe,YAAY,CAACE,MAAM,CAAC,CAAC;EACpC,CAAC,EAAE,CAACjB,OAAO,CAAC,CAAC;EAEb,oBACEJ,IAAA,CAACC,sBAAsB;IAAA,GACjBW,IAAI;IACRL,QAAQ,EAAEM,gBAAiB;IAC3BL,UAAU,EAAEM,kBAAmB;IAC/BL,UAAU,EAAEM;EAAc,CAC3B,CAAC;AAEN,CAAC","ignoreList":[]}
|
|
@@ -1 +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;
|
|
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;AAyBtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAmH5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,
|
|
1
|
+
{"version":3,"file":"QmsDashboardView.ios.d.ts","sourceRoot":"","sources":["../../../src/QmsDashboardView.ios.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAMtE,eAAO,MAAM,gBAAgB,EAAE,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAqC5D,CAAC"}
|
|
@@ -2,6 +2,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
2
2
|
export type QmsDashboardViewProps = {
|
|
3
3
|
style?: StyleProp<ViewStyle>;
|
|
4
4
|
onClose?: (event?: unknown) => void;
|
|
5
|
+
onLogout?: (event?: unknown) => void;
|
|
5
6
|
/**
|
|
6
7
|
* Preferred camelCase props. Uppercase variants are kept for backwards compatibility
|
|
7
8
|
* with the native iOS view manager prop names.
|
|
@@ -15,5 +16,11 @@ export type QmsDashboardViewProps = {
|
|
|
15
16
|
token?: string;
|
|
16
17
|
autoShow?: boolean;
|
|
17
18
|
themeColor?: string;
|
|
19
|
+
headerTextColor?: string;
|
|
20
|
+
headerIconColor?: string;
|
|
21
|
+
accentColor?: string;
|
|
22
|
+
fontFamily?: string;
|
|
23
|
+
isOrigin?: boolean;
|
|
24
|
+
payload?: Record<string, unknown> | null;
|
|
18
25
|
};
|
|
19
26
|
//# sourceMappingURL=QmsDashboardView.types.d.ts.map
|
|
@@ -1 +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,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;
|
|
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,OAAO,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACrC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -7,15 +7,28 @@ const { QmsModule } = NativeModules as {
|
|
|
7
7
|
showQms?: (
|
|
8
8
|
userToken?: string,
|
|
9
9
|
clientID?: string,
|
|
10
|
-
clientCode?: string
|
|
10
|
+
clientCode?: string,
|
|
11
|
+
isOrigin?: boolean
|
|
12
|
+
) => void;
|
|
13
|
+
showQmsWithPayload?: (
|
|
14
|
+
userToken?: string,
|
|
15
|
+
clientID?: string,
|
|
16
|
+
clientCode?: string,
|
|
17
|
+
isOrigin?: boolean,
|
|
18
|
+
payload?: Record<string, unknown> | null
|
|
11
19
|
) => void;
|
|
12
20
|
setPrimaryColor?: (hexColor?: string) => void;
|
|
21
|
+
setHeaderTextColor?: (hexColor?: string) => void;
|
|
22
|
+
setHeaderIconColor?: (hexColor?: string) => void;
|
|
23
|
+
setAccentColor?: (hexColor?: string) => void;
|
|
24
|
+
setFontFamily?: (fontFamily?: string) => void;
|
|
13
25
|
};
|
|
14
26
|
};
|
|
15
27
|
|
|
16
28
|
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
17
29
|
style,
|
|
18
30
|
onClose,
|
|
31
|
+
onLogout,
|
|
19
32
|
clientID,
|
|
20
33
|
clientCode,
|
|
21
34
|
ClientID,
|
|
@@ -25,18 +38,52 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
|
25
38
|
userToken,
|
|
26
39
|
autoShow = true,
|
|
27
40
|
themeColor,
|
|
41
|
+
headerTextColor,
|
|
42
|
+
headerIconColor,
|
|
43
|
+
accentColor,
|
|
44
|
+
fontFamily,
|
|
45
|
+
isOrigin = false,
|
|
46
|
+
payload,
|
|
28
47
|
}) => {
|
|
29
48
|
useEffect(() => {
|
|
30
49
|
const resolvedClientID = clientID ?? ClientID ?? '';
|
|
31
50
|
const resolvedClientCode = clientCode ?? ClientCode ?? '';
|
|
32
51
|
const resolvedToken = user_token ?? token ?? userToken ?? '';
|
|
52
|
+
const hasPayload = payload != null && Object.keys(payload).length > 0;
|
|
33
53
|
|
|
34
54
|
if (autoShow && QmsModule?.showQms) {
|
|
35
55
|
if (themeColor && QmsModule?.setPrimaryColor) {
|
|
36
56
|
QmsModule.setPrimaryColor(themeColor);
|
|
37
57
|
}
|
|
58
|
+
if (headerTextColor && QmsModule?.setHeaderTextColor) {
|
|
59
|
+
QmsModule.setHeaderTextColor(headerTextColor);
|
|
60
|
+
}
|
|
61
|
+
if (headerIconColor && QmsModule?.setHeaderIconColor) {
|
|
62
|
+
QmsModule.setHeaderIconColor(headerIconColor);
|
|
63
|
+
}
|
|
64
|
+
if (accentColor && QmsModule?.setAccentColor) {
|
|
65
|
+
QmsModule.setAccentColor(accentColor);
|
|
66
|
+
}
|
|
67
|
+
if (QmsModule?.setFontFamily) {
|
|
68
|
+
QmsModule.setFontFamily(fontFamily ?? '');
|
|
69
|
+
}
|
|
38
70
|
// map props to native method args
|
|
39
|
-
|
|
71
|
+
if (hasPayload && QmsModule?.showQmsWithPayload) {
|
|
72
|
+
QmsModule.showQmsWithPayload(
|
|
73
|
+
resolvedToken,
|
|
74
|
+
resolvedClientID,
|
|
75
|
+
resolvedClientCode,
|
|
76
|
+
isOrigin,
|
|
77
|
+
payload
|
|
78
|
+
);
|
|
79
|
+
} else {
|
|
80
|
+
QmsModule.showQms(
|
|
81
|
+
resolvedToken,
|
|
82
|
+
resolvedClientID,
|
|
83
|
+
resolvedClientCode,
|
|
84
|
+
isOrigin
|
|
85
|
+
);
|
|
86
|
+
}
|
|
40
87
|
}
|
|
41
88
|
}, [
|
|
42
89
|
clientID,
|
|
@@ -48,13 +95,31 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
|
48
95
|
userToken,
|
|
49
96
|
autoShow,
|
|
50
97
|
themeColor,
|
|
98
|
+
headerTextColor,
|
|
99
|
+
headerIconColor,
|
|
100
|
+
accentColor,
|
|
101
|
+
fontFamily,
|
|
102
|
+
isOrigin,
|
|
103
|
+
payload,
|
|
51
104
|
]);
|
|
52
105
|
|
|
53
106
|
useEffect(() => {
|
|
54
107
|
if (themeColor && QmsModule?.setPrimaryColor) {
|
|
55
108
|
QmsModule.setPrimaryColor(themeColor);
|
|
56
109
|
}
|
|
57
|
-
|
|
110
|
+
if (headerTextColor && QmsModule?.setHeaderTextColor) {
|
|
111
|
+
QmsModule.setHeaderTextColor(headerTextColor);
|
|
112
|
+
}
|
|
113
|
+
if (headerIconColor && QmsModule?.setHeaderIconColor) {
|
|
114
|
+
QmsModule.setHeaderIconColor(headerIconColor);
|
|
115
|
+
}
|
|
116
|
+
if (accentColor && QmsModule?.setAccentColor) {
|
|
117
|
+
QmsModule.setAccentColor(accentColor);
|
|
118
|
+
}
|
|
119
|
+
if (QmsModule?.setFontFamily) {
|
|
120
|
+
QmsModule.setFontFamily(fontFamily ?? '');
|
|
121
|
+
}
|
|
122
|
+
}, [themeColor, headerTextColor, headerIconColor, accentColor, fontFamily]);
|
|
58
123
|
|
|
59
124
|
useEffect(() => {
|
|
60
125
|
if (!onClose) return;
|
|
@@ -64,6 +129,14 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = ({
|
|
|
64
129
|
return () => subscription.remove();
|
|
65
130
|
}, [onClose]);
|
|
66
131
|
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
if (!onLogout) return;
|
|
134
|
+
const subscription = DeviceEventEmitter.addListener('QmsSdkOnLogout', () =>
|
|
135
|
+
onLogout()
|
|
136
|
+
);
|
|
137
|
+
return () => subscription.remove();
|
|
138
|
+
}, [onLogout]);
|
|
139
|
+
|
|
67
140
|
// Android doesn’t need to show native UI as a "view" here,
|
|
68
141
|
// we just render an empty container so JSX stays consistent.
|
|
69
142
|
return <View style={style} />;
|
|
@@ -13,6 +13,7 @@ const NativeQmsDashboardView =
|
|
|
13
13
|
export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
|
|
14
14
|
const {
|
|
15
15
|
onClose,
|
|
16
|
+
// onLogout,
|
|
16
17
|
clientID,
|
|
17
18
|
clientCode,
|
|
18
19
|
ClientID,
|
|
@@ -20,6 +21,7 @@ export const QmsDashboardView: React.FC<QmsDashboardViewProps> = (props) => {
|
|
|
20
21
|
user_token,
|
|
21
22
|
userToken,
|
|
22
23
|
token,
|
|
24
|
+
// isOrigin,
|
|
23
25
|
// autoShow is Android-only; ignored on iOS
|
|
24
26
|
...rest
|
|
25
27
|
} = props;
|
|
@@ -3,6 +3,7 @@ import type { StyleProp, ViewStyle } from 'react-native';
|
|
|
3
3
|
export type QmsDashboardViewProps = {
|
|
4
4
|
style?: StyleProp<ViewStyle>;
|
|
5
5
|
onClose?: (event?: unknown) => void;
|
|
6
|
+
onLogout?: (event?: unknown) => void;
|
|
6
7
|
/**
|
|
7
8
|
* Preferred camelCase props. Uppercase variants are kept for backwards compatibility
|
|
8
9
|
* with the native iOS view manager prop names.
|
|
@@ -16,4 +17,10 @@ export type QmsDashboardViewProps = {
|
|
|
16
17
|
token?: string;
|
|
17
18
|
autoShow?: boolean; // optional: Android uses this, iOS can ignore
|
|
18
19
|
themeColor?: string;
|
|
20
|
+
headerTextColor?: string;
|
|
21
|
+
headerIconColor?: string;
|
|
22
|
+
accentColor?: string;
|
|
23
|
+
fontFamily?: string;
|
|
24
|
+
isOrigin?: boolean;
|
|
25
|
+
payload?: Record<string, unknown> | null;
|
|
19
26
|
};
|