-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem: Function RestoreClient is not aysnc (fix #244, #255) #256
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does RestoreClient need to be async? To my understanding, it'll just load the session file (which ok, it could be async, but in general, sync should be fast?) and open a websocket connection (but that happens in a background)... is it just for the case to have a notification back to the game if the connection failed to be established?
Because it has noticeable blocking experience when I call it in ue 5.1, it has to be async. But previously when I tested on ue 4.27, not much blocking experience. |
Two events for notifications are another purpose: One is If connection failed, no events but errors. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I haven't tested it, but if laggy/blocking in 5.1, ok to make it async
/** | ||
* Used for `ConnectWalletConnect` | ||
*/ | ||
FString _description; | ||
FString _url; | ||
TArray<FString> _icon_urls; | ||
FString _name; | ||
int64 _chain_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should those be moved to be private fields instead of public fields? and perhaps grouped in a class/struct with a constructor that will initialise them, so that within the actor, it's guaranteed they are initialised?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh yes, should be in private.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked, already in private section:
play-unreal-plugin/Source/CronosPlayUnreal/Public/PlayCppSdkActor.h
Lines 208 to 242 in 8f26e0a
private: | |
static ::com::crypto::game_sdk::WalletconnectClient *_coreClient; | |
static const APlayCppSdkActor *_sdk; | |
// Internal session result, it will be set after successfully calling | |
// `EnsureSession` | |
FWalletConnectEnsureSessionResult _session_result; | |
/** | |
* RestoreClient delegate, called after calling | |
* `RestoreClient` | |
*/ | |
FRestoreClientDelegate OnRestoreClientDelegate; | |
/** | |
* InitializeWalletConnect delegate, called after calling | |
* `InitializeWalletConnect` | |
*/ | |
FInitializeWalletConnectDelegate OnInitializeWalletConnectDelegate; | |
/** | |
* EnsureSession delegate, called after calling `EnsureSession` | |
*/ | |
FEnsureSessionDelegate OnEnsureSessionDelegate; | |
/** | |
* Used for `ConnectWalletConnect` | |
*/ | |
FString _description; | |
FString _url; | |
TArray<FString> _icon_urls; | |
FString _name; | |
int64 _chain_id; | |
EConnectionType _connection_type = EConnectionType::URI_STRING; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They would be initialised when users call ConnectWalletConnect
, empty by default except Connection Type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's messy, so far I haven't found a better way to pass those values from ConnectWalletConnect to callback functions or functions called in callback functions, except private values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
👮🏻👮🏻👮🏻 !!!! REFERENCE THE PROBLEM YOUR ARE SOLVING IN THE PR TITLE AND DESCRIBE YOUR SOLUTION HERE !!!! DO NOT FORGET !!!! 👮🏻👮🏻👮🏻
PR Checklist:
Thank you for your code, it's appreciated! :)