Closed JohnyBoy-Games closed 1 year ago
Hi @JohnyBoy-Games , The login will trigger an exception with the error message if the user cancel it: https://github.com/magicblock-labs/Solana.Unity-SDK/blob/main/Runtime/codebase/SolanaMobileStack/SolanaMobileWalletAdapter.cs#L76 and not return any account.
Aren't you able to catch it? Be aware that the exception may not be triggered on the main thread.
Using unity internal logcat after clicking on connect your wallet the console returns this message in a loop
2023/07/02 17:39:51.689 23501 23951 Info IL2CPP [02/07/2023 17:39:51] ERROR WebSocket.connect Object reference not set to an instance of an object. 2023/07/02 17:39:52.190 23501 23951 Info IL2CPP [02/07/2023 17:39:52] FATAL ThreadPoolWorkQueue.Dispatch Connection refused
it doesn't prevent the game from working
when I press cancel the console returns this message
2023/07/02 17:39:52.324 23501 23501 Debug DecorView[] onWindowFocusChanged hasWindowFocus true 2023/07/02 17:39:52.324 23501 23501 Info HandWritingStubImpl isKeyboardTypeChanged: false 2023/07/02 17:39:52.324 23501 23501 Info HandWritingStubImpl refreshLastKeyboardType: 1 2023/07/02 17:39:52.324 23501 23501 Info HandWritingStubImpl getCurrentKeyboardType: 1 2023/07/02 17:39:52.326 23501 23501 Info HandWritingStubImpl isKeyboardTypeChanged: false 2023/07/02 17:39:52.331 23501 23501 Info HandWritingStubImpl isKeyboardTypeChanged: false 2023/07/02 17:39:52.342 23501 23541 Debug AudioTrack start(2874): prior state:STATE_STOPPED 2023/07/02 17:39:52.343 23501 23501 Debug MediaRouter onRestoreRoute() : route=RouteInfo{ name=Téléphone, description=null, status=null, category=RouteCategory{ name=Système types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null } 2023/07/02 17:39:52.343 23501 23501 Verbose MediaRouter Selecting route: RouteInfo{ name=Téléphone, description=null, status=null, category=RouteCategory{ name=Système types=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO groupable=false }, supportedTypes=ROUTE_TYPE_LIVE_AUDIO ROUTE_TYPE_LIVE_VIDEO , presentationDisplay=null }
I updated the code like this
if (!result.WasSuccessful) { try{ throw new Exception(result.Error.Message); }catch(Exception e){ Debug.Log(e.Message); return null; } }
the console does not display an error message, and does not return null, otherwise my logic should be able to continue I think that indeed nothing happens on the main thread when you click on cancel
It does not matter I display a button to manually cancel the action
This should have been solved in the latest SDK version, feel free to reopen if you are still having issues.
Describe the bug On android if the player cancels the connection, it looks like nothing is returned
To Reproduce try to deactivate all panels, then connect, cancel the connection, if null is returned re-activate the panel
Expected behavior
Screenshots
Desktop (please complete the following information):
Smartphone (please complete the following information):
Additional context