mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 05:52:58 +00:00
use class properties
This commit is contained in:
20
MacPass/MPPluginRepositoryItemVersionInfo.h
Normal file
20
MacPass/MPPluginRepositoryItemVersionInfo.h
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// MPPluginVersionInfo.h
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 04.10.18.
|
||||||
|
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface MPPluginRepositoryItemVersionInfo : NSObject
|
||||||
|
|
||||||
|
- (instancetype)initWithDict:(NSDictionary *)dict NS_DESIGNATED_INITIALIZER;
|
||||||
|
- (instancetype)init NS_UNAVAILABLE;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
||||||
36
MacPass/MPPluginRepositoryItemVersionInfo.m
Normal file
36
MacPass/MPPluginRepositoryItemVersionInfo.m
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
//
|
||||||
|
// MPPluginVersionInfo.m
|
||||||
|
// MacPass
|
||||||
|
//
|
||||||
|
// Created by Michael Starke on 04.10.18.
|
||||||
|
// Copyright © 2018 HicknHack Software GmbH. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "MPPluginRepositoryItemVersionInfo.h"
|
||||||
|
|
||||||
|
NSString *const MPPluginItemCompatibiltyVersionKey = @"pluginVersion";
|
||||||
|
NSString *const MPPluginItemCompatibiltyMinimumHostVersionKey = @"minimumHostVersion";
|
||||||
|
NSString *const MPPluginItemCompatibiltyMaxiumumHostVersionKey = @"maxiumumHostVersion";
|
||||||
|
|
||||||
|
@interface MPPluginRepositoryItemVersionInfo ()
|
||||||
|
|
||||||
|
@property (copy) NSString *version;
|
||||||
|
@property (copy) NSString *minimumHostVersion;
|
||||||
|
@property (copy) NSString *maxiumHostVersion;
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation MPPluginRepositoryItemVersionInfo
|
||||||
|
|
||||||
|
- (instancetype)initWithDict:(NSDictionary *)dict {
|
||||||
|
self = [super init];
|
||||||
|
if(self) {
|
||||||
|
self.version = dict[MPPluginItemCompatibiltyVersionKey];
|
||||||
|
self.minimumHostVersion = dict[MPPluginItemCompatibiltyMinimumHostVersionKey];
|
||||||
|
self.maxiumHostVersion = dict[MPPluginItemCompatibiltyMaxiumumHostVersionKey];
|
||||||
|
}
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
@implementation NSApplication (MPAdditions)
|
@implementation NSApplication (MPAdditions)
|
||||||
|
|
||||||
- (NSString *)applicationName {
|
- (NSString *)applicationName {
|
||||||
return [[NSBundle mainBundle].infoDictionary[@"CFBundleName"] copy];
|
return [NSBundle.mainBundle.infoDictionary[@"CFBundleName"] copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *)applicationSupportDirectoryURL {
|
- (NSURL *)applicationSupportDirectoryURL {
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
|
|
||||||
- (NSURL *)applicationSupportDirectoryURL:(BOOL)create {
|
- (NSURL *)applicationSupportDirectoryURL:(BOOL)create {
|
||||||
NSError *error;
|
NSError *error;
|
||||||
NSURL *url = [[NSFileManager defaultManager] URLForDirectory:NSApplicationSupportDirectory
|
NSURL *url = [NSFileManager.defaultManager URLForDirectory:NSApplicationSupportDirectory
|
||||||
inDomain:NSUserDomainMask
|
inDomain:NSUserDomainMask
|
||||||
appropriateForURL:nil
|
appropriateForURL:nil
|
||||||
create:NO
|
create:NO
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
if(url) {
|
if(url) {
|
||||||
url = [url URLByAppendingPathComponent:self.applicationName isDirectory:YES];
|
url = [url URLByAppendingPathComponent:self.applicationName isDirectory:YES];
|
||||||
if(create) {
|
if(create) {
|
||||||
[[NSFileManager defaultManager] createDirectoryAtURL:url
|
[NSFileManager.defaultManager createDirectoryAtURL:url
|
||||||
withIntermediateDirectories:YES
|
withIntermediateDirectories:YES
|
||||||
attributes:nil
|
attributes:nil
|
||||||
error:&error];
|
error:&error];
|
||||||
|
|||||||
Reference in New Issue
Block a user