How to correctly implement plugins

Taking Profile plugin as the example, how do you attach correctly the plugin implementation?

As I’ve seen in the above code, you can provide your implementation of the plugin interface for the getInfo/setInfo.

What is the correct approach to create the platformSettings.plugins object, since the getInfo / setInfo are functions, we can’t simply create those in the settings.json file.

One of the approaches I took was something like this before the Launch is called, but seems very dirty to me:

export default function () {
  arguments[1].plugins = {
    profile: {
      getInfo: (key) => { },
      setInfo: (key, params) => {},
    },
  }
  return Launch(App, ...arguments)
}

Created an issue on github: How to correctly implement plugins · Issue #324 · rdkcentral/Lightning-SDK · GitHub

After some talking with @mauro1855, came to the conclusion that these wrappers are useful when you deploy your app through the Metro store. We’ll think about the best approach to this, either we simulate what the Metro store does or we’ll create our own wrappers.