Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 4.02 KB

settings-and-customization.md

File metadata and controls

46 lines (32 loc) · 4.02 KB

App Settings

App settings are located in vaa-shared module. Settings are separated into static and dynamic settings.

Static settings can be changed only by modifying staticSettings.ts.

Dynamic settings can be changed by modifying dynamicSettings.ts. In addition, dynamic settings can also be changed in the backend. This has been currently implemented only in Strapi. Settings from dynamicSettings.ts are loaded into Strapi if the app settings collection is empty.

Settings from dynamicSettings.ts, staticSettings.ts and from the DataProvider are merged together into settings store. Settings from dynamicSettings.ts are overwritten by dynamic settings from the DataProvider. Settings from staticSettings.ts are merged last to prevent overwriting them.

Adding New Settings

In case of static settings:

  1. Add the type and documentation for the new setting to the StaticSettings type in staticSettings.ts.
  2. Add the default value for the setting to staticSettings.ts.

In case of dynamic settings:

  1. Add the type and documentation for the new setting to the DynamicSettings type in staticSettings.ts.
  2. Add the default value for the setting to dynamicSettings.ts.
  3. Edit the settings components in Strapi:
    1. If the new setting is a top-level one, create a new component for the setting and add it to the App Settings content-type.
    2. If the new setting is a subsetting of a top-level item, edit that setting.
  4. Edit the populate restrictions for the app-settings route so that the new component is allowed to be populated both for find and findOne.
  5. Update the Strapi data types for StrapiAppSettingsData in strapiDataProvider.type.ts
  6. Add the necessary populate query params to the getAppSettings method in strapiDataProvider.ts, because components need to be explicitly populated.
  7. If the data type for the setting does not match the one in the DynamicSettings type:
    1. Edit the getAppSettings method in strapiDataProvider.ts so that it returns the setting in the correct format.
    2. Edit the loadDefaultAppSettings utility so that it converts the default settings to a format suitable for Strapi.
  8. Repeat steps 3–5 for all other DataProvider implementations that support getAppSettings.

App Customization

App customization includes publisher logo, front page image, translations and frequently asked questions of the candidate app. App customization has been currently implemented only in Strapi.

Translations from dynamic.json are loaded into Strapi if the app customization collection is empty. In addition to changing the dynamic translations, any other translation can be overridden.

Adding New Customization Options

  1. Add the new option to AppCustomization type in global.d.ts.
  2. Add the new option to the App Customization content type in Strapi.
  3. If the new setting is a relation, media field or a component:
    1. Edit the populate restrictions for the app-customization route.
    2. Add the necessary populate query params to the getAppCustomization method in strapiDataProvider.ts.
  4. Update the Strapi data types for StrapiAppCustomizationData in strapiDataProvider.type.ts