diff --git a/Samples/iOS-Swift/iOS-Swift-UITests/SessionReplayUITests.swift b/Samples/iOS-Swift/iOS-Swift-UITests/SessionReplayUITests.swift index d23c5aef64..0b87e48ccf 100644 --- a/Samples/iOS-Swift/iOS-Swift-UITests/SessionReplayUITests.swift +++ b/Samples/iOS-Swift/iOS-Swift-UITests/SessionReplayUITests.swift @@ -13,7 +13,7 @@ class SessionReplayUITests: BaseUITest { app.buttons["Extra"].tap() // -- Act -- - app.buttons["Show Camera UI"].tap() + app.buttons["show-camera-ui"].tap() // We need to verify the camera UI is shown by checking for the existence of a UI element. // This can be any element that is part of the camera UI and can be found reliably. diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index a71526f988..884e2330df 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -1204,16 +1204,31 @@ - + + + + + diff --git a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift index ff4234f2af..2272c306de 100644 --- a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift @@ -1,6 +1,7 @@ // swiftlint:disable file_length import AuthenticationServices import Foundation +import PhotosUI import SafariServices @_spi(Private) import Sentry import SentrySampleShared @@ -410,6 +411,16 @@ class ExtraViewController: UIViewController { imagePicker.cameraCaptureMode = .photo self.present(imagePicker, animated: true, completion: nil) } + + @IBAction func showGalleryUIAction(_ sender: Any) { + var config = PHPickerConfiguration(photoLibrary: .shared()) + config.selectionLimit = 1 + config.filter = .images + + let picker = PHPickerViewController(configuration: config) + picker.delegate = self + self.present(picker, animated: true, completion: nil) + } } extension ExtraViewController: ASWebAuthenticationPresentationContextProviding { @@ -420,4 +431,10 @@ extension ExtraViewController: ASWebAuthenticationPresentationContextProviding { return window } } + +extension ExtraViewController: PHPickerViewControllerDelegate { + func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { + picker.dismiss(animated: true) + } +} // swiftlint:enable file_length