Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 41 Rev 42
Línea 125... Línea 125...
125
                //userInfo["command"] as? String ?? ""
125
                //userInfo["command"] as? String ?? ""
Línea 126... Línea 126...
126
                
126
                
127
                let newCapsules = Int(userInfo["new_capsules"] as? String ?? "") ?? 0
127
                let newCapsules = Int(userInfo["new_capsules"] as? String ?? "") ?? 0
Línea 128... Línea -...
128
                let isForeground = (Int(userInfo["is_foreground"] as? String ?? "") ?? 0) == 1
-
 
-
 
128
                let isForeground = (Int(userInfo["is_foreground"] as? String ?? "") ?? 0) == 1
129
                
129
                
130
                if newCapsules > 0 {
130
 
Línea 131... Línea 131...
131
                    let title = userInfo["title"] as? String ?? ""
131
                let title = userInfo["title"] as? String ?? ""
132
                    let body = userInfo["body"] as? String ?? ""
132
                let body = userInfo["body"] as? String ?? ""
133
                    
133
                    
134
                    let command = Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT
134
                let command = Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT
Línea 135... Línea 135...
135
                    let now = Date()
135
                let now = Date()
136
                    let dateFormatter = DateFormatter()
136
                let dateFormatter = DateFormatter()
Línea 137... Línea 137...
137
                    dateFormatter.dateFormat = Constants.FORMAT_DATE_YMD
137
                dateFormatter.dateFormat = Constants.FORMAT_DATE_YMD
138
                        
138
                        
Línea 139... Línea 139...
139
                    let timeFormatter = DateFormatter()
139
                let timeFormatter = DateFormatter()
140
                    timeFormatter.dateFormat = Constants.FORMAT_TIME_12
140
                timeFormatter.dateFormat = Constants.FORMAT_TIME_12
Línea 141... Línea -...
141
                        
-
 
142
                    let dateOn = dateFormatter.string(from: now)
-
 
143
                    let timeOn = timeFormatter.string(from: now)
141
                        
144
                        
-
 
Línea -... Línea 142...
-
 
142
                let dateOn = dateFormatter.string(from: now)
-
 
143
                let timeOn = timeFormatter.string(from: now)
-
 
144
                        
-
 
145
                let userNotificationDao = UserNotificationDao.sharedInstance
-
 
146
                var userNotification : UserNotificationModel  = UserNotificationModel(userUuid: appData.userUuid, title: title, body: body, viewed: 0, url: "", command: command, dateOn: dateOn, timeOn: timeOn)
-
 
147
                        
-
 
148
                userNotificationDao.insert(userNotification: userNotification)
-
 
149
                    
-
 
150
                    
-
 
151
                var message : String = ""
-
 
152
                switch newCapsules
-
 
153
                {
145
                    let userNotificationDao = UserNotificationDao.sharedInstance
154
                    case 0  :
-
 
155
                        message = Config.LANG_MESSAGE_NEW_CONTENT_THERE
-
 
156
                        break
146
                    var userNotification : UserNotificationModel  = UserNotificationModel(userUuid: appData.userUuid, title: title, body: body, viewed: 0, url: "", command: command, dateOn: dateOn, timeOn: timeOn)
157
                
147
                        
158
                    case 1 :
148
                        
159
                        message = Config.LANG_MESSAGE_NEW_CONTENT_THERE_IS_ONE_CAPSULE
149
 
160
                        break
150
                    userNotificationDao.insert(userNotification: userNotification)
161
  
151
                    
162
                    default :
152
                    
163
                        message = Config.LANG_MESSAGE_NEW_CONTENT_THERE_ARE_MULTIPLE_CAPSULES.replacingOccurrences(of: "%s", with: String(newCapsules))
153
                    
164
                        break
154
                    let message = newCapsules == 1 ? Config.LANG_MESSAGE_NEW_CONTENT_THERE_IS_ONE_CAPSULE : Config.LANG_MESSAGE_NEW_CONTENT_THERE_ARE_MULTIPLE_CAPSULES.replacingOccurrences(of: "%s", with: String(newCapsules))
165
                }
155
                    
166
                
156
                    if isForeground {
-
 
157
                        let snackbar = TTGSnackbar(message:  message, duration: .forever)
167
                if isForeground {
158
                        // Action 1
-
 
159
                        snackbar.actionText = Config.LANG_COMMNON_UPDATE
-
 
160
                        snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
-
 
161
                        snackbar.actionBlock = { (snackbar) in
-
 
162
                            DispatchQueue.main.async {
-
 
163
                                snackbar.dismiss()
-
 
164
                                refreshContent()
168
                    let snackbar = TTGSnackbar(message:  message, duration: .forever)
-
 
169
                        // Action 1
-
 
170
                    snackbar.actionText = Config.LANG_COMMNON_UPDATE
-
 
171
                    snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
-
 
172
                    snackbar.actionBlock = { (snackbar) in
-
 
173
                        DispatchQueue.main.async {
-
 
174
                            snackbar.dismiss()
165
                            }
175
                            refreshContent()
166
                        }
176
                        }
Línea 167... Línea 177...
167
 
177
                    }
168
                        snackbar.show()
178