Skip to content

Commit

Permalink
Move screenshots to the main thread (#161)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reflejo authored Dec 17, 2024
1 parent 0cc16f9 commit 591c334
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ apple_support_dependencies()

http_archive(
name = "build_bazel_rules_apple",
sha256 = "62847b3f444ce514ae386704a119ad7b29fa6dfb65a38bff4ae239f2389a0429",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.8.0/rules_apple.3.8.0.tar.gz",
sha256 = "352428421c89dba8859055c3e1ba42f742c224544bf0e196c926d1cf44a2d726",
url = "https://github.com/bazelbuild/rules_apple/releases/download/3.16.1/rules_apple.3.16.1.tar.gz",
)

http_archive(
Expand Down
17 changes: 8 additions & 9 deletions platform/swift/source/replay/SessionReplayTarget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,17 @@ extension SessionReplayTarget: CapturePassable.SessionReplayTarget {
return
}

let layer = window.layer
let format = UIGraphicsImageRendererFormat()
format.scale = 1.0

let start = Uptime()
let bounds = UIScreen.main.bounds.size
let jpeg = UIGraphicsImageRenderer(size: bounds, format: format)
.jpegData(withCompressionQuality: 0.1) { context in
window.layer.render(in: context.cgContext)
}

self.queue.async { [weak self] in
let start = Uptime()
let format = UIGraphicsImageRendererFormat()
format.scale = 1.0

let renderer = UIGraphicsImageRenderer(size: bounds, format: format)
let jpeg = renderer.jpegData(withCompressionQuality: 0.1) { context in
layer.render(in: context.cgContext)
}
self?.logger?.logSessionReplayScreenshot(
screen: SessionReplayCapture(data: jpeg),
duration: Uptime().timeIntervalSince(start)
Expand Down

0 comments on commit 591c334

Please sign in to comment.