mirror of
https://github.com/bitwarden/mobile
synced 2025-12-17 08:43:21 +00:00
Added custom device info service for determining model and version (ios = major version, android = API level).
This commit is contained in:
25
src/iOS.Core/Services/DeviceInfoService.cs
Normal file
25
src/iOS.Core/Services/DeviceInfoService.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Bit.App.Abstractions;
|
||||
using UIKit;
|
||||
|
||||
namespace Bit.iOS.Core.Services
|
||||
{
|
||||
public class DeviceInfoService : IDeviceInfoService
|
||||
{
|
||||
public string Model => UIDevice.CurrentDevice.Model;
|
||||
public int Version
|
||||
{
|
||||
get
|
||||
{
|
||||
int version;
|
||||
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
|
||||
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out version))
|
||||
{
|
||||
return version;
|
||||
}
|
||||
|
||||
// unable to determine version
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user