Skip to content

Commit

Permalink
minor UI adjustments, time machine settings properties are optional
Browse files Browse the repository at this point in the history
bump version
  • Loading branch information
lukepistrol committed Nov 15, 2023
1 parent 69ddd61 commit b904b31
Show file tree
Hide file tree
Showing 10 changed files with 275 additions and 90 deletions.
16 changes: 8 additions & 8 deletions TimeMachineStatus.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@
CODE_SIGN_ENTITLEMENTS = TimeMachineStatusHelper/TimeMachineStatusHelper.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -538,7 +538,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.0.5;
MARKETING_VERSION = 0.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.lukaspistrol.TimeMachineStatusHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand All @@ -554,7 +554,7 @@
CODE_SIGN_ENTITLEMENTS = TimeMachineStatusHelper/TimeMachineStatusHelper.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
GENERATE_INFOPLIST_FILE = YES;
Expand All @@ -567,7 +567,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.0.5;
MARKETING_VERSION = 0.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.lukaspistrol.TimeMachineStatusHelper;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -702,7 +702,7 @@
CODE_SIGN_ENTITLEMENTS = TimeMachineStatus/TimeMachineStatus.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_ASSET_PATHS = "\"TimeMachineStatus/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
Expand All @@ -719,7 +719,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.0.5;
MARKETING_VERSION = 0.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.lukaspistrol.TimeMachineStatus;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -736,7 +736,7 @@
CODE_SIGN_ENTITLEMENTS = TimeMachineStatus/TimeMachineStatus.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5;
CURRENT_PROJECT_VERSION = 6;
DEVELOPMENT_ASSET_PATHS = "\"TimeMachineStatus/Preview Content\"";
DEVELOPMENT_TEAM = "";
ENABLE_HARDENED_RUNTIME = NO;
Expand All @@ -753,7 +753,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 0.0.5;
MARKETING_VERSION = 0.0.6;
PRODUCT_BUNDLE_IDENTIFIER = com.lukaspistrol.TimeMachineStatus;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"images" : [
{
"filename" : "Icon-plain.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "original"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 89 additions & 0 deletions TimeMachineStatus/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,39 @@
}
}
},
"dest_label_no_size_info" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Keine Speicherplatz Informationen verfügbar"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "No storage info available"
}
}
}
},
"dest_label_no_volume_name" : {
"extractionState" : "manual",
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Unbekannt"
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Unknown"
}
}
}
},
"dest_label_progress_%lld_files_%@" : {
"extractionState" : "manual",
"localizations" : {
Expand Down Expand Up @@ -348,6 +381,46 @@
}
}
},
"dest_label_progress_found%lld" : {
"localizations" : {
"de" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld Änderung gefunden"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld Änderungen gefunden"
}
}
}
}
},
"en" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld change found"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld changes found"
}
}
}
}
}
}
},
"error_debug_description%@" : {
"localizations" : {
"de" : {
Expand Down Expand Up @@ -533,6 +606,22 @@
}
}
},
"label_currentbackup_%@" : {
"localizations" : {
"de" : {
"stringUnit" : {
"state" : "translated",
"value" : "Backup auf \"%@\" läuft..."
}
},
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "Backing up to \"%@\"..."
}
}
}
},
"label_lastbackup_%@_on_%@" : {
"extractionState" : "manual",
"localizations" : {
Expand Down
28 changes: 14 additions & 14 deletions TimeMachineStatus/Model/Preferences/Preferences.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ struct Preferences: Decodable {
case skipPaths = "SkipPaths"
}

let autoBackup: Bool
let autoBackup: Bool?
let autoBackupInterval: Int?
let excludedVolumeUUIDs: [UUID]?
let preferencesVersion: Int
let requiresACPower: Bool
let lastConfigurationTraceDate: Date
let requiresACPower: Bool?
let lastConfigurationTraceDate: Date?
let lastDestinationID: UUID?
let localizedDiskImageVolumeName: String
let localizedDiskImageVolumeName: String?
let skipPaths: [String]?
let destinations: [Destination]?

var latestBackupDate: Date? {
destinations?.map(\.snapshotDates).flatMap { $0 }.max()
destinations?.compactMap(\.snapshotDates).flatMap { $0 }.max()
}

var latestBackupVolume: String? {
Expand All @@ -64,16 +64,16 @@ struct Destination: Decodable {
case attemptDates = "AttemptDates"
}

let lastKnownVolumeName: String
let bytesUsed: Int
let bytesAvailable: Int
let filesystemTypeName: String
let lastKnownEncryptionState: String
let lastKnownVolumeName: String?
let bytesUsed: Int?
let bytesAvailable: Int?
let filesystemTypeName: String?
let lastKnownEncryptionState: String?
let quotaGB: Double?
let networkURL: String?
let destinationID: UUID
let consistencyScanDate: Date
let referenceLocalSnapshotDate: Date
let snapshotDates: [Date]
let attemptDates: [Date]
let consistencyScanDate: Date?
let referenceLocalSnapshotDate: Date?
let snapshotDates: [Date]?
let attemptDates: [Date]?
}
34 changes: 25 additions & 9 deletions TimeMachineStatus/Views/DestinationCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,13 @@ struct DestinationCell: View {
utility.status.activeDestinationID == dest.destinationID
}

private var findingChanges: BackupState.FindingChanges? {
if let findingChanges = utility.status as? BackupState.FindingChanges {
return findingChanges
}
return nil
}

private var copying: BackupState.Copying? {
if let copying = utility.status as? BackupState.Copying {
return copying
Expand Down Expand Up @@ -85,23 +92,28 @@ struct DestinationCell: View {
private var volumeInfo: some View {
VStack(alignment: .leading) {
HStack {
Text(dest.lastKnownVolumeName)
Text(dest.lastKnownVolumeName ?? "dest_label_no_volume_name")
.font(.headline)
if let latest = dest.snapshotDates.max() {
if let latest = dest.snapshotDates?.max() {
Text(latest.formatted(.relativeDate))
.font(.caption2)
.foregroundStyle(.secondary)
}
}
HStack {
let bytesUsed = dest.bytesUsed.formatted(byteFormat)
let bytesAvailable = dest.bytesAvailable.formatted(byteFormat)
Text("dest_label_\(bytesUsed)_used_\(bytesAvailable)_free")
if let bytesUsed = dest.bytesUsed, let bytesAvailable = dest.bytesAvailable {
let used = bytesUsed.formatted(byteFormat)
let available = bytesAvailable.formatted(byteFormat)
Text("dest_label_\(used)_used_\(available)_free")
.monospacedDigit()
.font(.caption2)
.foregroundStyle(.secondary)
} else {
Text("dest_label_no_size_info")
.font(.caption2)
.foregroundStyle(.secondary)
}
.font(.caption2)
.foregroundStyle(.secondary)
}
.lineLimit(1)
}

@ViewBuilder
Expand Down Expand Up @@ -130,9 +142,10 @@ struct DestinationCell: View {

@ViewBuilder
private var contextMenuActions: some View {
let unknown = NSLocalizedString("dest_label_no_volume_name", comment: "")
Button("button_show_info") { showInfo.toggle() }
Divider()
Button("button_backup_to_\(dest.lastKnownVolumeName)_now") {
Button("button_backup_to_\(dest.lastKnownVolumeName ?? unknown)_now") {
utility.startBackup(id: dest.destinationID)
}
}
Expand All @@ -145,6 +158,9 @@ struct DestinationCell: View {
Text(state.statusString)
}
Spacer()
if let findingChanges {
Text("dest_label_progress_found\(findingChanges.itemsFound)")
}
if let copying {
if let bytes = copying.progress.bytes, let files = copying.progress.files {
Text("dest_label_progress_\(files)_files_\(bytes.formatted(byteFormat))")
Expand Down
24 changes: 17 additions & 7 deletions TimeMachineStatus/Views/DestinationInfoView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,25 +16,35 @@ struct DestinationInfoView: View {
var body: some View {
Form {
Section {
LabeledContent("dest_info_name", value: dest.lastKnownVolumeName)
LabeledContent("dest_info_encrypted", value: dest.lastKnownEncryptionState)
if let lastKnownVolumeName = dest.lastKnownVolumeName {
LabeledContent("dest_info_name", value: lastKnownVolumeName)
}
if let lastKnownEncryptionState = dest.lastKnownEncryptionState {
LabeledContent("dest_info_encrypted", value: lastKnownEncryptionState)
}
if let networkURL = dest.networkURL {
LabeledContent("dest_info_url", value: networkURL)
}
}
Section {
LabeledContent("dest_info_filesystem", value: dest.filesystemTypeName)
LabeledContent("dest_info_usedspace", value: dest.bytesUsed.formatted(.byteCount(style: .file)))
LabeledContent("dest_info_freespace", value: dest.bytesAvailable.formatted(.byteCount(style: .file)))
if let filesystemTypeName = dest.filesystemTypeName {
LabeledContent("dest_info_filesystem", value: filesystemTypeName)
}
if let bytesUsed = dest.bytesUsed {
LabeledContent("dest_info_usedspace", value: bytesUsed.formatted(.byteCount(style: .file)))
}
if let bytesAvailable = dest.bytesAvailable {
LabeledContent("dest_info_freespace", value: bytesAvailable.formatted(.byteCount(style: .file)))
}
if let quotaGB = dest.quotaGB {
LabeledContent("dest_info_quota", value: Int(quotaGB * 1e9).formatted(.byteCount(style: .file)))
}
}
Section {
if let last = dest.snapshotDates.max() {
if let last = dest.snapshotDates?.max() {
LabeledContent("dest_info_lastbackup", value: last.formatted(.relativeDate))
}
if let last = dest.attemptDates.max() {
if let last = dest.attemptDates?.max() {
LabeledContent("dest_info_lastattempt", value: last.formatted(.relativeDate))
}
}
Expand Down
Loading

0 comments on commit b904b31

Please sign in to comment.