Skip to content

Commit 4117176

Browse files
feat: convert to post message
1 parent 56a6cbf commit 4117176

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sdk/src/main/java/ly/count/android/sdk/TransparentActivity.java

+1-6
Original file line numberDiff line numberDiff line change
@@ -170,17 +170,12 @@ public void onConfigurationChanged(android.content.res.Configuration newConfig)
170170
final Display display = wm.getDefaultDisplay();
171171
final DisplayMetrics metrics = new DisplayMetrics();
172172
display.getMetrics(metrics);
173-
boolean portrait = newConfig.orientation == Configuration.ORIENTATION_PORTRAIT;
174173

175174
if (metrics.widthPixels != lastWidth || metrics.heightPixels != lastHeight) {
176175
int scaledWidth = (int) Math.ceil(metrics.widthPixels / metrics.density);
177176
int scaledHeight = (int) Math.ceil(metrics.heightPixels / metrics.density);
178177

179-
int portraitWidth = portrait ? scaledWidth : scaledHeight;
180-
int portraitHeight = portrait ? scaledHeight : scaledWidth;
181-
int landscapeWidth = portrait ? scaledHeight : scaledWidth;
182-
int landscapeHeight = portrait ? scaledWidth : scaledHeight;
183-
webView.loadUrl("javascript:resizeContent(" + portraitWidth + "," + portraitHeight + "," + landscapeWidth + "," + landscapeHeight + ");");
178+
webView.loadUrl("javascript:window.postMessage({type: 'resize', width: " + scaledWidth + ", height: " + scaledHeight + "}, '*');");
184179

185180
lastWidth = metrics.widthPixels;
186181
lastHeight = metrics.heightPixels;

0 commit comments

Comments
 (0)