Skip to content
Open
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
23 changes: 12 additions & 11 deletions AutoImporter/AutoImporter/LAFAutoImporter.m
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
static LAFAutoImporter *sharedPlugin;

@interface LAFAutoImporter()
@property (nonatomic, strong) NSBundle *bundle;
@end

@implementation LAFAutoImporter
Expand All @@ -40,25 +39,27 @@ + (void)pluginDidLoad:(NSBundle *)plugin
NSString *currentApplicationName = [[NSBundle mainBundle] infoDictionary][@"CFBundleName"];
if ([currentApplicationName isEqual:@"Xcode"]) {
dispatch_once(&onceToken, ^{
sharedPlugin = [[self alloc] initWithBundle:plugin];
sharedPlugin = [[self alloc] init];
});
}
}

- (id)initWithBundle:(NSBundle *)plugin
{
- (instancetype)init {
if (self = [super init]) {
// init inspector
[LAFIDENotificationHandler sharedHandler];

// reference to plugin's bundle, for resource acccess
self.bundle = plugin;

[self loadKeyboardHandler];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidFinishLaunching:)
name:NSApplicationDidFinishLaunchingNotification
object:nil];
}
return self;
}

- (void)applicationDidFinishLaunching:(NSNotification*)noti{
// init inspector
[LAFIDENotificationHandler sharedHandler];
[self loadKeyboardHandler];
}

- (void)loadKeyboardHandler {
EventHotKeyRef lafHotKeyRef;
EventHotKeyID lafHotKeyID;
Expand Down