1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-11-26 12:16:07 +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); 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; } public AsyncCommand CheckPasswordCommand { get; }

View File

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

View File

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