1
0
mirror of https://github.com/bitwarden/mobile.git synced 2024-12-22 16:18:21 +01:00

some device functions

This commit is contained in:
Kyle Spearrin 2019-05-17 13:46:32 -04:00
parent 3e633dc38e
commit a3e165fa06
3 changed files with 28 additions and 11 deletions
src

View File

@ -318,6 +318,16 @@ namespace Bit.Droid.Services
return manager.IsAutofillSupported;
}
public int SystemMajorVersion()
{
return (int)Build.VERSION.SdkInt;
}
public string SystemModel()
{
return Build.Model;
}
private bool DeleteDir(Java.IO.File dir)
{
if(dir != null && dir.IsDirectory)

View File

@ -21,5 +21,7 @@ namespace Bit.App.Abstractions
bool SupportsNfc();
bool SupportsCamera();
bool SupportsAutofillService();
int SystemMajorVersion();
string SystemModel();
}
}

View File

@ -248,6 +248,22 @@ namespace Bit.iOS.Services
return true;
}
public int SystemMajorVersion()
{
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out int version))
{
return version;
}
// unable to determine version
return -1;
}
public string SystemModel()
{
return UIDevice.CurrentDevice.Model;
}
private void ImagePicker_FinishedPickingMedia(object sender, UIImagePickerMediaPickedEventArgs e)
{
if(sender is UIImagePickerController picker)
@ -364,16 +380,5 @@ namespace Bit.iOS.Services
var documents = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
return Path.Combine(documents, "..", "tmp");
}
private int SystemMajorVersion()
{
var versionParts = UIDevice.CurrentDevice.SystemVersion.Split('.');
if(versionParts.Length > 0 && int.TryParse(versionParts[0], out int version))
{
return version;
}
// unable to determine version
return -1;
}
}
}