Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
33 changes: 24 additions & 9 deletions Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -1204,16 +1204,31 @@
<segue destination="ehF-Y7-8St" kind="presentation" id="H7t-Et-KMM"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Dg-dP-BxN" userLabel="Show Camera UI">
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" translatesAutoresizingMaskIntoConstraints="NO" id="hXd-kh-5nx">
<rect key="frame" x="0.0" y="420" width="160" height="28"/>
<accessibility key="accessibilityConfiguration" identifier="show-camera-ui"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Show Camera UI"/>
<connections>
<action selector="showCameraUIAction:" destination="VqS-l1-kwe" eventType="touchUpInside" id="dyU-je-aIj"/>
</connections>
</button>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4Dg-dP-BxN" userLabel="Camera">
<rect key="frame" x="0.0" y="0.0" width="80" height="28"/>
<accessibility key="accessibilityConfiguration" identifier="show-camera-ui"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Camera"/>
<connections>
<action selector="showCameraUIAction:" destination="VqS-l1-kwe" eventType="touchUpInside" id="dyU-je-aIj"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="system" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="dIS-13-JMa" userLabel="Gallery">
<rect key="frame" x="80" y="0.0" width="80" height="28"/>
<accessibility key="accessibilityConfiguration" identifier="show-gallerya-ui"/>
<fontDescription key="fontDescription" type="system" pointSize="13"/>
<inset key="imageEdgeInsets" minX="0.0" minY="0.0" maxX="2.2250738585072014e-308" maxY="0.0"/>
<state key="normal" title="Gallery"/>
<connections>
<action selector="showGalleryUIAction:" destination="VqS-l1-kwe" eventType="touchUpInside" id="DPJ-Cg-5La"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillProportionally" translatesAutoresizingMaskIntoConstraints="NO" id="mOm-Ca-55v">
<rect key="frame" x="0.0" y="448" width="160" height="38"/>
<subviews>
Expand Down
17 changes: 17 additions & 0 deletions Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// swiftlint:disable file_length
import AuthenticationServices
import Foundation
import PhotosUI
import SafariServices
@_spi(Private) import Sentry
import SentrySampleShared
Expand Down Expand Up @@ -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 {
Expand All @@ -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
Loading