Skip to content
This repository was archived by the owner on Feb 24, 2025. It is now read-only.

Commit 2fd77ec

Browse files
Switch object identifiers to use tabModel.uid
1 parent 4313f26 commit 2fd77ec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

DuckDuckGo/AutomationServer.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,14 +187,14 @@ final class AutomationServer {
187187
self.respondError(on: connection, error: "no window")
188188
return
189189
}
190-
self.respond(on: connection, response: String(UInt(bitPattern: ObjectIdentifier(handle))))
190+
self.respond(on: connection, response: handle.tabModel.uid)
191191
}
192192

193193
@MainActor
194194
func getWindowHandles(on connection: NWConnection, url: URLComponents) {
195195
let handles = self.main.tabManager.model.tabs.map({ tab in
196196
let tabView = self.main.tabManager.controller(for: tab)!
197-
return String(UInt(bitPattern: ObjectIdentifier(tabView)))
197+
return tabView.tabModel.uid
198198
})
199199

200200
if let jsonData = try? JSONEncoder().encode(handles),
@@ -221,7 +221,7 @@ final class AutomationServer {
221221
guard let tabView = self.main.tabManager.controller(for: tab) else {
222222
return false
223223
}
224-
return String(UInt(bitPattern: ObjectIdentifier(tabView))) == handleString
224+
return tabView.tabModel.uid == handleString
225225
}) {
226226
Logger.automationServer.info("found tab \(tabIndex)")
227227
self.main.tabManager.select(tabAt: tabIndex)
@@ -243,7 +243,7 @@ final class AutomationServer {
243243
return
244244
}
245245
// Response {handle: "", type: "tab"}
246-
let response: [String: String] = ["handle": String(UInt(bitPattern: ObjectIdentifier(handle))), "type": "tab"]
246+
let response: [String: String] = ["handle": handle.tabModel.uid, "type": "tab"]
247247
if let jsonData = try? JSONEncoder().encode(response),
248248
let jsonString = String(data: jsonData, encoding: .utf8) {
249249
self.respond(on: connection, response: jsonString)

0 commit comments

Comments
 (0)