@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
|
@@ -36,6 +36,14 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct GlyphImage;
|
|
|
36
36
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct AssetImage; }
|
|
37
37
|
// Forward declaration of `RemoteImage` to properly resolve imports.
|
|
38
38
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct RemoteImage; }
|
|
39
|
+
// Forward declaration of `ListImageType` to properly resolve imports.
|
|
40
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { enum class ListImageType; }
|
|
41
|
+
// Forward declaration of `WaypointCoordinate` to properly resolve imports.
|
|
42
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct WaypointCoordinate; }
|
|
43
|
+
// Forward declaration of `Distance` to properly resolve imports.
|
|
44
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct Distance; }
|
|
45
|
+
// Forward declaration of `DurationWithTimeZone` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct DurationWithTimeZone; }
|
|
39
47
|
|
|
40
48
|
#include "AutoText.hpp"
|
|
41
49
|
#include <optional>
|
|
@@ -43,7 +51,12 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay { struct RemoteImage
|
|
|
43
51
|
#include "AssetImage.hpp"
|
|
44
52
|
#include "RemoteImage.hpp"
|
|
45
53
|
#include <variant>
|
|
54
|
+
#include "ListImageType.hpp"
|
|
46
55
|
#include <functional>
|
|
56
|
+
#include "WaypointCoordinate.hpp"
|
|
57
|
+
#include "Distance.hpp"
|
|
58
|
+
#include "DurationWithTimeZone.hpp"
|
|
59
|
+
#include <string>
|
|
47
60
|
|
|
48
61
|
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
49
62
|
|
|
@@ -57,13 +70,19 @@ namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
|
57
70
|
std::optional<bool> browsable SWIFT_PRIVATE;
|
|
58
71
|
bool enabled SWIFT_PRIVATE;
|
|
59
72
|
std::optional<std::variant<GlyphImage, AssetImage, RemoteImage>> image SWIFT_PRIVATE;
|
|
73
|
+
std::optional<ListImageType> imageType SWIFT_PRIVATE;
|
|
60
74
|
std::optional<bool> checked SWIFT_PRIVATE;
|
|
61
75
|
std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress SWIFT_PRIVATE;
|
|
62
76
|
std::optional<bool> selected SWIFT_PRIVATE;
|
|
77
|
+
std::optional<WaypointCoordinate> coordinate SWIFT_PRIVATE;
|
|
78
|
+
std::optional<Distance> distance SWIFT_PRIVATE;
|
|
79
|
+
std::optional<DurationWithTimeZone> duration SWIFT_PRIVATE;
|
|
80
|
+
std::optional<bool> travelEstimatesVisible SWIFT_PRIVATE;
|
|
81
|
+
std::optional<std::string> address SWIFT_PRIVATE;
|
|
63
82
|
|
|
64
83
|
public:
|
|
65
84
|
NitroRow() = default;
|
|
66
|
-
explicit NitroRow(AutoText title, std::optional<AutoText> detailedText, std::optional<bool> browsable, bool enabled, std::optional<std::variant<GlyphImage, AssetImage, RemoteImage>> image, std::optional<bool> checked, std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress, std::optional<bool> selected): title(title), detailedText(detailedText), browsable(browsable), enabled(enabled), image(image), checked(checked), onPress(onPress), selected(selected) {}
|
|
85
|
+
explicit NitroRow(AutoText title, std::optional<AutoText> detailedText, std::optional<bool> browsable, bool enabled, std::optional<std::variant<GlyphImage, AssetImage, RemoteImage>> image, std::optional<ListImageType> imageType, std::optional<bool> checked, std::optional<std::function<void(std::optional<bool> /* checked */)>> onPress, std::optional<bool> selected, std::optional<WaypointCoordinate> coordinate, std::optional<Distance> distance, std::optional<DurationWithTimeZone> duration, std::optional<bool> travelEstimatesVisible, std::optional<std::string> address): title(title), detailedText(detailedText), browsable(browsable), enabled(enabled), image(image), imageType(imageType), checked(checked), onPress(onPress), selected(selected), coordinate(coordinate), distance(distance), duration(duration), travelEstimatesVisible(travelEstimatesVisible), address(address) {}
|
|
67
86
|
|
|
68
87
|
public:
|
|
69
88
|
// NitroRow is not equatable because these properties are not equatable: onPress
|
|
@@ -84,9 +103,15 @@ namespace margelo::nitro {
|
|
|
84
103
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "browsable"))),
|
|
85
104
|
JSIConverter<bool>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled"))),
|
|
86
105
|
JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image"))),
|
|
106
|
+
JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::ListImageType>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageType"))),
|
|
87
107
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked"))),
|
|
88
108
|
JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onPress"))),
|
|
89
|
-
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected")))
|
|
109
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected"))),
|
|
110
|
+
JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coordinate"))),
|
|
111
|
+
JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::Distance>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance"))),
|
|
112
|
+
JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::DurationWithTimeZone>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration"))),
|
|
113
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "travelEstimatesVisible"))),
|
|
114
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "address")))
|
|
90
115
|
);
|
|
91
116
|
}
|
|
92
117
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::NitroRow& arg) {
|
|
@@ -96,9 +121,15 @@ namespace margelo::nitro {
|
|
|
96
121
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "browsable"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.browsable));
|
|
97
122
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "enabled"), JSIConverter<bool>::toJSI(runtime, arg.enabled));
|
|
98
123
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "image"), JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::toJSI(runtime, arg.image));
|
|
124
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "imageType"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::ListImageType>>::toJSI(runtime, arg.imageType));
|
|
99
125
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "checked"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.checked));
|
|
100
126
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "onPress"), JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::toJSI(runtime, arg.onPress));
|
|
101
127
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "selected"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.selected));
|
|
128
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "coordinate"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate>>::toJSI(runtime, arg.coordinate));
|
|
129
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "distance"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::Distance>>::toJSI(runtime, arg.distance));
|
|
130
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "duration"), JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::DurationWithTimeZone>>::toJSI(runtime, arg.duration));
|
|
131
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "travelEstimatesVisible"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.travelEstimatesVisible));
|
|
132
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "address"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.address));
|
|
102
133
|
return obj;
|
|
103
134
|
}
|
|
104
135
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -114,9 +145,15 @@ namespace margelo::nitro {
|
|
|
114
145
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "browsable")))) return false;
|
|
115
146
|
if (!JSIConverter<bool>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "enabled")))) return false;
|
|
116
147
|
if (!JSIConverter<std::optional<std::variant<margelo::nitro::swe::iternio::reactnativeautoplay::GlyphImage, margelo::nitro::swe::iternio::reactnativeautoplay::AssetImage, margelo::nitro::swe::iternio::reactnativeautoplay::RemoteImage>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "image")))) return false;
|
|
148
|
+
if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::ListImageType>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "imageType")))) return false;
|
|
117
149
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "checked")))) return false;
|
|
118
150
|
if (!JSIConverter<std::optional<std::function<void(std::optional<bool>)>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "onPress")))) return false;
|
|
119
151
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "selected")))) return false;
|
|
152
|
+
if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "coordinate")))) return false;
|
|
153
|
+
if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::Distance>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "distance")))) return false;
|
|
154
|
+
if (!JSIConverter<std::optional<margelo::nitro::swe::iternio::reactnativeautoplay::DurationWithTimeZone>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "duration")))) return false;
|
|
155
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "travelEstimatesVisible")))) return false;
|
|
156
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "address")))) return false;
|
|
120
157
|
return true;
|
|
121
158
|
}
|
|
122
159
|
};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// WaypointCoordinate.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
|
|
35
|
+
namespace margelo::nitro::swe::iternio::reactnativeautoplay {
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A struct which can be represented as a JavaScript object (WaypointCoordinate).
|
|
39
|
+
*/
|
|
40
|
+
struct WaypointCoordinate final {
|
|
41
|
+
public:
|
|
42
|
+
double latitude SWIFT_PRIVATE;
|
|
43
|
+
double longitude SWIFT_PRIVATE;
|
|
44
|
+
std::optional<double> altitude SWIFT_PRIVATE;
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
WaypointCoordinate() = default;
|
|
48
|
+
explicit WaypointCoordinate(double latitude, double longitude, std::optional<double> altitude): latitude(latitude), longitude(longitude), altitude(altitude) {}
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
friend bool operator==(const WaypointCoordinate& lhs, const WaypointCoordinate& rhs) = default;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
} // namespace margelo::nitro::swe::iternio::reactnativeautoplay
|
|
55
|
+
|
|
56
|
+
namespace margelo::nitro {
|
|
57
|
+
|
|
58
|
+
// C++ WaypointCoordinate <> JS WaypointCoordinate (object)
|
|
59
|
+
template <>
|
|
60
|
+
struct JSIConverter<margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate> final {
|
|
61
|
+
static inline margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
62
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
63
|
+
return margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate(
|
|
64
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude"))),
|
|
65
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude"))),
|
|
66
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "altitude")))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::swe::iternio::reactnativeautoplay::WaypointCoordinate& arg) {
|
|
70
|
+
jsi::Object obj(runtime);
|
|
71
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "latitude"), JSIConverter<double>::toJSI(runtime, arg.latitude));
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "longitude"), JSIConverter<double>::toJSI(runtime, arg.longitude));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "altitude"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.altitude));
|
|
74
|
+
return obj;
|
|
75
|
+
}
|
|
76
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
77
|
+
if (!value.isObject()) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
jsi::Object obj = value.getObject(runtime);
|
|
81
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
82
|
+
return false;
|
|
83
|
+
}
|
|
84
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "latitude")))) return false;
|
|
85
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "longitude")))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "altitude")))) return false;
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
package/src/Constants.ts
ADDED
package/src/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ import type {
|
|
|
15
15
|
import type { NitroNavigationAlert } from '../utils/NitroAlert';
|
|
16
16
|
import type { NitroManeuver } from '../utils/NitroManeuver';
|
|
17
17
|
import type { NitroMapButton } from '../utils/NitroMapButton';
|
|
18
|
+
import type { NitroOptionsPanelConfig } from '../utils/NitroOptionsPanel';
|
|
18
19
|
import type { NitroTemplateConfig } from './AutoPlay.nitro';
|
|
19
20
|
|
|
20
21
|
interface MapTemplateConfig extends NitroTemplateConfig, NitroMapTemplateConfig {}
|
|
@@ -47,7 +48,8 @@ export interface MapTemplate extends HybridObject<{ android: 'kotlin'; ios: 'swi
|
|
|
47
48
|
): void;
|
|
48
49
|
updateTravelEstimates(templateId: string, steps: Array<TripPoint>): void;
|
|
49
50
|
updateManeuvers(templateId: string, maneuvers: NitroManeuver): void;
|
|
50
|
-
startNavigation(templateId: string, trip: TripConfig): void
|
|
51
|
+
startNavigation(templateId: string, trip: TripConfig): Promise<void>;
|
|
51
52
|
stopNavigation(templateId: string): void;
|
|
52
53
|
setManeuverState(templateId: string, state: ManeuverState): void;
|
|
54
|
+
updateOptionsPanel(templateId: string, config?: NitroOptionsPanelConfig): Promise<void>;
|
|
53
55
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import { Platform } from 'react-native';
|
|
1
2
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
3
|
import type { GridTemplate as NitroGridTemplate } from '../specs/GridTemplate.nitro';
|
|
3
4
|
import type { AutoText } from '../types/Text';
|
|
4
5
|
import { type NitroAction, NitroActionUtil } from '../utils/NitroAction';
|
|
5
6
|
import { type GridButton, type NitroGridButton, NitroGridUtil } from '../utils/NitroGrid';
|
|
6
7
|
import { NitroMapButton } from '../utils/NitroMapButton';
|
|
7
|
-
import type { BaseMapTemplateConfig } from './MapTemplate';
|
|
8
|
+
import type { BaseMapTemplateConfig, PanelHeaderActions } from './MapTemplate';
|
|
8
9
|
import {
|
|
9
10
|
type HeaderActions,
|
|
10
11
|
type NitroBaseMapTemplateConfig,
|
|
@@ -15,10 +16,17 @@ import {
|
|
|
15
16
|
|
|
16
17
|
const HybridGridTemplate = NitroModules.createHybridObject<NitroGridTemplate>('GridTemplate');
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Controls the size of Android grid items. A selected size requires Android Car API 8.
|
|
21
|
+
* @namespace Android
|
|
22
|
+
*/
|
|
23
|
+
export type GridImageSize = 'unset' | 'large' | 'medium' | 'small';
|
|
24
|
+
|
|
18
25
|
export interface NitroGridTemplateConfig extends TemplateConfig {
|
|
19
26
|
headerActions?: Array<NitroAction>;
|
|
20
27
|
title: AutoText;
|
|
21
28
|
buttons: Array<NitroGridButton>;
|
|
29
|
+
imageSize?: GridImageSize;
|
|
22
30
|
mapConfig?: NitroBaseMapTemplateConfig;
|
|
23
31
|
}
|
|
24
32
|
|
|
@@ -34,10 +42,25 @@ export type GridTemplateConfig = Omit<
|
|
|
34
42
|
buttons: Array<GridButton<GridTemplate>>;
|
|
35
43
|
|
|
36
44
|
/**
|
|
37
|
-
*
|
|
45
|
+
* Controls the size of all images in the Android grid. Defaults to `unset`, which preserves
|
|
46
|
+
* the platform's standard grid layout. `large`, `medium`, and `small` require Android Car API
|
|
47
|
+
* 8. Ignored (with a `__DEV__` warning) when `mapConfig` is also set — `MapWithContentTemplate`
|
|
48
|
+
* does not support the sized grid content type.
|
|
38
49
|
* @namespace Android
|
|
39
50
|
*/
|
|
40
|
-
|
|
51
|
+
imageSize?: GridImageSize;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* If mapConfig is defined, it will use a MapWithContentTemplate with the current template. This results in a GridTemplate with a map in background. No actions need to be specified, can be empty object.
|
|
55
|
+
* @namespace Android - uses MapWithContentTemplate
|
|
56
|
+
* @namespace iOS - renders as a CPMapPanel on the current root map template (iOS 27+);
|
|
57
|
+
* `headerActions` here is Android-only — on iOS this template's own `headerActions` are
|
|
58
|
+
* applied to the root map template's nav bar instead, since CarPlay has no separate header
|
|
59
|
+
* for the map behind a panel.
|
|
60
|
+
*/
|
|
61
|
+
mapConfig?: Omit<BaseMapTemplateConfig<GridTemplate>, 'headerActions'> & {
|
|
62
|
+
headerActions?: PanelHeaderActions<GridTemplate>;
|
|
63
|
+
};
|
|
41
64
|
};
|
|
42
65
|
|
|
43
66
|
export class GridTemplate extends Template<GridTemplateConfig, HeaderActions<GridTemplate>> {
|
|
@@ -48,6 +71,18 @@ export class GridTemplate extends Template<GridTemplateConfig, HeaderActions<Gri
|
|
|
48
71
|
|
|
49
72
|
const { headerActions, buttons, mapConfig, ...rest } = config;
|
|
50
73
|
|
|
74
|
+
if (
|
|
75
|
+
__DEV__ &&
|
|
76
|
+
Platform.OS === 'android' &&
|
|
77
|
+
mapConfig != null &&
|
|
78
|
+
rest.imageSize != null &&
|
|
79
|
+
rest.imageSize !== 'unset'
|
|
80
|
+
) {
|
|
81
|
+
console.warn(
|
|
82
|
+
'GridTemplate: imageSize is ignored on Android when mapConfig is set — MapWithContentTemplate does not support the sized grid content type'
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
51
86
|
const nitroConfig: NitroGridTemplateConfig & NitroTemplateConfig = {
|
|
52
87
|
...rest,
|
|
53
88
|
id: this.id,
|
|
@@ -7,7 +7,7 @@ import { type NitroAction, NitroActionUtil } from '../utils/NitroAction';
|
|
|
7
7
|
import { NitroMapButton } from '../utils/NitroMapButton';
|
|
8
8
|
import { type NitroSection, NitroSectionUtil } from '../utils/NitroSection';
|
|
9
9
|
import type { SingleSection, TextRow } from './ListTemplate';
|
|
10
|
-
import type { BaseMapTemplateConfig } from './MapTemplate';
|
|
10
|
+
import type { BaseMapTemplateConfig, PanelActionsIos, PanelHeaderActions } from './MapTemplate';
|
|
11
11
|
import {
|
|
12
12
|
type HeaderActions,
|
|
13
13
|
type NitroBaseMapTemplateConfig,
|
|
@@ -16,6 +16,10 @@ import {
|
|
|
16
16
|
type TemplateConfig,
|
|
17
17
|
} from './Template';
|
|
18
18
|
|
|
19
|
+
type InformationActionsAndroid<T> =
|
|
20
|
+
| [CustomActionButtonAndroid<T>]
|
|
21
|
+
| [CustomActionButtonAndroid<T>, CustomActionButtonAndroid<T>];
|
|
22
|
+
|
|
19
23
|
const HybridInformationTemplate =
|
|
20
24
|
NitroModules.createHybridObject<NitroInformationTemplate>('InformationTemplate');
|
|
21
25
|
|
|
@@ -33,7 +37,7 @@ export type InformationItems =
|
|
|
33
37
|
| [TextRow, TextRow, TextRow]
|
|
34
38
|
| [TextRow, TextRow, TextRow, TextRow];
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
type InformationTemplateBaseConfig = Omit<
|
|
37
41
|
NitroInformationTemplateConfig,
|
|
38
42
|
'headerActions' | 'section' | 'mapConfig' | 'actions'
|
|
39
43
|
> & {
|
|
@@ -47,35 +51,62 @@ export type InformationTemplateConfig = Omit<
|
|
|
47
51
|
* @namespace iOS this is an InformationTemplate, ⚠️ the row image is NOT supported
|
|
48
52
|
*/
|
|
49
53
|
items?: InformationItems;
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* If mapConfig is defined, it will use a MapWithContentTemplate with the current template. This results in a PaneTemplate with a map in background. No actions need to be specified, can be empty object.
|
|
53
|
-
* @namespace Android
|
|
54
|
-
*/
|
|
55
|
-
mapConfig?: BaseMapTemplateConfig<InformationTemplate>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* @namespace Android up to 2 buttons of type TextButton, TextAndImageButton or ImageButton
|
|
59
|
-
* @namespace iOS - up to 3 buttons of type TextButton
|
|
60
|
-
*/
|
|
61
|
-
actions?: {
|
|
62
|
-
android?:
|
|
63
|
-
| [CustomActionButtonAndroid<InformationTemplate>]
|
|
64
|
-
| [
|
|
65
|
-
CustomActionButtonAndroid<InformationTemplate>,
|
|
66
|
-
CustomActionButtonAndroid<InformationTemplate>,
|
|
67
|
-
];
|
|
68
|
-
ios?:
|
|
69
|
-
| [
|
|
70
|
-
TextButton<InformationTemplate>,
|
|
71
|
-
TextButton<InformationTemplate>,
|
|
72
|
-
TextButton<InformationTemplate>,
|
|
73
|
-
]
|
|
74
|
-
| [TextButton<InformationTemplate>, TextButton<InformationTemplate>]
|
|
75
|
-
| [TextButton<InformationTemplate>];
|
|
76
|
-
};
|
|
77
54
|
};
|
|
78
55
|
|
|
56
|
+
/**
|
|
57
|
+
* `actions`/`mapConfig` are a discriminated union — `mapConfig` restricts `actions.ios` to at
|
|
58
|
+
* most one `TextButton` plus one icon-only `ImageButton` (a `CPMapPanel` can't show more), vs. up
|
|
59
|
+
* to three `TextButton`s otherwise. If your `mapConfig` value comes from a variable/prop rather
|
|
60
|
+
* than an inline literal, TS can't narrow which branch applies — assign it to a local `const` and
|
|
61
|
+
* branch with `if (mapConfig) { ... } else { ... }` into two separate constructor calls instead
|
|
62
|
+
* of passing it straight through to one.
|
|
63
|
+
*/
|
|
64
|
+
export type InformationTemplateConfig = InformationTemplateBaseConfig &
|
|
65
|
+
(
|
|
66
|
+
| {
|
|
67
|
+
mapConfig?: undefined;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @namespace Android up to 2 buttons of type TextButton, TextAndImageButton or ImageButton
|
|
71
|
+
* @namespace iOS - up to 3 buttons of type TextButton
|
|
72
|
+
*/
|
|
73
|
+
actions?: {
|
|
74
|
+
android?: InformationActionsAndroid<InformationTemplate>;
|
|
75
|
+
ios?:
|
|
76
|
+
| [
|
|
77
|
+
TextButton<InformationTemplate>,
|
|
78
|
+
TextButton<InformationTemplate>,
|
|
79
|
+
TextButton<InformationTemplate>,
|
|
80
|
+
]
|
|
81
|
+
| [TextButton<InformationTemplate>, TextButton<InformationTemplate>]
|
|
82
|
+
| [TextButton<InformationTemplate>];
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
| {
|
|
86
|
+
/**
|
|
87
|
+
* If mapConfig is defined, it will use a MapWithContentTemplate with the current template. This results in a PaneTemplate with a map in background. No actions need to be specified, can be empty object.
|
|
88
|
+
* @namespace Android - uses MapWithContentTemplate
|
|
89
|
+
* @namespace iOS - renders as a CPMapPanel on the current root map template (iOS 27+);
|
|
90
|
+
* `headerActions` here is Android-only — on iOS this template's own `headerActions` are
|
|
91
|
+
* applied to the root map template's nav bar instead, since CarPlay has no separate
|
|
92
|
+
* header for the map behind a panel.
|
|
93
|
+
*/
|
|
94
|
+
mapConfig: Omit<BaseMapTemplateConfig<InformationTemplate>, 'headerActions'> & {
|
|
95
|
+
headerActions?: PanelHeaderActions<InformationTemplate>;
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* @namespace Android up to 2 buttons of type TextButton, TextAndImageButton or ImageButton
|
|
100
|
+
* @namespace iOS - the panel can only show one TextButton plus one optional icon-only
|
|
101
|
+
* ImageButton, see PanelActionsIos
|
|
102
|
+
*/
|
|
103
|
+
actions?: {
|
|
104
|
+
android?: InformationActionsAndroid<InformationTemplate>;
|
|
105
|
+
ios?: PanelActionsIos<InformationTemplate>;
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
|
|
79
110
|
export class InformationTemplate extends Template<
|
|
80
111
|
InformationTemplateConfig,
|
|
81
112
|
HeaderActions<InformationTemplate>
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { NitroModules } from 'react-native-nitro-modules';
|
|
2
2
|
import type { ListTemplate as NitroListTemplate } from '../specs/ListTemplate.nitro';
|
|
3
|
-
import type { AutoImage } from '../types/Image';
|
|
4
3
|
import type { AutoText } from '../types/Text';
|
|
5
4
|
import { type NitroAction, NitroActionUtil } from '../utils/NitroAction';
|
|
6
5
|
import { NitroMapButton } from '../utils/NitroMapButton';
|
|
7
|
-
import { type NitroSection, NitroSectionUtil } from '../utils/NitroSection';
|
|
8
|
-
import type { BaseMapTemplateConfig } from './MapTemplate';
|
|
6
|
+
import { type NitroSection, NitroSectionUtil, type Section } from '../utils/NitroSection';
|
|
7
|
+
import type { BaseMapTemplateConfig, PanelHeaderActions } from './MapTemplate';
|
|
9
8
|
import {
|
|
10
9
|
type HeaderActions,
|
|
11
10
|
type NitroBaseMapTemplateConfig,
|
|
@@ -16,56 +15,23 @@ import {
|
|
|
16
15
|
|
|
17
16
|
const HybridListTemplate = NitroModules.createHybridObject<NitroListTemplate>('ListTemplate');
|
|
18
17
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
export type
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
type: 'toggle';
|
|
37
|
-
checked: boolean;
|
|
38
|
-
onPress: (template: T, checked: boolean) => void;
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export type RadioRow<T> = BaseRow & {
|
|
42
|
-
type: 'radio';
|
|
43
|
-
onPress: (template: T) => void;
|
|
44
|
-
selected?: boolean;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export type TextRow = BaseRow & {
|
|
48
|
-
type: 'text';
|
|
49
|
-
detailedText?: AutoText;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export type MultiSection<T> =
|
|
53
|
-
| {
|
|
54
|
-
type: 'default';
|
|
55
|
-
title: string;
|
|
56
|
-
items: Array<DefaultRow<T> | ToggleRow<T> | TextRow>;
|
|
57
|
-
}
|
|
58
|
-
| {
|
|
59
|
-
type: 'radio';
|
|
60
|
-
title: string;
|
|
61
|
-
items: Array<RadioRow<T>>;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export type SingleSection<T> = {
|
|
65
|
-
[K in MultiSection<T> as K['type']]: Omit<K, 'title' | 'detailedText'>;
|
|
66
|
-
}[MultiSection<T>['type']];
|
|
67
|
-
|
|
68
|
-
export type Section<T> = Array<MultiSection<T>> | SingleSection<T>;
|
|
18
|
+
/**
|
|
19
|
+
* Controls the Android image size for a list item.
|
|
20
|
+
* @namespace Android
|
|
21
|
+
*/
|
|
22
|
+
export type ListImageType = 'large' | 'medium' | 'small' | 'extra_small' | 'icon';
|
|
23
|
+
|
|
24
|
+
export type {
|
|
25
|
+
DefaultRow,
|
|
26
|
+
MultiSection,
|
|
27
|
+
RadioRow,
|
|
28
|
+
Section,
|
|
29
|
+
SingleSection,
|
|
30
|
+
TextRow,
|
|
31
|
+
ToggleRow,
|
|
32
|
+
WaypointCoordinate,
|
|
33
|
+
WaypointRow,
|
|
34
|
+
} from '../utils/NitroSection';
|
|
69
35
|
|
|
70
36
|
export interface NitroListTemplateConfig extends TemplateConfig {
|
|
71
37
|
headerActions?: Array<NitroAction>;
|
|
@@ -92,9 +58,15 @@ export type ListTemplateConfig = Omit<
|
|
|
92
58
|
sections?: Section<ListTemplate>;
|
|
93
59
|
/**
|
|
94
60
|
* If mapConfig is defined, it will use a MapWithContentTemplate with the current template. This results in a ListTemplate with a map in background. No actions need to be specified, can be empty object.
|
|
95
|
-
* @namespace Android
|
|
61
|
+
* @namespace Android - uses MapWithContentTemplate
|
|
62
|
+
* @namespace iOS - renders as a CPMapPanel on the current root map template (iOS 27+);
|
|
63
|
+
* `headerActions` here is Android-only — on iOS this template's own `headerActions` are
|
|
64
|
+
* applied to the root map template's nav bar instead, since CarPlay has no separate header
|
|
65
|
+
* for the map behind a panel.
|
|
96
66
|
*/
|
|
97
|
-
mapConfig?: BaseMapTemplateConfig<ListTemplate
|
|
67
|
+
mapConfig?: Omit<BaseMapTemplateConfig<ListTemplate>, 'headerActions'> & {
|
|
68
|
+
headerActions?: PanelHeaderActions<ListTemplate>;
|
|
69
|
+
};
|
|
98
70
|
};
|
|
99
71
|
|
|
100
72
|
export class ListTemplate extends Template<ListTemplateConfig, HeaderActions<ListTemplate>> {
|
|
@@ -7,7 +7,13 @@ import { SafeAreaInsetsProvider } from '../components/SafeAreaInsetsContext';
|
|
|
7
7
|
import { WindowInformationWrapper } from '../components/WindowInformationWrapper';
|
|
8
8
|
import { HybridAutoPlay } from '../hybrid/HybridAutoPlay';
|
|
9
9
|
import type { MapTemplate as NitroMapTemplate } from '../specs/MapTemplate.nitro';
|
|
10
|
-
import type {
|
|
10
|
+
import type {
|
|
11
|
+
ActionButtonAndroid,
|
|
12
|
+
ImageButton,
|
|
13
|
+
MapButton,
|
|
14
|
+
MapPanButton,
|
|
15
|
+
TextButton,
|
|
16
|
+
} from '../types/Button';
|
|
11
17
|
import type { AutoManeuver, ManeuverState } from '../types/Maneuver';
|
|
12
18
|
import type { ColorScheme, RootComponentInitialProps } from '../types/RootComponent';
|
|
13
19
|
import type {
|
|
@@ -21,6 +27,7 @@ import { type NavigationAlert, NitroAlertUtil } from '../utils/NitroAlert';
|
|
|
21
27
|
import { type NitroColor, NitroColorUtil, type ThemedColor } from '../utils/NitroColor';
|
|
22
28
|
import { NitroManeuverUtil, type NitroRoutingManeuver } from '../utils/NitroManeuver';
|
|
23
29
|
import { NitroMapButton } from '../utils/NitroMapButton';
|
|
30
|
+
import { NitroOptionsPanelUtil, type OptionsPanelConfig } from '../utils/NitroOptionsPanel';
|
|
24
31
|
import {
|
|
25
32
|
type HeaderActionsIos,
|
|
26
33
|
type NitroBaseMapTemplateConfig,
|
|
@@ -31,6 +38,17 @@ import {
|
|
|
31
38
|
|
|
32
39
|
const HybridMapTemplate = NitroModules.createHybridObject<NitroMapTemplate>('MapTemplate');
|
|
33
40
|
|
|
41
|
+
export type {
|
|
42
|
+
ChargerLocation,
|
|
43
|
+
ChargerOutlet,
|
|
44
|
+
ChargingConnector,
|
|
45
|
+
OptionsPanelChargerSection,
|
|
46
|
+
OptionsPanelConfig,
|
|
47
|
+
OptionsPanelGridSection,
|
|
48
|
+
OptionsPanelListSection,
|
|
49
|
+
OptionsPanelSection,
|
|
50
|
+
} from '../utils/NitroOptionsPanel';
|
|
51
|
+
|
|
34
52
|
export type Point = { x: number; y: number };
|
|
35
53
|
export type VisibleTravelEstimate = 'first' | 'last';
|
|
36
54
|
|
|
@@ -118,6 +136,19 @@ export type MapHeaderActions<T> = {
|
|
|
118
136
|
ios?: HeaderActionsIos<T>;
|
|
119
137
|
};
|
|
120
138
|
|
|
139
|
+
/**
|
|
140
|
+
* @namespace iOS - not supported; CarPlay has no separate header for the map behind a panel, so
|
|
141
|
+
* the panel template's own `headerActions` are applied to the root map template's nav bar instead.
|
|
142
|
+
*/
|
|
143
|
+
export type PanelHeaderActions<T> = Omit<MapHeaderActions<T>, 'ios'>;
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @namespace iOS - a CPMapPanel can only show one CPTextButton (with a title) and one
|
|
147
|
+
* optional icon-only button (any title is dropped natively), so a second action must be an
|
|
148
|
+
* ImageButton rather than a TextButton, and a third action isn't supported at all.
|
|
149
|
+
*/
|
|
150
|
+
export type PanelActionsIos<T> = [TextButton<T>] | [TextButton<T>, ImageButton<T>];
|
|
151
|
+
|
|
121
152
|
export type BaseMapTemplateConfig<T> = {
|
|
122
153
|
/**
|
|
123
154
|
* buttons that represent actions on the map template, usually on the bottom right corner
|
|
@@ -146,6 +177,13 @@ export type MapTemplateConfig = Omit<
|
|
|
146
177
|
*/
|
|
147
178
|
component: React.ComponentType<RootComponentInitialProps>;
|
|
148
179
|
|
|
180
|
+
/**
|
|
181
|
+
* the panel shown when tapping the ellipsis button next to the travel estimates during active navigation (iOS 27+).
|
|
182
|
+
* No-op on Android
|
|
183
|
+
* @namespace iOS
|
|
184
|
+
*/
|
|
185
|
+
optionsPanel?: OptionsPanelConfig<MapTemplate>;
|
|
186
|
+
|
|
149
187
|
/**
|
|
150
188
|
* Notification that navigation was stopped. May occur when another source such as the car head unit starts navigating.
|
|
151
189
|
* The navigation session on Android Auto/CarPlay is stopped already when this callback is triggered, make sure to stop other things like TTS too.
|
|
@@ -185,6 +223,7 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
|
|
|
185
223
|
onStopNavigation,
|
|
186
224
|
onAutoDriveEnabled,
|
|
187
225
|
defaultGuidanceBackgroundColor,
|
|
226
|
+
optionsPanel,
|
|
188
227
|
...baseConfig
|
|
189
228
|
} = config;
|
|
190
229
|
|
|
@@ -220,6 +259,25 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
|
|
|
220
259
|
};
|
|
221
260
|
|
|
222
261
|
HybridMapTemplate.createMapTemplate(nitroConfig);
|
|
262
|
+
|
|
263
|
+
// routed through updateOptionsPanel, not embedded in nitroConfig above — nitrogen can't generate
|
|
264
|
+
// a spec for a variant type nested that deep inside NitroMapTemplateConfig.
|
|
265
|
+
this.updateOptionsPanel(optionsPanel);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @namespace iOS updates the panel shown when tapping the ellipsis button
|
|
270
|
+
* next to the travel estimates during navigation (iOS 27+).
|
|
271
|
+
*/
|
|
272
|
+
public updateOptionsPanel(optionsPanel?: OptionsPanelConfig<MapTemplate>) {
|
|
273
|
+
if (Platform.OS !== 'ios') {
|
|
274
|
+
return;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return HybridMapTemplate.updateOptionsPanel(
|
|
278
|
+
this.id,
|
|
279
|
+
NitroOptionsPanelUtil.convert(this.template, optionsPanel)
|
|
280
|
+
);
|
|
223
281
|
}
|
|
224
282
|
|
|
225
283
|
public setMapButtons(mapButtons: MapTemplateConfig['mapButtons']) {
|
|
@@ -364,7 +422,7 @@ export class MapTemplate extends Template<MapTemplateConfig, MapTemplateConfig['
|
|
|
364
422
|
* or use this to start a navigation session without asking the user
|
|
365
423
|
*/
|
|
366
424
|
public startNavigation(trip: TripConfig) {
|
|
367
|
-
HybridMapTemplate.startNavigation(this.id, trip);
|
|
425
|
+
return HybridMapTemplate.startNavigation(this.id, trip);
|
|
368
426
|
}
|
|
369
427
|
|
|
370
428
|
public stopNavigation() {
|