Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 27 Rev 31
Línea 98... Línea 98...
98
                        .font(.callout)
98
                        .font(.callout)
99
                    }*/
99
                    }*/
100
            }
100
            }
101
        }
101
        }
102
        .onAppear {
102
        .onAppear {
-
 
103
            
-
 
104
        
103
            if appData.refreshContentMessageShowPending {
105
            if appData.refreshContentMessageShowPending {
-
 
106
                
-
 
107
            
-
 
108
                
104
                let snackbar = TTGSnackbar(message:  appData.refreshContentMessage, duration: .long)
109
                let snackbar = TTGSnackbar(message:  appData.refreshContentMessage, duration: .forever)
-
 
110
                
-
 
111
                // Action 1
-
 
112
                snackbar.actionText = Config.LANG_COMMON_YES
-
 
113
                snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
-
 
114
                snackbar.actionBlock = { (snackbar) in  refreshContent() }
-
 
115
 
-
 
116
       
-
 
117
                snackbar.secondActionText = Config.LANG_COMMON_NO
-
 
118
                snackbar.secondActionTextColor = UIColor(Color("color_snackbar_button_no"))
-
 
119
                snackbar.secondActionBlock = { (snackbar) in }
-
 
120
                   
-
 
121
               
105
                snackbar.show()
122
                snackbar.show()
Línea 106... Línea -...
106
                
-
 
107
                appData.refreshContentMessage = ""
-
 
108
                appData.refreshContentMessageShowPending = false
-
 
-
 
123
                
109
                appData.save()
124
                
110
            }
125
            }
111
        }
126
        }
112
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
127
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
113
        { data in
128
        { data in
Línea 140... Línea 155...
140
                    
155
                    
Línea 141... Línea 156...
141
                    
156
                    
142
                    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))
157
                    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))
-
 
158
                    
-
 
159
                    if isForeground {
-
 
160
                        let snackbar = TTGSnackbar(message:  message, duration: .forever)
-
 
161
                        // Action 1
-
 
162
                        snackbar.actionText = Config.LANG_COMMNON_UPDATE
-
 
163
                        snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
-
 
164
                        snackbar.actionBlock = { (snackbar) in  refreshContent() }
-
 
165
 
-
 
166
               
-
 
167
                        //snackbar.secondActionText = Config.LANG_COMMON_NO
-
 
168
                        //snackbar.secondActionTextColor = UIColor(Color("color_snackbar_button_no"))
143
                    
169
                        //snackbar.secondActionBlock = { (snackbar) in }
144
                    if isForeground {
170
                           
145
                        let snackbar = TTGSnackbar(message:  message, duration: .long)
171
                       
146
                        snackbar.show()
172
                        snackbar.show()
147
                    }  else {
173
                    }  else {
Línea 159... Línea 185...
159
           appData.userUuid = ""
185
           appData.userUuid = ""
160
           appData.userFirstname = ""
186
           appData.userFirstname = ""
161
           appData.userLastname = ""
187
           appData.userLastname = ""
162
           appData.userEmail = ""
188
           appData.userEmail = ""
163
           appData.userImage = ""
189
           appData.userImage = ""
-
 
190
           appData.refreshContentActionRequired = false
-
 
191
           appData.refreshContentMessage = ""
-
 
192
           appData.refreshContentMessageShowPending = false
164
           appData.save()
193
           appData.save()
Línea 165... Línea 194...
165
           
194
           
Línea 166... Línea 195...
166
           appNavigation.pageActive = .goodbye
195
           appNavigation.pageActive = .goodbye
Línea 192... Línea 221...
192
            userNotificationDao.insert(userNotification: userNotification)
221
            userNotificationDao.insert(userNotification: userNotification)
193
        }
222
        }
Línea 194... Línea 223...
194
        
223
        
-
 
224
        
-
 
225
    }
-
 
226
    
-
 
227
    func refreshContent() -> Void {
-
 
228
        appData.refreshContentMessage = ""
-
 
229
        appData.refreshContentMessageShowPending = false
-
 
230
        appData.save()
-
 
231
        
-
 
232
        let notificationDao = UserNotificationDao.sharedInstance
-
 
233
        notificationDao.markViewedAllPendingByUserUuidAndCommand(userUuid:appData.userUuid, command: Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT)
-
 
234
        
-
 
235
        appData.refreshContentActionRequired = true
-
 
236
        appData.save()
-
 
237
        
-
 
238
        withAnimation {
-
 
239
            appNavigation.subpageActive = .topics
-
 
240
        }
195
        
241
        
Línea 196... Línea 242...
196
    }
242
    }
197
}
243
}
198
 
244