feat: removed the Telemetry module from the Stats since it does not do anything for a long time

This commit is contained in:
Serhiy Mytrovtsiy
2025-11-29 16:31:23 +01:00
parent 15075bc7f1
commit f5e7da4221
7 changed files with 6 additions and 108 deletions

View File

@@ -41,7 +41,6 @@ class ApplicationSettings: NSStackView {
private var updateSelector: NSPopUpButton?
private var startAtLoginBtn: NSSwitch?
private var telemetryBtn: NSSwitch?
private var remoteControlBtn: NSSwitch?
private var combinedModulesView: PreferencesSection?
@@ -83,10 +82,6 @@ class ApplicationSettings: NSStackView {
action: #selector(self.toggleLaunchAtLogin),
state: LaunchAtLogin.isEnabled
)
self.telemetryBtn = switchView(
action: #selector(self.toggleTelemetry),
state: Telemetry.shared.isEnabled
)
scrollView.stackView.addArrangedSubview(PreferencesSection([
PreferencesRow(localizedString("Check for updates"), component: self.updateSelector!),
@@ -99,8 +94,7 @@ class ApplicationSettings: NSStackView {
action: #selector(self.toggleDock),
state: Store.shared.bool(key: "dockIcon", defaultValue: false)
)),
PreferencesRow(localizedString("Start at login"), component: self.startAtLoginBtn!),
PreferencesRow(localizedString("Share anonymous telemetry"), component: self.telemetryBtn!)
PreferencesRow(localizedString("Start at login"), component: self.startAtLoginBtn!)
]))
self.combinedModulesView = PreferencesSection([
@@ -205,7 +199,6 @@ class ApplicationSettings: NSStackView {
internal func viewWillAppear() {
self.startAtLoginBtn?.state = LaunchAtLogin.isEnabled ? .on : .off
self.telemetryBtn?.state = Telemetry.shared.isEnabled ? .on : .off
self.remoteControlBtn?.state = Remote.shared.control ? .on : .off
var idx = self.updateSelector?.indexOfSelectedItem ?? 0
@@ -319,10 +312,6 @@ class ApplicationSettings: NSStackView {
}
}
@objc private func toggleTelemetry(_ sender: NSButton) {
Telemetry.shared.isEnabled = sender.state == NSControl.StateValue.on
}
@objc private func toggleCombinedModules(_ sender: NSButton) {
self.combinedModulesState = sender.state == NSControl.StateValue.on
self.combinedModulesView?.setRowVisibility(1, newState: self.combinedModulesState)

View File

@@ -66,7 +66,7 @@ internal class SetupWindow: NSWindow, NSWindowDelegate {
}
private class SetupContainer: NSStackView {
private let pages: [NSView] = [SetupView_1(), SetupView_2(), SetupView_3(), SetupView_4(), SetupView_end()]
private let pages: [NSView] = [SetupView_1(), SetupView_2(), SetupView_3(), SetupView_end()]
private var main: NSView = NSView()
private var prevBtn: NSButton = NSButton()
@@ -367,70 +367,6 @@ private class SetupView_3: NSStackView {
}
}
private class SetupView_4: NSStackView {
init() {
super.init(frame: NSRect(x: 0, y: 0, width: setupSize.width, height: setupSize.height - 60))
let container: NSGridView = NSGridView()
container.rowSpacing = 0
container.yPlacement = .center
container.xPlacement = .center
let title: NSTextField = TextView(frame: NSRect(x: 0, y: 0, width: container.frame.width, height: 22))
title.alignment = .center
title.font = NSFont.systemFont(ofSize: 20, weight: .semibold)
title.stringValue = localizedString("Anonymous telemetry for better development decisions")
title.toolTip = localizedString("Anonymous telemetry for better development decisions")
title.isSelectable = false
container.addRow(with: [title])
container.addRow(with: [self.content()])
container.row(at: 0).height = 100
self.addArrangedSubview(container)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func content() -> NSView {
let container: NSGridView = NSGridView()
container.addRow(with: [self.option(
tag: 1,
state: Telemetry.shared.isEnabled,
text: localizedString("Share anonymous telemetry data")
)])
container.addRow(with: [self.option(
tag: 2,
state: !Telemetry.shared.isEnabled,
text: localizedString("Do not share anonymous telemetry data")
)])
return container
}
private func option(tag: Int, state: Bool, text: String) -> NSView {
let button: NSButton = NSButton(frame: NSRect(x: 0, y: 0, width: 30, height: 20))
button.setButtonType(.radio)
button.state = state ? .on : .off
button.title = text
button.action = #selector(self.toggle)
button.isBordered = false
button.isTransparent = false
button.target = self
button.tag = tag
return button
}
@objc private func toggle(_ sender: NSButton) {
Telemetry.shared.isEnabled = sender.tag == 1
}
}
private class SetupView_end: NSStackView {
init() {
super.init(frame: NSRect(x: 0, y: 0, width: setupSize.width, height: setupSize.height - 60))