Fix contact offer

We never assign interaction, but we can get it via the viewItem.

// FREEBIE
pull/1/head
Michael Kirk 8 years ago
parent e38535cbe1
commit 1f5603760b

@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface OWSContactOffersCell () @interface OWSContactOffersCell ()
@property (nonatomic, nullable) OWSContactOffersInteraction *interaction; @property (nonatomic, nullable, readonly) OWSContactOffersInteraction *interaction;
@property (nonatomic) UILabel *titleLabel; @property (nonatomic) UILabel *titleLabel;
@property (nonatomic) UIButton *addToContactsButton; @property (nonatomic) UIButton *addToContactsButton;
@ -195,15 +195,19 @@ NS_ASSUME_NONNULL_BEGIN
return result; return result;
} }
- (void)prepareForReuse #pragma mark - Events
{
[super prepareForReuse];
self.interaction = nil; - (nullable OWSContactOffersInteraction *)interaction
{
OWSAssert(self.viewItem);
OWSAssert(self.viewItem.interaction);
if (![self.viewItem.interaction isKindOfClass:[OWSContactOffersInteraction class]]) {
OWSFail(@"%@ expected OWSContactOffersInteraction but found: %@", self.logTag, self.viewItem.interaction);
return nil;
}
return (OWSContactOffersInteraction *)self.viewItem.interaction;
} }
#pragma mark - Events
- (void)addToContacts - (void)addToContacts
{ {
OWSAssert(self.delegate); OWSAssert(self.delegate);

Loading…
Cancel
Save