Skip to content

Commit

Permalink
Merge pull request #1200 from Web3Auth/mobile-updates
Browse files Browse the repository at this point in the history
Update Android, iOS And Flutter examples to latest
  • Loading branch information
shahbaz17 authored Jul 4, 2024
2 parents 317fa72 + f2e3195 commit b848f34
Show file tree
Hide file tree
Showing 73 changed files with 304 additions and 254 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dependencies {
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.github.web3auth:web3auth-android-sdk:7.4.0'
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.0'
implementation 'org.web3j:core:4.8.7-android'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.gson.Gson
import com.web3auth.core.Web3Auth
Expand Down Expand Up @@ -148,6 +149,15 @@ class MainActivity : AppCompatActivity() {
web3Auth.setResultUrl(intent?.data)
}

override fun onResume() {
super.onResume()
if (Web3Auth.getCustomTabsClosed()) {
Toast.makeText(this, "User closed the browser.", Toast.LENGTH_SHORT).show()
web3Auth.setResultUrl(null)
Web3Auth.setCustomTabsClosed(false)
}
}

private fun signInEP() {
val selectedLoginProvider = Provider.JWT
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(LoginParams(selectedLoginProvider, extraLoginOptions = ExtraLoginOptions(domain = "https://web3auth.au.auth0.com", verifierIdField = "email", isVerifierIdCaseSensitive = false)))
Expand Down
2 changes: 1 addition & 1 deletion android/android-auth0-example/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ dependencies {
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.github.web3auth:web3auth-android-sdk:7.4.0'
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.0'
implementation 'org.web3j:core:4.8.7-android'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.util.Log
import android.view.View
import android.widget.Button
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.gson.Gson
import com.web3auth.core.Web3Auth
Expand Down Expand Up @@ -45,7 +46,7 @@ class MainActivity : AppCompatActivity() {
setContentView(R.layout.activity_main)

web3 = Web3j.build(HttpService(rpcUrl))
loginParams = LoginParams(Provider.JWT, extraLoginOptions = ExtraLoginOptions(domain = "https://web3auth.au.auth0.com", verifierIdField = "email"))
loginParams = LoginParams(Provider.JWT, extraLoginOptions = ExtraLoginOptions(domain = "https://web3auth.au.auth0.com", verifierIdField = "sub"))

web3Auth = Web3Auth(
Web3AuthOptions(
Expand Down Expand Up @@ -140,6 +141,15 @@ class MainActivity : AppCompatActivity() {
web3Auth.setResultUrl(intent?.data)
}

override fun onResume() {
super.onResume()
if (Web3Auth.getCustomTabsClosed()) {
Toast.makeText(this, "User closed the browser.", Toast.LENGTH_SHORT).show()
web3Auth.setResultUrl(null)
Web3Auth.setCustomTabsClosed(false)
}
}

private fun signIn() {
val loginCompletableFuture: CompletableFuture<Web3AuthResponse> = web3Auth.login(loginParams)

Expand Down
2 changes: 1 addition & 1 deletion android/android-firebase-example/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ dependencies {
implementation 'com.google.android.material:material:1.7.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'com.github.web3auth:web3auth-android-sdk:7.4.0'
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.0'
implementation 'org.web3j:core:4.8.7-android'
implementation platform('com.google.firebase:firebase-bom:31.0.2')
implementation 'com.google.firebase:firebase-auth-ktx'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,15 @@ class MainActivity : AppCompatActivity() {
web3Auth.setResultUrl(intent?.data)
}

override fun onResume() {
super.onResume()
if (Web3Auth.getCustomTabsClosed()) {
Toast.makeText(this, "User closed the browser.", Toast.LENGTH_SHORT).show()
web3Auth.setResultUrl(null)
Web3Auth.setCustomTabsClosed(false)
}
}

private fun signIn() {
auth.signInWithEmailAndPassword("[email protected]", "Android@Web3Auth")
.addOnCompleteListener(this) { task ->
Expand Down
2 changes: 1 addition & 1 deletion android/android-playground/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
implementation("com.google.accompanist:accompanist-pager:0.13.0")
implementation("com.google.accompanist:accompanist-pager-indicators:0.27.1")
implementation("androidx.compose.material:material-icons-extended:1.6.7")
implementation("com.github.web3auth:web3auth-android-sdk:7.4.0")
implementation("com.github.web3auth:web3auth-android-sdk:8.0.0")
debugImplementation("androidx.compose.ui:ui-tooling:1.6.7")
implementation("androidx.compose.ui:ui-tooling-preview:1.6.7")
implementation("androidx.activity:activity-compose:1.9.0")
Expand Down
2 changes: 1 addition & 1 deletion android/android-quick-start/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ dependencies {
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'com.google.code.gson:gson:2.9.1'
// IMP START - Installation
implementation 'com.github.web3auth:web3auth-android-sdk:7.4.0'
implementation 'com.github.web3auth:web3auth-android-sdk:8.0.0'
// IMP END - Installation
implementation 'org.web3j:core:4.8.7-android'
testImplementation 'junit:junit:4.13.2'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import android.view.View
import android.widget.Button
import android.widget.EditText
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.google.gson.Gson
// IMP START - Quick Start
Expand Down Expand Up @@ -113,6 +114,15 @@ class MainActivity : AppCompatActivity() {
web3Auth.setResultUrl(intent?.data)
}

override fun onResume() {
super.onResume()
if (Web3Auth.getCustomTabsClosed()) {
Toast.makeText(this, "User closed the browser.", Toast.LENGTH_SHORT).show()
web3Auth.setResultUrl(null)
Web3Auth.setCustomTabsClosed(false)
}
}

private fun signIn() {
val email = emailInput.text.toString()
// IMP START - Login
Expand Down
2 changes: 1 addition & 1 deletion android/android-solana-example/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ dependencies {
implementation("androidx.compose.ui:ui-graphics")
implementation("androidx.compose.ui:ui-tooling-preview")
implementation("androidx.compose.material3:material3")
implementation("com.github.Web3Auth:web3auth-android-sdk:7.4.0")
implementation("com.github.Web3Auth:web3auth-android-sdk:8.0.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.5")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.1")
Expand Down
47 changes: 15 additions & 32 deletions flutter/flutter-aggregate-verifier-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
PODS:
- BigInt (5.0.0)
- CryptoSwift (1.8.1)
- BigInt (5.2.0)
- curvelib.swift (1.0.1)
- Flutter (1.0.0)
- GenericJSON (2.0.2)
- KeychainSwift (20.0.0)
- Logging (1.0.0)
- secp256k1.swift (0.1.4)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- TorusSessionManager (3.0.1):
- CryptoSwift (~> 1.8.0)
- TorusSessionManager (4.0.2):
- curvelib.swift (~> 1.0.1)
- KeychainSwift (~> 20.0.0)
- web3.swift (~> 1.6.0)
- web3.swift (1.6.0):
- BigInt (~> 5.0.0)
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- Web3Auth (7.4.1):
- CryptoSwift (~> 1.8.0)
- Web3Auth (9.0.0):
- BigInt (~> 5.2.0)
- curvelib.swift (~> 1.0.1)
- KeychainSwift (~> 20.0.0)
- TorusSessionManager (~> 3.0.1)
- web3.swift (~> 1.6.0)
- TorusSessionManager (~> 4.0.2)
- web3auth_flutter (2.0.1):
- Flutter
- Web3Auth (~> 7.4.1)
- Web3Auth (~> 9.0.0)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -35,13 +26,9 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- BigInt
- CryptoSwift
- GenericJSON
- curvelib.swift
- KeychainSwift
- Logging
- secp256k1.swift
- TorusSessionManager
- web3.swift
- Web3Auth

EXTERNAL SOURCES:
Expand All @@ -53,18 +40,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/web3auth_flutter/ios"

SPEC CHECKSUMS:
BigInt: 74b4d88367b0e819d9f77393549226d36faeb0d8
CryptoSwift: b9c701d6f5011df23794dbf7f2e480a77835d83d
BigInt: f668a80089607f521586bbe29513d708491ef2f7
curvelib.swift: d0746ae82bee34016c06da3567a97e493b3c979f
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
GenericJSON: 79a840eeb77030962e8cf02a62d36bd413b67626
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
TorusSessionManager: 829495789427b7ad7e29f2b535092a44f3900b42
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
Web3Auth: faf43a674c0db748dd4ff7fbe29a355d8736a186
web3auth_flutter: 208348cb4e01e0c0191adf740188c3b63f5fe20b
TorusSessionManager: 05a1a8f3265d0949a1a342c4ba2c52882445b614
Web3Auth: 086b5152a43df347ceff196c0ce67f6330838884
web3auth_flutter: bc5ffefe573c72f7fb1814573269952b045b7b22

PODFILE CHECKSUM: 775997f741c536251164e3eacf6e34abf2eb7a17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
15 changes: 15 additions & 0 deletions flutter/flutter-aggregate-verifier-example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
void initState() {
super.initState();
initPlatformState();
WidgetsBinding.instance.addObserver(this);
}

@override
void dispose() {
super.dispose();
WidgetsBinding.instance.removeObserver(this);
}

@override
void didChangeAppLifecycleState(final AppLifecycleState state) {
// This is important to trigger the on Android.
if (state == AppLifecycleState.resumed) {
Web3AuthFlutter.setCustomTabsClosed();
}
}

// Platform messages are asynchronous, so we initialize in an async method.
Expand Down
4 changes: 2 additions & 2 deletions flutter/flutter-aggregate-verifier-example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -473,10 +473,10 @@ packages:
dependency: "direct main"
description:
name: web3auth_flutter
sha256: "81a2370c0871b0c1a8253b1b5ac2803e5ffd1cd928c2ab0fb963b8e68f84a9ed"
sha256: "99d9a1e5a5e66094fb852672062fe7ea43ac69a47c824554999fef5da1d2fe5b"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "5.0.2"
web3dart:
dependency: "direct main"
description:
Expand Down
2 changes: 1 addition & 1 deletion flutter/flutter-aggregate-verifier-example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
web3auth_flutter: ^4.0.0
web3auth_flutter: ^5.0.2
web3dart: ^2.7.2
shared_preferences: ^2.2.2
http: ^1.2.0
Expand Down
47 changes: 15 additions & 32 deletions flutter/flutter-auth0-example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,31 +1,22 @@
PODS:
- BigInt (5.0.0)
- CryptoSwift (1.8.1)
- BigInt (5.2.0)
- curvelib.swift (1.0.1)
- Flutter (1.0.0)
- GenericJSON (2.0.2)
- KeychainSwift (20.0.0)
- Logging (1.0.0)
- secp256k1.swift (0.1.4)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- TorusSessionManager (3.0.1):
- CryptoSwift (~> 1.8.0)
- TorusSessionManager (4.0.2):
- curvelib.swift (~> 1.0.1)
- KeychainSwift (~> 20.0.0)
- web3.swift (~> 1.6.0)
- web3.swift (1.6.0):
- BigInt (~> 5.0.0)
- GenericJSON (~> 2.0)
- Logging (~> 1.0.0)
- secp256k1.swift (~> 0.1)
- Web3Auth (7.4.1):
- CryptoSwift (~> 1.8.0)
- Web3Auth (9.0.0):
- BigInt (~> 5.2.0)
- curvelib.swift (~> 1.0.1)
- KeychainSwift (~> 20.0.0)
- TorusSessionManager (~> 3.0.1)
- web3.swift (~> 1.6.0)
- TorusSessionManager (~> 4.0.2)
- web3auth_flutter (2.0.1):
- Flutter
- Web3Auth (~> 7.4.1)
- Web3Auth (~> 9.0.0)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -35,13 +26,9 @@ DEPENDENCIES:
SPEC REPOS:
trunk:
- BigInt
- CryptoSwift
- GenericJSON
- curvelib.swift
- KeychainSwift
- Logging
- secp256k1.swift
- TorusSessionManager
- web3.swift
- Web3Auth

EXTERNAL SOURCES:
Expand All @@ -53,18 +40,14 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/web3auth_flutter/ios"

SPEC CHECKSUMS:
BigInt: 74b4d88367b0e819d9f77393549226d36faeb0d8
CryptoSwift: b9c701d6f5011df23794dbf7f2e480a77835d83d
BigInt: f668a80089607f521586bbe29513d708491ef2f7
curvelib.swift: d0746ae82bee34016c06da3567a97e493b3c979f
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
GenericJSON: 79a840eeb77030962e8cf02a62d36bd413b67626
KeychainSwift: 0ce6a4d13f7228054d1a71bb1b500448fb2ab837
Logging: 9ef4ecb546ad3169398d5a723bc9bea1c46bef26
secp256k1.swift: a7e7a214f6db6ce5db32cc6b2b45e5c4dd633634
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
TorusSessionManager: 829495789427b7ad7e29f2b535092a44f3900b42
web3.swift: 2263d1e12e121b2c42ffb63a5a7beb1acaf33959
Web3Auth: faf43a674c0db748dd4ff7fbe29a355d8736a186
web3auth_flutter: 208348cb4e01e0c0191adf740188c3b63f5fe20b
TorusSessionManager: 05a1a8f3265d0949a1a342c4ba2c52882445b614
Web3Auth: 086b5152a43df347ceff196c0ce67f6330838884
web3auth_flutter: bc5ffefe573c72f7fb1814573269952b045b7b22

PODFILE CHECKSUM: 775997f741c536251164e3eacf6e34abf2eb7a17

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1430;
LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1430"
LastUpgradeVersion = "1510"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Loading

0 comments on commit b848f34

Please sign in to comment.