diff --git a/assets/app/schema.json b/assets/app/schema.json index 0da93d07..c95c3d87 100755 --- a/assets/app/schema.json +++ b/assets/app/schema.json @@ -964,6 +964,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 8ad2fe1f..a6a0e8c6 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.');