Skip to content

Commit

Permalink
Merge pull request #95 from WalletConnect/feature/email_login_new
Browse files Browse the repository at this point in the history
Email Login (beta version)
  • Loading branch information
quetool authored Mar 26, 2024
2 parents 550913d + 8c123fe commit aa94215
Show file tree
Hide file tree
Showing 76 changed files with 3,652 additions and 562 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## 3.1.3-beta01
## 3.2.0-beta01

- Email Login support
- Analytics API support

## 3.1.2
Expand Down
3 changes: 3 additions & 0 deletions assets/icons/mail.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/regular/wallet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions assets/icons/verif.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions assets/icons/wc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
versionName=3.1.3
versionCode=40
versionName=3.2.0
versionCode=42
6 changes: 6 additions & 0 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ PODS:
- FMDB (>= 2.7.5)
- url_launcher_ios (0.0.1):
- Flutter
- webview_flutter_wkwebview (0.0.1):
- Flutter

DEPENDENCIES:
- appcheck (from `.symlinks/plugins/appcheck/ios`)
Expand All @@ -37,6 +39,7 @@ DEPENDENCIES:
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite (from `.symlinks/plugins/sqflite/ios`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
- webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/ios`)

SPEC REPOS:
trunk:
Expand All @@ -62,6 +65,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/sqflite/ios"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
webview_flutter_wkwebview:
:path: ".symlinks/plugins/webview_flutter_wkwebview/ios"

SPEC CHECKSUMS:
appcheck: e1ab9d4e03736f03e0401554a134d1ed502d7629
Expand All @@ -75,6 +80,7 @@ SPEC CHECKSUMS:
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
url_launcher_ios: bf5ce03e0e2088bad9cc378ea97fa0ed5b49673b
webview_flutter_wkwebview: 4f3e50f7273d31e5500066ed267e3ae4309c5ae4

PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5

Expand Down
12 changes: 6 additions & 6 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
Expand All @@ -496,7 +496,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
Expand All @@ -514,7 +514,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
Expand All @@ -530,7 +530,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
Expand Down Expand Up @@ -655,7 +655,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -686,7 +686,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
CURRENT_PROJECT_VERSION = 40;
CURRENT_PROJECT_VERSION = 42;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>3.1.3</string>
<string>3.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
Expand All @@ -36,7 +36,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>40</string>
<string>42</string>
<key>ITSAppUsesNonExemptEncryption</key>
<false/>
<key>LSApplicationQueriesSchemes</key>
Expand Down
102 changes: 68 additions & 34 deletions example/lib/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:web3modal_flutter/utils/util.dart';

import 'package:web3modal_flutter/web3modal_flutter.dart';

Expand Down Expand Up @@ -39,13 +40,13 @@ class _MyHomePageState extends State<MyHomePage> {

void _initializeService() async {
// See https://docs.walletconnect.com/web3modal/flutter/custom-chains
W3MChainPresets.chains.putIfAbsent(_celo.chainId, () => _celo);
W3MChainPresets.chains.putIfAbsent(_sepolia.chainId, () => _sepolia);

_w3mService = W3MService(
projectId: DartDefines.projectId,
logLevel: LogLevel.error,
enableAnalytics: true,
enableAnalytics: true, // Optional - null by default
enableEmail: true, // Optional - false by default
metadata: const PairingMetadata(
name: StringConstants.w3mPageTitleV3,
description: StringConstants.w3mPageTitleV3,
Expand All @@ -62,6 +63,7 @@ class _MyHomePageState extends State<MyHomePage> {
// 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase Wallet
// },
// includedWalletIds: {
// 'a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393', // Phantom
// 'c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96', // Metamask
// '1ae92b26df02f0abca6304df07debccd18262fdf5fe82daa81593582dac9a369', // Rainbow
// 'fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa', // Coinbase Wallet
Expand Down Expand Up @@ -112,17 +114,18 @@ class _MyHomePageState extends State<MyHomePage> {
}

void _onModalConnect(ModalConnect? event) {
debugPrint('[$runtimeType] modal connect ${event?.toString()}');
debugPrint('[$runtimeType] modal connect ${event?.session.address}');
debugPrint('[$runtimeType] modal connect ${_w3mService.session?.address}');
debugPrint('[$runtimeType] 1 _onModalConnect ${event?.toString()}');
debugPrint('[$runtimeType] 2 _onModalConnect ${event?.session.address}');
debugPrint(
'[$runtimeType] 3 _onModalConnect ${_w3mService.session?.address}');
}

void _onModalDisconnect(ModalDisconnect? event) {
debugPrint('[$runtimeType] modal disconnect ${event?.toString()}');
debugPrint('[$runtimeType] 1 _onModalDisconnect ${event?.toString()}');
}

void _onModalError(ModalError? event) {
debugPrint('[$runtimeType] _onModalError ${event?.toString()}');
debugPrint('[$runtimeType] modal error ${event?.toString()}');
// When user connected to Coinbase Wallet but Coinbase Wallet does not have a session anymore
// (for instance if user disconnected the dapp directly within Coinbase Wallet)
// Then Coinbase Wallet won't emit any event
Expand Down Expand Up @@ -172,21 +175,25 @@ class _MyHomePageState extends State<MyHomePage> {
),
],
),
body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox.square(dimension: 4.0),
Text(
'Custom theme is: ${isCustom ? 'ON' : 'OFF'}',
style: TextStyle(
color: Web3ModalTheme.colorsOf(context).foreground100,
body: RefreshIndicator(
onRefresh: () => _w3mService.loadAccountData(),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
const SizedBox.square(dimension: 4.0),
Text(
'Custom theme is: ${isCustom ? 'ON' : 'OFF'}',
style: TextStyle(
color: Web3ModalTheme.colorsOf(context).foreground100,
),
),
),
_ButtonsView(w3mService: _w3mService),
const Divider(height: 0.0, color: Colors.transparent),
_ConnectedView(w3mService: _w3mService)
],
_ButtonsView(w3mService: _w3mService),
// _CustomButtonsView(w3mService: _w3mService),
const Divider(height: 0.0, color: Colors.transparent),
_ConnectedView(w3mService: _w3mService)
],
),
),
),
);
Expand All @@ -207,6 +214,45 @@ class _ButtonsView extends StatelessWidget {
child: W3MNetworkSelectButton(service: w3mService),
),
W3MConnectWalletButton(service: w3mService),
// W3MAccountButton(service: w3mService),
const SizedBox.square(dimension: 8.0),
],
);
}
}

// ignore: unused_element
class _CustomButtonsView extends StatelessWidget {
const _CustomButtonsView({required this.w3mService});
final W3MService w3mService;

@override
Widget build(BuildContext context) {
// if (w3mService.status.isLoading) {
// return const Center(
// child: CircularProgressIndicator(),
// );
// }
return Column(
children: [
const SizedBox.square(dimension: 8.0),
Visibility(
visible: !w3mService.isConnected,
child: ElevatedButton(
onPressed: () {
w3mService.openNetworks(context);
},
child: const Text('OPEN CHAINS'),
),
),
ElevatedButton(
onPressed: () {
w3mService.openModal(context);
},
child: w3mService.isConnected
? Text(Util.truncate(w3mService.session!.address!))
: const Text('CONNECT WALLET'),
),
const SizedBox.square(dimension: 8.0),
],
);
Expand Down Expand Up @@ -239,23 +285,11 @@ class _ConnectedView extends StatelessWidget {
}
}

final _celo = W3MChainInfo(
chainName: 'Celo',
namespace: 'eip155:42220',
chainId: '42220',
tokenName: 'CELO',
rpcUrl: 'https://forno.celo.org/',
blockExplorer: W3MBlockExplorer(
name: 'Celo Explorer',
url: 'https://explorer.celo.org/mainnet',
),
);

final _sepolia = W3MChainInfo(
chainName: 'Sepolia Testnet',
chainId: '11155111',
namespace: 'eip155:11155111',
tokenName: 'ETH',
tokenName: 'SEP',
rpcUrl: 'https://ethereum-sepolia.publicnode.com',
blockExplorer: W3MBlockExplorer(
name: 'Sepolia Etherscan',
Expand Down
36 changes: 18 additions & 18 deletions example/lib/utils/crypto/chain_data_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ class ChainDataWrapper {
static final List<ChainMetadata> chains = [
ChainMetadata(
type: ChainType.eip155,
color: Colors.blue.shade300,
color: Colors.blue,
w3mChainInfo: W3MChainPresets.chains['1']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.purple.shade300,
w3mChainInfo: W3MChainPresets.chains['137']!,
color: Colors.cyan,
w3mChainInfo: W3MChainPresets.chains['42161']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.purple.shade900,
w3mChainInfo: W3MChainPresets.chains['42161']!,
color: Colors.purple,
w3mChainInfo: W3MChainPresets.chains['137']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.red.shade400,
color: Colors.red.shade300,
w3mChainInfo: W3MChainPresets.chains['43114']!,
),
ChainMetadata(
Expand All @@ -31,33 +31,33 @@ class ChainDataWrapper {
),
ChainMetadata(
type: ChainType.eip155,
color: const Color(0xFF123962),
w3mChainInfo: W3MChainPresets.chains['250']!,
color: Colors.red.shade900,
w3mChainInfo: W3MChainPresets.chains['10']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.red.shade700,
w3mChainInfo: W3MChainPresets.chains['10']!,
color: Colors.green.shade900,
w3mChainInfo: W3MChainPresets.chains['100']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.blue.shade800,
w3mChainInfo: W3MChainPresets.chains['9001']!,
color: Colors.purple.shade50,
w3mChainInfo: W3MChainPresets.chains['324']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.purple.shade800,
w3mChainInfo: W3MChainPresets.chains['4689']!,
color: Colors.blue.shade100,
w3mChainInfo: W3MChainPresets.chains['8453']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.purple.shade700,
w3mChainInfo: W3MChainPresets.chains['1088']!,
color: Colors.yellow,
w3mChainInfo: W3MChainPresets.chains['42220']!,
),
ChainMetadata(
type: ChainType.eip155,
color: Colors.blue.shade200,
w3mChainInfo: W3MChainPresets.chains['11155111']!,
color: Colors.green.shade100,
w3mChainInfo: W3MChainPresets.chains['1313161554']!,
),
// const ChainMetadata(
// type: ChainType.solana,
Expand Down
Loading

0 comments on commit aa94215

Please sign in to comment.