diff --git a/Samples/SentrySampleShared/SentrySampleShared.xcconfig b/Samples/SentrySampleShared/SentrySampleShared.xcconfig index fdc3071a28a..8ae81dfd2c1 100644 --- a/Samples/SentrySampleShared/SentrySampleShared.xcconfig +++ b/Samples/SentrySampleShared/SentrySampleShared.xcconfig @@ -30,3 +30,5 @@ CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=macosx*] = PROVISIONING_PROFILE_SPECIFIER = DEVELOPMENT_TEAM = + +TARGETED_DEVICE_FAMILY = 1,2,3,4,7 diff --git a/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift b/Samples/SentrySampleShared/SentrySampleShared/DSNDisplayViewController.swift similarity index 95% rename from Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift rename to Samples/SentrySampleShared/SentrySampleShared/DSNDisplayViewController.swift index 6e6a6f09601..bc954c5db02 100644 --- a/Samples/iOS-Swift/iOS-Swift/Tools/DSNDisplayViewController.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/DSNDisplayViewController.swift @@ -1,15 +1,10 @@ -import SentrySampleShared +#if !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) + +import Sentry import UIKit let fontSize: CGFloat = 12 -func addDSNDisplay(_ vc: UIViewController, vcview: UIView) { - let dsnVC = DSNDisplayViewController(nibName: nil, bundle: nil) - vcview.addSubview(dsnVC.view) - dsnVC.view.matchEdgeAnchors(from: vcview) - vc.addChild(dsnVC) -} - class DSNDisplayViewController: UIViewController { let dispatchQueue = DispatchQueue(label: "io.sentry.iOS-Swift.queue.dsn-management", attributes: .concurrent) let label = UILabel(frame: .zero) @@ -48,7 +43,7 @@ class DSNDisplayViewController: UIViewController { ]) view.addSubview(stack) - stack.matchEdgeAnchors(from: view, leadingPad: 20) + stack.matchEdgeAnchors(from: view) buttonStack.translatesAutoresizingMaskIntoConstraints = false buttonStack.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 0.3).isActive = true } @@ -172,3 +167,5 @@ class DSNDisplayViewController: UIViewController { return attributedString } } + +#endif // !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) diff --git a/Samples/SentrySampleShared/SentrySampleShared/EnvironmentVariableTableViewCell.swift b/Samples/SentrySampleShared/SentrySampleShared/EnvironmentVariableTableViewCell.swift index 120443ad4bc..c908a5f3c50 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/EnvironmentVariableTableViewCell.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/EnvironmentVariableTableViewCell.swift @@ -18,7 +18,7 @@ class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { let stack = UIStackView(arrangedSubviews: [valueField, titleLabel]) stack.spacing = 8 contentView.addSubview(stack) - stack.matchEdgeAnchors(from: contentView, topPad: 8, bottomPad: 8) + stack.matchEdgeAnchors(from: contentView) valueField.borderStyle = .roundedRect } @@ -50,6 +50,7 @@ class EnvironmentVariableTableViewCell: UITableViewCell, UITextFieldDelegate { } else { override?.stringValue = textField.text } + SentrySDKWrapper.shared.startSentry() } } #endif // !os(macOS) && !os(tvOS) && !os(watchOS) diff --git a/Samples/SentrySampleShared/SentrySampleShared/FeaturesViewController.swift b/Samples/SentrySampleShared/SentrySampleShared/FeaturesViewController.swift index d35ac05fd7e..809637a04d7 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/FeaturesViewController.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/FeaturesViewController.swift @@ -1,15 +1,29 @@ -#if !os(macOS) && !os(tvOS) && !os(watchOS) +#if !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) import UIKit -public class FeaturesViewController: UITableViewController { - public override func viewDidLoad() { - super.viewDidLoad() +public class FeaturesViewController: UIViewController { + let tableView = UITableView(frame: .zero, style: .plain) + + public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) { + super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil) + tableView.register(LaunchArgumentTableViewCell.self, forCellReuseIdentifier: "launchArgumentCell") tableView.register(EnvironmentVariableTableViewCell.self, forCellReuseIdentifier: "environmentVariableCell") - tableView.tableHeaderView = tableHeader + tableView.dataSource = self + + let stack = UIStackView(arrangedSubviews: [headerView, tableView]) + stack.axis = .vertical + view.addSubview(stack) + stack.matchEdgeAnchors(from: view, safeArea: true) + + view.backgroundColor = .white } - var tableHeader: UIView { + required init?(coder: NSCoder) { + fatalError("init(coder:) not supported") + } + + var headerView: UIView { let resetButton = UIButton(type: .custom) resetButton.setTitle("Reset Defaults", for: .normal) resetButton.setTitleColor(.blue, for: .normal) @@ -18,28 +32,29 @@ public class FeaturesViewController: UITableViewController { let label = UILabel(frame: .zero) label.text = SentrySDKOverrides.schemaPrecedenceForEnvironmentVariables ? "Schema Precedence" : "Defaults Precedence" - let stack = UIStackView(arrangedSubviews: [label, resetButton]) - stack.spacing = 8 + let hstack = UIStackView(arrangedSubviews: [label, resetButton]) + hstack.spacing = 8 - let header = UIView(frame: .zero) - header.addSubview(stack) + let dsnVC = DSNDisplayViewController(nibName: nil, bundle: nil) + addChild(dsnVC) - stack.matchEdgeAnchors(from: header) - header.heightAnchor.constraint(equalToConstant: 50).isActive = true - - return header + let vStack = UIStackView(arrangedSubviews: [dsnVC.view, hstack]) + vStack.axis = .vertical + return vStack } @objc func resetDefaults() { SentrySDKOverrides.resetDefaults() tableView.reloadData() } +} - public override func numberOfSections(in tableView: UITableView) -> Int { +extension FeaturesViewController: UITableViewDataSource { + public func numberOfSections(in tableView: UITableView) -> Int { 6 } - public override func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + public func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { if section == 0 { return "Special" } else if section == 1 { @@ -56,7 +71,7 @@ public class FeaturesViewController: UITableViewController { return nil } - public override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + public func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { if section == 0 { return SentrySDKOverrides.Special.allCases.count } else if section == 1 { @@ -73,7 +88,7 @@ public class FeaturesViewController: UITableViewController { return 0 } - public override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + public func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { if indexPath.section == 2 { if SentrySDKOverrides.Tracing.boolValues.contains(SentrySDKOverrides.Tracing.allCases[indexPath.row]) { let cell = tableView.dequeueReusableCell(withIdentifier: "launchArgumentCell", for: indexPath) as! LaunchArgumentTableViewCell @@ -117,4 +132,4 @@ public class FeaturesViewController: UITableViewController { return cell } } -#endif // !os(macOS) && !os(tvOS) && !os(watchOS) +#endif // !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) diff --git a/Samples/SentrySampleShared/SentrySampleShared/LaunchArgumentTableViewCell.swift b/Samples/SentrySampleShared/SentrySampleShared/LaunchArgumentTableViewCell.swift index 8264fc2a236..26df23cfdab 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/LaunchArgumentTableViewCell.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/LaunchArgumentTableViewCell.swift @@ -12,6 +12,7 @@ class LaunchArgumentTableViewCell: UITableViewCell { @objc func toggleFlag() { override?.boolValue = flagSwitch.isOn + SentrySDKWrapper.shared.startSentry() } override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { @@ -19,7 +20,7 @@ class LaunchArgumentTableViewCell: UITableViewCell { let stack = UIStackView(arrangedSubviews: [flagSwitch, titleLabel]) stack.spacing = 8 contentView.addSubview(stack) - stack.matchEdgeAnchors(from: contentView, topPad: 8, bottomPad: 8) + stack.matchEdgeAnchors(from: contentView) } required init?(coder: NSCoder) { diff --git a/Samples/SentrySampleShared/SentrySampleShared/SampleAppDebugMenu.swift b/Samples/SentrySampleShared/SentrySampleShared/SampleAppDebugMenu.swift new file mode 100644 index 00000000000..be7d98302b2 --- /dev/null +++ b/Samples/SentrySampleShared/SentrySampleShared/SampleAppDebugMenu.swift @@ -0,0 +1,92 @@ +#if !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) +import UIKit + +public class SampleAppDebugMenu: NSObject { + public static let shared = SampleAppDebugMenu() + + static var displayingForm = false + + let window = { + if #available(iOS 13.0, *) { + if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene { + return Window(windowScene: scene) + } + } + return Window() + }() + + lazy var rootVC = { + let uivc = UIViewController(nibName: nil, bundle: nil) + uivc.view.addSubview(button) + + button.translatesAutoresizingMaskIntoConstraints = false + NSLayoutConstraint.activate([ + button.leadingAnchor.constraint(equalTo: uivc.view.safeAreaLayoutGuide.leadingAnchor, constant: 25), + button.bottomAnchor.constraint(equalTo: uivc.view.safeAreaLayoutGuide.bottomAnchor, constant: -75) + ]) + + return uivc + }() + + lazy var button = { + let button = UIButton(type: .custom) + button.addTarget(self, action: #selector(displayDebugMenu), for: .touchUpInside) + button.setTitle("SDK Debug", for: .normal) + button.setTitleColor(.blue, for: .normal) + return button + }() + + @objc public func display() { + window.rootViewController = rootVC + window.isHidden = false + } + + @objc func displayDebugMenu() { + SampleAppDebugMenu.displayingForm = true + rootVC.present(FeaturesViewController(nibName: nil, bundle: nil), animated: true) + } + + class Window: UIWindow { + + @available(iOS 13.0, *) + override init(windowScene: UIWindowScene) { + super.init(windowScene: windowScene) + commonInit() + } + + init() { + super.init(frame: UIScreen.main.bounds) + commonInit() + } + + func commonInit() { + windowLevel = UIWindow.Level.alert + 1 + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { + guard !SampleAppDebugMenu.displayingForm else { + return super.hitTest(point, with: event) + } + + guard let result = super.hitTest(point, with: event) else { + return nil + } + guard result.isKind(of: UIButton.self) else { + return nil + } + return result + } + } +} + +extension SampleAppDebugMenu: UIAdaptivePresentationControllerDelegate { + public func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { + rootVC.dismiss(animated: true) + SampleAppDebugMenu.displayingForm = false + } +} +#endif // !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) diff --git a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift index 5083db6b464..a615ce16bdf 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKOverrides.swift @@ -33,6 +33,7 @@ public enum SentrySDKOverrides { public enum Special: String, SentrySDKOverride { case wipeDataOnLaunch = "--io.sentry.wipe-data" case disableEverything = "--io.sentry.disable-everything" + case skipSDKInit = "--skip-sentry-init" public var boolValue: Bool { get { diff --git a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift index 7290d6d26c3..9921a12374c 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/SentrySDKWrapper.swift @@ -21,7 +21,14 @@ public struct SentrySDKWrapper { #endif // !os(macOS) && !os(tvOS) && !os(watchOS) public func startSentry() { - SentrySDK.start(configureOptions: configureSentryOptions(options:)) + if SentrySDK.isEnabled { + print("SentrySDK already enabled, closing it") + SentrySDK.close() + } + + if !SentrySDKOverrides.Special.skipSDKInit.boolValue { + SentrySDK.start(configureOptions: configureSentryOptions(options:)) + } } func configureSentryOptions(options: Options) { @@ -382,15 +389,11 @@ extension SentrySDKWrapper { public static let defaultDSN = "https://6cc9bae94def43cab8444a99e0031c28@o447951.ingest.sentry.io/5428557" var args: [String] { - let args = ProcessInfo.processInfo.arguments - print("[iOS-Swift] [debug] launch arguments: \(args)") - return args + return ProcessInfo.processInfo.arguments } var env: [String: String] { - let env = ProcessInfo.processInfo.environment - print("[iOS-Swift] [debug] environment: \(env)") - return env + return ProcessInfo.processInfo.environment } /// For testing purposes, we want to be able to change the DSN and store it to disk. In a real app, you shouldn't need this behavior. diff --git a/Samples/iOS-Swift/iOS-Swift/Tools/Toasts.swift b/Samples/SentrySampleShared/SentrySampleShared/Toasts.swift similarity index 88% rename from Samples/iOS-Swift/iOS-Swift/Tools/Toasts.swift rename to Samples/SentrySampleShared/SentrySampleShared/Toasts.swift index d642596b582..4270d3e87c4 100644 --- a/Samples/iOS-Swift/iOS-Swift/Tools/Toasts.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/Toasts.swift @@ -1,3 +1,5 @@ +#if !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) + import UIKit public enum ToastType { @@ -40,3 +42,5 @@ public func showToast(in vc: UIViewController, type: ToastType, message: String) } } } + +#endif // !os(macOS) && !os(tvOS) && !os(watchOS) && !os(visionOS) diff --git a/Samples/SentrySampleShared/SentrySampleShared/UIViewExtension.swift b/Samples/SentrySampleShared/SentrySampleShared/UIViewExtension.swift index afbbf3376ae..68c7db95d3a 100644 --- a/Samples/SentrySampleShared/SentrySampleShared/UIViewExtension.swift +++ b/Samples/SentrySampleShared/SentrySampleShared/UIViewExtension.swift @@ -11,14 +11,15 @@ public extension UIView { return self } - func matchEdgeAnchors(from other: UIView, leadingPad: CGFloat = 0, trailingPad: CGFloat = 0, topPad: CGFloat = 0, bottomPad: CGFloat = 0) { + func matchEdgeAnchors(from other: UIView, leadingPad: CGFloat = 0, trailingPad: CGFloat = 0, topPad: CGFloat = 0, bottomPad: CGFloat = 0, safeArea: Bool = false) { self.translatesAutoresizingMaskIntoConstraints = false other.translatesAutoresizingMaskIntoConstraints = false + let layoutGuide = safeArea ? other.safeAreaLayoutGuide : other.layoutMarginsGuide NSLayoutConstraint.activate([ - leadingAnchor.constraint(equalTo: other.leadingAnchor, constant: leadingPad), - trailingAnchor.constraint(equalTo: other.trailingAnchor, constant: -trailingPad), - topAnchor.constraint(equalTo: other.topAnchor, constant: topPad), - bottomAnchor.constraint(equalTo: other.bottomAnchor, constant: -bottomPad) + leadingAnchor.constraint(equalTo: layoutGuide.leadingAnchor, constant: leadingPad), + trailingAnchor.constraint(equalTo: layoutGuide.trailingAnchor, constant: -trailingPad), + topAnchor.constraint(equalTo: layoutGuide.topAnchor, constant: topPad), + bottomAnchor.constraint(equalTo: layoutGuide.bottomAnchor, constant: -bottomPad) ]) } } diff --git a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml index 29e20781e99..44bb23891dc 100644 --- a/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml +++ b/Samples/SessionReplay-CameraTest/SessionReplay-CameraTest.yml @@ -1,4 +1,6 @@ name: SessionReplay-CameraTest +include: + - ../Shared/feature-flags.yml createIntermediateGroups: true generateEmptyDirectories: true projectReferences: @@ -32,3 +34,10 @@ targets: - script: ../Shared/reset-git-info.sh name: Reset Git Fields in Info.plist basedOnDependencyAnalysis: false +schemes: + SessionReplay-CameraTest: + templates: + - SampleAppScheme + build: + targets: + SessionReplay-CameraTest: all diff --git a/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift b/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift index 62a70501305..7a7ff297cd5 100644 --- a/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift +++ b/Samples/SessionReplay-CameraTest/Sources/AppDelegate.swift @@ -4,29 +4,10 @@ import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { - - static var isSentryEnabled = true - static var isSessionReplayEnabled = true - static var isViewRendererV2Enabled = true - func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - AppDelegate.reloadSentrySDK() - - return true - } - - static func reloadSentrySDK() { - if SentrySDK.isEnabled { - print("SentrySDK already started, closing it") - SentrySDK.close() - } - - if !isSentryEnabled { - print("SentrySDK disabled") - return - } - SentrySDKWrapper.shared.startSentry() + SampleAppDebugMenu.shared.display() + return true } // MARK: UISceneSession Lifecycle diff --git a/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard b/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard index 055522d904b..8f49a1813ce 100644 --- a/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard +++ b/Samples/SessionReplay-CameraTest/Sources/Base.lproj/Main.storyboard @@ -1,8 +1,9 @@ - + - + + @@ -17,96 +18,40 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + - - + + + - + + - - - - + @@ -115,9 +60,6 @@ - - - diff --git a/Samples/SessionReplay-CameraTest/Sources/ViewController.swift b/Samples/SessionReplay-CameraTest/Sources/ViewController.swift index b6c9cca70d3..25ca3450afb 100644 --- a/Samples/SessionReplay-CameraTest/Sources/ViewController.swift +++ b/Samples/SessionReplay-CameraTest/Sources/ViewController.swift @@ -1,12 +1,13 @@ import AVFoundation import Sentry +import SentrySampleShared import UIKit class ViewController: UIViewController { @IBOutlet weak var backgroundLabel: UILabel! - @IBOutlet weak var controlsContainerView: UIView! - + @IBOutlet weak var previewContainerView: UIView! + @IBOutlet weak var enableSentrySwitch: UISwitch! @IBOutlet weak var enableSessionReplaySwitch: UISwitch! @IBOutlet weak var useViewRendererV2Switch: UISwitch! @@ -30,15 +31,8 @@ class ViewController: UIViewController { private func setupPreviewView() { let previewView = PreviewView() self.previewView = previewView - view.insertSubview(previewView, belowSubview: controlsContainerView) - - previewView.translatesAutoresizingMaskIntoConstraints = false - NSLayoutConstraint.activate([ - previewView.leadingAnchor.constraint(equalTo: view.leadingAnchor), - previewView.trailingAnchor.constraint(equalTo: view.trailingAnchor), - previewView.topAnchor.constraint(equalTo: view.topAnchor), - previewView.bottomAnchor.constraint(equalTo: view.bottomAnchor) - ]) + previewContainerView.addSubview(previewView) + previewView.matchEdgeAnchors(from: previewContainerView) } private func setupErrorLabel() { @@ -88,17 +82,7 @@ class ViewController: UIViewController { } } - @IBAction func didChangeToggleValue(_ sender: UISwitch) { - if sender === enableSessionReplaySwitch { - AppDelegate.isSessionReplayEnabled = sender.isOn - print("Enable session replay flag changed to: \(AppDelegate.isSessionReplayEnabled)") - } else if sender === useViewRendererV2Switch { - AppDelegate.isViewRendererV2Enabled = sender.isOn - print("Use view renderer V2 flag changed to: \(AppDelegate.isViewRendererV2Enabled)") - } else if sender === enableSentrySwitch { - AppDelegate.isSentryEnabled = sender.isOn - print("Enable Sentry flag changed to: \(AppDelegate.isSentryEnabled)") - } - AppDelegate.reloadSentrySDK() + @IBAction func configureSDK(_ sender: Any) { + present(FeaturesViewController(nibName: nil, bundle: nil), animated: true) } } diff --git a/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m b/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m index 2f4211b8cec..52fa06ffa1f 100644 --- a/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m +++ b/Samples/iOS-ObjectiveC/iOS-ObjectiveC/AppDelegate.m @@ -6,6 +6,7 @@ @import SentrySampleShared; @interface AppDelegate () +@property (strong, nonatomic) SampleAppDebugMenu *debugMenu; @end @implementation AppDelegate @@ -13,6 +14,9 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + self.debugMenu = [[SampleAppDebugMenu alloc] init]; + [self.debugMenu display]; + NSArray *args = NSProcessInfo.processInfo.arguments; NSDictionary *env = NSProcessInfo.processInfo.environment; diff --git a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift index be2f24a403c..9a46c8f6016 100644 --- a/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift +++ b/Samples/iOS-Swift/iOS-Swift/AppDelegate.swift @@ -16,10 +16,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { if args.contains("--io.sentry.wipe-data") { removeAppData() } - if !args.contains("--skip-sentry-init") { - SentrySDKWrapper.shared.startSentry() - } - + + SentrySDKWrapper.shared.startSentry() + SampleAppDebugMenu.shared.display() + if #available(iOS 15.0, *) { metricKit.receiveReports() } diff --git a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard index de25607cd8e..2f541d62378 100644 --- a/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard +++ b/Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard @@ -18,26 +18,19 @@ - - - - - - - - + - - - + + - - - - - - - - - - - - @@ -1397,11 +1346,7 @@ - - - - - + @@ -1414,7 +1359,6 @@ - @@ -1569,17 +1513,10 @@ - + - - - - - - - - + - + @@ -1751,7 +1688,6 @@ - diff --git a/Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift b/Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift index 222684a253e..eaf3457679a 100644 --- a/Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/ErrorsViewController.swift @@ -8,12 +8,9 @@ class ErrorsViewController: UIViewController { @IBOutlet weak var imageView: UIImageView! private let dispatchQueue = DispatchQueue(label: "ErrorsViewController", attributes: .concurrent) private let diskWriteException = DiskWriteException() - - @IBOutlet weak var dsnView: UIView! override func viewDidLoad() { super.viewDidLoad() - addDSNDisplay(self, vcview: dsnView) if SentrySDKOverrides.Feedback.useCustomFeedbackButton.boolValue { let button = SentrySDKWrapper.shared.feedbackButton diff --git a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift index c6ef9408708..4c87f5d909f 100644 --- a/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/ExtraViewController.swift @@ -14,7 +14,6 @@ class ExtraViewController: UIViewController { @IBOutlet weak var dataMarshalingStatusLabel: UILabel! @IBOutlet weak var dataMarshalingErrorLabel: UILabel! - @IBOutlet weak var dsnView: UIView! private let dispatchQueue = DispatchQueue(label: "ExtraViewControllers", attributes: .concurrent) override func viewDidLoad() { @@ -27,8 +26,6 @@ class ExtraViewController: UIViewController { Timer.scheduledTimer(withTimeInterval: 0.5, repeats: true) { _ in self.framesLabel?.text = "Frames Total:\(PrivateSentrySDKOnly.currentScreenFrames.total) Slow:\(PrivateSentrySDKOnly.currentScreenFrames.slow) Frozen:\(PrivateSentrySDKOnly.currentScreenFrames.frozen)" } - - addDSNDisplay(self, vcview: dsnView) } override func viewDidAppear(_ animated: Bool) { @@ -191,6 +188,7 @@ class ExtraViewController: UIViewController { @IBAction func startSDK(_ sender: UIButton) { highlightButton(sender) SentrySDKWrapper.shared.startSentry() + SampleAppDebugMenu.shared.display() } @IBAction func causeFrozenFrames(_ sender: Any) { @@ -200,10 +198,6 @@ class ExtraViewController: UIViewController { } } - @IBAction func featureFlags(_ sender: Any) { - navigationController?.pushViewController(FeaturesViewController(style: .plain), animated: true) - } - private func calcPi() -> Double { var denominator = 1.0 var pi = 0.0 diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/BenchmarkingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/BenchmarkingViewController.swift index d81442c8ffb..fb9a1246c5b 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/BenchmarkingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/BenchmarkingViewController.swift @@ -11,7 +11,6 @@ class BenchmarkingViewController: UIViewController, UITextFieldDelegate { @IBOutlet weak var maxWorkIntensityTextField: UITextField! @IBOutlet weak var valueTextField: UITextField! - @IBOutlet weak var dsnView: UIView! override func viewDidLoad() { super.viewDidLoad() minWorkIntensityTextField.text = String(defaultLongestIntervalMicros) @@ -21,7 +20,6 @@ class BenchmarkingViewController: UIViewController, UITextFieldDelegate { [maxThreadsTextField, minThreadsTextField, minWorkIntensityTextField, maxWorkIntensityTextField].forEach { $0?.delegate = self } - addDSNDisplay(self, vcview: dsnView) } override func viewDidAppear(_ animated: Bool) { diff --git a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift index 18078233aa9..28dbccdf36c 100644 --- a/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/Profiling/ProfilingViewController.swift @@ -17,11 +17,8 @@ class ProfilingViewController: UIViewController, UITextFieldDelegate { @IBOutlet weak var traceLifecycleSwitch: UISwitch! @IBOutlet weak var sessionSampleRateField: UITextField! - @IBOutlet weak var dsnView: UIView! - override func viewDidLoad() { super.viewDidLoad() - addDSNDisplay(self, vcview: dsnView) optionsConfiguration() } diff --git a/Samples/iOS-Swift/iOS-Swift/TransactionsViewController.swift b/Samples/iOS-Swift/iOS-Swift/TransactionsViewController.swift index 4430081c11c..6fc6ba7da62 100644 --- a/Samples/iOS-Swift/iOS-Swift/TransactionsViewController.swift +++ b/Samples/iOS-Swift/iOS-Swift/TransactionsViewController.swift @@ -8,11 +8,9 @@ class TransactionsViewController: UIViewController { private let dispatchQueue = DispatchQueue(label: "ViewController", attributes: .concurrent) private var timer: Timer? - @IBOutlet weak var dsnView: UIView! override func viewDidLoad() { super.viewDidLoad() - addDSNDisplay(self, vcview: dsnView) SentrySDK.reportFullyDisplayed() } diff --git a/Samples/iOS-Swift6/iOS-Swift6/AppDelegate.swift b/Samples/iOS-Swift6/iOS-Swift6/AppDelegate.swift index 7741a44a0d4..9c95aba95b2 100644 --- a/Samples/iOS-Swift6/iOS-Swift6/AppDelegate.swift +++ b/Samples/iOS-Swift6/iOS-Swift6/AppDelegate.swift @@ -1,16 +1,13 @@ -import Sentry import SentrySampleShared import UIKit @main class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { - SentrySDKWrapper.shared.startSentry() - return true - } - + SentrySDKWrapper.shared.startSentry() + return true +} // MARK: UISceneSession Lifecycle - func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) } diff --git a/Samples/iOS-Swift6/iOS-Swift6/SceneDelegate.swift b/Samples/iOS-Swift6/iOS-Swift6/SceneDelegate.swift index 84d9608c49d..3f51bf0d27b 100644 --- a/Samples/iOS-Swift6/iOS-Swift6/SceneDelegate.swift +++ b/Samples/iOS-Swift6/iOS-Swift6/SceneDelegate.swift @@ -1,3 +1,4 @@ +import SentrySampleShared import UIKit class SceneDelegate: UIResponder, UIWindowSceneDelegate { @@ -5,20 +6,6 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) { guard let _ = (scene as? UIWindowScene) else { return } - } - - func sceneDidDisconnect(_ scene: UIScene) { - } - - func sceneDidBecomeActive(_ scene: UIScene) { - } - - func sceneWillResignActive(_ scene: UIScene) { - } - - func sceneWillEnterForeground(_ scene: UIScene) { - } - - func sceneDidEnterBackground(_ scene: UIScene) { + SampleAppDebugMenu.shared.display() } } diff --git a/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift b/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift index 4dec6424f20..55c6d7cb0f9 100644 --- a/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift +++ b/Samples/iOS-SwiftUI/iOS-SwiftUI/SwiftUIApp.swift @@ -1,5 +1,4 @@ import Foundation -import Sentry import SentrySampleShared import SwiftUI @@ -8,7 +7,7 @@ struct SwiftUIApp: App { init() { SentrySDKWrapper.shared.startSentry() } - + var body: some Scene { WindowGroup { ContentView() diff --git a/Samples/iOS13-Swift/iOS13-Swift/AppDelegate.swift b/Samples/iOS13-Swift/iOS13-Swift/AppDelegate.swift index 588925ae319..7a7ff297cd5 100644 --- a/Samples/iOS13-Swift/iOS13-Swift/AppDelegate.swift +++ b/Samples/iOS13-Swift/iOS13-Swift/AppDelegate.swift @@ -6,6 +6,7 @@ import UIKit class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { SentrySDKWrapper.shared.startSentry() + SampleAppDebugMenu.shared.display() return true } diff --git a/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift b/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift index 58f633bec8d..61537bcc2f7 100644 --- a/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift +++ b/Samples/iOS15-SwiftUI/iOS15-SwiftUI/App.swift @@ -1,4 +1,3 @@ -import Sentry import SentrySampleShared import SwiftUI diff --git a/Samples/macOS-SwiftUI/macOS-SwiftUI/macOS_SwiftUIApp.swift b/Samples/macOS-SwiftUI/macOS-SwiftUI/macOS_SwiftUIApp.swift index 4137e32ddfa..0ba0b4a83f4 100644 --- a/Samples/macOS-SwiftUI/macOS-SwiftUI/macOS_SwiftUIApp.swift +++ b/Samples/macOS-SwiftUI/macOS-SwiftUI/macOS_SwiftUIApp.swift @@ -4,17 +4,13 @@ import SwiftUI @main struct MacOSSwiftUIApp: App { - @NSApplicationDelegateAdaptor private var appDelegate: MyAppDelegate - + init() { + SentrySDKWrapper.shared.startSentry() + } + var body: some Scene { WindowGroup { ContentView() } } } - -class MyAppDelegate: NSObject, NSApplicationDelegate, ObservableObject { - func applicationDidFinishLaunching(_ aNotification: Notification) { - SentrySDKWrapper.shared.startSentry() - } -} diff --git a/Samples/visionOS-Swift/visionOS-Swift.xcconfig b/Samples/visionOS-Swift/visionOS-Swift.xcconfig index 83e523399f2..4e9dc5778cc 100644 --- a/Samples/visionOS-Swift/visionOS-Swift.xcconfig +++ b/Samples/visionOS-Swift/visionOS-Swift.xcconfig @@ -28,3 +28,4 @@ CODE_SIGN_ENTITLEMENTS = visionOS-Swift/visionOS-Swift.entitlements SUPPORTED_PLATFORMS = xros xrsimulator XROS_DEPLOYMENT_TARGET = 1.0 DEVELOPMENT_ASSET_PATHS = "visionOS-Swift/Preview Content" +TARGETED_DEVICE_FAMILY = 7 diff --git a/Samples/visionOS-Swift/visionOS-Swift/Info.plist b/Samples/visionOS-Swift/visionOS-Swift/Info.plist index f1ad62ecd97..f76c47caa04 100644 --- a/Samples/visionOS-Swift/visionOS-Swift/Info.plist +++ b/Samples/visionOS-Swift/visionOS-Swift/Info.plist @@ -2,36 +2,36 @@ - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - $(PRODUCT_BUNDLE_PACKAGE_TYPE) - CFBundleShortVersionString - $(MARKETING_VERSION) - CFBundleVersion - $(CURRENT_PROJECT_VERSION) - GIT_BRANCH - <branch> - GIT_COMMIT_HASH - <sha> - GIT_STATUS_CLEAN - <status> - UIApplicationSceneManifest - - UIApplicationPreferredDefaultSceneSessionRole - UIWindowSceneSessionRoleApplication - UIApplicationSupportsMultipleScenes - - UISceneConfigurations - - + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + $(MARKETING_VERSION) + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + GIT_BRANCH + <branch> + GIT_COMMIT_HASH + <sha> + GIT_STATUS_CLEAN + <status> + UIApplicationSceneManifest + + UIApplicationPreferredDefaultSceneSessionRole + UIWindowSceneSessionRoleApplication + UIApplicationSupportsMultipleScenes + + UISceneConfigurations + +