Skip to content

Commit f22dfe7

Browse files
committed
Renaming isFullscreen to isFullbleed to avoid confusion
1 parent 71f558c commit f22dfe7

File tree

4 files changed

+55
-62
lines changed

4 files changed

+55
-62
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/InAppMessageView.java

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import android.view.Gravity;
1919
import android.view.View;
2020
import android.view.ViewGroup;
21-
import android.view.WindowInsets;
2221
import android.view.WindowManager;
2322
import android.view.animation.Animation;
2423
import android.webkit.WebView;
@@ -287,16 +286,11 @@ private void createPopupWindow(@NonNull RelativeLayout parentRelativeLayout) {
287286
true
288287
);
289288

290-
OSViewUtils.getWindowHeight(currentActivity);
291289
popupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
292290
popupWindow.setTouchable(true);
293-
// NOTE: This seems like the key to getting fullscreen under notches working?!
291+
// NOTE: This is required for getting fullscreen under notches working in portrait mode
294292
popupWindow.setClippingEnabled(false);
295293

296-
View container = (View)popupWindow.getContentView();
297-
System.out.println("container: " + container);
298-
System.out.println("container.getClass: " + container.getClass());
299-
300294
int gravity = 0;
301295
if (!hasBackground) {
302296
switch (displayLocation) {
@@ -315,7 +309,7 @@ private void createPopupWindow(@NonNull RelativeLayout parentRelativeLayout) {
315309

316310
// Using panel for fullbleed IAMs and dialog for non-fullbleed. The attached dialog type
317311
// does not allow content to bleed under notches but panel does.
318-
int displayType = this.messageContent.isFullScreen() ?
312+
int displayType = this.messageContent.isFullBleed() ?
319313
WindowManager.LayoutParams.TYPE_APPLICATION_PANEL :
320314
WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG;
321315
PopupWindowCompat.setWindowLayoutType(

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSInAppMessageContent.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ internal open class OSInAppMessageContent constructor(jsonObject: JSONObject) {
1212
var contentHtml: String? = null
1313
var useHeightMargin: Boolean = true
1414
var useWidthMargin: Boolean = true
15-
var isFullScreen: Boolean = false
15+
var isFullBleed: Boolean = false
1616
// The following properties are populated from Javascript events
1717
var displayLocation: WebViewManager.Position? = null
1818
var displayDuration: Double? = null
@@ -24,6 +24,6 @@ internal open class OSInAppMessageContent constructor(jsonObject: JSONObject) {
2424
var styles: JSONObject? = jsonObject.optJSONObject(STYLES)
2525
useHeightMargin = !(styles?.optBoolean(REMOVE_HEIGHT_MARGIN, false) ?: false)
2626
useWidthMargin = !(styles?.optBoolean(REMOVE_WIDTH_MARGIN, false) ?: false)
27-
isFullScreen = !useHeightMargin
27+
isFullBleed = !useHeightMargin
2828
}
2929
}

OneSignalSDK/onesignal/src/main/java/com/onesignal/WebViewManager.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.onesignal;
22

3-
43
import android.annotation.SuppressLint;
54
import android.annotation.TargetApi;
65
import android.app.Activity;
@@ -145,7 +144,7 @@ private static void setContentSafeAreaInsets(OSInAppMessageContent content, @Non
145144
}
146145

147146
private static void initInAppMessage(@NonNull final Activity currentActivity, @NonNull OSInAppMessageInternal message, @NonNull final OSInAppMessageContent content) {
148-
if (content.isFullScreen()) {
147+
if (content.isFullBleed()) {
149148
setContentSafeAreaInsets(content, currentActivity);
150149
}
151150
try {
@@ -163,7 +162,7 @@ private static void initInAppMessage(@NonNull final Activity currentActivity, @N
163162
public void run() {
164163
// Handles exception "MissingWebViewPackageException: Failed to load WebView provider: No WebView installed"
165164
try {
166-
webViewManager.setupWebView(currentActivity, base64Str, content.isFullScreen());
165+
webViewManager.setupWebView(currentActivity, base64Str, content.isFullBleed());
167166
} catch (Exception e) {
168167
// Need to check error message to only catch MissingWebViewPackageException as it isn't public
169168
if (e.getMessage() != null && e.getMessage().contains("No WebView installed")) {
@@ -239,7 +238,7 @@ public void postMessage(String message) {
239238
}
240239

241240
private void handleResize() {
242-
if (messageContent.isFullScreen()) {
241+
if (messageContent.isFullBleed()) {
243242
updateSafeAreaInsets();
244243
}
245244
}
@@ -334,8 +333,8 @@ private void calculateHeightAndShowWebViewAfterNewActivity() {
334333
if (messageView == null)
335334
return;
336335

337-
// Don't need a CSS / HTML height update for fullscreen
338-
if (messageView.getDisplayPosition() == Position.FULL_SCREEN && !messageContent.isFullScreen()) {
336+
// Don't need a CSS / HTML height update for fullscreen unless its fullbleed
337+
if (messageView.getDisplayPosition() == Position.FULL_SCREEN && !messageContent.isFullBleed()) {
339338
showMessageView(null);
340339
return;
341340
}
@@ -349,7 +348,7 @@ public void run() {
349348
// At time point the webView isn't attached to a view
350349
// Set the WebView to the max screen size then run JS to evaluate the height.
351350
setWebViewToMaxSize(activity);
352-
if (messageContent.isFullScreen()) {
351+
if (messageContent.isFullBleed()) {
353352
updateSafeAreaInsets();
354353
}
355354

@@ -512,7 +511,7 @@ private static void enableWebViewRemoteDebugging() {
512511
}
513512

514513
private int getWebViewMaxSizeX(Activity activity) {
515-
if (messageContent.isFullScreen()) {
514+
if (messageContent.isFullBleed()) {
516515
return getFullbleedWindowWidth(activity);
517516
} else {
518517

@@ -522,7 +521,7 @@ private int getWebViewMaxSizeX(Activity activity) {
522521
}
523522

524523
private int getWebViewMaxSizeY(Activity activity) {
525-
int margin = messageContent.isFullScreen() ? 0 : (MARGIN_PX_SIZE * 2);
524+
int margin = messageContent.isFullBleed() ? 0 : (MARGIN_PX_SIZE * 2);
526525
return OSViewUtils.getWindowHeight(activity) - margin;
527526
}
528527

0 commit comments

Comments
 (0)