Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,4 @@ fastlane/test_output
iOSInjectionProject/

.env
.DS_Store
6 changes: 3 additions & 3 deletions TimeMachineStatus/Components/CustomButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down
19 changes: 12 additions & 7 deletions TimeMachineStatus/Views/DestinationCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
// Copyright © 2023 Lukas Pistrol. All rights reserved.
//
// See LICENSE.md for license information.
//
//

import Sparkle
import SwiftUI

struct DestinationCell: View {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)"
)
)
}
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -247,8 +254,6 @@ struct DestinationCell: View {
}
}

import Sparkle

#Preview("Light") {
MenuView(
utility: TMUtilityMock(preferences: .mock),
Expand Down
28 changes: 20 additions & 8 deletions TimeMachineStatus/Views/MenuView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// Copyright © 2023 Lukas Pistrol. All rights reserved.
//
// See LICENSE.md for license information.
//
//

import Sparkle
import SwiftUI
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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")
Expand Down Expand Up @@ -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,
Expand Down