remove badge dependency for legacy NotificationManager
[platform/framework/native/appfw.git] / src / app / FApp_NotificationManagerImpl.h
1 //
2 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Apache License, Version 2.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 /**
18  * @file        FApp_NotificationManagerImpl.h
19  * @brief       This is the header file for the %_NotificationManagerImpl class.
20  */
21
22 #ifndef _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
23 #define _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_
24
25 #include <FBaseObject.h>
26 #include <FAppTypes.h>
27 #include <FOspConfig.h>
28
29 #include <FBaseRt_LibraryImpl.h>
30
31
32 namespace Tizen { namespace App
33 {
34
35 class _INotificationManagerImpl;
36
37 class _NotificationManagerImpl
38 {
39
40 public:
41         /**
42          * This is the default constructor for this class.
43          *
44          * @since               1.0
45          */
46         _NotificationManagerImpl(void);
47
48         /**
49          * This is the destructor for this class.
50          *
51          * @since               1.0
52          */
53         ~_NotificationManagerImpl(void);
54
55         /**
56          * Initializes this instance of %_NotificationManagerImpl.
57          *
58          * @since                       1.0
59          * @return              An error code
60          * @exception   E_SUCCESS               The method is successful.
61          * @exception   E_SYSTEM                A system error has occurred.
62          * @exception   E_OUT_OF_MEMORY The memory is insufficient.
63          */
64         result Construct(void);
65
66         /**
67          * Gets the badge number of the application icon.
68          *
69          * @since                               1.0
70          *
71          * @return              The current badge number
72          * @exception   E_SUCCESS                       The method is successful.
73          * @exception   E_SYSTEM                        A system error has occurred.
74          * @exception   E_OBJ_NOT_FOUND     The application is not installed.
75          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
76          *                                  The Construct() method is not called.
77          * @remarks The specific error code can be accessed using the GetLastResult() method. @n
78          *          In case of failure, this method returns @c -1.
79          */
80         int GetBadgeNumber(void) const;
81
82         /**
83          * Notifies the user using a badge number.
84          *
85          * @since                               1.0
86          *
87          * @return              An error code
88          * @param[in]   badgeNumber                     The badge number
89          * @exception   E_SUCCESS                       The method is successful.
90          * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
91          *                                  the specified @c badgeNumber is less than @c 0.
92          * @exception   E_SYSTEM                        A system error has occurred.
93          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
94          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
95          *                                  The Construct() method is not called.
96          */
97         result Notify(int badgeNumber) const;
98
99         /**
100          * Notifies the user using a message.
101          *
102          * @since                               1.0
103          *
104          * @return              An error code
105          * @param[in]   messageText                     The notification message
106          * @exception   E_SUCCESS                       The method is successful.
107          * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
108          *                                                                      the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
109          * @exception   E_SYSTEM                        A system error has occurred.
110          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
111          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
112          *                                  The Construct() method is not called.
113          */
114         result Notify(const Tizen::Base::String& messageText) const;
115
116         /**
117          * Notifies the user using a message and badge number.
118          *
119          * @since                               1.0
120          *
121          * @return              An error code
122          * @param[in]   messageText                     The notification message
123          * @param[in]   badgeNumber                     The badge number
124          * @exception   E_SUCCESS                       The method is successful.
125          * @exception   E_INVALID_ARG           The specified @c badgeNumber is less than @c 0, or
126          *                                                                      the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
127          * @exception   E_SYSTEM                        A system error has occurred.
128          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
129          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
130          *                                  The Construct() method is not called.
131          */
132         result Notify(const Tizen::Base::String& messageText, int badgeNumber) const;
133
134         /**
135          * Notifies the user using a message and badge number. @n
136          * If the user checks the message, @c launchArguments is delivered to the application. @n
137          * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
138          * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
139          *
140          * @since                               1.0
141          *
142          * @return              An error code
143          * @param[in]   messageText                     The notification message
144          * @param[in]   badgeNumber                     The badge number
145          * @param[in]   launchArguments         The message for application
146          * @exception   E_SUCCESS                       The method is successful.
147          * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
148          *                                                                      - A specified input parameter is invalid. @n
149          *                                                                      - The specified @c badgeNumber is less than @c 0. @n
150          *                                                                      - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
151          *                                                                      - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
152          * @exception   E_SYSTEM                        A system error has occurred.
153          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
154          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
155          *                                                                              The Construct() method is not called.
156          * @see                 Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
157          */
158         result Notify(const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
159
160         /**
161          * Removes the notification message.
162          *
163          * @since                       2.0
164          *
165          * @return              An error code
166          * @exception   E_SUCCESS                       The method was successful.
167          * @exception   E_SYSTEM                        A system error occurred.
168          * @exception   E_INVALID_STATE         This instance is in an invalid state: @n
169          *                                  - The Construct() method is not called. @n
170          * @remarks      The method returns E_SUCCESS when there is no outstanding notification.
171          */
172         result RemoveNotification(void);
173
174         /**
175          * Notifies the user about the ongoing activity using a message.
176          *
177          * @since                               2.0
178          *
179          * @return              An error code
180          * @param[in]   messageText                     The notification message
181          * @exception   E_SUCCESS                       The method is successful.
182          * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
183          *                                                                      the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
184          * @exception   E_SYSTEM                        A system error has occurred.
185          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
186          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
187          *                                  The Construct() method is not called.
188          */
189         result NotifyOngoingActivity(const Tizen::Base::String& messageText) const;
190
191         /**
192          * Notifies the user about the ongoing activity using a message. @n
193          * @c launchArguments is specified as input parameter for Application::OnUserEventReceivedN() or can be obtained by
194          * invoking Application::GetAppArgumentListN(), especially within Application::OnAppInitializing().
195          *
196          * @since                               2.0
197          *
198          * @return              An error code
199          * @param[in]   messageText                     The notification message
200          * @param[in]  launchArguments  The launch arguments for the application
201          * @exception   E_SUCCESS                       The method is successful.
202          * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
203          *                                                                      - A specified input parameter is invalid. @n
204          *                                                                      - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
205          *                                                                      - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
206          * @exception   E_SYSTEM                        A system error has occurred.
207          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
208          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
209          *                                  The Construct() method is not called.
210          * @see                 Application::OnUserEventReceivedN(), Application::GetAppArgumentListN()
211          */
212         result NotifyOngoingActivity(const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
213
214         /**
215          * Removes the notification message for the ongoing activity.
216          *
217          * @since                       2.0
218          *
219          * @return              An error code
220          * @exception   E_SUCCESS                       The method is successful.
221          * @exception   E_SYSTEM                        A system error has occurred.
222          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
223          *                                  The Construct() method is not called.
224          * @remarks      The method returns E_SUCCESS when there is no outstanding notification.
225          */
226         result RemoveOngoingActivityNotification(void);
227
228         /**
229          * Gets the badge number of the application icon.
230          *
231          * @since                               1.0
232          *
233          * @return              The current badge number
234          * @param[in]   appId                           The application ID
235          * @exception   E_SUCCESS                       The method is successful.
236          * @exception   E_SYSTEM                        A system error has occurred.
237          * @exception   E_OBJ_NOT_FOUND     The application is not installed.
238          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
239          *                                  The Construct() method is not called.
240          * @remarks The specific error code can be accessed using the GetLastResult() method. @n
241          *                      In case of failure, this method returns @c -1.
242          */
243         int GetBadgeNumber(const AppId& appId) const;
244
245         /**
246          * Notifies the user using a badge number on behalf of the specified application.
247          *
248          * @since                                       1.0
249          *
250          * @return              An error code
251          * @param[in]   appId                           The application ID
252          * @param[in]   badgeNumber                     The badge number
253          * @exception   E_SUCCESS                       The method is successful.
254          * @exception   E_INVALID_ARG           A specified input parameter is invalid, or
255          *                                  the specified @c badgeNumber is less than @c 0.
256          * @exception   E_APP_NOT_INSTALLED  The application is not installed.
257          * @exception   E_INVALID_OPERATION     The target application with the specified application ID is not permitted to get any notification as per the Tizen platform policy.
258          * @exception   E_SYSTEM                        A system error has occurred.
259          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
260          *                                                                      The Construct() method is not called.
261          */
262         result NotifyOnBehalf(const AppId& appId, int badgeNumber) const;
263
264         /**
265          * Notifies the user using a message on behalf of the specified application.
266          *
267          * @since                                       1.0
268          *
269          * @return              An error code
270          * @param[in]   appId                           The application ID
271          * @param[in]   messageText                     The notification message
272          * @exception   E_SUCCESS                       The method is successful.
273          * @exception   E_INVALID_ARG           A specified input parameter is invalid, or
274          *                                                                      the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
275          * @exception   E_APP_NOT_INSTALLED  The application is not installed.
276          * @exception   E_INVALID_OPERATION     The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy.
277          * @exception   E_SYSTEM                        A system error has occurred.
278          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
279          *                                                                      The Construct() method is not called.
280          */
281         result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText) const;
282
283         /**
284          * Notifies the user using a message and badge number on behalf of the specified application.
285          *
286          * @since                                       1.0
287          *
288          * @return              An error code
289          * @param[in]   appId                           The application ID
290          * @param[in]   messageText                     The notification message
291          * @param[in]   badgeNumber                     The badge number
292          * @exception   E_SUCCESS                       The method is successful.
293          * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
294          *                                                                      - A specified input parameter is invalid. @n
295          *                                                                      - The specified @c badgeNumber is less than @c 0. @n
296          *                                                                      - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
297          * @exception   E_APP_NOT_INSTALLED  The application is not installed.
298          * @exception   E_INVALID_OPERATION     The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy.
299          * @exception   E_SYSTEM                        A system error has occurred.
300          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
301          *                                  The Construct() method is not called.
302          */
303         result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber) const;
304
305         /**
306         * Notifies the user using a message and badge number on behalf of the specified application. @n
307         * If the user checks the message, the @c launchArguments is delivered to the application.
308         *
309         * @since               2.0
310         *
311         * @return             An error code
312         * @param[in]  appId                             The application ID
313         * @param[in]  messageText               The notification message
314         * @param[in]  launchArguments   The launch arguments for the application
315         * @exception  E_SUCCESS                 The method is successful.
316         * @exception  E_INVALID_ARG             Either of the following conditions has occurred: @n
317         *                                                               - A specified input parameter is invalid. @n
318         *                                                               - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
319         *                                                               - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
320         * @exception  E_APP_NOT_INSTALLED       The application is not installed.
321         * @exception  E_INVALID_OPERATION       The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy.
322         * @exception  E_SYSTEM                          A system error has occurred.
323         * @exception  E_INVALID_STATE           This instance is in an invalid state. @n
324          *                                  The Construct() method is not called.
325         */
326         result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
327
328         /**
329         * Notifies the user using a message and badge number on behalf of the specified application. @n
330         * If the user checks the message, the @c launchArguments is delivered to the application.
331         *
332         * @since               2.0
333         *
334         * @return             An error code
335         * @param[in]  appId                             The application ID
336         * @param[in]  messageText               The notification message
337         * @param[in]    badgeNumber                     The badge number
338         * @param[in]  launchArguments   The launch arguments for the application
339         * @exception  E_SUCCESS                 The method is successful.
340         * @exception  E_INVALID_ARG             Either of the following conditions has occurred: @n
341         *                                                               - A specified input parameter is invalid. @n
342         *                                                               - The specified @c badgeNumber is less than 0. @n
343         *                                                               - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
344         *                                                               - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
345         * @exception  E_APP_NOT_INSTALLED       The application is not installed.
346         * @exception  E_INVALID_OPERATION       The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy.
347         * @exception  E_SYSTEM                          A system error has occurred.
348         * @exception  E_INVALID_STATE           This instance is in an invalid state. @n
349          *                                  The Construct() method is not called.
350         */
351         result NotifyOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, int badgeNumber, const Tizen::Base::String& launchArguments) const;
352
353         /**
354          * Notifies the user about the ongoing activity using a message on behalf of the specified application.
355          *
356          * @since                               2.0
357          *
358          * @return              An error code
359          * @param[in]   appId                           The application ID
360          * @param[in]   messageText                     The notification message
361          * @exception   E_SUCCESS                       The method is successful.
362          * @exception   E_INVALID_ARG           The specified input parameter is invalid, or
363          *                                                                      the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH.
364          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
365          * @exception   E_SYSTEM                        A system error has occurred.
366          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
367          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
368          *                                  The Construct() method is not called.
369          */
370         result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText) const;
371
372         /**
373          * Notifies the user about the ongoing activity using a message on behalf of the specified application.
374          *
375          * @since                               2.0
376          *
377          * @return              An error code
378          * @param[in]   appId                           The application ID
379          * @param[in]   messageText                     The notification message
380          * @param[in]  launchArguments  The launch arguments for application
381          * @exception   E_SUCCESS                       The method is successful.
382          * @exception   E_INVALID_ARG           Either of the following conditions has occurred: @n
383          *                                                                      - A specified input parameter is invalid. @n
384          *                                                                      - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n
385          *                                                                      - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH.
386          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
387          * @exception   E_SYSTEM                        A system error has occurred.
388          * @exception   E_INVALID_OPERATION     The type of application calling this method is invalid as per the Tizen platform policy.
389          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
390          *                                                                      The Construct() method is not called.
391          */
392         result NotifyOngoingActivityOnBehalf(const AppId& appId, const Tizen::Base::String& messageText, const Tizen::Base::String& launchArguments) const;
393
394         /**
395          * Removes the notification message for ongoing activity on behalf of the specified application.
396          *
397          * @since                       2.0
398          *
399          * @return              An error code
400          * @param[in]   appId                           The application ID
401          * @exception   E_SUCCESS                       The method is successful.
402          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
403          * @exception   E_SYSTEM                        A system error has occurred.
404          * @exception   E_INVALID_STATE         This instance is in an invalid state. @n
405          *                                  The Construct() method is not called.
406          * @remarks             Although there is no outstanding notification for the calling application, this method returns E_SUCCESS.
407          */
408         result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId);
409
410         /**
411          * Removes the notification message on behalf of the specified application.
412          *
413          * @since                       2.0
414          *
415          * @return              An error code
416          * @param[in]   appId                           The application ID
417          * @exception   E_SUCCESS                       The method was successful.
418          * @exception   E_APP_NOT_INSTALLED     The application is not installed.
419          * @exception   E_SYSTEM                        A system error occurred.
420          * @exception   E_INVALID_STATE         This instance is in an invalid state: @n
421          *                                                                      - The Construct() method is not called. @n
422          * @remarks             Although there is no outstanding notification for the calling application, this method returns E_SUCCESS.
423          */
424         result RemoveNotificationOnBehalf(const AppId& appId);
425
426 private:
427         _NotificationManagerImpl(const _NotificationManagerImpl& rhs);
428
429         _NotificationManagerImpl& operator =(const _NotificationManagerImpl& rhs);
430
431 private:
432         _INotificationManagerImpl* __pNotiImpl;
433         Tizen::Base::Runtime::_LibraryImpl __lib;
434 };      //_NotificationManagerImpl
435
436 } } // Tizen::App
437
438 #endif // _FAPP_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_