@appboxo/react-native-sdk 1.10.0 → 1.11.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
CHANGED
|
@@ -123,7 +123,5 @@ dependencies {
|
|
|
123
123
|
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
|
124
124
|
//noinspection GradleDynamicVersion
|
|
125
125
|
implementation 'com.facebook.react:react-native:+' // From node_modules
|
|
126
|
-
implementation('io.boxo.sdk:boxo-android:1.
|
|
127
|
-
exclude group: 'com.google.android.gms', module: 'play-services-location'
|
|
128
|
-
}
|
|
126
|
+
implementation('io.boxo.sdk:boxo-android:1.39.0')
|
|
129
127
|
}
|
|
@@ -18,6 +18,7 @@ package com.appboxo.react
|
|
|
18
18
|
import android.app.Application
|
|
19
19
|
import android.os.Handler
|
|
20
20
|
import android.os.Looper
|
|
21
|
+
import android.graphics.Color
|
|
21
22
|
import io.boxo.data.models.MiniappData
|
|
22
23
|
import io.boxo.data.models.PageAnimation
|
|
23
24
|
import io.boxo.js.params.CustomEvent
|
|
@@ -63,7 +64,8 @@ class RnappboxosdkModule(reactContext: ReactApplicationContext) :
|
|
|
63
64
|
isDebug: Boolean,
|
|
64
65
|
showPermissionsPage: Boolean,
|
|
65
66
|
showClearCache: Boolean,
|
|
66
|
-
showAboutPage: Boolean
|
|
67
|
+
showAboutPage: Boolean,
|
|
68
|
+
splashScreenOptions: ReadableMap?
|
|
67
69
|
) {
|
|
68
70
|
val globalTheme: Config.Theme = when (theme) {
|
|
69
71
|
"light" -> Config.Theme.LIGHT
|
|
@@ -83,6 +85,24 @@ class RnappboxosdkModule(reactContext: ReactApplicationContext) :
|
|
|
83
85
|
.showClearCache(showClearCache)
|
|
84
86
|
.showAboutPage(showAboutPage)
|
|
85
87
|
.debug(isDebug)
|
|
88
|
+
.apply {
|
|
89
|
+
splashScreenOptions?.also { options->
|
|
90
|
+
setProgressBarColors(
|
|
91
|
+
lightIndicator =
|
|
92
|
+
Color.parseColor(options.getString("lightProgressIndicator")),
|
|
93
|
+
lightTrack =
|
|
94
|
+
Color.parseColor(options.getString("lightProgressTrack")),
|
|
95
|
+
darkIndicator =
|
|
96
|
+
Color.parseColor(options.getString("darkProgressIndicator")),
|
|
97
|
+
darkTrack =
|
|
98
|
+
Color.parseColor(options.getString("darkProgressTrack"))
|
|
99
|
+
)
|
|
100
|
+
setSplashBackgroundColors(
|
|
101
|
+
light = Color.parseColor(options.getString("lightBackground")),
|
|
102
|
+
dark = Color.parseColor(options.getString("darkBackground"))
|
|
103
|
+
)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
86
106
|
.build()
|
|
87
107
|
)
|
|
88
108
|
}
|
package/index.d.ts
CHANGED
|
@@ -38,7 +38,15 @@ declare module '@appboxo/react-native-sdk' {
|
|
|
38
38
|
isDebug?: boolean,
|
|
39
39
|
showPermissionsPage? : boolean,
|
|
40
40
|
showClearCache?: boolean,
|
|
41
|
-
showAboutPage?: boolean
|
|
41
|
+
showAboutPage?: boolean,
|
|
42
|
+
splashScreenOptions?: {
|
|
43
|
+
lightProgressIndicator: string,
|
|
44
|
+
lightProgressTrack: string,
|
|
45
|
+
darkProgressIndicator: string,
|
|
46
|
+
darkProgressTrack: string,
|
|
47
|
+
lightBackground: string,
|
|
48
|
+
darkBackground: string
|
|
49
|
+
}
|
|
42
50
|
}
|
|
43
51
|
): void
|
|
44
52
|
|
package/ios/Rnappboxosdk.m
CHANGED
|
@@ -32,7 +32,7 @@ limitations under the License.
|
|
|
32
32
|
RCT_EXPORT_MODULE()
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
RCT_EXPORT_METHOD(setConfig:(NSString *)clientId userId:(NSString *)userId language:(NSString *)language sandboxMode:(BOOL)sandboxMode enableMultitaskMode:(BOOL)enableMultitaskMode theme:(NSString *)theme isDebug:(BOOL)isDebug showPermissionsPage:(BOOL)showPermissionsPage showClearCache:(BOOL)showClearCache showAboutPage:(BOOL)showAboutPage)
|
|
35
|
+
RCT_EXPORT_METHOD(setConfig:(NSString *)clientId userId:(NSString *)userId language:(NSString *)language sandboxMode:(BOOL)sandboxMode enableMultitaskMode:(BOOL)enableMultitaskMode theme:(NSString *)theme isDebug:(BOOL)isDebug showPermissionsPage:(BOOL)showPermissionsPage showClearCache:(BOOL)showClearCache showAboutPage:(BOOL)showAboutPage splashScreenOptions:(nullable NSDictionary<NSString *, id> *)splashScreenOptions)
|
|
36
36
|
{
|
|
37
37
|
NSArray *themes = @[@"dark", @"light", @"system"];
|
|
38
38
|
|
|
@@ -50,6 +50,24 @@ RCT_EXPORT_METHOD(setConfig:(NSString *)clientId userId:(NSString *)userId langu
|
|
|
50
50
|
config.showClearCache = showClearCache;
|
|
51
51
|
config.showAboutPage = showAboutPage;
|
|
52
52
|
|
|
53
|
+
if (splashScreenOptions != NULL) {
|
|
54
|
+
UIColor *lightBackground = [self colorFromHexString: splashScreenOptions[@"lightBackground"]];
|
|
55
|
+
UIColor *darkBackground = [self colorFromHexString: splashScreenOptions[@"darkBackground"]];
|
|
56
|
+
|
|
57
|
+
if (lightBackground != NULL && darkBackground != NULL) {
|
|
58
|
+
config.splashBackgroundColors = [[SplashBackgroundColors alloc] light: lightBackground dark: darkBackground];
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
UIColor *lightProgressIndicator = [self colorFromHexString: splashScreenOptions[@"lightProgressIndicator"]];
|
|
62
|
+
UIColor *lightProgressTrack = [self colorFromHexString: splashScreenOptions[@"lightProgressTrack"]];
|
|
63
|
+
UIColor *darkProgressIndicator = [self colorFromHexString: splashScreenOptions[@"darkProgressIndicator"]];
|
|
64
|
+
UIColor *darkProgressTrack = [self colorFromHexString: splashScreenOptions[@"darkProgressTrack"]];
|
|
65
|
+
|
|
66
|
+
if (lightProgressIndicator != NULL && lightProgressTrack != NULL && darkProgressIndicator != NULL && darkProgressTrack != NULL) {
|
|
67
|
+
config.progressBarColors = [[ProgressBarColors alloc] initWithLightIndicator: lightProgressIndicator lightTrack: lightProgressTrack darkIndicator: darkProgressIndicator darkTrack: darkProgressTrack];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
53
71
|
[[Boxo shared] setConfig: config];
|
|
54
72
|
}
|
|
55
73
|
|
|
@@ -306,4 +324,57 @@ RCT_EXPORT_METHOD(getMiniapps)
|
|
|
306
324
|
[self sendEventWithName:APPBOXO_MINIAPP_LIFECYCLE_EVENT body:body];
|
|
307
325
|
}
|
|
308
326
|
|
|
327
|
+
- (nullable UIColor *)colorFromHexString: (nullable id) hexString {
|
|
328
|
+
if (hexString != NULL && [hexString isKindOfClass:[NSString class]]) {
|
|
329
|
+
NSString *hex = [[hexString stringByTrimmingCharactersInSet:
|
|
330
|
+
[NSCharacterSet whitespaceAndNewlineCharacterSet]]
|
|
331
|
+
stringByReplacingOccurrencesOfString:@"#" withString:@""];
|
|
332
|
+
|
|
333
|
+
unsigned long long intValue = 0;
|
|
334
|
+
NSScanner *scanner = [NSScanner scannerWithString:hex];
|
|
335
|
+
if (![scanner scanHexLongLong:&intValue]) {
|
|
336
|
+
return nil;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
CGFloat red, green, blue, alpha;
|
|
340
|
+
|
|
341
|
+
switch (hex.length) {
|
|
342
|
+
case 6: { // RRGGBB
|
|
343
|
+
red = ((intValue >> 16) & 0xFF) / 255.0;
|
|
344
|
+
green = ((intValue >> 8) & 0xFF) / 255.0;
|
|
345
|
+
blue = ( intValue & 0xFF) / 255.0;
|
|
346
|
+
alpha = 1.0;
|
|
347
|
+
break;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
case 8: { // RRGGBBAA
|
|
351
|
+
red = ((intValue >> 24) & 0xFF) / 255.0;
|
|
352
|
+
green = ((intValue >> 16) & 0xFF) / 255.0;
|
|
353
|
+
blue = ((intValue >> 8) & 0xFF) / 255.0;
|
|
354
|
+
alpha = ( intValue & 0xFF) / 255.0;
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
case 3: { // RGB short form
|
|
359
|
+
unsigned long long r = ((intValue >> 8) & 0xF) * 17;
|
|
360
|
+
unsigned long long g = ((intValue >> 4) & 0xF) * 17;
|
|
361
|
+
unsigned long long b = ( intValue & 0xF) * 17;
|
|
362
|
+
|
|
363
|
+
red = r / 255.0;
|
|
364
|
+
green = g / 255.0;
|
|
365
|
+
blue = b / 255.0;
|
|
366
|
+
alpha = 1.0;
|
|
367
|
+
break;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
default:
|
|
371
|
+
return NULL;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return [UIColor colorWithRed:red green:green blue:blue alpha:alpha];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
return NULL;
|
|
378
|
+
}
|
|
379
|
+
|
|
309
380
|
@end
|
package/js/mSetConfig.js
CHANGED
|
@@ -14,7 +14,8 @@ const mSetConfig = (clientId, options) => {
|
|
|
14
14
|
options?.isDebug ?? false,
|
|
15
15
|
options?.showPermissionsPage ?? true,
|
|
16
16
|
options?.showClearCache ?? true,
|
|
17
|
-
options?.showAboutPage ?? true
|
|
17
|
+
options?.showAboutPage ?? true,
|
|
18
|
+
options?.splashScreenOptions
|
|
18
19
|
)
|
|
19
20
|
}
|
|
20
21
|
|
package/package.json
CHANGED