diff --git a/enzevalos_iphone.xcodeproj/project.pbxproj b/enzevalos_iphone.xcodeproj/project.pbxproj index 4b007fa5071b84027b37d2b08d3122a1aff62929..ebfed598271c9834c7ab6585de1097b049fe3b5b 100644 --- a/enzevalos_iphone.xcodeproj/project.pbxproj +++ b/enzevalos_iphone.xcodeproj/project.pbxproj @@ -33,6 +33,7 @@ 4707092E2189C74200DF71A3 /* alicePublic.asc in Resources */ = {isa = PBXBuildFile; fileRef = 4707092C2189C74200DF71A3 /* alicePublic.asc */; }; 470709302189E1C100DF71A3 /* enc+signedThunderbird.eml in Resources */ = {isa = PBXBuildFile; fileRef = 4707092F2189E1C000DF71A3 /* enc+signedThunderbird.eml */; }; 4707096D1F8F9F4900657F41 /* ExportViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4707096C1F8F9F4900657F41 /* ExportViewController.swift */; }; + 47128FC9240BD3F70019F5CA /* Inbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47128FC8240BD3F70019F5CA /* Inbox.swift */; }; 4715F637202A0248001BFFD0 /* CoreDataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4715F636202A0248001BFFD0 /* CoreDataTests.swift */; }; 47184C3922F0D8F200712A7A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 47184C3822F0D8F200712A7A /* CFNetwork.framework */; }; 471876F7223FACA900912135 /* BobPWTEST1234.asc in Resources */ = {isa = PBXBuildFile; fileRef = 471876F5223FACA900912135 /* BobPWTEST1234.asc */; }; @@ -64,6 +65,14 @@ 475B00431F7BB6D6006CDD41 /* PersistentKey+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475B00411F7BB6D6006CDD41 /* PersistentKey+CoreDataProperties.swift */; }; 475DF4791F0D54C9009D807F /* Folder+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475DF4771F0D54C9009D807F /* Folder+CoreDataClass.swift */; }; 475DF47A1F0D54C9009D807F /* Folder+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 475DF4781F0D54C9009D807F /* Folder+CoreDataProperties.swift */; }; + 4760F438240D59CA0019A184 /* KeyRecordRow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F437240D59CA0019A184 /* KeyRecordRow.swift */; }; + 4760F43B240D5C050019A184 /* CiricleImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F43A240D5C050019A184 /* CiricleImage.swift */; }; + 4760F43D240D6E2B0019A184 /* MailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F43C240D6E2B0019A184 /* MailView.swift */; }; + 4760F440240E520C0019A184 /* Stroke.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F43F240E520C0019A184 /* Stroke.swift */; }; + 4760F444240E9D150019A184 /* VCSwiftUIView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F443240E9D150019A184 /* VCSwiftUIView.swift */; }; + 4760F45A241027370019A184 /* InboxCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F459241027370019A184 /* InboxCoordinator.swift */; }; + 4760F46224114DE50019A184 /* SearchBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F46124114DE50019A184 /* SearchBar.swift */; }; + 4760F466241195AB0019A184 /* SearchView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4760F465241195AB0019A184 /* SearchView.swift */; }; 476142081E07E52B00FD5E4F /* Theme.swift in Sources */ = {isa = PBXBuildFile; fileRef = 476142071E07E52B00FD5E4F /* Theme.swift */; }; 4761420A1E082F9C00FD5E4F /* Settings.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 476142091E082F9C00FD5E4F /* Settings.bundle */; }; 476373C21E09BA88004D5EFE /* UserData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 476373C11E09BA88004D5EFE /* UserData.swift */; }; @@ -133,6 +142,8 @@ 47F867E42052B49800AA832F /* libbz2.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 47F867E32052B49800AA832F /* libbz2.tbd */; }; 50F2E7D66366C779705987A7 /* Pods_enzevalos_iphoneUITests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AF67EF30BB065CC9C0D17940 /* Pods_enzevalos_iphoneUITests.framework */; }; 71DFE5BA240679E80042019C /* HeaderExtractionValues.swift in Sources */ = {isa = PBXBuildFile; fileRef = 71DFE5B9240679E80042019C /* HeaderExtractionValues.swift */; }; + 74ABD44C240D4E0B00671734 /* NewOnboardingView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74ABD44B240D4E0B00671734 /* NewOnboardingView.swift */; }; + 74ABD44F240E635E00671734 /* OnboardingIntro.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74ABD44E240E635E00671734 /* OnboardingIntro.swift */; }; 7500EE9D4F3130671F5C1AE2 /* Pods_enzevalos_iphoneTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7977EA7012D8E98D186D5C60 /* Pods_enzevalos_iphoneTests.framework */; }; 8428A8531F4369C0007649A5 /* Gamification.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 8428A8521F4369C0007649A5 /* Gamification.storyboard */; }; 8428A8551F4369CF007649A5 /* GamificationElements.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 8428A8541F4369CF007649A5 /* GamificationElements.xcassets */; }; @@ -298,6 +309,7 @@ 4707092C2189C74200DF71A3 /* alicePublic.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = alicePublic.asc; sourceTree = "<group>"; }; 4707092F2189E1C000DF71A3 /* enc+signedThunderbird.eml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "enc+signedThunderbird.eml"; sourceTree = "<group>"; }; 4707096C1F8F9F4900657F41 /* ExportViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExportViewController.swift; sourceTree = "<group>"; }; + 47128FC8240BD3F70019F5CA /* Inbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Inbox.swift; sourceTree = "<group>"; }; 4715F636202A0248001BFFD0 /* CoreDataTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CoreDataTests.swift; sourceTree = "<group>"; }; 47184C3822F0D8F200712A7A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 471876F5223FACA900912135 /* BobPWTEST1234.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = BobPWTEST1234.asc; sourceTree = "<group>"; }; @@ -331,6 +343,14 @@ 475B00411F7BB6D6006CDD41 /* PersistentKey+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PersistentKey+CoreDataProperties.swift"; sourceTree = "<group>"; }; 475DF4771F0D54C9009D807F /* Folder+CoreDataClass.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Folder+CoreDataClass.swift"; sourceTree = "<group>"; }; 475DF4781F0D54C9009D807F /* Folder+CoreDataProperties.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Folder+CoreDataProperties.swift"; sourceTree = "<group>"; }; + 4760F437240D59CA0019A184 /* KeyRecordRow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyRecordRow.swift; sourceTree = "<group>"; }; + 4760F43A240D5C050019A184 /* CiricleImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CiricleImage.swift; sourceTree = "<group>"; }; + 4760F43C240D6E2B0019A184 /* MailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailView.swift; sourceTree = "<group>"; }; + 4760F43F240E520C0019A184 /* Stroke.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stroke.swift; sourceTree = "<group>"; }; + 4760F443240E9D150019A184 /* VCSwiftUIView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = VCSwiftUIView.swift; sourceTree = "<group>"; }; + 4760F459241027370019A184 /* InboxCoordinator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InboxCoordinator.swift; sourceTree = "<group>"; }; + 4760F46124114DE50019A184 /* SearchBar.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchBar.swift; sourceTree = "<group>"; }; + 4760F465241195AB0019A184 /* SearchView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchView.swift; sourceTree = "<group>"; }; 476142071E07E52B00FD5E4F /* Theme.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Theme.swift; sourceTree = "<group>"; }; 476142091E082F9C00FD5E4F /* Settings.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Settings.bundle; sourceTree = "<group>"; }; 476373C11E09BA88004D5EFE /* UserData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UserData.swift; sourceTree = "<group>"; }; @@ -404,6 +424,8 @@ 66E758F271CD65AB3E5FE7A7 /* Pods-enzevalos_iphoneUITests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneUITests.debug.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneUITests/Pods-enzevalos_iphoneUITests.debug.xcconfig"; sourceTree = "<group>"; }; 6EBCCD02AD3B95D8317810E2 /* Pods-enzevalos_iphoneTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneTests.debug.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneTests/Pods-enzevalos_iphoneTests.debug.xcconfig"; sourceTree = "<group>"; }; 71DFE5B9240679E80042019C /* HeaderExtractionValues.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeaderExtractionValues.swift; sourceTree = "<group>"; }; + 74ABD44B240D4E0B00671734 /* NewOnboardingView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NewOnboardingView.swift; sourceTree = "<group>"; }; + 74ABD44E240E635E00671734 /* OnboardingIntro.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardingIntro.swift; sourceTree = "<group>"; }; 796D16D79BED5D60B580E602 /* Pods-enzevalos_iphoneUITests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-enzevalos_iphoneUITests.release.xcconfig"; path = "../enzevalos_iphone_workspace/Pods/Target Support Files/Pods-enzevalos_iphoneUITests/Pods-enzevalos_iphoneUITests.release.xcconfig"; sourceTree = "<group>"; }; 7977EA7012D8E98D186D5C60 /* Pods_enzevalos_iphoneTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_enzevalos_iphoneTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 8428A8521F4369C0007649A5 /* Gamification.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Gamification.storyboard; sourceTree = "<group>"; }; @@ -671,6 +693,25 @@ path = testKeys; sourceTree = "<group>"; }; + 47128FC6240BD3CC0019F5CA /* SwiftUI */ = { + isa = PBXGroup; + children = ( + 4760F439240D5BEF0019A184 /* SupportingViews */, + 47128FC7240BD3D90019F5CA /* Inbox */, + ); + path = SwiftUI; + sourceTree = "<group>"; + }; + 47128FC7240BD3D90019F5CA /* Inbox */ = { + isa = PBXGroup; + children = ( + 47128FC8240BD3F70019F5CA /* Inbox.swift */, + 4760F437240D59CA0019A184 /* KeyRecordRow.swift */, + 4760F459241027370019A184 /* InboxCoordinator.swift */, + ); + path = Inbox; + sourceTree = "<group>"; + }; 472F39921E279792009260FB /* protocols */ = { isa = PBXGroup; children = ( @@ -682,6 +723,35 @@ name = protocols; sourceTree = "<group>"; }; + 4760F439240D5BEF0019A184 /* SupportingViews */ = { + isa = PBXGroup; + children = ( + 4760F44C240F9C010019A184 /* SwiftUI to UIKit */, + 4760F43E240E52010019A184 /* Geometry */, + 4760F43A240D5C050019A184 /* CiricleImage.swift */, + 4760F43C240D6E2B0019A184 /* MailView.swift */, + 4760F465241195AB0019A184 /* SearchView.swift */, + ); + path = SupportingViews; + sourceTree = "<group>"; + }; + 4760F43E240E52010019A184 /* Geometry */ = { + isa = PBXGroup; + children = ( + 4760F43F240E520C0019A184 /* Stroke.swift */, + ); + path = Geometry; + sourceTree = "<group>"; + }; + 4760F44C240F9C010019A184 /* SwiftUI to UIKit */ = { + isa = PBXGroup; + children = ( + 4760F443240E9D150019A184 /* VCSwiftUIView.swift */, + 4760F46124114DE50019A184 /* SearchBar.swift */, + ); + path = "SwiftUI to UIKit"; + sourceTree = "<group>"; + }; 476EEF9722A872BF00BB4EF7 /* enzevalos_iphoneUITests */ = { isa = PBXGroup; children = ( @@ -792,6 +862,14 @@ path = private; sourceTree = "<group>"; }; + 74ABD44D240E633700671734 /* SwiftUI */ = { + isa = PBXGroup; + children = ( + 74ABD44E240E635E00671734 /* OnboardingIntro.swift */, + ); + name = SwiftUI; + sourceTree = "<group>"; + }; 78280F99990BFF65543B7F0B /* Frameworks */ = { isa = PBXGroup; children = ( @@ -934,6 +1012,7 @@ A13526771D955BDF00D3BFE1 /* enzevalos_iphone */ = { isa = PBXGroup; children = ( + 47128FC6240BD3CC0019F5CA /* SwiftUI */, 97B2F4D4240D31E6000DB34E /* authentication */, A1B9999D21DE7CD2002563F6 /* Travel */, 477548DC21F5DA46000B22A8 /* mail */, @@ -1055,12 +1134,14 @@ A18C76851E8185ED00B21414 /* onboarding */ = { isa = PBXGroup; children = ( + 74ABD44D240E633700671734 /* SwiftUI */, 479C649821F45DAF00A01071 /* HideShowPasswordTextField.swift */, 479C649921F45DAF00A01071 /* PasswordToggleVisibilityView.swift */, A1083A531E8BFEA6003666B7 /* Onboarding.swift */, 4751C6F72343B377006B2A4D /* Onboarding.Video.Click.Eng.m4v */, A102AA891EDDB4E80024B457 /* videoOnboarding2.m4v */, A1C62E992018F716000E5273 /* OnboardingValueState.swift */, + 74ABD44B240D4E0B00671734 /* NewOnboardingView.swift */, ); name = onboarding; sourceTree = "<group>"; @@ -1241,6 +1322,8 @@ dependencies = ( ); name = enzevalos_iphone; + packageProductDependencies = ( + ); productName = enzevalos_iphone; productReference = A13526751D955BDF00D3BFE1 /* enzevalos_iphone.app */; productType = "com.apple.product-type.application"; @@ -1322,6 +1405,8 @@ de, ); mainGroup = A135266C1D955BDF00D3BFE1; + packageReferences = ( + ); productRefGroup = A13526761D955BDF00D3BFE1 /* Products */; projectDirPath = ""; projectRoot = ""; @@ -1557,6 +1642,7 @@ A1E2324E1F0FA41A00DC9D40 /* FolderListCell.swift in Sources */, A1F8541021E8A60800614514 /* IntroSecretViewController.swift in Sources */, A1ACDD0921EB9C4C00A059D0 /* IntroInputViewController.swift in Sources */, + 4760F43B240D5C050019A184 /* CiricleImage.swift in Sources */, 476916A0216B86A100491527 /* PersistentMail +CoreDataClass.swift in Sources */, 4751C7002344D37C006B2A4D /* SecretKey+CoreDataClass.swift in Sources */, A1AEBA5921E808CB00C84E59 /* IntroYesNoViewController.swift in Sources */, @@ -1565,6 +1651,7 @@ 8428A8651F436A11007649A5 /* BadgeCaseCollectionViewCell.swift in Sources */, 472F39811E1E5347009260FB /* Mail_Address+CoreDataClass.swift in Sources */, A1EB05821D95685B008659C1 /* CollectionDataDelegate.swift in Sources */, + 4760F43D240D6E2B0019A184 /* MailView.swift in Sources */, 47A5D6E22294BF3B0084F81D /* TempKey.swift in Sources */, 4751C7012344D37C006B2A4D /* SecretKey+CoreDataProperties.swift in Sources */, 47D1302B1F7CEE6D007B14DF /* DebugSettings.swift in Sources */, @@ -1582,6 +1669,7 @@ F113C3851F30D06800E7F1D6 /* QRScannerView.swift in Sources */, 477670C6228454F700043604 /* ButtonCell.swift in Sources */, F18B44601E704C550080C041 /* ReplaceSegue.swift in Sources */, + 4760F46224114DE50019A184 /* SearchBar.swift in Sources */, 8428A8661F436A11007649A5 /* ArrowTableViewCell.swift in Sources */, F1ACF21C1E0C1C6800C1B843 /* ContactViewController.swift in Sources */, 475B00351F7B9565006CDD41 /* CryptoObject.swift in Sources */, @@ -1590,6 +1678,7 @@ 8428A86F1F436A1E007649A5 /* InviteFriendViewController.swift in Sources */, A1735DFA205AB88500B336DB /* SendViewState.swift in Sources */, 475B00331F7B9565006CDD41 /* SwiftPGP.swift in Sources */, + 4760F444240E9D150019A184 /* VCSwiftUIView.swift in Sources */, 477548E421F77BA0000B22A8 /* StudyParameterProtocol.swift in Sources */, 47A5D6E42294BFF50084F81D /* Logger.swift in Sources */, 3EB4FAA420120096001D0625 /* DialogOption.swift in Sources */, @@ -1610,7 +1699,10 @@ 476801DB218436B600F7F259 /* Autocrypt.swift in Sources */, A1EB057A1D956829008659C1 /* ContactCell.swift in Sources */, A12FC23120221A1400196008 /* ExportInfoViewController.swift in Sources */, + 74ABD44F240E635E00671734 /* OnboardingIntro.swift in Sources */, 4751C6EE233CA583006B2A4D /* DateExtension.swift in Sources */, + 74ABD44C240D4E0B00671734 /* NewOnboardingView.swift in Sources */, + 4760F440240E520C0019A184 /* Stroke.swift in Sources */, 477548DE21F5DABE000B22A8 /* MailServerConnectionError.swift in Sources */, 475DF47A1F0D54C9009D807F /* Folder+CoreDataProperties.swift in Sources */, 475B00431F7BB6D6006CDD41 /* PersistentKey+CoreDataProperties.swift in Sources */, @@ -1638,6 +1730,7 @@ A1EB05841D956867008659C1 /* TableViewDataDelegate.swift in Sources */, 8428A85E1F436A05007649A5 /* CircleView.swift in Sources */, A182182C21E5072200918A29 /* IntroDescriptionViewController.swift in Sources */, + 47128FC9240BD3F70019F5CA /* Inbox.swift in Sources */, F1C7AC821FED6473007629DB /* AboutViewController.swift in Sources */, A182183421E51DD200918A29 /* IntroContactCell.swift in Sources */, 472F397C1E1D0B0B009260FB /* PersistentMail +CoreDataProperties.swift in Sources */, @@ -1653,6 +1746,7 @@ 8428A85F1F436A05007649A5 /* GamificationData.swift in Sources */, 475DF4791F0D54C9009D807F /* Folder+CoreDataClass.swift in Sources */, A15D215B223BE5F4003E0CE0 /* TempAttachment.swift in Sources */, + 4760F438240D59CA0019A184 /* KeyRecordRow.swift in Sources */, 4706D65F225B7B6B00B3F1D3 /* ItunesHandler.swift in Sources */, 3EC35F2D200376A1008BDF95 /* SendViewController+Invitation.swift in Sources */, 475B00341F7B9565006CDD41 /* Cryptography.swift in Sources */, @@ -1664,6 +1758,7 @@ 472F39701E14F75C009260FB /* DataHandler.swift in Sources */, A1C62E9A2018F716000E5273 /* OnboardingValueState.swift in Sources */, A1EB05901D956923008659C1 /* ReadViewController.swift in Sources */, + 4760F466241195AB0019A184 /* SearchView.swift in Sources */, 0E6551A72406A42300DE30FC /* SearchHelper.swift in Sources */, 472F398E1E251B8D009260FB /* MailAddress.swift in Sources */, A198D2292056B384004CC838 /* SendViewDelegate.swift in Sources */, @@ -1678,6 +1773,7 @@ 47E7376E22845EC400972401 /* SecretKeyTableViewController.swift in Sources */, 478154A721FF3F0900A931EC /* Warning.swift in Sources */, 8428A8681F436A11007649A5 /* SubBadgeTableViewCell.swift in Sources */, + 4760F45A241027370019A184 /* InboxCoordinator.swift in Sources */, A1EB05861D956872008659C1 /* FrequentCell.swift in Sources */, F12041FB1DA3FBF7002E4940 /* ListViewController.swift in Sources */, F18B445E1E7044B70080C041 /* FlipTransition.swift in Sources */, diff --git a/enzevalos_iphone/AppDelegate.swift b/enzevalos_iphone/AppDelegate.swift index 5b06669feaf96aca1b0b20fe45a2d42995001efb..339c577bfec2e1f1bca5e8ad7f7afa7d8adef2e6 100644 --- a/enzevalos_iphone/AppDelegate.swift +++ b/enzevalos_iphone/AppDelegate.swift @@ -17,7 +17,6 @@ // along with this program. If not, see <https://www.gnu.org/licenses/>. // -import UIKit import SwiftUI import Contacts import CoreData @@ -26,16 +25,24 @@ import SystemConfiguration import QAKit import GTMAppAuth import UserNotifications +import SwiftUI + @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { + + + var newOnboarding=false + var window: UIWindow? var contactStore = CNContactStore() var mailHandler = MailHandler() + //var dataHandler = DataHandler.handler var orientationLock = UIInterfaceOrientationMask.allButUpsideDown var counterBackgroundFetch = 0 var start: Date = Date() let showAlertNoConnection = false + var inboxCoordinator: InboxCoordinator? = nil func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { @@ -56,8 +63,12 @@ class AppDelegate: UIResponder, UIApplicationDelegate { UserDefaults.standard.register(defaults: ["Signature.Text": "Verfasst mit Letterbox. Mehr Informationen: http://letterbox-app.org"]) self.window = UIWindow(frame: UIScreen.main.bounds) - self.window?.rootViewController = UIHostingController(rootView: AuthenticationScreen()) + if (newOnboarding) + {self.window?.rootViewController = UIHostingController(rootView: NewOnboardingView())} + else + {self.window?.rootViewController = Onboarding.onboarding()} self.window?.makeKeyAndVisible() + } else { @@ -235,7 +246,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate { class func getAppDelegate() -> AppDelegate { - return UIApplication.shared.delegate as! AppDelegate + guard let appDelegate = UIApplication.shared.delegate as? AppDelegate else { + fatalError("No AppDelegate!") + } + return appDelegate } @@ -295,8 +309,25 @@ class AppDelegate: UIResponder, UIApplicationDelegate { func requestForAccess() { self.requestForAccess(self.contactCheck) } - + + + + func sceneDidEnterBackground(_ scene: UIScene) { + DataHandler.handler.saveContext() + } + + func presentInboxViewController() { + //presentSwiftUITest() + guard let vc = self.window?.rootViewController as? UINavigationController else { + fatalError("No rootViewController!") + } + inboxCoordinator = InboxCoordinator(root: vc) + guard let coord = inboxCoordinator else { + fatalError("No Coordinator") + } + coord.pushInbox() + return let rootViewController = (self.window?.rootViewController! as! UINavigationController) for vc in rootViewController.viewControllers { diff --git a/enzevalos_iphone/Base.lproj/Main.storyboard b/enzevalos_iphone/Base.lproj/Main.storyboard index ec606ac867fd86130ada6bb4177c155dff7ea931..5c08e7be35a6470ef34544f9d48343ac06a9d4ca 100644 --- a/enzevalos_iphone/Base.lproj/Main.storyboard +++ b/enzevalos_iphone/Base.lproj/Main.storyboard @@ -2,7 +2,6 @@ <document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15705" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="Amm-QN-vA7"> <device id="retina6_5" orientation="portrait" appearance="light"/> <dependencies> - <deployment identifier="iOS"/> <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15706"/> <capability name="Safe area layout guides" minToolsVersion="9.0"/> <capability name="Stack View standard spacing" minToolsVersion="9.0"/> @@ -14,7 +13,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-Ouw-WD-EV6" id="Ouw-WD-EV6" customClass="ReadViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="static" style="grouped" separatorStyle="default" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="8" sectionFooterHeight="1" id="oZT-OA-Re5"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <sections> @@ -294,7 +293,7 @@ <navigationItem key="navigationItem" id="JgT-PA-2op"> <nil key="title"/> <button key="titleView" opaque="NO" contentMode="center" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="bcV-Tv-Mmh"> - <rect key="frame" x="192" y="6" width="30" height="32"/> + <rect key="frame" x="192" y="12" width="30" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/> <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/> <state key="normal"> @@ -822,7 +821,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-ooe-0X-glz" id="ooe-0X-glz" customClass="ListViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" id="ipK-4X-lVA"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <prototypes> @@ -908,7 +907,7 @@ <objects> <tableViewController storyboardIdentifier="UITableViewController-8Di-x2-cWQ" useStoryboardIdentifierAsRestorationIdentifier="YES" id="8Di-x2-cWQ" customClass="ContactViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="lK7-ug-OyQ"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <prototypes> @@ -1295,7 +1294,7 @@ </constraints> </imageView> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="751" verticalHuggingPriority="751" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="coq-va-tcb"> - <rect key="frame" x="72" y="14" width="41.666666666666657" height="20.333333333333329"/> + <rect key="frame" x="72" y="13.999999999999998" width="41.666666666666657" height="20.333333333333329"/> <fontDescription key="fontDescription" type="system" pointSize="17"/> <nil key="textColor"/> <nil key="highlightedColor"/> @@ -1353,7 +1352,7 @@ <objects> <viewController id="jYD-fk-aIP" customClass="KeyViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="18" sectionFooterHeight="18" id="ZAH-bZ-S6n"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" flexibleMaxX="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <edgeInsets key="layoutMargins" top="10" left="20" bottom="10" right="20"/> @@ -1536,7 +1535,7 @@ <objects> <tableViewController storyboardIdentifier="exportInfoViewController" id="7Pd-d5-0wz" customClass="ExportInfoViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <tableView key="view" clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" dataMode="prototypes" style="grouped" separatorStyle="default" sectionIndexMinimumDisplayRowCount="1" rowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="2Uv-bd-pB1"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/> <prototypes> @@ -1789,14 +1788,14 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <objects> <viewController id="86r-Nd-UBB" customClass="QRScannerView" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <view key="view" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" id="sqq-s3-zif"> - <rect key="frame" x="0.0" y="0.0" width="414" height="896"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="842"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nMw-DD-7LP" userLabel="TopBar"> - <rect key="frame" x="0.0" y="0.0" width="414" height="76"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="32"/> <subviews> <button opaque="NO" contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="w9U-eC-Koh"> - <rect key="frame" x="8" y="36" width="30" height="38"/> + <rect key="frame" x="8" y="-8.3333333333333339" width="30" height="38.333333333333336"/> <fontDescription key="fontDescription" type="system" weight="heavy" pointSize="21"/> <state key="normal" title="✕"> <color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/> @@ -1806,7 +1805,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </connections> </button> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" insetsLayoutMarginsFromSafeArea="NO" text="Kontakt verifizieren" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="25l-XT-PFo"> - <rect key="frame" x="116.33333333333333" y="41.666666666666664" width="181.66666666666669" height="26.333333333333336"/> + <rect key="frame" x="116.33333333333333" y="-2.3333333333333339" width="181.66666666666669" height="26.333333333333336"/> <fontDescription key="fontDescription" style="UICTFontTextStyleTitle2"/> <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/> <nil key="highlightedColor"/> @@ -1820,7 +1819,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </constraints> </view> <view contentMode="scaleToFill" insetsLayoutMarginsFromSafeArea="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ukS-99-lnz" userLabel="BottomBar"> - <rect key="frame" x="0.0" y="825.66666666666663" width="414" height="70.333333333333371"/> + <rect key="frame" x="0.0" y="771.66666666666663" width="414" height="70.333333333333371"/> <subviews> <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" insetsLayoutMarginsFromSafeArea="NO" text="Scanne den QR Code des Kontaktes" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ysO-xv-18D"> <rect key="frame" x="68.666666666666657" y="7.9999999999999982" width="276.66666666666674" height="20.333333333333329"/> @@ -1867,11 +1866,11 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d <objects> <viewController storyboardIdentifier="SendViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="4Ey-v4-VeB" customClass="SendViewController" customModule="enzevalos_iphone" customModuleProvider="target" sceneMemberID="viewController"> <view key="view" contentMode="scaleToFill" id="5dv-YO-2iV"> - <rect key="frame" x="0.0" y="0.0" width="414" height="808"/> + <rect key="frame" x="0.0" y="0.0" width="414" height="786"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <scrollView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleAspectFill" layoutMarginsFollowReadableWidth="YES" alwaysBounceVertical="YES" showsHorizontalScrollIndicator="NO" keyboardDismissMode="interactive" translatesAutoresizingMaskIntoConstraints="NO" id="sij-Oe-ann"> - <rect key="frame" x="5" y="0.0" width="407" height="774"/> + <rect key="frame" x="5" y="0.0" width="407" height="786"/> <subviews> <view contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" translatesAutoresizingMaskIntoConstraints="NO" id="zgt-Nh-yna" customClass="VENTokenField"> <rect key="frame" x="0.0" y="0.0" width="404" height="44"/> @@ -2024,7 +2023,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </connections> </barButtonItem> <button key="titleView" opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="iUk-lk-1LN"> - <rect key="frame" x="161.66666666666666" y="6" width="91" height="32"/> + <rect key="frame" x="162" y="12" width="91" height="32"/> <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMaxY="YES"/> <connections> <action selector="iconButtonPressed:" destination="4Ey-v4-VeB" eventType="touchUpInside" id="Opj-Y1-Vtg"/> @@ -2225,8 +2224,7 @@ Um deine sicheren E-Mails auch auf einem anderen Gerät lesen zu können, muss d </scene> </scenes> <inferredMetricsTieBreakers> - <segue reference="l65-HC-TE7"/> - <segue reference="3Wb-uL-BB5"/> + <segue reference="hd4-SZ-DZ0"/> <segue reference="td8-VW-Wrt"/> <segue reference="DcR-GX-scc"/> <segue reference="TgN-rB-esa"/> diff --git a/enzevalos_iphone/DataHandler.swift b/enzevalos_iphone/DataHandler.swift index be2dc7370c4ef75907927ae13f8bfa49d5f36397..c0556cbda925d11c84f388d911eca264e2f30cc7 100644 --- a/enzevalos_iphone/DataHandler.swift +++ b/enzevalos_iphone/DataHandler.swift @@ -61,7 +61,7 @@ class DataHandler { private var mainMOC: NSManagedObjectContext private var backMOC: NSManagedObjectContext - private var managedObjectContext: NSManagedObjectContext { + var managedObjectContext: NSManagedObjectContext { get { if Thread.current.isMainThread { return mainMOC @@ -71,6 +71,31 @@ class DataHandler { } } } + /** + Make coredata available to SwiftUI + See: https://www.hackingwithswift.com/quick-start/swiftui/how-to-configure-core-data-to-work-with-swiftui + */ + lazy var persistentContainer: NSPersistentContainer = { + let container = NSPersistentContainer(name: "enzevalos_iphone") + container.loadPersistentStores { description, error in + if let error = error { + fatalError("Could not load data...") + } + } + return container + }() + + func saveContext () { + let context = persistentContainer.viewContext + if context.hasChanges { + do { + try context.save() + } catch { + // Show the error here + } + } + } + public let outgoingFolder = "OutgoingMails" diff --git a/enzevalos_iphone/Folder+CoreDataProperties.swift b/enzevalos_iphone/Folder+CoreDataProperties.swift index 8918988235fea555f3eea0b3ff92c8fecd3d2ceb..dd08f4738ef903b41c47f521894fe4e93cf51188 100644 --- a/enzevalos_iphone/Folder+CoreDataProperties.swift +++ b/enzevalos_iphone/Folder+CoreDataProperties.swift @@ -164,3 +164,4 @@ extension Folder: Comparable { return lhs.name == rhs.name && lhs.path == rhs.path } } + diff --git a/enzevalos_iphone/FolderViewController.swift b/enzevalos_iphone/FolderViewController.swift index bde8ef9ece36163530f0b5148156412ce3130abe..0bb9b2aeda36614eb989fc59d74846730a88da51 100644 --- a/enzevalos_iphone/FolderViewController.swift +++ b/enzevalos_iphone/FolderViewController.swift @@ -85,9 +85,13 @@ class FolderViewController: UITableViewController { } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) + navigationController?.isToolbarHidden = false tableView.reloadData() } + override func viewWillDisappear(_ animated: Bool){ + navigationController?.isToolbarHidden = true + } override func numberOfSections(in tableView: UITableView) -> Int { var count = 0 @@ -190,7 +194,12 @@ class FolderViewController: UITableViewController { override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { if sectionType(indexPath) == .inbox { - performSegue(withIdentifier: "showInboxSegue", sender: nil) + if let coord = AppDelegate.getAppDelegate().inboxCoordinator { + coord.pushInbox() + } else { + // If new inbox is not available... + performSegue(withIdentifier: "showInboxSegue", sender: nil) + } } else if sectionType(indexPath) == .mails { performSegue(withIdentifier: "readFolderMailSegue", sender: getMails()[indexPath.row]) } else { diff --git a/enzevalos_iphone/KeyRecord+CoreDataClass.swift b/enzevalos_iphone/KeyRecord+CoreDataClass.swift index e95102f4f17d96163dc8fd9a18343d3c820e6e49..6fff2339219c4fb3d7887ad0b543a158abee1dcd 100644 --- a/enzevalos_iphone/KeyRecord+CoreDataClass.swift +++ b/enzevalos_iphone/KeyRecord+CoreDataClass.swift @@ -22,6 +22,7 @@ import Foundation import CoreData import Contacts import UIKit +import SwiftUI /** Key records are mostly used in the inbox and for id (views). For each key we have a single key record. There are also key records for each mail address without keys, for instance when receiving unsigned mails. @@ -29,8 +30,7 @@ import UIKit One person can have multiple key records, e.g. one with key, one without a key or multiple keys. */ @objc(KeyRecord) -public class KeyRecord: NSManagedObject, Record { - +public class KeyRecord: NSManagedObject, Record, Identifiable { public var isUser: Bool { get{ /** @@ -335,3 +335,14 @@ public func < (lhs: KeyRecord, rhs: KeyRecord) -> Bool { return lhs.mails.first!.date > rhs.mails.first!.date } + +extension UIImage { + /** + Same as image but different type + */ + public var img: Image { + get { + return Image(uiImage: self) + } + } +} diff --git a/enzevalos_iphone/KeyRecord+CoreDataProperties.swift b/enzevalos_iphone/KeyRecord+CoreDataProperties.swift index 02a45fc35cd56ee2bcc456f54942a8620893defd..e32d5510250e0a81cb9cc0ed144e87eca425eab8 100644 --- a/enzevalos_iphone/KeyRecord+CoreDataProperties.swift +++ b/enzevalos_iphone/KeyRecord+CoreDataProperties.swift @@ -68,3 +68,27 @@ extension KeyRecord { @NSManaged public func removeFromPersistentMails(_ values: NSSet) } + +extension KeyRecord { + static func allRecordsFetchRequest(in folder: Folder) -> NSFetchRequest<KeyRecord> { + let request: NSFetchRequest<KeyRecord> = KeyRecord.fetchRequest() + //request.predicate = NSPredicate(format: "folder == %@", folder) + request.sortDescriptors = [NSSortDescriptor(key: "newestDate", ascending: false)] + return request + } + + static func allRecordsFetchRequest(in folder: Folder, query: String) -> NSFetchRequest<KeyRecord> { + let request: NSFetchRequest<KeyRecord> = KeyRecord.fetchRequest() + let folderPredicate = NSPredicate(format: "folder == %@", folder) + if !query.isEmpty { + let name = NSPredicate(format: "name CONTAINS %@", query) + request.predicate = NSCompoundPredicate(andPredicateWithSubpredicates: [folderPredicate, name]) + } else { + request.predicate = folderPredicate + } + request.sortDescriptors = [NSSortDescriptor(key: "newestDate", ascending: false)] + return request + } +} + + diff --git a/enzevalos_iphone/ListViewController.swift b/enzevalos_iphone/ListViewController.swift index 4983b0bc098a3e6d61171e0dd6cf266aeadd719c..c38f30d3bd74e3540ef115f70445170642511765 100644 --- a/enzevalos_iphone/ListViewController.swift +++ b/enzevalos_iphone/ListViewController.swift @@ -74,6 +74,11 @@ class ListViewController: UITableViewController { override func viewWillAppear(_ animated: Bool) { tableView.reloadData() + navigationController?.isToolbarHidden = false + } + + override func viewWillDisappear(_ animated: Bool){ + navigationController?.isToolbarHidden = true } override func viewDidLoad() { @@ -105,6 +110,8 @@ class ListViewController: UITableViewController { tableView.reloadData() } + + deinit { print("===============|| ListViewController deinitialized ||===============") } diff --git a/enzevalos_iphone/MailHandler.swift b/enzevalos_iphone/MailHandler.swift index 3c03e32dfeffee3a0f652b99ac6152f9e712f235..d900c05cf08d968cc93a4bad00771865eea86b0b 100644 --- a/enzevalos_iphone/MailHandler.swift +++ b/enzevalos_iphone/MailHandler.swift @@ -985,6 +985,7 @@ class MailHandler { completionCallback(MailServerConnectionError.NoData) return } + folder.lastUpdate = Date() if folder.mailsOfFolder.count > 0 { self.loadMailsByNum(folder: folder, completionCallback: completionCallback, multipleMails: false) } else { diff --git a/enzevalos_iphone/NewOnboardingView.swift b/enzevalos_iphone/NewOnboardingView.swift new file mode 100644 index 0000000000000000000000000000000000000000..9ff1dd9fc9372a9f685a3d0796ab9bc280ca61f1 --- /dev/null +++ b/enzevalos_iphone/NewOnboardingView.swift @@ -0,0 +1,38 @@ +// +// NewOnboardingView.swift +// enzevalos_iphone +// +// Created by melicoa97 on 02.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +struct NewOnboardingView: View { + @ObservedObject var press=loginManager() + var body: some View { + if press.loggedIn{ + return AnyView(VCSwiftUIView(vcID: "RootViewController")) + }else{ + return AnyView( + OnboardingIntro(onClick: press.login) + ) + } + } +} + +struct NewOnboardingView_Previews: PreviewProvider { + static var previews: some View { + NewOnboardingView() + } +} + +//this class checks whether we are logged in or nah +class loginManager: ObservableObject { + @Published var loggedIn=false + func login(){ + loggedIn=true + } + + @Published var show = false +} diff --git a/enzevalos_iphone/Onboarding.swift b/enzevalos_iphone/Onboarding.swift index 09ae1c25c2f2aca1a6e8341adc1c353cf2e7c942..328db8abda14d7fd452e1e5beceba166a8ecfdf8 100644 --- a/enzevalos_iphone/Onboarding.swift +++ b/enzevalos_iphone/Onboarding.swift @@ -20,13 +20,14 @@ import Foundation import Onboard +import SwiftUI class Onboarding: NSObject { override init() { super.init() } static var textDelegate = TextFieldDelegate.init() - static let defaultColor = UIColor.darkGray + static let defaultColor = UIColor.red static let textColor = UIColor.white static var mailaddress = UITextField.init() static var username = UITextField.init() @@ -76,7 +77,13 @@ class Onboarding: NSObject { private static var currentIMAP: MailSession? private static var currentSMTP: MailSession? + + static func onboarding(_ errorCode: MailServerConnectionError? = nil) -> UIViewController { + + + + password.isSecureTextEntry = true doWhenDone = checkIMAPConfig startTimeView = Date() diff --git a/enzevalos_iphone/OnboardingIntro.swift b/enzevalos_iphone/OnboardingIntro.swift new file mode 100644 index 0000000000000000000000000000000000000000..2aed162746a2e310877cd42b959dff5c942d8f98 --- /dev/null +++ b/enzevalos_iphone/OnboardingIntro.swift @@ -0,0 +1,43 @@ +// +// OnboardingIntro.swift +// enzevalos_iphone +// +// Created by melicoa97 on 03.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +//Main Onboarding +struct OnboardingIntro: View { + var onClick: ()->Void + + var body: some View { + VStack(alignment: .center){ + Spacer() + Text(NSLocalizedString("Onboarding.headline", comment: "Welcome")) + .font(.largeTitle) + .fontWeight(.heavy) + .foregroundColor(Color.black) + OnboardingIntroStack() + Spacer() + OnboardingLoginButton(onClick: onClick) + } + .edgesIgnoringSafeArea([/*.bottom,*/ .top]) + } +} + +struct OnboardingIntroStack:View{ + var body: some View { + Text(NSLocalizedString("Onboarding.moreInfoInstruction", comment: "Tap to get more Info")) + } +} + +struct OnboardingLoginButton: View{ + var onClick: ()->Void + var body: some View { + Button(action: onClick) { + Text(NSLocalizedString("Onboarding.loginButtonText", comment: "Login")) + } + } +} diff --git a/enzevalos_iphone/ReadViewController.swift b/enzevalos_iphone/ReadViewController.swift index 46052da96a6f2b089b1c9901ad7a2ef43207a45b..f023c11b3534cad3a2182521c4a8a64a37112ec1 100644 --- a/enzevalos_iphone/ReadViewController.swift +++ b/enzevalos_iphone/ReadViewController.swift @@ -62,7 +62,6 @@ class ReadViewController: UITableViewController { var infoState = LogData.WarningType.none - var deletedWhileTravel: Bool { guard let mail = mail else { return false @@ -148,6 +147,8 @@ class ReadViewController: UITableViewController { } deinit { + + self.navigationController?.navigationBar.tintColor = .none print("===============|| ReadViewController deinitialized ||===============") if Logger.logging, let mail = self.mail { @@ -165,6 +166,10 @@ class ReadViewController: UITableViewController { } } + override func viewWillDisappear(_ animated: Bool){ + navigationController?.isToolbarHidden = true + } + override func viewWillAppear(_ animated: Bool) { // NavigationBar color if let mail = mail { @@ -179,7 +184,7 @@ class ReadViewController: UITableViewController { self.navigationController?.navigationBar.barTintColor = ThemeManager.unencryptedMessageColor() } } - navigationController?.toolbar.isHidden = false + navigationController?.isToolbarHidden = false } override func willMove(toParent parent: UIViewController?) { diff --git a/enzevalos_iphone/SendViewController.swift b/enzevalos_iphone/SendViewController.swift index a867fd807ef4dd3ec5af49870043cf61032fbfca..db134dd0cacfeafe3a91ce2ef4e327d16178e2bd 100644 --- a/enzevalos_iphone/SendViewController.swift +++ b/enzevalos_iphone/SendViewController.swift @@ -121,6 +121,8 @@ class SendViewController: UIViewController { } var invitationSelection = InvitationSelection() + + var wasPushed = false override func viewDidLoad() { super.viewDidLoad() @@ -639,7 +641,7 @@ class SendViewController: UIViewController { } controller?.dismissAction = { [weak self] in - if self?.isFeedback ?? false{ + if self?.isFeedback ?? false || self?.wasPushed ?? false { self?.navigationController?.popViewController(animated: true) } else { self?.navigationController?.dismiss(animated: true, completion: nil) @@ -647,7 +649,7 @@ class SendViewController: UIViewController { } } else { - if isFeedback { + if isFeedback || wasPushed { self.navigationController?.popViewController(animated: true) } else { self.navigationController?.dismiss(animated: true, completion: nil) @@ -804,6 +806,9 @@ class SendViewController: UIViewController { } } if (textView.text.trimmed() == "" || textView.text.trimmed() == UserManager.loadUserSignature().trimmed()) && toText.mailTokens.count == 0 && ccText.mailTokens.count == 0 && subjectText.inputText()?.trimmed() == "" { + if wasPushed { + self.navigationController?.popViewController(animated: true) + } self.navigationController?.dismiss(animated: true, completion: nil) } else { let toEntrys = toText.mailTokens @@ -816,7 +821,7 @@ class SendViewController: UIViewController { if let delegate = self?.sendViewDelegate { delegate.compositionDiscarded() } - if self?.isFeedback ?? false { + if self?.isFeedback ?? false || self?.wasPushed ?? false { self?.navigationController?.popViewController(animated: true) } else { self?.navigationController?.dismiss(animated: true, completion: nil) @@ -830,7 +835,7 @@ class SendViewController: UIViewController { if let delegate = self?.sendViewDelegate { delegate.compositionSavedAsDraft() } - if self?.isFeedback ?? false { + if self?.isFeedback ?? false || self?.wasPushed ?? false { self?.navigationController?.popViewController(animated: true) } else { self?.navigationController?.dismiss(animated: true, completion: nil) diff --git a/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift b/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift new file mode 100644 index 0000000000000000000000000000000000000000..5920a378b76ed7ac118dbb44177994e94c63c28f --- /dev/null +++ b/enzevalos_iphone/SwiftUI/Inbox/Inbox.swift @@ -0,0 +1,143 @@ +// +// Inbox.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 01.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +struct Inbox: View { + @Environment(\.managedObjectContext) var managedObjectContext + @FetchRequest(fetchRequest: KeyRecord.allRecordsFetchRequest(in: Folder.inbox)) var keyrecords: FetchedResults<KeyRecord> + + @ObservedObject var folder = Folder.inbox + + @State var updating = false + @State var showUser = false + @State var searchText = "" + @State var searchField = 0 + @State var searchNow = false + + let coord: InboxCoordinator + + var body: some View { + VStack{ + SearchView(searchText: $searchText, searchField: $searchField, searchNow: $searchNow) + .padding(6) + // Mails + mailList + // Toolbar + HStack { + self.idButton + Spacer() + self.lastUpdate + Spacer() + self.composeButton + } + .padding(6) + } + .navigationBarTitle(NSLocalizedString("Inbox", comment: "Inbox")) + .navigationBarItems(leading: self.folderButton) + } + + private var mailList: some View { + List { + ForEach(self.keyrecords.filter(filterKeyRecord), id: \.self){ + record in + KeyRecordRow(keyrecord: record, coord: self.coord) + } + } + .resignKeyboardOnDragGesture() // hide keyboard when dragging + } + + private var folderButton: some View { + Button(action: self.coord.pushFoldersView, label: { + Text(NSLocalizedString("Folders", comment: "Folder")) + }) + } + + private var idButton: some View { + Button(action: { + self.coord.pushRecordView(record: self.userRecord) + }, label: { + Text(NSLocalizedString("KeyID", comment: "id")) + }) + } + + private var composeButton: some View { + Button(action: self.coord.pushComposeView, label: { + Image(systemName: "message").imageScale(.large) + }) + } + + private var lastUpdate: some View { + var text = NSLocalizedString("Updating", comment: "updating...") + if !updating { + if let last = Folder.inbox.lastUpdate { + let dateFormatter = DateFormatter() + dateFormatter.locale = Locale.current + dateFormatter.timeStyle = .medium + let dateString = dateFormatter.string(from: last) + text = NSLocalizedString("LastUpdate", comment: "") + " " + dateString + } + else { + text = NSLocalizedString("NeverUpdated", comment: "no upates...") + } + } + return Button(action: updateMails, label: {Text(text) + .font(.callout) + + }) + } + + var userRecord: KeyRecord { + get { + let keyID = UserManager.loadUserValue(Attribute.prefSecretKeyID) as? String + let addr = UserManager.loadUserValue(Attribute.userAddr) as! String + return DataHandler.handler.getKeyRecord(addr: addr, keyID: keyID) + } + } + + func updateMails() { + guard !updating else { + return + } + AppDelegate.getAppDelegate().mailHandler.updateFolder(folder: Folder.inbox, completionCallback: {_ in + self.updating = false + }) + updating = true + } + + func filterKeyRecord(keyRecord: KeyRecord) -> Bool { + let searchType = SearchType.findType(i: searchField) + if self.searchText.isEmpty || self.searchText == NSLocalizedString("Searchbar.Title", comment: "Search") { + return true + } + let query = self.searchText.lowercased() + if (searchType == .All || searchType == .Sender) && containsSearchTerms(content: keyRecord.name, searchText: query){ + return true + } + else if (searchType == .All || searchType == .Sender) && keyRecord.addresses.filter({containsSearchTerms(content: $0.mailAddress, searchText: query)}).count > 0 { + return true + } + else if (searchType == .All || searchType == .Subject) && keyRecord.mails.filter({containsSearchTerms(content: $0.subject, searchText: query)}).count > 0 { + return true + } + else if (searchType == .All || searchType == .Body) && keyRecord.mails.filter({containsSearchTerms(content: $0.body, searchText: query)}).count > 0 { + return true + } + return false + } +} + + + +/* +struct Inbox_Previews: PreviewProvider { + static var previews: some View { + Inbox() + } +} + */ diff --git a/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift b/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift new file mode 100644 index 0000000000000000000000000000000000000000..af075479c2b46e6c7926f5ad273bb616d076dd84 --- /dev/null +++ b/enzevalos_iphone/SwiftUI/Inbox/InboxCoordinator.swift @@ -0,0 +1,90 @@ +// +// InboxCoordinator.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 04.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import Foundation +import SwiftUI + +class InboxCoordinator { + let root: UINavigationController + + private let mainStoryboardName = "Main" + private let mainStoryboard: UIStoryboard + private var inbox: UIViewController? + + + init(root: UINavigationController) { + self.root = root + mainStoryboard = UIStoryboard(name: self.mainStoryboardName, bundle: nil) + } + + func pushInbox(){ + try? AppDelegate.getAppDelegate().mailHandler.startIMAPIdleIfSupported() + AppDelegate.getAppDelegate().mailHandler.updateFolder(folder: Folder.inbox, completionCallback: {_ in + }) + + root.isToolbarHidden = true + + if let vc = inbox { + if root.viewControllers.contains(vc) { + while root.topViewController != vc { + root.popViewController(animated: true) + } + } else { + root.pushViewController(vc, animated: true) + } + } + else { + let context = DataHandler.handler.managedObjectContext + let vc = UIHostingController(rootView: Inbox(coord: self).environment(\.managedObjectContext,context)) + inbox = vc + root.pushViewController(vc, animated: true) + } + } + + func pushFoldersView() { + let controller = mainStoryboard.instantiateViewController(withIdentifier: ViewID.FoldersView.rawValue) + root.isToolbarHidden = false + root.pushViewController(controller, animated: true) + } + + func pushReadView(mail: PersistentMail) { + let vc = mainStoryboard.instantiateViewController(withIdentifier: ViewID.ReadView.rawValue) + if let vc = vc as? ReadViewController { + vc.mail = mail + } + root.isToolbarHidden = false + root.pushViewController(vc, animated: true) + } + + func pushRecordView(record: KeyRecord){ + let vc = mainStoryboard.instantiateViewController(withIdentifier: ViewID.KeyRecordView.rawValue) + if let vc = vc as? ContactViewController { + vc.keyRecord = record + } + root.isToolbarHidden = false + root.pushViewController(vc, animated: true) + } + + func pushComposeView() { + let vc = mainStoryboard.instantiateViewController(identifier: ViewID.ComposeView.rawValue) + if let vc = vc as? SendViewController { + vc.wasPushed = true + } + root.isToolbarHidden = false + root.pushViewController(vc, animated: true) + } + + func pushMailListView(record: KeyRecord) { + let vc = mainStoryboard.instantiateViewController(identifier: ViewID.MailListView.rawValue) + if let vc = vc as? ListViewController { + vc.contact = record + } + root.isToolbarHidden = false + root.pushViewController(vc, animated: true) + } +} diff --git a/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift b/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift new file mode 100644 index 0000000000000000000000000000000000000000..e8bc192f461adb52329a9eb7ff5b17881abe97ae --- /dev/null +++ b/enzevalos_iphone/SwiftUI/Inbox/KeyRecordRow.swift @@ -0,0 +1,104 @@ +// +// KeyRecordRow.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 02.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +struct KeyRecordRow: View { + @ObservedObject var keyrecord: KeyRecord + let coord: InboxCoordinator + + var body: some View { + VStack { + HStack(alignment: .lastTextBaseline) { + icon + Spacer() + mailListView() + .offset(y: -10) + } + HStack { + name + Spacer() + moreMails + } + } + } + + /* + Displays the first (and second) mail + */ + private func mailListView() -> AnyView { + let spacing = CGFloat(10) + let offset = -(spacing / 2) + + if let first = self.keyrecord.firstMail { + if let second = self.keyrecord.secondMail { + return AnyView(VStack(alignment: .leading, spacing: spacing) { + MailView(mail: first, coord: coord) + MailView(mail: second, coord: coord) + .background(Stroke(offsetY: offset)) + }) + } else { + return AnyView(VStack(alignment: .leading,spacing: spacing) { + MailView(mail: first, coord: coord) + Text(NSLocalizedString("NoFurtherMessages", comment: "No more Mails")) + .background(Stroke(offsetY: offset)) + }) + } + } else { + return AnyView(Text("NO MAILS...")) + } + } + + private var icon: some View{ + self.keyrecord.image.img + .resizable() + .frame(width: 60, height: 60) + .shadow(radius: 5) + .onTapGesture { + self.coord.pushRecordView(record: self.keyrecord) + } + } + + private var name: some View { + Text(self.keyrecord.myNick) + .frame(maxWidth: 300, alignment: .leading) + .lineLimit(1) + .onTapGesture { + self.coord.pushRecordView(record: self.keyrecord) + } + } + + private var moreMails: some View { + Button(action: { + self.coord.pushMailListView(record: self.keyrecord) + }, label: { + Text(NSLocalizedString("MailView.MoreMails", comment: "More mails")) + .foregroundColor(.gray) + }) + } +} + + +extension KeyRecord { + public var firstMail: PersistentMail? { + get { + return mails.first + } + } + + public var secondMail: PersistentMail? { + get { + if mails.count > 1 { + return mails[1] + } + return nil + } + } +} + + diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/CiricleImage.swift b/enzevalos_iphone/SwiftUI/SupportingViews/CiricleImage.swift new file mode 100644 index 0000000000000000000000000000000000000000..13e567f0a9ead8ea1c62e53333de2d25487d732b --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/CiricleImage.swift @@ -0,0 +1,20 @@ +// +// CiricleImage.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 02.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +struct CircleImage: View { + var image: Image + + var body: some View { + image + .clipShape(Circle()) + .overlay(Circle().stroke(Color.white, lineWidth: 4)) + .shadow(radius: 10) + } +} diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/Geometry/Stroke.swift b/enzevalos_iphone/SwiftUI/SupportingViews/Geometry/Stroke.swift new file mode 100644 index 0000000000000000000000000000000000000000..b71e6001ed49c08d98a4e5dd73ba7809469ef743 --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/Geometry/Stroke.swift @@ -0,0 +1,36 @@ +// +// Stroke.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 03.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +/** + Creates a gray stroke + */ +struct Stroke: View{ + var color = Color.secondary + var lineWidth = CGFloat(0.2) + var offsetY = CGFloat(0) + + var body: some View { + GeometryReader { geometry in + Path { path in + path.move(to: .zero) + path.addLine(to: CGPoint(x: geometry.size.width, y: 0)) + } + .strokedPath(StrokeStyle(lineWidth: self.lineWidth)) + .foregroundColor(self.color) + .offset(y: self.offsetY) + } + } +} + +struct Stroke_Previews: PreviewProvider { + static var previews: some View { + Stroke() + } +} diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/MailView.swift b/enzevalos_iphone/SwiftUI/SupportingViews/MailView.swift new file mode 100644 index 0000000000000000000000000000000000000000..2aa2587e4d9fed533c2374f1f4c3a2e5c0e9679e --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/MailView.swift @@ -0,0 +1,49 @@ +// +// MailView.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 02.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + + + +struct MailView: View { + var mail: PersistentMail + let coord: InboxCoordinator // We need this to move to the mail. + + init(mail: PersistentMail, coord: InboxCoordinator) { + self.mail = mail + self.coord = coord + + } + + var body: some View { + Group{ + HStack { + subject + .frame(minWidth: 10, maxWidth: 200, alignment: .leading) + .lineLimit(1) + Spacer() + Text(mail.timeString) + .font(.footnote) + } + } + .onTapGesture { + self.coord.pushReadView(mail: self.mail) + } + } + + var subject: some View { + var text = Text(mail.getSubjectWithFlagsString() ) + if !mail.isRead { + text = text.bold() + } + return text + } + +} + + diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift b/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift new file mode 100644 index 0000000000000000000000000000000000000000..f721cfc3cbe58a5fda3d58e9fa71a5ab53eafd6f --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/SearchView.swift @@ -0,0 +1,136 @@ +// +// SearchView.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 05.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI +import Combine + +/** + Where are we looking for? Used in the search footer. + */ +enum SearchType: CaseIterable { + case Sender, Subject, Body, All + var text: String { + get{ + switch self { + case .Sender: + return NSLocalizedString("Sender", comment: "") + case .Subject: + return NSLocalizedString("Subject", comment: "") + case .Body: + return NSLocalizedString("Body", comment: "") + case .All: + return NSLocalizedString("All", comment: "") + } + } + } + + static func findType(i: Int) -> SearchType{ + if i < SearchType.allCases.count { + return SearchType.allCases[i] + } else { + return SearchType.All + } + } +} +/** + A SearchView for mails with a search segmented Picker to choose the search area. + Open Problems: Deplay the search, s.t. we do not start a search after each input. + + */ +struct SearchView: View { + + @Binding var searchText: String + @Binding var searchField: Int + @Binding var searchNow: Bool + + @State private var showCancelButton: Bool = false + + var body: some View { + VStack{ + HStack { + searchFieldView + if showCancelButton { + Button("Cancel") { + UIApplication.shared.endEditing(true) + self.searchText = "" + self.showCancelButton = false + self.searchNow = false + } + .foregroundColor(Color(.systemBlue)) + } + } + if showCancelButton { + searchSegment + } + } + .padding(.horizontal) + .navigationBarHidden(showCancelButton) + } + + var searchFieldView: some View { + HStack { + Image(systemName: "magnifyingglass") + TextField(NSLocalizedString("Searchbar.Title", comment: "Search"), text: $searchText, onEditingChanged: { isEditing in + self.showCancelButton = true + }, onCommit: { + self.searchNow = true + }) + .foregroundColor(.primary) + Button(action: { + self.searchText = "" + }) { + Image(systemName: "xmark.circle.fill").opacity(searchText == "" ? 0 : 1) + } + } + .padding(EdgeInsets(top: 8, leading: 6, bottom: 8, trailing: 6)) + .foregroundColor(.secondary) + .background(Color(.secondarySystemBackground)) + .cornerRadius(10.0) + } + + var searchSegment: some View { + Picker(selection: $searchField, label: EmptyView()) { + ForEach(0..<SearchType.allCases.count) { index in + Text(SearchType.allCases[index].text).tag(index) + .onTapGesture { + self.searchField = index + print(self.searchField) + } + } + } + .pickerStyle(SegmentedPickerStyle()) + } +} + +/** + Helper about remove the keyboard when scrolling + */ + +extension UIApplication { + func endEditing(_ force: Bool) { + self.windows + .filter{$0.isKeyWindow} + .first? + .endEditing(force) + } +} + +struct ResignKeyboardOnDragGesture: ViewModifier { + var gesture = DragGesture().onChanged{_ in + UIApplication.shared.endEditing(true) + } + func body(content: Content) -> some View { + content.gesture(gesture) + } +} + +extension View { + func resignKeyboardOnDragGesture() -> some View { + return modifier(ResignKeyboardOnDragGesture()) + } +} diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/SearchBar.swift b/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/SearchBar.swift new file mode 100644 index 0000000000000000000000000000000000000000..97a3ed7daa4515cd4c0386fc172fd755e4a4d29c --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/SearchBar.swift @@ -0,0 +1,59 @@ +// +// SearchBar.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 05.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +struct SearchBar: UIViewRepresentable { + + @Binding var text: String + + class Coordinator: NSObject, UISearchBarDelegate { + + @Binding var text: String + + init(text: Binding<String>) { + _text = text + } + + func searchBar(_ searchBar: UISearchBar, textDidChange searchText: String) { + text = searchText + searchBar.delegate = self + } + + func searchBarCancelButtonClicked(_ searchBar: UISearchBar) { + // Stop doing the search stuff + // and clear the text in the search bar + searchBar.text = "" + // Hide the cancel button + searchBar.showsCancelButton = false + // You could also change the position, frame etc of the searchBar + searchBar.isHidden = true + } + + } + func makeCoordinator() -> SearchBar.Coordinator { + return Coordinator(text: $text) + } + + func makeUIView(context: UIViewRepresentableContext<SearchBar>) -> UISearchBar { + let searchBar = UISearchBar(frame: .zero) + searchBar.delegate = context.coordinator + searchBar.autocapitalizationType = .none + searchBar.showsScopeBar = true + searchBar.scopeButtonTitles = [NSLocalizedString("Sender", comment: ""), NSLocalizedString("Subject", comment: ""), NSLocalizedString("Body", comment: ""), NSLocalizedString("All", comment: "")] + searchBar.showsCancelButton = true + return searchBar + } + + func updateUIView(_ uiView: UISearchBar, context: UIViewRepresentableContext<SearchBar>) { + uiView.text = text + } + + +} + diff --git a/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/VCSwiftUIView.swift b/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/VCSwiftUIView.swift new file mode 100644 index 0000000000000000000000000000000000000000..2b562cdfafc9accd9a404114e8782148c5dee4e3 --- /dev/null +++ b/enzevalos_iphone/SwiftUI/SupportingViews/SwiftUI to UIKit/VCSwiftUIView.swift @@ -0,0 +1,41 @@ +// +// VCSwiftUIView.swift +// enzevalos_iphone +// +// Created by Oliver Wiese on 03.03.20. +// Copyright © 2020 fu-berlin. All rights reserved. +// + +import SwiftUI + +enum ViewID: String{ + case KeyRecordView = "UITableViewController-8Di-x2-cWQ" + case ReadView = "UITableViewController-Ouw-WD-EV6" + case FoldersView = "folderViewController" + case ComposeView = "SendViewController" + case MailListView = "UITableViewController-ooe-0X-glz" +} + +/** + Generate a SwiftUIView for a UIViewController in the main story board + */ +struct VCSwiftUIView: UIViewControllerRepresentable { + var storyboard: String = "Main" + var vcID: String + + func makeUIViewController(context: UIViewControllerRepresentableContext<VCSwiftUIView>) -> UIViewController { + //Load the storyboard + let loadedStoryboard = UIStoryboard(name: storyboard, bundle: nil) + //Load the ViewController + let myVc = loadedStoryboard.instantiateViewController(withIdentifier: vcID) + return myVc + + } + + func updateUIViewController(_ uiViewController: UIViewController, context: UIViewControllerRepresentableContext<VCSwiftUIView>) { + } +} + + + + diff --git a/enzevalos_iphone/de.lproj/Localizable.strings b/enzevalos_iphone/de.lproj/Localizable.strings index 0eda774b5f7aebf7e635d1d413ad15984b2b4c5c..a24c0fc65f1ed8f016d11fbf7c4771a4c86a33d8 100644 --- a/enzevalos_iphone/de.lproj/Localizable.strings +++ b/enzevalos_iphone/de.lproj/Localizable.strings @@ -352,3 +352,5 @@ "Feedback.Mail.Subject" = "[Letterbox] Feedback über %@"; "Feedback.Mail.Body" = "Hallo, hier ist mein Feedback zur Ansicht der %@. \n\n1) Wie verständlich ist die Ansicht?\n\nAntwortmöglichkeiten (Bitte ankreuzen/löschen):\nSehr unverständlich: \nUnverständlich:\nNeutral:\nVerständlich:\nSehr verständlich:\n\n2)Wie verständlich sind die Texte?\n\nAntwortmöglichkeiten\nSehr unverständlich: \nUnverständlich:\nNeutral:\nVerständlich:\nSehr verständlich:\n\n3)Was würdest du ändern und warum? \nEin Freitextfeld über konkrete Textverbesserungen bis unkonkrete Ideen:\n\n\n\n\n4)Was magst du und warum?\nEin Freitextfeld:\n\n\n"; "Feedback.Name" = "Feedback"; +"MailView.MoreMails" = "Mehr Mails sehen"; +"Searchbar.Title" = "Suchen"; diff --git a/enzevalos_iphone/en.lproj/Localizable.strings b/enzevalos_iphone/en.lproj/Localizable.strings index e31af588a2daa284b2e3f808ed88292362df2183..d497851a44be628c7fa26c92c15c8e9af8a7cc33 100644 --- a/enzevalos_iphone/en.lproj/Localizable.strings +++ b/enzevalos_iphone/en.lproj/Localizable.strings @@ -65,6 +65,11 @@ "KeyIsVerified" = "The Key is verified. It was verified on "; "KeyNotFound" = "No Key Found. This is an error, contact the developers!"; "Letter" = "Confidential and genuine mail"; + +"Onboarding.headline"="Welcome"; +"Onboarding.loginButtonText"="Login"; +"Onboarding.moreInfoInstruction"="Tap to get more info!"; + "Onboarding.ConfMail.Description" = "Who knows the content? \nOnly you and the sender. \n\nWhat confidence do we have about the sender? \nThe sender has an ID and we have a genuine record about previous mails of the sender."; "Onboarding.InsecureMail.Description" = "Who can read the mail?\n\nYou, the sender and all involved mail providers.\n\nWhat confidence do we have about the sender?\n\nTechnically, the sender address can be freely choosen and gives no strong confidence about the sender. A fraud can impersonate a person and fake the sender address."; "LetterDamaged" = "Manipulated mail"; @@ -322,3 +327,5 @@ "Feedback.Mail.Subject" = "[Letterbox] Feedback about %@"; "Feedback.Mail.Body" = "Hi, my feedback about the %@ view. \n\n1) How understandable is the view?\n\Options (Please, delete/mark):\nVery unclear: \nUnclear:\nNeutral:\nclear:\nVery clear:\n\n2)How understandable is the text?\n\Options:\nVery unclear: \nUnclear:\nNeutral:\nclear:\nVery clear:\n\n3)What you like to change and why? \nA free text answer from concrete text improvements to unclear ideas:\n\n\n\n\n4)What does you like and why? \nA free text answer:\n\n\n"; "Feedback.Name" = "Feedback"; +"MailView.MoreMails" = "See more mails"; +"Searchbar.Title" = "Search";