fix: Wallet type check when registering key service (#1111)

* fix: Wallet type check when registering key service

* fix: WalletConnect dependency registration
This commit is contained in:
Adegoke David 2023-10-05 13:04:08 +01:00 committed by GitHub
parent 4c60b178be
commit bad9b4c608
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View file

@ -740,9 +740,13 @@ Future<void> setup({
return PowNodeListViewModel(_powNodeSource, appStore); return PowNodeListViewModel(_powNodeSource, appStore);
}); });
getIt.registerFactory( getIt.registerFactory(() {
() => ConnectionSyncPage(getIt.get<DashboardViewModel>(), getIt.get<Web3WalletService>()), final wallet = getIt.get<AppStore>().wallet;
); return ConnectionSyncPage(
getIt.get<DashboardViewModel>(),
wallet?.type == WalletType.ethereum ? getIt.get<Web3WalletService>() : null,
);
});
getIt.registerFactory( getIt.registerFactory(
() => SecurityBackupPage(getIt.get<SecuritySettingsViewModel>(), getIt.get<AuthService>())); () => SecurityBackupPage(getIt.get<SecuritySettingsViewModel>(), getIt.get<AuthService>()));

View file

@ -23,7 +23,7 @@ class ConnectionSyncPage extends BasePage {
@override @override
String get title => S.current.connection_sync; String get title => S.current.connection_sync;
final Web3WalletService web3walletService; final Web3WalletService? web3walletService;
final DashboardViewModel dashboardViewModel; final DashboardViewModel dashboardViewModel;
@override @override
@ -91,7 +91,7 @@ class ConnectionSyncPage extends BasePage {
Navigator.of(context).push( Navigator.of(context).push(
MaterialPageRoute( MaterialPageRoute(
builder: (context) { builder: (context) {
return WalletConnectConnectionsView(web3walletService: web3walletService); return WalletConnectConnectionsView(web3walletService: web3walletService!);
}, },
), ),
); );