Skip to content

Commit

Permalink
Removed unused problematic code
Browse files Browse the repository at this point in the history
  • Loading branch information
livid committed Aug 9, 2024
1 parent 616ed72 commit d849083
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 46 deletions.
5 changes: 4 additions & 1 deletion Planet/Entities/MyPlanetModel+Aggregate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,11 @@ extension MyPlanetModel {
Task(priority: .utility) {
try existingArticle.savePublic()
}
DispatchQueue.main.async {
DispatchQueue.main.asyncAfter(deadline: .now() + 2) {
PlanetStore.shared.refreshSelectedArticles()
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
NotificationCenter.default.post(name: .loadArticle, object: nil)
}
}
}
}
Expand Down
7 changes: 1 addition & 6 deletions Planet/Entities/MyPlanetModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1402,15 +1402,12 @@ class MyPlanetModel: Equatable, Hashable, Identifiable, ObservableObject, Codabl
tags: tags
)
let environment = Environment(extensions: [StencilExtension.common])
let domain_prefix: String
let root_prefix: String
if let domainWithGateway = domainWithGateway {
domain_prefix = "https://" + domainWithGateway
root_prefix = "https://" + domainWithGateway
}
else {
domain_prefix = IPFSDaemon.preferredGateway()
root_prefix = IPFSDaemon.preferredGateway() + "/ipns/" + ipns
root_prefix = "https://eth.sucks/ipns/" + ipns
}
var hasDomain: Bool = false
if let planetDomain = domain, planetDomain.count > 0, !planetDomain.contains(":") {
Expand All @@ -1420,9 +1417,7 @@ class MyPlanetModel: Equatable, Hashable, Identifiable, ObservableObject, Codabl
"planet": publicPlanet,
"has_domain": hasDomain,
"domain": domainWithGateway ?? "",
"domain_prefix": domain_prefix,
"root_prefix": root_prefix,
"ipfs_gateway": IPFSDaemon.preferredGateway(),
"podcast": podcastOnly,
"has_podcast_cover_art": FileManager.default.fileExists(
atPath: publicPodcastCoverArtPath.path
Expand Down
2 changes: 1 addition & 1 deletion Planet/Helper/KeyboardShortcutHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class KeyboardShortcutHelper: ObservableObject {
Button {
if let url = URL(
string:
"\(IPFSDaemon.preferredGateway())/ipns/\(publishedLink)"
"https://eth.sucks/ipns/\(publishedLink)"
) {
self.openURL(url)
}
Expand Down
9 changes: 0 additions & 9 deletions Planet/IPFS/IPFSDaemon.swift
Original file line number Diff line number Diff line change
Expand Up @@ -754,20 +754,11 @@ extension IPFSDaemon {
] // Filebase
])

static func preferredGateway() -> String {
let index: Int = UserDefaults.standard.integer(forKey: String.settingsPublicGatewayIndex)
return IPFSGateway.publicGateways[index]
}

static func urlForCID(_ cid: String) -> URL? {
// let gateway = IPFSDaemon.preferredGateway()
// return URL(string: gateway + "/ipfs/" + cid)
return URL(string: "https://\(cid).ipfs2.eth.limo/")
}

static func urlForIPNS(_ ipns: String) -> URL? {
// let gateway = IPFSDaemon.preferredGateway()
// return URL(string: gateway + "/ipns/" + ipns)
return URL(string: "https://\(ipns).ipfs2.eth.limo/")
}

Expand Down
7 changes: 0 additions & 7 deletions Planet/IPFS/IPFSGateway.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,4 @@ enum IPFSGateway: String, Codable, CaseIterable {
let gateway = UserDefaults.standard.string(forKey: String.settingsPreferredIPFSPublicGateway)
return IPFSGateway(rawValue: gateway ?? IPFSGateway.defaultGateway.rawValue) ?? IPFSGateway.defaultGateway
}

static let publicGateways: [String] = [
"https://ipfs.io",
"https://dweb.link",
"https://gateway.pinata.cloud",
"https://ipfs.fleek.co"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ extension PFDashboardWindowController: NSToolbarDelegate {
if let selectedID = serviceStore.selectedFolderID, let folder = serviceStore.publishedFolders.first(where: { $0.id == selectedID }) {
let menu = NSMenu()
if let _ = folder.published, let publishedLink = folder.publishedLink {
if let gatewayURL = URL(string: "\(IPFSDaemon.preferredGateway())/ipns/\(publishedLink)") {
if let gatewayURL = URL(string: "https://eth.sucks/ipns/\(publishedLink)") {
let publicGatewayActionItem = NSMenuItem()
publicGatewayActionItem.representedObject = gatewayURL
publicGatewayActionItem.title = "Open in Public Gateway"
Expand Down Expand Up @@ -432,7 +432,7 @@ extension PFDashboardWindowController: NSToolbarDelegate {
extension PFDashboardWindowController: NSSharingServicePickerToolbarItemDelegate {
func items(for pickerToolbarItem: NSSharingServicePickerToolbarItem) -> [Any] {
let serviceStore = PlanetPublishedServiceStore.shared
guard let selectedID = serviceStore.selectedFolderID, let folder = serviceStore.publishedFolders.first(where: { $0.id == selectedID }), let _ = folder.published, let publishedLink = folder.publishedLink, let url = URL(string: "\(IPFSDaemon.preferredGateway())/ipns/\(publishedLink)") else { return [] }
guard let selectedID = serviceStore.selectedFolderID, let folder = serviceStore.publishedFolders.first(where: { $0.id == selectedID }), let _ = folder.published, let publishedLink = folder.publishedLink, let url = URL(string: "https://eth.sucks/ipns/\(publishedLink)") else { return [] }
let sharableItems = [url]
return sharableItems
}
Expand Down
19 changes: 0 additions & 19 deletions Planet/Settings/PlanetSettingsGeneralView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,25 +84,6 @@ struct PlanetSettingsGeneralView: View {
.padding(.top, -10)
}

// Obsoleted by ipfs2.eth.limo
/*
HStack(spacing: 4) {
Text("Public Gateway")
.frame(width: CAPTION_WIDTH, alignment: .trailing)
Picker(selection: $publicGatewayIndex, label: Text("")) {
ForEach(0..<IPFSDaemon.publicGateways.count, id: \.self) { index in
Text(IPFSDaemon.publicGateways[index])
.tag(index)
}
}
.pickerStyle(.menu)
.onChange(of: publicGatewayIndex) { newValue in
// Refresh Published Folders Dashboard Toolbar
NotificationCenter.default.post(name: .dashboardRefreshToolbar, object: nil)
}
}
*/

HStack(spacing: 4) {
Text("IPFS Public Gateway")
.frame(width: PlanetUI.SETTINGS_CAPTION_WIDTH, alignment: .trailing)
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 = 2191
CURRENT_PROJECT_VERSION = 2192

0 comments on commit d849083

Please sign in to comment.