Ensure profile images show on newly created wallets

This commit is contained in:
TheXamlGuy
2024-06-29 22:06:08 +01:00
parent 4de00a5b4f
commit f4808ccb50
2 changed files with 12 additions and 2 deletions
+5 -1
View File
@@ -22,8 +22,12 @@ public class WalletActivatedHandler(IWalletHostCollection Wallets,
{
if (host.Services.GetRequiredService<IServiceFactory>() is IServiceFactory serviceFactory)
{
IDecoratorService<ProfileImage<IImageDescriptor>> profileImageDecorator =
host.Services.GetRequiredService<IDecoratorService<ProfileImage<IImageDescriptor>>>();
ProfileImage<IImageDescriptor>? profileImage = profileImageDecorator.Service;
if (serviceFactory.Create<WalletNavigationViewModel>(args => args.Initialize(),
descriptor.Name, false)
descriptor.Name, profileImage?.Value, false)
is WalletNavigationViewModel viewModel)
{
publisher.Publish(Insert.As<IMainNavigationViewModel>(index, viewModel),
+7 -1
View File
@@ -10,7 +10,13 @@ public class WalletCollectionInitializer(IHostEnvironment environment,
{
public void Initialize()
{
foreach (string wallet in Directory.EnumerateDirectories(Path.Combine(environment.ContentRootPath, "Wallet")))
string path = Path.Combine(environment.ContentRootPath, "Wallet");
if (!Directory.Exists(path))
{
return;
}
foreach (string wallet in Directory.EnumerateDirectories(path))
{
string name = Path.GetFileName(wallet);
string section = $"Wallet:{name}";