Skip to content

Commit

Permalink
Present the print dialog with the fetched label data
Browse files Browse the repository at this point in the history
  • Loading branch information
rachelmcr committed Nov 27, 2024
1 parent ffeec9c commit bb3e847
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ final class WooShippingPostPurchaseViewModel: ObservableObject {
func printLabel() async {
do {
let printData = try await requestPrintData()
// TODO: Present the print dialog
presentPrintDialog(with: printData)
} catch {
DDLogError("Error generating shipping label document for printing: \(error)")
}
Expand All @@ -77,4 +77,11 @@ private extension WooShippingPostPurchaseViewModel {
stores.dispatch(action)
}
}

/// Presents the print dialog with the provided print data.
func presentPrintDialog(with printData: ShippingLabelPrintData) {
let printController = UIPrintInteractionController()
printController.printingItem = printData.data
printController.present(animated: true)
}
}

0 comments on commit bb3e847

Please sign in to comment.