Remove deprecated initializers

parent a78729b0
......@@ -31,10 +31,8 @@
@interface BUYLineItem : _BUYLineItem {}
- (instancetype)initWithVariant:(BUYProductVariant *)variant NS_DEPRECATED_IOS(8_0, 9_0, "Use `BUYModelManager` to create new instances of model objects instead");
- (instancetype)initWithCartLineItem:(BUYCartLineItem *)cartLineItem NS_DEPRECATED_IOS(8_0, 9_0, "Use `BUYModelManager` to create new instances of model objects instead");
@property (readonly) NSString *lineItemIdentifier NS_DEPRECATED_IOS(8_0, 9_0);
- (void)updateWithVariant:(BUYProductVariant *)variant;
- (void)updateWithLineItem:(BUYCartLineItem *)lineItem;
@end
......
......@@ -34,24 +34,6 @@
@implementation BUYLineItem
/**
* Have model manager responsible for instantiation, and allow deprecated
* initializers for backwards compatability
*/
- (instancetype)initWithCartLineItem:(BUYCartLineItem *)cartLineItem
{
BUYLineItem *lineItem = [[BUYLineItem alloc] initWithModelManager:cartLineItem.modelManager JSONDictionary:nil];
[lineItem updateWithLineItem:cartLineItem];
return lineItem;
}
- (instancetype)initWithVariant:(BUYProductVariant *)variant
{
BUYLineItem *lineItem = [[BUYLineItem alloc] initWithModelManager:variant.modelManager JSONDictionary:nil];
[lineItem updateWithVariant:variant];
return lineItem;
}
- (void)updateWithVariant:(BUYProductVariant *)variant
{
self.variantId = variant.identifier;
......@@ -69,11 +51,6 @@
self.quantity = lineItem.quantity;
}
- (NSString *)lineItemIdentifier
{
return self.identifier;
}
@end
@implementation BUYModelManager (BUYLineItemCreation)
......
......@@ -115,7 +115,9 @@
- (void)updateWithCart:(BUYCart *)cart
{
NSArray *lineItems = [[cart.lineItems array] buy_map:^id(BUYCartLineItem *cartLineItem) {
return [[BUYLineItem alloc] initWithCartLineItem:cartLineItem];
BUYLineItem *lineItem = [self.modelManager buy_objectWithEntityName:[BUYLineItem entityName] JSONDictionary:nil];
[lineItem updateWithLineItem:cartLineItem];
return lineItem;
}];
self.lineItems = [NSOrderedSet orderedSetWithArray:lineItems];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment