Skip to content

Configuration files

Please, have a look at each policy format based on OS:

PlatformHubPluginsConfig.json (iOS Only)

What it is?

The PlatformHubPluginsConfig JSON file specifies what will be the 1st message PlatformHub will publish when the app starts. It also includes the plugin class name, the name of the bundle where it is located and a set of configuration files that will be used to configure the plugin on its initialisation.

Where is it located?

This JSON lives at the iOS app level.
Android cannot instantiate classes from a string containing the name of the class and therefore the Android apps won't have a PluginsConfiguration.json file; instead, they will initialise each plugin manually programmatically when the app initialises.

What is its format?

The PlatformHubPluginsConfig.json file is located inside each iOS app using PlatformHub.

What is schemaVersion?

schemaVersion has been added to the PlatformHubPluginsConfig.json to ease adopting any file changes. The current version is marked as version 1 - the default version - with no need to mention it in the file. If any file changes are necessary, it will be released as version 2 of PlatformHubPluginsConfig.json. Then, it will be necessary to specify schemaVersion in the file. Thus, its adoption will not be enforced and can be taken up when needed.

Currently, no change is needed in PlatformHubPluginsConfig.json to include schemaVersion.

What information does it contain?

  • schemaVersion: Specifies which schema of PlatformHubPluginsConfig is used. Currently there is only one version, so this field is optional.
  • plugins: List of plugins the app needs as dependancy and PlatformHub will instantiate. Each element contains the following information:
    • bundle: Name of the bundle (plugin name) where the class to initialise is located.
    • class: Name of the class to initialise.
    • configurationFiles: Array with the name of the configuration files containing data to initialise and configure the plugin. These files must be located in the app bundle, not in the plugin bundle, as it contains app-specific plugin configurations.
json
{
  "schemaVersion": 1,
  "plugins": [
    {
      "bundle": "NetworkKitPlugin",
      "class": "NetworkPlugin",
      "configurationFiles": {
        "cookies": "cookies",
        "domainConfiguration": "domain"
      }
    },
    {
      "bundle": "AccountsKitPlugin",
      "class": "AccountsPlugin",
      "configurationFiles": {
        "mainConfig": "MainConfig",
        "style": "uiTemplateStyle",
        "languages": "languages"
      }
    },
    {
      "bundle": "MessagesKitPlugin",
      "class": "MessagesPlugin",
      "configurationFiles": {}
    }
  ]
}

Note that the naming convention for the individual plugin configuration files is that they should be PascalCased (ie, all words joined with their initial letters capitalised) & ending in 'Config', eg, 'MainConfig.json' - though the name passed in the configurationFiles dictionary does not need the .json suffix.

How should it be named?

There is generally no reason to name it anything other than "PlatformHubPluginsConfig.json", but if you have a good case for doing so, it should be PascalCased and finish with 'Config', eg, 'MyPersonalPluginsConfig.json'. If you decide to use a different name then you will need to pass this into PlatformHub's start function, in the pluginsConfigURL parameter.

plugins-registry.json

What it is?

Any plugin that is allowed to be used in PlatformHub will appear in this list. It has a list of plugins with their versions. Every plugin has to go through a process of approval in order to be entitled to use in PlatformHub and therefore appear in this list.

Where is it located?

Lives in this repo in SKYRIN's Git account: https://alm-github.systems.uk.skyrin/mobile/platform-accredited-plugins/blob/master/plugins-registry.json. When building any mobile app using PlatformHub in our release CI pipelines, a script will validate every plugin contained into the app against this plugins-registry.json. If the plugin is not present in this JSON file the CI pipeline will error with a meaningful message for the user.

What is its format?

This files is consumed by iOS and Android apps, therefore its format is a JSON file.

What information does it contain?

It contains 2 sets of plugins, one for iOS and another one for Android. Each plugin has it has the following information

  • name: Plugin name.
json
{
  "android": [
    {
      "pluginName": "AnExamplePlugin",
      "versions": [
        {
          "version": "1.0"
        },
        {
          "version": "1.1"
        }
      ]
    },
    {
      "pluginName": "AnotherPluginExample",
      "versions": [
        {
          "version": "1.0"
        }
      ]
    }
  ],
  "iOS": [
    {
      "pluginName": "AnExamplePlugin",
      "versions": [
        {
          "version": "1.0"
        },
        {
          "version": "1.1"
        }
      ]
    },
    {
      "pluginName": "AnotherPluginExample",
      "versions": [
        {
          "version": "1.0"
        }
      ]
    }
  ]
}