mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
Using properties
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
- (void)didCopyToPastboard:(NSNotification *)notification {
|
||||
_timeStamp = NSDate.timeIntervalSinceReferenceDate;
|
||||
_pasteboardCleard = NO;
|
||||
if([MPPasteBoardController defaultController].clearTimeout > 0) {
|
||||
if(MPPasteBoardController.defaultController.clearTimeout > 0) {
|
||||
[self updateBadge];
|
||||
}
|
||||
}
|
||||
@@ -68,7 +68,7 @@
|
||||
if(_pasteboardCleard) {
|
||||
return;
|
||||
}
|
||||
NSTimeInterval timeOut = [MPPasteBoardController defaultController].clearTimeout;
|
||||
NSTimeInterval timeOut = MPPasteBoardController.defaultController.clearTimeout;
|
||||
NSTimeInterval countDown = timeOut - (NSDate.timeIntervalSinceReferenceDate - _timeStamp);
|
||||
if(countDown > 0) {
|
||||
NSApp.dockTile.badgeLabel = [[NSString alloc] initWithFormat:@"%d", (int)countDown];
|
||||
|
||||
@@ -30,20 +30,20 @@ static NSCharacterSet *_characterSet = nil;
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_characterSet = [[NSCharacterSet characterSetWithCharactersInString:@"1234567890"] invertedSet];
|
||||
_characterSet = [NSCharacterSet characterSetWithCharactersInString:@"1234567890"].invertedSet;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString *)stringForObjectValue:(id)obj {
|
||||
if([obj isKindOfClass:[NSNumber class]]) {
|
||||
return [[NSString alloc] initWithFormat:@"%ld",[obj integerValue]];
|
||||
if([obj isKindOfClass:NSNumber.class]) {
|
||||
return [[NSString alloc] initWithFormat:@"%ld",((NSNumber *)obj).integerValue];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error {
|
||||
NSNumber *number = [[NSNumber alloc] initWithInteger:[string integerValue]];
|
||||
NSNumber *number = [[NSNumber alloc] initWithInteger:string.integerValue];
|
||||
*obj = number;
|
||||
return YES;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ NSString *const MPStringLengthValueTransformerName = @"com.hicknhack.macpass.MPM
|
||||
@implementation MPStringLengthValueTransformer
|
||||
|
||||
+ (Class)transformedValueClass {
|
||||
return [NSString class];
|
||||
return NSString.class;
|
||||
}
|
||||
|
||||
+ (BOOL)allowsReverseTransformation {
|
||||
@@ -43,8 +43,8 @@ NSString *const MPStringLengthValueTransformerName = @"com.hicknhack.macpass.MPM
|
||||
|
||||
- (id)transformedValue:(id)value {
|
||||
NSUInteger length = 0;
|
||||
if([value isKindOfClass:[NSString class]]) {
|
||||
length = [value length];
|
||||
if([value isKindOfClass:NSString.class]) {
|
||||
length = ((NSString *)value).length;
|
||||
}
|
||||
return (length > 0) ? @"12345678" : @"";
|
||||
}
|
||||
|
||||
@@ -42,14 +42,14 @@
|
||||
if(self) {
|
||||
_binary = binary;
|
||||
_loadScheduled = NO;
|
||||
[[MPTemporaryFileStorageCenter defaultCenter] registerStorage:self];
|
||||
[MPTemporaryFileStorageCenter.defaultCenter registerStorage:self];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)dealloc {
|
||||
[self cleanup];
|
||||
[[MPTemporaryFileStorageCenter defaultCenter] unregisterStorage:self];
|
||||
[MPTemporaryFileStorageCenter.defaultCenter unregisterStorage:self];
|
||||
}
|
||||
|
||||
- (void)cleanupNow {
|
||||
@@ -101,7 +101,7 @@
|
||||
if(!binary || !binary.data || !binary.name || [binary.name length] == 0) {
|
||||
return NO;
|
||||
}
|
||||
NSString *fileName = [NSString stringWithFormat:@"%@_%@", [[NSProcessInfo processInfo] globallyUniqueString], binary.name];
|
||||
NSString *fileName = [NSString stringWithFormat:@"%@_%@", NSProcessInfo.processInfo.globallyUniqueString, binary.name];
|
||||
self.temporaryFileURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:fileName]];
|
||||
|
||||
BOOL success = [binary.data writeToURL:self.temporaryFileURL options:0 error:0];
|
||||
@@ -117,7 +117,7 @@
|
||||
if(!self.temporaryFileURL) {
|
||||
return; // No URL to clean up
|
||||
}
|
||||
NSString *path = [self.temporaryFileURL path];
|
||||
NSString *path = self.temporaryFileURL.path;
|
||||
if(blockUntilDone) {
|
||||
[MPTemporaryFileStorage _runCleanupForPath:path];
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ NSString *const MPExpiryDateValueTransformerName = @"com.hicknhack.macpass.MPExp
|
||||
formatter.timeStyle = NSDateFormatterNoStyle;
|
||||
}
|
||||
|
||||
if([value isEqualToDate:[NSDate distantFuture]]) {
|
||||
if([value isEqualToDate:NSDate.distantFuture]) {
|
||||
return noExpirationDateString;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user