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 36
Línea 11... Línea 11...
11
struct MyCapsuleInProgressView: View {
11
struct MyCapsuleInProgressView: View {
Línea 12... Línea 12...
12
 
12
 
13
    @EnvironmentObject var appNavigation : AppNavigation
13
    @EnvironmentObject var appNavigation : AppNavigation
Línea 14... Línea 14...
14
    private var appData = AppData.sharedInstance
14
    private var appData = AppData.sharedInstance
15
    
15
    
Línea 16... Línea 16...
16
    private var capsuleModel : CapsuleModel
16
    @ObservedObject  private var viewModel = MyCapsulesInProgressViewModel()
17
    private var capsuleTitle : String
17
    private var capsuleTitle : String = ""
18
    
18
    
19
    init(capsuleUuid: String)
-
 
Línea 20... Línea 19...
20
    {
19
    init(capsuleUuid: String)
21
        let capsuleDao = CapsuleDao.sharedInstance
20
    {
22
        capsuleModel = capsuleDao.selectByUuid(uuid: capsuleUuid)
21
        viewModel.fetch()
Línea 23... Línea 22...
23
        
22
        
24
        if capsuleModel.uuid.isEmpty {
23
        if viewModel.capsule.uuid.isEmpty {
25
            self.capsuleTitle = Config.LANG_MY_CAPSULES_INPROGRESS_NOT_AVAILABLE
24
            self.capsuleTitle = Config.LANG_MY_CAPSULES_INPROGRESS_NOT_AVAILABLE
26
        } else {
25
        } else {
27
            
26
            
Línea 28... Línea 27...
28
            if  capsuleModel.name.count > Constants.CAPSULE_TITLE_MAX_LENGTH {
27
            if  viewModel.capsule.name.count > Constants.CAPSULE_TITLE_MAX_LENGTH {
Línea 67... Línea 66...
67
                    .padding(.top, 10)
66
                    .padding(.top, 10)
68
                    .padding(.leading, 16)
67
                    .padding(.leading, 16)
Línea 69... Línea 68...
69
                    
68
                    
70
                    HStack {
69
                    HStack {
71
                        ProgressBar(
70
                        ProgressBar(
72
                            value: self.capsuleModel.progress,
71
                            value: self.viewModel.capsule.progress,
73
                            maxValue: 100,
72
                            maxValue: 100,
74
                            backgroundColor: Color("color_capsule_inprogress_progress_bar_background"),
73
                            backgroundColor: Color("color_capsule_inprogress_progress_bar_background"),
Línea 75... Línea 74...
75
                            foregroundColor: Color("color_capsule_inprogress_progress_bar_foreground")
74
                            foregroundColor: Color("color_capsule_inprogress_progress_bar_foreground")
76
                            
75
                            
77
                        )
76
                        )
Línea 78... Línea 77...
78
                        .frame(height: 6)
77
                        .frame(height: 6)
79
                        .padding(10)
78
                        .padding(10)
80
                        
79
                        
81
                        Text( String(format: "%.1f", self.capsuleModel.progress) + "%")
80
                        Text( String(format: "%.1f", self.viewModel.capsule.progress) + "%")
82
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_MY_CAPSULES_INPROGRESS_PROGRESS_LABEL ))
81
                            .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_MY_CAPSULES_INPROGRESS_PROGRESS_LABEL ))
83
                            .foregroundColor(Color("color_capsule_inprogress_progress_label"))
82
                            .foregroundColor(Color("color_capsule_inprogress_progress_label"))
84
                            .padding(5)
83
                            .padding(5)
Línea 85... Línea 84...
85
                    }
84
                    }
Línea 86... Línea 85...
86
                    .padding(.leading, 10)
85
                    .padding(.leading, 10)
Línea 87... Línea 86...
87
                    .padding(.trailing, 10)
86
                    .padding(.trailing, 10)
88
                    
87
                    
89
                    Spacer()
88
                    Spacer()
90
                    
89
                    
91
                    if !self.capsuleModel.uuid.isEmpty {
90
                    if !self.viewModel.capsule.uuid.isEmpty {
92
                    
91
                    
Línea 93... Línea 92...
93
                        HStack {
92
                        HStack {
94
                            Button(action: {
93
                            Button(action: {
Línea 129... Línea 128...
129
                    }
128
                    }
Línea 130... Línea 129...
130
              
129
              
131
                    
130
                    
132
                }
131
                }
Línea 133... Línea 132...
133
                Group {
132
                Group {
134
                    if self.capsuleModel.image.isEmpty {
133
                    if self.viewModel.capsule.image.isEmpty {
135
                        
134
                        
Línea 141... Línea 140...
141
                               
140
                               
142
                           
141
                           
143
                        
142
                        
144
                    } else {
143
                    } else {
145
                        CustomAsyncImage(
144
                        CustomAsyncImage(
146
                            url: URL(string: self.capsuleModel.image)!,
145
                            url: URL(string: self.viewModel.capsule.image)!,