Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

Rev 31 | Rev 61 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 31 Rev 44
Línea 104... Línea 104...
104
        }
104
        }
105
         */
105
         */
106
    }
106
    }
Línea 107... Línea -...
107
    
-
 
108
 
-
 
109
    
-
 
110
    public func removeItem(id: Int) {
-
 
111
        let userNotificationDao = UserNotificationDao.sharedInstance
-
 
112
        userNotificationDao.remove(id: id)
-
 
113
        
-
 
114
        /*
-
 
115
        var i : Int = 0
-
 
116
        while i < groups.count {
-
 
117
            groups[i].notifications.remove(at:  groups[i].notifications.firstIndex(where: {  $0.id == id })!)
-
 
118
        
-
 
119
            i += 1
-
 
120
        }
-
 
121
        
-
 
122
        groups.remove(at:  groups.firstIndex(where: {  $0.notifications.count == 0 })!)
-
 
123
         */
-
 
124
        
-
 
125
        notifications.remove(at: notifications.firstIndex(where: {  $0.id == id })!)
-
 
126
        
-
 
127
       
-
 
128
    }
-
 
129
    
-
 
130
    public func markForViewedById(id: Int) {
-
 
131
        let userNotificationDao = UserNotificationDao.sharedInstance
-
 
132
        userNotificationDao.markViewed(id: id)
-
 
133
        
-
 
134
        
-
 
135
        var i : Int = 0
-
 
136
        while i < notifications.count  {
-
 
137
            
-
 
138
            if notifications[i].id == id {
-
 
139
                notifications[i].viewed = 1
-
 
140
            }
-
 
141
            i += 1
-
 
142
        }
-
 
143
        /*
-
 
144
        var i : Int = 0
-
 
145
        var j : Int = 0
-
 
146
        while i < groups.count {
-
 
147
            while j < groups[i].notifications.count {
-
 
148
                
-
 
149
                if groups[i].notifications[j].id == id {
-
 
150
                    groups[i].notifications[j].viewed = 1
-
 
151
                }
-
 
152
                
-
 
153
                j += 1
-
 
154
            }
-
 
155
        
-
 
156
            i += 1
-
 
157
        }*/
-
 
158
    }
-
 
159
    
-
 
160
    public func markAllForViewedByType(command : String) {
-
 
161
        let notificationDao = UserNotificationDao()
-
 
162
        notificationDao.markViewedAllPendingByUserUuidAndCommand(userUuid: appData.userUuid, command: command)
-
 
163
        
-
 
164
        var i : Int = 0
-
 
165
        while i < notifications.count  {
-
 
166
            
-
 
167
            if notifications[i].command == command  {
-
 
168
                notifications[i].viewed = 1
-
 
169
            }
-
 
170
            i += 1
-
 
171
        }
-
 
172
        
-
 
173
        /*
-
 
174
        var i : Int = 0
-
 
175
        var j : Int = 0
-
 
176
        while i < groups.count {
-
 
177
            while j < groups[i].notifications.count {
-
 
178
                
-
 
179
                if groups[i].notifications[j].command == command && groups[i].notifications[j].viewed == 0 {
-
 
180
                    groups[i].notifications[j].viewed = 1
-
 
181
                }
-
 
182
                
-
 
183
                j += 1
-
 
184
            }
-
 
185
        
-
 
186
            i += 1
-
 
187
        }*/
-
 
188
    }
-
 
189
    
107