Skip to content

Commit

Permalink
Merge pull request #144 from immutable/docs/dx-3340
Browse files Browse the repository at this point in the history
docs: add documentation to passport methods (#3340)
  • Loading branch information
ImmutableJeffrey authored Oct 20, 2024
2 parents 039edd3 + 715efb0 commit 1941bbe
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
7 changes: 5 additions & 2 deletions Source/Immutable/Public/Immutable/ImmutableDataTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ struct IMMUTABLE_API FImmutablePassportInitData
{
GENERATED_BODY()

/** The Client Id. */
/** The Client ID. */
UPROPERTY()
FString clientId;

Expand All @@ -65,7 +65,10 @@ struct IMMUTABLE_API FImmutablePassportInitData
UPROPERTY()
FString environment = ImmutablePassportAction::EnvSandbox;

/** Whether silent logout is enabled. */
/**
* Whether silent logout is enabled.
* If true, logout silently (without popping up a new browser tab)
*/
UPROPERTY()
bool isSilentLogout = false;

Expand Down
20 changes: 14 additions & 6 deletions Source/Immutable/Public/Immutable/ImmutablePassport.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,18 @@ class IMMUTABLE_API UImmutablePassport : public UObject
* This will open the user's default browser and take them through Passport login.
* @param IsConnectImx If true, the "re-connect" method is used to authenticate into Passport with Immutable X.
* Else, "re-login" is used for authentication. To access a wallet with Immutable X or zkEVM later, you must call "Connect" again with this value set to true, or use "ConnectEvm."
* @param TryToRelogin If true, the game bridge will use a cached session to re-connect or re-login the user, avoiding the need for a web browser. If this attempt fails, it will fall back to device code authentication.
* @param TryToRelogin If true, the game bridge will use a cached session to re-connect or re-login the user, avoiding the need to open a web browser. If this attempt fails, it will fall back to device code authentication.
* @param ResponseDelegate Callback delegate.
*/
void Connect(bool IsConnectImx, bool TryToRelogin, const FImtblPassportResponseDelegate& ResponseDelegate);
#if PLATFORM_ANDROID | PLATFORM_IOS | PLATFORM_MAC
/**
* (Android, iOS and macOS only) Logs into Passport using Authorisation Code Flow with Proof Key for Code Exchange (PKCE)
*
* @param IsConnectImx If true, player will go through the device code auth login flow and connect to Immutable X.
* Else, initiate only the device auth login flow.
* @param ResponseDelegate Callback delegate.
*/
void ConnectPKCE(bool IsConnectImx, const FImtblPassportResponseDelegate& ResponseDelegate);
#endif

Expand Down Expand Up @@ -277,7 +284,7 @@ class IMMUTABLE_API UImmutablePassport : public UObject
void HandleCustomTabsDismissed(FString Url);
#elif PLATFORM_IOS | PLATFORM_MAC
/**
* Handle deep linking. This is called from Objective-C.
* Handle deep linking. This is called from iOS/Mac native code.
*
* @param DeepLink The deep link URL, passed from the iOS/Mac. This string contains the deep link data to be processed.
*/
Expand Down Expand Up @@ -325,12 +332,12 @@ class IMMUTABLE_API UImmutablePassport : public UObject
void ReinstateConnection(FImtblJSResponse Response);

/**
* Checks if the passport has been initialised before allowing an action to proceed.
* Checks if Passport has been initialised before allowing an action to proceed.
*
* @param Action The name of the JavaScript action to be called. Used for logging purposes.
* @param ResponseDelegate Delegate to handle the response if the passport is not initialised.
*
* @return True if the passport is initialised, otherwise, false.
* @return True if Passport is initialised, otherwise, false.
*/
bool CheckIsInitialized(const FString& Action, const FImtblPassportResponseDelegate& ResponseDelegate) const;

Expand Down Expand Up @@ -435,7 +442,8 @@ class IMMUTABLE_API UImmutablePassport : public UObject
void CallJniStaticVoidMethod(JNIEnv* Env, const jclass Class, jmethodID Method, ...);

/**
* Launches a URL on Android using JNI.
* Opens a specified URL on Android using Chrome Custom Tabs via JNI if Chrome is installed.
* Else, it launches the URL in any available browser.
*
* @param Url The URL to launch.
*/
Expand Down Expand Up @@ -489,7 +497,7 @@ class IMMUTABLE_API UImmutablePassport : public UObject

private:
/**
* Saves the current passport settings to save game object.
* Saves the current Passport settings to save game object.
*/
void SavePassportSettings();

Expand Down

0 comments on commit 1941bbe

Please sign in to comment.