Skip to content

Commit

Permalink
Add new address feature
Browse files Browse the repository at this point in the history
  • Loading branch information
matsakiv committed Jul 20, 2023
1 parent 0ca4e17 commit 34eec25
Show file tree
Hide file tree
Showing 6 changed files with 226 additions and 173 deletions.
4 changes: 2 additions & 2 deletions Atomex.Client.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<UseAppHost>true</UseAppHost>
<ApplicationIcon>Resources/Images/atomex_logo_256x256_ico.ico</ApplicationIcon>

<AssemblyVersion>1.3.7</AssemblyVersion>
<Version>1.3.7</Version>
<AssemblyVersion>1.3.8</AssemblyVersion>
<Version>1.3.8</Version>
</PropertyGroup>
<Choose>
<When Condition=" '$(Configuration)' == 'Debug' ">
Expand Down
15 changes: 15 additions & 0 deletions Controls/IconButton.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@

<controls:IconButton Classes="SetupAssets"
Margin="10 0 0 0" />

<controls:IconButton Classes="Plus"
Margin="10 0 0 0" />
</StackPanel>

<StackPanel Margin="0 25 0 0 "
Expand Down Expand Up @@ -469,4 +472,16 @@
<Setter Property="Path" Value="/Resources/Icons/warning-orange.svg" />
<Setter Property="Width" Value="24" />
</Style>

<Style Selector="controls|IconButton.Plus">
<Setter Property="Width" Value="24" />
<Setter Property="Height" Value="24" />
</Style>
<Style Selector="controls|IconButton.Plus svg|Svg">
<Setter Property="Path" Value="/Resources/Icons/plus-gray.svg" />
<Setter Property="Width" Value="24" />
</Style>
<Style Selector="controls|IconButton.Plus:pointerover svg|Svg">
<Setter Property="Path" Value="/Resources/Icons/plus.svg" />
</Style>
</Styles>
20 changes: 20 additions & 0 deletions ViewModels/AddressesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,26 @@ public AddressesViewModel(
_app.LocalStorage.BalanceChanged += OnBalanceChangedEventHandler;
}

private ReactiveCommand<Unit, Unit>? _addNewAddressCommand;
public ReactiveCommand<Unit, Unit> AddNewAddress => _addNewAddressCommand ??= ReactiveCommand.Create(() =>
{
try
{
var account = _app.Account
.GetCurrencyAccount(_currency.Name);

_ = account
.AddNewExternalAddressAsync()
.WaitForResult();

_ = ReloadAddresses();
}
catch (Exception ex)
{
Log.Error(ex, "Error while add new address");
}
});

private async Task ReloadAddresses()
{
try
Expand Down
14 changes: 12 additions & 2 deletions ViewModels/DappsViewModels/DappsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,18 @@ private void GetAllDapps()
var disconnectViewModel = new DisconnectViewModel
{
DappName = permissionInfo.AppMetadata.Name,
OnDisconnect = async () => await _beaconWalletClient
.RemovePeerAsync(disconnectPeer.SenderId)
OnDisconnect = async () =>
{
try
{
await _beaconWalletClient
.RemovePeerAsync(disconnectPeer.SenderId);
}
catch (Exception e)
{
Log.Error(e, "Can't remove peer with sender id {@id}", disconnectPeer.SenderId);
}
}
};

App.DialogService.Show(disconnectViewModel);
Expand Down
Loading

0 comments on commit 34eec25

Please sign in to comment.