mirror of
https://github.com/bitwarden/mobile
synced 2025-12-21 18:53:29 +00:00
PM-3349 PM-3350 MAUI Migration Initial
This commit is contained in:
56
src/Core/Models/AppOptions.cs
Normal file
56
src/Core/Models/AppOptions.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.App.Models
|
||||
{
|
||||
public class AppOptions
|
||||
{
|
||||
public bool MyVaultTile { get; set; }
|
||||
public bool GeneratorTile { get; set; }
|
||||
public bool FromAutofillFramework { get; set; }
|
||||
public CipherType? FillType { get; set; }
|
||||
public string Uri { get; set; }
|
||||
public CipherType? SaveType { get; set; }
|
||||
public string SaveName { get; set; }
|
||||
public string SaveUsername { get; set; }
|
||||
public string SavePassword { get; set; }
|
||||
public string SaveCardName { get; set; }
|
||||
public string SaveCardNumber { get; set; }
|
||||
public string SaveCardExpMonth { get; set; }
|
||||
public string SaveCardExpYear { get; set; }
|
||||
public string SaveCardCode { get; set; }
|
||||
public bool IosExtension { get; set; }
|
||||
public Tuple<SendType, string, byte[], string> CreateSend { get; set; }
|
||||
public bool CopyInsteadOfShareAfterSaving { get; set; }
|
||||
public bool HideAccountSwitcher { get; set; }
|
||||
public OtpData? OtpData { get; set; }
|
||||
|
||||
public void SetAllFrom(AppOptions o)
|
||||
{
|
||||
if (o == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MyVaultTile = o.MyVaultTile;
|
||||
GeneratorTile = o.GeneratorTile;
|
||||
FromAutofillFramework = o.FromAutofillFramework;
|
||||
FillType = o.FillType;
|
||||
Uri = o.Uri;
|
||||
SaveType = o.SaveType;
|
||||
SaveName = o.SaveName;
|
||||
SaveUsername = o.SaveUsername;
|
||||
SavePassword = o.SavePassword;
|
||||
SaveCardName = o.SaveCardName;
|
||||
SaveCardNumber = o.SaveCardNumber;
|
||||
SaveCardExpMonth = o.SaveCardExpMonth;
|
||||
SaveCardExpYear = o.SaveCardExpYear;
|
||||
SaveCardCode = o.SaveCardCode;
|
||||
IosExtension = o.IosExtension;
|
||||
CreateSend = o.CreateSend;
|
||||
CopyInsteadOfShareAfterSaving = o.CopyInsteadOfShareAfterSaving;
|
||||
HideAccountSwitcher = o.HideAccountSwitcher;
|
||||
OtpData = o.OtpData;
|
||||
}
|
||||
}
|
||||
}
|
||||
12
src/Core/Models/DialogDetails.cs
Normal file
12
src/Core/Models/DialogDetails.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace Bit.App.Models
|
||||
{
|
||||
public class DialogDetails
|
||||
{
|
||||
public string Text { get; set; }
|
||||
public string Title { get; set; }
|
||||
public string ConfirmText { get; set; }
|
||||
public string CancelText { get; set; }
|
||||
public string Type { get; set; }
|
||||
public int DialogId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using System.Threading.Tasks;
|
||||
using Bit.Core.Models.Data;
|
||||
using Bit.Core.Models.View;
|
||||
using CollectionView = Bit.Core.Models.View.CollectionView;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Data.Common;
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Permissions = Bit.Core.Models.Data.Permissions;
|
||||
|
||||
namespace Bit.Core.Models.Domain
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Bit.Core.Models.View;
|
||||
using CollectionView = Bit.Core.Models.View.CollectionView;
|
||||
|
||||
namespace Bit.Core.Models.Export
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Bit.Core.Models.View;
|
||||
using Newtonsoft.Json;
|
||||
using CollectionView = Bit.Core.Models.View.CollectionView;
|
||||
|
||||
namespace Bit.Core.Models.Export
|
||||
{
|
||||
|
||||
23
src/Core/Models/NotificationData.cs
Normal file
23
src/Core/Models/NotificationData.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
namespace Bit.App.Models
|
||||
{
|
||||
public abstract class BaseNotificationData
|
||||
{
|
||||
public abstract string Type { get; }
|
||||
|
||||
public string Id { get; set; }
|
||||
}
|
||||
|
||||
public class PasswordlessNotificationData : BaseNotificationData
|
||||
{
|
||||
public const string TYPE = "passwordlessNotificationData";
|
||||
|
||||
public override string Type => TYPE;
|
||||
|
||||
public int TimeoutInMinutes { get; set; }
|
||||
|
||||
public string UserEmail { get; set; }
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
39
src/Core/Models/PlatformCulture.cs
Normal file
39
src/Core/Models/PlatformCulture.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
|
||||
namespace Bit.App.Models
|
||||
{
|
||||
public class PlatformCulture
|
||||
{
|
||||
public PlatformCulture(string platformCultureString)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(platformCultureString))
|
||||
{
|
||||
throw new ArgumentException("Expected culture identifier.", nameof(platformCultureString));
|
||||
}
|
||||
|
||||
// .NET expects dash, not underscore
|
||||
PlatformString = platformCultureString.Replace("_", "-");
|
||||
var dashIndex = PlatformString.IndexOf("-", StringComparison.Ordinal);
|
||||
if (dashIndex > 0)
|
||||
{
|
||||
var parts = PlatformString.Split('-');
|
||||
LanguageCode = parts[0];
|
||||
LocaleCode = parts[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
LanguageCode = PlatformString;
|
||||
LocaleCode = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public string PlatformString { get; private set; }
|
||||
public string LanguageCode { get; private set; }
|
||||
public string LocaleCode { get; private set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return PlatformString;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Bit.Core.Models.Request
|
||||
Identifier = appId;
|
||||
}
|
||||
|
||||
public DeviceType? Type { get; set; }
|
||||
public Enums.DeviceType? Type { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public string PushToken { get; set; }
|
||||
|
||||
@@ -5,7 +5,7 @@ public class DeviceResponse
|
||||
public string Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Identifier { get; set; }
|
||||
public DeviceType Type { get; set; }
|
||||
public Bit.Core.Enums.DeviceType Type { get; set; }
|
||||
public string CreationDate { get; set; }
|
||||
public string EncryptedUserKey { get; set; }
|
||||
public string EncryptedPublicKey { get; set; }
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Models.Data;
|
||||
using Permissions = Bit.Core.Models.Data.Permissions;
|
||||
|
||||
namespace Bit.Core.Models.Response
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user