X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2FTizen.Applications.Notification%2FTizen.Applications.Notifications%2FNotification.cs;h=8ac2c210da82f33cdfd76a970bc4037958ef5c19;hb=f2eae88f6e7a6883f35a795bf21ca4b6a07a493c;hp=ec7202a89c090ba2ef34d7b985155f84b2c4a101;hpb=e75934b05630411e63ef6892d79a833e2da12da9;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git
diff --git a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs
index ec7202a..8ac2c21 100755
--- a/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs
+++ b/src/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs
@@ -21,7 +21,7 @@ namespace Tizen.Applications.Notifications
using System.ComponentModel;
///
- /// Class containing common properties and methods of Notifications
+ /// This class contains common properties and methods of notifications.
///
///
/// A notification is a message that is displayed on the notification area.
@@ -36,77 +36,89 @@ namespace Tizen.Applications.Notifications
private bool disposed = false;
private IDictionary styleDictionary;
- private IDictionary extenderDictionary;
+ private IDictionary extraDataDictionary;
private int count = 0;
///
/// Initializes a new instance of the class.
///
+ /// 3
public Notification()
{
styleDictionary = new Dictionary();
- extenderDictionary = new Dictionary();
+ extraDataDictionary = new Dictionary();
}
///
- /// Gets or sets Tag of Notification.
+ /// Gets or sets the tag of notification.
///
+ /// 3
public string Tag { get; set; } = string.Empty;
///
- /// Gets or sets Title of Notification.
+ /// Gets or sets the title of notification.
///
+ /// 3
public string Title { get; set; } = string.Empty;
///
- /// Gets or sets icon of Notification.
+ /// Gets or sets the icon of notification.
+ /// You should set an absolute path for an image file.
///
+ /// 3
public string Icon { get; set; } = string.Empty;
///
- /// Gets or sets sub icon of Notification.
+ /// Gets or sets the sub icon of notification.
/// This SubIcon is displayed in Icon you set.
+ /// You should set an absolute path for an image file.
///
+ /// 3
public string SubIcon { get; set; } = string.Empty;
///
- /// Gets or sets content of Notification.
+ /// Gets or sets the content of notification.
///
+ /// 3
public string Content { get; set; } = string.Empty;
///
- /// Gets or sets a value indicating whether TimeStamp of Notification is Visible or not.
+ /// Gets or sets a value indicating whether TimeStamp of the notification is Visible or not.
/// Default to true.
///
+ /// 3
public bool IsTimeStampVisible { get; set; } = true;
///
- /// Gets or sets TimeStamp of Notification.
+ /// Gets or sets the TimeStamp of notification.
///
///
- /// If you don't set TimeStamp, It will be set value that time when the notification is posted.
+ /// If you don't set TimeStamp, it will set the value when the notification is posted.
/// TimeStamp requires NotificationManager.Post() to be called.
- /// If you set IsVisibleTimeStamp property is false, TimeStamp is not Visible in Notification.
+ /// If you set IsVisibleTimeStamp property to false, TimeStamp is not visible in notification.
///
+ /// 3
public DateTime TimeStamp { get; set; }
///
- /// Gets or sets Action which is invoked when notification is clicked
+ /// Gets or sets action, which is invoked when the notification is clicked.
///
///
/// If you set it to null, the already set AppControl will be removed and nothing will happen when you click on notification.
///
///
+ /// 3
public AppControl Action { get; set; }
///
- /// Gets or sets Count which is displayed at the right side of notification.
+ /// Gets or sets count, which is displayed at the right side of the notification.
///
///
/// You must set only positive number.
- /// If you set count to negative number, This property throw exception.
+ /// If you set count to negative number, this property throws exception.
///
- /// Thrown when argument is invalid
+ /// Thrown when argument is invalid.
+ /// 3
public int Count
{
get
@@ -126,23 +138,30 @@ namespace Tizen.Applications.Notifications
}
}
+ ///
+ /// Gets or sets a value indicating whether the notification is Onging or not.
+ /// Default value is false.
+ ///
+ /// 3
[EditorBrowsable(EditorBrowsableState.Never)]
public bool IsOngoing { get; set; } = false;
///
- /// Gets or sets property
+ /// Gets or sets property.
///
///
+ /// 3
public NotificationProperty Property { get; set; } = NotificationProperty.None;
///
- /// Gets or sets object for display at notification
+ /// Gets or sets object for display at notification.
///
///
+ /// 3
public ProgressType Progress { get; set; }
///
- /// Gets or sets which is included vibration, led and sound option to be applied at Notification.
+ /// Gets or sets which is included vibration, LED and sound option to be applied at notification.
///
///
/// If you set it to null, the already set AccessorySet will be initialized.
@@ -173,16 +192,18 @@ namespace Tizen.Applications.Notifications
/// NotificationManager.Post(notification);
///
///
+ /// 3
public AccessorySet Accessory { get; set; }
///
- /// Gets or sets a value indicating whether notification is displayed on default viewer.
+ /// Gets or sets a value indicating whether notification is displayed on the default viewer.
/// If you set false and add style, you can see only style notification.
///
- public bool IsDisplay { get; set; } = true;
+ /// 4
+ public bool IsVisible { get; set; } = true;
///
- /// Gets or sets NotificationSafeHandle
+ /// Gets or sets NotificationSafeHandle.
///
internal NotificationSafeHandle Handle
{
@@ -204,19 +225,19 @@ namespace Tizen.Applications.Notifications
}
///
- /// Gets or sets Private ID
+ /// Gets or sets private ID.
///
internal int PrivID { get; set; } = -1;
///
- /// Method to add various style to be applied to notification.
+ /// Method for adding various styles to be applied to notification.
///
///
- /// The user always see about valid notification style. If you add style which is not supported in platform,
+ /// The user always see about valid notification style. If you add a style which is not supported in platform,
/// this method has no effect.
///
- /// The style to be applied to notification
- /// Thrown when argument is invalid
+ /// The style to be applied to notification.
+ /// Thrown when argument is invalid.
///
///
/// Notification notification = new Notification
@@ -238,6 +259,7 @@ namespace Tizen.Applications.Notifications
/// NotificationManager.Post(notification);
///
///
+ /// 3
public void AddStyle(StyleBase style)
{
if (style == null)
@@ -260,8 +282,9 @@ namespace Tizen.Applications.Notifications
///
/// Method to remove style you already added.
///
- /// Type of notification style to be queried
- /// Thrown when argument is invalid
+ /// Type of notification style to be queried.
+ /// Thrown when argument is invalid.
+ /// 3
public void RemoveStyle() where T : Notification.StyleBase, new()
{
T type = new T();
@@ -280,11 +303,12 @@ namespace Tizen.Applications.Notifications
///
/// Method to get style you already added.
///
- /// Type of notification style to be queried
+ /// Type of notification style to be queried.
///
- /// The Notification.Style object associated with the given style
+ /// The Notification.Style object associated with the given style.
///
- /// Thrown when argument is invalid
+ /// Thrown when argument is invalid.
+ /// 3
public T GetStyle() where T : Notification.StyleBase, new()
{
T type = new T();
@@ -304,14 +328,14 @@ namespace Tizen.Applications.Notifications
}
///
- /// Method to set extender data to add extra data
+ /// Method to set extra data to add extra data.
///
///
- /// The type of extra data is Bundle.
+ /// The type of extra data is bundle.
///
/// The key of the extra data you want to add.
/// The value you want to add.
- /// Thrown when argument is invalid
+ /// Thrown when argument is invalid.
///
///
/// Notification notification = new Notification
@@ -324,46 +348,48 @@ namespace Tizen.Applications.Notifications
/// Bundle bundle = new Bundle();
/// bundle.AddItem("key", "value");
///
- /// notification.SetExtender("firstKey", bundle);
+ /// notification.SetExtraData("firstKey", bundle);
///
///
- public void SetExtender(string key, Bundle value)
+ /// 4
+ public void SetExtraData(string key, Bundle value)
{
if (value == null || value.SafeBundleHandle.IsInvalid || string.IsNullOrEmpty(key))
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered");
}
- if (extenderDictionary.ContainsKey(key) == true)
+ if (extraDataDictionary.ContainsKey(key) == true)
{
Log.Info(LogTag, "The key is existed, so extender data is replaced");
- extenderDictionary.Remove(key);
- extenderDictionary.Add(key, value);
+ extraDataDictionary.Remove(key);
+ extraDataDictionary.Add(key, value);
}
else
{
- extenderDictionary.Add(key, value);
+ extraDataDictionary.Add(key, value);
}
}
///
- /// Method to remove extender you already added.
+ /// Method to remove extra you already added.
///
///
- /// The type of extra data is Bundle.
+ /// The type of extra data is bundle.
///
/// The key of the extra data to add.
- /// Thrown when argument is invalid
- public void RemoveExtender(string key)
+ /// Thrown when argument is invalid.
+ /// 4
+ public void RemoveExtraData(string key)
{
if (string.IsNullOrEmpty(key))
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered");
}
- if (extenderDictionary.ContainsKey(key))
+ if (extraDataDictionary.ContainsKey(key))
{
- extenderDictionary.Remove(key);
+ extraDataDictionary.Remove(key);
}
else
{
@@ -372,12 +398,13 @@ namespace Tizen.Applications.Notifications
}
///
- /// Method to get extender data you already set
+ /// Method to get extra data you already set.
///
/// The key of the extra data to get.
- /// Bundle Object that include extender data
- /// Thrown when argument is invalid
- public Bundle GetExtender(string key)
+ /// Bundle Object that include extra data
+ /// Thrown when argument is invalid.
+ /// 4
+ public Bundle GetExtraData(string key)
{
if (string.IsNullOrEmpty(key))
{
@@ -385,7 +412,7 @@ namespace Tizen.Applications.Notifications
}
Bundle bundle;
- if (extenderDictionary.TryGetValue(key, out bundle) == false)
+ if (extraDataDictionary.TryGetValue(key, out bundle) == false)
{
throw NotificationErrorFactory.GetException(NotificationError.InvalidParameter, "invalid parameter entered : " + key);
}
@@ -396,6 +423,7 @@ namespace Tizen.Applications.Notifications
///
/// Releases any unmanaged resources used by this object.
///
+ /// 3
public void Dispose()
{
Dispose(true);
@@ -409,7 +437,7 @@ namespace Tizen.Applications.Notifications
return;
}
- if (disposing)
+ if (disposing && Handle != null && Handle.IsInvalid == false)
{
Handle.Dispose();
}
@@ -422,9 +450,9 @@ namespace Tizen.Applications.Notifications
return styleDictionary;
}
- internal IDictionary GetExtenderDictionary()
+ internal IDictionary GetextraDataDictionary()
{
- return extenderDictionary;
+ return extraDataDictionary;
}
internal StyleBase GetStyle(string key)
@@ -448,10 +476,10 @@ namespace Tizen.Applications.Notifications
{
NotificationBinder.BindObject(this);
- foreach (string key in GetExtenderDictionary().Keys)
+ foreach (string key in GetextraDataDictionary().Keys)
{
Log.Info(LogTag, "Start to bind Notification.ExtenderData to SafeHandle");
- Interop.Notification.SetExtentionData(Handle, key, extenderDictionary[key].SafeBundleHandle);
+ Interop.Notification.SetExtensionData(Handle, key, extraDataDictionary[key].SafeBundleHandle);
}
foreach (Notification.StyleBase style in styleDictionary.Values)
@@ -475,21 +503,24 @@ namespace Tizen.Applications.Notifications
internal Notification Build()
{
- IntPtr extention = IntPtr.Zero;
- IntPtr extentionBundlePtr = IntPtr.Zero;
+ IntPtr extension = IntPtr.Zero;
+ IntPtr extensionBundlePtr = IntPtr.Zero;
NotificationBinder.BindSafeHandle(this);
- Interop.Notification.GetExtentionBundle(Handle, out extention, out extentionBundlePtr);
+ Interop.Notification.GetExtensionBundle(Handle, out extension, out extensionBundlePtr);
- if (extention != IntPtr.Zero)
+ if (extension != IntPtr.Zero)
{
- Bundle bundle = new Bundle(new SafeBundleHandle(extention, false));
+ Bundle bundle = new Bundle(new SafeBundleHandle(extension, false));
foreach (string key in bundle.Keys)
{
+ if (key.StartsWith("_NOTIFICATION_EXTENSION_EVENT_"))
+ continue;
+
SafeBundleHandle sbh;
- Interop.Notification.GetExtentionData(Handle, key, out sbh);
- extenderDictionary.Add(key, new Bundle(sbh));
+ Interop.Notification.GetExtensionData(Handle, key, out sbh);
+ extraDataDictionary.Add(key, new Bundle(sbh));
}
}