1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-23 11:45:38 +01:00

PM-3349 PM-3350 MAUI Migration fix nullable bindings and fallbacks

This commit is contained in:
Federico Maccaroni 2023-09-29 12:27:12 -03:00
parent b8f0747dd4
commit d17789d5ee
No known key found for this signature in database
GPG Key ID: 5D233F8F2B034536
3 changed files with 6 additions and 4 deletions

View File

@ -37,7 +37,7 @@ namespace Bit.App.Pages
set => SetProperty(ref _cipher, value, additionalPropertyNames: AdditionalPropertiesToRaiseOnCipherChanged);
}
public string CreationDate => string.Format(AppResources.CreatedXY, Cipher.CreationDate.ToShortDateString(), Cipher.CreationDate.ToShortTimeString());
public string CreationDate => string.Format(AppResources.CreatedXY, Cipher?.CreationDate.ToShortDateString(), Cipher?.CreationDate.ToShortTimeString());
public AsyncCommand CheckPasswordCommand { get; }

View File

@ -126,7 +126,7 @@
StyleClass="box-label" />
<Entry
x:Name="_nameEntry"
Text="{Binding Cipher.Name}"
Text="{Binding Cipher.Name, FallbackValue=''}"
StyleClass="box-value"
AutomationProperties.IsInAccessibleTree="True"
SemanticProperties.Description="{u:I18n Name}"
@ -219,7 +219,7 @@
Grid.RowSpan="2"
AutomationProperties.IsInAccessibleTree="True"
SemanticProperties.Description="{u:I18n GeneratePassword}"
IsVisible="{Binding Cipher.ViewPassword}"
IsVisible="{Binding Cipher.ViewPassword, FallbackValue=False}"
AutomationId="RegeneratePasswordButton" />
</Grid>

View File

@ -17,6 +17,8 @@ using Microsoft.Maui.Controls;
using Microsoft.Maui;
using Bit.App.Utilities;
#nullable enable
namespace Bit.App.Pages
{
public class CipherAddEditPageViewModel : BaseCipherViewModel
@ -883,7 +885,7 @@ namespace Bit.App.Pages
Cipher.OrganizationId = OwnershipOptions[OwnershipSelectedIndex].Value;
TriggerCipherChanged();
}
if (Cipher.OrganizationId != null)
if (Cipher?.OrganizationId != null)
{
var cols = _writeableCollections.Where(c => c.OrganizationId == Cipher.OrganizationId)
.Select(c => new CollectionViewModel { Collection = c }).ToList();