mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-23 01:59:24 +00:00
Plugin display is now more verbose
The plugin settings now displays more information about a failed plugin instead of just not displaying anything at all.
This commit is contained in:
@@ -21,6 +21,7 @@
|
||||
//
|
||||
|
||||
#import "MPPlugin.h"
|
||||
#import "MPPlugin_Private.h"
|
||||
#import "MPPluginHost.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
|
||||
@@ -28,15 +29,35 @@ NSString *const kMPPluginFileExtension = @"mpplugin";
|
||||
|
||||
@implementation MPPlugin
|
||||
|
||||
@synthesize bundle = _bundle;
|
||||
|
||||
- (instancetype)initWithPluginHost:(MPPluginHost *)host {
|
||||
self = [super init];
|
||||
if(self) {
|
||||
_enabled = YES;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSBundle *)bundle {
|
||||
if(_enabled) {
|
||||
return [NSBundle bundleForClass:self.class];
|
||||
}
|
||||
else {
|
||||
return _bundle;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)setBundle:(NSBundle *)bundle {
|
||||
self.enabled = NO;
|
||||
if(_bundle != bundle) {
|
||||
_bundle = bundle;
|
||||
}
|
||||
}
|
||||
|
||||
- (NSString *)identifier {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
if(bundle && bundle.bundleIdentifier) {
|
||||
return bundle.bundleIdentifier;
|
||||
if(self.bundle.bundleIdentifier) {
|
||||
return self.bundle.bundleIdentifier;
|
||||
}
|
||||
return [NSString stringWithFormat:@"unknown.bundle.identifier"];
|
||||
}
|
||||
@@ -47,10 +68,9 @@ NSString *const kMPPluginFileExtension = @"mpplugin";
|
||||
}
|
||||
|
||||
- (NSString *)version {
|
||||
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
||||
if(bundle) {
|
||||
NSString *humanVersion = bundle.infoDictionary[@"CFBundleShortVersionString"];
|
||||
NSString *version = bundle.infoDictionary[(NSString *)kCFBundleVersionKey];
|
||||
if(self.bundle) {
|
||||
NSString *humanVersion = self.bundle.infoDictionary[@"CFBundleShortVersionString"];
|
||||
NSString *version = self.bundle.infoDictionary[(NSString *)kCFBundleVersionKey];
|
||||
if(humanVersion && version) {
|
||||
return [NSString stringWithFormat:@"%@ (%@)", humanVersion, version];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user