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 6... Línea 6...
6
//
6
//
Línea 7... Línea 7...
7
 
7
 
Línea 8... Línea 8...
8
import SwiftUI
8
import SwiftUI
-
 
9
 
9
 
10
struct NotificationListView: View {
10
struct NotificationListView: View {
11
    @Environment(\.openURL) var openURL
Línea 11... Línea 12...
11
    @EnvironmentObject private var networkMonitor : NetworkMonitor
12
    @EnvironmentObject private var networkMonitor : NetworkMonitor
-
 
13
    @EnvironmentObject private var appNavigation : AppNavigation
-
 
14
    
Línea 12... Línea 15...
12
    @EnvironmentObject private var appNavigation : AppNavigation
15
    @ObservedObject var viewModel :NotificationListViewModel = NotificationListViewModel()
13
    
16
    private let appData = AppData.sharedInstance
14
    @ObservedObject var viewModel :NotificationListViewModel = NotificationListViewModel()
17
    
15
    
18
    
Línea 64... Línea 67...
64
                            
67
                            
Línea 65... Línea 68...
65
                            ForEach(0..<groupItem.notifications.count, id: \.self) { index in
68
                            ForEach(0..<groupItem.notifications.count, id: \.self) { index in
Línea 66... Línea 69...
66
                                
69
                                
-
 
70
                                let notificationItem = groupItem.notifications[index]
-
 
71
                            
-
 
72
                                NotificationListItemView(notification: notificationItem,onExecute: {
-
 
73
                                    
-
 
74
                                    if notificationItem.command == Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT && notificationItem.viewed == 0 {
-
 
75
                                        
-
 
76
                                        self.viewModel.markAllForViewedByType(command:  Constants.NOTIFICATION_COMMAND_REFRESH_CONTENT)
-
 
77
                                        
-
 
78
                                        appData.refreshContentActionRequired = true
-
 
79
                                        appData.save()
-
 
80
                                        
-
 
81
                                        withAnimation {
-
 
82
                                            appNavigation.subpageActive = .topics
-
 
83
                                        }
-
 
84
                                        
-
 
85
                                        
-
 
86
                                    } else if notificationItem.command == Constants.NOTIFICATION_COMMAND_OPEN_URL &&
-
 
87
                                        !notificationItem.url.isEmpty  &&
-
 
88
                                        notificationItem.viewed == 0  {
-
 
89
                                        
-
 
90
                                        openURL(URL(string: notificationItem.url)!)
-
 
91
                                        self.viewModel.markForViewedById(id: notificationItem.id)
-
 
92
                                        
67
                                let notificationItem = groupItem.notifications[index]
93
                                    }
68
                            
94
                                    
-
 
95
                                }) {
69
                                NotificationListItemView(notification: notificationItem)  {
96
                                    self.viewModel.removeItem(id: notificationItem.id)
70
                                    self.viewModel.removeItem(id: notificationItem.id)
97
                                }
71
                                }
98
                                   
72
                            }
99
                            }
73
                        }
100
                        }