You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/js/src/manager/screen/choiceset/ChoiceSet.js
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,12 @@ import { VrHelpItem } from '../../../rpc/structs/VrHelpItem.js';
36
36
classChoiceSet{
37
37
/**
38
38
* Create a new instance of ChoiceSet
39
+
* Initialize with a title, choices, and listener. It will use the default timeout and layout, all other properties (such as prompts) will be null.
40
+
* WARNING: If you display multiple cells with the same title with the only uniquing property between cells being different `vrCommands` or a feature
41
+
* that is not displayed on the head unit (e.g. if the head unit doesn't display `secondaryArtwork` and that's the only uniquing property between two cells)
42
+
* then the cells may appear to be the same to the user in `Manual` mode. This only applies to RPC connections >= 7.1.0.
43
+
* WARNING: On < 7.1.0 connections, the title cell will be automatically modified among cells that have the same title when they are preloaded, so they will
44
+
* always appear differently on-screen when they are displayed. Unique text will be created by appending " (2)", " (3)", etc.
39
45
* @class
40
46
* @param {String} title - The choice set's title
41
47
* @param {ChoiceCell[]} choices - The choices to be displayed to the user for interaction
@@ -167,6 +169,25 @@ class _ChoiceSetManagerBase extends _SubManagerBase {
167
169
});
168
170
}
169
171
172
+
/**
173
+
* Checks if 2 or more cells have the same text/title. In case this condition is true, this function will handle the presented issue by adding "(count)".
174
+
* E.g. Choices param contains 2 cells with text/title "Address" will be handled by updating the uniqueText/uniqueTitle of the second cell to "Address (2)".
175
+
* @param {ChoiceCell[]} choices - A list of ChoiceCell objects to be uploaded
176
+
*/
177
+
_addUniqueNamesToCells(choices){
178
+
constdictCounter={};// create a string to number hash for counting similar primary texts
console.error('ChoiceSetManager: Attempted to create a choice set with duplicate cell text. Cell text must be unique. The choice set will not be set.');
322
+
if(uniqueChoiceCells.length!==choices.length){
323
+
console.error('Attempted to create a choice set with a duplicate cell. Cell must have a unique value other than its primary text. The choice set will not be set.');
303
324
returnfalse;
304
325
}
305
326
@@ -579,6 +600,22 @@ class _ChoiceSetManagerBase extends _SubManagerBase {
0 commit comments