Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Musamuss patch 1 #79

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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 @@ -26,7 +26,11 @@
#import "DBTextViewViewController.h"
#import "DBImageViewViewController.h"
#import <MessageUI/MessageUI.h>
#if __has_include(<DBDebugToolkit/DBDebugToolkit-Swift.h>)
#import <DBDebugToolkit/DBDebugToolkit-Swift.h>
#else
#import <DBDebugToolkit-Swift.h>
#endif

typedef NS_ENUM(NSUInteger, DBCrashReportDetailsTableViewControllerSection) {
DBCrashReportDetailsTableViewControllerSectionDetails,
Expand Down
4 changes: 4 additions & 0 deletions DBDebugToolkit/Classes/CrashReports/DBCrashReportsToolkit.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,11 @@
#include <sys/types.h>
#include <unistd.h>
#include <sys/sysctl.h>
#if __has_include(<DBDebugToolkit/DBDebugToolkit-Swift.h>)
#import <DBDebugToolkit/DBDebugToolkit-Swift.h>
#else
#import <DBDebugToolkit-Swift.h>
#endif

typedef void (*sighandler_t)(int);

Expand Down
38 changes: 14 additions & 24 deletions DBDebugToolkit/Classes/DBDebugToolkit.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@
#import "DBCrashReportsToolkit.h"
#import "DBTopLevelViewsWrapper.h"
#import "UIApplication+DBDebugToolkit.h"
#if __has_include(<DBDebugToolkit/DBDebugToolkit-Swift.h>)
#import <DBDebugToolkit/DBDebugToolkit-Swift.h>
#else
#import <DBDebugToolkit-Swift.h>
#endif


static NSString *const DBDebugToolkitObserverPresentationControllerPropertyKeyPath = @"containerView";

@interface DBDebugToolkit () <DBDebugToolkitTriggerDelegate, DBMenuTableViewControllerDelegate, DBPerformanceWidgetViewDelegate>

@property (nonatomic, copy) NSArray <id <DBDebugToolkitTrigger>> *triggers;
@property (nonatomic, strong) DBMenuTableViewController *menuViewController;
@property (nonatomic, strong) UIViewController *menuViewController;
@property (nonatomic, assign) BOOL showsMenu;
@property (nonatomic, strong) DBPerformanceToolkit *performanceToolkit;
@property (nonatomic, strong) DBConsoleOutputCaptor *consoleOutputCaptor;
Expand Down Expand Up @@ -399,6 +404,13 @@ + (UIViewController *)menuViewController {
- (void)showMenu {
self.showsMenu = YES;
UIViewController *presentingViewController = [self topmostViewController];
if (@available(iOS 15.0, *)) {
UINavigationBarAppearance *navBarAppearance = [[UINavigationBarAppearance alloc] init];
navBarAppearance.backgroundColor = [UIColor whiteColor];
[navBarAppearance configureWithOpaqueBackground];
[UINavigationBar appearance].standardAppearance = navBarAppearance;
[UINavigationBar appearance].scrollEdgeAppearance = navBarAppearance;
}
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:self.menuViewController];
navigationController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
navigationController.modalPresentationStyle = UIModalPresentationOverFullScreen;
Expand Down Expand Up @@ -432,7 +444,7 @@ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(N
}
}

- (DBMenuTableViewController *)menuViewController {
- (UIViewController *)menuViewController {
if (!_menuViewController) {
_menuViewController = [SwiftUIViewFactory
makeMenuListViewWithPerformanceToolkit:self.performanceToolkit
Expand All @@ -452,24 +464,6 @@ - (DBMenuTableViewController *)menuViewController {
}

return _menuViewController;

if (!_menuViewController) {
NSBundle *bundle = [NSBundle debugToolkitBundle];
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"DBMenuTableViewController" bundle:bundle];
_menuViewController = [storyboard instantiateInitialViewController];
_menuViewController.performanceToolkit = self.performanceToolkit;
_menuViewController.consoleOutputCaptor = self.consoleOutputCaptor;
_menuViewController.networkToolkit = self.networkToolkit;
_menuViewController.userInterfaceToolkit = self.userInterfaceToolkit;
_menuViewController.locationToolkit = self.locationToolkit;
_menuViewController.coreDataToolkit = self.coreDataToolkit;
_menuViewController.crashReportsToolkit = self.crashReportsToolkit;
_menuViewController.deviceInfoProvider = [DBDeviceInfoProvider new];
_menuViewController.delegate = self;
}
_menuViewController.customVariables = self.customVariables.allValues;
_menuViewController.customActions = self.customActions;
return _menuViewController;
}

- (UIViewController *)topmostViewController {
Expand Down Expand Up @@ -521,10 +515,6 @@ - (void)performanceWidgetView:(DBPerformanceWidgetView *)performanceWidgetView d
// Only update the presented DBPerformanceTableViewController instance.
DBPerformanceTableViewController *performanceTableViewController = (DBPerformanceTableViewController *)navigationController.viewControllers[1];
performanceTableViewController.selectedSection = section;
} else {
// Update navigation controller's view controllers.
[self.menuViewController openPerformanceMenuWithSection:section
animated:shouldAnimateShowingPerformance];
}
}

Expand Down
4 changes: 4 additions & 0 deletions DBDebugToolkit/Classes/Menu/DBMenuTableViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@
#import "DBCustomActionsTableViewController.h"
#import "DBCustomVariablesTableViewController.h"
#import "DBCrashReportsTableViewController.h"
#if __has_include(<DBDebugToolkit/DBDebugToolkit-Swift.h>)
#import <DBDebugToolkit/DBDebugToolkit-Swift.h>
#else
#import <DBDebugToolkit-Swift.h>
#endif

typedef NS_ENUM(NSUInteger, DBMenuTableViewControllerRow) {
DBMenuTableViewControllerRowPerformance,
Expand Down
Loading