diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj index 936fd40b..af675c89 100644 --- a/damus.xcodeproj/project.pbxproj +++ b/damus.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 0E8A4BB72AE4359200065E81 /* NostrFilter+Hashable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0E8A4BB62AE4359200065E81 /* NostrFilter+Hashable.swift */; }; 3165648B295B70D500C64604 /* LinkView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3165648A295B70D500C64604 /* LinkView.swift */; }; 3169CAE6294E69C000EE4006 /* EmptyTimelineView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */; }; 3169CAED294FCCFC00EE4006 /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3169CAEC294FCCFC00EE4006 /* Constants.swift */; }; @@ -481,6 +482,7 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ + 0E8A4BB62AE4359200065E81 /* NostrFilter+Hashable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NostrFilter+Hashable.swift"; sourceTree = ""; }; 3165648A295B70D500C64604 /* LinkView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkView.swift; sourceTree = ""; }; 3169CAE5294E69C000EE4006 /* EmptyTimelineView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmptyTimelineView.swift; sourceTree = ""; }; 3169CAEC294FCCFC00EE4006 /* Constants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Constants.swift; path = damus/Util/Constants.swift; sourceTree = SOURCE_ROOT; }; @@ -1295,6 +1297,7 @@ 4C363A9928283854006E126D /* Reply.swift */, 4C363A9B282838B9006E126D /* EventRef.swift */, 4C363AA328296DEE006E126D /* SearchModel.swift */, + 0E8A4BB62AE4359200065E81 /* NostrFilter+Hashable.swift */, 4C3AC79A28306D7B00E1F516 /* Contacts.swift */, 4C285C85283892E7008A31F1 /* CreateAccountModel.swift */, 4C63334F283D40E500B1C9C3 /* HomeModel.swift */, @@ -2574,6 +2577,7 @@ 4C4793062A993E5300489948 /* json_parser.c in Sources */, 4C4793052A993E3200489948 /* builder.c in Sources */, 4C4793042A993DC000489948 /* midl.c in Sources */, + 0E8A4BB72AE4359200065E81 /* NostrFilter+Hashable.swift in Sources */, 4C4793012A993CDA00489948 /* mdb.c in Sources */, 4CE9FBBA2A6B3C63007E485C /* nostrdb.c in Sources */, ADFE73552AD4793100EC7326 /* QRScanNSECView.swift in Sources */, diff --git a/damus/Models/NostrFilter+Hashable.swift b/damus/Models/NostrFilter+Hashable.swift new file mode 100644 index 00000000..6c6b8dbc --- /dev/null +++ b/damus/Models/NostrFilter+Hashable.swift @@ -0,0 +1,19 @@ +// +// NostrFilter+Hashable.swift +// damus +// +// Created by Davide De Rosa on 10/21/23. +// + +import Foundation + +// FIXME: fine-tune here what's involved in comparing search filters +extension NostrFilter: Hashable { + static func == (lhs: Self, rhs: Self) -> Bool { + lhs.hashtag == rhs.hashtag + } + + func hash(into hasher: inout Hasher) { + hasher.combine(hashtag) + } +} diff --git a/damus/Util/Router.swift b/damus/Util/Router.swift index 3017d11c..ac6731e7 100644 --- a/damus/Util/Router.swift +++ b/damus/Util/Router.swift @@ -188,8 +188,7 @@ enum Route: Hashable { hasher.combine(reactions.target) case .Search(let search): hasher.combine("search") - hasher.combine(search.sub_id) - hasher.combine(search.profiles_subid) + hasher.combine(search.search) case .EULA: hasher.combine("eula") case .Login: