@iternio/react-native-auto-play 0.3.13 → 0.3.14
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/README.md +1 -43
- package/ReactNativeAutoPlay.podspec +4 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/SymbolFont.kt +30 -29
- package/android/src/main/res/font/materialsymbolsoutlined_regular.ttf +0 -0
- package/ios/Assets/MaterialSymbolsOutlined-Regular.ttf +0 -0
- package/ios/utils/SymbolFont.swift +44 -44
- package/lib/HybridAutoPlay.d.ts +2 -0
- package/lib/HybridAutoPlay.js +2 -0
- package/lib/hooks/useIsAutoPlayFocused.d.ts +7 -0
- package/lib/hooks/useIsAutoPlayFocused.js +20 -0
- package/lib/hybrid/HybridVoice.d.ts +12 -0
- package/lib/hybrid/HybridVoice.js +13 -0
- package/lib/hybrid.d.ts +2 -0
- package/lib/hybrid.js +2 -0
- package/lib/index.d.ts +0 -1
- package/lib/index.js +0 -1
- package/lib/specs/AutomotivePermissionRequestTemplate.d.ts +11 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.js +1 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.d.ts +11 -0
- package/lib/specs/AutomotivePermissionRequestTemplate.nitro.js +1 -0
- package/lib/specs/Voice.nitro.d.ts +51 -0
- package/lib/specs/Voice.nitro.js +1 -0
- package/lib/templates/AutomotivePermissionRequestTemplate.d.ts +23 -0
- package/lib/templates/AutomotivePermissionRequestTemplate.js +18 -0
- package/lib/types/Glyphmap.d.ts +4105 -0
- package/lib/types/Glyphmap.js +4105 -0
- package/lib/types/Image.d.ts +4 -33
- package/lib/types/Maneuver.d.ts +10 -2
- package/lib/types/Voice.d.ts +15 -0
- package/lib/types/Voice.js +1 -0
- package/lib/utils/NitroImage.d.ts +2 -23
- package/lib/utils/NitroImage.js +3 -57
- package/nitrogen/generated/android/c++/JGlyphImage.hpp +1 -6
- package/nitrogen/generated/android/c++/JNitroImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.hpp +1 -1
- package/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp +1 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GlyphImage.kt +2 -5
- package/nitrogen/generated/ios/c++/HybridCarPlayDashboardSpecSwift.hpp +1 -1
- package/nitrogen/generated/ios/swift/GlyphImage.swift +2 -7
- package/nitrogen/generated/shared/c++/GlyphImage.hpp +1 -6
- package/package.json +3 -2
- package/src/index.ts +0 -1
- package/src/types/Glyphmap.ts +4107 -0
- package/src/types/Image.ts +18 -53
- package/src/types/Maneuver.ts +10 -3
- package/src/utils/NitroImage.ts +5 -66
package/lib/types/Image.d.ts
CHANGED
|
@@ -1,22 +1,8 @@
|
|
|
1
1
|
import type { ImageSourcePropType } from 'react-native';
|
|
2
2
|
import type { ThemedColor } from '../utils/NitroColor';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* // autoplay-glyphs.d.ts
|
|
9
|
-
* import type { GlyphName } from './assets/symbolFont/Glyphmap';
|
|
10
|
-
* declare module '@iternio/react-native-auto-play' {
|
|
11
|
-
* interface AutoPlayGlyphMap extends Record<GlyphName, number> {}
|
|
12
|
-
* }
|
|
13
|
-
* ```
|
|
14
|
-
*/
|
|
15
|
-
export interface AutoPlayGlyphMap {
|
|
16
|
-
}
|
|
17
|
-
/** Resolves to the augmented glyph name union, or falls back to `string` when not augmented. */
|
|
18
|
-
export type GlyphMapKey = keyof AutoPlayGlyphMap extends never ? string : Extract<keyof AutoPlayGlyphMap, string>;
|
|
19
|
-
type GlyphStyleFields = {
|
|
3
|
+
import type { GlyphName } from './Glyphmap';
|
|
4
|
+
export type AutoImage = {
|
|
5
|
+
name: GlyphName;
|
|
20
6
|
/**
|
|
21
7
|
* Sets the icon dark and light mode color or a single color for both.
|
|
22
8
|
* Defaults to white for dark mode and black for light mode if not specified.
|
|
@@ -29,22 +15,8 @@ type GlyphStyleFields = {
|
|
|
29
15
|
*/
|
|
30
16
|
backgroundColor?: ThemedColor | string;
|
|
31
17
|
fontScale?: number;
|
|
32
|
-
};
|
|
33
|
-
/** Glyph by name — looked up in the glyph map registered via {@link setIconFont}. */
|
|
34
|
-
export type AutoGlyphByName = GlyphStyleFields & {
|
|
35
|
-
type: 'glyph';
|
|
36
|
-
/** Key in the glyph map passed to `setIconFont`. */
|
|
37
|
-
name: GlyphMapKey;
|
|
38
|
-
/** Optional override — if set, used instead of the map lookup. */
|
|
39
|
-
codepoint?: number;
|
|
40
|
-
};
|
|
41
|
-
/** Glyph by raw Unicode code point. */
|
|
42
|
-
export type AutoGlyphByCodepoint = GlyphStyleFields & {
|
|
43
18
|
type: 'glyph';
|
|
44
|
-
|
|
45
|
-
};
|
|
46
|
-
export type AutoGlyph = AutoGlyphByName | AutoGlyphByCodepoint;
|
|
47
|
-
export type AutoImage = AutoGlyph | {
|
|
19
|
+
} | {
|
|
48
20
|
image: ImageSourcePropType;
|
|
49
21
|
/**
|
|
50
22
|
* if specified the image gets tinted, if not it will just use the original image
|
|
@@ -66,4 +38,3 @@ export type AutoImage = AutoGlyph | {
|
|
|
66
38
|
timeoutMs?: number;
|
|
67
39
|
type: 'remote';
|
|
68
40
|
};
|
|
69
|
-
export {};
|
package/lib/types/Maneuver.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageSourcePropType } from 'react-native';
|
|
2
2
|
import type { ThemedColor } from '../utils/NitroColor';
|
|
3
|
-
import type {
|
|
3
|
+
import type { GlyphName } from './Glyphmap';
|
|
4
4
|
import type { TravelEstimates } from './Trip';
|
|
5
5
|
export declare enum ManeuverType {
|
|
6
6
|
Depart = 0,
|
|
@@ -148,7 +148,15 @@ export interface PreferredLane extends Lane {
|
|
|
148
148
|
highlightedAngle: number;
|
|
149
149
|
isPreferred: boolean;
|
|
150
150
|
}
|
|
151
|
-
export type ManeuverImage =
|
|
151
|
+
export type ManeuverImage = {
|
|
152
|
+
name: GlyphName;
|
|
153
|
+
/**
|
|
154
|
+
* make sure to specify a color with a proper contrast ratio to cardBackgroundColor otherwise it might not get applied
|
|
155
|
+
* defaults to white/black for dark/light mode
|
|
156
|
+
*/
|
|
157
|
+
color?: ThemedColor | string;
|
|
158
|
+
type: 'glyph';
|
|
159
|
+
} | {
|
|
152
160
|
image: ImageSourcePropType;
|
|
153
161
|
/**
|
|
154
162
|
* if specified the image gets tinted, if not it will just use the original image
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface VoiceInputChunk {
|
|
2
|
+
partial?: string;
|
|
3
|
+
audio?: ArrayBuffer;
|
|
4
|
+
}
|
|
5
|
+
export interface VoiceInputResult {
|
|
6
|
+
transcription?: string;
|
|
7
|
+
audio?: ArrayBuffer;
|
|
8
|
+
}
|
|
9
|
+
export interface VoiceInputOptions {
|
|
10
|
+
silenceThresholdMs?: number;
|
|
11
|
+
maxDurationMs?: number;
|
|
12
|
+
listeningText?: string;
|
|
13
|
+
preferSpeechToText?: boolean;
|
|
14
|
+
onChunk?: (chunk: VoiceInputChunk) => void;
|
|
15
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,34 +1,12 @@
|
|
|
1
1
|
import { type ImageResolvedAssetSource } from 'react-native';
|
|
2
2
|
import type { AutoImage } from '../types/Image';
|
|
3
3
|
import { type NitroColor } from './NitroColor';
|
|
4
|
-
/**
|
|
5
|
-
* Register the icon font and (optionally) a glyph map for name-based lookups.
|
|
6
|
-
* Must be called **once** before creating any templates. Subsequent calls are ignored.
|
|
7
|
-
*
|
|
8
|
-
* The font name maps directly to a native font asset:
|
|
9
|
-
* - **Android** — `res/font/<name>.ttf` (must be lowercase)
|
|
10
|
-
* - **iOS** — `<name>.ttf` in the app bundle (registered via CoreText automatically)
|
|
11
|
-
*
|
|
12
|
-
* For cross-platform compatibility use lowercase with underscores only.
|
|
13
|
-
*
|
|
14
|
-
* @param name Native font asset name (without extension).
|
|
15
|
-
* @param glyphMap Optional map of glyph names to Unicode code points.
|
|
16
|
-
* When provided, glyphs can use `{ type: 'glyph', name: 'icon_name' }`.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```ts
|
|
20
|
-
* import { glyphMap } from './assets/Glyphmap';
|
|
21
|
-
* setIconFont('material_symbols', glyphMap);
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
export declare function setIconFont(name: string, glyphMap?: Record<string, number>): void;
|
|
25
4
|
interface AssetImage extends ImageResolvedAssetSource {
|
|
26
5
|
color?: NitroColor;
|
|
27
6
|
packager_asset: boolean;
|
|
28
7
|
}
|
|
29
8
|
interface GlyphImage {
|
|
30
9
|
glyph: number;
|
|
31
|
-
fontName: string;
|
|
32
10
|
color: NitroColor;
|
|
33
11
|
backgroundColor: NitroColor;
|
|
34
12
|
fontScale?: number;
|
|
@@ -39,7 +17,8 @@ interface RemoteImage {
|
|
|
39
17
|
timeoutMs?: number;
|
|
40
18
|
}
|
|
41
19
|
/**
|
|
42
|
-
*
|
|
20
|
+
* we need to map the ButtonImage.name from GlyphName to
|
|
21
|
+
* the actual numeric value so we need a nitro specific type
|
|
43
22
|
*/
|
|
44
23
|
export type NitroImage = GlyphImage | AssetImage | RemoteImage;
|
|
45
24
|
declare function convert(image: AutoImage): NitroImage;
|
package/lib/utils/NitroImage.js
CHANGED
|
@@ -1,68 +1,14 @@
|
|
|
1
1
|
import { Image } from 'react-native';
|
|
2
|
+
import { glyphMap } from '../types/Glyphmap';
|
|
2
3
|
import { NitroColorUtil } from './NitroColor';
|
|
3
|
-
let _iconFont;
|
|
4
|
-
let _glyphMap;
|
|
5
|
-
/**
|
|
6
|
-
* Register the icon font and (optionally) a glyph map for name-based lookups.
|
|
7
|
-
* Must be called **once** before creating any templates. Subsequent calls are ignored.
|
|
8
|
-
*
|
|
9
|
-
* The font name maps directly to a native font asset:
|
|
10
|
-
* - **Android** — `res/font/<name>.ttf` (must be lowercase)
|
|
11
|
-
* - **iOS** — `<name>.ttf` in the app bundle (registered via CoreText automatically)
|
|
12
|
-
*
|
|
13
|
-
* For cross-platform compatibility use lowercase with underscores only.
|
|
14
|
-
*
|
|
15
|
-
* @param name Native font asset name (without extension).
|
|
16
|
-
* @param glyphMap Optional map of glyph names to Unicode code points.
|
|
17
|
-
* When provided, glyphs can use `{ type: 'glyph', name: 'icon_name' }`.
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { glyphMap } from './assets/Glyphmap';
|
|
22
|
-
* setIconFont('material_symbols', glyphMap);
|
|
23
|
-
* ```
|
|
24
|
-
*/
|
|
25
|
-
export function setIconFont(name, glyphMap) {
|
|
26
|
-
if (_iconFont != null) {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
_iconFont = name;
|
|
30
|
-
_glyphMap = glyphMap;
|
|
31
|
-
}
|
|
32
|
-
function getIconFont() {
|
|
33
|
-
if (_iconFont == null) {
|
|
34
|
-
throw new Error('No icon font configured. Call setIconFont("your_font_name") before using glyph images.');
|
|
35
|
-
}
|
|
36
|
-
return _iconFont;
|
|
37
|
-
}
|
|
38
|
-
function resolveGlyph(image) {
|
|
39
|
-
if ('name' in image && image.name !== undefined) {
|
|
40
|
-
if (image.codepoint !== undefined) {
|
|
41
|
-
return image.codepoint;
|
|
42
|
-
}
|
|
43
|
-
if (_glyphMap == null) {
|
|
44
|
-
throw new Error(`Glyph name "${image.name}" used but no glyph map was provided to setIconFont().`);
|
|
45
|
-
}
|
|
46
|
-
const cp = _glyphMap[image.name];
|
|
47
|
-
if (cp === undefined) {
|
|
48
|
-
throw new Error(`Glyph name "${image.name}" not found in the glyph map.`);
|
|
49
|
-
}
|
|
50
|
-
return cp;
|
|
51
|
-
}
|
|
52
|
-
if (image.codepoint !== undefined) {
|
|
53
|
-
return image.codepoint;
|
|
54
|
-
}
|
|
55
|
-
throw new Error('Glyph image must provide either `name` or `codepoint`.');
|
|
56
|
-
}
|
|
57
4
|
function convert(image) {
|
|
58
5
|
if (image == null) {
|
|
59
6
|
return undefined;
|
|
60
7
|
}
|
|
61
8
|
if (image.type === 'glyph') {
|
|
62
|
-
const { color = { darkColor: 'white', lightColor: 'black' }, fontScale, backgroundColor = 'transparent', } = image;
|
|
9
|
+
const { color = { darkColor: 'white', lightColor: 'black' }, fontScale, name, backgroundColor = 'transparent', } = image;
|
|
63
10
|
return {
|
|
64
|
-
glyph:
|
|
65
|
-
fontName: getIconFont(),
|
|
11
|
+
glyph: glyphMap[name],
|
|
66
12
|
color: NitroColorUtil.convert(color),
|
|
67
13
|
backgroundColor: NitroColorUtil.convert(backgroundColor),
|
|
68
14
|
fontScale,
|
|
@@ -13,7 +13,6 @@
|
|
|
13
13
|
#include "JNitroColor.hpp"
|
|
14
14
|
#include "NitroColor.hpp"
|
|
15
15
|
#include <optional>
|
|
16
|
-
#include <string>
|
|
17
16
|
|
|
18
17
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
19
18
|
|
|
@@ -36,8 +35,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
36
35
|
static const auto clazz = javaClassStatic();
|
|
37
36
|
static const auto fieldGlyph = clazz->getField<double>("glyph");
|
|
38
37
|
double glyph = this->getFieldValue(fieldGlyph);
|
|
39
|
-
static const auto fieldFontName = clazz->getField<jni::JString>("fontName");
|
|
40
|
-
jni::local_ref<jni::JString> fontName = this->getFieldValue(fieldFontName);
|
|
41
38
|
static const auto fieldColor = clazz->getField<JNitroColor>("color");
|
|
42
39
|
jni::local_ref<JNitroColor> color = this->getFieldValue(fieldColor);
|
|
43
40
|
static const auto fieldBackgroundColor = clazz->getField<JNitroColor>("backgroundColor");
|
|
@@ -46,7 +43,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
46
43
|
jni::local_ref<jni::JDouble> fontScale = this->getFieldValue(fieldFontScale);
|
|
47
44
|
return GlyphImage(
|
|
48
45
|
glyph,
|
|
49
|
-
fontName->toStdString(),
|
|
50
46
|
color->toCpp(),
|
|
51
47
|
backgroundColor->toCpp(),
|
|
52
48
|
fontScale != nullptr ? std::make_optional(fontScale->value()) : std::nullopt
|
|
@@ -59,13 +55,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
59
55
|
*/
|
|
60
56
|
[[maybe_unused]]
|
|
61
57
|
static jni::local_ref<JGlyphImage::javaobject> fromCpp(const GlyphImage& value) {
|
|
62
|
-
using JSignature = JGlyphImage(double, jni::alias_ref<
|
|
58
|
+
using JSignature = JGlyphImage(double, jni::alias_ref<JNitroColor>, jni::alias_ref<JNitroColor>, jni::alias_ref<jni::JDouble>);
|
|
63
59
|
static const auto clazz = javaClassStatic();
|
|
64
60
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
65
61
|
return create(
|
|
66
62
|
clazz,
|
|
67
63
|
value.glyph,
|
|
68
|
-
jni::make_jstring(value.fontName),
|
|
69
64
|
JNitroColor::fromCpp(value.color),
|
|
70
65
|
JNitroColor::fromCpp(value.backgroundColor),
|
|
71
66
|
value.fontScale.has_value() ? jni::JDouble::valueOf(value.fontScale.value()) : nullptr
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
#include "RemoteImage.hpp"
|
|
16
16
|
#include <variant>
|
|
17
17
|
#include "JGlyphImage.hpp"
|
|
18
|
-
#include <string>
|
|
19
18
|
#include "NitroColor.hpp"
|
|
20
19
|
#include "JNitroColor.hpp"
|
|
21
20
|
#include <optional>
|
|
22
21
|
#include "JAssetImage.hpp"
|
|
22
|
+
#include <string>
|
|
23
23
|
#include "JRemoteImage.hpp"
|
|
24
24
|
|
|
25
25
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
@@ -15,11 +15,11 @@
|
|
|
15
15
|
#include "RemoteImage.hpp"
|
|
16
16
|
#include <variant>
|
|
17
17
|
#include "JGlyphImage.hpp"
|
|
18
|
-
#include <string>
|
|
19
18
|
#include "NitroColor.hpp"
|
|
20
19
|
#include "JNitroColor.hpp"
|
|
21
20
|
#include <optional>
|
|
22
21
|
#include "JAssetImage.hpp"
|
|
22
|
+
#include <string>
|
|
23
23
|
#include "JRemoteImage.hpp"
|
|
24
24
|
|
|
25
25
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
@@ -19,11 +19,11 @@
|
|
|
19
19
|
#include "RemoteImage.hpp"
|
|
20
20
|
#include "JNitroImage.hpp"
|
|
21
21
|
#include "JGlyphImage.hpp"
|
|
22
|
-
#include <string>
|
|
23
22
|
#include "NitroColor.hpp"
|
|
24
23
|
#include "JNitroColor.hpp"
|
|
25
24
|
#include <optional>
|
|
26
25
|
#include "JAssetImage.hpp"
|
|
26
|
+
#include <string>
|
|
27
27
|
#include "JRemoteImage.hpp"
|
|
28
28
|
#include <vector>
|
|
29
29
|
#include "JImageLane.hpp"
|
|
@@ -22,9 +22,6 @@ data class GlyphImage(
|
|
|
22
22
|
val glyph: Double,
|
|
23
23
|
@DoNotStrip
|
|
24
24
|
@Keep
|
|
25
|
-
val fontName: String,
|
|
26
|
-
@DoNotStrip
|
|
27
|
-
@Keep
|
|
28
25
|
val color: NitroColor,
|
|
29
26
|
@DoNotStrip
|
|
30
27
|
@Keep
|
|
@@ -43,8 +40,8 @@ data class GlyphImage(
|
|
|
43
40
|
@Keep
|
|
44
41
|
@Suppress("unused")
|
|
45
42
|
@JvmStatic
|
|
46
|
-
private fun fromCpp(glyph: Double,
|
|
47
|
-
return GlyphImage(glyph,
|
|
43
|
+
private fun fromCpp(glyph: Double, color: NitroColor, backgroundColor: NitroColor, fontScale: Double?): GlyphImage {
|
|
44
|
+
return GlyphImage(glyph, color, backgroundColor, fontScale)
|
|
48
45
|
}
|
|
49
46
|
}
|
|
50
47
|
}
|
|
@@ -36,9 +36,9 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ColorSc
|
|
|
36
36
|
#include "AssetImage.hpp"
|
|
37
37
|
#include "RemoteImage.hpp"
|
|
38
38
|
#include <variant>
|
|
39
|
-
#include <string>
|
|
40
39
|
#include "NitroColor.hpp"
|
|
41
40
|
#include <optional>
|
|
41
|
+
#include <string>
|
|
42
42
|
#include "ColorScheme.hpp"
|
|
43
43
|
|
|
44
44
|
#include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
|
|
@@ -18,8 +18,8 @@ public extension GlyphImage {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `GlyphImage`.
|
|
20
20
|
*/
|
|
21
|
-
init(glyph: Double,
|
|
22
|
-
self.init(glyph,
|
|
21
|
+
init(glyph: Double, color: NitroColor, backgroundColor: NitroColor, fontScale: Double?) {
|
|
22
|
+
self.init(glyph, color, backgroundColor, { () -> bridge.std__optional_double_ in
|
|
23
23
|
if let __unwrappedValue = fontScale {
|
|
24
24
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
25
25
|
} else {
|
|
@@ -33,11 +33,6 @@ public extension GlyphImage {
|
|
|
33
33
|
return self.__glyph
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
@inline(__always)
|
|
37
|
-
var fontName: String {
|
|
38
|
-
return String(self.__fontName)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
36
|
@inline(__always)
|
|
42
37
|
var color: NitroColor {
|
|
43
38
|
return self.__color
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
// Forward declaration of `NitroColor` to properly resolve imports.
|
|
32
32
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroColor; }
|
|
33
33
|
|
|
34
|
-
#include <string>
|
|
35
34
|
#include "NitroColor.hpp"
|
|
36
35
|
#include <optional>
|
|
37
36
|
|
|
@@ -43,14 +42,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
43
42
|
struct GlyphImage final {
|
|
44
43
|
public:
|
|
45
44
|
double glyph SWIFT_PRIVATE;
|
|
46
|
-
std::string fontName SWIFT_PRIVATE;
|
|
47
45
|
NitroColor color SWIFT_PRIVATE;
|
|
48
46
|
NitroColor backgroundColor SWIFT_PRIVATE;
|
|
49
47
|
std::optional<double> fontScale SWIFT_PRIVATE;
|
|
50
48
|
|
|
51
49
|
public:
|
|
52
50
|
GlyphImage() = default;
|
|
53
|
-
explicit GlyphImage(double glyph,
|
|
51
|
+
explicit GlyphImage(double glyph, NitroColor color, NitroColor backgroundColor, std::optional<double> fontScale): glyph(glyph), color(color), backgroundColor(backgroundColor), fontScale(fontScale) {}
|
|
54
52
|
|
|
55
53
|
public:
|
|
56
54
|
friend bool operator==(const GlyphImage& lhs, const GlyphImage& rhs) = default;
|
|
@@ -67,7 +65,6 @@ namespace margelo::nitro {
|
|
|
67
65
|
jsi::Object obj = arg.asObject(runtime);
|
|
68
66
|
return margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage(
|
|
69
67
|
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "glyph"))),
|
|
70
|
-
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontName"))),
|
|
71
68
|
JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color"))),
|
|
72
69
|
JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"))),
|
|
73
70
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale")))
|
|
@@ -76,7 +73,6 @@ namespace margelo::nitro {
|
|
|
76
73
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage& arg) {
|
|
77
74
|
jsi::Object obj(runtime);
|
|
78
75
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "glyph"), JSIConverter<double>::toJSI(runtime, arg.glyph));
|
|
79
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontName"), JSIConverter<std::string>::toJSI(runtime, arg.fontName));
|
|
80
76
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "color"), JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::toJSI(runtime, arg.color));
|
|
81
77
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor"), JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::toJSI(runtime, arg.backgroundColor));
|
|
82
78
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "fontScale"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.fontScale));
|
|
@@ -91,7 +87,6 @@ namespace margelo::nitro {
|
|
|
91
87
|
return false;
|
|
92
88
|
}
|
|
93
89
|
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "glyph")))) return false;
|
|
94
|
-
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontName")))) return false;
|
|
95
90
|
if (!JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color")))) return false;
|
|
96
91
|
if (!JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "backgroundColor")))) return false;
|
|
97
92
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "fontScale")))) return false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iternio/react-native-auto-play",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.14",
|
|
4
4
|
"description": "Android Auto and Apple CarPlay for react-native",
|
|
5
5
|
"main": "lib/index",
|
|
6
6
|
"module": "lib/index",
|
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"lint": "biome check src",
|
|
35
35
|
"lint-ci": "biome ci src --reporter=summary",
|
|
36
36
|
"typescript": "tsc",
|
|
37
|
+
"generate:fonts": "node ./assets/symbolFont/bundleAsset.js",
|
|
37
38
|
"specs": "nitrogen --logLevel=\"debug\"",
|
|
38
|
-
"prepare": "yarn circular && tsc && nitrogen",
|
|
39
|
+
"prepare": "yarn circular && tsc && nitrogen && npm run generate:fonts",
|
|
39
40
|
"swift:format": "swift-format format ./ios --in-place --recursive",
|
|
40
41
|
"circular": "dpdm ./src/* --circular --exit-code circular:1 --no-tree --warning=false --transform"
|
|
41
42
|
},
|
package/src/index.ts
CHANGED