Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[User Model] Add back the dropshadow to In App Messages with a plist option to disable it #1395

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
// Info.plist key
#define FALLBACK_TO_SETTINGS_MESSAGE @"Onesignal_settings_fallback_message"
#define ONESIGNAL_SUPRESS_LAUNCH_URLS @"OneSignal_suppress_launch_urls"
#define ONESIGNAL_IN_APP_HIDE_DROP_SHADOW @"OneSignal_in_app_message_hide_drop_shadow"

// GDPR Privacy Consent
#define GDPR_CONSENT_GRANTED @"GDPR_CONSENT_GRANTED"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,19 @@ - (void)setupInitialMessageUI {
}];
}

- (void)updateDropShadow {
// the plist value specifies whether the user wants to add drop shadow to the In App Message
NSDictionary *bundleDict = [[NSBundle mainBundle] infoDictionary];
BOOL hideDropShadow = [bundleDict[ONESIGNAL_IN_APP_HIDE_DROP_SHADOW] boolValue];
if (hideDropShadow) {
return;
}
self.messageView.layer.shadowOffset = CGSizeMake(0, 3);
self.messageView.layer.shadowColor = [[UIColor blackColor] CGColor];
self.messageView.layer.shadowRadius = 3.0f;
self.messageView.layer.shadowOpacity = 0.55f;
}

- (void)displayMessage {
[OneSignalLog onesignalLog:ONE_S_LL_VERBOSE message:@"Displaying In-App Message"];

Expand Down Expand Up @@ -233,9 +246,11 @@ - (OSResultSuccessBlock)messageContentOnSuccess {
if (self.waitForTags) {
return;
}
[self updateDropShadow];
[self.delegate messageWillDisplay:self.message];
[self.messageView loadedHtmlContent:self.pendingHTMLContent withBaseURL:baseUrl];
self.pendingHTMLContent = nil;

}];
};
}
Expand Down