@christianriedl/utils 1.0.64 → 1.0.65

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@christianriedl/utils",
3
- "version": "1.0.64",
3
+ "version": "1.0.65",
4
4
  "description": "Interfaces, local storage, service worker, configuration, application state",
5
5
 
6
6
  "main": "dist/index.js",
@@ -1,5 +1,5 @@
1
1
  <script setup lang="ts">
2
- import { inject, computed, onBeforeUnmount } from 'vue';
2
+ import { inject, computed, ref, nextTick, onBeforeUnmount } from 'vue';
3
3
  import { onBeforeRouteLeave } from 'vue-router'
4
4
  import { IAppConfig, IConfigItem, IAppState } from '@christianriedl/utils'
5
5
  import SettingsLine from '../components/SettingsLine.vue';
@@ -7,8 +7,8 @@
7
7
  const emits = defineEmits<{ (e: 'configchange', item: IConfigItem): void }>();
8
8
  const appState = inject<IAppState>('appstate')!;
9
9
  const appConfig = inject<IAppConfig>('appconfig')!;
10
-
11
10
  const heightStyle = computed(() => { return { height: appState.bodyHeight.value + 'px', overflowY: 'auto' } });
11
+ const scopes = ref(appState.scopes);
12
12
 
13
13
  let changed = false;
14
14
  const subscribePushNotifications = appConfig.subscribePush ? appConfig.items["subscribePushNotifications"] : null;
@@ -28,6 +28,7 @@
28
28
 
29
29
  async function saveConfiguration(): Promise<boolean> {
30
30
  if (changed) {
31
+ const useServerWait = appConfig.items['smartHomeUseServerWait'].value;
31
32
  appConfig.save();
32
33
  if (subscribePushNotifications && subscribePushNotifications.value != wasSubscribed) {
33
34
  console.log(`Subscribe changed to ${subscribePushNotifications.value}`)
@@ -45,6 +46,13 @@
45
46
  }
46
47
 
47
48
  function onChange(item: IConfigItem) {
49
+ if (item.name === 'smartHomeUseServerWait') {
50
+ const acqCycleItem = appConfig.items['smartHomeAcqCycle'];
51
+ if (acqCycleItem)
52
+ acqCycleItem.value = item.value ? 30000 : 1000;
53
+ scopes.value = 0;
54
+ nextTick(() => scopes.value = appState.scopes);
55
+ }
48
56
  emits('configchange', item);
49
57
  changed = true;
50
58
  }
@@ -61,7 +69,7 @@
61
69
  </tr>
62
70
  </thead>
63
71
  <tbody>
64
- <settings-line v-for="config in appConfig.items" :key="config.name" :item="config" :scopes="appState.scopes" @change="onChange(config)"></settings-line>
72
+ <settings-line v-for="config in appConfig.items" :key="config.name" :item="config" :scopes="scopes" @change="onChange(config)"></settings-line>
65
73
  </tbody>
66
74
  </v-table>
67
75
  </v-container>