Skip to content

Commit

Permalink
Further fix variant error on pairing
Browse files Browse the repository at this point in the history
  • Loading branch information
Joolee committed Jul 24, 2020
1 parent 4b775e0 commit 411102e
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions assets/pairing/sensor.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,16 @@ document.body.addEventListener('click', (event) => {

deviceCapabilities = window.device.capabilities;

if (variant) {
if (typeof variant != "undefined") {
device.settings.variant = variant.key;

const basicCapabilities = window.device.capabilities.filter(cap => !cap.hasOwnProperty("index"));
const variantCapabilities = window.device.capabilities.filter(cap => cap.hasOwnProperty("index") && variant.values.includes(cap.name));

deviceCapabilities = basicCapabilities.concat(variantCapabilities);

console.dir(basicCapabilities, variantCapabilities);
console.dir(deviceCapabilities);
}

if (deviceCapabilities) {
if (typeof deviceCapabilities != "undefined") {
for (const value of deviceCapabilities) {
if (typeof (value.capabilities) == 'string') {
device.capabilities.push(value.capabilities);
Expand Down

0 comments on commit 411102e

Please sign in to comment.