Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if UWB_WEBVIEW && !IMMUTABLE_CUSTOM_BROWSER && (UNITY_STANDALONE_WIN || (UNITY_ANDROID && UNITY_EDITOR_WIN) || (UNITY_IPHONE && UNITY_EDITOR_WIN))
#if UWB_WEBVIEW && !IMMUTABLE_CUSTOM_BROWSER && (UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR_OSX || (UNITY_ANDROID && UNITY_EDITOR_WIN) || (UNITY_IPHONE && UNITY_EDITOR_WIN))

using System;
using System.IO;
Expand Down Expand Up @@ -32,7 +32,6 @@ public class UwbWebView : MonoBehaviour, IWebBrowserClient
#endif

private WebBrowserClient? webBrowserClient;
private GameBridgeServer? gameBridgeServer;

public async UniTask Init(int engineStartupTimeoutMs, bool redactTokensInLogs, Func<string, string> redactionHandler)
{
Expand Down Expand Up @@ -67,9 +66,8 @@ public async UniTask Init(int engineStartupTimeoutMs, bool redactTokensInLogs, F
var browserEngineMainDir = WebBrowserUtils.GetAdditionFilesDirectory();
browserClient.CachePath = new FileInfo(Path.Combine(browserEngineMainDir, "ImmutableSDK/UWBCache"));

// Start local HTTP server to serve index.html
gameBridgeServer = new GameBridgeServer(GameBridge.GetFileSystemPath());
browserClient.initialUrl = gameBridgeServer.Start();
// Game bridge path
browserClient.initialUrl = GameBridge.GetFilePath();

// Set up engine from standard UWB configuration asset
var engineConfigAsset = Resources.Load<EngineConfiguration>("Cef Engine Configuration");
Expand Down Expand Up @@ -147,8 +145,6 @@ public void Dispose()
if (webBrowserClient?.HasDisposed == true) return;

webBrowserClient?.Dispose();
gameBridgeServer?.Dispose();
gameBridgeServer = null;
}
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,5 @@ public static string GetFilePath()
filePath = filePath.Replace(" ", "%20");
return filePath;
}

/// <summary>
/// Gets the file system path to index.html (without file:// scheme or URL encoding).
/// </summary>
public static string GetFileSystemPath()
{
return GetFilePath()
.Replace(SCHEME_FILE, "")
.Replace("%20", " ");
}
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#if UNITY_STANDALONE_WIN || (UNITY_ANDROID && UNITY_EDITOR_WIN) || (UNITY_IPHONE && UNITY_EDITOR_WIN)

using System.Net.Sockets;
using System.IO;
using UnityEngine;
using Immutable.Browser.Core;
using Immutable.Passport;
using Immutable.Passport.Core.Logging;
using Cysharp.Threading.Tasks;

Expand All @@ -14,7 +13,6 @@ public class WindowsWebBrowserClientAdapter : IWebBrowserClient
public event OnUnityPostMessageDelegate OnUnityPostMessage;

private readonly IWindowsWebBrowserClient webBrowserClient;
private GameBridgeServer? gameBridgeServer;

public WindowsWebBrowserClientAdapter(IWindowsWebBrowserClient windowsWebBrowserClient)
{
Expand All @@ -35,11 +33,8 @@ public async UniTask Init()
// Initialise the web browser client asynchronously
await webBrowserClient.Init();

// Start local HTTP server to serve index.html
gameBridgeServer = new GameBridgeServer(GameBridge.GetFileSystemPath());

// Load the game bridge file into the web browser client
webBrowserClient.LoadUrl(gameBridgeServer.Start());
webBrowserClient.LoadUrl(GameBridge.GetFilePath());

// Get the JavaScript API call for posting messages from the web page to the Unity application
string postMessageApiCall = webBrowserClient.GetPostMessageApiCall();
Expand All @@ -64,8 +59,6 @@ public void LaunchAuthURL(string url, string? redirectUri)
public void Dispose()
{
webBrowserClient.Dispose();
gameBridgeServer?.Dispose();
gameBridgeServer = null;
}
}
}
Expand Down
Loading