@@ -14,8 +14,8 @@ namespace Immutable.Passport
1414{
1515 /// <summary>
1616 /// Android implementation of IPassportWebView using Vuplex WebView
17- /// Provides embedded WebView functionality within the Unity app (not external browser)
18- /// This is different from AndroidPassportWebView which uses external browser for auth flows
17+ /// Provides embedded WebView functionality within the Unity app
18+ /// Consistent with iOS and macOS Vuplex implementations
1919 /// </summary>
2020 public class AndroidVuplexWebView : IPassportWebView
2121 {
@@ -85,11 +85,27 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
8585 // Must be child of Canvas for Vuplex to work
8686 _webViewPrefab . transform . SetParent ( _canvasReference . canvas . transform , false ) ;
8787
88- // Set up full-screen layout for Native 2D Mode
88+ // Set WebView size based on configuration
8989 var rect = _webViewPrefab . GetComponent < RectTransform > ( ) ;
90- rect . anchorMin = Vector2 . zero ;
91- rect . anchorMax = Vector2 . one ;
92- rect . offsetMin = rect . offsetMax = Vector2 . zero ;
90+
91+ // Use configured dimensions or fallback to full-screen for Native 2D Mode
92+ if ( config . Width > 0 && config . Height > 0 )
93+ {
94+ // Center the WebView with specific dimensions
95+ rect . anchorMin = new Vector2 ( 0.5f , 0.5f ) ;
96+ rect . anchorMax = new Vector2 ( 0.5f , 0.5f ) ;
97+ rect . sizeDelta = new Vector2 ( config . Width , config . Height ) ;
98+ rect . anchoredPosition = Vector2 . zero ;
99+ PassportLogger . Info ( $ "{ TAG } Using configured dimensions: { config . Width } x{ config . Height } ") ;
100+ }
101+ else
102+ {
103+ // Full-screen fallback for Native 2D Mode
104+ rect . anchorMin = Vector2 . zero ;
105+ rect . anchorMax = Vector2 . one ;
106+ rect . offsetMin = rect . offsetMax = Vector2 . zero ;
107+ PassportLogger . Info ( $ "{ TAG } Using full-screen dimensions for Native 2D Mode") ;
108+ }
93109
94110 // Wait for WebView initialization
95111 await _webViewPrefab . WaitUntilInitialized ( ) ;
0 commit comments