@o-lukas/homebridge-smartthings-tv 3.0.0-alpha.2 → 3.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -212,6 +212,11 @@
|
|
|
212
212
|
const pluginConfig = await homebridge.getPluginConfig();
|
|
213
213
|
_log('updateUi - got pluginConfig', pluginConfig);
|
|
214
214
|
|
|
215
|
+
// determine whether wizard is currently visible so we don't close it on config change
|
|
216
|
+
const wizardEl = document.getElementById('wizard');
|
|
217
|
+
const wizardOpen = !!(wizardEl && window.getComputedStyle(wizardEl).display !== 'none');
|
|
218
|
+
_log('updateUi - wizardOpen', wizardOpen);
|
|
219
|
+
|
|
215
220
|
if (pluginConfig.length === 0) {
|
|
216
221
|
_log('updateUi - pluginConfig empty, initializing default');
|
|
217
222
|
pluginConfig[0] = {
|
|
@@ -222,23 +227,35 @@
|
|
|
222
227
|
_log('updateUi - default pluginConfig saved');
|
|
223
228
|
}
|
|
224
229
|
|
|
230
|
+
// Update UI elements but avoid closing the wizard if it's already open.
|
|
225
231
|
switch (pluginConfig[0].tokenType) {
|
|
226
232
|
case "oauth":
|
|
227
233
|
_log('updateUi - tokenType oauth');
|
|
228
234
|
homebridge.showSchemaForm();
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
235
|
+
// Only toggle wizard visibility when it's not currently open.
|
|
236
|
+
if (!wizardOpen) {
|
|
237
|
+
document.getElementById('wizard').style.display = "none";
|
|
238
|
+
document.getElementById('oauth-start').style.display = "block";
|
|
239
|
+
document.getElementById('pat-warning').style.display = "none";
|
|
240
|
+
_log('updateUi - wizard was closed, showing oauth-start');
|
|
241
|
+
} else {
|
|
242
|
+
_log('updateUi - wizard open, leaving wizard visible');
|
|
243
|
+
}
|
|
232
244
|
break;
|
|
233
245
|
|
|
234
246
|
case "pat":
|
|
235
247
|
default:
|
|
236
248
|
_log('updateUi - tokenType pat or default', pluginConfig[0].tokenType);
|
|
237
249
|
homebridge.showSchemaForm();
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
250
|
+
if (!wizardOpen) {
|
|
251
|
+
document.getElementById('wizard').style.display = "none";
|
|
252
|
+
document.getElementById('oauth-start').style.display = "none";
|
|
253
|
+
document.getElementById('pat-warning').style.display =
|
|
254
|
+
pluginConfig[0].disablePatWarning === true ? "none" : "block";
|
|
255
|
+
_log('updateUi - wizard was closed, applied pat/default visibility');
|
|
256
|
+
} else {
|
|
257
|
+
_log('updateUi - wizard open, leaving wizard visible');
|
|
258
|
+
}
|
|
242
259
|
break;
|
|
243
260
|
}
|
|
244
261
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"displayName": "Homebridge SmartThings TV",
|
|
3
3
|
"name": "@o-lukas/homebridge-smartthings-tv",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "3.0.0-alpha.
|
|
5
|
+
"version": "3.0.0-alpha.3",
|
|
6
6
|
"description": "This is a plugin for Homebridge. It offers some basic functions to control Samsung TVs using the SmartThings API.",
|
|
7
7
|
"author": "o-lukas",
|
|
8
8
|
"license": "MIT",
|