@@ -71,6 +71,21 @@ def __get__(self, notification, cls):
71
71
notification ._attribute_cache [self ._id ] = value
72
72
return value
73
73
74
+ NOTIFICATION_CATEGORIES = (
75
+ "Other" ,
76
+ "IncomingCall" ,
77
+ "MissedCall" ,
78
+ "Voicemail" ,
79
+ "Social" ,
80
+ "Schedule" ,
81
+ "Email" ,
82
+ "News" ,
83
+ "HealthAndFitness" ,
84
+ "BusinessAndFinance" ,
85
+ "Location" ,
86
+ "Entertainment"
87
+ )
88
+
74
89
class Notification :
75
90
"""One notification that appears in the iOS notification center."""
76
91
# pylint: disable=too-many-instance-attributes
@@ -147,31 +162,7 @@ def update(self, event_flags, category_id, category_count):
147
162
def __str__ (self ):
148
163
# pylint: disable=too-many-branches
149
164
flags = []
150
- category = None
151
- if self .category_id == 0 :
152
- category = "Other"
153
- elif self .category_id == 1 :
154
- category = "IncomingCall"
155
- elif self .category_id == 2 :
156
- category = "MissedCall"
157
- elif self .category_id == 3 :
158
- category = "Voicemail"
159
- elif self .category_id == 4 :
160
- category = "Social"
161
- elif self .category_id == 5 :
162
- category = "Schedule"
163
- elif self .category_id == 6 :
164
- category = "Email"
165
- elif self .category_id == 7 :
166
- category = "News"
167
- elif self .category_id == 8 :
168
- category = "HealthAndFitness"
169
- elif self .category_id == 9 :
170
- category = "BusinessAndFinance"
171
- elif self .category_id == 10 :
172
- category = "Location"
173
- elif self .category_id == 11 :
174
- category = "Entertainment"
165
+ category = NOTIFICATION_CATEGORIES [self .category_id ]
175
166
176
167
if self .silent :
177
168
flags .append ("silent" )
0 commit comments