From 2f92db3d737cd1ea18990205a24ff3630b3fe4d1 Mon Sep 17 00:00:00 2001 From: Sami Samhuri Date: Sun, 3 May 2015 17:20:49 -0700 Subject: [PATCH] enable code injection --- Blog/AppDelegate.m | 14 ++++++++++++++ Blog/EditorViewController.m | 4 ++++ 2 files changed, 18 insertions(+) diff --git a/Blog/AppDelegate.m b/Blog/AppDelegate.m index 612f904..20edaa6 100644 --- a/Blog/AppDelegate.m +++ b/Blog/AppDelegate.m @@ -6,6 +6,7 @@ // Copyright (c) 2014 Guru Logic Inc. All rights reserved. // +#import #import "AppDelegate.h" #import "PostsViewController.h" #import "EditorViewController.h" @@ -23,6 +24,7 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + [self configureCodeInjection]; UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; UINavigationController *navigationController = splitViewController.viewControllers.lastObject; navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; @@ -31,6 +33,18 @@ return YES; } +- (void)configureCodeInjection { + __block BOOL codeInjectionEnabled = NO; + [[[NSProcessInfo processInfo] arguments] enumerateObjectsUsingBlock:^(NSString *obj, NSUInteger idx, BOOL *stop) { + if ([obj isEqual:@"EnableCodeInjection"]) { + codeInjectionEnabled = YES; + } + }]; + if (!codeInjectionEnabled) { + [NSClassFromString(@"SFDynamicCodeInjection") performSelector:@selector(disable)]; + } +} + - (PostsViewController *)postsViewController { UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; UINavigationController *navigationController = splitViewController.viewControllers.firstObject; diff --git a/Blog/EditorViewController.m b/Blog/EditorViewController.m index b30da84..aef97fc 100644 --- a/Blog/EditorViewController.m +++ b/Blog/EditorViewController.m @@ -84,6 +84,10 @@ } } +- (void)updateOnClassInjection { + [self configureView]; +} + - (void)configureView { [self configureTitleView]; [self configureLinkView];