1 /*
2  * Copyright (C) 2020 The Android Open Source Project
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 package com.android.deskclock.data
18 
19 /**
20  * Data that must be coordinated across all notifications is accessed via this model.
21  */
22 internal class NotificationModel {
23     /**
24      * @return `true` while the application is open in the foreground
25      */
26     /**
27      * @param inForeground `true` to indicate the application is open in the foreground
28      */
29     var isApplicationInForeground = false
30 
31     //
32     // Notification IDs
33     //
34     // Used elsewhere:
35     // Integer.MAX_VALUE - 4
36     // Integer.MAX_VALUE - 5
37     // Integer.MAX_VALUE - 7
38     //
39 
40     /**
41      * @return a value that identifies the stopwatch notification
42      */
43     val stopwatchNotificationId: Int
44         get() = Int.MAX_VALUE - 1
45 
46     /**
47      * @return a value that identifies the notification for running/paused timers
48      */
49     val unexpiredTimerNotificationId: Int
50         get() = Int.MAX_VALUE - 2
51 
52     /**
53      * @return a value that identifies the notification for expired timers
54      */
55     val expiredTimerNotificationId: Int
56         get() = Int.MAX_VALUE - 3
57 
58     /**
59      * @return a value that identifies the notification for missed timers
60      */
61     val missedTimerNotificationId: Int
62         get() = Int.MAX_VALUE - 6
63 
64     //
65     // Notification Group keys
66     //
67     // Used elsewhere:
68     // "1"
69     // "4"
70 
71     /**
72      * @return the group key for the stopwatch notification
73      */
74     val stopwatchNotificationGroupKey: String
75         get() = "3"
76 
77     /**
78      * @return the group key for the timer notification
79      */
80     val timerNotificationGroupKey: String
81         get() = "2"
82 
83     //
84     // Notification Sort keys
85     //
86 
87     /**
88      * @return the sort key for the timer notification
89      */
90     val timerNotificationSortKey: String
91         get() = "0"
92 
93     /**
94      * @return the sort key for the missed timer notification
95      */
96     val timerNotificationMissedSortKey: String
97         get() = "1"
98 }