Proyectos de Subversion Iphone Microlearning - Inconcert

Rev

Rev 19 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
//
2
//  LoginView.swift
3
//  twogetskills
4
//
5
//  Created by Efrain Yanez Recanatini on 1/27/22.
6
//
7
 
8
import SwiftUI
9
import AudioToolbox
10
import Network
11
import Alamofire
12
import SwiftyJSON
13
import SafariServices
14
import RNCryptor
15
 
16
 
17
 
18
 
19
 
20
struct SigninView: View {
21
 
22
    @EnvironmentObject var networkMonitor : NetworkMonitor
23
    @EnvironmentObject var appNavigation : AppNavigation
24
 
11 efrain 25
    @State private var keyboardHeight : CGFloat = 0
26
 
1 efrain 27
    private var appData = AppData.sharedInstance
28
 
29
 
20 efrain 30
    @State private var email: String = "" {
1 efrain 31
        didSet {
32
            if email.count > 250 {
33
                email = String(email.prefix(250))
34
                AudioServicesPlayAlertSoundWithCompletion(SystemSoundID(kSystemSoundID_Vibrate)) { return }
35
            }
36
        }
37
    }
38
 
39
    @State private var isProcessing : Bool = false
40
 
41
    @State private var isValidEmail : Bool = true
42
    @State private var isEditingEmail : Bool = false
43
 
20 efrain 44
    @State private var password: String = ""  {
1 efrain 45
        didSet {
46
            if password.count > 25 {
47
                password = String(password.prefix(25))
48
                AudioServicesPlayAlertSoundWithCompletion(SystemSoundID(kSystemSoundID_Vibrate)) { return }
49
            }
50
        }
51
    }
52
 
53
    @State private var isValidPassword : Bool = true
54
    @State private var isEditingPassword : Bool = false
55
 
56
    @State private var isPasswordShow: Bool = false
57
    @State private var showProgressView : Bool = false
58
 
59
    @State private var presentAlert : Bool = false
60
    @State private var titleAlert : String = ""
61
    @State private var messageAlert : String = ""
11 efrain 62
 
1 efrain 63
 
11 efrain 64
 
65
    @State private var openForgotPassword : Bool = false
66
    @State private var openSignup : Bool = false
67
 
1 efrain 68
    var body: some View {
69
        ZStack {
70
 
71
            Color("color_window_background")
72
                    .edgesIgnoringSafeArea(.all)
73
 
74
            if self.showProgressView {
75
                ProgressView()
76
                    .progressViewStyle(CircularProgressViewStyle(tint: Color("color_progress_view_foreground")))
77
                    .scaleEffect(3, anchor: .center).zIndex(100000)
78
            }
79
 
80
            VStack(spacing: 0) {
81
 
82
                if networkMonitor.status == .disconnected {
83
                    HStack {
84
 
85
 
86
                        Text(Config.LANG_ERROR_NETWORK_MESSAGE_SHORT)
87
                        .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_APP_BAR_HEAD1 ))
88
                            .foregroundColor(Color("color_network_disconnected_foreground"))
89
                            .padding(.leading, 16)
90
 
91
 
92
                        Spacer()
93
                    }
94
                    .edgesIgnoringSafeArea(.top)
95
                    .frame(height: 50)
96
                    .background(Color("color_network_disconnected_background"))
97
 
98
 
99
                    Divider().background(Color("color_network_disconnected_background"))
100
                }
101
 
102
                HeaderGroupView()
103
 
104
                EmailTextFieldGroup(email: self.$email, isEditingEmail: self.$isEditingEmail, isValidEmail: self.$isValidEmail, password: self.$password, isEditingPassword: self.$isEditingPassword, isValidPassword: self.$isValidPassword)
105
 
106
                PasswordTextFieldGroup(
107
                    password: self.$password,
108
                    isEditingPassword: self.$isEditingPassword,
109
                    isValidPassword: self.$isValidPassword,
110
                    isPasswordShow: self.$isPasswordShow
111
                ).padding(.top, isValidEmail ? 10 : 2)
112
 
113
 
114
 
115
                Button(action: {
116
                    if(validate()) {
117
                        signin()
118
                    }
119
                }, label: {
120
                    Text(Config.LANG_SIGNIN_BUTTON_SIGNIN)
121
                    .font(Font.custom(Config.FONT_NAME_REGULAR, size: 13))
122
                    .frame(width: UIScreen.main.bounds.width - 32, height: 35)
123
                    .foregroundColor(Color("color_button_foreground"))
124
                    .background(Color("color_button_background"))
125
                    .border(Color("color_button_border"), width: Config.BUTTON_BORDER_SIZE)
126
                                           .cornerRadius(Config.BUTTON_BORDER_RADIUS)
127
 
128
                                   })
129
 
130
                                   .padding(.top, 16)
131
                                   .padding(.leading, 16)
132
                                   .padding(.trailing, 16)
133
 
134
 
11 efrain 135
                ButtonSignUpGroup(openSignup: self.$openSignup)
1 efrain 136
 
137
 
138
 
139
                Spacer()
140
 
11 efrain 141
                ButtonForgotPasswordGroup(openForgotPassword: self.$openForgotPassword)
142
 
1 efrain 143
 
144
            }
145
 
146
 
147
        }
148
 
149
        //}.offset(y : CGFloat(-(self.keyboardHeight / 2)))
150
 
151
        .onAppear {
152
    /*
153
            NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillShowNotification, object: nil, queue: .main) { (notification) in
154
                let keyboardHeight: CGFloat = (notification.userInfo?[UIResponder.keyboardFrameEndUserInfoKey] as? NSValue)?.cgRectValue.height ?? 0
155
 
156
 
157
                self.keyboardHeight = keyboardHeight
158
                //print("keyboardHeightShow = \(keyboardHeight)")
159
 
160
            }*/
161
 
162
            NotificationCenter.default.addObserver(forName: UIResponder.keyboardWillHideNotification, object: nil, queue: .main) { (notification) in
163
 
164
 
165
               // print("keyboardHeightHide ")
166
 
167
            }
11 efrain 168
        }.popover(isPresented: self.$openSignup, content: {
169
 
170
            SafariView(sURL: Config.URL_SIGNUP_ENDPOINT)
171
 
172
        }).popover(isPresented: self.$openForgotPassword, content: {
173
 
174
            SafariView(sURL: Config.URL_FORGOT_PASSWORD_ENDPOINT)
175
 
176
        }).alert(isPresented: $presentAlert) {
1 efrain 177
            Alert(
178
                title: Text(self.titleAlert),
179
                message: Text(self.messageAlert),
180
                dismissButton: .default(Text(Config.LANG_COMMON_OK))
181
            )
182
        }
183
 
184
    }
185
 
186
    private func signin() -> Void
187
    {
188
        if isProcessing {
189
            self.titleAlert = Config.LANG_ERROR_SIGNIN_IN_PROGRESS_TITLE
190
            self.messageAlert = Config.LANG_ERROR_SIGNIN_IN_PROGRESS_MESSAGE
191
            self.presentAlert = true
192
 
193
            return
194
        }
195
 
196
 
197
        self.isEditingEmail = false
198
        self.isValidEmail = Validator.checkEmail(email: self.email)
199
        self.isEditingPassword = false
200
        self.isValidPassword = Validator.checkPassword(password: self.password)
201
 
202
        if !self.isValidEmail || !self.isValidPassword {
203
            return
204
        }
205
 
206
 
207
        let device_uuid = appData.deviceUuid
19 efrain 208
        let emailTrimming = email.trimmingCharacters(in: .whitespaces)
209
        let passwordTrimming = password.trimmingCharacters(in: .whitespaces)
210
 
1 efrain 211
        //print("signin")
212
        //print(" aes  = \(appData.deviceAes) " )
213
        //print(" email  = \(self.email) " )
214
        //print(" password  = \(self.password) " )
215
 
216
 
17 efrain 217
        let syncDao = SyncDao()
1 efrain 218
        if appData.deviceAes.isEmpty  {
219
 
220
            let syncRecord = syncDao.selectOneByType(type: Constants.SYNC_ADAPTER_TYPE_DEVICE)
221
 
222
            if syncRecord.id > 0 {
223
                let syncAdapter = SyncAdapter()
17 efrain 224
                syncAdapter.sync(isForeground: true){
1 efrain 225
                    success in
226
                }
227
            }
228
 
229
            self.titleAlert = Config.LANG_ERROR_DEVICE_NOT_REGISTER_TITLE
230
            self.messageAlert = Config.LANG_ERROR_DEVICE_NOT_REGISTER_MESSAGE
231
            self.presentAlert = true
232
 
233
            return
234
        }
235
 
236
 
237
 
238
        if networkMonitor.status == .disconnected {
239
            self.titleAlert = Config.LANG_ERROR_NETWORK_TITLE
240
            self.messageAlert = Config.LANG_ERROR_NETWORK_MESSAGE_SHORT
241
            self.presentAlert = true
242
 
243
            return
244
        }
245
 
246
        self.showProgressView = true;
247
 
19 efrain 248
        let emailData = emailTrimming.data(using: .utf8)!
1 efrain 249
        let emailCipherData = RNCryptor.encrypt(data: emailData, withPassword: appData.deviceAes)
250
        let emailEncrypted = emailCipherData.base64EncodedString()
251
 
19 efrain 252
        let passwordData = passwordTrimming.data(using: .utf8)!
1 efrain 253
        let passwordCipherData = RNCryptor.encrypt(data: passwordData, withPassword: appData.deviceAes)
254
        let passwordEncrypted = passwordCipherData.base64EncodedString()
255
 
256
 
257
        //print(" email encrypted = \(emailEncrypted) " )
258
        //print(" password encrypted = \(passwordEncrypted) " )
259
 
260
        let parameters = [
17 efrain 261
            Constants.POST_SIGNIN_FIELD_APPLICATION_ID: "\(Config.APPLICATION_ID)",
262
            Constants.POST_SIGNIN_FIELD_VARIANT_ID: "\(Config.VARIANT_ID)",
1 efrain 263
            Constants.POST_SYNC_FIELD_DEVICE_UUID: device_uuid,
264
            Constants.POST_SIGNIN_FIELD_EMAIL: emailEncrypted,
265
            Constants.POST_SIGNIN_FIELD_PASSWORD: passwordEncrypted,
266
            Constants.POST_SIGNIN_FIELD_ENCRYPTER: Constants.GLOBAL_ENCRYPTER
267
        ]
268
 
269
        let headers: HTTPHeaders = [
270
            .accept(Constants.HTTP_HEADER_ACCEPT)
271
        ]
272
 
273
        //print("URL signin : \(Config.URL_SIGNIN)")
274
 
275
        self.showProgressView = true
276
        AF.request(Config.URL_SIGNIN, method: .post, parameters: parameters, encoding: URLEncoding.default, headers: headers).responseJSON{(response) in
277
            self.showProgressView = false
278
 
279
            switch response.result {
280
                case .success:
281
                    let json = try? JSON(data: response.data!)
282
 
283
                    //print("json : \(json)")
284
 
285
                    if json?["success"] ?? "" != false {
286
                        let dataService = DataService()
287
 
288
                        if dataService.syncFromServer(json : json) {
289
 
290
 
291
                            let userinfo = [
292
                                "title" : Config.LANG_TITLE_NOTIFICATION_SIGNIN_PUSH,
293
                                "body" : Config.LANG_BODY_NOTIFICATION_SIGNIN_PUSH,
294
                                "url" : ""
295
                            ]
296
 
297
 
298
                            NotificationCenter.default.post(name: Constants.NOTIFICATION_NAME_PUSH , object: self, userInfo: userinfo)
299
 
300
                            let now = Date()
301
                            let dateFormatter = DateFormatter()
302
                            dateFormatter.dateFormat = Constants.FORMAT_DATETIME_SERVICE
303
                            let dateOn = dateFormatter.string(from: now)
304
 
305
 
306
 
307
 
308
 
309
                            var userLog = UserLogModel()
310
                            userLog.userUuid = appData.userUuid
311
                            userLog.activity = Constants.USER_LOG_ACTIVITY_SIGNIN
312
                            userLog.addedOn = dateOn
313
 
17 efrain 314
                            let userLogDao = UserLogDao()
1 efrain 315
                            userLogDao.insert(record: userLog)
316
 
317
                            var sync = SyncModel()
318
 
319
                            var json = userLog.toJson()
320
                            json[Constants.SYNC_ADAPTER_DATA_TYPE_FIELD_NAME] = Constants.SYNC_ADAPTER_DATA_TYPE_USER_LOG
321
 
322
                            sync = SyncModel();
323
                            sync.type = Constants.SYNC_ADAPTER_TYPE_SYNC
324
                            if let theJSONData = try?  JSONSerialization.data(withJSONObject: json, options: .prettyPrinted),
325
                                let data = String(data: theJSONData, encoding: String.Encoding.ascii) {
326
                                    sync.data = data
327
                                }
328
 
329
                            syncDao.insert(record : sync);
330
 
331
 
332
                            appNavigation.subpageActive = AppMainSubPage.mycapsules
333
                            appNavigation.pageActive = AppMainPage.home
334
 
335
 
336
 
337
                            //self.goToMain = true
338
                        }
339
                    } else {
340
                        let message = json?["data"].string ?? ""
341
                        if !message.isEmpty {
342
                            self.titleAlert = Config.LANG_ERROR_GENERIC_TITLE
343
                            self.messageAlert = message
344
                            self.presentAlert = true
345
                        }
346
                    }
347
 
348
                   return
349
 
350
                case .failure :
351
                    self.titleAlert = Config.LANG_ERROR_COMMUNICATION_TITLE
352
                    self.messageAlert = Config.LANG_ERROR_COMMUNICATION_MESSAGE
353
                    self.presentAlert = true
354
 
355
                    return
356
            }
357
 
358
 
359
 
360
 
361
 
362
        }
363
    }
364
 
365
 
366
    private func validate() -> Bool
367
    {
368
 
369
        //print("validate - email : \(email)")
370
        //print("validate - password : \(password)")
371
 
372
 
373
        if email.isEmpty {
374
            self.isValidEmail = false
19 efrain 375
        } else  if !Validator.checkEmail(email: email) {
1 efrain 376
            self.isValidEmail = false
377
        } else {
378
            self.isValidEmail = true
379
        }
380
 
381
 
382
 
383
        if password.isEmpty {
384
            self.isValidPassword = false
19 efrain 385
        } else if(!Validator.checkPassword(password: password)) {
1 efrain 386
            self.isValidPassword = false
387
 
388
        } else {
389
            self.isValidPassword = true
390
        }
391
 
392
        return  self.isValidEmail &&  self.isValidPassword
393
    }
394
 
395
 
19 efrain 396
 
1 efrain 397
 
398
 
399
 
400
 
401
}
402
 
403
 
404
 
405
struct SigninView_Previews: PreviewProvider {
406
    static var previews: some View {
407
        SigninView()
408
    }
409
}
410
 
411
 
412
 
413
struct HeaderGroupView: View {
414
 
415
 
416
    var body: some View {
417
        //Inicio Logo
418
        HStack {
419
            Image("logo")
420
            .resizable()
421
            .frame(width: 50, height: 50)
422
 
423
            Text(Config.LANG_SIGNIN_APP_NAME)
424
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 24))
425
            .foregroundColor(Color("color_textview_foreground"))
426
 
427
            Spacer()
428
        }
429
        .padding(.leading, 16)
430
        .padding(.top, 66)
431
        //Fin logo
432
 
433
        //Inicio Saludo
434
        HStack {
435
            Text(Config.LANG_SIGNIN_GREATING)
436
            .font(Font.custom(Config.FONT_NAME_BOLD, size: 32))
437
            .foregroundColor(Color("color_textview_foreground"))
438
            Spacer()
439
        }
440
        .padding(.leading, 16)
441
        .padding(.top, 10)
442
        //Fin Saludo
443
 
444
        //Inicio Encabezado
445
        HStack {
446
            Text(Config.LANG_SIGNIN_HEAD_LINE1)
447
            .font(Font.custom(Config.FONT_NAME_REGULAR, size: 16))
448
            .foregroundColor(Color("color_textview_foreground"))
449
            Spacer()
450
        }
451
        .padding(.leading, 16)
452
        .padding(.top, 10)
453
        //Fin Encabezado
454
    }
455
}
456
 
457
struct EmailTextFieldGroup : View {
458
 
459
 
460
 
461
    @Binding var email: String
462
    @Binding var isEditingEmail : Bool
463
    @Binding var isValidEmail : Bool
464
 
465
    @Binding var password: String
466
    @Binding var isEditingPassword: Bool
467
    @Binding var isValidPassword: Bool
468
 
469
 
470
    var body : some View {
471
        //Inicio Label Email
472
        HStack {
473
            Text(Config.LANG_SIGNIN_TITLE_EMAIL_FIELD)
17 efrain 474
            .font(Font.custom(Config  .FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_LABEL))
1 efrain 475
            .foregroundColor(Color("color_textview_foreground"))
476
            Spacer()
477
        }
478
        .padding(.leading, 16)
479
        .padding(.top, 10)
480
        //Fin Label Email
481
 
482
        //Inicio TextField  Email
483
 
484
        Group {
485
            HStack {
486
                /*
487
                Image("ui_mail")
488
                .resizable()
489
                .frame(width: 24, height: 24)
490
                         .padding(.horizontal, 4)
491
                */
492
 
493
 
494
                TextField("",
495
                    text: self.$email,
496
                    onEditingChanged: { (changed) in
497
 
498
                        if changed {
499
 
500
                            if self.isEditingPassword {
501
                                self.isValidPassword = Validator.checkPassword(password: self.password)
502
                                self.isEditingPassword = false
503
                            }
504
 
505
 
506
                            self.isEditingEmail = true
507
                        } else {
508
                            self.isEditingEmail = false
509
                            self.isValidEmail = Validator.checkEmail(email: self.email)
510
                        }
511
 
512
                    }, onCommit: {
513
                        self.isEditingEmail = false
514
                        self.isValidEmail = Validator.checkEmail(email: self.email)
515
                    }
516
                )
517
 
17 efrain 518
                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD))
1 efrain 519
                .textFieldStyle(PlainTextFieldStyle())
520
                .frame(height: 32)
521
                .keyboardType(.emailAddress)
522
                .autocapitalization(.none)
523
                //.foregroundColor(Color("color_textfield_foreground"))
524
                //.background(Color("color_textfield_background"))
525
                .padding(.leading, 4)
526
                Spacer()
527
 
528
            }
529
        }
530
 
531
        .foregroundColor(Color("color_textfield_foreground"))
532
        .background(Color("color_textfield_background"))
533
        .overlay(RoundedRectangle(cornerRadius: 5).stroke(
534
            Color(self.isEditingEmail ? "color_textfield_border_active" : self.isValidEmail ? "color_textfield_border" : "color_textfield_border_error" )
535
        ))
536
        .padding(.leading, 16)
537
        .padding(.trailing, 16)
538
        .padding(.top, self.isValidEmail ? 10 : 2)
539
 
540
 
541
        if !self.isValidEmail {
542
            HStack {
543
                Spacer()
544
 
545
                Text(Config.LANG_SIGNIN_ERROR_EMAIL_FIELD)
546
                .foregroundColor(.red)
17 efrain 547
                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_ERROR))
1 efrain 548
 
549
            }
550
            .padding(.top, 5)
551
            .padding(.trailing, 16)
552
        }
553
 
554
        //Fin TextField Email
555
    }
556
 
557
}
558
 
559
 
560
 
561
struct PasswordTextFieldGroup : View {
562
    @Binding var password: String
563
    @Binding var isEditingPassword: Bool
564
    @Binding var isValidPassword: Bool
565
    @Binding var isPasswordShow: Bool
566
 
567
    var body : some View {
568
        //Inicio Label Password
569
        HStack {
570
            Text(Config.LANG_SIGNIN_TITLE_PASSWORD_FIELD)
17 efrain 571
                .font(Font.custom(Config  .FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_LABEL))
1 efrain 572
            .foregroundColor(Color("color_textview_foreground"))
573
            Spacer()
574
        }
575
        .padding(.leading, 16)
576
        //Fin Label Password
577
 
578
 
579
        //Inicio TextField  Password
580
 
581
        Group {
582
            HStack {
583
                /*
584
                Image("ui_key")
585
                .resizable()
586
                .frame(width: 24, height: 24)
587
                         .padding(.horizontal, 4)
588
                 */
589
                if isPasswordShow {
590
 
591
                    TextField("",
592
                        text: self.$password,
593
                        onEditingChanged: { (changed) in
594
 
595
                            if changed {
596
                                self.isEditingPassword = true
597
                            } else {
598
                                self.isEditingPassword = false
599
                                self.isValidPassword = Validator.checkPassword(password: self.password)
600
                            }
601
 
602
                        }, onCommit: {
603
                            self.isEditingPassword = false
604
                            self.isValidPassword = Validator.checkPassword(password:  self.password)
605
                        }
606
                    )
17 efrain 607
                    .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD))
1 efrain 608
                    .textFieldStyle(PlainTextFieldStyle())
609
                    .frame(height: 32)
610
                        .keyboardType(.default)
611
                    .autocapitalization(.none)
612
                    /*
613
                    .foregroundColor(Color("color_textfield_foreground"))
614
                    .background(Color("color_textfield_background"))
615
 */
616
                    .padding(.leading, 4)
617
                    Spacer()
618
 
619
                    Button(action: {
620
                        self.isPasswordShow.toggle()
621
                    }, label: {
622
                        Image("ui_visibility_off")
623
                        .resizable()
624
                        .frame(width: 24, height: 24)
625
                                 .padding(.horizontal, 4)
626
                    })
627
                } else {
628
 
629
                    SecureField("", text: self.$password, onCommit: {
630
                        self.isEditingPassword = false
631
                        self.isValidPassword = Validator.checkPassword(password: self.password)
632
                    })
633
                    .onTapGesture {
634
                        self.isEditingPassword = true
635
                    }
17 efrain 636
                    .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD))
1 efrain 637
                    .textFieldStyle(PlainTextFieldStyle())
638
                    .frame(height: 32)
639
                        .keyboardType(.default)
640
                    .autocapitalization(.none)
641
                    /*
642
                    .foregroundColor(Color("color_textfield_foreground"))
643
                    .background(Color("color_textfield_background"))*/
644
                        .padding(.leading, 4)
645
                    Spacer()
646
 
647
                    Button(action: {
648
                        self.isPasswordShow.toggle()
649
                    }, label: {
650
                        Image("ui_visibility")
651
                        .resizable()
652
                        .frame(width: 24, height: 24)
653
                                 .padding(.horizontal, 4)
654
 
655
                    })
656
 
657
                }
658
 
659
                //
660
                //ui_visibility
661
 
662
            }
663
        }
664
        .foregroundColor(Color("color_textfield_foreground"))
665
        .background(Color("color_textfield_background"))
666
        .overlay(RoundedRectangle(cornerRadius: 5).stroke(
667
            Color(self.isEditingPassword ? "color_textfield_border_active" : self.isValidPassword ? "color_textfield_border" : "color_textfield_border_error" )
668
        ))
669
        .padding(.leading, 16)
670
        .padding(.trailing, 16)
671
        .padding(.top, 2)
672
 
673
        if !self.isValidPassword {
674
            HStack {
675
                Spacer()
676
 
677
                Text(Config.LANG_SIGNIN_ERROR_PASSWORD_FIELD)
678
                .foregroundColor(.red)
17 efrain 679
                .font(Font.custom(Config.FONT_NAME_REGULAR, size: Config.FONT_SIZE_TEXTFIELD_ERROR))
1 efrain 680
 
681
            }
682
            .padding(.top, 5)
683
            .padding(.trailing, 16)
684
        }
685
 
686
        //Fin TextField Password
687
 
688
 
689
    }
690
 
691
 
692
 
693
}
694
 
695
struct ButtonSignUpGroup : View {
11 efrain 696
    @Binding var openSignup : Bool
1 efrain 697
 
11 efrain 698
 
699
 
1 efrain 700
    var body : some View {
701
        Button(action: {
11 efrain 702
            openSignup = true
1 efrain 703
 
704
        }, label: {
705
            Text(Config.LANG_SIGNIN_BUTTON_SIGNUP)
706
             .font(Font.custom(Config.FONT_NAME_REGULAR, size: 13))
707
             .frame(width: UIScreen.main.bounds.width - 32, height: 35)
708
                .foregroundColor(Color("color_button_foreground"))
709
                .background(Color("color_button_background"))
710
                .border(Color("color_button_border"), width: Config.BUTTON_BORDER_SIZE)
711
                .cornerRadius(Config.BUTTON_BORDER_RADIUS)
712
 
713
        })
714
        .padding(.top, 16)
715
        .padding(.leading, 16)
716
        .padding(.trailing, 16)
717
    }
718
}
719
 
720
struct ButtonForgotPasswordGroup : View {
11 efrain 721
    @Binding var openForgotPassword : Bool
722
 
1 efrain 723
    var body : some View {
724
        Button(action: {
11 efrain 725
            openForgotPassword = true
1 efrain 726
 
727
        }, label: {
728
            Text(Config.LANG_SIGNIN_BUTTON_FORGOT_PASSWORD)
729
             .font(Font.custom(Config.FONT_NAME_REGULAR, size: 13))
730
 
731
                .foregroundColor(Color("color_button_foreground"))
732
 
733
 
734
 
735
        })
736
        .padding(.vertical, 16)
737
    }
738
}
11 efrain 739