Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 17 Rev 22
Línea 139... Línea 139...
139
    processNotification(userInfo: userInfo, isForeground: true)
139
    processNotification(userInfo: userInfo, isForeground: true)
140
    completionHandler([[.banner, .badge, .sound]])
140
    completionHandler([[.banner, .badge, .sound]])
141
  }
141
  }
Línea 142... Línea 142...
142
    
142
    
-
 
143
    private func processNotification(userInfo : [AnyHashable : Any], isForeground : Bool) {
-
 
144
        
-
 
145
        let userNotificationDao = UserNotificationDao.sharedInstance
-
 
146
        let now = Date()
-
 
147
        let dateFormatter = DateFormatter()
-
 
148
        dateFormatter.dateFormat = Constants.FORMAT_DATETIME_SERVICE
-
 
149
        let dateOn = dateFormatter.string(from: now)
143
    private func processNotification(userInfo : [AnyHashable : Any], isForeground : Bool) {
150
                
144
        let title = userInfo["title"]  as? String ?? ""
151
        let title = userInfo["title"]  as? String ?? ""
145
        let body = userInfo["body"]  as? String ?? ""
152
        let body = userInfo["body"]  as? String ?? ""
146
        let url = userInfo["url"] as? String ?? ""
153
        let url = userInfo["url"] as? String ?? ""
147
        let command = userInfo["command"] as? String ?? ""
154
        let command = userInfo["command"] as? String ?? ""
Línea -... Línea 155...
-
 
155
        let new_capsules = Int(userInfo["new_capsules"] as? String ?? "") ?? 0
Línea -... Línea 156...
-
 
156
 
-
 
157
        var userNotification : UserNotificationModel
148
        let new_capsules = Int(userInfo["new_capsules"] as? String ?? "") ?? 0
158
        
149
 
159
        userNotification = UserNotificationModel(userUuid: appData.userUuid, title: "userInfo", description: "\(userInfo)", viewed: 0, url: "", addedOn: dateOn)
150
        
160
        userNotificationDao.insert(userNotification: userNotification)
151
        if command == "signout" {
161
        if command == "signout" {
152
            NotificationCenter.default.post(name: Constants.NOTIFICATION_NAME_COMMAND_EXIT , object: self, userInfo: nil)
162
            NotificationCenter.default.post(name: Constants.NOTIFICATION_NAME_COMMAND_EXIT , object: self, userInfo: nil)
Línea 158... Línea 168...
158
        }
168
        }
Línea 159... Línea 169...
159
        
169
        
Línea 160... Línea 170...
160
        
170
        
161
        if !title.isEmpty && !body.isEmpty {
-
 
162
            
-
 
163
            var userNotification = UserNotificationModel()
-
 
164
            userNotification.user_uuid = appData.userUuid
-
 
165
            userNotification.title = title
-
 
-
 
171
        if !title.isEmpty && !body.isEmpty {
Línea 166... Línea -...
166
            userNotification.description = body
-
 
167
            userNotification.url = url
172
            
Línea 168... Línea 173...
168
            userNotification.viewed = 0
173
            var userNotification = UserNotificationModel(userUuid: appData.userUuid, title: title, description: description, viewed: 0, url: "", addedOn: dateOn)
169
            
174