@iternio/react-native-auto-play 0.3.10 → 0.3.12

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.
Files changed (134) hide show
  1. package/README.md +60 -2
  2. package/android/src/automotive/AndroidManifest.xml +1 -0
  3. package/android/src/main/AndroidManifest.xml +1 -0
  4. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoSession.kt +1 -0
  5. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +91 -0
  6. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VoiceInputManager.kt +214 -0
  7. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MapTemplate.kt +8 -1
  8. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +108 -38
  9. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/utils/BitmapCache.kt +14 -0
  10. package/ios/extensions/NitroImageExtensions.swift +10 -1
  11. package/ios/hybrid/HybridAutoPlay.swift +51 -4
  12. package/ios/hybrid/HybridMapTemplate.swift +2 -5
  13. package/ios/templates/GridTemplate.swift +7 -0
  14. package/ios/templates/MapTemplate.swift +55 -0
  15. package/ios/templates/Parser.swift +109 -11
  16. package/ios/utils/VoiceInputManager.swift +233 -0
  17. package/lib/specs/AutoPlay.nitro.d.ts +31 -1
  18. package/lib/templates/MapTemplate.d.ts +7 -1
  19. package/lib/templates/MapTemplate.js +10 -2
  20. package/lib/types/Image.d.ts +13 -0
  21. package/lib/types/Maneuver.d.ts +6 -0
  22. package/lib/utils/NitroImage.d.ts +6 -1
  23. package/lib/utils/NitroImage.js +7 -0
  24. package/lib/utils/NitroManeuver.d.ts +2 -0
  25. package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +1 -1
  26. package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +3 -1
  27. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +48 -1
  28. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +4 -0
  29. package/nitrogen/generated/android/c++/JHybridClusterSpec.cpp +4 -0
  30. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +5 -1
  31. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +5 -1
  32. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +5 -1
  33. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +5 -1
  34. package/nitrogen/generated/android/c++/JHybridMessageTemplateSpec.cpp +5 -1
  35. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +5 -1
  36. package/nitrogen/generated/android/c++/JHybridSignInTemplateSpec.cpp +5 -1
  37. package/nitrogen/generated/android/c++/JImageLane.hpp +2 -0
  38. package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +3 -1
  39. package/nitrogen/generated/android/c++/JLaneGuidance.hpp +2 -0
  40. package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +3 -1
  41. package/nitrogen/generated/android/c++/JMapTemplateConfig.hpp +8 -2
  42. package/nitrogen/generated/android/c++/JMessageTemplateConfig.hpp +7 -5
  43. package/nitrogen/generated/android/c++/JNitroAction.hpp +7 -5
  44. package/nitrogen/generated/android/c++/JNitroAttributedString.hpp +2 -0
  45. package/nitrogen/generated/android/c++/JNitroAttributedStringImage.hpp +2 -0
  46. package/nitrogen/generated/android/c++/JNitroBaseMapTemplateConfig.hpp +3 -1
  47. package/nitrogen/generated/android/c++/JNitroGridButton.hpp +2 -0
  48. package/nitrogen/generated/android/c++/JNitroImage.cpp +6 -2
  49. package/nitrogen/generated/android/c++/JNitroImage.hpp +19 -2
  50. package/nitrogen/generated/android/c++/JNitroLoadingManeuver.hpp +15 -4
  51. package/nitrogen/generated/android/c++/JNitroManeuver.hpp +3 -1
  52. package/nitrogen/generated/android/c++/JNitroMapButton.hpp +2 -0
  53. package/nitrogen/generated/android/c++/JNitroMessageManeuver.hpp +7 -5
  54. package/nitrogen/generated/android/c++/JNitroNavigationAlert.hpp +7 -5
  55. package/nitrogen/generated/android/c++/JNitroRoutingManeuver.hpp +7 -5
  56. package/nitrogen/generated/android/c++/JNitroRow.hpp +7 -5
  57. package/nitrogen/generated/android/c++/JNitroSection.hpp +3 -1
  58. package/nitrogen/generated/android/c++/JPreferredImageLane.hpp +2 -0
  59. package/nitrogen/generated/android/c++/JRemoteImage.hpp +68 -0
  60. package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +3 -1
  61. package/nitrogen/generated/android/c++/JSignInTemplateConfig.hpp +3 -1
  62. package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.cpp +30 -0
  63. package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage_RemoteImage.hpp +92 -0
  64. package/nitrogen/generated/android/c++/JVariant_PreferredImageLane_ImageLane.hpp +2 -0
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +17 -0
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MapTemplateConfig.kt +7 -4
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/MessageTemplateConfig.kt +3 -3
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroAction.kt +3 -3
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroImage.kt +14 -2
  70. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroLoadingManeuver.kt +9 -3
  71. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroMessageManeuver.kt +2 -2
  72. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroNavigationAlert.kt +3 -3
  73. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRoutingManeuver.kt +2 -2
  74. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +3 -3
  75. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/RemoteImage.kt +44 -0
  76. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/{Variant_GlyphImage_AssetImage.kt → Variant_GlyphImage_AssetImage_RemoteImage.kt} +20 -8
  77. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.cpp +16 -8
  78. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +156 -79
  79. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +4 -0
  80. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +37 -0
  81. package/nitrogen/generated/ios/c++/HybridCarPlayDashboardSpecSwift.hpp +3 -0
  82. package/nitrogen/generated/ios/c++/HybridClusterSpecSwift.hpp +3 -0
  83. package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +3 -0
  84. package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +3 -0
  85. package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +3 -0
  86. package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +3 -0
  87. package/nitrogen/generated/ios/c++/HybridMessageTemplateSpecSwift.hpp +3 -0
  88. package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +3 -0
  89. package/nitrogen/generated/ios/swift/Func_void_std__shared_ptr_ArrayBuffer_.swift +46 -0
  90. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +4 -0
  91. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +82 -0
  92. package/nitrogen/generated/ios/swift/ImageLane.swift +9 -4
  93. package/nitrogen/generated/ios/swift/MapTemplateConfig.swift +12 -1
  94. package/nitrogen/generated/ios/swift/MessageTemplateConfig.swift +16 -11
  95. package/nitrogen/generated/ios/swift/NitroAction.swift +16 -11
  96. package/nitrogen/generated/ios/swift/NitroAttributedStringImage.swift +9 -4
  97. package/nitrogen/generated/ios/swift/NitroCarPlayDashboardButton.swift +9 -4
  98. package/nitrogen/generated/ios/swift/NitroGridButton.swift +9 -4
  99. package/nitrogen/generated/ios/swift/NitroImage.swift +2 -1
  100. package/nitrogen/generated/ios/swift/NitroLoadingManeuver.swift +25 -2
  101. package/nitrogen/generated/ios/swift/NitroMapButton.swift +9 -4
  102. package/nitrogen/generated/ios/swift/NitroMessageManeuver.swift +16 -11
  103. package/nitrogen/generated/ios/swift/NitroNavigationAlert.swift +16 -11
  104. package/nitrogen/generated/ios/swift/NitroRoutingManeuver.swift +25 -15
  105. package/nitrogen/generated/ios/swift/NitroRow.swift +16 -11
  106. package/nitrogen/generated/ios/swift/PreferredImageLane.swift +9 -4
  107. package/nitrogen/generated/ios/swift/RemoteImage.swift +58 -0
  108. package/nitrogen/generated/ios/swift/{Variant_GlyphImage_AssetImage.swift → Variant_GlyphImage_AssetImage_RemoteImage.swift} +4 -3
  109. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.cpp +4 -0
  110. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +5 -0
  111. package/nitrogen/generated/shared/c++/ImageLane.hpp +8 -5
  112. package/nitrogen/generated/shared/c++/MapTemplateConfig.hpp +8 -1
  113. package/nitrogen/generated/shared/c++/MessageTemplateConfig.hpp +8 -5
  114. package/nitrogen/generated/shared/c++/NitroAction.hpp +8 -5
  115. package/nitrogen/generated/shared/c++/NitroAttributedStringImage.hpp +8 -5
  116. package/nitrogen/generated/shared/c++/NitroCarPlayDashboardButton.hpp +8 -5
  117. package/nitrogen/generated/shared/c++/NitroGridButton.hpp +8 -5
  118. package/nitrogen/generated/shared/c++/NitroLoadingManeuver.hpp +15 -4
  119. package/nitrogen/generated/shared/c++/NitroMapButton.hpp +8 -5
  120. package/nitrogen/generated/shared/c++/NitroMessageManeuver.hpp +8 -5
  121. package/nitrogen/generated/shared/c++/NitroNavigationAlert.hpp +8 -5
  122. package/nitrogen/generated/shared/c++/NitroRoutingManeuver.hpp +12 -9
  123. package/nitrogen/generated/shared/c++/NitroRow.hpp +8 -5
  124. package/nitrogen/generated/shared/c++/PreferredImageLane.hpp +8 -5
  125. package/nitrogen/generated/shared/c++/RemoteImage.hpp +94 -0
  126. package/package.json +1 -1
  127. package/src/specs/AutoPlay.nitro.ts +39 -1
  128. package/src/templates/MapTemplate.ts +23 -2
  129. package/src/types/Image.ts +14 -0
  130. package/src/types/Maneuver.ts +6 -0
  131. package/src/utils/NitroImage.ts +15 -1
  132. package/src/utils/NitroManeuver.ts +2 -0
  133. package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage.cpp +0 -26
  134. package/nitrogen/generated/android/c++/JVariant_GlyphImage_AssetImage.hpp +0 -75
@@ -34,11 +34,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct AutoText; }
34
34
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct GlyphImage; }
35
35
  // Forward declaration of `AssetImage` to properly resolve imports.
36
36
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct AssetImage; }
37
+ // Forward declaration of `RemoteImage` to properly resolve imports.
38
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct RemoteImage; }
37
39
 
38
40
  #include "AutoText.hpp"
39
41
  #include <optional>
40
42
  #include "GlyphImage.hpp"
41
43
  #include "AssetImage.hpp"
44
+ #include "RemoteImage.hpp"
42
45
  #include <variant>
43
46
  #include <functional>
44
47
 
@@ -53,14 +56,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
53
56
  std::optional<AutoText> detailedText SWIFT_PRIVATE;
54
57
  std::optional<bool> browsable SWIFT_PRIVATE;
55
58
  bool enabled SWIFT_PRIVATE;
56
- std::optional<std::variant<GlyphImage, AssetImage>> image SWIFT_PRIVATE;
59
+ std::optional<std::variant<GlyphImage, AssetImage, RemoteImage>> image SWIFT_PRIVATE;
57
60
  std::optional<bool> checked SWIFT_PRIVATE;
58
61
  std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress SWIFT_PRIVATE;
59
62
  std::optional<bool> selected SWIFT_PRIVATE;
60
63
 
61
64
  public:
62
65
  NitroRow() = default;
63
- explicit NitroRow(AutoText title, std::optional<AutoText> detailedText, std::optional<bool> browsable, bool enabled, std::optional<std::variant<GlyphImage, AssetImage>> image, std::optional<bool> checked, std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress, std::optional<bool> selected): title(title), detailedText(detailedText), browsable(browsable), enabled(enabled), image(image), checked(checked), onPress(onPress), selected(selected) {}
66
+ explicit NitroRow(AutoText title, std::optional<AutoText> detailedText, std::optional<bool> browsable, bool enabled, std::optional<std::variant<GlyphImage, AssetImage, RemoteImage>> image, std::optional<bool> checked, std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress, std::optional<bool> selected): title(title), detailedText(detailedText), browsable(browsable), enabled(enabled), image(image), checked(checked), onPress(onPress), selected(selected) {}
64
67
 
65
68
  public:
66
69
  // NitroRow is not equatable because these properties are not equatable: onPress
@@ -80,7 +83,7 @@ namespace margelo::nitro {
80
83
  JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::AutoText>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detailedText"))),
81
84
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "browsable"))),
82
85
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled"))),
83
- JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
86
+ JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
84
87
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked"))),
85
88
  JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onPress"))),
86
89
  JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected")))
@@ -92,7 +95,7 @@ namespace margelo::nitro {
92
95
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "detailedText"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::AutoText>>::toJSI(runtime, arg.detailedText));
93
96
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "browsable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.browsable));
94
97
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "enabled"), JSIConverter<bool>::toJSI(runtime, arg.enabled));
95
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>>::toJSI(runtime, arg.image));
98
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::toJSI(runtime, arg.image));
96
99
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "checked"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.checked));
97
100
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "onPress"), JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::toJSI(runtime, arg.onPress));
98
101
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "selected"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.selected));
@@ -110,7 +113,7 @@ namespace margelo::nitro {
110
113
  if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::AutoText>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "detailedText")))) return false;
111
114
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "browsable")))) return false;
112
115
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled")))) return false;
113
- if (!JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
116
+ if (!JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
114
117
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked")))) return false;
115
118
  if (!JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onPress")))) return false;
116
119
  if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected")))) return false;
@@ -32,9 +32,12 @@
32
32
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct GlyphImage; }
33
33
  // Forward declaration of `AssetImage` to properly resolve imports.
34
34
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct AssetImage; }
35
+ // Forward declaration of `RemoteImage` to properly resolve imports.
36
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct RemoteImage; }
35
37
 
36
38
  #include "GlyphImage.hpp"
37
39
  #include "AssetImage.hpp"
40
+ #include "RemoteImage.hpp"
38
41
  #include <variant>
39
42
  #include <vector>
40
43
 
@@ -45,14 +48,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
45
48
  */
46
49
  struct PreferredImageLane final {
47
50
  public:
48
- std::variant<GlyphImage, AssetImage> image SWIFT_PRIVATE;
51
+ std::variant<GlyphImage, AssetImage, RemoteImage> image SWIFT_PRIVATE;
49
52
  double highlightedAngle SWIFT_PRIVATE;
50
53
  bool isPreferred SWIFT_PRIVATE;
51
54
  std::vector<double> angles SWIFT_PRIVATE;
52
55
 
53
56
  public:
54
57
  PreferredImageLane() = default;
55
- explicit PreferredImageLane(std::variant<GlyphImage, AssetImage> image, double highlightedAngle, bool isPreferred, std::vector<double> angles): image(image), highlightedAngle(highlightedAngle), isPreferred(isPreferred), angles(angles) {}
58
+ explicit PreferredImageLane(std::variant<GlyphImage, AssetImage, RemoteImage> image, double highlightedAngle, bool isPreferred, std::vector<double> angles): image(image), highlightedAngle(highlightedAngle), isPreferred(isPreferred), angles(angles) {}
56
59
 
57
60
  public:
58
61
  friend bool operator==(const PreferredImageLane& lhs, const PreferredImageLane& rhs) = default;
@@ -68,7 +71,7 @@ namespace margelo::nitro {
68
71
  static inline margelo::nitro::swe::iternio::reactnativeautoplay::PreferredImageLane fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
69
72
  jsi::Object obj = arg.asObject(runtime);
70
73
  return margelo::nitro::swe::iternio::reactnativeautoplay::PreferredImageLane(
71
- JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
74
+ JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
72
75
  JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle"))),
73
76
  JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPreferred"))),
74
77
  JSIConverter<std::vector<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles")))
@@ -76,7 +79,7 @@ namespace margelo::nitro {
76
79
  }
77
80
  static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::PreferredImageLane& arg) {
78
81
  jsi::Object obj(runtime);
79
- obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>::toJSI(runtime, arg.image));
82
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>::toJSI(runtime, arg.image));
80
83
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle"), JSIConverter<double>::toJSI(runtime, arg.highlightedAngle));
81
84
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "isPreferred"), JSIConverter<bool>::toJSI(runtime, arg.isPreferred));
82
85
  obj.setProperty(runtime, PropNameIDCache::get(runtime, "angles"), JSIConverter<std::vector<double>>::toJSI(runtime, arg.angles));
@@ -90,7 +93,7 @@ namespace margelo::nitro {
90
93
  if (!nitro::isPlainObject(runtime, obj)) {
91
94
  return false;
92
95
  }
93
- if (!JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
96
+ if (!JSIConverter<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
94
97
  if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "highlightedAngle")))) return false;
95
98
  if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "isPreferred")))) return false;
96
99
  if (!JSIConverter<std::vector<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "angles")))) return false;
@@ -0,0 +1,94 @@
1
+ ///
2
+ /// RemoteImage.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #if __has_include(<NitroModules/JSIConverter.hpp>)
11
+ #include <NitroModules/JSIConverter.hpp>
12
+ #else
13
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
14
+ #endif
15
+ #if __has_include(<NitroModules/NitroDefines.hpp>)
16
+ #include <NitroModules/NitroDefines.hpp>
17
+ #else
18
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
19
+ #endif
20
+ #if __has_include(<NitroModules/JSIHelpers.hpp>)
21
+ #include <NitroModules/JSIHelpers.hpp>
22
+ #else
23
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
24
+ #endif
25
+ #if __has_include(<NitroModules/PropNameIDCache.hpp>)
26
+ #include <NitroModules/PropNameIDCache.hpp>
27
+ #else
28
+ #error NitroModules cannot be found! Are you sure you installed NitroModules properly?
29
+ #endif
30
+
31
+ // Forward declaration of `NitroColor` to properly resolve imports.
32
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroColor; }
33
+
34
+ #include <string>
35
+ #include "NitroColor.hpp"
36
+ #include <optional>
37
+
38
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
39
+
40
+ /**
41
+ * A struct which can be represented as a JavaScript object (RemoteImage).
42
+ */
43
+ struct RemoteImage final {
44
+ public:
45
+ std::string uri SWIFT_PRIVATE;
46
+ std::optional<NitroColor> color SWIFT_PRIVATE;
47
+ std::optional<double> timeoutMs SWIFT_PRIVATE;
48
+
49
+ public:
50
+ RemoteImage() = default;
51
+ explicit RemoteImage(std::string uri, std::optional<NitroColor> color, std::optional<double> timeoutMs): uri(uri), color(color), timeoutMs(timeoutMs) {}
52
+
53
+ public:
54
+ friend bool operator==(const RemoteImage& lhs, const RemoteImage& rhs) = default;
55
+ };
56
+
57
+ } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
58
+
59
+ namespace margelo::nitro {
60
+
61
+ // C++ RemoteImage <> JS RemoteImage (object)
62
+ template <>
63
+ struct JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage> final {
64
+ static inline margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
65
+ jsi::Object obj = arg.asObject(runtime);
66
+ return margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage(
67
+ JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri"))),
68
+ JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color"))),
69
+ JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeoutMs")))
70
+ );
71
+ }
72
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage& arg) {
73
+ jsi::Object obj(runtime);
74
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "uri"), JSIConverter<std::string>::toJSI(runtime, arg.uri));
75
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "color"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::toJSI(runtime, arg.color));
76
+ obj.setProperty(runtime, PropNameIDCache::get(runtime, "timeoutMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timeoutMs));
77
+ return obj;
78
+ }
79
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
80
+ if (!value.isObject()) {
81
+ return false;
82
+ }
83
+ jsi::Object obj = value.getObject(runtime);
84
+ if (!nitro::isPlainObject(runtime, obj)) {
85
+ return false;
86
+ }
87
+ if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "uri")))) return false;
88
+ if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::NitroColor>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "color")))) return false;
89
+ if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timeoutMs")))) return false;
90
+ return true;
91
+ }
92
+ };
93
+
94
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iternio/react-native-auto-play",
3
- "version": "0.3.10",
3
+ "version": "0.3.12",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -34,7 +34,8 @@ export interface AutoPlay extends HybridObject<{ android: 'kotlin'; ios: 'swift'
34
34
  ): CleanupCallback;
35
35
 
36
36
  /**
37
- * Adds a listener for voice input events. Not implemented on iOS.
37
+ * Adds a listener for voice input events fired by the OS (Android Auto only).
38
+ * On iOS this is a no-op — use startVoiceInput instead.
38
39
  * @param callback the callback to receive the voice input
39
40
  * @returns callback to remove the listener
40
41
  * @namespace Android
@@ -43,6 +44,43 @@ export interface AutoPlay extends HybridObject<{ android: 'kotlin'; ios: 'swift'
43
44
  callback: (coordinates: Location | undefined, query: string | undefined) => void
44
45
  ): CleanupCallback;
45
46
 
47
+ /**
48
+ * Returns true if microphone permission has already been granted.
49
+ */
50
+ hasVoiceInputPermission(): boolean;
51
+
52
+ /**
53
+ * Request microphone permission from the user.
54
+ * On Android: uses the car context when Android Auto is connected, otherwise
55
+ * falls back to the React Native application context.
56
+ * On iOS: uses AVAudioApplication (iOS 17+) or AVAudioSession (iOS 15–16).
57
+ * Returns true if permission was granted, false if denied.
58
+ */
59
+ requestVoiceInputPermission(): Promise<boolean>;
60
+
61
+ /**
62
+ * Start an in-app voice recording session.
63
+ * On Android: acquires audio focus and captures via CarAudioRecord when
64
+ * Android Auto is connected, otherwise uses standard AudioRecord.
65
+ * On iOS: presents CPVoiceControlTemplate (when a car is connected) and
66
+ * captures audio via AVAudioEngine.
67
+ * Resolves with the complete raw PCM buffer (16 kHz, 16-bit, mono) when
68
+ * silence is detected, the max duration is reached, or stopVoiceInput() is called.
69
+ * Rejects if microphone permission has not been granted or recording fails to start.
70
+ */
71
+ startVoiceInput(
72
+ silenceThresholdMs?: number,
73
+ maxDurationMs?: number,
74
+ listeningText?: string
75
+ ): Promise<ArrayBuffer>;
76
+
77
+ /**
78
+ * Stop the active voice recording session early. Causes the Promise returned
79
+ * by startVoiceInput() to resolve with the audio captured so far.
80
+ * No-op if no recording is in progress.
81
+ */
82
+ stopVoiceInput(): void;
83
+
46
84
  /**
47
85
  * sets the specified template as root template, initializes a new stack
48
86
  * Promise might contain an error message in case setting root template failed
@@ -18,6 +18,7 @@ import type {
18
18
  } from '../types/Trip';
19
19
  import { type NitroAction, NitroActionUtil } from '../utils/NitroAction';
20
20
  import { type NavigationAlert, NitroAlertUtil } from '../utils/NitroAlert';
21
+ import { type NitroColor, NitroColorUtil, type ThemedColor } from '../utils/NitroColor';
21
22
  import { NitroManeuverUtil, type NitroRoutingManeuver } from '../utils/NitroManeuver';
22
23
  import { NitroMapButton } from '../utils/NitroMapButton';
23
24
  import {
@@ -80,6 +81,8 @@ export interface NitroMapTemplateConfig extends TemplateConfig, NitroBaseMapTemp
80
81
  mapButtons?: Array<NitroMapButton>;
81
82
  headerActions?: Array<NitroAction>;
82
83
 
84
+ defaultGuidanceBackgroundColor?: NitroColor;
85
+
83
86
  /**
84
87
  * specify the percentage of screen height/width the pan button should scroll
85
88
  * @namespace iOS
@@ -131,7 +134,11 @@ export type BaseMapTemplateConfig<T> = {
131
134
 
132
135
  export type MapTemplateConfig = Omit<
133
136
  NitroMapTemplateConfig,
134
- 'mapButtons' | 'headerActions' | 'onStopNavigation' | 'onAutoDriveEnabled'
137
+ | 'mapButtons'
138
+ | 'headerActions'
139
+ | 'onStopNavigation'
140
+ | 'onAutoDriveEnabled'
141
+ | 'defaultGuidanceBackgroundColor'
135
142
  > &
136
143
  BaseMapTemplateConfig<MapTemplate> & {
137
144
  /**
@@ -150,6 +157,11 @@ export type MapTemplateConfig = Omit<
150
157
  * @namespace Android
151
158
  */
152
159
  onAutoDriveEnabled?: (template: MapTemplate) => void;
160
+
161
+ /**
162
+ * Initial navigation maneuver background color. Mainly useful, when in CarPlay the default loading maneuver does not have the right color.
163
+ */
164
+ defaultGuidanceBackgroundColor?: ThemedColor | string;
153
165
  };
154
166
 
155
167
  export interface TripSelectorCallback {
@@ -169,6 +181,7 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
169
181
  headerActions,
170
182
  onStopNavigation,
171
183
  onAutoDriveEnabled,
184
+ defaultGuidanceBackgroundColor,
172
185
  ...baseConfig
173
186
  } = config;
174
187
 
@@ -197,6 +210,10 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
197
210
  mapButtons: NitroMapButton.convert(this.template, mapButtons),
198
211
  onStopNavigation: () => onStopNavigation(this.template),
199
212
  onAutoDriveEnabled: onAutoDriveEnabled ? () => onAutoDriveEnabled(this.template) : undefined,
213
+ defaultGuidanceBackgroundColor:
214
+ defaultGuidanceBackgroundColor != null
215
+ ? NitroColorUtil.convert(defaultGuidanceBackgroundColor)
216
+ : undefined,
200
217
  };
201
218
 
202
219
  HybridMapTemplate.createMapTemplate(nitroConfig);
@@ -327,7 +344,11 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
327
344
  }
328
345
 
329
346
  if (maneuvers.type === 'loading') {
330
- HybridMapTemplate.updateManeuvers(this.id, { isLoading: true });
347
+ HybridMapTemplate.updateManeuvers(this.id, {
348
+ isLoading: true,
349
+ cardBackgroundColor: NitroColorUtil.convert(maneuvers.cardBackgroundColor),
350
+ text: maneuvers.text != null ? maneuvers.text : undefined,
351
+ });
331
352
  return;
332
353
  }
333
354
 
@@ -29,4 +29,18 @@ export type AutoImage =
29
29
  */
30
30
  color?: ThemedColor | string;
31
31
  type: 'asset';
32
+ }
33
+ | {
34
+ /** HTTPS URL to a remote image. HTTP is not supported (blocked by App Transport Security). */
35
+ uri: string;
36
+ /**
37
+ * if specified the image gets tinted, if not it will just use the original image
38
+ */
39
+ color?: ThemedColor | string;
40
+ /**
41
+ * Network timeout in milliseconds before the remote fetch is abandoned and `null` is returned.
42
+ * Defaults to 500ms when not specified.
43
+ */
44
+ timeoutMs?: number;
45
+ type: 'remote';
32
46
  };
@@ -252,6 +252,12 @@ export type MessageManeuver = {
252
252
 
253
253
  export type LoadingManeuver = {
254
254
  type: 'loading';
255
+ cardBackgroundColor: ThemedColor | string;
256
+ /**
257
+ * @namespace iOS CarPlay — shows text on the loading maneuver card
258
+ * @namespace Android Auto — not supported
259
+ */
260
+ text?: string;
255
261
  };
256
262
 
257
263
  export type AutoManeuver =
@@ -15,11 +15,17 @@ interface GlyphImage {
15
15
  fontScale?: number;
16
16
  }
17
17
 
18
+ interface RemoteImage {
19
+ uri: string;
20
+ color?: NitroColor;
21
+ timeoutMs?: number;
22
+ }
23
+
18
24
  /**
19
25
  * we need to map the ButtonImage.name from GlyphName to
20
26
  * the actual numeric value so we need a nitro specific type
21
27
  */
22
- export type NitroImage = GlyphImage | AssetImage;
28
+ export type NitroImage = GlyphImage | AssetImage | RemoteImage;
23
29
 
24
30
  function convert(image: AutoImage): NitroImage;
25
31
  function convert(image?: AutoImage): NitroImage | undefined;
@@ -44,6 +50,14 @@ function convert(image?: AutoImage): NitroImage | undefined {
44
50
  };
45
51
  }
46
52
 
53
+ if (image.type === 'remote') {
54
+ return {
55
+ uri: image.uri,
56
+ color: NitroColorUtil.convert(image.color),
57
+ timeoutMs: image.timeoutMs,
58
+ };
59
+ }
60
+
47
61
  // Image.resolveAssetSource is pretty terrible, it will simply return whatever object you pass it is not a number [require(...)]
48
62
  // so the input allows all optional parameters which are returned as is even though
49
63
  // the return type claims to not have any optional parameters...
@@ -54,6 +54,8 @@ export interface NitroMessageManeuver {
54
54
 
55
55
  interface NitroLoadingManeuver {
56
56
  isLoading: true;
57
+ cardBackgroundColor: NitroColor;
58
+ text?: string;
57
59
  }
58
60
 
59
61
  export type NitroManeuver =
@@ -1,26 +0,0 @@
1
- ///
2
- /// JVariant_GlyphImage_AssetImage.cpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- #include "JVariant_GlyphImage_AssetImage.hpp"
9
-
10
- namespace margelo::nitro::swe::iternio::reactnativeautoplay {
11
- /**
12
- * Converts JVariant_GlyphImage_AssetImage to std::variant<GlyphImage, AssetImage>
13
- */
14
- std::variant<GlyphImage, AssetImage> JVariant_GlyphImage_AssetImage::toCpp() const {
15
- if (isInstanceOf(JVariant_GlyphImage_AssetImage_impl::First::javaClassStatic())) {
16
- // It's a `GlyphImage`
17
- auto jniValue = static_cast<const JVariant_GlyphImage_AssetImage_impl::First*>(this)->getValue();
18
- return jniValue->toCpp();
19
- } else if (isInstanceOf(JVariant_GlyphImage_AssetImage_impl::Second::javaClassStatic())) {
20
- // It's a `AssetImage`
21
- auto jniValue = static_cast<const JVariant_GlyphImage_AssetImage_impl::Second*>(this)->getValue();
22
- return jniValue->toCpp();
23
- }
24
- throw std::invalid_argument("Variant is unknown Kotlin instance!");
25
- }
26
- } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -1,75 +0,0 @@
1
- ///
2
- /// JVariant_GlyphImage_AssetImage.hpp
3
- /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
- /// https://github.com/mrousavy/nitro
5
- /// Copyright © Marc Rousavy @ Margelo
6
- ///
7
-
8
- #pragma once
9
-
10
- #include <fbjni/fbjni.h>
11
- #include <variant>
12
-
13
- #include "GlyphImage.hpp"
14
- #include "AssetImage.hpp"
15
- #include <variant>
16
- #include "JGlyphImage.hpp"
17
- #include "NitroColor.hpp"
18
- #include "JNitroColor.hpp"
19
- #include <optional>
20
- #include "JAssetImage.hpp"
21
- #include <string>
22
-
23
- namespace margelo::nitro::swe::iternio::reactnativeautoplay {
24
-
25
- using namespace facebook;
26
-
27
- /**
28
- * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_GlyphImage_AssetImage".
29
- */
30
- class JVariant_GlyphImage_AssetImage: public jni::JavaClass<JVariant_GlyphImage_AssetImage> {
31
- public:
32
- static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_GlyphImage_AssetImage;";
33
-
34
- static jni::local_ref<JVariant_GlyphImage_AssetImage> create_0(jni::alias_ref<JGlyphImage> value) {
35
- static const auto method = javaClassStatic()->getStaticMethod<JVariant_GlyphImage_AssetImage(jni::alias_ref<JGlyphImage>)>("create");
36
- return method(javaClassStatic(), value);
37
- }
38
- static jni::local_ref<JVariant_GlyphImage_AssetImage> create_1(jni::alias_ref<JAssetImage> value) {
39
- static const auto method = javaClassStatic()->getStaticMethod<JVariant_GlyphImage_AssetImage(jni::alias_ref<JAssetImage>)>("create");
40
- return method(javaClassStatic(), value);
41
- }
42
-
43
- static jni::local_ref<JVariant_GlyphImage_AssetImage> fromCpp(const std::variant<GlyphImage, AssetImage>& variant) {
44
- switch (variant.index()) {
45
- case 0: return create_0(JGlyphImage::fromCpp(std::get<0>(variant)));
46
- case 1: return create_1(JAssetImage::fromCpp(std::get<1>(variant)));
47
- default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
48
- }
49
- }
50
-
51
- [[nodiscard]] std::variant<GlyphImage, AssetImage> toCpp() const;
52
- };
53
-
54
- namespace JVariant_GlyphImage_AssetImage_impl {
55
- class First final: public jni::JavaClass<First, JVariant_GlyphImage_AssetImage> {
56
- public:
57
- static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_GlyphImage_AssetImage$First;";
58
-
59
- [[nodiscard]] jni::local_ref<JGlyphImage> getValue() const {
60
- static const auto field = javaClassStatic()->getField<JGlyphImage>("value");
61
- return getFieldValue(field);
62
- }
63
- };
64
-
65
- class Second final: public jni::JavaClass<Second, JVariant_GlyphImage_AssetImage> {
66
- public:
67
- static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/Variant_GlyphImage_AssetImage$Second;";
68
-
69
- [[nodiscard]] jni::local_ref<JAssetImage> getValue() const {
70
- static const auto field = javaClassStatic()->getField<JAssetImage>("value");
71
- return getFieldValue(field);
72
- }
73
- };
74
- } // namespace JVariant_GlyphImage_AssetImage_impl
75
- } // namespace margelo::nitro::swe::iternio::reactnativeautoplay