diff --git a/assets/app/schema.json b/assets/app/schema.json index 5f971bd1..8c35fb6d 100755 --- a/assets/app/schema.json +++ b/assets/app/schema.json @@ -1037,6 +1037,17 @@ ] } }, + "platformLocalRequiredFeatures": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "nfc", + "speaker", + "ledring" + ] + } + }, "tags": { "$ref": "#/definitions/i18nArray" }, diff --git a/lib/App/index.js b/lib/App/index.js index c49c5924..094a91e9 100644 --- a/lib/App/index.js +++ b/lib/App/index.js @@ -127,6 +127,18 @@ class App { } } + // validate that there are no platform local required features defined when targetting cloud + if ((appJson.platforms || []).includes('cloud') + && (appJson.platformLocalRequiredFeatures || []).length > 0) { + throw new Error('The property `platformLocalRequiredFeatures` can not be used in combination with platform: `cloud`.'); + } + + // validate that platforms includes local when using platformLocalRequiredFeatures + if ((appJson.platforms || []).includes('local') === false + && (appJson.platformLocalRequiredFeatures || []).length > 0) { + console.warn('Warning: using `platformLocalRequiredFeatures` requires `platforms: [local]`.'); + } + if (levelVerified) { if (appJson.platforms === undefined) { throw new Error('The property `platforms` is required in order to publish a verified app.');