Skip to content

Commit d705397

Browse files
committed
deduplicating setwebViewFrame and updating logging
1 parent 6c82f9e commit d705397

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

iOS_SDK/OneSignalSDK/Source/OSInAppMessageView.m

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,6 @@ - (NSString *)addTagsToHTML:(NSString *)html {
8989

9090
- (void)loadedHtmlContent:(NSString *)html withBaseURL:(NSURL *)url {
9191
// UI Update must be done on the main thread
92-
NSLog(@"11111 [self.webView loadHTMLString:html baseURL:url];");
93-
94-
NSLog(@"222222 [self.webView loadHTMLString:html baseURL:url];");
9592
NSString *taggedHTML = [self addTagsToHTML:html];
9693
[OneSignal onesignal_Log:ONE_S_LL_VERBOSE message:[NSString stringWithFormat:@"loadedHtmlContent with Tags: \n%@", taggedHTML]];
9794
[self.webView loadHTMLString:taggedHTML baseURL:url];
@@ -120,8 +117,12 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {
120117

121118
- (void)setIsFullscreen:(BOOL)isFullscreen {
122119
_isFullscreen = isFullscreen;
120+
[self setWebviewFrame];
121+
}
122+
123+
- (void)setWebviewFrame {
123124
CGRect mainBounds = UIScreen.mainScreen.bounds;
124-
if (!isFullscreen) {
125+
if (!self.isFullscreen) {
125126
CGFloat marginSpacing = [OneSignalViewHelper sizeToScale:MESSAGE_MARGIN];
126127
mainBounds.size.width -= (2.0 * marginSpacing);
127128
}
@@ -137,13 +138,7 @@ - (void)resetWebViewToMaxBoundsAndResizeHeight:(void (^) (NSNumber *newHeight))
137138
[self.webView removeConstraints:[self.webView constraints]];
138139

139140

140-
CGRect mainBounds = UIScreen.mainScreen.bounds;
141-
if (!self.isFullscreen) {
142-
CGFloat marginSpacing = [OneSignalViewHelper sizeToScale:MESSAGE_MARGIN];
143-
mainBounds.size.width -= (2.0 * marginSpacing);
144-
}
145-
146-
[self.webView setFrame:mainBounds];
141+
[self setWebviewFrame];
147142
[self.webView layoutIfNeeded];
148143

149144
// Evaluate JS getPageMetaData() method to obtain the updated height for the messageView to contain the webView contents

iOS_SDK/OneSignalSDK/Source/OSInAppMessageViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,8 @@ - (void)jsEventOccurredWithBody:(NSData *)body {
733733
break;
734734
}
735735
case OSInAppMessageBridgeEventTypePageResize: {
736-
// Unused resize event for IAM during actions like orientation changes and displaying an IAM
736+
// resize event for IAM during actions like orientation changes and displaying an IAM
737+
// Currently used for fullscreen IAMs to account for safe area changes
737738
// self.message.height = event.resize.height;
738739
if (self.isFullscreen) {
739740
[self.messageView updateSafeAreaInsets];

0 commit comments

Comments
 (0)