Watch: activity line on working cards, All threads browsing, a thread's subagents, Load earlier, and markdown messages
This commit is contained in:
1 parent
abd2fd0e13
commit
d916bfbab5
21 files changed
+928
-46
No files matched your search
@@ -11,20 +11,26 @@ enum Route: Hashable, Sendable {
|
||||
case status
|
||||
case host(id: String)
|
||||
case notifications
|
||||
/// All threads: every host, then one host's projects, then one project's threads.
|
||||
case allThreads
|
||||
case hostProjects(hostId: String)
|
||||
case projectThreads(hostId: String, projectId: String)
|
||||
|
||||
static let scheme = "wristcode"
|
||||
|
||||
/// `wristcode://thread/<hostId>/<threadId>`, `wristcode://new`, `wristcode://recent`, `wristcode://status`,
|
||||
/// `wristcode://host/<hostId>` or `wristcode://notifications`.
|
||||
/// `wristcode://host/<hostId>`, `wristcode://notifications`, `wristcode://threads`,
|
||||
/// `wristcode://projects/<hostId>` or `wristcode://project/<hostId>/<projectId>`.
|
||||
var url: URL {
|
||||
var components = URLComponents()
|
||||
components.scheme = Self.scheme
|
||||
func path(_ parts: String...) -> String {
|
||||
"/" + parts.map { $0.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? $0 }.joined(separator: "/")
|
||||
}
|
||||
switch self {
|
||||
case let .thread(hostId, threadId):
|
||||
components.host = "thread"
|
||||
components.percentEncodedPath = "/" + [hostId, threadId]
|
||||
.map { $0.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? $0 }
|
||||
.joined(separator: "/")
|
||||
components.percentEncodedPath = path(hostId, threadId)
|
||||
case .newThread:
|
||||
components.host = "new"
|
||||
case .recent:
|
||||
@@ -33,9 +39,17 @@ enum Route: Hashable, Sendable {
|
||||
components.host = "status"
|
||||
case let .host(id):
|
||||
components.host = "host"
|
||||
components.percentEncodedPath = "/" + (id.addingPercentEncoding(withAllowedCharacters: .alphanumerics) ?? id)
|
||||
components.percentEncodedPath = path(id)
|
||||
case .notifications:
|
||||
components.host = "notifications"
|
||||
case .allThreads:
|
||||
components.host = "threads"
|
||||
case let .hostProjects(hostId):
|
||||
components.host = "projects"
|
||||
components.percentEncodedPath = path(hostId)
|
||||
case let .projectThreads(hostId, projectId):
|
||||
components.host = "project"
|
||||
components.percentEncodedPath = path(hostId, projectId)
|
||||
}
|
||||
return components.url!
|
||||
}
|
||||
@@ -59,6 +73,12 @@ enum Route: Hashable, Sendable {
|
||||
self = .host(id: parts[0])
|
||||
case "notifications":
|
||||
self = .notifications
|
||||
case "threads":
|
||||
self = .allThreads
|
||||
case "projects" where parts.count == 1 && !parts[0].isEmpty:
|
||||
self = .hostProjects(hostId: parts[0])
|
||||
case "project" where parts.count == 2 && parts.allSatisfy { !$0.isEmpty }:
|
||||
self = .projectThreads(hostId: parts[0], projectId: parts[1])
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user