Skip to content

Commit

Permalink
Merge pull request #503 from Web3Auth/pnp-update-v5
Browse files Browse the repository at this point in the history
docs update for pnp android v5
  • Loading branch information
shahbaz17 authored Oct 12, 2023
2 parents 9827947 + 92ec403 commit f3bee63
Show file tree
Hide file tree
Showing 6 changed files with 154 additions and 16 deletions.
125 changes: 125 additions & 0 deletions docs/pnp/migration-guides/android-v4-to-v5.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
title: PnP Android SDK - v4 to v5
displayed_sidebar: docs
description: "PnP Android SDK - v4 to v5 | Documentation - Web3Auth"
sidebar_label: v4 to v5
---

import TabItem from "@theme/TabItem";
import Tabs from "@theme/Tabs";

## General

### openlogin v5 is supported

With V5, Users can now log in from sapphire mainnet and sapphire testnet.

```tsx
// With V5
// highlight-start
web3Auth = Web3Auth(
Web3AuthOptions(
...
// highlight-start
network = Network.SAPPHIRE_MAINNET, // pass over the network you want to use (MAINNET or TESTNET or CYAN, AQUA, SAPPHIRE_MAINNET or SAPPHIRE_TESTNET) // highlight-end
...
)
)
```

### Android Compile and Target SDK: `34`.

In V5, android compile target sdk is changed from 33 to 34. If you previously used the target SDK with 33, update your build.gradle file.

```tsx
// With V5
android {
compileSdk 34

defaultConfig {
applicationId "com.sbz.web3authdemoapp"
minSdk 24
targetSdk 34
versionCode 1
versionName "1.0"
...

}
}
```

### Web3AuthOptions param configuration changed

In v5, the way parameters are configured has changed. The buildEnv parameter must be included. The whiteLabel parameter type and configuration has
changed. And, as mentioned earlier, the network type has been added.

#### change of WhiteLabel parameter configuration

<Tabs
defaultValue="v5"
values={[
{ label: "V4", value: "v4" },
{ label: "V5", value: "v5" },
]}
>

<TabItem value="v4">

| Parameter | Type | Mandatory | Description |
| ----------------- | ------------------ | --------- | ------------------------------------------------- |
| `name` | `String` | No | Name of your application |
| `logoLight` | `String` | No | Light logo for dark background |
| `logoDark` | `String` | No | Dark logo for light background |
| `defaultLanguage` | `String` | No | Default translation language to be used |
| `dark` | `Boolean` | No | If true, enables dark mode. Default is light mode |
| `theme` | `Map<String, Any>` | No | Whitelabel theme |

</TabItem>

<TabItem value="v5">

| Parameter | Type | Mandatory | Description |
| ----------------- | ------------------ | --------- | --------------------------------------- |
| `appName` | `String` | No | Name of your application |
| `appUrl` | `String` | No | Url of your application |
| `logoLight` | `String` | No | Light logo for dark background |
| `logoDark` | `String` | No | Dark logo for light background |
| `defaultLanguage` | `String` | No | Default translation language to be used |
| `mode` | `Boolean` | No | 3 Theme modes of the application |
| `theme` | `Map<String, Any>` | No | Whitelabel theme |
| `useLogoLoader` | `Boolean` | No | Loads the logo when loading |

</TabItem>

</Tabs>

Here's the example configuration of Web3AuthOptions.

```tsx
web3Auth = Web3Auth(
Web3AuthOptions(
context = this,
clientId = getString(R.string.web3auth_project_id), // pass over your Web3Auth Client ID from Developer Dashboard
network = Network.CYAN, // pass over the network you want to use (MAINNET or TESTNET or CYAN or AQUA or SAPPHIRE_MAINNET or SAPPHIRE_TESTNET)
// highlight-start
buildEnv = BuildEnv.TESTING, // 3 options available: PRODUCTION, STAGING, TESTING
// highlight-end
redirectUrl = Uri.parse("com.sbz.web3authdemoapp://auth"), // your app's redirect URL
// Optional parameters
// highlight-start
whiteLabel = WhiteLabelData(
"Web3Auth Android Auth0 Example", null, null, null, Language.EN, ThemeModes.LIGHT, true,
hashMapOf(
"primary" to "#eb5424"
)
),
// highlight-end
loginConfig = hashMapOf("jwt" to LoginConfigItem(
verifier = "web3auth-auth0-demo",
typeOfLogin = TypeOfLogin.JWT,
name = "Auth0 Login",
clientId = getString(R.string.web3auth_auth0_client_id)
))
)
)
```
4 changes: 2 additions & 2 deletions docs/sdk/pnp/android/android.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ authenticate users using Web3Auth. For using Web3Auth natively in Android, Web3A
key generated in a non-custodial way on successful user authentication. This authentication can be achieved by using any social login options that
Web3Auth supports or using a custom authentication flow of your choice.

#### This Documentation is based on `4.0.8` SDK Version.
#### This Documentation is based on `5.0.2` SDK Version.

## Requirements

- Android API version `24` or newer.
- Android Compile and Target SDK: `33`.
- Android Compile and Target SDK: `34`.
- Basic knowledge of Java or Kotlin Development.

## Resources
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/pnp/android/initialize.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ web3Auth = Web3Auth(
Web3AuthOptions(
context = this,
clientId = getString(R.string.web3auth_project_id), // pass over your Web3Auth Client ID from Developer Dashboard
network = Network.MAINNET, // pass over the network you want to use (MAINNET or TESTNET or CYAN or AQUA)
network = Network.MAINNET, // pass over the network you want to use (MAINNET or TESTNET or CYAN or AQUA or SAPPHIRE_MAINNET or SAPPHIRE_TESTNET)
redirectUrl = Uri.parse("{YOUR_APP_PACKAGE_NAME}://auth"), // your app's redirect URL
)
)
Expand Down
2 changes: 1 addition & 1 deletion docs/sdk/pnp/android/install.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Then, in your app-level `build.gradle` dependencies section, add the following:
dependencies {
// ...
// highlight-next-line
implementation 'com.github.Web3Auth:web3auth-android-sdk:4.0.8'
implementation 'com.github.Web3Auth:web3auth-android-sdk:5.0.2'
}
```

Expand Down
30 changes: 18 additions & 12 deletions docs/sdk/pnp/android/whitelabel.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,29 @@ Object called `whiteLabel`. This parameter takes another object called `WhiteLab

| Parameter | Type | Mandatory | Description |
| ----------------- | ------------------ | --------- | ------------------------------------------------- |
| `name` | `String` | No | Name of your application |
| `appName` | `String` | No | Name of your application |
| `appUrl` | `String` | No | Url of your application |
| `logoLight` | `String` | No | Light logo for dark background |
| `logoDark` | `String` | No | Dark logo for light background |
| `defaultLanguage` | `String` | No | Default translation language to be used |
| `dark` | `Boolean` | No | If true, enables dark mode. Default is light mode |
| `mode` | `Boolean` | No | 3 Theme modes of the application |
| `theme` | `Map<String, Any>` | No | Whitelabel theme |
| `useLogoLoader` | `Boolean` | No | Loads the logo when loading |

</TabItem>

<TabItem value="interface">

```kotlin
data class WhiteLabelData (
private var name : String? = null,
private var logoLight : String? = null,
private var logoDark : String? = null,
private var defaultLanguage : String? = "en",
private var dark : Boolean? = false,
private var theme : HashMap<String, String>? = null
data class WhiteLabelData(
private var appName: String? = null,
private var appUrl: String? = null,
private var logoLight: String? = null,
private var logoDark: String? = null,
private var defaultLanguage: Language? = Language.EN,
private var mode: ThemeModes? = null,
private var useLogoLoader: Boolean? = false,
private var theme: HashMap<String, String>? = null
)
```

Expand All @@ -65,11 +69,13 @@ web3Auth = Web3Auth (
// Optional whitelabel object
// highlight-start
whiteLabel = WhiteLabelData (
name = "Web3Auth Sample App",
appName = "Web3Auth Sample App",
appUrl = null,
logoLight = null,
logoDark = null,
defaultLanguage = "en", // en, de, ja, ko, zh, es, fr, pt, nl
dark = true,
defaultLanguage = Language.EN, // EN, DE, JA, KO, ZH, ES, FR, PT, NL
ThemeModes = ThemeModes.DARK, // LIGHT, DARK, AUTO
useLogoLoader = true,
theme = hashMapOf (
"primary" to "#229954"
)
Expand Down
7 changes: 7 additions & 0 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,13 @@ module.exports = {
collapsible: true,
items: ["pnp/migration-guides/no-modal-v6-to-v7", "pnp/migration-guides/no-modal-v5-to-v6"],
},
{
type: "category",
label: "PnP Android",
collapsed: true,
collapsible: true,
items: ["pnp/migration-guides/android-v4-to-v5"],
},

"pnp/migration-guides/rn-v3-to-v4",
],
Expand Down

1 comment on commit f3bee63

@vercel
Copy link

@vercel vercel bot commented on f3bee63 Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

web3auth-docs – ./

web3auth-docs-git-master-web3auth.vercel.app
web3auth-docs-web3auth.vercel.app
w3a-docs.vercel.app

Please sign in to comment.