-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1007 from Web3Auth/sfa-android-v3
[SFA Android] Update docs for v3
- Loading branch information
Showing
8 changed files
with
91 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
title: SFA Android SDK - v2.0.0 to v3.0.0 | ||
description: "SFA Android SDK - v2.0.0 to v3.0.0 | Documentation - Web3Auth" | ||
sidebar_label: v2.0.0 to v3.0.0 | ||
--- | ||
|
||
This migration guide provides steps for upgrading from version v2.0.0 to v3.0.0 of the SFA Android | ||
SDK. The guide outlines significant changes and enhancements. | ||
|
||
## Breaking Changes | ||
|
||
### initialize Method Changes | ||
|
||
In v3, the `initialize` method will now return void upon successful initialization instead of | ||
returning `SessionData`. After successful initialization, you can use the | ||
[getSessionData](/docs/sdk/sfa/sfa-android/usage/#get-session-data) method to check if the user is | ||
logged in or not. | ||
|
||
```kotlin | ||
val initializeCF = singleFactoreAuth.initialize(this.applicationContext) | ||
|
||
// remove-next-line | ||
initializeCF.whenComplete { sessionData, error -> | ||
// add-next-line | ||
initializeCF.whenComplete {_, error -> | ||
if (error != null) { | ||
// Handle error | ||
} | ||
// remove-start | ||
else if (sessionData != null) { | ||
// User is logged in | ||
} else { | ||
// User is not logged in | ||
} | ||
// remove-end | ||
// add-start | ||
let sessionData = singleFactorAuth.getSessionData() | ||
if(sessionData != null) { | ||
// User is logged in | ||
} else { | ||
// User is not logged in | ||
} | ||
// add-end | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
src/common/sdk/sfa/android/_sfa-android-initialization.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
```kotlin | ||
import android.content.Context | ||
import com.web3auth.singlefactorauth.SingleFactorAuth | ||
import com.web3auth.singlefactorauth.types.Web3AuthOptions | ||
import org.torusresearch.fetchnodedetails.types.Web3AuthNetwork | ||
|
||
// You can get the client id for your Web3Auth project from Web3Auth dashboard. | ||
val web3AuthOptions = Web3AuthOptions( | ||
"YOUR_WEB3AUTH_CLIENT_ID", | ||
Web3AuthNetwork.SAPPHIRE_MAINNET | ||
) | ||
|
||
val context: Context = "YOUR_APPLICATION_CONTEXT" | ||
val sessionDataCF = singleFactorAuth.initialize(context) | ||
|
||
val singleFactorAuth = SingleFactorAuth(web3AuthOptions, context) | ||
sessionDataCF.whenComplete {sessionData, error -> | ||
if(error != null) { | ||
// Something went wrong | ||
// Initiate the login flow again | ||
} else { | ||
// You can use the SessionData to check if the user is | ||
//logged in or not | ||
} | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
```kotlin | ||
import android.content.Context | ||
import com.web3auth.singlefactorauth.SingleFactorAuth | ||
import com.web3auth.singlefactorauth.types.Web3AuthOptions | ||
import org.torusresearch.fetchnodedetails.types.Web3AuthNetwork | ||
|
||
// You can get the client id for your Web3Auth project from Web3Auth dashboard. | ||
val web3AuthOptions = Web3AuthOptions( | ||
"YOUR_WEB3AUTH_CLIENT_ID", | ||
Web3AuthNetwork.SAPPHIRE_MAINNET | ||
) | ||
|
||
val context: Context = "YOUR_APPLICATION_CONTEXT" | ||
|
||
val singleFactorAuth = SingleFactorAuth(web3AuthOptions, context) | ||
``` |
20 changes: 0 additions & 20 deletions
20
src/common/sdk/sfa/android/_sfa-android-session-management.mdx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters