Skip to content

Commit

Permalink
Permalink for My and Following articles
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Aug 7, 2024
1 parent c1b00d0 commit e4ce37a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Planet/Views/Following/FollowingArticleItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,24 @@ struct FollowingArticleItemView: View {
} label: {
Text("Open in Browser")
}
if let planet = article.planet, let cid = planet.cid, cid.hasPrefix("bafy") {
Divider()
Button {
let permalink: String = "https://\(cid).eth.sucks\(article.link)"
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(permalink, forType: .string)
} label: {
Text("Copy Permalink")
}
Button {
let permalink: String = "https://\(cid).eth.sucks\(article.link)"
if let url = URL(string: permalink) {
NSWorkspace.shared.open(url)
}
} label: {
Text("Open Permalink in Browser")
}
}
}
}
.confirmationDialog(
Expand Down
18 changes: 18 additions & 0 deletions Planet/Views/My/MyArticleItemView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,24 @@ struct MyArticleItemView: View {
} label: {
Text("Open in Local Gateway")
}
if let planet = article.planet, let cid = planet.lastPublishedCID, cid.hasPrefix("bafy") {
Divider()
Button {
let permalink: String = "https://\(cid).eth.sucks\(article.link)"
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(permalink, forType: .string)
} label: {
Text("Copy Permalink")
}
Button {
let permalink: String = "https://\(cid).eth.sucks\(article.link)"
if let url = URL(string: permalink) {
NSWorkspace.shared.open(url)
}
} label: {
Text("Open Permalink in Browser")
}
}
}
}
.confirmationDialog(
Expand Down
2 changes: 1 addition & 1 deletion Planet/versioning.xcconfig
Original file line number Diff line number Diff line change
@@ -1 +1 @@
CURRENT_PROJECT_VERSION = 2183
CURRENT_PROJECT_VERSION = 2189

0 comments on commit e4ce37a

Please sign in to comment.