Defining Properties

We call PROPERTIES to all those values used inside your AddOn that you want to let the publishers of Mobincube edit in order to customize and adapt the AddOn to their own needs.

All the properties must be defined in a unique file called properties.json, which uses standard JSON format. This filed has to be placed in the root folder of your AddOn. Properties can be grouped by TABS, which is really useful to make things easier for you and the publishers.

{
  "tabs": [{
      "key": "firebase",
      "label": "Firebase",
      "properties": [{
          "key": "moduleInstructions",
          "type": "label",
          "label": {"en":"Instructions:","es":"Instrucciones:"},
          "value": {"en":"This add-on works with the login add-on only. Please be sure that you've added that other module and it is loaded before the logout screen.","es":"Este add-on es un complemento al de login. Asegúrate de haber añadido la pantalla de login y que se muestra con anterioridad a ésta."}
        },{
          "key": "backgroundColor",
          "type": "color",
          "label": {"en":"Background color:","es":"Color de fondo:"},
          "value": "rgb(0,0,0)",
          "format": "hex"
        },{
          "key": "destinationScreen",
          "type": "screen",
          "label": {"en":"Destination screen:","es":"Pantalla de destino:"},
          "value": ""
        },{
          "key": "notice",
          "type": "label",
          "label": {"en":"Important:","es":"Importante:"},
          "value": {"en":"Keep this screen as an anchor point, so that the user can't navigate to previous screens after logout.","es":"Mantén esta pantalla como punto de anclaje para evitar que los usuarios puedan navegar por las pantallas anteriores después de hacer logout."}
        }]
    }]
}

When the publisher is editting your AddOn, Mobincube takes all those properties and converts them into visual input elements, so that the publisher can change property values from Mobincube's visual interface. That way, publishers don't need any html skills whatsoever, since they will never have access to the source code.

Within the properties.json file you can set default values and define the range of values that the publisher is allowed to choose. The way you can define those expected values depends on the type of property (the type of value you are asking the publisher to customize). There are different types f properties that you can use:

Additionally, you can use some non-editable properties in order to organize the properties inside Mobincube's properties panel or give the publisher some instructions on how to set-up the AddOn. These properties will make things easier for the publisher and you AddOn will be more successful:

  • Label
  • Image
  • Video
  • Line

Regardless its type, all the properties have to have these parameters:

Name
Type
Constraing
Description
key
String
Mandatory
It is a unique identifier of the property. It is used to access the value of the property from within the javascript code.
type
String
Mandatory
Defines the type of property, so that Mobincube knows that type of input element to use for the publisher to enter a value for the property.

Values:
text|range|color|checkbox|list|map|date|select|screen
label
String
Recommended
It is the text that will appear on Mobincube before the property input, so that the publisher knows what the property is for. The label accepts multiple values, one text for each of the desired languages. The key for each value must be the ISO code of the corresponding language.

Example:
{"en":"text in english","es":"text in spanish"}
value
varies
Optional
It is the default value of the property, just in case the publisher doesn't enter a value. In some addons it is highly recommended to use default values, in order to make it easier for the publisher to build the app. For instance, if you develop a menu addon, you might create some buttons by default, so the publisher finds a pre-made menu where it is easier to edit buttons rather than build it from scratch. In other cases you'll prefer not to use a default value and force the publisher to enter a value. For instance, in case you are developing an addon that relies on Firebase, you might want publishers to enter their own Firebase API key./

TEXT properties

Lets publishers enter a text value. The value will be stored as a String

Name
Type
Constraing
Description
multiline
Boolean
Optional
If false or undefined, the text input has only one line height. If it's TRUE, the text input will auto expand when needed.
maxLines
Integer
Optional
If the multiline parameter is undefined of false, this one is ignored. If multiline is true, the maxLines defines the number of lines of the text input. If the parameter is not defined, the text area will expand automatically without limit.

RANGE properties

Lets publishers enter a number value. The value will be stored as a Double. Mobincube will use a slider bar, so the user can pick a value. There will also be a text input next to the slider, in case the publisher prefers to write the value.

Name
Type
Constraing
Description
min
Float
Mandatory
The minimum value that can be selected using the slider.
max
Float
Mandatory
The maximum value that can be selected using the slider.
step
Float
Mandatory
The gap between 2 consecutive values of the slider.
decimals
Integer
Optional
The number of decimals that can have the selected number. By default, it is set to zero decimals

COLOR properties

Lets publishers enter a color value. The value will be stored as a String. Mobincube will use a color picker, so the publisher can pick a value. The color picker accepts alfa channel selection.

Name
Type
Constraing
Description
format
String
Mandatory
Since the color will be stored as a String, you have to specify how Mobincube will format that String.

Values:
hex

CHECKBOX properties

Lets publishers enter a color value. The value will be stored as a String. Mobincube will use a color picker, so the publisher can pick a value. The color picker accepts alfa channel selection.

Name
Type
Constraing
Description
checkboxLabel
String
Mandatory
The label parameter is used for the bold text that appears above the checkbox. But you can also define a text to be placed next to the checkbox. By default, that text will be "Enable", unless you use the checkboxLabel parameter. This label also accepts a multilanguage value.

SELECT properties

Lets publishers select one or several options. The value will be stored as a single value or as an array. Mobincube will use a SELECT input, so the publisher can pick a value (or several of them).

Name
Type
Constraing
Description
data
Array
Mandatory
Options of the list. Each option has to have 2 parameters: label (the text to be displayed in the select input and value (the value of the property in case that option is selected).
multiple
Boolean
Optional
If true, the publisher will be allowed to select several values. If false or undefined, only one option can be selected.
minimumResultsForSearch
Integer
Optional
In case the number of options is large, it is recommended to activate the search box inside the select input. It will automatically appear if the number of options is equal or higher than the number set in the minimumResultsForSearch parameter.

DATE properties

Lets publishers select a date value. The value will be stored as a timestamp. Mobincube will use a date picker input.

Name
Type
Constraing
Description
?
?
?
?

MAP properties

Lets publishers select a gps location value. The value will be stored as a String containing latitude and longituded separated by a comma. Mobincube will use a google maps div to pick a location.

Name
Type
Constraing
Description
?
?
?
?

SCREEN properties

Lets publishers select a destination screen, in case your addon wants the app to open another screen after some user action. The value will be stored as a String. Mobincube will use a select input and will fill it automatically with all the screens of the app in the moment when the publisher tries to select a destination screen.

Name
Type
Constraing
Description
?
?
?
?

LIST properties

List are arrays of groups of properties. The length of those arrays are unknown for you, it is the publisher the one that will decide the number of items in the array. List are useful in so many cases. For instance: if you develop an image gallery addon, you might want publishers to add as many images as they want.

Name
Type
Constraing
Description
buttonLabel
String
Recommended
Lets you edit the text of the button used for adding a new item to the list. If you don't use this parameter, the button will show the text "Add Endtry" in english only. You should use this parameter to customize the text using the multilanguage format.
schema
array
Mandatory
It is an array of properties. All items in the list will have their own values for those properties. In case you set values for some properties in the array, new items will have those values assigned in their properties by default.
value
Array
Optional
For lists, the value parameter has a different format. Instead of a single value, the value is an array of groups of values. The value is optional. You only need to use it in case you want your addon to have some items preloaded in the list. This might be highly recommended for making it easier for the publisher to understand how your addon works.


Here's an example of list:

{
 "key": "cellList",
 "type": "list",
 "label": {
  "en": "List of cells:",
  "es": "Lista de celdas:"
 },
 "buttonLabel":{"en":"Add cell","es":"Añadir celda"},
 "schema": [{
   "key": "cellBackground",
   "type": "color",
   "format": "hex",
   "label": {
    "en": "Cell background:",
    "es": "Color de fondo de la celda:"
   },
   "value": "rgba(255,255,255,0)"
  }, {
   "key": "cellWidth",
   "type": "range",
   "label": {
    "en": "Cell width (columns):",
    "es": "Ancho de la celda (columnas):"
  },
   "min": 1,
   "max": 10,
   "step": 1,
   "value": 1
  }],
 "value": [{
   "cellBackground": "#FFF",
   "cellWidth": 2
  },{
   "cellBackground": "#F00",
   "cellWidth": 3
 }]
}


In order to access some value of one items of the above list from JavaScript, you should use properties.properties.cellList[1].cellWidth.


FILE properties

Lets publishers pick a resource from the resource manager of Mobincube. The value will be stored as a String with the URI to the file. You can set a default value that points to a file inside the addon's zip file, but once publishers pick a file from the resource manager, they won't be able to select the default file again.

Name
Type
Constraing
Description
buttonLabel
String
Recommended
Lets you edit the text of the button used for selecting a file. If you don't use this parameter, the button will show the text "File" in english only. You should use this parameter to customize the text using the multilanguage format.
accept
Json Node
Mandatory
Tells Mobincube what type of resources can be accepted. This parameter can have one or two parameters:
  • fileType (an array including all the file types accepted)
  • fileName

LABEL properties

This is only an informative property, so you can add instructions on Mobincube's properties panel, in order to make it easier for the publisher to understand how your addon works.

Name
Type
Constraing
Description
value
String (accepts multilanguage format)
Recommended
It's the text you want the publisher to read. Unlike the text of the property's label, the text of the value doesn't use bold font.

IMAGE properties

This type is currently not available.


VIDEO properties

This type is currently not available.


LINE properties

This type is currently not available.