/*
* Copyright(c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Runtime.InteropServices;
using System.ComponentModel;
namespace Tizen.NUI
{
///
/// AutofillContainer controls several text input boxes.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class AutofillContainer : BaseHandle
{
private AuthenticationEventCallbackType authenticationCallback;
private ListEventCallbackType listCallback;
private event EventHandler authenticationEventHandler;
private event EventHandler listEventHandler;
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
private delegate void AuthenticationEventCallbackType(IntPtr autofillContainer);
private delegate void ListEventCallbackType(IntPtr control);
///
/// AutofillContainer Authentication Service Event.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ServiceEvent
{
add
{
if (authenticationEventHandler == null)
{
authenticationCallback = OnServiceEvent;
AutofillServiceEventSignal().Connect(authenticationCallback);
}
authenticationEventHandler += value;
}
remove
{
authenticationEventHandler -= value;
if (authenticationEventHandler == null && authenticationCallback != null)
{
AutofillServiceEventSignal().Disconnect(authenticationCallback);
}
}
}
///
/// AutofillContainer Fill List Event.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public event EventHandler ListEvent
{
add
{
if (listEventHandler == null)
{
listCallback = OnListEvent;
AutofillListEventSignal().Connect(listCallback);
}
listEventHandler += value;
}
remove
{
listEventHandler -= value;
if (listEventHandler == null && listCallback != null)
{
AutofillListEventSignal().Disconnect(listCallback);
}
}
}
///
/// Constructor.
///
/// The AutofillContainer name
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public AutofillContainer(string name) : this(Interop.AutofillContainer.New(name), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal AutofillContainer(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn)
{
}
internal AutofillContainer(AutofillContainer autofillContainer) : this(Interop.AutofillContainer.NewAutofillContainer(AutofillContainer.getCPtr(autofillContainer)), true)
{
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal AutofillContainer Assign(AutofillContainer autofillContainer)
{
AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.Assign(SwigCPtr, AutofillContainer.getCPtr(autofillContainer)), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal static AutofillContainer DownCast(BaseHandle handle)
{
AutofillContainer ret = new AutofillContainer(Interop.AutofillContainer.DownCast(BaseHandle.getCPtr(handle)), true);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Adds View and its Autofill item information to Autofill Container.
///
/// The view to be added to Autofill Container
/// The Property to be filled automatically of each View
/// A unique ID that does not always change on each launching
/// An auxiliary means to guess heuristically what data is
/// The Hint - id (username), name, password, phone, credit card number, organization, and so on
/// Whether this information is a sensitive data or not
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void AddAutofillView(BaseComponents.View view, int propertyIndex, string id, string label, AutofillContainer.ItemHint hint, bool isSensitive)
{
Interop.AutofillContainer.AddAutofillView(SwigCPtr, BaseComponents.View.getCPtr(view), propertyIndex, id, label, (uint)hint, isSensitive);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Removes View and its AutofillItem information to Autofill Container.
///
/// The view to be removed to Autofill Container
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void RemoveAutofillItem(BaseComponents.View view)
{
Interop.AutofillContainer.RemoveAutofillItem(SwigCPtr, BaseComponents.View.getCPtr(view));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Stores autofill data.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void SaveAutofillData()
{
Interop.AutofillContainer.SaveAutofillData(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Sends a request for filling the data.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public void RequestFillData()
{
Interop.AutofillContainer.RequestFillData(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
///
/// Gets the Autofill Service Name.
///
/// Autofill Service Name
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string GetAutofillServiceName()
{
string ret = Interop.AutofillContainer.GetAutofillServiceName(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the Autofill Service Message.
///
/// Autofill Service Message
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string GetAutofillServiceMessage()
{
string ret = Interop.AutofillContainer.GetAutofillServiceMessage(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the Autofill Service Image Path.
///
/// Autofill Service Image Path
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string GetAutofillServiceImagePath()
{
string ret = Interop.AutofillContainer.GetAutofillServiceImagePath(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the number of list items. (The presentation text of Autofill)
///
/// The number of list items
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public uint GetListItemCount()
{
uint ret = Interop.AutofillContainer.GetListItemCount(SwigCPtr);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Gets the list item of the index.
///
/// The index for the list
/// The list item of the index
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public string GetListItem(uint index)
{
string ret = Interop.AutofillContainer.GetListItem(SwigCPtr, index);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Sets the selected item to fill out.
///
/// The selected item
/// 5
public void SetSelectedItem(string selected)
{
Interop.AutofillContainer.SetSelectedItem(SwigCPtr, selected);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
internal AuthenticationSignalType AutofillServiceEventSignal()
{
AuthenticationSignalType ret = new AuthenticationSignalType(Interop.AutofillContainer.AutofillServiceEventSignal(SwigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
internal ListEventSignalType AutofillListEventSignal()
{
ListEventSignalType ret = new ListEventSignalType(Interop.AutofillContainer.AutofillListEventSignal(SwigCPtr), false);
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
return ret;
}
///
/// Dispose.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void Dispose(DisposeTypes type)
{
if (disposed)
{
return;
}
//Release your own unmanaged resources here.
//You should not access any managed member here except static instance.
//because the execution order of Finalizes is non-deterministic.
if (this != null)
{
if (authenticationCallback != null)
{
AutofillServiceEventSignal().Disconnect(authenticationCallback);
}
if (listCallback != null)
{
AutofillListEventSignal().Disconnect(listCallback);
}
}
base.Dispose(type);
}
/// This will not be public opened.
[EditorBrowsable(EditorBrowsableState.Never)]
protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr)
{
Interop.AutofillContainer.DeleteAutofillContainer(swigCPtr);
}
private void OnServiceEvent(IntPtr autofillContainer)
{
AuthenticationEventArgs e = new AuthenticationEventArgs();
e.AutofillContainer = Registry.GetManagedBaseHandleFromNativePtr(autofillContainer) as AutofillContainer;
if (authenticationEventHandler != null)
{
authenticationEventHandler(this, e);
}
}
private void OnListEvent(IntPtr control)
{
ListEventArgs e = new ListEventArgs();
e.Control = Registry.GetManagedBaseHandleFromNativePtr(control) as BaseComponents.View;
if (listEventHandler != null)
{
listEventHandler(this, e);
}
}
///
/// Event arguments that passed via the Authentication event.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class AuthenticationEventArgs : EventArgs
{
///
/// The instance of AutofillContainer
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public AutofillContainer AutofillContainer
{
get;
set;
}
}
///
/// AutofillContainer list event arguments.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public class ListEventArgs : EventArgs
{
///
/// The instance of AutofillContainer
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public BaseComponents.View Control
{
get;
set;
}
}
///
/// Enumeration for hint of the autofill item.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
public enum ItemHint
{
///
/// Autofill hint for a credit card expiration date
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardExpirationData,
///
/// Autofill hint for a credit card expiration day
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardExpirationDay,
///
/// Autofill hint for a credit card expiration month
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardExpirationMonth,
///
/// Autofill hint for a credit card expiration year
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardExpirationYear,
///
/// Autofill hint for a credit card number
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardNumber,
///
/// Autofill hint for an email address
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
EmailAddress,
///
/// Autofill hint for a user's real name
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
Name,
///
/// Autofill hint for a phone number
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
Phone,
///
/// Autofill hint for a postal address
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
PostalAddress,
///
/// Autofill hint for a postal code
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
PostalCode,
///
/// Autofill hint for a user's ID
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
Id,
///
/// Autofill hint for password
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
Password,
///
/// Autofill hint for a credit card security code
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API.
[EditorBrowsable(EditorBrowsableState.Never)]
CreditCardSecurityCode
}
}
}