6
6
using UnityEngine . UI ;
7
7
using Immutable . Passport . Core . Logging ;
8
8
9
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
9
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
10
10
using Vuplex . WebView ;
11
11
#endif
12
12
@@ -20,8 +20,8 @@ namespace Immutable.Passport
20
20
public class AndroidVuplexWebView : IPassportWebView
21
21
{
22
22
private const string TAG = "[AndroidVuplexWebView]" ;
23
-
24
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
23
+
24
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
25
25
private CanvasWebViewPrefab ? _webViewPrefab ;
26
26
#endif
27
27
private readonly Dictionary < string , Action < string > > _jsHandlers = new Dictionary < string , Action < string > > ( ) ;
@@ -33,7 +33,7 @@ public class AndroidVuplexWebView : IPassportWebView
33
33
public event Action ? OnLoadStarted ;
34
34
35
35
// Safe access - check initialization
36
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
36
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
37
37
public bool IsVisible => _webViewPrefab ? . Visible ?? false ;
38
38
public string CurrentUrl => _webViewPrefab ? . WebView ? . Url ?? "" ;
39
39
#else
@@ -54,7 +54,7 @@ public void Initialize(PassportWebViewConfig config)
54
54
return ;
55
55
}
56
56
57
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
57
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
58
58
try
59
59
{
60
60
PassportLogger . Info ( $ "{ TAG } Initializing Vuplex WebView...") ;
@@ -73,7 +73,7 @@ public void Initialize(PassportWebViewConfig config)
73
73
#endif
74
74
}
75
75
76
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
76
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
77
77
private async UniTaskVoid InitializeAsync ( PassportWebViewConfig config )
78
78
{
79
79
try
@@ -134,7 +134,7 @@ private async UniTaskVoid InitializeAsync(PassportWebViewConfig config)
134
134
135
135
public void LoadUrl ( string url )
136
136
{
137
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
137
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
138
138
if ( ! _isInitialized || _webViewPrefab ? . WebView == null )
139
139
{
140
140
PassportLogger . Error ( $ "{ TAG } Cannot load URL - WebView not initialized") ;
@@ -149,7 +149,7 @@ public void LoadUrl(string url)
149
149
150
150
public void Show ( )
151
151
{
152
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
152
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
153
153
if ( _webViewPrefab != null )
154
154
{
155
155
_webViewPrefab . Visible = true ;
@@ -159,7 +159,7 @@ public void Show()
159
159
160
160
public void Hide ( )
161
161
{
162
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
162
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
163
163
if ( _webViewPrefab != null )
164
164
{
165
165
_webViewPrefab . Visible = false ;
@@ -169,7 +169,7 @@ public void Hide()
169
169
170
170
public void ExecuteJavaScript ( string js )
171
171
{
172
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
172
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
173
173
if ( ! _isInitialized || _webViewPrefab ? . WebView == null )
174
174
{
175
175
PassportLogger . Error ( $ "{ TAG } Cannot execute JavaScript - WebView not initialized") ;
@@ -184,7 +184,7 @@ public void RegisterJavaScriptMethod(string methodName, Action<string> handler)
184
184
{
185
185
_jsHandlers [ methodName ] = handler ;
186
186
187
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
187
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
188
188
if ( _isInitialized && _webViewPrefab ? . WebView != null )
189
189
{
190
190
ExecuteJavaScript ( $ "window.{ methodName } =d=>window.vuplex?.postMessage('{ methodName } :'+(typeof d==='object'?JSON.stringify(d):d))") ;
@@ -194,7 +194,7 @@ public void RegisterJavaScriptMethod(string methodName, Action<string> handler)
194
194
195
195
public void Dispose ( )
196
196
{
197
- #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
197
+ #if UNITY_ANDROID && ! UNITY_EDITOR && VUPLEX_AVAILABLE && VUPLEX_AVAILABLE
198
198
if ( _webViewPrefab != null )
199
199
{
200
200
_webViewPrefab . Destroy ( ) ;
0 commit comments