Stubbed entry proxy to enable better model editing behaviour

This commit is contained in:
michael starke
2016-03-07 19:55:35 +01:00
parent cd901cb227
commit d408c925bf
4 changed files with 117 additions and 0 deletions

25
MacPass/MPEntryProxy.h Normal file
View File

@@ -0,0 +1,25 @@
//
// MPEntryProxy.h
// MacPass
//
// Created by Michael Starke on 07/03/16.
// Copyright © 2016 HicknHack Software GmbH. All rights reserved.
//
#import <Foundation/Foundation.h>
/*
Proxies the display of an entry to enable discardable changes to the entry
*/
NS_ASSUME_NONNULL_BEGIN
@class KPKEntry;
@interface MPEntryProxy : NSProxy
- (instancetype)initWithEntry:(KPKEntry *)entry;
@end
NS_ASSUME_NONNULL_END

36
MacPass/MPEntryProxy.m Normal file
View File

@@ -0,0 +1,36 @@
//
// MPEntryProxy.m
// MacPass
//
// Created by Michael Starke on 07/03/16.
// Copyright © 2016 HicknHack Software GmbH. All rights reserved.
//
#import "MPEntryProxy.h"
#import <KeePassKit/KeePassKit.h>
@interface MPEntryProxy ()
@property (strong) KPKEntry *entry;
@end
@implementation MPEntryProxy
- (instancetype)initWithEntry:(KPKEntry *)entry {
if(!entry) {
@throw [NSException exceptionWithName:NSInvalidArgumentException reason:nil userInfo:nil];
}
_entry = entry;
return self;
}
- (void)forwardInvocation:(NSInvocation *)invocation {
[invocation invokeWithTarget:self.entry];
}
- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel {
return [self.entry methodSignatureForSelector:sel];
}
@end