Skip to content

Commit

Permalink
Merge pull request #1294 from OneSignal/user_model/fix_in_app_display
Browse files Browse the repository at this point in the history
[User model] Fix in app display
  • Loading branch information
emawby authored and nan-li committed Oct 30, 2023
2 parents 0724e1e + 9e42090 commit a4112a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ - (void)presentInAppPreviewMessage:(OSInAppMessageInternal *)message {
- (void)displayMessage:(OSInAppMessageInternal *)message {
// Check if the app disabled IAMs for this device before showing an IAM
if (_isInAppMessagingPaused && !message.isPreview) {
[self cleanUpInAppWindow];
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"In app messages will not show while paused"];
return;
}
Expand Down Expand Up @@ -737,7 +738,7 @@ - (void)messageViewControllerWasDismissed:(OSInAppMessageInternal *)message disp
[self persistInAppMessageForRedisplay:showingIAM];
}
// Reset the IAM viewController to prepare for next IAM if one exists
[self cleanUpInAppWindow];
self.viewController = nil;
// Reset time since last IAM
[self setAndPersistTimeSinceLastMessage];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,15 @@ @interface OSInAppMessageViewController ()

@implementation OSInAppMessageViewController

OSInAppMessageInternal *_dismissingMessage = nil;

- (instancetype _Nonnull)initWithMessage:(OSInAppMessageInternal *)inAppMessage delegate:(id<OSInAppMessageViewControllerDelegate>)delegate {
if (self = [super init]) {
self.message = inAppMessage;
self.delegate = delegate;
self.useHeightMargin = YES;
self.useWidthMargin = YES;
_dismissingMessage = nil;
}

return self;
Expand Down Expand Up @@ -490,6 +493,10 @@ - (void)dismissCurrentInAppMessage:(BOOL)up withVelocity:(double)velocity {
[self.delegate messageViewControllerWasDismissed:self.message displayed:NO];
return;
}

if (_dismissingMessage == self.message) {
return;
}

[self.delegate messageViewControllerWillDismiss:self.message];

Expand Down Expand Up @@ -521,7 +528,7 @@ - (void)dismissCurrentInAppMessage:(BOOL)up withVelocity:(double)velocity {
animationOption = UIViewAnimationOptionCurveEaseIn;
dismissAnimationDuration = MIN_DISMISSAL_ANIMATION_DURATION;
}

_dismissingMessage = self.message;
[UIView animateWithDuration:dismissAnimationDuration delay:0.0f options:animationOption animations:^{
self.view.backgroundColor = [UIColor clearColor];
self.view.alpha = 0.0f;
Expand Down

0 comments on commit a4112a0

Please sign in to comment.