mirror of
https://github.com/bitwarden/android.git
synced 2024-12-24 18:08:26 +03:00
some device functions
This commit is contained in:
parent
3e633dc38e
commit
a3e165fa06
3 changed files with 28 additions and 11 deletions
|
@ -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)
|
||||
|
|
|
@ -21,5 +21,7 @@ namespace Bit.App.Abstractions
|
|||
bool SupportsNfc();
|
||||
bool SupportsCamera();
|
||||
bool SupportsAutofillService();
|
||||
int SystemMajorVersion();
|
||||
string SystemModel();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue