cozy / cozy-libs

Libraries used to build Cozy products and tools.
MIT License
7 stars 12 forks source link

feat: Add options object in NativeService args #2548

Closed zatteo closed 3 months ago

zatteo commented 4 months ago

When receiving an intent on the flagship app, we want to know which webview sent the intent. Here we inject at the beginning of the args array an options object with the webviewUri.

Example

On a front end app, we will do

webviewIntent.call('multiply', 2, 3)

On flagship app, we will set a local method

multiply: (options, arg1, arg2) => return arg1 * arg2

=> the options object has been added at the beginning of the args array

We also add a new NativeMethodsRegisterWithOptions to modelize this new behavior.

BREAKING: A options object has been added in NativeService message args. You need to update your local methods (see example). FLAGSHIP APP ONLY. Nothing to do on a front end app.