diff --git a/.gitignore b/.gitignore index e8426f5..5a7d0c6 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,4 @@ fastlane/test_output iOSInjectionProject/ .env +.DS_Store \ No newline at end of file diff --git a/TimeMachineStatus/Components/CustomButtonStyle.swift b/TimeMachineStatus/Components/CustomButtonStyle.swift index 13f7c25..f49fbdc 100644 --- a/TimeMachineStatus/Components/CustomButtonStyle.swift +++ b/TimeMachineStatus/Components/CustomButtonStyle.swift @@ -24,12 +24,12 @@ struct CustomButtonStyle: ButtonStyle { private func foreground(_ configuration: Configuration) -> Color { if isEnabled { if configuration.isPressed { - Color.accentColor.opacity(0.5) + return .white.opacity(0.5) // Changed from accentColor } else { - Color.accentColor + return .white // Changed from accentColor } } else { - Color.secondary + return .secondary } } } diff --git a/TimeMachineStatus/Views/DestinationCell.swift b/TimeMachineStatus/Views/DestinationCell.swift index 2067880..9ff74d7 100644 --- a/TimeMachineStatus/Views/DestinationCell.swift +++ b/TimeMachineStatus/Views/DestinationCell.swift @@ -7,8 +7,9 @@ // Copyright © 2023 Lukas Pistrol. All rights reserved. // // See LICENSE.md for license information. -// +// +import Sparkle import SwiftUI struct DestinationCell: View { @@ -107,6 +108,12 @@ struct DestinationCell: View { .foregroundStyle(.secondary) } } + //added destinition url info and extracted hostname with regex + if dest.networkURL != nil { + if let match = dest.networkURL!.firstMatch(of: /@([^\/]+)\//) { + Text(match.output.1) + } + } if let bytesUsed = dest.bytesUsed, let bytesAvailable = dest.bytesAvailable { let used = bytesUsed.formatted(byteFormat) let available = bytesAvailable.formatted(byteFormat) @@ -146,8 +153,8 @@ struct DestinationCell: View { .focusable(false) .help( String( - localized: dest.destinationError?.localizedString ?? - "dest_label_last_backup_failed_\(dest.result ?? -1)" + localized: dest.destinationError?.localizedString + ?? "dest_label_last_backup_failed_\(dest.result ?? -1)" ) ) } @@ -162,7 +169,7 @@ struct DestinationCell: View { startStopBackup() } label: { if utility.status.activeDestinationID == dest.destinationID { - Image(systemSymbol: .stopFill) + Image(systemSymbol: .xmark) .resizable() .aspectRatio(contentMode: .fit) .frame(width: 13) @@ -234,7 +241,7 @@ struct DestinationCell: View { private var progressBackground: some View { GeometryReader { geometry in if let percent = utility.status.progessPercentage { - Color.accentColor + Color.white .frame(width: geometry.size.width * percent) .opacity(0.3) .animation(.easeInOut, value: percent) @@ -247,8 +254,6 @@ struct DestinationCell: View { } } -import Sparkle - #Preview("Light") { MenuView( utility: TMUtilityMock(preferences: .mock), diff --git a/TimeMachineStatus/Views/MenuView.swift b/TimeMachineStatus/Views/MenuView.swift index 743ba82..5017d7f 100644 --- a/TimeMachineStatus/Views/MenuView.swift +++ b/TimeMachineStatus/Views/MenuView.swift @@ -7,7 +7,7 @@ // Copyright © 2023 Lukas Pistrol. All rights reserved. // // See LICENSE.md for license information. -// +// import Sparkle import SwiftUI @@ -131,7 +131,8 @@ struct MenuView: View { utility.stopBackup() } } label: { - Label("button_startbackup", systemSymbol: utility.isIdle ? .playFill : .stopFill) + // 1. Changed .stopFill to .xmark + Label("button_startbackup", systemSymbol: utility.isIdle ? .playFill : .xmark) } .focusable(false) toolbarStatus @@ -155,14 +156,19 @@ struct MenuView: View { @ViewBuilder private var toolbarStatus: some View { if let activeUUID = utility.status.activeDestinationID, - let destination = utility.preferences?.destinations?.first(where: { $0.destinationID == activeUUID }) { + let destination = utility.preferences?.destinations?.first(where: { + $0.destinationID == activeUUID + }) + { let unknown = NSLocalizedString("dest_label_no_volume_name", comment: "") VStack(alignment: .leading, spacing: 0) { Text("label_currentbackup_\(destination.lastKnownVolumeName ?? unknown)") HStack(spacing: 0) { Text(utility.status.statusString) if let percentage = utility.status.progessPercentage { - Text(verbatim: " – " + percentage.formatted(.percent.precision(.fractionLength(0)))) + Text( + verbatim: " – " + + percentage.formatted(.percent.precision(.fractionLength(0)))) } } .font(.caption) @@ -180,10 +186,15 @@ struct MenuView: View { } } else { if let latestDate = utility.preferences?.latestBackupDate, - let latestVolume = utility.preferences?.latestBackupVolume { + let latestVolume = utility.preferences?.latestBackupVolume + { VStack(alignment: .leading, spacing: 0) { - Text("label_lastbackup_\(latestDate.formatted(.relativeDate))_on_\(latestVolume)") - if let interval = utility.preferences?.autoBackupInterval, utility.preferences?.autoBackup == true { + Text( + "label_lastbackup_\(latestDate.formatted(.relativeDate))_on_\(latestVolume)" + ) + if let interval = utility.preferences?.autoBackupInterval, + utility.preferences?.autoBackup == true + { let nextDate = latestDate.addingTimeInterval(.init(interval)) if nextDate < .now { Text("label_nextbackup_issue") @@ -300,7 +311,8 @@ struct MenuView: View { #Preview("Dark Finding Changes") { let preferences = Preferences.mock // swiftlint:disable:next force_unwrapping - let status = BackupState._State.Mock.findingChanges(preferences.destinations!.first!.destinationID) + let status = BackupState._State.Mock.findingChanges( + preferences.destinations!.first!.destinationID) MenuView( utility: TMUtilityMock( status: status,