Skip to content

Commit 05d0089

Browse files
committed
fix: compilation flags
1 parent 9779695 commit 05d0089

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

sample/Assets/Scripts/AuthenticatedScript.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ public async void Logout()
189189
try
190190
{
191191
ShowOutput("Logging out...");
192+
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
192193
if (SampleAppManager.UsePKCE)
193194
{
194195
await passport.LogoutPKCE();
@@ -197,6 +198,9 @@ public async void Logout()
197198
{
198199
await passport.Logout();
199200
}
201+
#else
202+
await passport.Logout();
203+
#endif
200204
SampleAppManager.IsConnected = false;
201205
passport.OnAuthEvent -= OnPassportAuthEvent;
202206
SceneManager.LoadScene(sceneName: "UnauthenticatedScene");

sample/Assets/Scripts/UnauthenticatedScript.cs

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ public async void Login()
121121
ShowOutput("Called Login()...");
122122
LoginButton.gameObject.SetActive(false);
123123

124+
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
124125
if (SampleAppManager.UsePKCE)
125126
{
126127
await passport.LoginPKCE();
@@ -129,6 +130,9 @@ public async void Login()
129130
{
130131
await passport.Login();
131132
}
133+
#else
134+
await passport.Login();
135+
#endif
132136

133137
SampleAppManager.IsConnected = false;
134138
NavigateToAuthenticatedScene();
@@ -189,6 +193,7 @@ public async void Connect()
189193
ShowOutput("Called Connect()...");
190194
ConnectButton.gameObject.SetActive(false);
191195

196+
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
192197
if (SampleAppManager.UsePKCE)
193198
{
194199
await passport.ConnectImxPKCE();
@@ -197,6 +202,9 @@ public async void Connect()
197202
{
198203
await passport.ConnectImx();
199204
}
205+
#else
206+
await passport.ConnectImx();
207+
#endif
200208

201209
SampleAppManager.IsConnected = true;
202210
NavigateToAuthenticatedScene();
@@ -252,13 +260,24 @@ public async void Reconnect()
252260

253261
private async UniTask Logout()
254262
{
255-
if (SampleAppManager.UsePKCE)
263+
try
256264
{
257-
await passport.LogoutPKCE();
265+
#if (UNITY_ANDROID && !UNITY_EDITOR_WIN) || (UNITY_IPHONE && !UNITY_EDITOR_WIN) || UNITY_STANDALONE_OSX
266+
if (SampleAppManager.UsePKCE)
267+
{
268+
await passport.LogoutPKCE();
269+
}
270+
else
271+
{
272+
await passport.Logout();
273+
}
274+
#else
275+
await passport.Logout();
276+
#endif
258277
}
259-
else
278+
catch (Exception ex)
260279
{
261-
await passport.Logout();
280+
ShowOutput($"Logout() error: {ex.Message}");
262281
}
263282
}
264283

0 commit comments

Comments
 (0)