mirror of
https://github.com/bitwarden/mobile
synced 2026-01-06 02:23:57 +00:00
Added custom device info service for determining model and version (ios = major version, android = API level).
This commit is contained in:
8
src/App/Abstractions/Services/IDeviceInfoService.cs
Normal file
8
src/App/Abstractions/Services/IDeviceInfoService.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
namespace Bit.App.Abstractions
|
||||
{
|
||||
public interface IDeviceInfoService
|
||||
{
|
||||
string Model { get; }
|
||||
int Version { get; }
|
||||
}
|
||||
}
|
||||
@@ -37,6 +37,7 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Abstractions\Repositories\IAccountsApiRepository.cs" />
|
||||
<Compile Include="Abstractions\Repositories\IDeviceApiRepository.cs" />
|
||||
<Compile Include="Abstractions\Services\IDeviceInfoService.cs" />
|
||||
<Compile Include="Abstractions\Services\IGoogleAnalyticsService.cs" />
|
||||
<Compile Include="Abstractions\Services\IAppInfoService.cs" />
|
||||
<Compile Include="Abstractions\Services\IAppIdService.cs" />
|
||||
@@ -246,14 +247,6 @@
|
||||
<HintPath>..\..\packages\Xam.Plugin.Connectivity.2.2.12\lib\portable-net45+wp80+wp81+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+Xamarin.Mac20+UAP10\Plugin.Connectivity.Abstractions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Plugin.DeviceInfo, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugin.DeviceInfo.2.0.2\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.DeviceInfo.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Plugin.DeviceInfo.Abstractions, Version=2.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Xam.Plugin.DeviceInfo.2.0.2\lib\portable-net45+wp8+wpa81+win8+MonoAndroid10+MonoTouch10+Xamarin.iOS10+UAP10\Plugin.DeviceInfo.Abstractions.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Plugin.Fingerprint, Version=1.2.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Plugin.Fingerprint.1.2.0\lib\portable-net45+win8+wpa81+wp8\Plugin.Fingerprint.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using Bit.App.Abstractions;
|
||||
using Plugin.DeviceInfo.Abstractions;
|
||||
using PushNotification.Plugin.Abstractions;
|
||||
using Xamarin.Forms;
|
||||
|
||||
namespace Bit.App.Models.Api
|
||||
{
|
||||
@@ -8,11 +8,11 @@ namespace Bit.App.Models.Api
|
||||
{
|
||||
public DeviceRequest() { }
|
||||
|
||||
public DeviceRequest(IAppIdService appIdService, IDeviceInfo deviceInfo)
|
||||
public DeviceRequest(IAppIdService appIdService, IDeviceInfoService deviceInfoService)
|
||||
{
|
||||
Identifier = appIdService.AppId;
|
||||
Name = deviceInfo.Model;
|
||||
Type = deviceInfo.Platform == Platform.Android ? DeviceType.Android : DeviceType.iOS;
|
||||
Name = deviceInfoService.Model;
|
||||
Type = Device.OS == TargetPlatform.Android ? DeviceType.Android : DeviceType.iOS;
|
||||
}
|
||||
|
||||
public DeviceType Type { get; set; }
|
||||
|
||||
@@ -4,7 +4,6 @@ using Bit.App.Abstractions;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Models.Api;
|
||||
using Bit.App.Resources;
|
||||
using Plugin.DeviceInfo.Abstractions;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Acr.UserDialogs;
|
||||
@@ -18,7 +17,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
private ICryptoService _cryptoService;
|
||||
private IAuthService _authService;
|
||||
private IDeviceInfo _deviceInfo;
|
||||
private IDeviceInfoService _deviceInfoService;
|
||||
private IAppIdService _appIdService;
|
||||
private IUserDialogs _userDialogs;
|
||||
private ISyncService _syncService;
|
||||
@@ -33,7 +32,7 @@ namespace Bit.App.Pages
|
||||
_email = email;
|
||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||
_authService = Resolver.Resolve<IAuthService>();
|
||||
_deviceInfo = Resolver.Resolve<IDeviceInfo>();
|
||||
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
||||
_appIdService = Resolver.Resolve<IAppIdService>();
|
||||
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||
_syncService = Resolver.Resolve<ISyncService>();
|
||||
@@ -184,7 +183,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
Email = normalizedEmail,
|
||||
MasterPasswordHash = _cryptoService.HashPasswordBase64(key, PasswordCell.Entry.Text),
|
||||
Device = new DeviceRequest(_appIdService, _deviceInfo)
|
||||
Device = new DeviceRequest(_appIdService, _deviceInfoService)
|
||||
};
|
||||
|
||||
_userDialogs.ShowLoading("Logging in...", MaskType.Black);
|
||||
|
||||
@@ -4,7 +4,6 @@ using Bit.App.Abstractions;
|
||||
using Bit.App.Controls;
|
||||
using Bit.App.Models.Api;
|
||||
using Bit.App.Resources;
|
||||
using Plugin.DeviceInfo.Abstractions;
|
||||
using Xamarin.Forms;
|
||||
using XLabs.Ioc;
|
||||
using Acr.UserDialogs;
|
||||
@@ -16,7 +15,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
private ICryptoService _cryptoService;
|
||||
private IAuthService _authService;
|
||||
private IDeviceInfo _deviceInfo;
|
||||
private IDeviceInfoService _deviceInfoService;
|
||||
private IAppIdService _appIdService;
|
||||
private IUserDialogs _userDialogs;
|
||||
private ISyncService _syncService;
|
||||
@@ -26,7 +25,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
_cryptoService = Resolver.Resolve<ICryptoService>();
|
||||
_authService = Resolver.Resolve<IAuthService>();
|
||||
_deviceInfo = Resolver.Resolve<IDeviceInfo>();
|
||||
_deviceInfoService = Resolver.Resolve<IDeviceInfoService>();
|
||||
_appIdService = Resolver.Resolve<IAppIdService>();
|
||||
_userDialogs = Resolver.Resolve<IUserDialogs>();
|
||||
_syncService = Resolver.Resolve<ISyncService>();
|
||||
@@ -124,7 +123,7 @@ namespace Bit.App.Pages
|
||||
{
|
||||
Code = CodeCell.Entry.Text,
|
||||
Provider = "Authenticator",
|
||||
Device = new DeviceRequest(_appIdService, _deviceInfo)
|
||||
Device = new DeviceRequest(_appIdService, _deviceInfoService)
|
||||
};
|
||||
|
||||
_userDialogs.ShowLoading("Validating code...", MaskType.Black);
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
<package id="Unity" version="3.5.1405-prerelease" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Validation" version="2.2.8" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugin.Connectivity" version="2.2.12" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugin.DeviceInfo" version="2.0.2" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xam.Plugin.PushNotification" version="1.2.2" targetFramework="portable45-net45+win8+wpa81" developmentDependency="true" />
|
||||
<package id="Xam.Plugins.Settings" version="2.1.0" targetFramework="portable45-net45+win8+wpa81" />
|
||||
<package id="Xamarin.Forms" version="2.3.1.114" targetFramework="portable45-net45+win8+wpa81" />
|
||||
|
||||
Reference in New Issue
Block a user