Skip to content

Commit

Permalink
Prevent copied links from being clickable
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Jul 25, 2024
1 parent 75a69c0 commit d1cc258
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 19 deletions.
9 changes: 3 additions & 6 deletions Maccy/Views/FooterItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ struct FooterItemView: View {

var body: some View {
ConfirmationView(item: item) {
ListItemView(
id: item.id,
title: item.title,
shortcuts: item.shortcuts,
isSelected: item.isSelected
)
ListItemView(id: item.id, shortcuts: item.shortcuts, isSelected: item.isSelected) {
Text(LocalizedStringKey(item.title))
}
}
}
}
5 changes: 3 additions & 2 deletions Maccy/Views/HistoryItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@ struct HistoryItemView: View {
id: item.id,
image: item.thumbnailImage ?? ColorImage.from(item.title),
attributedTitle: item.attributedTitle,
title: item.title,
shortcuts: item.shortcuts,
isSelected: item.isSelected
)
) {
Text(verbatim: item.title)
}
.onTapGesture {
appState.history.select(item)
}
Expand Down
7 changes: 3 additions & 4 deletions Maccy/Views/ListItemTitleView.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import SwiftUI

struct ListItemTitleView: View {
struct ListItemTitleView<Title: View>: View {
var attributedTitle: AttributedString? = nil
var title: String
var isSelected: Bool
@ViewBuilder var title: () -> Title

var body: some View {
if let attributedTitle {
Expand All @@ -12,11 +12,10 @@ struct ListItemTitleView: View {
.truncationMode(.middle)
.padding(.leading, 10)
} else {
Text(LocalizedStringKey(title))
title()
.lineLimit(1)
.truncationMode(.middle)
.padding(.leading, 10)
.tint(isSelected ? .white : .primary)
}
}
}
10 changes: 3 additions & 7 deletions Maccy/Views/ListItemView.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import Defaults
import SwiftUI

struct ListItemView: View {
struct ListItemView<Title: View>: View {
var id: UUID
var image: NSImage? = nil
var attributedTitle: AttributedString? = nil
var title: String
var shortcuts: [KeyShortcut]
var isSelected: Bool
var help: LocalizedStringKey? = nil
@ViewBuilder var title: () -> Title

@Environment(AppState.self) private var appState
@Environment(ModifierFlags.self) private var modifierFlags
Expand All @@ -21,11 +21,7 @@ struct ListItemView: View {
.padding(.leading, 10)
.padding(.vertical, 5)
} else {
ListItemTitleView(
attributedTitle: attributedTitle,
title: title,
isSelected: isSelected
)
ListItemTitleView(attributedTitle: attributedTitle, isSelected: isSelected, title: title)
}
Spacer()
if !shortcuts.isEmpty {
Expand Down

0 comments on commit d1cc258

Please sign in to comment.