Skip to content

Commit b8d4306

Browse files
committed
views: general-settings: replace telemetry switch with data sharing modal
Add a "Shared Data" entry point in General settings that opens the new data privacy modal, and remove the legacy "Usage statistics telemetry" switch from Dev settings - it was the only consumer of the `enableUsageStatisticsTelemetry` ref, which now belongs to the modal through plain `localStorage`. Drop the corresponding `useStorage` registration from the development store so the settings manager no longer claims ownership of the boolean and cannot stomp the value the modal writes.
1 parent ce81fbc commit b8d4306

3 files changed

Lines changed: 25 additions & 13 deletions

File tree

src/stores/development.ts

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,39 @@
11
import { useStorage } from '@vueuse/core'
22
import { defineStore } from 'pinia'
3-
import { ref } from 'vue'
3+
import { ref, watch } from 'vue'
44

55
import { useBlueOsStorage } from '@/composables/settingsSyncer'
6+
import { defaultShareHardwareDetails, shareHardwareDetailsKey } from '@/libs/external-telemetry/event-tracking'
7+
import { settingsManager } from '@/libs/settings-management'
68

79
export const systemLoggingEnablingKey = 'cockpit-enable-system-logging'
810
export const blueOsSettingsSyncEnablingKey = 'cockpit-enable-blueos-settings-sync'
9-
export const enableUsageStatisticsTelemetryKey = 'cockpit-enable-usage-statistics-telemetry'
1011
export const showSplashScreenOnStartupKey = 'cockpit-show-splash-screen-on-startup'
1112

1213
export const useDevelopmentStore = defineStore('development', () => {
1314
const developmentMode = ref(false)
1415
const widgetDevInfoBlurLevel = ref(3)
1516
const enableSystemLogging = useBlueOsStorage(systemLoggingEnablingKey, true)
1617
const enableBlueOsSettingsSync = useStorage(blueOsSettingsSyncEnablingKey, true)
17-
const enableUsageStatisticsTelemetry = useStorage(enableUsageStatisticsTelemetryKey, true)
1818
const showSplashScreenOnStartup = useStorage(showSplashScreenOnStartupKey, true)
1919

20+
const shareHardwareDetails = ref<boolean>(
21+
settingsManager.getKeyValue<boolean>(shareHardwareDetailsKey) ?? defaultShareHardwareDetails
22+
)
23+
watch(shareHardwareDetails, (newValue) => {
24+
settingsManager.setKeyValue(shareHardwareDetailsKey, newValue, Date.now())
25+
})
26+
settingsManager.registerListener(shareHardwareDetailsKey, (newSetting) => {
27+
const newValue = newSetting.value as boolean
28+
if (newValue !== shareHardwareDetails.value) shareHardwareDetails.value = newValue
29+
})
30+
2031
return {
2132
developmentMode,
2233
widgetDevInfoBlurLevel,
2334
enableSystemLogging,
2435
enableBlueOsSettingsSync,
25-
enableUsageStatisticsTelemetry,
36+
shareHardwareDetails,
2637
showSplashScreenOnStartup,
2738
}
2839
})

src/views/ConfigurationDevelopmentView.vue

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,6 @@
2626
class="min-w-[155px]"
2727
@update:model-value="reloadCockpitAndWarnUser()"
2828
/>
29-
<v-switch
30-
v-model="devStore.enableUsageStatisticsTelemetry"
31-
label="Usage statistics telemetry"
32-
color="white"
33-
hide-details
34-
class="min-w-[155px]"
35-
@update:model-value="reloadCockpitAndWarnUser()"
36-
/>
3729
<v-switch
3830
v-model="devStore.enableSystemLogging"
3931
label="Enable system logging"

src/views/ConfigurationGeneralView.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
</div>
4141
</div>
4242
<v-divider class="w-full opacity-[0.08]" />
43-
<div class="flex flex-row w-full items-center justify-between py-5 gap-x-2">
43+
<div class="flex flex-row w-full items-center justify-between py-3 gap-x-2 gap-y-3 flex-wrap">
4444
<v-btn size="x-small" class="bg-[#FFFFFF22] shadow-1" variant="flat" @click="openTutorial">
4545
Show tutorial
4646
</v-btn>
@@ -63,6 +63,15 @@
6363
<v-btn size="x-small" class="bg-[#FFFFFF22] shadow-1" variant="flat" @click="openExternalFeaturesModal">
6464
Extension features
6565
</v-btn>
66+
<v-btn
67+
size="x-small"
68+
class="bg-[#FFFFFF22] shadow-1"
69+
variant="flat"
70+
prepend-icon="mdi-shield-lock-outline"
71+
@click="interfaceStore.isDataPrivacyModalVisible = true"
72+
>
73+
Shared Data
74+
</v-btn>
6675
</div>
6776
<v-divider v-if="isElectron()" class="w-full opacity-[0.08]" />
6877
<div v-if="isElectron()" class="flex flex-col w-full py-4 gap-1">

0 commit comments

Comments
 (0)