Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 31 Rev 32
Línea 99... Línea 99...
99
                    }*/
99
                    }*/
100
            }
100
            }
101
        }
101
        }
102
        .onAppear {
102
        .onAppear {
Línea 103... Línea -...
103
            
-
 
-
 
103
            
-
 
104
            if appData.signoutActionRequired {
-
 
105
                signout()
104
        
106
            } else {
105
            if appData.refreshContentMessageShowPending {
-
 
106
                
-
 
107
            
-
 
108
                
107
                if appData.refreshContentMessageShowPending {
109
                let snackbar = TTGSnackbar(message:  appData.refreshContentMessage, duration: .forever)
-
 
110
                
108
                    let snackbar = TTGSnackbar(message: appData.refreshContentMessage, duration: .forever)
111
                // Action 1
109
                    // Action 1
112
                snackbar.actionText = Config.LANG_COMMON_YES
110
                    snackbar.actionText = Config.LANG_COMMNON_UPDATE
113
                snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
111
                    snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
114
                snackbar.actionBlock = { (snackbar) in  refreshContent() }
-
 
115
 
112
                    snackbar.actionBlock = { (snackbar) in  refreshContent() }
116
       
-
 
117
                snackbar.secondActionText = Config.LANG_COMMON_NO
-
 
118
                snackbar.secondActionTextColor = UIColor(Color("color_snackbar_button_no"))
-
 
Línea 119... Línea -...
119
                snackbar.secondActionBlock = { (snackbar) in }
-
 
120
                   
113
                       
121
               
114
                   
122
                snackbar.show()
115
                    snackbar.show()
-
 
116
                    
123
                
117
                    
124
                
118
                }
125
            }
119
            }
126
        }
120
        }
127
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
121
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_REFRESH_CONTENT))
Línea 161... Línea 155...
161
                        // Action 1
155
                        // Action 1
162
                        snackbar.actionText = Config.LANG_COMMNON_UPDATE
156
                        snackbar.actionText = Config.LANG_COMMNON_UPDATE
163
                        snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
157
                        snackbar.actionTextColor = UIColor( Color("color_snackbar_button_yes"))
164
                        snackbar.actionBlock = { (snackbar) in  refreshContent() }
158
                        snackbar.actionBlock = { (snackbar) in  refreshContent() }
Línea 165... Línea 159...
165
 
159
 
166
               
-
 
167
                        //snackbar.secondActionText = Config.LANG_COMMON_NO
-
 
168
                        //snackbar.secondActionTextColor = UIColor(Color("color_snackbar_button_no"))
-
 
Línea 169... Línea 160...
169
                        //snackbar.secondActionBlock = { (snackbar) in }
160
 
170
                           
161
                           
171
                       
162
                       
Línea 179... Línea 170...
179
            }
170
            }
Línea 180... Línea 171...
180
 
171
 
181
        }
172
        }
182
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_EXIT))
173
        .onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_COMMAND_EXIT))
-
 
174
       { data in
-
 
175
            if data.userInfo != nil {
Línea -... Línea 176...
-
 
176
                let isForeground = (Int(data.userInfo?["is_foreground"]! as? String ?? "0") ?? 0) == 1
183
       { data in
177
            
184
            
178
            
185
           appData.userUuid = ""
179
                if isForeground {
186
           appData.userFirstname = ""
180
                    signout()
187
           appData.userLastname = ""
181
                } else {
188
           appData.userEmail = ""
-
 
189
           appData.userImage = ""
182
                    appData.signoutActionRequired = true
190
           appData.refreshContentActionRequired = false
-
 
-
 
183
                    appData.save()
-
 
184
                }
191
           appData.refreshContentMessage = ""
185
            
-
 
186
 
Línea 192... Línea -...
192
           appData.refreshContentMessageShowPending = false
-
 
Línea 193... Línea 187...
193
           appData.save()
187
            }
194
           
188
           
Línea 195... Línea 189...
195
           appNavigation.pageActive = .goodbye
189
           
Línea 222... Línea 216...
222
        }
216
        }
Línea 223... Línea 217...
223
        
217
        
Línea 224... Línea 218...
224
        
218
        
-
 
219
    }
-
 
220
    
-
 
221
    func signout() -> Void {
-
 
222
        appData.userUuid = ""
-
 
223
        appData.userFirstname = ""
-
 
224
        appData.userLastname = ""
225
    }
225
        appData.userEmail = ""
226
    
226
        appData.userImage = ""
-
 
227
        appData.refreshContentActionRequired = false
227
    func refreshContent() -> Void {
228
        appData.refreshContentMessage = ""
Línea 228... Línea 229...
228
        appData.refreshContentMessage = ""
229
        appData.refreshContentMessageShowPending = false
229
        appData.refreshContentMessageShowPending = false
-
 
-
 
230
        appData.signoutActionRequired = false
230
        appData.save()
231
        appData.save()
-
 
232
        
-
 
233
        appNavigation.pageActive = .goodbye
-
 
234
    }
231
        
235
    
232
        let notificationDao = UserNotificationDao.sharedInstance
236
    func refreshContent() -> Void {
Línea 233... Línea 237...
233
        notificationDao.markViewedAllPendingByUserUuidAndCommand(userUuid:appData.userUuid, command: Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT)
237
        appData.refreshContentMessage = ""
234
        
238
        appData.refreshContentMessageShowPending = false
235
        appData.refreshContentActionRequired = true
239
        appData.refreshContentActionRequired = true
-
 
240
        appData.save()
Línea 236... Línea 241...
236
        appData.save()
241
        
237
        
242
        withAnimation {
Línea 238... Línea 243...
238
        withAnimation {
243
            appNavigation.subpageActive = .topics