Repository navigation
recording: improvements to screenshot masking - #147
Conversation
| if let webView = view as? WKWebView { | ||
| // since we cannot the webview content, if masking texts or images are enabled | ||
| // we mask the whole webview as well | ||
| if isAnyInputSensitive(webView) { | ||
| maskableWidgets.append(view.toAbsoluteRect(parent)) | ||
| return | ||
| } | ||
| } | ||
|
|
||
| if let button = view as? UIButton { | ||
| if isButtonSensitive(button) { | ||
| maskableWidgets.append(view.toAbsoluteRect(parent)) | ||
| return | ||
| } | ||
| } | ||
|
|
||
| if let theSwitch = view as? UISwitch { | ||
| if isSwitchSensitive(theSwitch) { | ||
| maskableWidgets.append(view.toAbsoluteRect(parent)) | ||
| return | ||
| } | ||
| } | ||
|
|
||
| if let picker = view as? UIPickerView { |
There was a problem hiding this comment.
Added a few missing items that are placeholders for wireframes but not for screenshots and can be sensitive
| private func hasText(_ text: String?) -> Bool { | ||
| if let text = text, !text.isEmpty { | ||
| return true | ||
| } else { | ||
| // if there's no text, there's nothing to mask | ||
| return false | ||
| } | ||
| } | ||
|
|
||
| private func isImageViewSensitive(_ view: UIImageView) -> Bool { | ||
| var isAsset = false | ||
| if let image = view.image { | ||
| isAsset = isAssetsImage(image) | ||
| } else { | ||
| // if there's no image, there's nothing to mask | ||
| return false |
There was a problem hiding this comment.
Even if masking is enabled, only mask if there's actually any content (text|image)
daibhin
left a comment
There was a problem hiding this comment.
Random thought: I don't recall seeing any exit early conditions. I know rrweb will not check child nodes if a parent has been masked which could help some of the extra processing time here
|
💡 Motivation and Context
💚 How did you test it?
📝 Checklist