@iternio/react-native-auto-play 0.5.14-beta.1 → 0.6.1
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 +270 -36
- 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 +69 -15
- 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/jest.js +2 -0
- 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/index.web.d.ts +73 -0
- package/lib/index.web.js +72 -1
- 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/types/Image.d.ts +6 -1
- package/lib/utils/NitroColor.d.ts +1 -0
- package/lib/utils/NitroColor.js +8 -0
- package/lib/utils/NitroImage.js +1 -1
- package/lib/utils/NitroManeuver.js +1 -3
- 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/lib-cjs/AutoPlayHeadlessJsTask.js +16 -0
- package/lib-cjs/Constants.js +9 -0
- package/lib-cjs/components/MapTemplateContext.js +10 -0
- package/lib-cjs/components/SafeAreaInsetsContext.js +21 -0
- package/lib-cjs/components/SafeAreaView.js +22 -0
- package/lib-cjs/components/WindowInformationWrapper.js +20 -0
- package/lib-cjs/hooks/useAndroidAutoTelemetry.js +115 -0
- package/lib-cjs/hooks/useFocusedEffect.js +35 -0
- package/lib-cjs/hooks/useMapTemplate.js +13 -0
- package/lib-cjs/hooks/useSafeAreaInsets.js +9 -0
- package/lib-cjs/hooks/useVoiceInput.js +42 -0
- package/lib-cjs/hybrid/HybridAndroidAutoTelemetry.js +4 -0
- package/lib-cjs/hybrid/HybridAndroidWindowInformation.js +4 -0
- package/lib-cjs/hybrid/HybridAutoPlay.js +5 -0
- package/lib-cjs/hybrid/HybridVoice.js +61 -0
- package/lib-cjs/index.js +76 -0
- package/lib-cjs/index.web.js +98 -0
- package/lib-cjs/scenes/AutoPlayCluster.js +140 -0
- package/lib-cjs/scenes/CarPlayDashboardScene.js +100 -0
- package/lib-cjs/specs/AndroidAutoTelemetry.nitro.js +2 -0
- package/lib-cjs/specs/AndroidAutomotive.nitro.js +16 -0
- package/lib-cjs/specs/AndroidWindowInformation.nitro.js +2 -0
- package/lib-cjs/specs/AutoPlay.nitro.js +2 -0
- package/lib-cjs/specs/CarPlayDashboard.nitro.js +2 -0
- package/lib-cjs/specs/Cluster.nitro.js +2 -0
- package/lib-cjs/specs/GridTemplate.nitro.js +2 -0
- package/lib-cjs/specs/InformationTemplate.nitro.js +2 -0
- package/lib-cjs/specs/ListTemplate.nitro.js +2 -0
- package/lib-cjs/specs/MapTemplate.nitro.js +2 -0
- package/lib-cjs/specs/MessageTemplate.nitro.js +2 -0
- package/lib-cjs/specs/SearchTemplate.nitro.js +2 -0
- package/lib-cjs/specs/SignInTemplate.nitro.js +2 -0
- package/lib-cjs/specs/Voice.nitro.js +2 -0
- package/lib-cjs/templates/GridTemplate.js +41 -0
- package/lib-cjs/templates/InformationTemplate.js +49 -0
- package/lib-cjs/templates/ListTemplate.js +33 -0
- package/lib-cjs/templates/MapTemplate.js +168 -0
- package/lib-cjs/templates/MessageTemplate.js +50 -0
- package/lib-cjs/templates/SearchTemplate.js +32 -0
- package/lib-cjs/templates/SignInTemplate.js +55 -0
- package/lib-cjs/templates/Template.js +40 -0
- package/lib-cjs/types/Button.js +12 -0
- package/lib-cjs/types/Event.js +2 -0
- package/lib-cjs/types/Image.js +2 -0
- package/lib-cjs/types/Maneuver.js +77 -0
- package/lib-cjs/types/RootComponent.js +2 -0
- package/lib-cjs/types/SignInMethod.js +22 -0
- package/lib-cjs/types/Telemetry.js +24 -0
- package/lib-cjs/types/Text.js +8 -0
- package/lib-cjs/types/Trip.js +2 -0
- package/lib-cjs/types/Voice.js +2 -0
- package/lib-cjs/utils/ErrorUtil.js +34 -0
- package/lib-cjs/utils/NitroAction.js +129 -0
- package/lib-cjs/utils/NitroAlert.js +19 -0
- package/lib-cjs/utils/NitroAttributedString.js +14 -0
- package/lib-cjs/utils/NitroColor.js +32 -0
- package/lib-cjs/utils/NitroGrid.js +12 -0
- package/lib-cjs/utils/NitroImage.js +97 -0
- package/lib-cjs/utils/NitroManeuver.js +79 -0
- package/lib-cjs/utils/NitroMapButton.js +33 -0
- package/lib-cjs/utils/NitroOptionsPanel.js +66 -0
- package/lib-cjs/utils/NitroSection.js +112 -0
- 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++/JNitroColor.hpp +8 -4
- 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/NitroColor.kt +9 -4
- 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/NitroColor.swift +20 -2
- 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++/NitroColor.hpp +7 -3
- 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 +7 -3
- package/src/Constants.ts +9 -0
- package/src/index.ts +1 -0
- package/src/index.web.ts +166 -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/types/Image.ts +6 -1
- package/src/utils/NitroColor.ts +10 -1
- package/src/utils/NitroImage.ts +1 -5
- package/src/utils/NitroManeuver.ts +1 -4
- package/src/utils/NitroOptionsPanel.ts +218 -0
- package/src/utils/NitroSection.ts +160 -5
|
@@ -1,7 +1,95 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type {
|
|
1
|
+
import type { ListImageType } from '../templates/ListTemplate';
|
|
2
|
+
import type { AutoImage } from '../types/Image';
|
|
3
|
+
import { type AutoText, type Distance, TextPlaceholders } from '../types/Text';
|
|
4
|
+
import type { DurationWithTimeZone } from '../types/Trip';
|
|
3
5
|
import { type NitroImage, NitroImageUtil } from './NitroImage';
|
|
4
6
|
|
|
7
|
+
type BaseRow = {
|
|
8
|
+
title: AutoText;
|
|
9
|
+
enabled?: boolean;
|
|
10
|
+
image?: AutoImage;
|
|
11
|
+
/** @namespace Android */
|
|
12
|
+
imageType?: ListImageType;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export type DefaultRow<T> = BaseRow & {
|
|
16
|
+
type: 'default';
|
|
17
|
+
/**
|
|
18
|
+
* adds a chevron at the end of the row
|
|
19
|
+
*/
|
|
20
|
+
browsable?: boolean;
|
|
21
|
+
onPress: (template: T) => void;
|
|
22
|
+
detailedText?: AutoText;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export type ToggleRow<T> = BaseRow & {
|
|
26
|
+
type: 'toggle';
|
|
27
|
+
checked: boolean;
|
|
28
|
+
onPress: (template: T, checked: boolean) => void;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export type RadioRow<T> = BaseRow & {
|
|
32
|
+
type: 'radio';
|
|
33
|
+
onPress: (template: T) => void;
|
|
34
|
+
selected?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type TextRow = BaseRow & {
|
|
38
|
+
type: 'text';
|
|
39
|
+
detailedText?: AutoText;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type WaypointCoordinate = {
|
|
43
|
+
latitude: number;
|
|
44
|
+
longitude: number;
|
|
45
|
+
altitude?: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* a point of interest, e.g. a charger's location. Renders as a `CPMapTemplateWaypoint` item
|
|
50
|
+
* (showing `title` as the name, `address` as the address, and the travel estimate for reaching
|
|
51
|
+
* it) when part of a `CPMapPanel` (iOS 27+); falls back to a plain row using `title`/`address`
|
|
52
|
+
* as the detail line everywhere else (including Android, which has no equivalent concept).
|
|
53
|
+
*/
|
|
54
|
+
export type WaypointRow<T> = BaseRow & {
|
|
55
|
+
type: 'waypoint';
|
|
56
|
+
/**
|
|
57
|
+
* add one of {@link TextPlaceholders} to add travelEstimates
|
|
58
|
+
* prefer travelEstimates.visible over that on iOS 27+
|
|
59
|
+
*/
|
|
60
|
+
address?: string;
|
|
61
|
+
coordinate: WaypointCoordinate;
|
|
62
|
+
travelEstimates: {
|
|
63
|
+
distance: Distance;
|
|
64
|
+
duration: DurationWithTimeZone;
|
|
65
|
+
/**
|
|
66
|
+
* by default travel estimates are not shown
|
|
67
|
+
* setting this to true adds another row showing CPTravelEstimates
|
|
68
|
+
* @namespace iOS 27+
|
|
69
|
+
*/
|
|
70
|
+
visible?: boolean;
|
|
71
|
+
};
|
|
72
|
+
onPress?: (template: T) => void;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
export type MultiSection<T> =
|
|
76
|
+
| {
|
|
77
|
+
type: 'default';
|
|
78
|
+
title: string;
|
|
79
|
+
items: Array<DefaultRow<T> | ToggleRow<T> | TextRow | WaypointRow<T>>;
|
|
80
|
+
}
|
|
81
|
+
| {
|
|
82
|
+
type: 'radio';
|
|
83
|
+
title: string;
|
|
84
|
+
items: Array<RadioRow<T>>;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export type SingleSection<T> = {
|
|
88
|
+
[K in MultiSection<T> as K['type']]: Omit<K, 'title' | 'detailedText'>;
|
|
89
|
+
}[MultiSection<T>['type']];
|
|
90
|
+
|
|
91
|
+
export type Section<T> = Array<MultiSection<T>> | SingleSection<T>;
|
|
92
|
+
|
|
5
93
|
type NitroSectionType = 'default' | 'radio';
|
|
6
94
|
|
|
7
95
|
export type NitroRow = {
|
|
@@ -10,9 +98,20 @@ export type NitroRow = {
|
|
|
10
98
|
browsable?: boolean;
|
|
11
99
|
enabled: boolean;
|
|
12
100
|
image?: NitroImage;
|
|
101
|
+
imageType?: ListImageType;
|
|
13
102
|
checked?: boolean;
|
|
14
103
|
onPress?: (checked?: boolean) => void;
|
|
15
104
|
selected?: boolean;
|
|
105
|
+
coordinate?: WaypointCoordinate;
|
|
106
|
+
distance?: Distance;
|
|
107
|
+
duration?: DurationWithTimeZone;
|
|
108
|
+
/**
|
|
109
|
+
* only meaningful in panel context (iOS 27+, `mapConfig` set) — adds a sibling `CPMapPanelItem`
|
|
110
|
+
* showing `distance`/`duration` as a native `CPTravelEstimates` row. Non-panel/Android rendering
|
|
111
|
+
* relies purely on `title`/`detailedText` opting in via `TextPlaceholders` instead.
|
|
112
|
+
*/
|
|
113
|
+
travelEstimatesVisible?: boolean;
|
|
114
|
+
address?: string;
|
|
16
115
|
};
|
|
17
116
|
|
|
18
117
|
export type NitroSection = {
|
|
@@ -63,13 +162,63 @@ const convert = <T>(template: T, sections?: Section<T>): Array<NitroSection> | u
|
|
|
63
162
|
];
|
|
64
163
|
};
|
|
65
164
|
|
|
165
|
+
/**
|
|
166
|
+
* `AutoText.distance`/`.duration` only take effect if `text` actually uses the matching
|
|
167
|
+
* `TextPlaceholders` marker — populate whichever of those the text references, leaving the rest
|
|
168
|
+
* of `text` untouched, so a title/address that doesn't opt in via a placeholder is unaffected.
|
|
169
|
+
*/
|
|
170
|
+
const withTravelEstimates = (
|
|
171
|
+
text: AutoText,
|
|
172
|
+
distance: Distance,
|
|
173
|
+
durationSeconds: number
|
|
174
|
+
): AutoText => {
|
|
175
|
+
const hasDistance = text.text.includes(TextPlaceholders.Distance);
|
|
176
|
+
const hasDuration = text.text.includes(TextPlaceholders.Duration);
|
|
177
|
+
|
|
178
|
+
if (!hasDistance && !hasDuration) {
|
|
179
|
+
return text;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return {
|
|
183
|
+
...text,
|
|
184
|
+
distance: hasDistance ? distance : text.distance,
|
|
185
|
+
duration: hasDuration ? durationSeconds : text.duration,
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
|
|
66
189
|
const convertRow = <T>(
|
|
67
190
|
template: T,
|
|
68
|
-
item: DefaultRow<T> | RadioRow<T> | ToggleRow<T> | TextRow
|
|
191
|
+
item: DefaultRow<T> | RadioRow<T> | ToggleRow<T> | TextRow | WaypointRow<T>
|
|
69
192
|
): NitroRow => {
|
|
70
|
-
const {
|
|
193
|
+
const { type, enabled = true, image, imageType } = item;
|
|
194
|
+
|
|
195
|
+
// `WaypointRow` has no `detailedText` of its own — `address` doubles as the detail line
|
|
196
|
+
// whenever this falls back to a plain row (non-panel context, Android).
|
|
197
|
+
let title = item.title;
|
|
198
|
+
let detailedText =
|
|
199
|
+
item.type === 'waypoint'
|
|
200
|
+
? item.address != null
|
|
201
|
+
? { text: item.address }
|
|
202
|
+
: undefined
|
|
203
|
+
: 'detailedText' in item
|
|
204
|
+
? item.detailedText
|
|
205
|
+
: undefined;
|
|
206
|
+
|
|
207
|
+
// Opt-in only: a title/address using `{distance}`/`{duration}` gets those values filled in,
|
|
208
|
+
// via the same substitution `AutoText` already does everywhere else — no separate "estimate"
|
|
209
|
+
// UI element needed for a row embedded in a list alongside other rows. Deliberately NOT gated
|
|
210
|
+
// on `travelEstimates.visible` — that flag only controls the panel-only sibling
|
|
211
|
+
// `CPTravelEstimates` item (see `Parser.swift`'s `travelEstimatesVisible` check), which has no
|
|
212
|
+
// bearing on the non-panel/Android fallback text this feeds; a placeholder in the text is
|
|
213
|
+
// already its own explicit opt-in regardless of `visible`.
|
|
214
|
+
if (item.type === 'waypoint') {
|
|
215
|
+
const { distance, duration } = item.travelEstimates;
|
|
216
|
+
title = withTravelEstimates(title, distance, duration.seconds);
|
|
217
|
+
if (detailedText != null) {
|
|
218
|
+
detailedText = withTravelEstimates(detailedText, distance, duration.seconds);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
71
221
|
|
|
72
|
-
const detailedText = 'detailedText' in item ? item.detailedText : undefined;
|
|
73
222
|
const selected = type === 'radio' ? (item.selected ?? false) : undefined;
|
|
74
223
|
|
|
75
224
|
const onTogglePress = item.type === 'toggle' ? item.onPress : undefined;
|
|
@@ -93,10 +242,16 @@ const convertRow = <T>(
|
|
|
93
242
|
detailedText,
|
|
94
243
|
enabled,
|
|
95
244
|
image: NitroImageUtil.convert(image),
|
|
245
|
+
imageType,
|
|
96
246
|
title,
|
|
97
247
|
checked: type === 'toggle' ? item.checked : undefined,
|
|
98
248
|
onPress,
|
|
99
249
|
selected,
|
|
250
|
+
coordinate: item.type === 'waypoint' ? item.coordinate : undefined,
|
|
251
|
+
distance: item.type === 'waypoint' ? item.travelEstimates.distance : undefined,
|
|
252
|
+
duration: item.type === 'waypoint' ? item.travelEstimates.duration : undefined,
|
|
253
|
+
travelEstimatesVisible: item.type === 'waypoint' ? item.travelEstimates.visible : undefined,
|
|
254
|
+
address: item.type === 'waypoint' ? item.address : undefined,
|
|
100
255
|
};
|
|
101
256
|
};
|
|
102
257
|
|