Skip to content

Commit

Permalink
Merge pull request #366 from apptentive/feature/close-all-ui-3
Browse files Browse the repository at this point in the history
Add "cause" to About VC close event if needed
  • Loading branch information
frankus authored Mar 3, 2017
2 parents 1f19de2 + 3a073e9 commit 626503c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ @interface ApptentiveAboutViewController ()
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *privacyButtonLeadingConstraint;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *aboutButtonPrivacyButtonVeritcalConstraint;


@property (strong, nonatomic) NSArray *portraitConstraints;
@property (strong, nonatomic) NSArray *landscapeConstraints;

@property (strong, nonatomic) NSDictionary *closeEventUserInfo;

@end


Expand All @@ -56,12 +57,16 @@ - (void)viewDidLoad {

self.landscapeConstraints = [NSLayoutConstraint constraintsWithVisualFormat:@"H:[about]-(16)-[privacy]" options:NSLayoutFormatAlignAllBaseline metrics:nil views:@{ @"about": self.aboutButton,
@"privacy": self.privacyButton }];

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addCause) name:ApptentiveInteractionsShouldDismissNotification object:nil];
}

- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];

[[Apptentive sharedConnection].engagementBackend engageCodePoint:[self codePointForEvent:ATInteractionAboutViewEventLabelClose] fromInteraction:nil userInfo:nil customData:nil extendedData:nil fromViewController:self];
[[NSNotificationCenter defaultCenter] removeObserver:self];

[[Apptentive sharedConnection].engagementBackend engageCodePoint:[self codePointForEvent:ATInteractionAboutViewEventLabelClose] fromInteraction:nil userInfo:self.closeEventUserInfo customData:nil extendedData:nil fromViewController:self];
}

- (IBAction)learnMore:(id)sender {
Expand Down Expand Up @@ -102,4 +107,8 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
[self.view layoutIfNeeded];
}

- (void)addCause {
self.closeEventUserInfo = @{ @"cause" : @"notification"};
}

@end

0 comments on commit 626503c

Please sign in to comment.