From 6b48418ad4d72afaa1928cbfb84a58d120ec40d8 Mon Sep 17 00:00:00 2001 From: Janez T Date: Wed, 3 Jan 2024 12:09:23 +0100 Subject: [PATCH] Format code --- Pareto/AppInfo.swift | 2 +- .../Access Security/PasswordtoUnlock.swift | 4 +- .../Access Security/SSHKeysStrength.swift | 4 +- .../InternetSharing.swift | 2 +- .../RemoteManagment.swift | 2 +- Pareto/Checks/LibreOffice.swift | 2 +- Pareto/Checks/ParetoCheck.swift | 2 +- .../Checks/Software Updates/AdobeReader.swift | 2 +- .../Checks/System Integrity/FileVault.swift | 2 +- .../System Integrity/NoUnusedUsers.swift | 49 ++++++++++++-- Pareto/Checks/System Integrity/OpenWiFi.swift | 2 +- .../Checks/System Integrity/SecureiTerm.swift | 2 +- Pareto/Checks/VSCode.swift | 2 +- Pareto/Checks/Zoom.swift | 2 +- .../macOS Updates/AutoUpdateAppCheck.swift | 2 +- .../macOS Updates/AutoUpdateCheck.swift | 2 +- .../AutomaticDownloadCheck.swift | 2 +- .../macOS Updates/AutomaticInstallCheck.swift | 2 +- .../macOS Updates/SecurityUpdateCheck.swift | 2 +- .../macOS Updates/SystemUpdatesCheck.swift | 2 +- Pareto/Defaults.swift | 16 +++-- Pareto/Extensions/SSHCheck.swift | 12 ++-- Pareto/Info.plist | 2 +- Pareto/Teams.swift | 2 +- .../Views/Settings/ChecksSettingsView.swift | 2 +- .../Views/Settings/GeneralSettingsView.swift | 66 +++++++++---------- .../Views/Settings/LicenseSettingsView.swift | 2 +- .../Settings/PermissionsSettingsView.swift | 4 +- Pareto/Views/Settings/TeamSettings.swift | 50 +++++++------- Pareto/Views/Welcome/FollowView.swift | 2 +- Pareto/Views/Welcome/PermissionsView.swift | 2 +- .../ParetoCustomCheckTest.swift | 2 +- ParetoSecurityTests/SettingsTests.swift | 2 +- 33 files changed, 146 insertions(+), 109 deletions(-) diff --git a/Pareto/AppInfo.swift b/Pareto/AppInfo.swift index b655335..9078662 100644 --- a/Pareto/AppInfo.swift +++ b/Pareto/AppInfo.swift @@ -1,5 +1,5 @@ // -// ParetoApp.swift +// AppInfo.swift // Pareto // // Created by Janez Troha on 12/07/2021. diff --git a/Pareto/Checks/Access Security/PasswordtoUnlock.swift b/Pareto/Checks/Access Security/PasswordtoUnlock.swift index 2295a73..82246d3 100644 --- a/Pareto/Checks/Access Security/PasswordtoUnlock.swift +++ b/Pareto/Checks/Access Security/PasswordtoUnlock.swift @@ -1,6 +1,6 @@ // -// PasswordFromLock.swift.swift -// PasswordFromLock.swift +// PasswordtoUnlock.swift +// PasswordtoUnlock.swift // // Created by Janez Troha on 17/08/2021. // diff --git a/Pareto/Checks/Access Security/SSHKeysStrength.swift b/Pareto/Checks/Access Security/SSHKeysStrength.swift index bf0cb0a..4c0cc20 100644 --- a/Pareto/Checks/Access Security/SSHKeysStrength.swift +++ b/Pareto/Checks/Access Security/SSHKeysStrength.swift @@ -35,7 +35,7 @@ struct KeyInfo: Equatable, ExpressibleByStringLiteral { // MARK: - Equatable Methods public static func == (lhs: KeyInfo, rhs: KeyInfo) -> Bool { - return (lhs.signature == rhs.signature) + return lhs.signature == rhs.signature } // MARK: - ExpressibleByStringLiteral Methods @@ -77,7 +77,7 @@ class SSHKeysStrengthCheck: SSHCheck { } return "SSH key \(sshKey) is using weak encryption" } - + func isKeyStrong(withKey path: String) -> Bool { let output = runCMD(app: getSSHKeygenPath(), args: ["-l", "-f", path]) let info = KeyInfo(stringLiteral: output.strip()) diff --git a/Pareto/Checks/Firewall and Sharing/InternetSharing.swift b/Pareto/Checks/Firewall and Sharing/InternetSharing.swift index 2925d28..f4519c9 100644 --- a/Pareto/Checks/Firewall and Sharing/InternetSharing.swift +++ b/Pareto/Checks/Firewall and Sharing/InternetSharing.swift @@ -1,5 +1,5 @@ // -// InternetShare.swift +// InternetSharing.swift // InternetShare // // Created by Janez Troha on 21/09/2021. diff --git a/Pareto/Checks/Firewall and Sharing/RemoteManagment.swift b/Pareto/Checks/Firewall and Sharing/RemoteManagment.swift index 4893289..015c623 100644 --- a/Pareto/Checks/Firewall and Sharing/RemoteManagment.swift +++ b/Pareto/Checks/Firewall and Sharing/RemoteManagment.swift @@ -1,5 +1,5 @@ // -// RemoteManagementCheck.swift +// RemoteManagment.swift // RemoteManagementCheck // // Created by Janez Troha on 08/09/2021. diff --git a/Pareto/Checks/LibreOffice.swift b/Pareto/Checks/LibreOffice.swift index 8c4ec64..cf79278 100644 --- a/Pareto/Checks/LibreOffice.swift +++ b/Pareto/Checks/LibreOffice.swift @@ -1,5 +1,5 @@ // -// GoogleChrome.swift +// LibreOffice.swift // Pareto Security // // Created by Janez Troha on 11/11/2021. diff --git a/Pareto/Checks/ParetoCheck.swift b/Pareto/Checks/ParetoCheck.swift index d731966..546e3ea 100644 --- a/Pareto/Checks/ParetoCheck.swift +++ b/Pareto/Checks/ParetoCheck.swift @@ -1,5 +1,5 @@ // -// MenuItemCheck.swift +// ParetoCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/Software Updates/AdobeReader.swift b/Pareto/Checks/Software Updates/AdobeReader.swift index 7fc3e86..6152164 100644 --- a/Pareto/Checks/Software Updates/AdobeReader.swift +++ b/Pareto/Checks/Software Updates/AdobeReader.swift @@ -1,5 +1,5 @@ // -// Docker.swift +// AdobeReader.swift // Pareto Security // // Created by Janez Troha on 11/11/2021. diff --git a/Pareto/Checks/System Integrity/FileVault.swift b/Pareto/Checks/System Integrity/FileVault.swift index 1cc4b45..89aa6c6 100644 --- a/Pareto/Checks/System Integrity/FileVault.swift +++ b/Pareto/Checks/System Integrity/FileVault.swift @@ -1,5 +1,5 @@ // -// Firewall.swift +// FileVault.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/System Integrity/NoUnusedUsers.swift b/Pareto/Checks/System Integrity/NoUnusedUsers.swift index 52b4418..3ed4edf 100644 --- a/Pareto/Checks/System Integrity/NoUnusedUsers.swift +++ b/Pareto/Checks/System Integrity/NoUnusedUsers.swift @@ -1,10 +1,12 @@ // -// Firewall.swift +// NoUnusedUsers.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. // +import Foundation + class NoUnusedUsers: ParetoCheck { static let sharedInstance = NoUnusedUsers() override var UUID: String { @@ -18,16 +20,53 @@ class NoUnusedUsers: ParetoCheck { override var TitleOFF: String { "Unrequired user accounts are present(" + accounts.joined(separator: ",") + ")" } - + var accounts: [String] { let output = runCMD(app: "/usr/bin/dscl", args: [".", "-list", "/Users"]).components(separatedBy: "\n") let local = output.filter { u in - return !u.hasPrefix("_") && u.count > 1 && u != "root" && u != "nobody" && u != "daemon" + !u.hasPrefix("_") && u.count > 1 && u != "root" && u != "nobody" && u != "daemon" } return local } - + + func lastLoginRecent(user: String) -> Bool { + let output = runCMD(app: "/usr/bin/last", args: ["-w", "-y", user]).components(separatedBy: "\n") + let log = output.filter { u in + u.contains(user) + } + + let entry = log.first?.components(separatedBy: " ").filter { i in + i.count > 1 + } + if (log.first?.contains("still logged in")) != nil { + return true + } + // parse string to date + if entry?.count ?? 0 > 1 { + let dateFormatter = DateFormatter() + dateFormatter.locale = Locale(identifier: "en_US_POSIX") // Use a POSIX locale + dateFormatter.dateFormat = "EEE MMM d yyyy HH:mm" + + if let date = dateFormatter.date(from: entry![2]) { + let currentDate = Date() + let calendar = Calendar.current + + let components = calendar.dateComponents([.month], from: date, to: currentDate) + + if let monthDifference = components.month, monthDifference <= 1 { + return true + } else { + return false + } + } + } + + return false + } + override func checkPasses() -> Bool { - return accounts.count == 1 + return accounts.allSatisfy { u in + lastLoginRecent(user: u) + } } } diff --git a/Pareto/Checks/System Integrity/OpenWiFi.swift b/Pareto/Checks/System Integrity/OpenWiFi.swift index 2d2d959..ee94eb8 100644 --- a/Pareto/Checks/System Integrity/OpenWiFi.swift +++ b/Pareto/Checks/System Integrity/OpenWiFi.swift @@ -1,5 +1,5 @@ // -// OpenWIFI.swift +// OpenWiFi.swift // Pareto Security // // Created by Janez Troha on 28/09/2021. diff --git a/Pareto/Checks/System Integrity/SecureiTerm.swift b/Pareto/Checks/System Integrity/SecureiTerm.swift index 4bb0118..98ba1f9 100644 --- a/Pareto/Checks/System Integrity/SecureiTerm.swift +++ b/Pareto/Checks/System Integrity/SecureiTerm.swift @@ -1,5 +1,5 @@ // -// SecureTerminal.swift +// SecureiTerm.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/VSCode.swift b/Pareto/Checks/VSCode.swift index 33a65a9..65d757a 100644 --- a/Pareto/Checks/VSCode.swift +++ b/Pareto/Checks/VSCode.swift @@ -1,5 +1,5 @@ // -// SublimeText.swift +// VSCode.swift // Pareto Security // // Created by Janez Troha on 11/11/2021. diff --git a/Pareto/Checks/Zoom.swift b/Pareto/Checks/Zoom.swift index d7b7374..573273e 100644 --- a/Pareto/Checks/Zoom.swift +++ b/Pareto/Checks/Zoom.swift @@ -1,5 +1,5 @@ // -// GoogleChrome.swift +// Zoom.swift // Pareto Security // // Created by Janez Troha on 11/11/2021. diff --git a/Pareto/Checks/macOS Updates/AutoUpdateAppCheck.swift b/Pareto/Checks/macOS Updates/AutoUpdateAppCheck.swift index 558f074..4c7f63f 100644 --- a/Pareto/Checks/macOS Updates/AutoUpdateAppCheck.swift +++ b/Pareto/Checks/macOS Updates/AutoUpdateAppCheck.swift @@ -1,5 +1,5 @@ // -// AppStoreAppsUpdatesCheck.swift +// AutoUpdateAppCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/macOS Updates/AutoUpdateCheck.swift b/Pareto/Checks/macOS Updates/AutoUpdateCheck.swift index 0a7f840..1d33dea 100644 --- a/Pareto/Checks/macOS Updates/AutoUpdateCheck.swift +++ b/Pareto/Checks/macOS Updates/AutoUpdateCheck.swift @@ -1,5 +1,5 @@ // -// AppStoreUpdatesCheck.swift +// AutoUpdateCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/macOS Updates/AutomaticDownloadCheck.swift b/Pareto/Checks/macOS Updates/AutomaticDownloadCheck.swift index f7dd709..b8fff34 100644 --- a/Pareto/Checks/macOS Updates/AutomaticDownloadCheck.swift +++ b/Pareto/Checks/macOS Updates/AutomaticDownloadCheck.swift @@ -1,5 +1,5 @@ // -// AutoUpdateCheck.swift +// AutomaticDownloadCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/macOS Updates/AutomaticInstallCheck.swift b/Pareto/Checks/macOS Updates/AutomaticInstallCheck.swift index 78d74bf..48e7333 100644 --- a/Pareto/Checks/macOS Updates/AutomaticInstallCheck.swift +++ b/Pareto/Checks/macOS Updates/AutomaticInstallCheck.swift @@ -1,5 +1,5 @@ // -// AutoUpdateCheck.swift +// AutomaticInstallCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/macOS Updates/SecurityUpdateCheck.swift b/Pareto/Checks/macOS Updates/SecurityUpdateCheck.swift index dfb28b1..a19d21f 100644 --- a/Pareto/Checks/macOS Updates/SecurityUpdateCheck.swift +++ b/Pareto/Checks/macOS Updates/SecurityUpdateCheck.swift @@ -1,5 +1,5 @@ // -// AutoUpdateCheck.swift +// SecurityUpdateCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Checks/macOS Updates/SystemUpdatesCheck.swift b/Pareto/Checks/macOS Updates/SystemUpdatesCheck.swift index 45b7821..0761533 100644 --- a/Pareto/Checks/macOS Updates/SystemUpdatesCheck.swift +++ b/Pareto/Checks/macOS Updates/SystemUpdatesCheck.swift @@ -1,5 +1,5 @@ // -// AppStoreUpdatesCheck.swift +// SystemUpdatesCheck.swift // Pareto Security // // Created by Janez Troha on 15/07/2021. diff --git a/Pareto/Defaults.swift b/Pareto/Defaults.swift index 132558a..b569b4a 100644 --- a/Pareto/Defaults.swift +++ b/Pareto/Defaults.swift @@ -1,14 +1,14 @@ // -// Settings.swift +// Defaults.swift // Settings // // Created by Janez Troha on 27/07/2021. // +import AppKit import Combine import Defaults import Foundation -import AppKit import SwiftUI enum ReportingRoles: String, Defaults.Serializable { @@ -88,25 +88,27 @@ public extension Defaults { Defaults[.lastUpdateCheck] = Date().currentTimeMs() Defaults[.updateNag] = false } - + static func OKColor() -> NSColor { if Defaults[.alternativeColor] { - let light = NSColor.init(red: 255, green: 179, blue: 64, alpha: 1) - let dark = NSColor.init(red: 255, green: 179, blue: 64, alpha: 1) + let light = NSColor(red: 255, green: 179, blue: 64, alpha: 1) + let dark = NSColor(red: 255, green: 179, blue: 64, alpha: 1) let isDark = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark" return isDark ? dark : light } return NSColor.systemGreen } + static func FailColor() -> NSColor { if Defaults[.alternativeColor] { - let light = NSColor.init(red: 64, green: 156, blue: 255, alpha: 1) - let dark = NSColor.init(red: 64, green: 156, blue: 255, alpha: 1) + let light = NSColor(red: 64, green: 156, blue: 255, alpha: 1) + let dark = NSColor(red: 64, green: 156, blue: 255, alpha: 1) let isDark = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") == "Dark" return isDark ? dark : light } return NSColor.systemOrange } + static func shouldAskForHWAllow() -> Bool { return Defaults[.lastHWAsk] + Date.HourInMs * 24 * 7 * 30 * 6 < Date().currentTimeMs() } diff --git a/Pareto/Extensions/SSHCheck.swift b/Pareto/Extensions/SSHCheck.swift index 98e7519..a223cf4 100644 --- a/Pareto/Extensions/SSHCheck.swift +++ b/Pareto/Extensions/SSHCheck.swift @@ -9,27 +9,27 @@ import Foundation import os.log class SSHCheck: ParetoCheck { - internal let sshPath = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".ssh").resolvingSymlinksInPath() + let sshPath = FileManager.default.homeDirectoryForCurrentUser.appendingPathComponent(".ssh").resolvingSymlinksInPath() private var sshKeygenPath = "" - + func itExists(_ path: String) -> Bool { FileManager.default.fileExists(atPath: path) } - + func getSSHKeygenPath() -> String { if !sshKeygenPath.isEmpty { return sshKeygenPath } - + if itExists("/opt/homebrew/bin/ssh-keygen") { sshKeygenPath = "/opt/homebrew/bin/ssh-keygen" } else { sshKeygenPath = "/usr/bin/ssh-keygen" } - + return sshKeygenPath } - + override var isRunnable: Bool { if !itExists(getSSHKeygenPath()) { os_log("Not found /opt/homebrew/bin/ssh-keygen or /usr/bin/ssh-keygen, check disabled", log: Log.check) diff --git a/Pareto/Info.plist b/Pareto/Info.plist index 3df9782..cdc2e18 100644 --- a/Pareto/Info.plist +++ b/Pareto/Info.plist @@ -26,7 +26,7 @@ CFBundleVersion - 5292 + 5310 LSApplicationCategoryType public.app-category.utilities LSMinimumSystemVersion diff --git a/Pareto/Teams.swift b/Pareto/Teams.swift index 55563a8..9ff2d59 100644 --- a/Pareto/Teams.swift +++ b/Pareto/Teams.swift @@ -1,5 +1,5 @@ // -// Team.swift +// Teams.swift // Team // // Created by Janez Troha on 16/09/2021. diff --git a/Pareto/Views/Settings/ChecksSettingsView.swift b/Pareto/Views/Settings/ChecksSettingsView.swift index c2c828c..13a9f54 100644 --- a/Pareto/Views/Settings/ChecksSettingsView.swift +++ b/Pareto/Views/Settings/ChecksSettingsView.swift @@ -1,5 +1,5 @@ // -// CheckSettingsView.swift +// ChecksSettingsView.swift // CheckSettingsView // // Created by Janez Troha on 10/09/2021. diff --git a/Pareto/Views/Settings/GeneralSettingsView.swift b/Pareto/Views/Settings/GeneralSettingsView.swift index 038abe3..9e19a9c 100644 --- a/Pareto/Views/Settings/GeneralSettingsView.swift +++ b/Pareto/Views/Settings/GeneralSettingsView.swift @@ -27,68 +27,66 @@ struct GeneralSettingsView: View { var body: some View { VStack { - - Form { Section( footer: Text("To enable continuous monitoring and reporting.").font(.footnote)) { - VStack(alignment: .leading) { - Toggle("Automatically launch on system startup", isOn: $atLogin.isEnabled) - } + VStack(alignment: .leading) { + Toggle("Automatically launch on system startup", isOn: $atLogin.isEnabled) } + } Section( footer: Text("Only scan for updates for recently used apps.").font(.footnote)) { - VStack(alignment: .leading) { - Toggle("Update check only for apps used in the last week", isOn: $checkForUpdatesRecentOnly) - } + VStack(alignment: .leading) { + Toggle("Update check only for apps used in the last week", isOn: $checkForUpdatesRecentOnly) } + } Section( - footer: Text("To show the menu bar icon, launch the app again.").font(.footnote) ){ - VStack(alignment: .leading) { - Toggle("Only show in menu bar when the checks are failing", isOn: $hideWhenNoFailures) - } + footer: Text("To show the menu bar icon, launch the app again.").font(.footnote)) { + VStack(alignment: .leading) { + Toggle("Only show in menu bar when the checks are failing", isOn: $hideWhenNoFailures) } + } Section( footer: Text("Enables custom checks, that are configured by YAML rules. [Learn more](https://paretosecurity.com/custom-check/)").font(.footnote)) { - VStack(alignment: .leading) { - HStack { - Toggle("Enable My Checks", isOn: $myChecks) - Button("Select folder") { - selectFolder() - }.disabled(!myChecks) - } + VStack(alignment: .leading) { + HStack { + Toggle("Enable My Checks", isOn: $myChecks) + Button("Select folder") { + selectFolder() + }.disabled(!myChecks) } } + } Section( - footer: Text("Improve default colors for accessibility.").font(.footnote) ){ - VStack(alignment: .leading) { - Toggle("Use alternative color scheme", isOn: $alternativeColor) - } + footer: Text("Improve default colors for accessibility.").font(.footnote)) { + VStack(alignment: .leading) { + Toggle("Use alternative color scheme", isOn: $alternativeColor) } + } if showBeta { Section( footer: Text("When priority check fails show notification.").font(.footnote)) { - VStack(alignment: .leading) { - Toggle("Show priority check failures as notifications", isOn: $showNotifications).onChange(of: showNotifications) { isEnabled in - if isEnabled { - registerNotifications() - } + VStack(alignment: .leading) { + Toggle("Show priority check failures as notifications", isOn: $showNotifications).onChange(of: showNotifications) { isEnabled in + if isEnabled { + registerNotifications() } } } + } Section( footer: Text("Skip all processing after wakeup, network changes.").font(.footnote)) { - VStack(alignment: .leading) { - Toggle("Skip running checks on events", isOn: $disableChecksEvents) - } + VStack(alignment: .leading) { + Toggle("Skip running checks on events", isOn: $disableChecksEvents) } + } Section( footer: Text("Latest features but potentially bugs to report.").font(.footnote)) { - VStack(alignment: .leading) { - Toggle("Update app to pre-release builds", isOn: $betaChannel) - } + VStack(alignment: .leading) { + Toggle("Update app to pre-release builds", isOn: $betaChannel) } + } #if DEBUG HStack { Button("Reset Settings") { diff --git a/Pareto/Views/Settings/LicenseSettingsView.swift b/Pareto/Views/Settings/LicenseSettingsView.swift index 2d86e54..3d17062 100644 --- a/Pareto/Views/Settings/LicenseSettingsView.swift +++ b/Pareto/Views/Settings/LicenseSettingsView.swift @@ -1,5 +1,5 @@ // -// LicenseView.swift +// LicenseSettingsView.swift // LicenseView // // Created by Janez Troha on 10/09/2021. diff --git a/Pareto/Views/Settings/PermissionsSettingsView.swift b/Pareto/Views/Settings/PermissionsSettingsView.swift index 6cc713c..715fe44 100644 --- a/Pareto/Views/Settings/PermissionsSettingsView.swift +++ b/Pareto/Views/Settings/PermissionsSettingsView.swift @@ -1,5 +1,5 @@ // -// GeneralSettingsView.swift +// PermissionsSettingsView.swift // GeneralSettingsView // // Created by Janez Troha on 10/09/2021. @@ -40,7 +40,6 @@ struct PermissionsSettingsView: View { var body: some View { VStack { - HStack { VStack(alignment: .leading) { Text("System Events Access").font(.headline) @@ -84,7 +83,6 @@ struct PermissionsSettingsView: View { checker.stop() } } - } struct PermissionsSettingsView_Previews: PreviewProvider { diff --git a/Pareto/Views/Settings/TeamSettings.swift b/Pareto/Views/Settings/TeamSettings.swift index c93f7fa..b655e47 100644 --- a/Pareto/Views/Settings/TeamSettings.swift +++ b/Pareto/Views/Settings/TeamSettings.swift @@ -34,50 +34,50 @@ struct TeamSettingsView: View { VStack(alignment: .leading) { Section( footer: Text("Team Name").font(.caption)) { - VStack(alignment: .leading) { - Text("\(teamSettings.name)") - } + VStack(alignment: .leading) { + Text("\(teamSettings.name)") } + } Spacer(minLength: 1) Section( footer: Text("Team Admin").font(.caption)) { - VStack(alignment: .leading) { - Link(teamSettings.admin, destination: URL(string: "mailto:\(teamSettings.admin)")!).contextMenu(ContextMenu(menuItems: { - Button("Copy", action: copyMail) - })) - } + VStack(alignment: .leading) { + Link(teamSettings.admin, destination: URL(string: "mailto:\(teamSettings.admin)")!).contextMenu(ContextMenu(menuItems: { + Button("Copy", action: copyMail) + })) } + } Spacer(minLength: 1) Section( footer: Text("Device Name").font(.caption)) { - VStack(alignment: .leading) { - Text("\(AppInfo.machineName)").contextMenu(ContextMenu(menuItems: { - Button("How to change", action: help) - })) - } + VStack(alignment: .leading) { + Text("\(AppInfo.machineName)").contextMenu(ContextMenu(menuItems: { + Button("How to change", action: help) + })) } + } Spacer(minLength: 1) Section( footer: Text("Device ID").font(.caption)) { - VStack(alignment: .leading) { - Text("\(machineUUID)").contextMenu(ContextMenu(menuItems: { - Button("Copy", action: copy) - })) - } + VStack(alignment: .leading) { + Text("\(machineUUID)").contextMenu(ContextMenu(menuItems: { + Button("Copy", action: copy) + })) } + } Spacer(minLength: 2) Section( footer: Text("When enabled, send model name and serial number.").font(.footnote)) { - VStack(alignment: .leading) { - if teamSettings.forceSerialPush { - Toggle("Send inventory info on update", isOn: $sendHWInfo) - Text("Sending is requested by the team policy.").font(.footnote) - } else { - Toggle("Send inventory info on update", isOn: $sendHWInfo) - } + VStack(alignment: .leading) { + if teamSettings.forceSerialPush { + Toggle("Send inventory info on update", isOn: $sendHWInfo) + Text("Sending is requested by the team policy.").font(.footnote) + } else { + Toggle("Send inventory info on update", isOn: $sendHWInfo) } } + } HStack { Button("Unlink this device") { diff --git a/Pareto/Views/Welcome/FollowView.swift b/Pareto/Views/Welcome/FollowView.swift index 606af5b..073649b 100644 --- a/Pareto/Views/Welcome/FollowView.swift +++ b/Pareto/Views/Welcome/FollowView.swift @@ -1,5 +1,5 @@ // -// PermissiosView.swift +// FollowView.swift // Pareto Security // // Created by Janez Troha on 09/11/2021. diff --git a/Pareto/Views/Welcome/PermissionsView.swift b/Pareto/Views/Welcome/PermissionsView.swift index 20835e1..6380a6a 100644 --- a/Pareto/Views/Welcome/PermissionsView.swift +++ b/Pareto/Views/Welcome/PermissionsView.swift @@ -1,5 +1,5 @@ // -// PermissiosView.swift +// PermissionsView.swift // Pareto Security // // Created by Janez Troha on 09/11/2021. diff --git a/ParetoSecurityTests/ParetoCustomCheckTest.swift b/ParetoSecurityTests/ParetoCustomCheckTest.swift index 195ce75..439810a 100644 --- a/ParetoSecurityTests/ParetoCustomCheckTest.swift +++ b/ParetoSecurityTests/ParetoCustomCheckTest.swift @@ -1,5 +1,5 @@ // -// ParetoAppTest.swift +// ParetoCustomCheckTest.swift // ParetoAppTest // // Created by Janez Troha on 20/09/2021. diff --git a/ParetoSecurityTests/SettingsTests.swift b/ParetoSecurityTests/SettingsTests.swift index 4aa0187..5c29841 100644 --- a/ParetoSecurityTests/SettingsTests.swift +++ b/ParetoSecurityTests/SettingsTests.swift @@ -1,5 +1,5 @@ // -// Settings.swift +// SettingsTests.swift // Settings // // Created by Janez Troha on 17/08/2021.