diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index f4911b90b0ae8ebf363f26459dbd14e575a69db5..df2f5df725180198e0081f21ea0d5a96955d7f3e 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -147,6 +147,7 @@ 47EABF272423BFDD00774A93 /* AuthenticationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EABF262423BFDD00774A93 /* AuthenticationScreen.swift */; }; 47EABF292423C1FB00774A93 /* KeyboardChecker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EABF282423C1FB00774A93 /* KeyboardChecker.swift */; }; 47EABF2B2423C20C00774A93 /* LoadingBlocker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EABF2A2423C20C00774A93 /* LoadingBlocker.swift */; }; + 47EABF2D2423C65F00774A93 /* AuthenticationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47EABF2C2423C65F00774A93 /* AuthenticationView.swift */; }; 47F0376E22A7278A0005C9DE /* accounts.json in Resources */ = {isa = PBXBuildFile; fileRef = 47F0376D22A7278A0005C9DE /* accounts.json */; }; 47F79240203492E3005E7DB6 /* KeyRecord+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47F7923E203492E3005E7DB6 /* KeyRecord+CoreDataClass.swift */; }; 47F79241203492E3005E7DB6 /* KeyRecord+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47F7923F203492E3005E7DB6 /* KeyRecord+CoreDataProperties.swift */; }; @@ -545,6 +546,7 @@ 47EABF262423BFDD00774A93 /* AuthenticationScreen.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationScreen.swift; sourceTree = "<group>"; }; 47EABF282423C1FB00774A93 /* KeyboardChecker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KeyboardChecker.swift; sourceTree = "<group>"; }; 47EABF2A2423C20C00774A93 /* LoadingBlocker.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingBlocker.swift; sourceTree = "<group>"; }; + 47EABF2C2423C65F00774A93 /* AuthenticationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthenticationView.swift; sourceTree = "<group>"; }; 47F0376D22A7278A0005C9DE /* accounts.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = accounts.json; sourceTree = "<group>"; }; 47F7923E203492E3005E7DB6 /* KeyRecord+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KeyRecord+CoreDataClass.swift"; sourceTree = "<group>"; }; 47F7923F203492E3005E7DB6 /* KeyRecord+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KeyRecord+CoreDataProperties.swift"; sourceTree = "<group>"; }; @@ -1153,6 +1155,7 @@ 47EABF0C241A9CA800774A93 /* MailAccount.swift */, 47EABF06241A9C8700774A93 /* AuthenticationModel.swift */, 47EABF262423BFDD00774A93 /* AuthenticationScreen.swift */, + 47EABF2C2423C65F00774A93 /* AuthenticationView.swift */, 47EABF2A2423C20C00774A93 /* LoadingBlocker.swift */, 47EABF07241A9C8700774A93 /* AuthenticationViewModel.swift */, ); @@ -2107,6 +2110,7 @@ 0E6551A72406A42300DE30FC /* SearchHelper.swift in Sources */, 472F398E1E251B8D009260FB /* MailAddress.swift in Sources */, A198D2292056B384004CC838 /* SendViewDelegate.swift in Sources */, + 47EABF2D2423C65F00774A93 /* AuthenticationView.swift in Sources */, 479011492289975D0057AB04 /* NoSecIconStyleKit.swift in Sources */, F12060821DA552FC00F6EF37 /* MailHandlerDelegator.swift in Sources */, 474994022261E4E6000F8DA5 /* SimpleSendIcon.swift in Sources */, diff --git a/enzevalos_iphone/AuthenticationScreen.swift b/enzevalos_iphone/AuthenticationScreen.swift index b4945a7fc601b663cdf933b9978836c3964e37f4..2a65105e9a07724a62fbf284d78aa0a23fe4b4cc 100644 --- a/enzevalos_iphone/AuthenticationScreen.swift +++ b/enzevalos_iphone/AuthenticationScreen.swift @@ -106,43 +106,3 @@ struct AuthenticationScreen: View { return (self.viewModel.errorMessage != nil) && (!self.viewModel.errorMessage!.isEmpty) } } - -struct ActivityIndicator: UIViewRepresentable { - - @Binding var isAnimating: Bool - let style: UIActivityIndicatorView.Style - - func makeUIView(context: UIViewRepresentableContext<ActivityIndicator>) -> UIActivityIndicatorView { - return UIActivityIndicatorView(style: style) - } - - func updateUIView(_ uiView: UIActivityIndicatorView, context: UIViewRepresentableContext<ActivityIndicator>) { - isAnimating ? uiView.startAnimating() : uiView.stopAnimating() - } -} - -struct LoadingView<Content>: View where Content: View { - - @Binding var isShowing: Bool - var content: () -> Content - - var body: some View { - ZStack(alignment: .center) { - - self.content() - .disabled(self.isShowing) - .blur(radius: self.isShowing ? 3 : 0) - - VStack { - Text("Loading...") - ActivityIndicator(isAnimating: .constant(true), style: .large) - } - .frame(width: UIScreen.main.bounds.size.width / 2, - height: UIScreen.main.bounds.size.height / 5) - .background(Color.secondary.colorInvert()) - .foregroundColor(Color.primary) - .cornerRadius(20) - .opacity(self.isShowing ? 1 : 0) - } - } -} diff --git a/enzevalos_iphone/AuthenticationViewModel.swift b/enzevalos_iphone/AuthenticationViewModel.swift index e6fc4ea82c6d3933101d99b0966d98b139b74112..fb17e551c5ea787ce185a2b57f46ac600cb50b80 100644 --- a/enzevalos_iphone/AuthenticationViewModel.swift +++ b/enzevalos_iphone/AuthenticationViewModel.swift @@ -7,6 +7,7 @@ // import Foundation +import Combine class AuthenticationViewModel : ObservableObject {