mirror of
https://github.com/morgan9e/macos-stats
synced 2026-04-14 00:04:15 +09:00
feat: removed the Telemetry module from the Stats since it does not do anything for a long time
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
//
|
||||
// Telemetry.swift
|
||||
// Kit
|
||||
//
|
||||
// Created by Serhiy Mytrovtsiy on 18/06/2023
|
||||
// Using Swift 5.0
|
||||
// Running on macOS 13.4
|
||||
//
|
||||
// Copyright © 2023 Serhiy Mytrovtsiy. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public class Telemetry {
|
||||
public static let shared = Telemetry()
|
||||
|
||||
public var isEnabled: Bool {
|
||||
get { Store.shared.bool(key: "telemetry", defaultValue: true) }
|
||||
set { Store.shared.set(key: "telemetry", value: newValue) }
|
||||
}
|
||||
|
||||
public init() {}
|
||||
}
|
||||
@@ -53,7 +53,6 @@
|
||||
5C4E8BC42B6EF65E00F148B6 /* libleveldb.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5C4E8BC32B6EF65E00F148B6 /* libleveldb.a */; };
|
||||
5C4E8BC72B6EF98800F148B6 /* DB.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C4E8BC62B6EF98800F148B6 /* DB.swift */; };
|
||||
5C4E8BE92B71031A00F148B6 /* Kit.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C4E8BE82B7102A700F148B6 /* Kit.h */; settings = {ATTRIBUTES = (Private, ); }; };
|
||||
5C5647F82A3F6B100098FFE9 /* Telemetry.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C5647F72A3F6B100098FFE9 /* Telemetry.swift */; };
|
||||
5C621D822B4770D6004ED7AF /* process.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C621D812B4770D6004ED7AF /* process.swift */; };
|
||||
5C645BFF2C591F6600D8342A /* widget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5C645BFE2C591F6600D8342A /* widget.swift */; };
|
||||
5C645C002C591FFA00D8342A /* Net.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9A3E17CC247A94AF00449CD1 /* Net.framework */; };
|
||||
@@ -541,7 +540,6 @@
|
||||
5C4E8BC32B6EF65E00F148B6 /* libleveldb.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libleveldb.a; sourceTree = "<group>"; };
|
||||
5C4E8BC62B6EF98800F148B6 /* DB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DB.swift; sourceTree = "<group>"; };
|
||||
5C4E8BE82B7102A700F148B6 /* Kit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Kit.h; sourceTree = "<group>"; };
|
||||
5C5647F72A3F6B100098FFE9 /* Telemetry.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Telemetry.swift; sourceTree = "<group>"; };
|
||||
5C621D812B4770D6004ED7AF /* process.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = process.swift; sourceTree = "<group>"; };
|
||||
5C645BFE2C591F6600D8342A /* widget.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = widget.swift; sourceTree = "<group>"; };
|
||||
5C6F55A62D45694400AB58ED /* notifications.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = notifications.swift; sourceTree = "<group>"; };
|
||||
@@ -1203,7 +1201,6 @@
|
||||
9A6EEBBD2685259500897371 /* Logger.swift */,
|
||||
9A5A8446271895B700BC40A4 /* Reachability.swift */,
|
||||
9A302613286A2A3B00B41D57 /* Repeater.swift */,
|
||||
5C5647F72A3F6B100098FFE9 /* Telemetry.swift */,
|
||||
5C4E8BC62B6EF98800F148B6 /* DB.swift */,
|
||||
);
|
||||
path = plugins;
|
||||
@@ -1720,7 +1717,7 @@
|
||||
New,
|
||||
);
|
||||
LastSwiftUpdateCheck = 1540;
|
||||
LastUpgradeCheck = 1640;
|
||||
LastUpgradeCheck = 2610;
|
||||
ORGANIZATIONNAME = "Serhiy Mytrovtsiy";
|
||||
TargetAttributes = {
|
||||
5C22299C29CCB3C400F00E69 = {
|
||||
@@ -2086,7 +2083,6 @@
|
||||
9A2847672666AA2700EC1F6D /* BarChart.swift in Sources */,
|
||||
9A28477B2666AA5000EC1F6D /* popup.swift in Sources */,
|
||||
5C038CF62D86EE8A00516809 /* Remote.swift in Sources */,
|
||||
5C5647F82A3F6B100098FFE9 /* Telemetry.swift in Sources */,
|
||||
9A2848202666AB3600EC1F6D /* types.swift in Sources */,
|
||||
9A28481E2666AB3600EC1F6D /* extensions.swift in Sources */,
|
||||
9A2848092666AB3000EC1F6D /* Store.swift in Sources */,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1640"
|
||||
LastUpgradeVersion = "2610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1640"
|
||||
LastUpgradeVersion = "2610"
|
||||
version = "1.3">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "1640"
|
||||
LastUpgradeVersion = "2610"
|
||||
wasCreatedForAppExtension = "YES"
|
||||
version = "2.0">
|
||||
<BuildAction
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user