Skip to content

Commit

Permalink
✨ Add safe area insets to screen capture metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
iujames authored and mmaatttt committed Apr 11, 2023
1 parent 8043934 commit 5791b74
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Sources/AppcuesKit/Data/Networking/Endpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ internal enum CustomerAPIEndpoint: Endpoint {
switch self {
case let .preSignedImageUpload(_, filename):
components.path = "/v1/accounts/\(config.accountID)/mobile/\(config.applicationID)/pre-upload-screenshot"
components.query = "?name=\(filename)"
components.query = "name=\(filename)"
case .screenCapture:
components.path = "/v1/accounts/\(config.accountID)/mobile/\(config.applicationID)/screens"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,29 @@ internal struct Capture: Identifiable {
let sdkName = "appcues-ios"
let osName = "ios"
let osVersion = UIDevice.current.systemVersion
let insets: Insets
}

struct Insets: Encodable {
let left: CGFloat
let right: CGFloat
let top: CGFloat
let bottom: CGFloat

init(_ insets: UIEdgeInsets) {
self.left = insets.left
self.right = insets.right
self.top = insets.top
self.bottom = insets.bottom
}
}

let id = UUID().appcuesFormatted
let appId: String
var displayName: String
var screenshotImageUrl: URL?
let layout: View
let metadata = Metadata()
let metadata: Metadata
let timestamp: Date

// The image data here is sent to a separate endpoint to upload the image, then
Expand Down
1 change: 1 addition & 0 deletions Sources/AppcuesKit/Presentation/Debugger/UIDebugger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ extension UIDebugger: DebugViewDelegate {
displayName: window.screenCaptureDisplayName(at: timestamp),
screenshotImageUrl: URL(string: "http://www.appcues.com/screenshot/\(UUID())"),
layout: layout,
metadata: Capture.Metadata(insets: Capture.Insets(window.safeAreaInsets)),
timestamp: timestamp,
screenshot: screenshot)

Expand Down

0 comments on commit 5791b74

Please sign in to comment.