/****************************************************************************
* Copyright 2019 Nreal Techonology Limited. All rights reserved.
*
* This file is part of NRSDK.
*
* https://www.nreal.ai/
*
*****************************************************************************/
namespace NRKernal
{
using System.Text;
///
/// Structure holding data summarizing the result of an Android permissions request.
public struct AndroidPermissionsRequestResult
{
/// Constructs a new AndroidPermissionsRequestResult.
/// The value for PermissionNames.
/// The value for GrantResults.
public AndroidPermissionsRequestResult(
string[] permissionNames, bool[] grantResults) : this()
{
PermissionNames = permissionNames;
GrantResults = grantResults;
}
/// Gets or sets a collection of permissions requested.
/// A list of names of the permissions.
public string[] PermissionNames { get; private set; }
///
/// Gets or sets a collection of results corresponding to .
/// The grant results.
public bool[] GrantResults { get; private set; }
/// Gets a value indicating whether all permissions are granted.
/// True if all is granted, false if not.
public bool IsAllGranted
{
get
{
if (PermissionNames == null || GrantResults == null)
{
return false;
}
for (int i = 0; i < GrantResults.Length; i++)
{
if (!GrantResults[i])
{
return false;
}
}
return true;
}
}
/// Convert this object into a string representation.
/// A string that represents this object.
public override string ToString()
{
StringBuilder st = new StringBuilder();
for (int i = 0; i < PermissionNames.Length; i++)
{
st.AppendLine("Name:" + PermissionNames[i] + " GrantResult:" + GrantResults[i]);
}
return st.ToString();
}
}
}