Class ConsentDialog
Inheritance
Namespace: EasyMobile
Assembly: cs.temp.dll.dll
Syntax
[Serializable]
public class ConsentDialog
Constructors
ConsentDialog()
Declaration
public ConsentDialog()
Fields
ButtonPattern
Declaration
public const string ButtonPattern = "</EM_CONSENT_BUTTON. "
Field Value
Type | Description |
---|---|
System.String |
ButtonSearchPattern
Declaration
public const string ButtonSearchPattern = "</EM_CONSENT_BUTTON. Id = (.*?)>"
Field Value
Type | Description |
---|---|
System.String |
TogglePattern
Declaration
public const string TogglePattern = "</EM_CONSENT_TOGGLE. "
Field Value
Type | Description |
---|---|
System.String |
ToggleSearchPattern
Declaration
public const string ToggleSearchPattern = "</EM_CONSENT_TOGGLE. Id = (.*?)>"
Field Value
Type | Description |
---|---|
System.String |
UrlPattern
Declaration
public const string UrlPattern = "https?:\\/\\/(www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%_\\+.~#?&//=]*)"
Field Value
Type | Description |
---|---|
System.String |
Properties
ActionButtons
Array containing the action buttons to be inserted into the dialog.
Each dialog must have at least one button or the Completed
event will never be fired, and the dialog can't be closed unless it is
shown with the dismissible option being true
.
Declaration
public ConsentDialog.Button[] ActionButtons { get; set; }
Property Value
Type | Description |
---|---|
ConsentDialog.Button[] |
ActiveDialog
The consent dialog being shown if any. Returns null if no dialog is shown at the moment.
Declaration
public static ConsentDialog ActiveDialog { get; }
Property Value
Type | Description |
---|---|
ConsentDialog | The active dialog. |
Content
The HTML-tagged text used to construct the main body of the dialog.
Declaration
public string Content { get; set; }
Property Value
Type | Description |
---|---|
System.String |
IsShowing
Gets a value indicating whether this dialog is showing.
Declaration
public bool IsShowing { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Title
The dialog title.
Declaration
public string Title { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Toggles
Array containing the toogles to be inserted into the dialog.
Declaration
public ConsentDialog.Toggle[] Toggles { get; set; }
Property Value
Type | Description |
---|---|
ConsentDialog.Toggle[] |
Methods
AppendButton(ConsentDialog.Button)
Appends the button to the end of the main content (see Content). The button will also be added to the ActionButtons array if it is not included in that array yet.
Declaration
public void AppendButton(ConsentDialog.Button button)
Parameters
Type | Name | Description |
---|---|---|
ConsentDialog.Button | button | Button. |
AppendText(String)
Appends the text to the end of the main content (see Content).
Declaration
public void AppendText(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | Text. |
AppendToggle(ConsentDialog.Toggle)
Appends the toggle to the end of the main content (see Content). The toggle will also be added to the Toggles array if it is not included in that array yet.
Declaration
public void AppendToggle(ConsentDialog.Toggle toggle)
Parameters
Type | Name | Description |
---|---|---|
ConsentDialog.Toggle | toggle | Toggle. |
FindButtonWithId(String)
Returns the button with the give ID if one exists in the
Declaration
public ConsentDialog.Button FindButtonWithId(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier. |
Returns
Type | Description |
---|---|
ConsentDialog.Button | The button with identifier. |
FindToggleWithId(String)
Returns the toggle with the given ID if one exists in the Toggles array.
Declaration
public ConsentDialog.Toggle FindToggleWithId(string id)
Parameters
Type | Name | Description |
---|---|---|
System.String | id | Identifier. |
Returns
Type | Description |
---|---|
ConsentDialog.Toggle | The toggle with identifier. |
GetAllButtonIds()
Get all defined button ids.
Declaration
public List<string> GetAllButtonIds()
Returns
Type | Description |
---|---|
List<System.String> |
GetAllToggleIds()
Get all defined toggle ids.
Declaration
public List<string> GetAllToggleIds()
Returns
Type | Description |
---|---|
List<System.String> |
GetAllUrlsInContent()
Find all the urls that can be found in Content.
Declaration
public IEnumerable<string> GetAllUrlsInContent()
Returns
Type | Description |
---|---|
IEnumerable<System.String> |
GetSplittedContents()
Declaration
public List<string> GetSplittedContents()
Returns
Type | Description |
---|---|
List<System.String> |
IsButtonPattern(String)
Check if a string is a ButtonPattern
Declaration
public static bool IsButtonPattern(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
Returns
Type | Description |
---|---|
System.Boolean |
IsShowingAnyDialog()
Determines if any consent dialog is being shown.
Declaration
public static bool IsShowingAnyDialog()
Returns
Type | Description |
---|---|
System.Boolean |
|
IsTogglePattern(String)
Check if a string is a TogglePattern.
Declaration
public static bool IsTogglePattern(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveButton(String)
Removes the button with the specified ID from the dialog if any.
Declaration
public void RemoveButton(string buttonId)
Parameters
Type | Name | Description |
---|---|---|
System.String | buttonId | Button identifier. |
RemoveToggle(String)
Removes the toggle with the specified ID from the dialog if any.
Declaration
public void RemoveToggle(string toggleId)
Parameters
Type | Name | Description |
---|---|---|
System.String | toggleId | Toggle identifier. |
SearchForIdInButtonPattern(String)
Declaration
public static string SearchForIdInButtonPattern(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
Returns
Type | Description |
---|---|
System.String |
SearchForIdInTogglePattern(String)
Declaration
public static string SearchForIdInTogglePattern(string source)
Parameters
Type | Name | Description |
---|---|---|
System.String | source |
Returns
Type | Description |
---|---|
System.String |
SetButtonInteractable(String, Boolean)
Sets the interactable state of the button with the specified ID. Use this to update the button's interactable setting while the dialog is showing.
Declaration
public void SetButtonInteractable(string buttonId, bool interactable)
Parameters
Type | Name | Description |
---|---|---|
System.String | buttonId | Button identifier. |
System.Boolean | interactable | If set to |
SetToggleInteractable(String, Boolean)
Sets the interactable state of the toggle with the specified ID. Use this to update the toggle's interactable setting while the dialog is showing.
Declaration
public void SetToggleInteractable(string toggleId, bool interactable)
Parameters
Type | Name | Description |
---|---|---|
System.String | toggleId | Toggle identifier. |
System.Boolean | interactable | If set to |
SetToggleIsOn(String, Boolean, Boolean)
Sets the value of toggle with the specified ID. Use this to update the toggle state from script while the dialog is showing.
Declaration
public void SetToggleIsOn(string toggleId, bool isOn, bool animated = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | toggleId | Toggle identifier. |
System.Boolean | isOn | If set to |
System.Boolean | animated | If set to |
Show(Boolean)
Show the consent dialog.
Declaration
public void Show(bool isDismissible = false)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | isDismissible | If set to |
Events
Completed
Occurs when the dialog is completed, which means it is closed by the user clicking an action button inside the dialog. This event is always raised on main thread.
Declaration
public event ConsentDialog.CompletedHandler Completed
Event Type
Type | Description |
---|---|
ConsentDialog.CompletedHandler |
Dismissed
Occurs when the dialog is dismissed, which means it is closed by the user clicking the default 'Cancel' button on iOS or the 'Back' button on Android. This event is always raised on main thread.
Declaration
public event Action<ConsentDialog> Dismissed
Event Type
Type | Description |
---|---|
System.Action<ConsentDialog> |
ToggleStateUpdated
Occurs when the state of any toggle in the dialog is changed. This event is always raised on main thread.
Declaration
public event ConsentDialog.ToggleStateUpdatedHandler ToggleStateUpdated
Event Type
Type | Description |
---|---|
ConsentDialog.ToggleStateUpdatedHandler |