diff options
Diffstat (limited to 'Tizen.Applications.Notification/Tizen.Applications.Notifications')
9 files changed, 122 insertions, 42 deletions
diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs index ec7202a..d0f9c7f 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/Notification.cs @@ -36,7 +36,7 @@ namespace Tizen.Applications.Notifications private bool disposed = false; private IDictionary<string, StyleBase> styleDictionary; - private IDictionary<string, Bundle> extenderDictionary; + private IDictionary<string, Bundle> extraDataDictionary; private int count = 0; /// <summary> @@ -45,7 +45,7 @@ namespace Tizen.Applications.Notifications public Notification() { styleDictionary = new Dictionary<string, StyleBase>(); - extenderDictionary = new Dictionary<string, Bundle>(); + extraDataDictionary = new Dictionary<string, Bundle>(); } /// <summary> @@ -60,12 +60,14 @@ namespace Tizen.Applications.Notifications /// <summary> /// Gets or sets icon of Notification. + /// An absolute path for an image file. /// </summary> public string Icon { get; set; } = string.Empty; /// <summary> /// Gets or sets sub icon of Notification. - /// This SubIcon is displayed in Icon you set. + /// An absolute path for an image file. + /// The SubIcon is superimposed on the lower right of the icon. /// </summary> public string SubIcon { get; set; } = string.Empty; @@ -177,9 +179,9 @@ namespace Tizen.Applications.Notifications /// <summary> /// Gets or sets a value indicating whether notification is displayed on default viewer. - /// If you set false and add style, you can see only style notification. + /// If you set false and add style, It will be shown only on the style you added. /// </summary> - public bool IsDisplay { get; set; } = true; + public bool IsVisible { get; set; } = true; /// <summary> /// Gets or sets NotificationSafeHandle @@ -304,7 +306,7 @@ namespace Tizen.Applications.Notifications } /// <summary> - /// Method to set extender data to add extra data + /// Method to set extra data to add extra data /// </summary> /// <remarks> /// The type of extra data is Bundle. @@ -324,46 +326,46 @@ namespace Tizen.Applications.Notifications /// Bundle bundle = new Bundle(); /// bundle.AddItem("key", "value"); /// - /// notification.SetExtender("firstKey", bundle); + /// notification.SetExtraData("firstKey", bundle); /// </code> /// </example> - public void SetExtender(string key, Bundle value) + 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); } } /// <summary> - /// Method to remove extender you already added. + /// Method to remove extra you already added. /// </summary> /// <remarks> /// The type of extra data is Bundle. /// </remarks> /// <param name="key">The key of the extra data to add.</param> /// <exception cref="ArgumentException">Thrown when argument is invalid</exception> - public void RemoveExtender(string key) + 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 +374,12 @@ namespace Tizen.Applications.Notifications } /// <summary> - /// Method to get extender data you already set + /// Method to get extra data you already set /// </summary> /// <param name="key">The key of the extra data to get.</param> - /// <returns>Bundle Object that include extender data</returns> + /// <returns>Bundle Object that include extra data</returns> /// <exception cref="ArgumentException">Thrown when argument is invalid</exception> - public Bundle GetExtender(string key) + public Bundle GetExtraData(string key) { if (string.IsNullOrEmpty(key)) { @@ -385,7 +387,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); } @@ -422,9 +424,9 @@ namespace Tizen.Applications.Notifications return styleDictionary; } - internal IDictionary<string, Bundle> GetExtenderDictionary() + internal IDictionary<string, Bundle> GetextraDataDictionary() { - return extenderDictionary; + return extraDataDictionary; } internal StyleBase GetStyle(string key) @@ -448,10 +450,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.SetExtentionData(Handle, key, extraDataDictionary[key].SafeBundleHandle); } foreach (Notification.StyleBase style in styleDictionary.Values) @@ -487,9 +489,12 @@ namespace Tizen.Applications.Notifications Bundle bundle = new Bundle(new SafeBundleHandle(extention, 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)); + extraDataDictionary.Add(key, new Bundle(sbh)); } } diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs index ec7958d..948c8de 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationAccessorySet.cs @@ -37,12 +37,13 @@ namespace Tizen.Applications.Notifications /// Gets or sets the sound option. Default to AccessoryOption.Off. /// </summary> /// <remarks> - /// If you set AccessoryOption.Custom and not set SoundPath, then turn on the default sound. + /// If you set AccessoryOption.Custom, you must the SoundPath. Otherwise, an exception is thrown. /// </remarks> public AccessoryOption SoundOption { get; set; } = AccessoryOption.Off; /// <summary> /// Gets or sets the sound path, It will play on the sound file you set. + /// An absolute path for a sound file. /// </summary> public string SoundPath { get; set; } @@ -52,29 +53,29 @@ namespace Tizen.Applications.Notifications public bool CanVibrate { get; set; } = false; /// <summary> - /// Gets or sets the led option. Default to AccessoryOption.Off. + /// Gets or sets the led option. The default value is AccessoryOption.Off. /// </summary> /// <remarks> - /// If you set AccessoryOption.Custom and not set LedColor, then turn on the LED with default color. + /// If you set AccessoryOption.Custom and not set LedColor, the LED will show default color. /// </remarks> public AccessoryOption LedOption { get; set; } = AccessoryOption.Off; /// <summary> - /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate + /// Gets or sets the on time so that it looks like the device's LED is blinking. /// </summary> /// <remarks> /// Default value of LedOnMillisecond is 0. /// The rate is specified in terms of the number of Milliseconds to be on. - /// You should always set LedOnMillisecond with LedOffMillisecond. Otherwise, it may not operate normally. + /// You must set the on and off times at the same time. Otherwise, it may not operate normally. /// </remarks> public int LedOnMillisecond { get; set; } /// <summary> - /// Gets or sets the led on time period that you would like the LED on the device to blink. as well as the rate. + /// Gets or sets the off time so that it looks like the device's LED is blinking. /// </summary> /// <remarks> /// The rate is specified in terms of the number of Milliseconds to be off. - /// You should always set LedOffMillisecond with LedOnMillisecond. Otherwise, it may not operate normally. + /// You must set the on and off times at the same time. Otherwise, it may not operate normally. /// </remarks> public int LedOffMillisecond { get; set; } diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs index d7b9d7f..005e508 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationActiveStyle.cs @@ -112,6 +112,40 @@ namespace Tizen.Applications.Notifications public ReplyAction ReplyAction { get; set; } /// <summary> + /// Gets or sets Action which is invoked when notification is hidden by user. + /// </summary> + /// <remarks> + /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by user. + /// The property is only reflected on Tizen TV. + /// If you use this API on other profile, this action have no effect + /// </remarks> + /// <seealso cref="Tizen.Applications.AppControl"></seealso> + public AppControl HiddenByUserAction { get; set; } + + /// <summary> + /// Gets or sets Action which is invoked when there is no any response by user until hide timeout. + /// </summary> + /// <remarks> + /// This action occurs when there is no response to the notification until the delete timeout set by SetRemoveTime(). + /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by timeout. + /// The property is only reflected on Tizen TV. + /// If you use this API on other profile, this action settings have no effect + /// </remarks> + /// <seealso cref="Tizen.Applications.AppControl"></seealso> + public AppControl HiddenByTimeoutAction { get; set; } + + /// <summary> + /// Gets or sets Action which is invoked when the notification is hidden by external factor. + /// </summary> + /// <remarks> + /// If you set it to null, the already set AppControl will be removed and nothing will happen when notification is hidden by external factor. + /// The property is only reflected on Tizen TV. + /// If you use this API on other profile, this action settings have no effect + /// </remarks> + /// <seealso cref="Tizen.Applications.AppControl"></seealso> + public AppControl HiddenByExternalAction { get; set; } + + /// <summary> /// Gets the key of ActiveStyle /// </summary> internal override string Key diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs index 2d7eb4b..e7c6c21 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationBinder.cs @@ -30,7 +30,7 @@ namespace Tizen.Applications.Notifications Interop.Notification.SetID(notification.Handle, notification.PrivID); - if (notification.IsDisplay) + if (notification.IsVisible) { Interop.Notification.SetApplist(notification.Handle, (int)NotificationDisplayApplist.Tray); } @@ -78,7 +78,7 @@ namespace Tizen.Applications.Notifications Interop.Notification.GetApplist(notification.Handle, out appList); if ((appList & (int)NotificationDisplayApplist.Tray) == 0) { - notification.IsDisplay = false; + notification.IsVisible = false; } BindSafeHandleText(notification); diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs index c4c2ed5..c291e82 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationButtonAction.cs @@ -46,6 +46,7 @@ namespace Tizen.Applications.Notifications /// <summary> /// Gets or sets the image path that represent the button + /// An absolute path for an image file. /// </summary> public string ImagePath { get; set; } diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs index 7cb41d9..459bfd4 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationEnumerations.cs @@ -100,7 +100,7 @@ namespace Tizen.Applications.Notifications /// <summary> /// Value for display only SIM card inserted /// </summary> - DisplayOnlySimmode = 0x01, + DisplayOnlySimMode = 0x01, /// <summary> /// Value for disable application launch when it selected @@ -153,7 +153,10 @@ namespace Tizen.Applications.Notifications ThirdButton, ClickOnIcon = 6, ClockOnThumbnail = 7, - ClickOnTextInputButton = 8 + ClickOnTextInputButton = 8, + HiddenByUser = 100, + HiddenByTimeout = 101, + HiddenByExternal = 102, } internal enum NotificationLayout diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs index 1a890f3..bf80eab 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationManager.cs @@ -234,15 +234,15 @@ namespace Tizen.Applications.Notifications } /// <summary> - /// Searches for a posted notification which has the inputted tag and isn't deleted not yet. + /// Searches for a posted notification which has the specified tag and has not been deleted yet. /// </summary> /// <remarks> /// Load method should be called only for notifications which have been posted using NotificationManager.Post method. /// If two or more notifications share the same tag, the notification posted most recently is returned. /// </remarks> /// <param name="tag">Tag used to query</param> - /// <returns>Notification Object with inputted tag</returns> - /// <exception cref="ArgumentException">Thrown when argument is invalid or when the tag does not exist</exception> + /// <returns>Notification Object with specified tag</returns> + /// <exception cref="ArgumentException">Throwing the same exception when argument is invalid and when the tag does not exist is misleading</exception> /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception> /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception> /// <example> @@ -356,7 +356,7 @@ namespace Tizen.Applications.Notifications /// </summary> /// <param name="name">Template name</param> /// <returns>Notification Object with inputted template name</returns> - /// <exception cref="ArgumentException">Thrown when argument is invalid or when no template with input name exists</exception> + /// <exception cref="ArgumentException">Throwing the same exception when argument is invalid and when the template does not exist is misleading</exception> /// <exception cref="UnauthorizedAccessException">Thrown in case of permission denied.</exception> /// <exception cref="InvalidOperationException">Thrown in case of any internal error.</exception> /// <example> diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs index f3bc10a..3b828d9 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationReplyAction.cs @@ -27,7 +27,7 @@ namespace Tizen.Applications.Notifications public sealed partial class Notification { /// <summary> - /// Class for displaying direct-reply at notification. + /// Class for displaying direct-reply on notification. /// You must set a ReplyMax and Button. Otherwise user can't send written text to application which is set by AppControl. /// </summary> public sealed class ReplyAction : MakerBase @@ -46,7 +46,7 @@ namespace Tizen.Applications.Notifications public string PlaceHolderText { get; set; } /// <summary> - /// Gets or sets the ReplyMax of ReplyAction which is appeared at Notification. + /// Gets or sets the maximum number of characters that the user can input. /// You must set a ReplyMax. Otherwise user don't write text to placeholder in notification. /// </summary> /// <value> diff --git a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs index 587c6ef..a442e51 100755 --- a/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs +++ b/Tizen.Applications.Notification/Tizen.Applications.Notifications/NotificationStyleBinder.cs @@ -117,6 +117,21 @@ namespace Tizen.Applications.Notifications { style.ReplyAction.Make(notification); } + + if (style.HiddenByUserAction != null) + { + Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByUser, style.HiddenByUserAction.SafeAppControlHandle); + } + + if (style.HiddenByTimeoutAction != null) + { + Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByTimeout, style.HiddenByUserAction.SafeAppControlHandle); + } + + if (style.HiddenByExternalAction != null) + { + Interop.Notification.SetExtensionAction(notification.Handle, NotificationEventType.HiddenByExternal, style.HiddenByUserAction.SafeAppControlHandle); + } } internal static void BindSafeHandle(Notification notification) @@ -158,6 +173,27 @@ namespace Tizen.Applications.Notifications } } + appcontrol = null; + Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByUser, out appcontrol); + if (appcontrol != null) + { + active.HiddenByUserAction = new AppControl(appcontrol); + } + + appcontrol = null; + Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByTimeout, out appcontrol); + if (appcontrol != null) + { + active.HiddenByTimeoutAction = new AppControl(appcontrol); + } + + appcontrol = null; + Interop.Notification.GetExtensionAction(notification.Handle, NotificationEventType.HiddenByExternal, out appcontrol); + if (appcontrol != null) + { + active.HiddenByExternalAction = new AppControl(appcontrol); + } + Interop.Notification.GetAutoRemove(notification.Handle, out autoRemove); active.IsAutoRemove = autoRemove; if (autoRemove) |