Skip to content

Commit

Permalink
Fix crash in detail items
Browse files Browse the repository at this point in the history
  • Loading branch information
NSAntoine committed Mar 2, 2024
1 parent bcd2f08 commit 3f25802
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Samra/Backend/DetailItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ struct DetailItemSection: Hashable {
DetailItem(primaryText: "UNIX Timestamp", secondaryText: assetStorage.storageTimestamp())
])

let coreUIVersionText: CustomStringConvertible = assetStorage.responds(to: #selector(CUICommonAssetStorage.coreuiVersion)) ? assetStorage.coreuiVersion() : "Unknown"
let coreUISection = DetailItemSection(sectionHeader: "Other", items: [
DetailItem(primaryText: "CoreUI Version", secondaryText: assetStorage.coreuiVersion()),
DetailItem(primaryText: "CoreUI Version", secondaryText: coreUIVersionText),
DetailItem(primaryText: "Schema Version", secondaryText: assetStorage.schemaVersion()),
DetailItem(primaryText: "UUID", secondaryText: assetStorage.uuid())
])

return [toolSection, argumentsSection, dateSection, coreUISection]
Expand Down
12 changes: 0 additions & 12 deletions Samra/Backend/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,6 @@ extension CGImage {
}
}

extension NSView {
func setHiddenWithAnimations(hidden: Bool) {
NSAnimationContext.runAnimationGroup { animationContext in
animationContext.duration = hidden ? 0.1 : 0.1
animator().alphaValue = 0
} completionHandler: {
self.isHidden = hidden
self.alphaValue = 1
}
}
}

extension NSAlert {
convenience init(title: String, message: String? = nil) {
self.init()
Expand Down
8 changes: 3 additions & 5 deletions Samra/UI/Diff/AssetCatalogDiffSelectionViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ class AssetCatalogDiffSelectionViewController: NSViewController {

@objc
func leftOrRightButtonClicked(sender: NSButton) {
// tag 1 = left
// tag 2 = right
URLHandler.shared.presentArchiveChooserPanel(senderView: nil) { [unowned self] url in
validateAndProcessURL(url, forSide: DiffSide(rawValue: sender.tag)!)
}
Expand All @@ -177,13 +175,13 @@ class AssetCatalogDiffSelectionViewController: NSViewController {
case .left:
leftCatalogInput = try AssetCatalogInput(fileURL: urlToChoose)
leftCatalogPathLabel.stringValue = urlToChoose.path
setImageViewForPreview(url: url, side: .left)
leftCatalogPreview.imageView.image = NSWorkspace.shared.icon(forFile: url.path)
case .right:
rightCatalogInput = try AssetCatalogInput(fileURL: urlToChoose)
rightCatalogPathLabel.stringValue = urlToChoose.path
setImageViewForPreview(url: url, side: .right)
rightCatalogPreview.imageView.image = NSWorkspace.shared.icon(forFile: url.path)
}

diffCatalogsButton.isEnabled = rightCatalogInput != nil && leftCatalogInput != nil
} catch {
NSAlert(title: "Unable to open Asset Catalog file \(urlToChoose.path)")
Expand Down

0 comments on commit 3f25802

Please sign in to comment.