Skip to content

Commit 6bd6f37

Browse files
committed
feat: add close webview handler
1 parent 9e37ab9 commit 6bd6f37

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

src/Packages/Passport/Runtime/Scripts/Public/PassportUI.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public class PassportUI : MonoBehaviour
8585

8686
[Header("WebView Settings")]
8787
[Tooltip("URL to load in the WebView for authentication.")]
88-
[SerializeField] private string webViewUrl = "http://localhost:3001";
88+
[SerializeField] private string webViewUrl = "https://auth.immutable.com/im-embedded-login-prompt?isWebView=true&client_id=YOUR_CLIENT_ID";
8989

9090
/// <summary>
9191
/// Gets or sets the URL to load in the WebView for authentication
@@ -198,6 +198,7 @@ private void CreateWebView()
198198
// Register JavaScript methods
199199
webView.RegisterJavaScriptMethod("HandleLoginData", HandleLoginData);
200200
webView.RegisterJavaScriptMethod("HandleLoginError", HandleLoginError);
201+
webView.RegisterJavaScriptMethod("CloseWebView", (data) => HideLoginUI());
201202

202203
isInitialized = true;
203204
PassportLogger.Info($"{TAG} Cross-platform WebView created successfully");
@@ -511,15 +512,6 @@ public void HideLoginUI(bool logMessage = true)
511512
PassportLogger.Info($"{TAG} Login UI hidden");
512513
}
513514
}
514-
515-
// CRITICAL: Re-enable the bridge WebView GameObject now that UI is hidden
516-
if (bridgeWebViewGameObject != null && !bridgeWebViewGameObject.activeSelf)
517-
{
518-
bridgeWebViewGameObject.SetActive(true);
519-
PassportLogger.Info($"{TAG} Re-enabled bridge WebView {bridgeWebViewGameObject.name} - UI WebView is now hidden");
520-
bridgeWebViewGameObject = null; // Clear reference
521-
}
522-
523515
}
524516

525517
/// <summary>

0 commit comments

Comments
 (0)