Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 24 Rev 25
Línea 98... Línea 98...
98
                        .font(.callout)
98
                        .font(.callout)
99
                    }*/
99
                    }*/
100
            }
100
            }
101
        }
101
        }
102
        .onAppear {
102
        .onAppear {
103
            if appData.refreshContentPending {
103
            if appData.refreshContentMessageShowPending {
104
                let snackbar = TTGSnackbar(message:  appData.refreshContentMessage, duration: .long)
104
                let snackbar = TTGSnackbar(message:  appData.refreshContentMessage, duration: .long)
105
                snackbar.show()
105
                snackbar.show()
Línea 106... Línea 106...
106
                
106
                
107
                appData.refreshContentMessage = ""
107
                appData.refreshContentMessage = ""
108
                appData.refreshContentPending = false
108
                appData.refreshContentMessageShowPending = false
109
                appData.save()
109
                appData.save()
110
            }
110
            }
111
        }
111
        }
112
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
112
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
Línea 122... Línea 122...
122
                    if isForeground {
122
                    if isForeground {
123
                        let snackbar = TTGSnackbar(message:  message, duration: .long)
123
                        let snackbar = TTGSnackbar(message:  message, duration: .long)
124
                        snackbar.show()
124
                        snackbar.show()
125
                    }  else {
125
                    }  else {
126
                        appData.refreshContentMessage = message
126
                        appData.refreshContentMessage = message
127
                        appData.refreshContentPending = true
127
                        appData.refreshContentMessageShowPending = true
128
                        appData.save()
128
                        appData.save()
129
                    }
129
                    }
130
                }
130
                }
131
            }
131
            }
Línea 147... Línea 147...
147
        { data in
147
        { data in
Línea 148... Línea 148...
148
            
148
            
149
            let title = data.userInfo?["title"]! as? String ?? ""
149
            let title = data.userInfo?["title"]! as? String ?? ""
150
            let body = data.userInfo?["body"]! as? String ?? ""
150
            let body = data.userInfo?["body"]! as? String ?? ""
-
 
151
            let url = data.userInfo?["url"]! as? String ?? ""
151
            let url = data.userInfo?["url"]! as? String ?? ""
152
            let newCapsules = Int(data.userInfo?["new_capsules"]! as? String ?? "0") ?? 0
-
 
153
 
152
            
154
        
-
 
155
            if !title.isEmpty && !body.isEmpty {
-
 
156
                
-
 
157
                var command : String
-
 
158
                if !url.isEmpty {
-
 
159
                    command = Constants.NOTIFICATION_COMMAND_OPEN_URL
-
 
160
                } else if newCapsules > 0 {
-
 
161
                    command = Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT
-
 
162
                } else {
-
 
163
                    command = ""
-
 
164
                }
-
 
165
                
153
            if !title.isEmpty && !body.isEmpty {
166
                
154
                let now = Date()
167
                let now = Date()
155
                let dateFormatter = DateFormatter()
168
                let dateFormatter = DateFormatter()
Línea 156... Línea 169...
156
                dateFormatter.dateFormat = Constants.FORMAT_DATE_YMD
169
                dateFormatter.dateFormat = Constants.FORMAT_DATE_YMD
Línea 160... Línea 173...
160
                
173
                
161
                let dateOn = dateFormatter.string(from: now)
174
                let dateOn = dateFormatter.string(from: now)
Línea 162... Línea 175...
162
                let timeOn = dateFormatter.string(from: now)
175
                let timeOn = dateFormatter.string(from: now)
163
                
176
                
Línea 164... Línea 177...
164
                let userNotificationDao = UserNotificationDao.sharedInstance
177
                let userNotificationDao = UserNotificationDao.sharedInstance