@iternio/react-native-auto-play 0.5.14-beta.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +214 -29
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/AndroidAutoSession.kt +5 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplate.kt +9 -2
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/NativeBackdrop.kt +40 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/VirtualRenderer.kt +52 -0
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/GridTemplate.kt +47 -13
- package/android/src/main/java/com/margelo/nitro/swe/iternio/reactnativeautoplay/template/Parser.kt +21 -2
- package/ios/Types.swift +3 -0
- package/ios/extensions/UIImage+Toggle.swift +5 -2
- package/ios/hybrid/HybridAutoPlay.swift +28 -16
- package/ios/hybrid/HybridMapTemplate.swift +22 -5
- package/ios/scenes/AutoPlayInterfaceController.swift +261 -72
- package/ios/templates/AutoPlayMapPanelDelegate.swift +190 -0
- package/ios/templates/AutoPlayTemplate.swift +24 -2
- package/ios/templates/GridTemplate.swift +57 -57
- package/ios/templates/InformationTemplate.swift +84 -9
- package/ios/templates/ListTemplate.swift +66 -11
- package/ios/templates/MapTemplate.swift +83 -68
- package/ios/templates/MessageTemplate.swift +72 -6
- package/ios/templates/Parser.swift +564 -69
- package/ios/templates/SearchTemplate.swift +1 -1
- package/ios/templates/TemplateStore.swift +5 -15
- package/ios/utils/SymbolFont.swift +13 -28
- package/lib/Constants.d.ts +4 -0
- package/lib/Constants.js +6 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/specs/MapTemplate.nitro.d.ts +3 -1
- package/lib/templates/GridTemplate.d.ts +23 -3
- package/lib/templates/GridTemplate.js +8 -0
- package/lib/templates/InformationTemplate.d.ts +38 -12
- package/lib/templates/ListTemplate.d.ts +16 -47
- package/lib/templates/MapTemplate.d.ts +26 -2
- package/lib/templates/MapTemplate.js +16 -2
- package/lib/templates/MessageTemplate.d.ts +52 -11
- package/lib/templates/MessageTemplate.js +1 -1
- package/lib/utils/NitroOptionsPanel.d.ts +103 -0
- package/lib/utils/NitroOptionsPanel.js +63 -0
- package/lib/utils/NitroSection.d.ts +89 -2
- package/lib/utils/NitroSection.js +49 -2
- package/nitrogen/generated/android/ReactNativeAutoPlay+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JChargingConnector.hpp +79 -0
- package/nitrogen/generated/android/c++/JGridImageSize.hpp +64 -0
- package/nitrogen/generated/android/c++/JGridTemplateConfig.hpp +7 -1
- package/nitrogen/generated/android/c++/JHybridGridTemplateSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JHybridInformationTemplateSpec.cpp +12 -0
- package/nitrogen/generated/android/c++/JHybridListTemplateSpec.cpp +12 -0
- package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.cpp +78 -3
- package/nitrogen/generated/android/c++/JHybridMapTemplateSpec.hpp +2 -1
- package/nitrogen/generated/android/c++/JHybridSearchTemplateSpec.cpp +12 -0
- package/nitrogen/generated/android/c++/JInformationTemplateConfig.hpp +6 -0
- package/nitrogen/generated/android/c++/JListImageType.hpp +67 -0
- package/nitrogen/generated/android/c++/JListTemplateConfig.hpp +6 -0
- package/nitrogen/generated/android/c++/JNitroChargerLocation.hpp +115 -0
- package/nitrogen/generated/android/c++/JNitroChargerOutlet.hpp +82 -0
- package/nitrogen/generated/android/c++/JNitroOptionsPanelChargerSection.hpp +112 -0
- package/nitrogen/generated/android/c++/JNitroOptionsPanelConfig.hpp +157 -0
- package/nitrogen/generated/android/c++/JNitroOptionsPanelGridSection.hpp +102 -0
- package/nitrogen/generated/android/c++/JNitroOptionsPanelSection.cpp +30 -0
- package/nitrogen/generated/android/c++/JNitroOptionsPanelSection.hpp +129 -0
- package/nitrogen/generated/android/c++/JNitroRow.hpp +33 -3
- package/nitrogen/generated/android/c++/JNitroSection.hpp +6 -0
- package/nitrogen/generated/android/c++/JSearchTemplateConfig.hpp +6 -0
- package/nitrogen/generated/android/c++/JWaypointCoordinate.hpp +65 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ChargingConnector.kt +30 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridImageSize.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/GridTemplateConfig.kt +9 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/HybridMapTemplateSpec.kt +5 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/ListImageType.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerLocation.kt +90 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerOutlet.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelChargerSection.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelConfig.kt +61 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelGridSection.kt +56 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroOptionsPanelSection.kt +75 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/NitroRow.kt +36 -6
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/swe/iternio/reactnativeautoplay/WaypointCoordinate.kt +61 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Bridge.hpp +174 -0
- package/nitrogen/generated/ios/ReactNativeAutoPlay-Swift-Cxx-Umbrella.hpp +27 -0
- package/nitrogen/generated/ios/c++/HybridGridTemplateSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridInformationTemplateSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/c++/HybridListTemplateSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/c++/HybridMapTemplateSpecSwift.hpp +47 -1
- package/nitrogen/generated/ios/c++/HybridSearchTemplateSpecSwift.hpp +9 -0
- package/nitrogen/generated/ios/swift/ChargingConnector.swift +68 -0
- package/nitrogen/generated/ios/swift/GridImageSize.swift +48 -0
- package/nitrogen/generated/ios/swift/GridTemplateConfig.swift +12 -1
- package/nitrogen/generated/ios/swift/HybridMapTemplateSpec.swift +2 -1
- package/nitrogen/generated/ios/swift/HybridMapTemplateSpec_cxx.swift +31 -4
- package/nitrogen/generated/ios/swift/ListImageType.swift +52 -0
- package/nitrogen/generated/ios/swift/NitroChargerLocation.swift +161 -0
- package/nitrogen/generated/ios/swift/NitroChargerOutlet.swift +65 -0
- package/nitrogen/generated/ios/swift/NitroOptionsPanelChargerSection.swift +64 -0
- package/nitrogen/generated/ios/swift/NitroOptionsPanelConfig.swift +94 -0
- package/nitrogen/generated/ios/swift/NitroOptionsPanelGridSection.swift +53 -0
- package/nitrogen/generated/ios/swift/NitroOptionsPanelSection.swift +32 -0
- package/nitrogen/generated/ios/swift/NitroRow.swift +81 -1
- package/nitrogen/generated/ios/swift/WaypointCoordinate.swift +52 -0
- package/nitrogen/generated/shared/c++/ChargingConnector.hpp +104 -0
- package/nitrogen/generated/shared/c++/GridImageSize.hpp +84 -0
- package/nitrogen/generated/shared/c++/GridTemplateConfig.hpp +8 -1
- package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridMapTemplateSpec.hpp +5 -1
- package/nitrogen/generated/shared/c++/ListImageType.hpp +88 -0
- package/nitrogen/generated/shared/c++/NitroChargerLocation.hpp +131 -0
- package/nitrogen/generated/shared/c++/NitroChargerOutlet.hpp +98 -0
- package/nitrogen/generated/shared/c++/NitroOptionsPanelChargerSection.hpp +98 -0
- package/nitrogen/generated/shared/c++/NitroOptionsPanelConfig.hpp +107 -0
- package/nitrogen/generated/shared/c++/NitroOptionsPanelGridSection.hpp +91 -0
- package/nitrogen/generated/shared/c++/NitroRow.hpp +39 -2
- package/nitrogen/generated/shared/c++/WaypointCoordinate.hpp +91 -0
- package/package.json +1 -1
- package/src/Constants.ts +9 -0
- package/src/index.ts +1 -0
- package/src/specs/MapTemplate.nitro.ts +3 -1
- package/src/templates/GridTemplate.ts +38 -3
- package/src/templates/InformationTemplate.ts +60 -29
- package/src/templates/ListTemplate.ts +27 -55
- package/src/templates/MapTemplate.ts +60 -2
- package/src/templates/MessageTemplate.ts +71 -24
- package/src/utils/NitroOptionsPanel.ts +218 -0
- package/src/utils/NitroSection.ts +160 -5
|
@@ -33,6 +33,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct Distance; }
|
|
|
33
33
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class DistanceUnits; }
|
|
34
34
|
// Forward declaration of `NitroGridButton` to properly resolve imports.
|
|
35
35
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroGridButton; }
|
|
36
|
+
// Forward declaration of `GridImageSize` to properly resolve imports.
|
|
37
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class GridImageSize; }
|
|
36
38
|
// Forward declaration of `NitroBaseMapTemplateConfig` to properly resolve imports.
|
|
37
39
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroBaseMapTemplateConfig; }
|
|
38
40
|
// Forward declaration of `NitroMapButton` to properly resolve imports.
|
|
@@ -79,6 +81,8 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
|
|
|
79
81
|
#include "NitroGridButton.hpp"
|
|
80
82
|
#include "JNitroGridButton.hpp"
|
|
81
83
|
#include "JNitroImage.hpp"
|
|
84
|
+
#include "GridImageSize.hpp"
|
|
85
|
+
#include "JGridImageSize.hpp"
|
|
82
86
|
#include "NitroBaseMapTemplateConfig.hpp"
|
|
83
87
|
#include "JNitroBaseMapTemplateConfig.hpp"
|
|
84
88
|
#include "NitroMapButton.hpp"
|
|
@@ -35,6 +35,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class Distanc
|
|
|
35
35
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
|
|
36
36
|
// Forward declaration of `NitroRow` to properly resolve imports.
|
|
37
37
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRow; }
|
|
38
|
+
// Forward declaration of `ListImageType` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ListImageType; }
|
|
40
|
+
// Forward declaration of `WaypointCoordinate` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WaypointCoordinate; }
|
|
42
|
+
// Forward declaration of `DurationWithTimeZone` to properly resolve imports.
|
|
43
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct DurationWithTimeZone; }
|
|
38
44
|
// Forward declaration of `NitroSectionType` to properly resolve imports.
|
|
39
45
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSectionType; }
|
|
40
46
|
// Forward declaration of `NitroBaseMapTemplateConfig` to properly resolve imports.
|
|
@@ -84,6 +90,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
|
|
|
84
90
|
#include "JNitroSection.hpp"
|
|
85
91
|
#include "NitroRow.hpp"
|
|
86
92
|
#include "JNitroRow.hpp"
|
|
93
|
+
#include "ListImageType.hpp"
|
|
94
|
+
#include "JListImageType.hpp"
|
|
95
|
+
#include "WaypointCoordinate.hpp"
|
|
96
|
+
#include "JWaypointCoordinate.hpp"
|
|
97
|
+
#include "DurationWithTimeZone.hpp"
|
|
98
|
+
#include "JDurationWithTimeZone.hpp"
|
|
87
99
|
#include "NitroSectionType.hpp"
|
|
88
100
|
#include "JNitroSectionType.hpp"
|
|
89
101
|
#include "NitroBaseMapTemplateConfig.hpp"
|
|
@@ -35,6 +35,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class Distanc
|
|
|
35
35
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
|
|
36
36
|
// Forward declaration of `NitroRow` to properly resolve imports.
|
|
37
37
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRow; }
|
|
38
|
+
// Forward declaration of `ListImageType` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ListImageType; }
|
|
40
|
+
// Forward declaration of `WaypointCoordinate` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WaypointCoordinate; }
|
|
42
|
+
// Forward declaration of `DurationWithTimeZone` to properly resolve imports.
|
|
43
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct DurationWithTimeZone; }
|
|
38
44
|
// Forward declaration of `NitroSectionType` to properly resolve imports.
|
|
39
45
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSectionType; }
|
|
40
46
|
// Forward declaration of `NitroBaseMapTemplateConfig` to properly resolve imports.
|
|
@@ -84,6 +90,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroMa
|
|
|
84
90
|
#include "JNitroSection.hpp"
|
|
85
91
|
#include "NitroRow.hpp"
|
|
86
92
|
#include "JNitroRow.hpp"
|
|
93
|
+
#include "ListImageType.hpp"
|
|
94
|
+
#include "JListImageType.hpp"
|
|
95
|
+
#include "WaypointCoordinate.hpp"
|
|
96
|
+
#include "JWaypointCoordinate.hpp"
|
|
97
|
+
#include "DurationWithTimeZone.hpp"
|
|
98
|
+
#include "JDurationWithTimeZone.hpp"
|
|
87
99
|
#include "NitroSectionType.hpp"
|
|
88
100
|
#include "JNitroSectionType.hpp"
|
|
89
101
|
#include "NitroBaseMapTemplateConfig.hpp"
|
|
@@ -97,6 +97,30 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class Maneuve
|
|
|
97
97
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct TripConfig; }
|
|
98
98
|
// Forward declaration of `ManeuverState` to properly resolve imports.
|
|
99
99
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ManeuverState; }
|
|
100
|
+
// Forward declaration of `NitroOptionsPanelConfig` to properly resolve imports.
|
|
101
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroOptionsPanelConfig; }
|
|
102
|
+
// Forward declaration of `NitroSection` to properly resolve imports.
|
|
103
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
|
|
104
|
+
// Forward declaration of `NitroOptionsPanelGridSection` to properly resolve imports.
|
|
105
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroOptionsPanelGridSection; }
|
|
106
|
+
// Forward declaration of `NitroOptionsPanelChargerSection` to properly resolve imports.
|
|
107
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroOptionsPanelChargerSection; }
|
|
108
|
+
// Forward declaration of `NitroRow` to properly resolve imports.
|
|
109
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRow; }
|
|
110
|
+
// Forward declaration of `ListImageType` to properly resolve imports.
|
|
111
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ListImageType; }
|
|
112
|
+
// Forward declaration of `WaypointCoordinate` to properly resolve imports.
|
|
113
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WaypointCoordinate; }
|
|
114
|
+
// Forward declaration of `NitroSectionType` to properly resolve imports.
|
|
115
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSectionType; }
|
|
116
|
+
// Forward declaration of `NitroGridButton` to properly resolve imports.
|
|
117
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroGridButton; }
|
|
118
|
+
// Forward declaration of `NitroChargerOutlet` to properly resolve imports.
|
|
119
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroChargerOutlet; }
|
|
120
|
+
// Forward declaration of `ChargingConnector` to properly resolve imports.
|
|
121
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ChargingConnector; }
|
|
122
|
+
// Forward declaration of `NitroChargerLocation` to properly resolve imports.
|
|
123
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroChargerLocation; }
|
|
100
124
|
|
|
101
125
|
#include "TripSelectorCallback.hpp"
|
|
102
126
|
#include "JTripSelectorCallback.hpp"
|
|
@@ -211,6 +235,31 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class Maneuve
|
|
|
211
235
|
#include "JTripConfig.hpp"
|
|
212
236
|
#include "ManeuverState.hpp"
|
|
213
237
|
#include "JManeuverState.hpp"
|
|
238
|
+
#include "NitroOptionsPanelConfig.hpp"
|
|
239
|
+
#include "JNitroOptionsPanelConfig.hpp"
|
|
240
|
+
#include "NitroSection.hpp"
|
|
241
|
+
#include "NitroOptionsPanelGridSection.hpp"
|
|
242
|
+
#include "NitroOptionsPanelChargerSection.hpp"
|
|
243
|
+
#include "JNitroOptionsPanelSection.hpp"
|
|
244
|
+
#include "JNitroSection.hpp"
|
|
245
|
+
#include "NitroRow.hpp"
|
|
246
|
+
#include "JNitroRow.hpp"
|
|
247
|
+
#include "ListImageType.hpp"
|
|
248
|
+
#include "JListImageType.hpp"
|
|
249
|
+
#include "WaypointCoordinate.hpp"
|
|
250
|
+
#include "JWaypointCoordinate.hpp"
|
|
251
|
+
#include "NitroSectionType.hpp"
|
|
252
|
+
#include "JNitroSectionType.hpp"
|
|
253
|
+
#include "JNitroOptionsPanelGridSection.hpp"
|
|
254
|
+
#include "NitroGridButton.hpp"
|
|
255
|
+
#include "JNitroGridButton.hpp"
|
|
256
|
+
#include "JNitroOptionsPanelChargerSection.hpp"
|
|
257
|
+
#include "NitroChargerOutlet.hpp"
|
|
258
|
+
#include "JNitroChargerOutlet.hpp"
|
|
259
|
+
#include "ChargingConnector.hpp"
|
|
260
|
+
#include "JChargingConnector.hpp"
|
|
261
|
+
#include "NitroChargerLocation.hpp"
|
|
262
|
+
#include "JNitroChargerLocation.hpp"
|
|
214
263
|
|
|
215
264
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
216
265
|
|
|
@@ -333,9 +382,20 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
333
382
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroManeuver> /* maneuvers */)>("updateManeuvers");
|
|
334
383
|
method(_javaPart, jni::make_jstring(templateId), JNitroManeuver::fromCpp(maneuvers));
|
|
335
384
|
}
|
|
336
|
-
void JHybridMapTemplateSpec::startNavigation(const std::string& templateId, const TripConfig& trip) {
|
|
337
|
-
static const auto method = _javaPart->javaClassStatic()->getMethod<
|
|
338
|
-
method(_javaPart, jni::make_jstring(templateId), JTripConfig::fromCpp(trip));
|
|
385
|
+
std::shared_ptr<Promise<void>> JHybridMapTemplateSpec::startNavigation(const std::string& templateId, const TripConfig& trip) {
|
|
386
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JTripConfig> /* trip */)>("startNavigation");
|
|
387
|
+
auto __result = method(_javaPart, jni::make_jstring(templateId), JTripConfig::fromCpp(trip));
|
|
388
|
+
return [&]() {
|
|
389
|
+
auto __promise = Promise<void>::create();
|
|
390
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
391
|
+
__promise->resolve();
|
|
392
|
+
});
|
|
393
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
394
|
+
jni::JniException __jniError(__throwable);
|
|
395
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
396
|
+
});
|
|
397
|
+
return __promise;
|
|
398
|
+
}();
|
|
339
399
|
}
|
|
340
400
|
void JHybridMapTemplateSpec::stopNavigation(const std::string& templateId) {
|
|
341
401
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */)>("stopNavigation");
|
|
@@ -345,5 +405,20 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
345
405
|
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JManeuverState> /* state */)>("setManeuverState");
|
|
346
406
|
method(_javaPart, jni::make_jstring(templateId), JManeuverState::fromCpp(state));
|
|
347
407
|
}
|
|
408
|
+
std::shared_ptr<Promise<void>> JHybridMapTemplateSpec::updateOptionsPanel(const std::string& templateId, const std::optional<NitroOptionsPanelConfig>& config) {
|
|
409
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* templateId */, jni::alias_ref<JNitroOptionsPanelConfig> /* config */)>("updateOptionsPanel");
|
|
410
|
+
auto __result = method(_javaPart, jni::make_jstring(templateId), config.has_value() ? JNitroOptionsPanelConfig::fromCpp(config.value()) : nullptr);
|
|
411
|
+
return [&]() {
|
|
412
|
+
auto __promise = Promise<void>::create();
|
|
413
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
414
|
+
__promise->resolve();
|
|
415
|
+
});
|
|
416
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
417
|
+
jni::JniException __jniError(__throwable);
|
|
418
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
419
|
+
});
|
|
420
|
+
return __promise;
|
|
421
|
+
}();
|
|
422
|
+
}
|
|
348
423
|
|
|
349
424
|
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -64,9 +64,10 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
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, NitroLoadingManeuver>& maneuvers) override;
|
|
67
|
-
void startNavigation(const std::string& templateId, const TripConfig& trip) override;
|
|
67
|
+
std::shared_ptr<Promise<void>> startNavigation(const std::string& templateId, const TripConfig& trip) override;
|
|
68
68
|
void stopNavigation(const std::string& templateId) override;
|
|
69
69
|
void setManeuverState(const std::string& templateId, ManeuverState state) override;
|
|
70
|
+
std::shared_ptr<Promise<void>> updateOptionsPanel(const std::string& templateId, const std::optional<NitroOptionsPanelConfig>& config) override;
|
|
70
71
|
|
|
71
72
|
private:
|
|
72
73
|
jni::global_ref<JHybridMapTemplateSpec::JavaPart> _javaPart;
|
|
@@ -35,6 +35,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class Distanc
|
|
|
35
35
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroSection; }
|
|
36
36
|
// Forward declaration of `NitroRow` to properly resolve imports.
|
|
37
37
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct NitroRow; }
|
|
38
|
+
// Forward declaration of `ListImageType` to properly resolve imports.
|
|
39
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ListImageType; }
|
|
40
|
+
// Forward declaration of `WaypointCoordinate` to properly resolve imports.
|
|
41
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WaypointCoordinate; }
|
|
42
|
+
// Forward declaration of `DurationWithTimeZone` to properly resolve imports.
|
|
43
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct DurationWithTimeZone; }
|
|
38
44
|
// Forward declaration of `NitroSectionType` to properly resolve imports.
|
|
39
45
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSectionType; }
|
|
40
46
|
|
|
@@ -78,6 +84,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class NitroSe
|
|
|
78
84
|
#include "JNitroSection.hpp"
|
|
79
85
|
#include "NitroRow.hpp"
|
|
80
86
|
#include "JNitroRow.hpp"
|
|
87
|
+
#include "ListImageType.hpp"
|
|
88
|
+
#include "JListImageType.hpp"
|
|
89
|
+
#include "WaypointCoordinate.hpp"
|
|
90
|
+
#include "JWaypointCoordinate.hpp"
|
|
91
|
+
#include "DurationWithTimeZone.hpp"
|
|
92
|
+
#include "JDurationWithTimeZone.hpp"
|
|
81
93
|
#include "NitroSectionType.hpp"
|
|
82
94
|
#include "JNitroSectionType.hpp"
|
|
83
95
|
#include "JFunc_void_std__string.hpp"
|
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
#include "AutoText.hpp"
|
|
15
15
|
#include "Distance.hpp"
|
|
16
16
|
#include "DistanceUnits.hpp"
|
|
17
|
+
#include "DurationWithTimeZone.hpp"
|
|
17
18
|
#include "GlyphImage.hpp"
|
|
18
19
|
#include "JAssetImage.hpp"
|
|
19
20
|
#include "JAutoText.hpp"
|
|
20
21
|
#include "JDistance.hpp"
|
|
21
22
|
#include "JDistanceUnits.hpp"
|
|
23
|
+
#include "JDurationWithTimeZone.hpp"
|
|
22
24
|
#include "JFunc_void.hpp"
|
|
23
25
|
#include "JFunc_void_bool.hpp"
|
|
24
26
|
#include "JFunc_void_std__optional_bool_.hpp"
|
|
25
27
|
#include "JGlyphImage.hpp"
|
|
28
|
+
#include "JListImageType.hpp"
|
|
26
29
|
#include "JNitroAction.hpp"
|
|
27
30
|
#include "JNitroActionType.hpp"
|
|
28
31
|
#include "JNitroAlignment.hpp"
|
|
@@ -37,6 +40,8 @@
|
|
|
37
40
|
#include "JNitroSectionType.hpp"
|
|
38
41
|
#include "JRemoteImage.hpp"
|
|
39
42
|
#include "JVariant_GlyphImage_AssetImage_RemoteImage.hpp"
|
|
43
|
+
#include "JWaypointCoordinate.hpp"
|
|
44
|
+
#include "ListImageType.hpp"
|
|
40
45
|
#include "NitroAction.hpp"
|
|
41
46
|
#include "NitroActionType.hpp"
|
|
42
47
|
#include "NitroAlignment.hpp"
|
|
@@ -49,6 +54,7 @@
|
|
|
49
54
|
#include "NitroSection.hpp"
|
|
50
55
|
#include "NitroSectionType.hpp"
|
|
51
56
|
#include "RemoteImage.hpp"
|
|
57
|
+
#include "WaypointCoordinate.hpp"
|
|
52
58
|
#include <NitroModules/JNICallable.hpp>
|
|
53
59
|
#include <functional>
|
|
54
60
|
#include <optional>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JListImageType.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 "ListImageType.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "ListImageType" and the the Kotlin enum "ListImageType".
|
|
19
|
+
*/
|
|
20
|
+
struct JListImageType final: public jni::JavaClass<JListImageType> {
|
|
21
|
+
public:
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/ListImageType;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum ListImageType.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
ListImageType toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<ListImageType>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JListImageType> fromCpp(ListImageType value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case ListImageType::LARGE:
|
|
46
|
+
static const auto fieldLARGE = clazz->getStaticField<JListImageType>("LARGE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldLARGE);
|
|
48
|
+
case ListImageType::MEDIUM:
|
|
49
|
+
static const auto fieldMEDIUM = clazz->getStaticField<JListImageType>("MEDIUM");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldMEDIUM);
|
|
51
|
+
case ListImageType::SMALL:
|
|
52
|
+
static const auto fieldSMALL = clazz->getStaticField<JListImageType>("SMALL");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldSMALL);
|
|
54
|
+
case ListImageType::EXTRA_SMALL:
|
|
55
|
+
static const auto fieldEXTRA_SMALL = clazz->getStaticField<JListImageType>("EXTRA_SMALL");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldEXTRA_SMALL);
|
|
57
|
+
case ListImageType::ICON:
|
|
58
|
+
static const auto fieldICON = clazz->getStaticField<JListImageType>("ICON");
|
|
59
|
+
return clazz->getStaticFieldValue(fieldICON);
|
|
60
|
+
default:
|
|
61
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
62
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -14,15 +14,18 @@
|
|
|
14
14
|
#include "AutoText.hpp"
|
|
15
15
|
#include "Distance.hpp"
|
|
16
16
|
#include "DistanceUnits.hpp"
|
|
17
|
+
#include "DurationWithTimeZone.hpp"
|
|
17
18
|
#include "GlyphImage.hpp"
|
|
18
19
|
#include "JAssetImage.hpp"
|
|
19
20
|
#include "JAutoText.hpp"
|
|
20
21
|
#include "JDistance.hpp"
|
|
21
22
|
#include "JDistanceUnits.hpp"
|
|
23
|
+
#include "JDurationWithTimeZone.hpp"
|
|
22
24
|
#include "JFunc_void.hpp"
|
|
23
25
|
#include "JFunc_void_bool.hpp"
|
|
24
26
|
#include "JFunc_void_std__optional_bool_.hpp"
|
|
25
27
|
#include "JGlyphImage.hpp"
|
|
28
|
+
#include "JListImageType.hpp"
|
|
26
29
|
#include "JNitroAction.hpp"
|
|
27
30
|
#include "JNitroActionType.hpp"
|
|
28
31
|
#include "JNitroAlignment.hpp"
|
|
@@ -37,6 +40,8 @@
|
|
|
37
40
|
#include "JNitroSectionType.hpp"
|
|
38
41
|
#include "JRemoteImage.hpp"
|
|
39
42
|
#include "JVariant_GlyphImage_AssetImage_RemoteImage.hpp"
|
|
43
|
+
#include "JWaypointCoordinate.hpp"
|
|
44
|
+
#include "ListImageType.hpp"
|
|
40
45
|
#include "NitroAction.hpp"
|
|
41
46
|
#include "NitroActionType.hpp"
|
|
42
47
|
#include "NitroAlignment.hpp"
|
|
@@ -49,6 +54,7 @@
|
|
|
49
54
|
#include "NitroSection.hpp"
|
|
50
55
|
#include "NitroSectionType.hpp"
|
|
51
56
|
#include "RemoteImage.hpp"
|
|
57
|
+
#include "WaypointCoordinate.hpp"
|
|
52
58
|
#include <NitroModules/JNICallable.hpp>
|
|
53
59
|
#include <functional>
|
|
54
60
|
#include <optional>
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroChargerLocation.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 "NitroChargerLocation.hpp"
|
|
12
|
+
|
|
13
|
+
#include "AssetImage.hpp"
|
|
14
|
+
#include "Distance.hpp"
|
|
15
|
+
#include "DistanceUnits.hpp"
|
|
16
|
+
#include "DurationWithTimeZone.hpp"
|
|
17
|
+
#include "GlyphImage.hpp"
|
|
18
|
+
#include "JAssetImage.hpp"
|
|
19
|
+
#include "JDistance.hpp"
|
|
20
|
+
#include "JDistanceUnits.hpp"
|
|
21
|
+
#include "JDurationWithTimeZone.hpp"
|
|
22
|
+
#include "JFunc_void.hpp"
|
|
23
|
+
#include "JGlyphImage.hpp"
|
|
24
|
+
#include "JNitroColor.hpp"
|
|
25
|
+
#include "JRemoteImage.hpp"
|
|
26
|
+
#include "JVariant_GlyphImage_AssetImage_RemoteImage.hpp"
|
|
27
|
+
#include "JWaypointCoordinate.hpp"
|
|
28
|
+
#include "NitroColor.hpp"
|
|
29
|
+
#include "RemoteImage.hpp"
|
|
30
|
+
#include "WaypointCoordinate.hpp"
|
|
31
|
+
#include <NitroModules/JNICallable.hpp>
|
|
32
|
+
#include <functional>
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include <string>
|
|
35
|
+
#include <variant>
|
|
36
|
+
|
|
37
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
38
|
+
|
|
39
|
+
using namespace facebook;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* The C++ JNI bridge between the C++ struct "NitroChargerLocation" and the the Kotlin data class "NitroChargerLocation".
|
|
43
|
+
*/
|
|
44
|
+
struct JNitroChargerLocation final: public jni::JavaClass<JNitroChargerLocation> {
|
|
45
|
+
public:
|
|
46
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerLocation;";
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroChargerLocation by copying all values to C++.
|
|
51
|
+
*/
|
|
52
|
+
[[maybe_unused]]
|
|
53
|
+
[[nodiscard]]
|
|
54
|
+
NitroChargerLocation toCpp() const {
|
|
55
|
+
static const auto clazz = javaClassStatic();
|
|
56
|
+
static const auto fieldName = clazz->getField<jni::JString>("name");
|
|
57
|
+
jni::local_ref<jni::JString> name = this->getFieldValue(fieldName);
|
|
58
|
+
static const auto fieldAddress = clazz->getField<jni::JString>("address");
|
|
59
|
+
jni::local_ref<jni::JString> address = this->getFieldValue(fieldAddress);
|
|
60
|
+
static const auto fieldCoordinate = clazz->getField<JWaypointCoordinate>("coordinate");
|
|
61
|
+
jni::local_ref<JWaypointCoordinate> coordinate = this->getFieldValue(fieldCoordinate);
|
|
62
|
+
static const auto fieldDistance = clazz->getField<JDistance>("distance");
|
|
63
|
+
jni::local_ref<JDistance> distance = this->getFieldValue(fieldDistance);
|
|
64
|
+
static const auto fieldDuration = clazz->getField<JDurationWithTimeZone>("duration");
|
|
65
|
+
jni::local_ref<JDurationWithTimeZone> duration = this->getFieldValue(fieldDuration);
|
|
66
|
+
static const auto fieldVisible = clazz->getField<jni::JBoolean>("visible");
|
|
67
|
+
jni::local_ref<jni::JBoolean> visible = this->getFieldValue(fieldVisible);
|
|
68
|
+
static const auto fieldImage = clazz->getField<JVariant_GlyphImage_AssetImage_RemoteImage>("image");
|
|
69
|
+
jni::local_ref<JVariant_GlyphImage_AssetImage_RemoteImage> image = this->getFieldValue(fieldImage);
|
|
70
|
+
static const auto fieldOnPress = clazz->getField<JFunc_void::javaobject>("onPress");
|
|
71
|
+
jni::local_ref<JFunc_void::javaobject> onPress = this->getFieldValue(fieldOnPress);
|
|
72
|
+
return NitroChargerLocation(
|
|
73
|
+
name != nullptr ? std::make_optional(name->toStdString()) : std::nullopt,
|
|
74
|
+
address != nullptr ? std::make_optional(address->toStdString()) : std::nullopt,
|
|
75
|
+
coordinate->toCpp(),
|
|
76
|
+
distance->toCpp(),
|
|
77
|
+
duration->toCpp(),
|
|
78
|
+
visible != nullptr ? std::make_optional(static_cast<bool>(visible->value())) : std::nullopt,
|
|
79
|
+
image != nullptr ? std::make_optional(image->toCpp()) : std::nullopt,
|
|
80
|
+
onPress != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
81
|
+
if (onPress->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
82
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(onPress);
|
|
83
|
+
return downcast->cthis()->getFunction();
|
|
84
|
+
} else {
|
|
85
|
+
auto onPressRef = jni::make_global(onPress);
|
|
86
|
+
return JNICallable<JFunc_void, void()>(std::move(onPressRef));
|
|
87
|
+
}
|
|
88
|
+
}()) : std::nullopt
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public:
|
|
93
|
+
/**
|
|
94
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
95
|
+
*/
|
|
96
|
+
[[maybe_unused]]
|
|
97
|
+
static jni::local_ref<JNitroChargerLocation::javaobject> fromCpp(const NitroChargerLocation& value) {
|
|
98
|
+
using JSignature = JNitroChargerLocation(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JString>, jni::alias_ref<JWaypointCoordinate>, jni::alias_ref<JDistance>, jni::alias_ref<JDurationWithTimeZone>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JVariant_GlyphImage_AssetImage_RemoteImage>, jni::alias_ref<JFunc_void::javaobject>);
|
|
99
|
+
static const auto clazz = javaClassStatic();
|
|
100
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
101
|
+
return create(
|
|
102
|
+
clazz,
|
|
103
|
+
value.name.has_value() ? jni::make_jstring(value.name.value()) : nullptr,
|
|
104
|
+
value.address.has_value() ? jni::make_jstring(value.address.value()) : nullptr,
|
|
105
|
+
JWaypointCoordinate::fromCpp(value.coordinate),
|
|
106
|
+
JDistance::fromCpp(value.distance),
|
|
107
|
+
JDurationWithTimeZone::fromCpp(value.duration),
|
|
108
|
+
value.visible.has_value() ? jni::JBoolean::valueOf(value.visible.value()) : nullptr,
|
|
109
|
+
value.image.has_value() ? JVariant_GlyphImage_AssetImage_RemoteImage::fromCpp(value.image.value()) : nullptr,
|
|
110
|
+
value.onPress.has_value() ? JFunc_void_cxx::fromCpp(value.onPress.value()) : nullptr
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JNitroChargerOutlet.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 "NitroChargerOutlet.hpp"
|
|
12
|
+
|
|
13
|
+
#include "ChargingConnector.hpp"
|
|
14
|
+
#include "JChargingConnector.hpp"
|
|
15
|
+
#include "JFunc_void.hpp"
|
|
16
|
+
#include <NitroModules/JNICallable.hpp>
|
|
17
|
+
#include <functional>
|
|
18
|
+
#include <optional>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
21
|
+
|
|
22
|
+
using namespace facebook;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* The C++ JNI bridge between the C++ struct "NitroChargerOutlet" and the the Kotlin data class "NitroChargerOutlet".
|
|
26
|
+
*/
|
|
27
|
+
struct JNitroChargerOutlet final: public jni::JavaClass<JNitroChargerOutlet> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/swe/iternio/reactnativeautoplay/NitroChargerOutlet;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
/**
|
|
33
|
+
* Convert this Java/Kotlin-based struct to the C++ struct NitroChargerOutlet by copying all values to C++.
|
|
34
|
+
*/
|
|
35
|
+
[[maybe_unused]]
|
|
36
|
+
[[nodiscard]]
|
|
37
|
+
NitroChargerOutlet toCpp() const {
|
|
38
|
+
static const auto clazz = javaClassStatic();
|
|
39
|
+
static const auto fieldConnector = clazz->getField<JChargingConnector>("connector");
|
|
40
|
+
jni::local_ref<JChargingConnector> connector = this->getFieldValue(fieldConnector);
|
|
41
|
+
static const auto fieldVoltage = clazz->getField<double>("voltage");
|
|
42
|
+
double voltage = this->getFieldValue(fieldVoltage);
|
|
43
|
+
static const auto fieldPowerKw = clazz->getField<double>("powerKw");
|
|
44
|
+
double powerKw = this->getFieldValue(fieldPowerKw);
|
|
45
|
+
static const auto fieldOnPress = clazz->getField<JFunc_void::javaobject>("onPress");
|
|
46
|
+
jni::local_ref<JFunc_void::javaobject> onPress = this->getFieldValue(fieldOnPress);
|
|
47
|
+
return NitroChargerOutlet(
|
|
48
|
+
connector->toCpp(),
|
|
49
|
+
voltage,
|
|
50
|
+
powerKw,
|
|
51
|
+
onPress != nullptr ? std::make_optional([&]() -> std::function<void()> {
|
|
52
|
+
if (onPress->isInstanceOf(JFunc_void_cxx::javaClassStatic())) [[likely]] {
|
|
53
|
+
auto downcast = jni::static_ref_cast<JFunc_void_cxx::javaobject>(onPress);
|
|
54
|
+
return downcast->cthis()->getFunction();
|
|
55
|
+
} else {
|
|
56
|
+
auto onPressRef = jni::make_global(onPress);
|
|
57
|
+
return JNICallable<JFunc_void, void()>(std::move(onPressRef));
|
|
58
|
+
}
|
|
59
|
+
}()) : std::nullopt
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
/**
|
|
65
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
66
|
+
*/
|
|
67
|
+
[[maybe_unused]]
|
|
68
|
+
static jni::local_ref<JNitroChargerOutlet::javaobject> fromCpp(const NitroChargerOutlet& value) {
|
|
69
|
+
using JSignature = JNitroChargerOutlet(jni::alias_ref<JChargingConnector>, double, double, jni::alias_ref<JFunc_void::javaobject>);
|
|
70
|
+
static const auto clazz = javaClassStatic();
|
|
71
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
72
|
+
return create(
|
|
73
|
+
clazz,
|
|
74
|
+
JChargingConnector::fromCpp(value.connector),
|
|
75
|
+
value.voltage,
|
|
76
|
+
value.powerKw,
|
|
77
|
+
value.onPress.has_value() ? JFunc_void_cxx::fromCpp(value.onPress.value()) : nullptr
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|