Skip to content

Commit 79abff4

Browse files
committed
feat: update CFBundleVersion to 6728, rename TeamSettings.swift to CloudSettings.swift, and add CloudSettingsView for improved functionality
1 parent a795c3d commit 79abff4

File tree

4 files changed

+175
-143
lines changed

4 files changed

+175
-143
lines changed

Pareto Security.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
4F20E2622E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F20E2602E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift */; };
9393
4F20E2642E70217400E93943 /* NotificationNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F20E2632E70217400E93943 /* NotificationNames.swift */; };
9494
4F20E2652E70217400E93943 /* NotificationNames.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F20E2632E70217400E93943 /* NotificationNames.swift */; };
95-
4F24A09026EB735F0036F748 /* TeamSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A08F26EB735F0036F748 /* TeamSettings.swift */; };
95+
4F24A09026EB735F0036F748 /* CloudSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A08F26EB735F0036F748 /* CloudSettings.swift */; };
9696
4F24A09226EB73980036F748 /* AboutSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A09126EB73980036F748 /* AboutSettingsView.swift */; };
9797
4F24A09426EB73C80036F748 /* ChecksSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A09326EB73C80036F748 /* ChecksSettingsView.swift */; };
9898
4F24A09626EB73F30036F748 /* GeneralSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A09526EB73F30036F748 /* GeneralSettingsView.swift */; };
@@ -106,7 +106,7 @@
106106
4F37E70C2718122E00A2B254 /* RemoteLogin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F35395626E8AE02008F5DD3 /* RemoteLogin.swift */; };
107107
4F37E70E2718122E00A2B254 /* PrinterSharingCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F6A0E0D26CE484A003B00A3 /* PrinterSharingCheck.swift */; };
108108
4F37E70F2718122E00A2B254 /* FileSharingCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F6A0E0F26CE4868003B00A3 /* FileSharingCheck.swift */; };
109-
4F37E7102718122E00A2B254 /* TeamSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A08F26EB735F0036F748 /* TeamSettings.swift */; };
109+
4F37E7102718122E00A2B254 /* CloudSettings.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F24A08F26EB735F0036F748 /* CloudSettings.swift */; };
110110
4F37E7112718122E00A2B254 /* URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F81C10726EB5D270065F548 /* URL.swift */; };
111111
4F37E7122718122E00A2B254 /* NetworkHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4F5B20C2270316DB0015642A /* NetworkHandler.swift */; };
112112
4F37E7132718122E00A2B254 /* Log.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB7C67C26AFF1AB00FB1C41 /* Log.swift */; };
@@ -387,7 +387,7 @@
387387
4F1E6C6328355B2100C8AFAB /* InternetSharing.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InternetSharing.swift; sourceTree = "<group>"; };
388388
4F20E2602E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IgnoredSSHKeysSettingsView.swift; sourceTree = "<group>"; };
389389
4F20E2632E70217400E93943 /* NotificationNames.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NotificationNames.swift; sourceTree = "<group>"; };
390-
4F24A08F26EB735F0036F748 /* TeamSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TeamSettings.swift; sourceTree = "<group>"; };
390+
4F24A08F26EB735F0036F748 /* CloudSettings.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CloudSettings.swift; sourceTree = "<group>"; };
391391
4F24A09126EB73980036F748 /* AboutSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutSettingsView.swift; sourceTree = "<group>"; };
392392
4F24A09326EB73C80036F748 /* ChecksSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChecksSettingsView.swift; sourceTree = "<group>"; };
393393
4F24A09526EB73F30036F748 /* GeneralSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralSettingsView.swift; sourceTree = "<group>"; };
@@ -708,7 +708,7 @@
708708
4F20E2602E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift */,
709709
4F93F1CF2E6F13EB0093FF41 /* IgnoredUsersSettingsView.swift */,
710710
4F103007269EE135008C1E86 /* SettingsView.swift */,
711-
4F24A08F26EB735F0036F748 /* TeamSettings.swift */,
711+
4F24A08F26EB735F0036F748 /* CloudSettings.swift */,
712712
4F24A09126EB73980036F748 /* AboutSettingsView.swift */,
713713
4F24A09326EB73C80036F748 /* ChecksSettingsView.swift */,
714714
4F24A09526EB73F30036F748 /* GeneralSettingsView.swift */,
@@ -1171,7 +1171,7 @@
11711171
4F3DCFCF274FD1AE00F1CB55 /* AppCheck.swift in Sources */,
11721172
4F37E70E2718122E00A2B254 /* PrinterSharingCheck.swift in Sources */,
11731173
4F37E70F2718122E00A2B254 /* FileSharingCheck.swift in Sources */,
1174-
4F37E7102718122E00A2B254 /* TeamSettings.swift in Sources */,
1174+
4F37E7102718122E00A2B254 /* CloudSettings.swift in Sources */,
11751175
4F20E2622E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift in Sources */,
11761176
4F37E7112718122E00A2B254 /* URL.swift in Sources */,
11771177
4F38D8CC273AC5F200671756 /* PermissionsView.swift in Sources */,
@@ -1321,7 +1321,7 @@
13211321
4F3DCFCE274FD1AE00F1CB55 /* AppCheck.swift in Sources */,
13221322
4F6A0E0E26CE484A003B00A3 /* PrinterSharingCheck.swift in Sources */,
13231323
4F6A0E1026CE4868003B00A3 /* FileSharingCheck.swift in Sources */,
1324-
4F24A09026EB735F0036F748 /* TeamSettings.swift in Sources */,
1324+
4F24A09026EB735F0036F748 /* CloudSettings.swift in Sources */,
13251325
4F20E2612E701B6400E93943 /* IgnoredSSHKeysSettingsView.swift in Sources */,
13261326
4F81C10826EB5D270065F548 /* URL.swift in Sources */,
13271327
4F38D8CB273AC5F200671756 /* PermissionsView.swift in Sources */,

Pareto/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
</dict>
2727
</array>
2828
<key>CFBundleVersion</key>
29-
<string>6725</string>
29+
<string>6729</string>
3030
<key>LSApplicationCategoryType</key>
3131
<string>public.app-category.utilities</string>
3232
<key>LSMinimumSystemVersion</key>
Lines changed: 168 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,168 @@
1+
//
2+
// TeamSettings.swift
3+
// TeamSettings
4+
//
5+
// Created by Janez Troha on 10/09/2021.
6+
//
7+
8+
import Defaults
9+
import SwiftUI
10+
11+
struct TeamSettingsView: View {
12+
@StateObject var teamSettings: TeamSettingsUpdater
13+
14+
@Default(.teamID) var teamID
15+
@Default(.machineUUID) var machineUUID
16+
@Default(.sendHWInfo) var sendHWInfo
17+
@Default(.showBeta) var showBeta
18+
19+
@State private var debugLinkURL: String = ""
20+
21+
// SwiftUI-native alert handling
22+
@State private var alertData: InlineAlert?
23+
24+
@Environment(\.openURL) private var openURL
25+
26+
private struct InlineAlert: Identifiable {
27+
let id = UUID()
28+
let title: String
29+
let message: String?
30+
}
31+
32+
private func copyIDsToPasteboard() {
33+
NSPasteboard.general.clearContents()
34+
NSPasteboard.general.setString("Team ID: \(teamID)\nMachine UUID: \(machineUUID)", forType: .string)
35+
alertData = InlineAlert(title: "Copied", message: "Team ID and Machine UUID have been copied to the clipboard.")
36+
}
37+
38+
private func copyApps() {
39+
var logs = [String]()
40+
logs.append("Name, Bundle, Version")
41+
for app in PublicApp.all {
42+
logs.append("\(app.name), \(app.bundle), \(app.version)")
43+
}
44+
45+
NSPasteboard.general.clearContents()
46+
NSPasteboard.general.setString(logs.joined(separator: "\n"), forType: .string)
47+
alertData = InlineAlert(title: "Copied", message: "List of installed apps has been copied to the clipboard.")
48+
}
49+
50+
private func help() {
51+
if let url = URL(string: "https://support.apple.com/en-ie/guide/mac-help/mchlp2322/mac#mchl8c79215b") {
52+
openURL(url)
53+
}
54+
}
55+
56+
private func processDebugLinkURL() {
57+
let trimmed = debugLinkURL.trimmingCharacters(in: .whitespacesAndNewlines)
58+
guard let url = URL(string: trimmed), !trimmed.isEmpty else {
59+
alertData = InlineAlert(title: "Invalid URL", message: "Please enter a valid paretosecurity:// URL.")
60+
return
61+
}
62+
63+
AppHandlers().processAction(url)
64+
debugLinkURL = ""
65+
}
66+
67+
var body: some View {
68+
Group {
69+
if !teamID.isEmpty {
70+
Form {
71+
Section(footer: Text("Device Name").font(.caption)) {
72+
Text(AppInfo.machineName)
73+
.textSelection(.enabled)
74+
.contextMenu {
75+
Button("How to change", action: help)
76+
}
77+
}
78+
Section(footer: Text("Device ID").font(.caption)) {
79+
Text(machineUUID)
80+
.font(.system(.body, design: .monospaced))
81+
.textSelection(.enabled)
82+
.contextMenu {
83+
Button("Copy", action: copyIDsToPasteboard)
84+
}
85+
}
86+
Section(footer: Text("When enabled, send model name and serial number.").font(.footnote)) {
87+
if teamSettings.forceSerialPush {
88+
Toggle("Send inventory info on update", isOn: $sendHWInfo)
89+
Text("Sending is requested by the team policy.")
90+
.font(.footnote)
91+
.foregroundStyle(.secondary)
92+
} else {
93+
Toggle("Send inventory info on update", isOn: $sendHWInfo)
94+
}
95+
Button("Copy App list") { copyApps() }
96+
}
97+
98+
if showBeta {
99+
Section(footer: Text("Cloud API Endpoint").font(.caption)) {
100+
Text(Defaults[.teamAPI])
101+
.font(.system(.body, design: .monospaced))
102+
.textSelection(.enabled)
103+
.contextMenu {
104+
Button("Copy") {
105+
NSPasteboard.general.clearContents()
106+
NSPasteboard.general.setString(Defaults[.teamAPI], forType: .string)
107+
alertData = InlineAlert(title: "Copied", message: "Cloud API Endpoint copied to the clipboard.")
108+
}
109+
}
110+
}
111+
}
112+
113+
Section {
114+
HStack {
115+
Button("Unlink this device") { Defaults.toOpenSource() }
116+
Spacer()
117+
Link("Cloud Dashboard »", destination: AppInfo.teamsURL())
118+
}
119+
}
120+
}
121+
.padding(20)
122+
.task {
123+
// Refresh team settings when the view appears
124+
teamSettings.update {}
125+
}
126+
} else {
127+
Form {
128+
Section {
129+
VStack(alignment: .leading, spacing: 6) {
130+
Text("Pareto Cloud provides a web dashboard for an overview of your company's devices. [Learn more »](https://paretosecurity.com/product/device-monitoring)")
131+
.font(.body)
132+
.foregroundStyle(.secondary)
133+
.fixedSize(horizontal: false, vertical: true)
134+
.lineLimit(nil)
135+
}
136+
}
137+
if showBeta {
138+
Section {
139+
// Use inline placeholder to avoid wide left-side form label
140+
TextField("Debug URL", text: $debugLinkURL, prompt: Text("paretosecurity://linkDevice/?invite_id=..."))
141+
.textFieldStyle(RoundedBorderTextFieldStyle())
142+
.onSubmit { processDebugLinkURL() }
143+
144+
HStack {
145+
Button("Process URL", action: processDebugLinkURL)
146+
.keyboardShortcut(.defaultAction)
147+
.disabled(debugLinkURL.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty)
148+
Spacer()
149+
}
150+
} footer: {
151+
VStack(alignment: .leading, spacing: 4) {
152+
Text("DEBUG: Enter a paretosecurity:// URL to trigger device linking").font(.footnote)
153+
Text("Host parameter options:").font(.footnote).fontWeight(.medium)
154+
Text("• Default (cloud): paretosecurity://linkDevice/?invite_id=123").font(.footnote)
155+
Text("• Complete URL: paretosecurity://linkDevice/?invite_id=123&host=https://api.example.com").font(.footnote)
156+
}
157+
}
158+
}
159+
}
160+
.padding(20)
161+
}
162+
}
163+
.alert(item: $alertData) { data in
164+
Alert(title: Text(data.title), message: data.message.map(Text.init), dismissButton: .default(Text("OK")))
165+
}
166+
}
167+
}
168+

Pareto/Views/Settings/TeamSettings.swift

Lines changed: 0 additions & 136 deletions
This file was deleted.

0 commit comments

Comments
 (0)