Proyectos de Subversion Iphone Microlearning - Nuevo Interface

Rev

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

Rev 1 Rev 8
Línea 18... Línea 18...
18
 
18
 
Línea 19... Línea 19...
19
 
19
 
-
 
20
struct SigninView: View {
20
struct SigninView: View {
21
 
21
 
22
    @Environment(\.openURL) var openURL
Línea 22... Línea 23...
22
    @Environment(\.openURL) var openURL
23
    @EnvironmentObject var networkMonitor : NetworkMonitor
Línea 71... Línea 72...
71
        
72
        
Línea 72... Línea 73...
72
        ZStack {
73
        ZStack {
73
            
74
            
-
 
75
            Color("color_window_background")
-
 
76
                    .edgesIgnoringSafeArea(.all)
-
 
77
            
-
 
78
            if self.showProgressView {
-
 
79
                ProgressView()
-
 
80
                    .progressViewStyle(CircularProgressViewStyle(tint: Color("color_progress_view_foreground")))
Línea 74... Línea 81...
74
            Color("color_window_background")
81
                    .scaleEffect(3, anchor: .center).zIndex(100000)
-
 
82
            }
-
 
83
                
-
 
84
            VStack(spacing: 0) {
-
 
85
                
-
 
86
                if networkMonitor.status == .disconnected {
-
 
87
                    HStack {
-
 
88
                        
-
 
89
                        
-
 
90
                        Text(Config.LANG_ERROR_NETWORK_MESSAGE_SHORT)
-
 
91
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_APP_BAR_HEAD1 ))
-
 
92
                            .foregroundColor(Color("color_network_disconnected_foreground"))
-
 
93
                            .padding(.leading, 16)
-
 
94
 
-
 
95
                        
-
 
96
                        Spacer()
-
 
97
                    }
-
 
98
                    .edgesIgnoringSafeArea(.top)
-
 
99
                    .frame(height: 50)
-
 
100
                    .background(Color("color_network_disconnected_background"))
-
 
101
 
Línea 75... Línea 102...
75
                    .edgesIgnoringSafeArea(.all)
102
 
Línea 76... Línea 103...
76
                
103
                    Divider().background(Color("color_network_disconnected_background"))
Línea 146... Línea 173...
146
        
173
        
147
         .alert(isPresented: $presentAlert) {
174
         .alert(isPresented: $presentAlert) {
148
            Alert(
175
            Alert(
149
                title: Text(self.titleAlert),
176
                title: Text(self.titleAlert),
150
                message: Text(self.messageAlert),
177
                message: Text(self.messageAlert),
151
                dismissButton: .default(Text("Ok"))
178
                dismissButton: .default(Text(Config.LANG_COMMON_OK))
152
            )
179
            )
Línea 153... Línea 180...
153
        }
180
        }
Línea 192... Línea 219...
192
            self.presentAlert = true
219
            self.presentAlert = true
Línea 193... Línea 220...
193
 
220
 
194
            return
221
            return
Línea -... Línea 222...
-
 
222
        }
-
 
223
        
-
 
224
 
-
 
225
        
-
 
226
        if networkMonitor.status == .disconnected {
-
 
227
            self.titleAlert = Config.LANG_ERROR_NETWORK_TITLE
-
 
228
            self.messageAlert = Config.LANG_ERROR_NETWORK_MESSAGE_SHORT
-
 
229
            self.presentAlert = true
-
 
230
            
-
 
231
            return
195
        }
232
        }
Línea 196... Línea 233...
196
        
233
        
197
        self.showProgressView = true;
234
        self.showProgressView = true;
198
 
235
 
Línea 262... Línea 299...
262
                                    sync.data = data
299
                                    sync.data = data
263
                                }
300
                                }
Línea 264... Línea 301...
264
                                      
301
                                      
Línea -... Línea 302...
-
 
302
                            syncDao.insert(record : sync);
-
 
303
                            
265
                            syncDao.insert(record : sync);
304
                            
Línea 266... Línea 305...
266
                            
305
                            appNavigation.subpageActive = AppMainSubPage.mycapsules
Línea 290... Línea 329...
290
            }
329
            }
Línea 291... Línea -...
291
            
-
 
292
 
-
 
293
           
-
 
294
         
330
            
295
            /*
-
 
296
            switch response.result {
-
 
297
                case .success:
-
 
298
                    
-
 
299
                   
-
 
300
                    print("Response Data : \(response.data!) ")
-
 
301
                    
-
 
302
                    let json = try? JSON(data: response.data!)
-
 
303
                    if json?["success"] ?? "" != false {
-
 
304
                        let dataService = DataService()
-
 
305
                        
-
 
306
                        if dataService.syncFromServer(json : json) {
-
 
307
                            self.goToMain = true
-
 
308
                        }
-
 
309
                    } else {
-
 
310
                        let message = json?["data"].string ?? ""
-
 
311
                        if !message.isEmpty {
-
 
312
                            self.titleAlert = "Error"
-
 
313
                            self.messageAlert = message
-
 
314
                            self.presentAlert = true
-
 
315
                        }
-
 
316
                    }
-
 
317
                    
-
 
318
            
-
 
319
                    return
-
 
320
 
-
 
321
                case .failure:
-
 
322
                    self.titleAlert = "Servidor no encontrado"
-
 
323
                    self.messageAlert = "Ocurrio un error de comunicación"
-
 
324
                    self.presentAlert = true
331
 
325
                    
332
           
Línea 326... Línea 333...
326
                    return
333
         
Línea 378... Línea 385...
378
            return true
385
            return true
379
        } else {
386
        } else {
380
            return false
387
            return false
381
        }
388
        }
382
    }
389
    }
-
 
390
    
-
 
391
    
Línea 383... Línea 392...
383
       
392
       
Línea 390... Línea 399...
390
    static var previews: some View {
399
    static var previews: some View {
391
        SigninView()
400
        SigninView()
392
    }
401
    }
393
}
402
}
Línea -... Línea 403...
-
 
403
 
-
 
404
 
394
 
405
 
Línea 395... Línea 406...
395
struct HeaderGroupView: View {
406
struct HeaderGroupView: View {
396
 
407
 
Línea 402... Línea 413...
402
            .resizable()
413
            .resizable()
403
            .frame(width: 50, height: 50)
414
            .frame(width: 50, height: 50)
Línea 404... Línea 415...
404
                      
415
                      
405
            Text(Config.LANG_SIGNIN_APP_NAME)
416
            Text(Config.LANG_SIGNIN_APP_NAME)
406
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 24))
417
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 24))
Línea 407... Línea 418...
407
            .foregroundColor(Color("color_textview"))
418
            .foregroundColor(Color("color_textview_foreground"))
408
                      
419
                      
409
            Spacer()
420
            Spacer()
410
        }
421
        }
Línea 414... Línea 425...
414
        
425
        
415
        //Inicio Saludo
426
        //Inicio Saludo
416
        HStack {
427
        HStack {
417
            Text(Config.LANG_SIGNIN_GREATING)
428
            Text(Config.LANG_SIGNIN_GREATING)
418
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 32))
429
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 32))
419
            .foregroundColor(Color("color_textview"))
430
            .foregroundColor(Color("color_textview_foreground"))
420
            Spacer()
431
            Spacer()
421
        }
432
        }
422
        .padding(.leading, 16)
433
        .padding(.leading, 16)
423
        .padding(.top, 10)
434
        .padding(.top, 10)
Línea 424... Línea 435...
424
        //Fin Saludo
435
        //Fin Saludo
425
        
436
        
426
        //Inicio Encabezado
437
        //Inicio Encabezado
427
        HStack {
438
        HStack {
428
            Text(Config.LANG_SIGNIN_HEAD_LINE1)
439
            Text(Config.LANG_SIGNIN_HEAD_LINE1)
429
            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 16))
440
            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 16))
430
            .foregroundColor(Color("color_textview"))
441
            .foregroundColor(Color("color_textview_foreground"))
431
            Spacer()
442
            Spacer()
432
        }
443
        }
433
        .padding(.leading, 16)
444
        .padding(.leading, 16)
Línea 452... Línea 463...
452
    var body : some View {
463
    var body : some View {
453
        //Inicio Label Email
464
        //Inicio Label Email
454
        HStack {
465
        HStack {
455
            Text(Config.LANG_SIGNIN_TITLE_EMAIL_FIELD)
466
            Text(Config.LANG_SIGNIN_TITLE_EMAIL_FIELD)
456
            .font(Font.custom(Config  .FONT_NAME_REGULAR, size: 11))
467
            .font(Font.custom(Config  .FONT_NAME_REGULAR, size: 11))
457
            .foregroundColor(Color("color_textview"))
468
            .foregroundColor(Color("color_textview_foreground"))
458
            Spacer()
469
            Spacer()
459
        }
470
        }
460
        .padding(.leading, 16)
471
        .padding(.leading, 16)
461
        .padding(.top, 10)
472
        .padding(.top, 10)
462
        //Fin Label Email
473
        //Fin Label Email
Línea 549... Línea 560...
549
    var body : some View {
560
    var body : some View {
550
        //Inicio Label Password
561
        //Inicio Label Password
551
        HStack {
562
        HStack {
552
            Text(Config.LANG_SIGNIN_TITLE_PASSWORD_FIELD)
563
            Text(Config.LANG_SIGNIN_TITLE_PASSWORD_FIELD)
553
            .font(Font.custom(Config  .FONT_NAME_REGULAR, size: 11))
564
            .font(Font.custom(Config  .FONT_NAME_REGULAR, size: 11))
554
            .foregroundColor(Color("color_textview"))
565
            .foregroundColor(Color("color_textview_foreground"))
555
            Spacer()
566
            Spacer()
556
        }
567
        }
557
        .padding(.leading, 16)
568
        .padding(.leading, 16)
558
        //Fin Label Password
569
        //Fin Label Password