This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0. | |
| * This product includes software developed at Datadog (https://www.datadoghq.com/). | |
| * Copyright 2019-2020 Datadog, Inc. | |
| */ | |
| import Foundation | |
| public extension URLSession { | |
| internal typealias RequestInterceptor = HookedSession.RequestInterceptor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func getBrightnessValue(from sampleBuffer: CMSampleBuffer) -> Float { | |
| guard | |
| let metadataDict = CMCopyDictionaryOfAttachments(nil, sampleBuffer, kCMAttachmentMode_ShouldPropagate) as? [String: Any], | |
| let exifMetadata = metadataDict[String(kCGImagePropertyExifDictionary)] as? [String: Any], | |
| let brightnessValue = exifMetadata[String(kCGImagePropertyExifBrightnessValue)] as? Float | |
| else { return 0.0 } | |
| return brightnessValue | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Since the WKWebView has no sizeToFit() method, increase the frame height of the webView to | |
| // match the height of the content's scrollHeight | |
| // | |
| // The WKWebView's `navigationDelegate` property needs to be set for the delegate method to be called | |
| func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { | |
| if webView.isLoading == false { | |
| webView.evaluateJavaScript("document.body.scrollHeight", completionHandler: { [weak self] (result, error) in | |
| if let height = result as? CGFloat { |
OlderNewer