diff --git a/CHANGELOG.md b/CHANGELOG.md
index 51b16931..275e9087 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+## 3.1.0-beta03
## 3.1.0-beta02
- Improvements and bug fixes
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 037b48b5..71dd6d3a 100644
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
versionName=3.1.0
-versionCode=26
+versionCode=27
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index d39bbcd5..5999f2e9 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -470,7 +470,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
@@ -496,7 +496,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -514,7 +514,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -530,7 +530,7 @@
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.0;
PRODUCT_BUNDLE_IDENTIFIER = com.web3modal.flutterExample.RunnerTests;
@@ -655,7 +655,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
@@ -686,7 +686,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 26;
+ CURRENT_PROJECT_VERSION = 27;
DEVELOPMENT_TEAM = "";
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = W5R8AG9K22;
ENABLE_BITCODE = NO;
diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist
index ccfd4404..ba99cff6 100644
--- a/example/ios/Runner/Info.plist
+++ b/example/ios/Runner/Info.plist
@@ -36,7 +36,7 @@
CFBundleVersion
- 26
+ 27
ITSAppUsesNonExemptEncryption
LSApplicationQueriesSchemes
diff --git a/example/lib/widgets/session_widget.dart b/example/lib/widgets/session_widget.dart
index 70d88268..8d19391f 100644
--- a/example/lib/widgets/session_widget.dart
+++ b/example/lib/widgets/session_widget.dart
@@ -76,12 +76,13 @@ class SessionWidgetState extends State {
final currentNamespace = widget.w3mService.selectedChain!.namespace;
final chainsNamespaces = NamespaceUtils.getChainsFromAccounts(accounts);
if (chainsNamespaces.contains(currentNamespace)) {
- final account = accounts
- .firstWhere((account) => account.contains(currentNamespace));
+ final account = accounts.firstWhere(
+ (account) => account.contains('$currentNamespace:'),
+ );
children.add(_buildAccountWidget(account));
}
} catch (e) {
- debugPrint(e.toString());
+ debugPrint('[$runtimeType] ${e.toString()}');
}
return Padding(
diff --git a/example/pubspec.lock b/example/pubspec.lock
index 86c4b3bc..582dc5bc 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -1065,10 +1065,10 @@ packages:
dependency: transitive
description:
name: walletconnect_flutter_v2
- sha256: a3654aa71221f15be6b20663759fad3eb3a37dc486f72860d7eb69c1e39d682b
+ sha256: e26ca98cfd6b8d5dc9c5f7e581999ab314d5134c0ffcddb73ef750f13b322d9c
url: "https://pub.dev"
source: hosted
- version: "2.1.12"
+ version: "2.1.13"
watcher:
dependency: transitive
description:
@@ -1099,7 +1099,7 @@ packages:
path: ".."
relative: true
source: path
- version: "3.1.0-beta02"
+ version: "3.1.0-beta03"
web_socket_channel:
dependency: transitive
description:
diff --git a/lib/services/explorer_service/explorer_service.dart b/lib/services/explorer_service/explorer_service.dart
index 31692c4b..c8244f82 100644
--- a/lib/services/explorer_service/explorer_service.dart
+++ b/lib/services/explorer_service/explorer_service.dart
@@ -271,7 +271,6 @@ class ExplorerService implements IExplorerService {
StringConstants.connectedWalletData,
walletDataString,
);
- await storeRecentWalletId(walletInfo.listing.id);
await _updateRecentWalletId(walletInfo, walletId: walletInfo.listing.id);
}
@@ -308,29 +307,32 @@ class ExplorerService implements IExplorerService {
W3MWalletInfo? walletInfo, {
String? walletId,
}) async {
- final recentId = walletInfo?.listing.id ?? walletId ?? '';
- // Set the recent
- if (recentId.isNotEmpty) {
- await storageService.instance.setString(
- StringConstants.recentWalletId,
- recentId,
+ try {
+ final recentId = walletInfo?.listing.id ?? walletId;
+ await storeRecentWalletId(recentId);
+
+ final currentListings = List.from(
+ _listings.map((e) => e.copyWith(recent: false)).toList(),
+ );
+ final recentWallet = currentListings.firstWhereOrNull(
+ (e) => e.listing.id == recentId,
+ );
+ if (recentWallet != null) {
+ final rw = recentWallet.copyWith(recent: true);
+ currentListings.removeWhere((e) => e.listing.id == rw.listing.id);
+ currentListings.insert(0, rw);
+ }
+ _listings = currentListings;
+ listings.value = _listings;
+ W3MLoggerUtil.logger.t('[$runtimeType] _updateRecentWalletId $walletId '
+ '${walletInfo?.toJson()}');
+ } catch (e, s) {
+ W3MLoggerUtil.logger.e(
+ '[$runtimeType] _updateRecentWalletId',
+ error: e,
+ stackTrace: s,
);
}
- final currentListings = List.from(
- _listings.map((e) => e.copyWith(recent: false)).toList(),
- );
- final recentWallet = currentListings.firstWhereOrNull(
- (e) => e.listing.id == recentId,
- );
- if (recentWallet != null) {
- final rw = recentWallet.copyWith(recent: true);
- currentListings.removeWhere((e) => e.listing.id == rw.listing.id);
- currentListings.insert(0, rw);
- }
- _listings = currentListings;
- listings.value = _listings;
- W3MLoggerUtil.logger.t(
- '[$runtimeType] _updateRecentWalletId $walletId ${walletInfo?.toJson()}');
}
@override
@@ -406,16 +408,10 @@ class ExplorerService implements IExplorerService {
WalletRedirect? getWalletRedirect(W3MWalletInfo? walletInfo) {
if (walletInfo == null) return null;
- final wallet = listings.value.firstWhereOrNull(
- (item) => walletInfo.listing.id == item.listing.id,
- );
- if (wallet == null) {
- return null;
- }
return WalletRedirect(
- mobile: wallet.listing.mobileLink,
- desktop: wallet.listing.desktopLink,
- web: wallet.listing.webappLink,
+ mobile: walletInfo.listing.mobileLink,
+ desktop: walletInfo.listing.desktopLink,
+ web: walletInfo.listing.webappLink,
);
}
diff --git a/lib/services/w3m_service/models/w3m_session.dart b/lib/services/w3m_service/models/w3m_session.dart
index add3c0ac..264527ab 100644
--- a/lib/services/w3m_service/models/w3m_session.dart
+++ b/lib/services/w3m_service/models/w3m_session.dart
@@ -66,20 +66,19 @@ class W3MSession {
}
String? get address {
- if (sessionData != null) {
- if (sessionData!.namespaces.isNotEmpty) {
- final accounts = sessionData!.namespaces.values.first.accounts;
- if (accounts.isNotEmpty) {
- return NamespaceUtils.getAccount(accounts.first);
- }
- W3MLoggerUtil.logger.e('[$runtimeType] empty accounts');
- }
+ if (sessionService.noSession) {
+ return null;
}
- if (coinbaseData != null) {
+ if (sessionService.isCoinbase) {
return coinbaseData!.address;
}
- // if (magicData != null)
+ // if (sessionService.isMagic) {
//
+ final namespace = sessionData?.namespaces[EthConstants.namespace];
+ final accounts = namespace?.accounts ?? [];
+ if (accounts.isNotEmpty) {
+ return NamespaceUtils.getAccount(accounts.first);
+ }
W3MLoggerUtil.logger.e('[$runtimeType] no address found');
return null;
}
diff --git a/lib/services/w3m_service/w3m_service.dart b/lib/services/w3m_service/w3m_service.dart
index db238b95..478e44c7 100644
--- a/lib/services/w3m_service/w3m_service.dart
+++ b/lib/services/w3m_service/w3m_service.dart
@@ -512,6 +512,12 @@ class W3MService with ChangeNotifier, CoinbaseService implements IW3MService {
return false;
}
+ if (walletInfo.isCoinbase) {
+ // Coinbase Wallet is getting launched at every request by it's own SDK
+ // SO no need to do it here.
+ return false;
+ }
+
final redirect = explorerService.instance.getWalletRedirect(walletInfo);
if (redirect == null) {
return false;
@@ -956,6 +962,11 @@ extension _W3MServiceExtension on W3MService {
void onSessionConnect(SessionConnect? args) async {
W3MLoggerUtil.logger.t('[$runtimeType] onSessionConnect: $args');
if (args != null) {
+ if (_selectedWallet == null) {
+ await storageService.instance.clearKey(StringConstants.recentWalletId);
+ await storageService.instance
+ .clearKey(StringConstants.connectedWalletData);
+ }
await _storeSession(W3MSession(sessionData: args.session));
await _selectChainFromStoredId();
_loadAccountData();
diff --git a/lib/version.dart b/lib/version.dart
index ba1577f3..58c8c663 100644
--- a/lib/version.dart
+++ b/lib/version.dart
@@ -1,2 +1,2 @@
// Generated code. Do not modify.
-const packageVersion = '3.1.0-beta02';
+const packageVersion = '3.1.0-beta03';
diff --git a/pubspec.lock b/pubspec.lock
index c7df8554..f92adcc3 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -1049,10 +1049,10 @@ packages:
dependency: "direct main"
description:
name: walletconnect_flutter_v2
- sha256: a3654aa71221f15be6b20663759fad3eb3a37dc486f72860d7eb69c1e39d682b
+ sha256: e26ca98cfd6b8d5dc9c5f7e581999ab314d5134c0ffcddb73ef750f13b322d9c
url: "https://pub.dev"
source: hosted
- version: "2.1.12"
+ version: "2.1.13"
watcher:
dependency: transitive
description:
diff --git a/pubspec.yaml b/pubspec.yaml
index 418ce90c..a5943ed0 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: web3modal_flutter
description: "WalletConnect Web3Modal: Simple, intuitive wallet login. With this drop-in UI SDK, enable any wallet's users to seamlessly log in to your app and enjoy a unified experience"
-version: 3.1.0-beta02
+version: 3.1.0-beta03
repository: https://github.com/WalletConnect/Web3ModalFlutter
environment:
@@ -22,7 +22,7 @@ dependencies:
qr_flutter_wc: ^0.0.3
shimmer: ^3.0.0
url_launcher: ^6.2.3
- walletconnect_flutter_v2: ^2.1.12
+ walletconnect_flutter_v2: ^2.1.13
dev_dependencies:
build_runner: ^2.4.7