@iternio/react-native-auto-play 0.0.9 → 0.0.11

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 (113) hide show
  1. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlay.kt +10 -9
  2. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridGridTemplate.kt +6 -3
  3. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridInformationTemplate.kt +7 -5
  4. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridListTemplate.kt +6 -3
  5. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplate.kt +6 -3
  6. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSearchTemplate.kt +6 -3
  7. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/MapTemplate.kt +10 -6
  8. package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +3 -0
  9. package/ios/hybrid/HybridAutoPlay.swift +48 -16
  10. package/ios/hybrid/HybridGridTemplate.swift +17 -10
  11. package/ios/hybrid/HybridInformationTemplate.swift +18 -10
  12. package/ios/hybrid/HybridListTemplate.swift +18 -10
  13. package/ios/hybrid/HybridMapTemplate.swift +26 -11
  14. package/ios/hybrid/HybridMessageTemplate.swift +4 -7
  15. package/ios/hybrid/HybridSearchTemplate.swift +20 -10
  16. package/ios/scenes/AutoPlayInterfaceController.swift +11 -14
  17. package/ios/scenes/AutoPlayScene.swift +1 -1
  18. package/ios/scenes/HeadUnitSceneDelegate.swift +5 -4
  19. package/ios/templates/AutoPlayTemplate.swift +3 -2
  20. package/ios/templates/GridTemplate.swift +1 -2
  21. package/ios/templates/InformationTemplate.swift +1 -2
  22. package/ios/templates/ListTemplate.swift +3 -2
  23. package/ios/templates/MapTemplate.swift +39 -33
  24. package/ios/templates/SearchTemplate.swift +11 -7
  25. package/ios/templates/TemplateStore.swift +8 -8
  26. package/ios/utils/RootModule.swift +13 -40
  27. package/lib/specs/AutoPlay.nitro.d.ts +1 -1
  28. package/lib/specs/GridTemplate.nitro.d.ts +1 -1
  29. package/lib/specs/InformationTemplate.nitro.d.ts +1 -1
  30. package/lib/specs/ListTemplate.nitro.d.ts +1 -1
  31. package/lib/specs/MapTemplate.nitro.d.ts +1 -1
  32. package/lib/specs/SearchTemplate.nitro.d.ts +1 -1
  33. package/lib/templates/GridTemplate.d.ts +1 -1
  34. package/lib/templates/GridTemplate.js +1 -1
  35. package/lib/templates/InformationTemplate.d.ts +1 -1
  36. package/lib/templates/InformationTemplate.js +1 -1
  37. package/lib/templates/ListTemplate.d.ts +1 -1
  38. package/lib/templates/ListTemplate.js +1 -1
  39. package/lib/templates/MapTemplate.d.ts +2 -2
  40. package/lib/templates/MapTemplate.js +6 -2
  41. package/lib/templates/SearchTemplate.d.ts +1 -1
  42. package/lib/templates/SearchTemplate.js +1 -1
  43. package/lib/templates/Template.d.ts +1 -1
  44. package/lib/templates/Template.js +1 -1
  45. package/lib/types/Maneuver.d.ts +5 -2
  46. package/lib/utils/NitroManeuver.d.ts +4 -1
  47. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +14 -3
  48. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +1 -1
  49. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +16 -3
  50. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.hpp +1 -1
  51. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +16 -3
  52. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.hpp +1 -1
  53. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +16 -3
  54. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.hpp +1 -1
  55. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +21 -4
  56. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.hpp +2 -2
  57. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +16 -3
  58. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.hpp +1 -1
  59. package/nitrogen/generated/android/c++/JNitroLoadingManeuver.hpp +57 -0
  60. package/nitrogen/generated/android/c++/JNitroManeuver.cpp +6 -2
  61. package/nitrogen/generated/android/c++/JNitroManeuver.hpp +19 -2
  62. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +1 -1
  63. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridGridTemplateSpec.kt +2 -1
  64. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridInformationTemplateSpec.kt +2 -1
  65. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridListTemplateSpec.kt +2 -1
  66. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +2 -1
  67. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSearchTemplateSpec.kt +2 -1
  68. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroLoadingManeuver.kt +38 -0
  69. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroManeuver.kt +15 -2
  70. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +28 -19
  71. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +3 -0
  72. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +3 -1
  73. package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +4 -1
  74. package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +4 -1
  75. package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +4 -1
  76. package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +8 -2
  77. package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +4 -1
  78. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +1 -1
  79. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +12 -4
  80. package/nitrogen/generated/ios/swift/HybridGridTemplateSpec.swift +2 -1
  81. package/nitrogen/generated/ios/swift/HybridGridTemplateSpec_cxx.swift +13 -4
  82. package/nitrogen/generated/ios/swift/HybridInformationTemplateSpec.swift +2 -1
  83. package/nitrogen/generated/ios/swift/HybridInformationTemplateSpec_cxx.swift +13 -4
  84. package/nitrogen/generated/ios/swift/HybridListTemplateSpec.swift +2 -1
  85. package/nitrogen/generated/ios/swift/HybridListTemplateSpec_cxx.swift +13 -4
  86. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec.swift +2 -1
  87. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec_cxx.swift +17 -5
  88. package/nitrogen/generated/ios/swift/HybridSearchTemplateSpec.swift +2 -1
  89. package/nitrogen/generated/ios/swift/HybridSearchTemplateSpec_cxx.swift +13 -4
  90. package/nitrogen/generated/ios/swift/NitroLoadingManeuver.swift +35 -0
  91. package/nitrogen/generated/ios/swift/NitroManeuver.swift +2 -1
  92. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +1 -1
  93. package/nitrogen/generated/shared/c++/HybridGridTemplateSpec.hpp +2 -1
  94. package/nitrogen/generated/shared/c++/HybridInformationTemplateSpec.hpp +2 -1
  95. package/nitrogen/generated/shared/c++/HybridListTemplateSpec.hpp +2 -1
  96. package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.hpp +6 -2
  97. package/nitrogen/generated/shared/c++/HybridSearchTemplateSpec.hpp +2 -1
  98. package/nitrogen/generated/shared/c++/NitroLoadingManeuver.hpp +75 -0
  99. package/package.json +1 -1
  100. package/src/specs/AutoPlay.nitro.ts +1 -1
  101. package/src/specs/GridTemplate.nitro.ts +1 -1
  102. package/src/specs/InformationTemplate.nitro.ts +1 -1
  103. package/src/specs/ListTemplate.nitro.ts +1 -1
  104. package/src/specs/MapTemplate.nitro.ts +1 -1
  105. package/src/specs/SearchTemplate.nitro.ts +4 -1
  106. package/src/templates/GridTemplate.ts +1 -1
  107. package/src/templates/InformationTemplate.ts +1 -1
  108. package/src/templates/ListTemplate.ts +1 -1
  109. package/src/templates/MapTemplate.ts +7 -2
  110. package/src/templates/SearchTemplate.ts +1 -1
  111. package/src/templates/Template.ts +1 -1
  112. package/src/types/Maneuver.ts +8 -1
  113. package/src/utils/NitroManeuver.ts +8 -1
@@ -7,6 +7,7 @@
7
7
 
8
8
  import Foundation
9
9
  import NitroModules
10
+ import NitroModules
10
11
 
11
12
  /**
12
13
  * A class implementation that bridges HybridSearchTemplateSpec over to C++.
@@ -129,13 +130,21 @@ open class HybridSearchTemplateSpec_cxx {
129
130
  }
130
131
 
131
132
  @inline(__always)
132
- public final func updateSearchResults(templateId: std.string, results: NitroSection) -> bridge.Result_void_ {
133
+ public final func updateSearchResults(templateId: std.string, results: NitroSection) -> bridge.Result_std__shared_ptr_Promise_void___ {
133
134
  do {
134
- try self.__implementation.updateSearchResults(templateId: String(templateId), results: results)
135
- return bridge.create_Result_void_()
135
+ let __result = try self.__implementation.updateSearchResults(templateId: String(templateId), results: results)
136
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
137
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
138
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
139
+ __result
140
+ .then({ __result in __promiseHolder.resolve() })
141
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
142
+ return __promise
143
+ }()
144
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
136
145
  } catch (let __error) {
137
146
  let __exceptionPtr = __error.toCpp()
138
- return bridge.create_Result_void_(__exceptionPtr)
147
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
139
148
  }
140
149
  }
141
150
  }
@@ -0,0 +1,35 @@
1
+ ///
2
+ /// NitroLoadingManeuver.swift
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ import NitroModules
9
+
10
+ /**
11
+ * Represents an instance of `NitroLoadingManeuver`, backed by a C++ struct.
12
+ */
13
+ public typealias NitroLoadingManeuver = margelo.nitro.swe.iternio.reactnativeautoplay.NitroLoadingManeuver
14
+
15
+ public extension NitroLoadingManeuver {
16
+ private typealias bridge = margelo.nitro.swe.iternio.reactnativeautoplay.bridge.swift
17
+
18
+ /**
19
+ * Create a new instance of `NitroLoadingManeuver`.
20
+ */
21
+ init(isLoading: Bool) {
22
+ self.init(isLoading)
23
+ }
24
+
25
+ var isLoading: Bool {
26
+ @inline(__always)
27
+ get {
28
+ return self.__isLoading
29
+ }
30
+ @inline(__always)
31
+ set {
32
+ self.__isLoading = newValue
33
+ }
34
+ }
35
+ }
@@ -9,10 +9,11 @@
9
9
 
10
10
  /**
11
11
  * An Swift enum with associated values representing a Variant/Union type.
12
- * JS type: `array | struct`
12
+ * JS type: `array | struct | struct`
13
13
  */
14
14
  @frozen
15
15
  public indirect enum NitroManeuver {
16
16
  case first([NitroRoutingManeuver])
17
17
  case second(NitroMessageManeuver)
18
+ case third(NitroLoadingManeuver)
18
19
  }
@@ -71,7 +71,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
71
71
  virtual std::shared_ptr<Promise<void>> popToRootTemplate(std::optional<bool> animate) = 0;
72
72
  virtual std::shared_ptr<Promise<void>> popToTemplate(const std::string& templateId, std::optional<bool> animate) = 0;
73
73
  virtual std::function<void()> addSafeAreaInsetsListener(const std::string& moduleName, const std::function<void(const SafeAreaInsets& /* insets */)>& callback) = 0;
74
- virtual void setTemplateHeaderActions(const std::string& templateId, const std::optional<std::vector<NitroAction>>& headerActions) = 0;
74
+ virtual std::shared_ptr<Promise<void>> setTemplateHeaderActions(const std::string& templateId, const std::optional<std::vector<NitroAction>>& headerActions) = 0;
75
75
  virtual bool isConnected() = 0;
76
76
 
77
77
  protected:
@@ -19,6 +19,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct GridTemplat
19
19
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroGridButton; }
20
20
 
21
21
  #include "GridTemplateConfig.hpp"
22
+ #include <NitroModules/Promise.hpp>
22
23
  #include <string>
23
24
  #include "NitroGridButton.hpp"
24
25
  #include <vector>
@@ -55,7 +56,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
55
56
  public:
56
57
  // Methods
57
58
  virtual void createGridTemplate(const GridTemplateConfig& config) = 0;
58
- virtual void updateGridTemplateButtons(const std::string& templateId, const std::vector<NitroGridButton>& buttons) = 0;
59
+ virtual std::shared_ptr<Promise<void>> updateGridTemplateButtons(const std::string& templateId, const std::vector<NitroGridButton>& buttons) = 0;
59
60
 
60
61
  protected:
61
62
  // Hybrid Setup
@@ -19,6 +19,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct Information
19
19
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
20
20
 
21
21
  #include "InformationTemplateConfig.hpp"
22
+ #include <NitroModules/Promise.hpp>
22
23
  #include <string>
23
24
  #include "NitroSection.hpp"
24
25
 
@@ -54,7 +55,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
54
55
  public:
55
56
  // Methods
56
57
  virtual void createInformationTemplate(const InformationTemplateConfig& config) = 0;
57
- virtual void updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) = 0;
58
+ virtual std::shared_ptr<Promise<void>> updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) = 0;
58
59
 
59
60
  protected:
60
61
  // Hybrid Setup
@@ -19,6 +19,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct ListTemplat
19
19
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
20
20
 
21
21
  #include "ListTemplateConfig.hpp"
22
+ #include <NitroModules/Promise.hpp>
22
23
  #include <string>
23
24
  #include "NitroSection.hpp"
24
25
  #include <vector>
@@ -56,7 +57,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
56
57
  public:
57
58
  // Methods
58
59
  virtual void createListTemplate(const ListTemplateConfig& config) = 0;
59
- virtual void updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) = 0;
60
+ virtual std::shared_ptr<Promise<void>> updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) = 0;
60
61
 
61
62
  protected:
62
63
  // Hybrid Setup
@@ -35,6 +35,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripPoint;
35
35
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRoutingManeuver; }
36
36
  // Forward declaration of `NitroMessageManeuver` to properly resolve imports.
37
37
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroMessageManeuver; }
38
+ // Forward declaration of `NitroLoadingManeuver` to properly resolve imports.
39
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroLoadingManeuver; }
38
40
  // Forward declaration of `TripConfig` to properly resolve imports.
39
41
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripConfig; }
40
42
 
@@ -49,10 +51,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripConfig;
49
51
  #include "TripPreviewTextConfiguration.hpp"
50
52
  #include <functional>
51
53
  #include "NitroMapButton.hpp"
54
+ #include <NitroModules/Promise.hpp>
52
55
  #include "VisibleTravelEstimate.hpp"
53
56
  #include "TripPoint.hpp"
54
57
  #include "NitroRoutingManeuver.hpp"
55
58
  #include "NitroMessageManeuver.hpp"
59
+ #include "NitroLoadingManeuver.hpp"
56
60
  #include <variant>
57
61
  #include "TripConfig.hpp"
58
62
 
@@ -93,10 +97,10 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
93
97
  virtual void dismissNavigationAlert(const std::string& templateId, double navigationAlertId) = 0;
94
98
  virtual TripSelectorCallback showTripSelector(const std::string& templateId, const std::vector<TripsConfig>& trips, const std::optional<std::string>& selectedTripId, const TripPreviewTextConfiguration& textConfig, const std::function<void(const std::string& /* tripId */, const std::string& /* routeId */)>& onTripSelected, const std::function<void(const std::string& /* tripId */, const std::string& /* routeId */)>& onTripStarted, const std::function<void()>& onBackPressed, const std::vector<NitroMapButton>& mapButtons) = 0;
95
99
  virtual void hideTripSelector(const std::string& templateId) = 0;
96
- virtual void setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) = 0;
100
+ virtual std::shared_ptr<Promise<void>> setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) = 0;
97
101
  virtual void updateVisibleTravelEstimate(const std::string& templateId, VisibleTravelEstimate visibleTravelEstimate) = 0;
98
102
  virtual void updateTravelEstimates(const std::string& templateId, const std::vector<TripPoint>& steps) = 0;
99
- virtual void updateManeuvers(const std::string& templateId, const std::variant<std::vector<NitroRoutingManeuver>, NitroMessageManeuver>& maneuvers) = 0;
103
+ virtual void updateManeuvers(const std::string& templateId, const std::variant<std::vector<NitroRoutingManeuver>, NitroMessageManeuver, NitroLoadingManeuver>& maneuvers) = 0;
100
104
  virtual void startNavigation(const std::string& templateId, const TripConfig& trip) = 0;
101
105
  virtual void stopNavigation(const std::string& templateId) = 0;
102
106
 
@@ -19,6 +19,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct SearchTempl
19
19
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
20
20
 
21
21
  #include "SearchTemplateConfig.hpp"
22
+ #include <NitroModules/Promise.hpp>
22
23
  #include <string>
23
24
  #include "NitroSection.hpp"
24
25
 
@@ -54,7 +55,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
54
55
  public:
55
56
  // Methods
56
57
  virtual void createSearchTemplate(const SearchTemplateConfig& config) = 0;
57
- virtual void updateSearchResults(const std::string& templateId, const NitroSection& results) = 0;
58
+ virtual std::shared_ptr<Promise<void>> updateSearchResults(const std::string& templateId, const NitroSection& results) = 0;
58
59
 
59
60
  protected:
60
61
  // Hybrid Setup
@@ -0,0 +1,75 @@
1
+ ///
2
+ /// NitroLoadingManeuver.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © 2025 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
+
26
+
27
+
28
+
29
+
30
+ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
31
+
32
+ /**
33
+ * A struct which can be represented as a JavaScript object (NitroLoadingManeuver).
34
+ */
35
+ struct NitroLoadingManeuver {
36
+ public:
37
+ bool isLoading SWIFT_PRIVATE;
38
+
39
+ public:
40
+ NitroLoadingManeuver() = default;
41
+ explicit NitroLoadingManeuver(bool isLoading): isLoading(isLoading) {}
42
+ };
43
+
44
+ } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
45
+
46
+ namespace margelo::nitro {
47
+
48
+ // C++ NitroLoadingManeuver <> JS NitroLoadingManeuver (object)
49
+ template <>
50
+ struct JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver> final {
51
+ static inline margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
52
+ jsi::Object obj = arg.asObject(runtime);
53
+ return margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver(
54
+ JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, "isLoading"))
55
+ );
56
+ }
57
+ static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::NitroLoadingManeuver& arg) {
58
+ jsi::Object obj(runtime);
59
+ obj.setProperty(runtime, "isLoading", JSIConverter<bool>::toJSI(runtime, arg.isLoading));
60
+ return obj;
61
+ }
62
+ static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
63
+ if (!value.isObject()) {
64
+ return false;
65
+ }
66
+ jsi::Object obj = value.getObject(runtime);
67
+ if (!nitro::isPlainObject(runtime, obj)) {
68
+ return false;
69
+ }
70
+ if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, "isLoading"))) return false;
71
+ return true;
72
+ }
73
+ };
74
+
75
+ } // namespace margelo::nitro
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iternio/react-native-auto-play",
3
- "version": "0.0.9",
3
+ "version": "0.0.11",
4
4
  "description": "Android Auto and Apple CarPlay for react-native",
5
5
  "main": "lib/index",
6
6
  "module": "lib/index",
@@ -68,7 +68,7 @@ export interface AutoPlay extends HybridObject<{ android: 'kotlin'; ios: 'swift'
68
68
  /**
69
69
  * update a templates headerActions
70
70
  */
71
- setTemplateHeaderActions(templateId: string, headerActions?: Array<NitroAction>): void;
71
+ setTemplateHeaderActions(templateId: string, headerActions?: Array<NitroAction>): Promise<void>;
72
72
 
73
73
  /**
74
74
  * Check if AutoPlay is connected.
@@ -7,5 +7,5 @@ interface GridTemplateConfig extends NitroTemplateConfig, NitroGridTemplateConfi
7
7
 
8
8
  export interface GridTemplate extends HybridObject<{ android: 'kotlin'; ios: 'swift' }> {
9
9
  createGridTemplate(config: GridTemplateConfig): void;
10
- updateGridTemplateButtons(templateId: string, buttons: Array<NitroGridButton>): void;
10
+ updateGridTemplateButtons(templateId: string, buttons: Array<NitroGridButton>): Promise<void>;
11
11
  }
@@ -9,5 +9,5 @@ export interface InformationTemplate extends HybridObject<{ android: 'kotlin'; i
9
9
  updateInformationTemplateSections(
10
10
  templateId: string,
11
11
  section: NitroInformationTemplateConfig['section']
12
- ): void;
12
+ ): Promise<void>;
13
13
  }
@@ -9,5 +9,5 @@ export interface ListTemplate extends HybridObject<{ android: 'kotlin'; ios: 'sw
9
9
  updateListTemplateSections(
10
10
  templateId: string,
11
11
  sections: NitroListTemplateConfig['sections']
12
- ): void;
12
+ ): Promise<void>;
13
13
  }
@@ -39,7 +39,7 @@ export interface MapTemplate extends HybridObject<{ android: 'kotlin'; ios: 'swi
39
39
  mapButtons: Array<NitroMapButton>
40
40
  ): TripSelectorCallback;
41
41
  hideTripSelector(templateId: string): void;
42
- setTemplateMapButtons(templateId: string, buttons?: Array<NitroMapButton>): void;
42
+ setTemplateMapButtons(templateId: string, buttons?: Array<NitroMapButton>): Promise<void>;
43
43
  updateVisibleTravelEstimate(
44
44
  templateId: string,
45
45
  visibleTravelEstimate: VisibleTravelEstimate
@@ -6,5 +6,8 @@ interface SearchTemplateConfig extends NitroTemplateConfig, NitroSearchTemplateC
6
6
 
7
7
  export interface SearchTemplate extends HybridObject<{ android: 'kotlin'; ios: 'swift' }> {
8
8
  createSearchTemplate(config: SearchTemplateConfig): void;
9
- updateSearchResults(templateId: string, results: NitroSearchTemplateConfig['results']): void;
9
+ updateSearchResults(
10
+ templateId: string,
11
+ results: NitroSearchTemplateConfig['results']
12
+ ): Promise<void>;
10
13
  }
@@ -65,7 +65,7 @@ export class GridTemplate extends Template<GridTemplateConfig, HeaderActions<Gri
65
65
  }
66
66
 
67
67
  public updateGrid(buttons: Array<GridButton<GridTemplate>>) {
68
- HybridGridTemplate.updateGridTemplateButtons(
68
+ return HybridGridTemplate.updateGridTemplateButtons(
69
69
  this.id,
70
70
  NitroGridUtil.convert(this.template, buttons)
71
71
  );
@@ -116,7 +116,7 @@ export class InformationTemplate extends Template<
116
116
 
117
117
  public updateItems(items?: InformationItems) {
118
118
  const section = this.getSection(items);
119
- HybridInformationTemplate.updateInformationTemplateSections(
119
+ return HybridInformationTemplate.updateInformationTemplateSections(
120
120
  this.id,
121
121
  NitroSectionUtil.convert(this.template, section)?.at(0) ?? { items: [], type: 'default' }
122
122
  );
@@ -122,7 +122,7 @@ export class ListTemplate extends Template<ListTemplateConfig, HeaderActions<Lis
122
122
  }
123
123
 
124
124
  public updateSections(sections?: Section<ListTemplate>) {
125
- HybridListTemplate.updateListTemplateSections(
125
+ return HybridListTemplate.updateListTemplateSections(
126
126
  this.id,
127
127
  NitroSectionUtil.convert(this.template, sections)
128
128
  );
@@ -198,12 +198,12 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
198
198
 
199
199
  public setMapButtons(mapButtons: MapTemplateConfig['mapButtons']) {
200
200
  const buttons = NitroMapButton.convert(this.template, mapButtons);
201
- HybridMapTemplate.setTemplateMapButtons(this.id, buttons);
201
+ return HybridMapTemplate.setTemplateMapButtons(this.id, buttons);
202
202
  }
203
203
 
204
204
  public override setHeaderActions(headerActions: MapTemplateConfig['headerActions']) {
205
205
  const nitroActions = NitroActionUtil.convert(this.template, headerActions);
206
- HybridAutoPlay.setTemplateHeaderActions(this.id, nitroActions);
206
+ return HybridAutoPlay.setTemplateHeaderActions(this.id, nitroActions);
207
207
  }
208
208
 
209
209
  /**
@@ -320,6 +320,11 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
320
320
  return;
321
321
  }
322
322
 
323
+ if (maneuvers.type === 'loading') {
324
+ HybridMapTemplate.updateManeuvers(this.id, { isLoading: true });
325
+ return;
326
+ }
327
+
323
328
  const messageManeuver = NitroManeuverUtil.convert(maneuvers);
324
329
  HybridMapTemplate.updateManeuvers(this.id, messageManeuver);
325
330
  }
@@ -87,7 +87,7 @@ export class SearchTemplate extends Template<SearchTemplateConfig, HeaderActions
87
87
  }
88
88
 
89
89
  public updateSearchResults(results?: SingleSection<SearchTemplate>) {
90
- HybridSearchTemplate.updateSearchResults(
90
+ return HybridSearchTemplate.updateSearchResults(
91
91
  this.id,
92
92
  NitroSectionUtil.convert(this.template, results)?.at(0) ?? {
93
93
  items: [],
@@ -104,6 +104,6 @@ export class Template<TemplateConfigType, ActionsType> {
104
104
 
105
105
  public setHeaderActions<T>(headerActions?: ActionsType) {
106
106
  const nitroActions = NitroActionUtil.convert(headerActions as HeaderActions<T>);
107
- HybridAutoPlay.setTemplateHeaderActions(this.id, nitroActions);
107
+ return HybridAutoPlay.setTemplateHeaderActions(this.id, nitroActions);
108
108
  }
109
109
  }
@@ -237,4 +237,11 @@ export type MessageManeuver = {
237
237
  type: 'message';
238
238
  };
239
239
 
240
- export type AutoManeuver = (Array<RoutingManeuver> & { length: 1 | 2 }) | MessageManeuver;
240
+ export type LoadingManeuver = {
241
+ type: 'loading';
242
+ };
243
+
244
+ export type AutoManeuver =
245
+ | (Array<RoutingManeuver> & { length: 0 | 1 | 2 })
246
+ | MessageManeuver
247
+ | LoadingManeuver;
@@ -52,7 +52,14 @@ export interface NitroMessageManeuver {
52
52
  cardBackgroundColor: NitroColor;
53
53
  }
54
54
 
55
- export type NitroManeuver = Array<NitroRoutingManeuver> | NitroMessageManeuver;
55
+ interface NitroLoadingManeuver {
56
+ isLoading: true;
57
+ }
58
+
59
+ export type NitroManeuver =
60
+ | Array<NitroRoutingManeuver>
61
+ | NitroMessageManeuver
62
+ | NitroLoadingManeuver;
56
63
 
57
64
  function convertManeuverImage(image: ManeuverImage): NitroImage;
58
65
  function convertManeuverImage(image: ManeuverImage | undefined): NitroImage | undefined;