@@ -38,7 +38,7 @@ @interface OSInAppMessageView () <UIScrollViewDelegate, WKUIDelegate, WKNavigati
3838@property (strong , nonatomic , nonnull ) OSInAppMessageInternal *message;
3939@property (strong , nonatomic , nonnull ) WKWebView *webView;
4040@property (nonatomic ) BOOL loaded;
41-
41+ @property ( nonatomic ) BOOL isFullscreen;
4242@end
4343
4444
@@ -118,6 +118,16 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {
118118 [self layoutIfNeeded ];
119119}
120120
121+ - (void )setIsFullscreen : (BOOL )isFullscreen {
122+ _isFullscreen = isFullscreen;
123+ CGRect mainBounds = UIScreen.mainScreen .bounds ;
124+ if (!isFullscreen) {
125+ CGFloat marginSpacing = [OneSignalViewHelper sizeToScale: MESSAGE_MARGIN];
126+ mainBounds.size .width -= (2.0 * marginSpacing);
127+ }
128+ [self .webView setFrame: mainBounds];
129+ }
130+
121131/*
122132 Method for resetting the height of the WebView so the JS can calculate the new height
123133 WebView will have margins accounted for on width, but height just needs to be phone height or larger
@@ -126,9 +136,12 @@ - (void)setupWebviewWithMessageHandler:(id<WKScriptMessageHandler>)handler {
126136- (void )resetWebViewToMaxBoundsAndResizeHeight : (void (^) (NSNumber *newHeight)) completion {
127137 [self .webView removeConstraints: [self .webView constraints ]];
128138
129- CGFloat marginSpacing = [OneSignalViewHelper sizeToScale: MESSAGE_MARGIN];
139+
130140 CGRect mainBounds = UIScreen.mainScreen .bounds ;
131- mainBounds.size .width -= (2.0 * marginSpacing);
141+ if (!self.isFullscreen ) {
142+ CGFloat marginSpacing = [OneSignalViewHelper sizeToScale: MESSAGE_MARGIN];
143+ mainBounds.size .width -= (2.0 * marginSpacing);
144+ }
132145
133146 [self .webView setFrame: mainBounds];
134147 [self .webView layoutIfNeeded ];
0 commit comments