Skip to content

Commit 7fb88d1

Browse files
committed
Rename views from custom to sc
1 parent fb78710 commit 7fb88d1

26 files changed

+79
-157
lines changed

SupportCompanion/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class AppDelegate: NSObject, NSApplicationDelegate {
4949
popover.behavior = .transient // Closes when clicking outside
5050
popover.contentSize = NSSize(width: 500, height: 520)
5151
popover.contentViewController = NSHostingController(
52-
rootView: CustomMenuView(
52+
rootView: TrayMenuView(
5353
viewModel: CardGridViewModel(appState: AppStateManager.shared)
5454
)
5555
.environmentObject(AppStateManager.shared)

SupportCompanion/Localizable.xcstrings

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
},
1313
"%@%%" : {
1414

15+
},
16+
"%@%% Patched" : {
17+
1518
},
1619
"%@%% Used" : {
1720
"localizations" : {
@@ -1456,9 +1459,6 @@
14561459
}
14571460
}
14581461
}
1459-
},
1460-
"Done" : {
1461-
14621462
},
14631463
"Error.CommandFailed" : {
14641464
"comment" : "Error message when a command failed",
@@ -2433,9 +2433,6 @@
24332433
}
24342434
}
24352435
}
2436-
},
2437-
"Pending: " : {
2438-
24392436
},
24402437
"PlatformSSO.LoginFrequency" : {
24412438
"comment" : "Label for the login frequency",
@@ -2688,12 +2685,6 @@
26882685
}
26892686
}
26902687
}
2691-
},
2692-
"Progress: " : {
2693-
2694-
},
2695-
"Quick Actions" : {
2696-
26972688
},
26982689
"Realm:" : {
26992690

@@ -2728,12 +2719,6 @@
27282719
},
27292720
"Rings" : {
27302721

2731-
},
2732-
"Run" : {
2733-
2734-
},
2735-
"Select an action" : {
2736-
27372722
},
27382723
"Select an option" : {
27392724

SupportCompanion/ViewModels/CardGridViewModel.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ class CardGridViewModel: ObservableObject {
3232
]
3333
}
3434

35-
func createRestartIntuneAgentButton(fontSize: CGFloat? = nil) -> CustomButton {
36-
CustomButton(Constants.Actions.restartIntuneAgent, fontSize: fontSize) {
35+
func createRestartIntuneAgentButton(fontSize: CGFloat? = nil) -> ScButton {
36+
ScButton(Constants.Actions.restartIntuneAgent, fontSize: fontSize) {
3737
ActionHelpers.restartIntuneAgent { result in
3838
ActionHelpers.handleResult(
3939
operationName: "Restart Intune Agent",
@@ -50,8 +50,8 @@ class CardGridViewModel: ObservableObject {
5050
}
5151
}
5252

53-
func createGatherLogsButton(fontSize: CGFloat? = nil) -> CustomButton {
54-
CustomButton(Constants.Actions.gatherLogs, fontSize: fontSize) {
53+
func createGatherLogsButton(fontSize: CGFloat? = nil) -> ScButton {
54+
ScButton(Constants.Actions.gatherLogs, fontSize: fontSize) {
5555
ActionHelpers.gatherLogs(preferences: self.appState.preferences) { result in
5656
ActionHelpers.handleResult(
5757
operationName: Constants.Actions.gatherLogs,
@@ -69,8 +69,8 @@ class CardGridViewModel: ObservableObject {
6969

7070
func createRebootButton(
7171
onShowModal: @escaping (Int, String, String) -> Void
72-
) -> CustomButton {
73-
CustomButton(Constants.Actions.reboot) {
72+
) -> ScButton {
73+
ScButton(Constants.Actions.reboot) {
7474
await ActionHelpers.reboot { result in
7575
DispatchQueue.main.async {
7676
switch result {
@@ -86,8 +86,8 @@ class CardGridViewModel: ObservableObject {
8686
}
8787
}
8888

89-
func createChangePasswordButton(fontSize: CGFloat? = nil) -> CustomButton {
90-
CustomButton(Constants.Actions.changePassword, fontSize: fontSize) {
89+
func createChangePasswordButton(fontSize: CGFloat? = nil) -> ScButton {
90+
ScButton(Constants.Actions.changePassword, fontSize: fontSize) {
9191
await ActionHelpers.openChangePassword(preferences: self.appState.preferences) { result in
9292
ActionHelpers.handleResult(
9393
operationName: Constants.Actions.changePassword,
@@ -108,7 +108,7 @@ class CardGridViewModel: ObservableObject {
108108
case `default`
109109
}
110110

111-
func createOpenManagementAppButton(type: ManagementAppURLType, fontSize: CGFloat? = nil) -> CustomButton {
111+
func createOpenManagementAppButton(type: ManagementAppURLType, fontSize: CGFloat? = nil) -> ScButton {
112112
let appName: String
113113
let appURL: String
114114

@@ -129,7 +129,7 @@ class CardGridViewModel: ObservableObject {
129129
appURL = ""
130130
}
131131

132-
return CustomButton("\(Constants.Actions.openManagementApp) \(appName)", fontSize: fontSize) {
132+
return ScButton("\(Constants.Actions.openManagementApp) \(appName)", fontSize: fontSize) {
133133
ActionHelpers.openManagementApp(appURL: appURL)
134134
}
135135
}

SupportCompanion/Views/Cards/ActionsCard.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct ActionsCard: View {
1515

1616
var body: some View {
1717
if viewModel.isCardVisible("Actions") {
18-
CustomCard(title: "\(Constants.CardTitle.actions)", titleImageName: "cursorarrow.click.2", content: {
18+
ScCard(title: "\(Constants.CardTitle.actions)", titleImageName: "cursorarrow.click.2", content: {
1919
// Precompute the filtered and chunked buttons
2020
let visibleButtons = [
2121
viewModel.isButtonVisible("ChangePassword") ? viewModel.createChangePasswordButton() : nil,
@@ -27,9 +27,9 @@ struct ActionsCard: View {
2727
(appState.preferences.mode == Constants.modes.munki || appState.preferences.mode == Constants.modes.intune)
2828
? (viewModel.isButtonVisible("OpenManagementApp") ? viewModel.createOpenManagementAppButton(type: .default) : nil)
2929
: nil,
30-
viewModel.isButtonVisible("GetSupport") ? CustomButton(Constants.Actions.getSupport) { ActionHelpers.openSupportPage(url: appState.preferences.supportPageURL) } : nil,
30+
viewModel.isButtonVisible("GetSupport") ? ScButton(Constants.Actions.getSupport) { ActionHelpers.openSupportPage(url: appState.preferences.supportPageURL) } : nil,
3131
viewModel.isButtonVisible("GatherLogs") ? viewModel.createGatherLogsButton() : nil,
32-
viewModel.isButtonVisible("SoftwareUpdates") ? CustomButton(
32+
viewModel.isButtonVisible("SoftwareUpdates") ? ScButton(
3333
Constants.Actions.softwareUpdate,
3434
badgeNumber: appState.systemUpdateCache.updates.count,
3535
helpText: appState.systemUpdateCache.updates.joined(separator: "\n"))

SupportCompanion/Views/Cards/AppCard.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ struct AppCard: View {
4646
}
4747

4848
var body: some View {
49-
CustomCard(
49+
ScCard(
5050
title: card.name,
5151
titleImageName: titleImage,
5252
imageSize: (40, 40),
@@ -78,7 +78,7 @@ struct AppCard: View {
7878
}
7979

8080
if card.isSelfServe {
81-
CustomButton(Constants.General.manage, action: {
81+
ScButton(Constants.General.manage, action: {
8282
Task {
8383
if !card.action.isEmpty {
8484
_ = try await ExecutionService.executeShellCommand(card.action)

SupportCompanion/Views/Cards/BatteryEvergreenStack.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct BatteryEvergreenStack: View {
1717
} else{
1818
VStack(alignment: .leading){
1919
if viewModel.isCardVisible("Evergreen") && appState.preferences.mode == Constants.modes.munki {
20-
CustomCard(title: "\(Constants.CardTitle.evergreen)", titleImageName: "leaf.fill", content: {
20+
ScCard(title: "\(Constants.CardTitle.evergreen)", titleImageName: "leaf.fill", content: {
2121
VStack(alignment: .leading) {
2222
Text("Rings")
2323
.font(.system(size: 14))
@@ -40,7 +40,7 @@ struct BatteryEvergreenStack: View {
4040
}
4141

4242
if viewModel.isCardVisible("Battery") {
43-
CustomCard(title: "\(Constants.CardTitle.battery)", titleImageName: "battery.100percent.bolt", imageSize: (25,25), content: {
43+
ScCard(title: "\(Constants.CardTitle.battery)", titleImageName: "battery.100percent.bolt", imageSize: (25,25), content: {
4444
VStack(alignment: .leading) {
4545
CardData(info: appState.batteryInfoManager.batteryInfo.toKeyValuePairs())
4646
}

SupportCompanion/Views/Cards/DeviceInformationCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ struct DeviceInformationCard: View {
1717
if viewModel.isCardVisible("DeviceInformation") {
1818
let groupedData = groupedDeviceInfoArray() // Precomputed grouped data
1919

20-
CustomCard(
20+
ScCard(
2121
title: "\(Constants.CardTitle.deviceInfo)",
2222
titleImageName: "laptopcomputer",
2323
buttonImageName: "doc.on.doc.fill",

SupportCompanion/Views/Cards/JsonCardView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct JsonCardView: View {
1212
let card: JsonCard
1313

1414
var body: some View {
15-
CustomCard(
15+
ScCard(
1616
title: card.header,
1717
titleImageName: card.icon,
1818
content: {

SupportCompanion/Views/Cards/KSSOCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ struct KSSOCard: View {
1414
var body: some View {
1515
VStack(alignment: .leading){
1616
if "" != appState.ssoInfoManager.kerberosSSO.username {
17-
CustomCard(title: "\(Constants.CardTitle.kerberosSSO)", titleImageName: "lock.fill", useMultiColor: false, content: {
17+
ScCard(title: "\(Constants.CardTitle.kerberosSSO)", titleImageName: "lock.fill", useMultiColor: false, content: {
1818
VStack(alignment: .leading) {
1919
CardData(info: appState.ssoInfoManager.kerberosSSO.toKeyValuePairs())
2020
}

SupportCompanion/Views/Cards/PSSOCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PSSOCard: View {
1515
var body: some View {
1616
VStack(alignment: .leading){
1717
if "" != appState.ssoInfoManager.platformSSO.loginType {
18-
CustomCard(title: "\(Constants.CardTitle.platformSSO)", titleImageName: "lock.fill", useMultiColor: false, content: {
18+
ScCard(title: "\(Constants.CardTitle.platformSSO)", titleImageName: "lock.fill", useMultiColor: false, content: {
1919
VStack(alignment: .leading) {
2020
CardData(info: appState.ssoInfoManager.platformSSO.toKeyValuePairs())
2121
}

SupportCompanion/Views/Cards/PatchingProgressCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PatchingProgressCard: View {
1515
var body: some View {
1616
if viewModel.isCardVisible("ApplicationInstallProgress") {
1717
VStack {
18-
CustomCard(title: "\(Constants.CardTitle.appPatchProgress)", titleImageName: "app.badge.checkmark", content: {
18+
ScCard(title: "\(Constants.CardTitle.appPatchProgress)", titleImageName: "app.badge.checkmark", content: {
1919
ZStack {
2020
CircularProgressWithWave(
2121
progress: appState.installPercentage / 100,

SupportCompanion/Views/Cards/PendingUpdatesCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct PendingUpdatesCard: View {
1515
var body: some View {
1616
if viewModel.isCardVisible("PendingAppUpdates") {
1717
VStack {
18-
CustomCard(
18+
ScCard(
1919
title: "\(Constants.CardTitle.pendingUpdates)",
2020
titleImageName: "clock.fill",
2121
content: {

SupportCompanion/Views/Cards/StorageDeviceManagementStack.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct StorageDeviceManagementStack: View {
1919
VStack(alignment: .leading){
2020
// Storage Card
2121
if viewModel.isCardVisible(Constants.Cards.storageCardName) {
22-
CustomCard(title: "\(Constants.CardTitle.storage)",
22+
ScCard(title: "\(Constants.CardTitle.storage)",
2323
titleImageName: "internaldrive.fill",
2424
buttonImageName: "macwindow.on.rectangle",
2525
buttonAction: { viewModel.openStoragePanel() },
@@ -55,7 +55,7 @@ struct StorageDeviceManagementStack: View {
5555

5656
// Device Management Card
5757
if viewModel.isCardVisible("DeviceManagement") {
58-
CustomCard(title: "\(Constants.CardTitle.deviceManagement)", titleImageName: "lock.shield", content: {
58+
ScCard(title: "\(Constants.CardTitle.deviceManagement)", titleImageName: "lock.shield", content: {
5959
VStack(alignment: .leading, spacing: 5) {
6060
CardData(info: appState.mdmInfoManager.mdmInfo.toKeyValuePairs())
6161
}

SupportCompanion/Views/Cards/UserInfoCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ struct UserInfoCard: View {
1313

1414
var body: some View {
1515
VStack(alignment: .leading){
16-
CustomCard(title: "\(Constants.CardTitle.userInfo)", titleImageName: "person.fill", content: {
16+
ScCard(title: "\(Constants.CardTitle.userInfo)", titleImageName: "person.fill", content: {
1717
VStack(alignment: .leading) {
1818
CardData(info: appState.userInfoManager.userInfo.toKeyValuePairs())
1919
}

SupportCompanion/Views/CompactCards/CompactBatteryCard.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct CompactBatteryCard: View {
55
@EnvironmentObject var appState: AppStateManager
66

77
var body: some View {
8-
CustomCardCompact(
8+
ScCardCompact(
99
title: "Battery",
1010
titleImageName: "battery.100percent",
1111
buttonImageName: "info.circle",
@@ -19,4 +19,4 @@ struct CompactBatteryCard: View {
1919
appState.batteryInfoManager.refresh()
2020
}
2121
}
22-
}
22+
}

SupportCompanion/Views/CompactCards/CompactDeviceCard.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct CompactDeviceCard: View {
55
@EnvironmentObject var appState: AppStateManager
66

77
var body: some View {
8-
CustomCardCompact(
8+
ScCardCompact(
99
title: AppStateManager.shared.deviceInfoManager.deviceInfo?.hostName ?? "",
1010
titleImageName: "desktopcomputer",
1111
imageSize: (13, 13),

SupportCompanion/Views/CompactCards/CompactPatchProgressCard.swift

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,25 @@ struct CompactPatchProgressCard: View {
66
@Environment(\.colorScheme) var colorScheme
77

88
var body: some View {
9-
CustomCardCompact(
9+
ScCardCompact(
1010
title: "Patch progress",
1111
titleImageName: "app",
1212
buttonImageName: "info.circle",
1313
buttonAction: {},
1414
imageSize: (13, 13),
1515
content: {
16-
HStack {
17-
Text("Progress: ")
18-
.bold()
19-
.font(.system(size: 12))
20-
+ Text("\(Int(appState.installPercentage))")
21-
.font(.system(size: 12))
22-
.foregroundColor(
23-
appState.installPercentage < 90 ? (colorScheme == .light ? .orangeLight : .orange)
24-
: appState.installPercentage < 60 ? (colorScheme == .light ? .redLight : .red)
25-
: .green)
26-
+ Text("%")
27-
.font(.system(size: 12))
28-
}
29-
HStack {
30-
Text("Pending: ")
31-
.bold()
32-
.font(.system(size: 12))
33-
+ Text("\(appState.pendingUpdatesCount)")
34-
}
16+
AnyView(
17+
ProgressView(
18+
value: appState.installPercentage,
19+
total: 100,
20+
label: {
21+
Text("\(String(format: "%.1f", appState.installPercentage))% Patched")
22+
.font(.system(size: 12))}
23+
)
24+
.tint(appState.installPercentage < 90 ? (colorScheme == .light ? .orangeLight : .orange)
25+
: appState.installPercentage < 60 ? (colorScheme == .light ? .redLight : .red)
26+
: .green)
27+
)
3528
}
3629
)
3730
.onAppear {

SupportCompanion/Views/CompactCards/CompactStorageCard.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ struct CompactStorageCard: View {
77

88
var body: some View {
99
VStack(alignment: .leading){
10-
CustomCardCompact(
10+
ScCardCompact(
1111
title: AppStateManager.shared.storageInfoManager.storageInfo.name,
1212
titleImageName: "internaldrive.fill",
1313
buttonImageName: "info.circle",
@@ -36,4 +36,4 @@ struct CompactStorageCard: View {
3636
appState.storageInfoManager.refresh()
3737
}
3838
}
39-
}
39+
}

SupportCompanion/Views/PopupModal.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ struct PopupModal: View {
2525
}
2626
.padding(.bottom)
2727

28-
CustomButton(Constants.General.close){
28+
ScButton(Constants.General.close){
2929
isShowing = false
3030
}
3131
}

0 commit comments

Comments
 (0)