Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 17 Rev 30
Línea 61... Línea 61...
61
                .multilineTextAlignment(/*@START_MENU_TOKEN@*/.leading/*@END_MENU_TOKEN@*/)
61
                .multilineTextAlignment(/*@START_MENU_TOKEN@*/.leading/*@END_MENU_TOKEN@*/)
Línea 62... Línea 62...
62
                            
62
                            
Línea -... Línea 63...
-
 
63
                Spacer()
-
 
64
                    
-
 
65
                
-
 
66
                HStack {
-
 
67
                    if self.viewModel.topic.image.isEmpty {
-
 
68
                        Image(uiImage: UIImage(named: "logo") ?? UIImage())
-
 
69
                            .resizable()
63
                Spacer()
70
                            .aspectRatio(contentMode: .fit)
-
 
71
                    } else {
-
 
72
                        CustomAsyncImage(
-
 
73
                            url: URL(string: self.viewModel.topic.image)!,
-
 
74
                            placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},
-
 
75
                            image: {
-
 
76
                                Image(uiImage: $0).resizable()
64
                    
77
                            }
Línea 65... Línea 78...
65
                
78
                        )
Línea 66... Línea 79...
66
                CardTopicImageGroup(requestImage: preview ? "": self.viewModel.topic.image )
79
                    }
67
                .padding(.horizontal, 5)
80
                }.padding(.horizontal, 5)
Línea 97... Línea 110...
97
            )
110
            )
98
            .padding(.horizontal, 5)
111
            .padding(.horizontal, 5)
99
        }.onAppear {
112
        }.onAppear {
100
            self.viewModel.fetchProgress(topicUuid: self.viewModel.topic.uuid, userUuid: self.userUuid)
113
            self.viewModel.fetchProgress(topicUuid: self.viewModel.topic.uuid, userUuid: self.userUuid)
Línea -... Línea 114...
-
 
114
            
-
 
115
        }.onReceive(NotificationCenter.default.publisher(for: Constants.NOTIFICATION_NAME_CHANGE_PERCENTAJE_COMPLETED_TOPIC))
-
 
116
        { data in
-
 
117
            if data.userInfo != nil {
-
 
118
                if let topicUuid = data.userInfo?["topicUuid"]! as? String {
-
 
119
                    if !topicUuid.isEmpty && topicUuid == self.viewModel.topic.uuid {
-
 
120
                        self.viewModel.fetchProgress(topicUuid: topicUuid, userUuid: appData.userUuid)
-
 
121
                        
-
 
122
                    }
-
 
123
                }
101
            
124
            }
Línea 102... Línea 125...
102
        }
125
        }
103
 
126
 
104
        .padding(.top, 5)
127
        .padding(.top, 5)
Línea 111... Línea 134...
111
    static var previews: some View {
134
    static var previews: some View {
Línea 112... Línea 135...
112
 
135
 
113
        CardTopicView(topicUuid: "T123")
136
        CardTopicView(topicUuid: "T123")
114
    }
137
    }
115
}
-
 
116
 
-
 
117
struct CardTopicImageGroup : View {
-
 
118
    
-
 
119
    var requestImage : String
-
 
120
 
-
 
121
    var body: some View {
-
 
122
        HStack {
-
 
123
            if requestImage.isEmpty {
-
 
124
                
-
 
125
                
-
 
126
                Image(uiImage: UIImage(named: "logo") ?? UIImage())
-
 
127
                    .resizable()
-
 
128
                    .aspectRatio(contentMode: .fit)
-
 
129
                   
-
 
130
                
-
 
131
            } else {
-
 
132
                CustomAsyncImage(
-
 
133
                    url: URL(string: requestImage)!,
-
 
134
                    placeholder: { Text(Config.LANG_COMMON_LOADING).font(.footnote).foregroundColor(.black)},
-
 
135
                    image: {
-
 
136
                        Image(uiImage: $0).resizable()
-
 
137
                    }
-
 
138
                )
-
 
139
            }
-
 
140
        }
-
 
141
    }
-
 
142
}
-