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

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 (98) 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/ios/hybrid/HybridAutoPlay.swift +48 -16
  8. package/ios/hybrid/HybridGridTemplate.swift +17 -10
  9. package/ios/hybrid/HybridInformationTemplate.swift +18 -10
  10. package/ios/hybrid/HybridListTemplate.swift +18 -10
  11. package/ios/hybrid/HybridMapTemplate.swift +20 -12
  12. package/ios/hybrid/HybridMessageTemplate.swift +4 -7
  13. package/ios/hybrid/HybridSearchTemplate.swift +20 -10
  14. package/ios/scenes/AutoPlayInterfaceController.swift +11 -14
  15. package/ios/scenes/AutoPlayScene.swift +1 -1
  16. package/ios/scenes/HeadUnitSceneDelegate.swift +5 -4
  17. package/ios/templates/AutoPlayTemplate.swift +3 -2
  18. package/ios/templates/GridTemplate.swift +1 -2
  19. package/ios/templates/InformationTemplate.swift +1 -2
  20. package/ios/templates/ListTemplate.swift +3 -2
  21. package/ios/templates/MapTemplate.swift +37 -32
  22. package/ios/templates/SearchTemplate.swift +11 -7
  23. package/ios/templates/TemplateStore.swift +8 -8
  24. package/ios/utils/RootModule.swift +13 -40
  25. package/lib/specs/AutoPlay.nitro.d.ts +1 -1
  26. package/lib/specs/GridTemplate.nitro.d.ts +1 -1
  27. package/lib/specs/InformationTemplate.nitro.d.ts +1 -1
  28. package/lib/specs/ListTemplate.nitro.d.ts +1 -1
  29. package/lib/specs/MapTemplate.nitro.d.ts +1 -1
  30. package/lib/specs/SearchTemplate.nitro.d.ts +1 -1
  31. package/lib/templates/GridTemplate.d.ts +1 -1
  32. package/lib/templates/GridTemplate.js +1 -1
  33. package/lib/templates/InformationTemplate.d.ts +1 -1
  34. package/lib/templates/InformationTemplate.js +1 -1
  35. package/lib/templates/ListTemplate.d.ts +1 -1
  36. package/lib/templates/ListTemplate.js +1 -1
  37. package/lib/templates/MapTemplate.d.ts +2 -2
  38. package/lib/templates/MapTemplate.js +2 -2
  39. package/lib/templates/SearchTemplate.d.ts +1 -1
  40. package/lib/templates/SearchTemplate.js +1 -1
  41. package/lib/templates/Template.d.ts +1 -1
  42. package/lib/templates/Template.js +1 -1
  43. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.cpp +14 -3
  44. package/nitrogen/generated/android/c++/JHybridAutoPlaySpec.hpp +1 -1
  45. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +16 -3
  46. package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.hpp +1 -1
  47. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +16 -3
  48. package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.hpp +1 -1
  49. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +16 -3
  50. package/nitrogen/generated/android/c++/JHybridListTemplateSpec.hpp +1 -1
  51. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +16 -3
  52. package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.hpp +1 -1
  53. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +16 -3
  54. package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.hpp +1 -1
  55. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridAutoPlaySpec.kt +1 -1
  56. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridGridTemplateSpec.kt +2 -1
  57. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridInformationTemplateSpec.kt +2 -1
  58. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridListTemplateSpec.kt +2 -1
  59. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +2 -1
  60. package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridSearchTemplateSpec.kt +2 -1
  61. package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +9 -9
  62. package/nitrogen/generated/ios/c++/HybridAutoPlaySpecSwift.hpp +3 -1
  63. package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +4 -1
  64. package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +4 -1
  65. package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +4 -1
  66. package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +4 -1
  67. package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +4 -1
  68. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec.swift +1 -1
  69. package/nitrogen/generated/ios/swift/HybridAutoPlaySpec_cxx.swift +12 -4
  70. package/nitrogen/generated/ios/swift/HybridGridTemplateSpec.swift +2 -1
  71. package/nitrogen/generated/ios/swift/HybridGridTemplateSpec_cxx.swift +13 -4
  72. package/nitrogen/generated/ios/swift/HybridInformationTemplateSpec.swift +2 -1
  73. package/nitrogen/generated/ios/swift/HybridInformationTemplateSpec_cxx.swift +13 -4
  74. package/nitrogen/generated/ios/swift/HybridListTemplateSpec.swift +2 -1
  75. package/nitrogen/generated/ios/swift/HybridListTemplateSpec_cxx.swift +13 -4
  76. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec.swift +2 -1
  77. package/nitrogen/generated/ios/swift/HybridMapTemplateSpec_cxx.swift +13 -4
  78. package/nitrogen/generated/ios/swift/HybridSearchTemplateSpec.swift +2 -1
  79. package/nitrogen/generated/ios/swift/HybridSearchTemplateSpec_cxx.swift +13 -4
  80. package/nitrogen/generated/shared/c++/HybridAutoPlaySpec.hpp +1 -1
  81. package/nitrogen/generated/shared/c++/HybridGridTemplateSpec.hpp +2 -1
  82. package/nitrogen/generated/shared/c++/HybridInformationTemplateSpec.hpp +2 -1
  83. package/nitrogen/generated/shared/c++/HybridListTemplateSpec.hpp +2 -1
  84. package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.hpp +2 -1
  85. package/nitrogen/generated/shared/c++/HybridSearchTemplateSpec.hpp +2 -1
  86. package/package.json +1 -1
  87. package/src/specs/AutoPlay.nitro.ts +1 -1
  88. package/src/specs/GridTemplate.nitro.ts +1 -1
  89. package/src/specs/InformationTemplate.nitro.ts +1 -1
  90. package/src/specs/ListTemplate.nitro.ts +1 -1
  91. package/src/specs/MapTemplate.nitro.ts +1 -1
  92. package/src/specs/SearchTemplate.nitro.ts +4 -1
  93. package/src/templates/GridTemplate.ts +1 -1
  94. package/src/templates/InformationTemplate.ts +1 -1
  95. package/src/templates/ListTemplate.ts +1 -1
  96. package/src/templates/MapTemplate.ts +2 -2
  97. package/src/templates/SearchTemplate.ts +1 -1
  98. package/src/templates/Template.ts +1 -1
@@ -42,6 +42,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroMapBut
42
42
  // Forward declaration of `NitroMapButtonType` to properly resolve imports.
43
43
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMapButtonType; }
44
44
 
45
+ #include <NitroModules/Promise.hpp>
46
+ #include <NitroModules/JPromise.hpp>
45
47
  #include "InformationTemplateConfig.hpp"
46
48
  #include "JInformationTemplateConfig.hpp"
47
49
  #include <string>
@@ -123,9 +125,20 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
123
125
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JInformationTemplateConfig> /* config */)>("createInformationTemplate");
124
126
  method(_javaPart, JInformationTemplateConfig::fromCpp(config));
125
127
  }
126
- void JHybridInformationTemplateSpec::updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) {
127
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroSection> /* section */)>("updateInformationTemplateSections");
128
- method(_javaPart, jni::make_jstring(templateId), JNitroSection::fromCpp(section));
128
+ std::shared_ptr<Promise<void>> JHybridInformationTemplateSpec::updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) {
129
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroSection> /* section */)>("updateInformationTemplateSections");
130
+ auto __result = method(_javaPart, jni::make_jstring(templateId), JNitroSection::fromCpp(section));
131
+ return [&]() {
132
+ auto __promise = Promise<void>::create();
133
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
134
+ __promise->resolve();
135
+ });
136
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
137
+ jni::JniException __jniError(__throwable);
138
+ __promise->reject(std::make_exception_ptr(__jniError));
139
+ });
140
+ return __promise;
141
+ }();
129
142
  }
130
143
 
131
144
  } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -55,7 +55,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
55
55
  public:
56
56
  // Methods
57
57
  void createInformationTemplate(const InformationTemplateConfig& config) override;
58
- void updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) override;
58
+ std::shared_ptr<Promise<void>> updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) override;
59
59
 
60
60
  private:
61
61
  friend HybridBase;
@@ -42,6 +42,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroMapBut
42
42
  // Forward declaration of `NitroMapButtonType` to properly resolve imports.
43
43
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMapButtonType; }
44
44
 
45
+ #include <NitroModules/Promise.hpp>
46
+ #include <NitroModules/JPromise.hpp>
45
47
  #include "ListTemplateConfig.hpp"
46
48
  #include "JListTemplateConfig.hpp"
47
49
  #include <string>
@@ -123,9 +125,9 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
123
125
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JListTemplateConfig> /* config */)>("createListTemplate");
124
126
  method(_javaPart, JListTemplateConfig::fromCpp(config));
125
127
  }
126
- void JHybridListTemplateSpec::updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) {
127
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<jni::JArrayClass<JNitroSection>> /* sections */)>("updateListTemplateSections");
128
- method(_javaPart, jni::make_jstring(templateId), sections.has_value() ? [&]() {
128
+ std::shared_ptr<Promise<void>> JHybridListTemplateSpec::updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) {
129
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<jni::JArrayClass<JNitroSection>> /* sections */)>("updateListTemplateSections");
130
+ auto __result = method(_javaPart, jni::make_jstring(templateId), sections.has_value() ? [&]() {
129
131
  size_t __size = sections.value().size();
130
132
  jni::local_ref<jni::JArrayClass<JNitroSection>> __array = jni::JArrayClass<JNitroSection>::newArray(__size);
131
133
  for (size_t __i = 0; __i < __size; __i++) {
@@ -135,6 +137,17 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
135
137
  }
136
138
  return __array;
137
139
  }() : nullptr);
140
+ return [&]() {
141
+ auto __promise = Promise<void>::create();
142
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
143
+ __promise->resolve();
144
+ });
145
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
146
+ jni::JniException __jniError(__throwable);
147
+ __promise->reject(std::make_exception_ptr(__jniError));
148
+ });
149
+ return __promise;
150
+ }();
138
151
  }
139
152
 
140
153
  } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -55,7 +55,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
55
55
  public:
56
56
  // Methods
57
57
  void createListTemplate(const ListTemplateConfig& config) override;
58
- void updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) override;
58
+ std::shared_ptr<Promise<void>> updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) override;
59
59
 
60
60
  private:
61
61
  friend HybridBase;
@@ -97,6 +97,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripConfig;
97
97
  #include <string>
98
98
  #include <functional>
99
99
  #include "JFunc_void_std__string.hpp"
100
+ #include <NitroModules/Promise.hpp>
101
+ #include <NitroModules/JPromise.hpp>
100
102
  #include "MapTemplateConfig.hpp"
101
103
  #include "JMapTemplateConfig.hpp"
102
104
  #include <optional>
@@ -271,9 +273,9 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
271
273
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */)>("hideTripSelector");
272
274
  method(_javaPart, jni::make_jstring(templateId));
273
275
  }
274
- void JHybridMapTemplateSpec::setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) {
275
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<jni::JArrayClass<JNitroMapButton>> /* buttons */)>("setTemplateMapButtons");
276
- method(_javaPart, jni::make_jstring(templateId), buttons.has_value() ? [&]() {
276
+ std::shared_ptr<Promise<void>> JHybridMapTemplateSpec::setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) {
277
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<jni::JArrayClass<JNitroMapButton>> /* buttons */)>("setTemplateMapButtons");
278
+ auto __result = method(_javaPart, jni::make_jstring(templateId), buttons.has_value() ? [&]() {
277
279
  size_t __size = buttons.value().size();
278
280
  jni::local_ref<jni::JArrayClass<JNitroMapButton>> __array = jni::JArrayClass<JNitroMapButton>::newArray(__size);
279
281
  for (size_t __i = 0; __i < __size; __i++) {
@@ -283,6 +285,17 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
283
285
  }
284
286
  return __array;
285
287
  }() : nullptr);
288
+ return [&]() {
289
+ auto __promise = Promise<void>::create();
290
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
291
+ __promise->resolve();
292
+ });
293
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
294
+ jni::JniException __jniError(__throwable);
295
+ __promise->reject(std::make_exception_ptr(__jniError));
296
+ });
297
+ return __promise;
298
+ }();
286
299
  }
287
300
  void JHybridMapTemplateSpec::updateVisibleTravelEstimate(const std::string& templateId, VisibleTravelEstimate visibleTravelEstimate) {
288
301
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JVisibleTravelEstimate> /* visibleTravelEstimate */)>("updateVisibleTravelEstimate");
@@ -60,7 +60,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
60
60
  void dismissNavigationAlert(const std::string& templateId, double navigationAlertId) override;
61
61
  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) override;
62
62
  void hideTripSelector(const std::string& templateId) override;
63
- void setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) override;
63
+ std::shared_ptr<Promise<void>> setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) override;
64
64
  void updateVisibleTravelEstimate(const std::string& templateId, VisibleTravelEstimate visibleTravelEstimate) override;
65
65
  void updateTravelEstimates(const std::string& templateId, const std::vector<TripPoint>& steps) override;
66
66
  void updateManeuvers(const std::string& templateId, const std::variant<std::vector<NitroRoutingManeuver>, NitroMessageManeuver>& maneuvers) override;
@@ -36,6 +36,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRow; }
36
36
  // Forward declaration of `NitroSectionType` to properly resolve imports.
37
37
  namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSectionType; }
38
38
 
39
+ #include <NitroModules/Promise.hpp>
40
+ #include <NitroModules/JPromise.hpp>
39
41
  #include "SearchTemplateConfig.hpp"
40
42
  #include "JSearchTemplateConfig.hpp"
41
43
  #include <string>
@@ -110,9 +112,20 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
110
112
  static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JSearchTemplateConfig> /* config */)>("createSearchTemplate");
111
113
  method(_javaPart, JSearchTemplateConfig::fromCpp(config));
112
114
  }
113
- void JHybridSearchTemplateSpec::updateSearchResults(const std::string& templateId, const NitroSection& results) {
114
- static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroSection> /* results */)>("updateSearchResults");
115
- method(_javaPart, jni::make_jstring(templateId), JNitroSection::fromCpp(results));
115
+ std::shared_ptr<Promise<void>> JHybridSearchTemplateSpec::updateSearchResults(const std::string& templateId, const NitroSection& results) {
116
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroSection> /* results */)>("updateSearchResults");
117
+ auto __result = method(_javaPart, jni::make_jstring(templateId), JNitroSection::fromCpp(results));
118
+ return [&]() {
119
+ auto __promise = Promise<void>::create();
120
+ __result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
121
+ __promise->resolve();
122
+ });
123
+ __result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
124
+ jni::JniException __jniError(__throwable);
125
+ __promise->reject(std::make_exception_ptr(__jniError));
126
+ });
127
+ return __promise;
128
+ }();
116
129
  }
117
130
 
118
131
  } // namespace margelo::nitro::swe::iternio::reactnativeautoplay
@@ -55,7 +55,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
55
55
  public:
56
56
  // Methods
57
57
  void createSearchTemplate(const SearchTemplateConfig& config) override;
58
- void updateSearchResults(const std::string& templateId, const NitroSection& results) override;
58
+ std::shared_ptr<Promise<void>> updateSearchResults(const std::string& templateId, const NitroSection& results) override;
59
59
 
60
60
  private:
61
61
  friend HybridBase;
@@ -95,7 +95,7 @@ abstract class HybridAutoPlaySpec: HybridObject() {
95
95
 
96
96
  @DoNotStrip
97
97
  @Keep
98
- abstract fun setTemplateHeaderActions(templateId: String, headerActions: Array<NitroAction>?): Unit
98
+ abstract fun setTemplateHeaderActions(templateId: String, headerActions: Array<NitroAction>?): Promise<Unit>
99
99
 
100
100
  @DoNotStrip
101
101
  @Keep
@@ -10,6 +10,7 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -51,7 +52,7 @@ abstract class HybridGridTemplateSpec: HybridObject() {
51
52
 
52
53
  @DoNotStrip
53
54
  @Keep
54
- abstract fun updateGridTemplateButtons(templateId: String, buttons: Array<NitroGridButton>): Unit
55
+ abstract fun updateGridTemplateButtons(templateId: String, buttons: Array<NitroGridButton>): Promise<Unit>
55
56
 
56
57
  private external fun initHybrid(): HybridData
57
58
 
@@ -10,6 +10,7 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -51,7 +52,7 @@ abstract class HybridInformationTemplateSpec: HybridObject() {
51
52
 
52
53
  @DoNotStrip
53
54
  @Keep
54
- abstract fun updateInformationTemplateSections(templateId: String, section: NitroSection): Unit
55
+ abstract fun updateInformationTemplateSections(templateId: String, section: NitroSection): Promise<Unit>
55
56
 
56
57
  private external fun initHybrid(): HybridData
57
58
 
@@ -10,6 +10,7 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -51,7 +52,7 @@ abstract class HybridListTemplateSpec: HybridObject() {
51
52
 
52
53
  @DoNotStrip
53
54
  @Keep
54
- abstract fun updateListTemplateSections(templateId: String, sections: Array<NitroSection>?): Unit
55
+ abstract fun updateListTemplateSections(templateId: String, sections: Array<NitroSection>?): Promise<Unit>
55
56
 
56
57
  private external fun initHybrid(): HybridData
57
58
 
@@ -10,6 +10,7 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -76,7 +77,7 @@ abstract class HybridMapTemplateSpec: HybridObject() {
76
77
 
77
78
  @DoNotStrip
78
79
  @Keep
79
- abstract fun setTemplateMapButtons(templateId: String, buttons: Array<NitroMapButton>?): Unit
80
+ abstract fun setTemplateMapButtons(templateId: String, buttons: Array<NitroMapButton>?): Promise<Unit>
80
81
 
81
82
  @DoNotStrip
82
83
  @Keep
@@ -10,6 +10,7 @@ package com.margelo.nitro.swe.iternio.reactnativeautoplay
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.jni.HybridData
12
12
  import com.facebook.proguard.annotations.DoNotStrip
13
+ import com.margelo.nitro.core.Promise
13
14
  import com.margelo.nitro.core.HybridObject
14
15
 
15
16
  /**
@@ -51,7 +52,7 @@ abstract class HybridSearchTemplateSpec: HybridObject() {
51
52
 
52
53
  @DoNotStrip
53
54
  @Keep
54
- abstract fun updateSearchResults(templateId: String, results: NitroSection): Unit
55
+ abstract fun updateSearchResults(templateId: String, results: NitroSection): Promise<Unit>
55
56
 
56
57
  private external fun initHybrid(): HybridData
57
58
 
@@ -505,15 +505,6 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
505
505
  return Result<std::shared_ptr<Promise<void>>>::withError(error);
506
506
  }
507
507
 
508
- // pragma MARK: Result<void>
509
- using Result_void_ = Result<void>;
510
- inline Result_void_ create_Result_void_() noexcept {
511
- return Result<void>::withValue();
512
- }
513
- inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
514
- return Result<void>::withError(error);
515
- }
516
-
517
508
  // pragma MARK: Result<bool>
518
509
  using Result_bool_ = Result<bool>;
519
510
  inline Result_bool_ create_Result_bool_(bool value) noexcept {
@@ -579,6 +570,15 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay::bridge::swift {
579
570
  using std__weak_ptr_HybridCarPlayDashboardSpec_ = std::weak_ptr<HybridCarPlayDashboardSpec>;
580
571
  inline std__weak_ptr_HybridCarPlayDashboardSpec_ weakify_std__shared_ptr_HybridCarPlayDashboardSpec_(const std::shared_ptr<HybridCarPlayDashboardSpec>& strong) noexcept { return strong; }
581
572
 
573
+ // pragma MARK: Result<void>
574
+ using Result_void_ = Result<void>;
575
+ inline Result_void_ create_Result_void_() noexcept {
576
+ return Result<void>::withValue();
577
+ }
578
+ inline Result_void_ create_Result_void_(const std::exception_ptr& error) noexcept {
579
+ return Result<void>::withError(error);
580
+ }
581
+
582
582
  // pragma MARK: std::function<void(const std::string& /* clusterId */)>
583
583
  /**
584
584
  * Specialized version of `std::function<void(const std::string&)>`.
@@ -158,11 +158,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
158
158
  auto __value = std::move(__result.value());
159
159
  return __value;
160
160
  }
161
- inline void setTemplateHeaderActions(const std::string& templateId, const std::optional<std::vector<NitroAction>>& headerActions) override {
161
+ inline std::shared_ptr<Promise<void>> setTemplateHeaderActions(const std::string& templateId, const std::optional<std::vector<NitroAction>>& headerActions) override {
162
162
  auto __result = _swiftPart.setTemplateHeaderActions(templateId, headerActions);
163
163
  if (__result.hasError()) [[unlikely]] {
164
164
  std::rethrow_exception(__result.error());
165
165
  }
166
+ auto __value = std::move(__result.value());
167
+ return __value;
166
168
  }
167
169
  inline bool isConnected() override {
168
170
  auto __result = _swiftPart.isConnected();
@@ -63,6 +63,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
63
63
  #include "NitroBaseMapTemplateConfig.hpp"
64
64
  #include "NitroMapButton.hpp"
65
65
  #include "NitroMapButtonType.hpp"
66
+ #include <NitroModules/Promise.hpp>
66
67
 
67
68
  #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
68
69
 
@@ -114,11 +115,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
114
115
  std::rethrow_exception(__result.error());
115
116
  }
116
117
  }
117
- inline void updateGridTemplateButtons(const std::string& templateId, const std::vector<NitroGridButton>& buttons) override {
118
+ inline std::shared_ptr<Promise<void>> updateGridTemplateButtons(const std::string& templateId, const std::vector<NitroGridButton>& buttons) override {
118
119
  auto __result = _swiftPart.updateGridTemplateButtons(templateId, buttons);
119
120
  if (__result.hasError()) [[unlikely]] {
120
121
  std::rethrow_exception(__result.error());
121
122
  }
123
+ auto __value = std::move(__result.value());
124
+ return __value;
122
125
  }
123
126
 
124
127
  private:
@@ -69,6 +69,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
69
69
  #include "NitroBaseMapTemplateConfig.hpp"
70
70
  #include "NitroMapButton.hpp"
71
71
  #include "NitroMapButtonType.hpp"
72
+ #include <NitroModules/Promise.hpp>
72
73
 
73
74
  #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
74
75
 
@@ -120,11 +121,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
120
121
  std::rethrow_exception(__result.error());
121
122
  }
122
123
  }
123
- inline void updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) override {
124
+ inline std::shared_ptr<Promise<void>> updateInformationTemplateSections(const std::string& templateId, const NitroSection& section) override {
124
125
  auto __result = _swiftPart.updateInformationTemplateSections(templateId, std::forward<decltype(section)>(section));
125
126
  if (__result.hasError()) [[unlikely]] {
126
127
  std::rethrow_exception(__result.error());
127
128
  }
129
+ auto __value = std::move(__result.value());
130
+ return __value;
128
131
  }
129
132
 
130
133
  private:
@@ -69,6 +69,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
69
69
  #include "NitroBaseMapTemplateConfig.hpp"
70
70
  #include "NitroMapButton.hpp"
71
71
  #include "NitroMapButtonType.hpp"
72
+ #include <NitroModules/Promise.hpp>
72
73
 
73
74
  #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
74
75
 
@@ -120,11 +121,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
120
121
  std::rethrow_exception(__result.error());
121
122
  }
122
123
  }
123
- inline void updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) override {
124
+ inline std::shared_ptr<Promise<void>> updateListTemplateSections(const std::string& templateId, const std::optional<std::vector<NitroSection>>& sections) override {
124
125
  auto __result = _swiftPart.updateListTemplateSections(templateId, sections);
125
126
  if (__result.hasError()) [[unlikely]] {
126
127
  std::rethrow_exception(__result.error());
127
128
  }
129
+ auto __value = std::move(__result.value());
130
+ return __value;
128
131
  }
129
132
 
130
133
  private:
@@ -129,6 +129,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripConfig;
129
129
  #include "TravelEstimates.hpp"
130
130
  #include "DurationWithTimeZone.hpp"
131
131
  #include "TripPreviewTextConfiguration.hpp"
132
+ #include <NitroModules/Promise.hpp>
132
133
  #include "NitroRoutingManeuver.hpp"
133
134
  #include "NitroMessageManeuver.hpp"
134
135
  #include "NitroAttributedString.hpp"
@@ -227,11 +228,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
227
228
  std::rethrow_exception(__result.error());
228
229
  }
229
230
  }
230
- inline void setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) override {
231
+ inline std::shared_ptr<Promise<void>> setTemplateMapButtons(const std::string& templateId, const std::optional<std::vector<NitroMapButton>>& buttons) override {
231
232
  auto __result = _swiftPart.setTemplateMapButtons(templateId, buttons);
232
233
  if (__result.hasError()) [[unlikely]] {
233
234
  std::rethrow_exception(__result.error());
234
235
  }
236
+ auto __value = std::move(__result.value());
237
+ return __value;
235
238
  }
236
239
  inline void updateVisibleTravelEstimate(const std::string& templateId, VisibleTravelEstimate visibleTravelEstimate) override {
237
240
  auto __result = _swiftPart.updateVisibleTravelEstimate(templateId, static_cast<int>(visibleTravelEstimate));
@@ -60,6 +60,7 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSe
60
60
  #include "NitroSection.hpp"
61
61
  #include "NitroRow.hpp"
62
62
  #include "NitroSectionType.hpp"
63
+ #include <NitroModules/Promise.hpp>
63
64
 
64
65
  #include "ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp"
65
66
 
@@ -111,11 +112,13 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
111
112
  std::rethrow_exception(__result.error());
112
113
  }
113
114
  }
114
- inline void updateSearchResults(const std::string& templateId, const NitroSection& results) override {
115
+ inline std::shared_ptr<Promise<void>> updateSearchResults(const std::string& templateId, const NitroSection& results) override {
115
116
  auto __result = _swiftPart.updateSearchResults(templateId, std::forward<decltype(results)>(results));
116
117
  if (__result.hasError()) [[unlikely]] {
117
118
  std::rethrow_exception(__result.error());
118
119
  }
120
+ auto __value = std::move(__result.value());
121
+ return __value;
119
122
  }
120
123
 
121
124
  private:
@@ -23,7 +23,7 @@ public protocol HybridAutoPlaySpec_protocol: HybridObject {
23
23
  func popToRootTemplate(animate: Bool?) throws -> Promise<Void>
24
24
  func popToTemplate(templateId: String, animate: Bool?) throws -> Promise<Void>
25
25
  func addSafeAreaInsetsListener(moduleName: String, callback: @escaping (_ insets: SafeAreaInsets) -> Void) throws -> () -> Void
26
- func setTemplateHeaderActions(templateId: String, headerActions: [NitroAction]?) throws -> Void
26
+ func setTemplateHeaderActions(templateId: String, headerActions: [NitroAction]?) throws -> Promise<Void>
27
27
  func isConnected() throws -> Bool
28
28
  }
29
29
 
@@ -295,9 +295,9 @@ open class HybridAutoPlaySpec_cxx {
295
295
  }
296
296
 
297
297
  @inline(__always)
298
- public final func setTemplateHeaderActions(templateId: std.string, headerActions: bridge.std__optional_std__vector_NitroAction__) -> bridge.Result_void_ {
298
+ public final func setTemplateHeaderActions(templateId: std.string, headerActions: bridge.std__optional_std__vector_NitroAction__) -> bridge.Result_std__shared_ptr_Promise_void___ {
299
299
  do {
300
- try self.__implementation.setTemplateHeaderActions(templateId: String(templateId), headerActions: { () -> [NitroAction]? in
300
+ let __result = try self.__implementation.setTemplateHeaderActions(templateId: String(templateId), headerActions: { () -> [NitroAction]? in
301
301
  if bridge.has_value_std__optional_std__vector_NitroAction__(headerActions) {
302
302
  let __unwrapped = bridge.get_std__optional_std__vector_NitroAction__(headerActions)
303
303
  return __unwrapped.map({ __item in __item })
@@ -305,10 +305,18 @@ open class HybridAutoPlaySpec_cxx {
305
305
  return nil
306
306
  }
307
307
  }())
308
- return bridge.create_Result_void_()
308
+ let __resultCpp = { () -> bridge.std__shared_ptr_Promise_void__ in
309
+ let __promise = bridge.create_std__shared_ptr_Promise_void__()
310
+ let __promiseHolder = bridge.wrap_std__shared_ptr_Promise_void__(__promise)
311
+ __result
312
+ .then({ __result in __promiseHolder.resolve() })
313
+ .catch({ __error in __promiseHolder.reject(__error.toCpp()) })
314
+ return __promise
315
+ }()
316
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__resultCpp)
309
317
  } catch (let __error) {
310
318
  let __exceptionPtr = __error.toCpp()
311
- return bridge.create_Result_void_(__exceptionPtr)
319
+ return bridge.create_Result_std__shared_ptr_Promise_void___(__exceptionPtr)
312
320
  }
313
321
  }
314
322
 
@@ -7,6 +7,7 @@
7
7
 
8
8
  import Foundation
9
9
  import NitroModules
10
+ import NitroModules
10
11
 
11
12
  /// See ``HybridGridTemplateSpec``
12
13
  public protocol HybridGridTemplateSpec_protocol: HybridObject {
@@ -15,7 +16,7 @@ public protocol HybridGridTemplateSpec_protocol: HybridObject {
15
16
 
16
17
  // Methods
17
18
  func createGridTemplate(config: GridTemplateConfig) throws -> Void
18
- func updateGridTemplateButtons(templateId: String, buttons: [NitroGridButton]) throws -> Void
19
+ func updateGridTemplateButtons(templateId: String, buttons: [NitroGridButton]) throws -> Promise<Void>
19
20
  }
20
21
 
21
22
  public extension HybridGridTemplateSpec_protocol {
@@ -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 HybridGridTemplateSpec over to C++.
@@ -129,13 +130,21 @@ open class HybridGridTemplateSpec_cxx {
129
130
  }
130
131
 
131
132
  @inline(__always)
132
- public final func updateGridTemplateButtons(templateId: std.string, buttons: bridge.std__vector_NitroGridButton_) -> bridge.Result_void_ {
133
+ public final func updateGridTemplateButtons(templateId: std.string, buttons: bridge.std__vector_NitroGridButton_) -> bridge.Result_std__shared_ptr_Promise_void___ {
133
134
  do {
134
- try self.__implementation.updateGridTemplateButtons(templateId: String(templateId), buttons: buttons.map({ __item in __item }))
135
- return bridge.create_Result_void_()
135
+ let __result = try self.__implementation.updateGridTemplateButtons(templateId: String(templateId), buttons: buttons.map({ __item in __item }))
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
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  import Foundation
9
9
  import NitroModules
10
+ import NitroModules
10
11
 
11
12
  /// See ``HybridInformationTemplateSpec``
12
13
  public protocol HybridInformationTemplateSpec_protocol: HybridObject {
@@ -15,7 +16,7 @@ public protocol HybridInformationTemplateSpec_protocol: HybridObject {
15
16
 
16
17
  // Methods
17
18
  func createInformationTemplate(config: InformationTemplateConfig) throws -> Void
18
- func updateInformationTemplateSections(templateId: String, section: NitroSection) throws -> Void
19
+ func updateInformationTemplateSections(templateId: String, section: NitroSection) throws -> Promise<Void>
19
20
  }
20
21
 
21
22
  public extension HybridInformationTemplateSpec_protocol {
@@ -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 HybridInformationTemplateSpec over to C++.
@@ -129,13 +130,21 @@ open class HybridInformationTemplateSpec_cxx {
129
130
  }
130
131
 
131
132
  @inline(__always)
132
- public final func updateInformationTemplateSections(templateId: std.string, section: NitroSection) -> bridge.Result_void_ {
133
+ public final func updateInformationTemplateSections(templateId: std.string, section: NitroSection) -> bridge.Result_std__shared_ptr_Promise_void___ {
133
134
  do {
134
- try self.__implementation.updateInformationTemplateSections(templateId: String(templateId), section: section)
135
- return bridge.create_Result_void_()
135
+ let __result = try self.__implementation.updateInformationTemplateSections(templateId: String(templateId), section: section)
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
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  import Foundation
9
9
  import NitroModules
10
+ import NitroModules
10
11
 
11
12
  /// See ``HybridListTemplateSpec``
12
13
  public protocol HybridListTemplateSpec_protocol: HybridObject {
@@ -15,7 +16,7 @@ public protocol HybridListTemplateSpec_protocol: HybridObject {
15
16
 
16
17
  // Methods
17
18
  func createListTemplate(config: ListTemplateConfig) throws -> Void
18
- func updateListTemplateSections(templateId: String, sections: [NitroSection]?) throws -> Void
19
+ func updateListTemplateSections(templateId: String, sections: [NitroSection]?) throws -> Promise<Void>
19
20
  }
20
21
 
21
22
  public extension HybridListTemplateSpec_protocol {