Let agents show and drive Page view tabs on the iPhone
This commit is contained in:
@@ -278,6 +278,17 @@ final class Pages {
|
||||
}
|
||||
return png
|
||||
}
|
||||
#else
|
||||
func capture(_ view: WKWebView) async throws -> Data {
|
||||
guard view.window != nil, !view.isHidden else {
|
||||
throw ApiError(status: 0, message: "the tab isn't on screen: the human has the page view closed or another tab showing")
|
||||
}
|
||||
let image = try await view.takeSnapshot(configuration: nil)
|
||||
guard let png = image.pngData() else {
|
||||
throw ApiError(status: 0, message: "couldn't encode the capture as PNG")
|
||||
}
|
||||
return png
|
||||
}
|
||||
#endif
|
||||
|
||||
func close() {
|
||||
|
||||
Reference in New Issue
Block a user