mirror of
https://github.com/bitwarden/mobile
synced 2025-12-10 05:13:31 +00:00
* EC-259 Added Account switching on share extension on iOS, also improved performance for this and exception handling * EC-259 code formatting * EC-259 Added account switching to Share extension Send view * EC-259 Fixed navigation on share extension when a forms page is already presented * EC-259 Fix send text UI update when going from the iOS extension * EC-259 Improved DateTimeViewModel with helper property to easily setup date and time at the same time and applied on usage
71 lines
1.6 KiB
C#
71 lines
1.6 KiB
C#
using System;
|
|
using Bit.Core.Utilities;
|
|
|
|
namespace Bit.App.Controls
|
|
{
|
|
public class DateTimeViewModel : ExtendedViewModel
|
|
{
|
|
DateTime? _date;
|
|
TimeSpan? _time;
|
|
|
|
public DateTimeViewModel(string dateName, string timeName)
|
|
{
|
|
DateName = dateName;
|
|
TimeName = timeName;
|
|
}
|
|
|
|
public Action<DateTime?> OnDateChanged { get; set; }
|
|
public Action<TimeSpan?> OnTimeChanged { get; set; }
|
|
|
|
public DateTime? Date
|
|
{
|
|
get => _date;
|
|
set
|
|
{
|
|
if (SetProperty(ref _date, value))
|
|
{
|
|
OnDateChanged?.Invoke(value);
|
|
}
|
|
}
|
|
}
|
|
public TimeSpan? Time
|
|
{
|
|
get => _time;
|
|
set
|
|
{
|
|
if (SetProperty(ref _time, value))
|
|
{
|
|
OnTimeChanged?.Invoke(value);
|
|
}
|
|
}
|
|
}
|
|
|
|
public string DateName { get; }
|
|
public string TimeName { get; }
|
|
|
|
public string DatePlaceholder { get; set; }
|
|
public string TimePlaceholder { get; set; }
|
|
|
|
public DateTime? DateTime
|
|
{
|
|
get
|
|
{
|
|
if (Date.HasValue)
|
|
{
|
|
if (Time.HasValue)
|
|
{
|
|
return Date.Value.Add(Time.Value);
|
|
}
|
|
return Date;
|
|
}
|
|
return null;
|
|
}
|
|
set
|
|
{
|
|
Date = value?.Date;
|
|
Time = value?.Date.TimeOfDay;
|
|
}
|
|
}
|
|
}
|
|
}
|