From ffb94bc3bf4abc766a7d7fbbab0f6bdcd2ff150e Mon Sep 17 00:00:00 2001 From: kean Date: Sun, 12 Nov 2023 22:29:13 -0500 Subject: [PATCH] Add analytics view to the demo --- Demo/Integrations/ViewController.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Demo/Integrations/ViewController.swift b/Demo/Integrations/ViewController.swift index 6aa43207..8d433650 100644 --- a/Demo/Integrations/ViewController.swift +++ b/Demo/Integrations/ViewController.swift @@ -8,7 +8,7 @@ import Pulse import SwiftUI final class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate { - private let tableView = UITableView(frame: .zero, style: .grouped) + private let tableView = UITableView(frame: .zero, style: .insetGrouped) private var sections: [MenuSection] = [] override func viewDidLoad() { @@ -30,15 +30,23 @@ final class ViewController: UIViewController, UITableViewDataSource, UITableView ]), MenuSection(title: "Components", footer: "Demonstrates how you can push individual PulseUI screens into an existing navigation (UINavigationController or NavigationView)", items: [ MenuItem(title: "ConsoleView", action: { [unowned self] in - let vc = UIHostingController(rootView: ConsoleView(store: .mock)) + let vc = UIHostingController(rootView: ConsoleView(store: .mock).closeButtonHidden()) self.navigationController?.pushViewController(vc, animated: true) }), MenuItem(title: "ConsoleView (Logs)", action: { [unowned self] in - let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .logs)) + let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .logs).closeButtonHidden()) self.navigationController?.pushViewController(vc, animated: true) }), MenuItem(title: "ConsoleView (Network)", action: { [unowned self] in - let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .network)) + let vc = UIHostingController(rootView: ConsoleView(store: .mock, mode: .network).closeButtonHidden()) + self.navigationController?.pushViewController(vc, animated: true) + }) + ]), + MenuSection(title: "Custom Views", footer: "Custom views into the underlying logger data", items: [ + MenuItem(title: "User Analytics", action: { [unowned self] in + let view = DebugAnalyticsView() + .environment(\.managedObjectContext, LoggerStore.mock.viewContext) + let vc = UIHostingController(rootView: view) self.navigationController?.pushViewController(vc, animated: true) }) ]),