From e1f7971ee729a63dd4e28f8858a7be6005bb57d2 Mon Sep 17 00:00:00 2001 From: Woit Date: Wed, 20 Nov 2024 14:31:51 +0100 Subject: [PATCH] wip --- Monal/Monal.xcodeproj/project.pbxproj | 41 +++++---- Monal/another.im/AnotherIMApp.swift | 7 +- .../Helpers/PHImageManager+Fetch.swift | 86 +++++++++---------- .../Views/{ => Enter}/LoginScreen.swift | 0 .../{ => Enter}/RegistrationScreen.swift | 0 .../Views/{ => Enter}/WelcomeScreen.swift | 0 Monal/another.im/Views/RootView.swift | 21 ++--- Monal/another.im/XMPP/AppError.swift | 12 --- 8 files changed, 74 insertions(+), 93 deletions(-) rename Monal/another.im/Views/{ => Enter}/LoginScreen.swift (100%) rename Monal/another.im/Views/{ => Enter}/RegistrationScreen.swift (100%) rename Monal/another.im/Views/{ => Enter}/WelcomeScreen.swift (100%) delete mode 100644 Monal/another.im/XMPP/AppError.swift diff --git a/Monal/Monal.xcodeproj/project.pbxproj b/Monal/Monal.xcodeproj/project.pbxproj index ccccdc3..8ae935e 100644 --- a/Monal/Monal.xcodeproj/project.pbxproj +++ b/Monal/Monal.xcodeproj/project.pbxproj @@ -8,6 +8,7 @@ /* Begin PBXBuildFile section */ 08CAF17FA202CF3CB760D93C /* Pods_NotificationService.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B7A5555D807EE78C95217FD /* Pods_NotificationService.framework */; }; + 1C8760F8FB99C27D0C3A6ED1 /* RegistrationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 82D4382FFF3D97C4E1D7727C /* RegistrationScreen.swift */; }; 1D3623260D0F684500981E51 /* MonalAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* MonalAppDelegate.m */; }; 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; 20D3611C2C10E12500E46587 /* BoardingCards.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20D3611B2C10E12500E46587 /* BoardingCards.swift */; }; @@ -78,6 +79,7 @@ 26E8462824EABAED00ECE419 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 26E8462A24EABAED00ECE419 /* Main.storyboard */; }; 26F9794D1ACAC73A0008E005 /* MLContactCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 26F9794C1ACAC73A0008E005 /* MLContactCell.xib */; }; 26FE3BCB1C61A6C3003CC230 /* MLResizingTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 26FE3BCA1C61A6C3003CC230 /* MLResizingTextView.m */; }; + 335B19D1B8E6A4D5FE71380C /* WelcomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = CCF3CF336EBAA5802383370F /* WelcomeScreen.swift */; }; 34BC08122C5E9BE30099FB85 /* ContentUnavailableShimView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34BC08112C5E9BE30099FB85 /* ContentUnavailableShimView.swift */; }; 34E58B4B2C68E7BC009A1634 /* ContactsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34E58B4A2C68E7BC009A1634 /* ContactsView.swift */; }; 38720923251EDE07001837EB /* MLXEPSlashMeHandler.m in Sources */ = {isa = PBXBuildFile; fileRef = 38720921251EDE07001837EB /* MLXEPSlashMeHandler.m */; }; @@ -136,9 +138,6 @@ 7E71758E2CECC5C70059F30B /* server_features.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7E71758A2CECC5C70059F30B /* server_features.plist */; }; 7E71758F2CECC5C70059F30B /* launchscreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 7E7175892CECC5C70059F30B /* launchscreen.storyboard */; }; 7E8D7AE32CECD011009AD3DF /* SwiftfulRouting in Frameworks */ = {isa = PBXBuildFile; productRef = 7E8D7AE22CECD011009AD3DF /* SwiftfulRouting */; }; - 7E8D7AEB2CECE9A8009AD3DF /* LoginScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AE82CECE9A8009AD3DF /* LoginScreen.swift */; }; - 7E8D7AEC2CECE9A8009AD3DF /* RegistrationScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AE92CECE9A8009AD3DF /* RegistrationScreen.swift */; }; - 7E8D7AED2CECE9A8009AD3DF /* WelcomeScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AEA2CECE9A8009AD3DF /* WelcomeScreen.swift */; }; 7E8D7AF12CECEB30009AD3DF /* Images+Generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AEF2CECEB30009AD3DF /* Images+Generated.swift */; }; 7E8D7AF22CECEB30009AD3DF /* Strings+Generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AF02CECEB30009AD3DF /* Strings+Generated.swift */; }; 7E8D7AF32CECEB30009AD3DF /* Colors+Generated.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7AEE2CECEB30009AD3DF /* Colors+Generated.swift */; }; @@ -167,7 +166,6 @@ 7E8D7B272CECEE79009AD3DF /* UIImage+Crop.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7B0D2CECEE79009AD3DF /* UIImage+Crop.swift */; }; 7E8D7B282CECEE79009AD3DF /* String+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7B092CECEE79009AD3DF /* String+Extensions.swift */; }; 7E8D7B292CECEE79009AD3DF /* View+OnLoad.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7B132CECEE79009AD3DF /* View+OnLoad.swift */; }; - 7E8D7B2B2CECEEDF009AD3DF /* AppError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E8D7B2A2CECEEDF009AD3DF /* AppError.swift */; }; 7E995F242CEAC5D2005B30EE /* AnotherIMApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E995F202CEAC5D2005B30EE /* AnotherIMApp.swift */; }; 7E995F252CEAC5D2005B30EE /* RootView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7E995F222CEAC5D2005B30EE /* RootView.swift */; }; 7E995F2B2CEAC9A0005B30EE /* monalxmpp.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26CC579223A0867400ABB92A /* monalxmpp.framework */; }; @@ -231,6 +229,7 @@ C114D13D2B15B903000FB99F /* ContactEntry.swift in Sources */ = {isa = PBXBuildFile; fileRef = C114D13C2B15B903000FB99F /* ContactEntry.swift */; }; C117F7E12B086390001F2BC6 /* CreateGroupMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D88BB76295BB6DC00FB30BA /* CreateGroupMenu.swift */; }; C117F7E22B0863B3001F2BC6 /* ContactPicker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D631822294BAB1D00026BE7 /* ContactPicker.swift */; }; + C11E557980B75AA90738EC9C /* LoginScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2D8673A73C41D0B1697FE97D /* LoginScreen.swift */; }; C12436142434AB5D00B8F074 /* MLAttributedLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = C12436132434AB5D00B8F074 /* MLAttributedLabel.m */; }; C1414E9D24312F0100948788 /* MLChatMapsCell.m in Sources */ = {isa = PBXBuildFile; fileRef = C1414E9C24312F0100948788 /* MLChatMapsCell.m */; }; C15489B925680BBE00BBA2F0 /* MLQRCodeScanner.swift in Sources */ = {isa = PBXBuildFile; fileRef = C15489B825680BBE00BBA2F0 /* MLQRCodeScanner.swift */; }; @@ -560,6 +559,7 @@ 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 2B7A5555D807EE78C95217FD /* Pods_NotificationService.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_NotificationService.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 2C59BAF969550DFAC27E5F2B /* Pods_MonalXMPPUnitTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_MonalXMPPUnitTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2D8673A73C41D0B1697FE97D /* LoginScreen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = ""; }; 2E5021A8D40FCC591D952104 /* Pods-NotificaionService.alpha-ios.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificaionService.alpha-ios.xcconfig"; path = "Target Support Files/Pods-NotificaionService/Pods-NotificaionService.alpha-ios.xcconfig"; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* MonalSourceCodePrefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MonalSourceCodePrefix.pch; sourceTree = ""; }; 34BC08112C5E9BE30099FB85 /* ContentUnavailableShimView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContentUnavailableShimView.swift; sourceTree = ""; }; @@ -638,9 +638,6 @@ 7E7175892CECC5C70059F30B /* launchscreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = launchscreen.storyboard; sourceTree = ""; }; 7E71758A2CECC5C70059F30B /* server_features.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = server_features.plist; sourceTree = ""; }; 7E71758B2CECC5C70059F30B /* Localizable.strings */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; path = Localizable.strings; sourceTree = ""; }; - 7E8D7AE82CECE9A8009AD3DF /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = ""; }; - 7E8D7AE92CECE9A8009AD3DF /* RegistrationScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegistrationScreen.swift; sourceTree = ""; }; - 7E8D7AEA2CECE9A8009AD3DF /* WelcomeScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeScreen.swift; sourceTree = ""; }; 7E8D7AEE2CECEB30009AD3DF /* Colors+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Colors+Generated.swift"; sourceTree = ""; }; 7E8D7AEF2CECEB30009AD3DF /* Images+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Images+Generated.swift"; sourceTree = ""; }; 7E8D7AF02CECEB30009AD3DF /* Strings+Generated.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Strings+Generated.swift"; sourceTree = ""; }; @@ -669,7 +666,6 @@ 7E8D7B122CECEE79009AD3DF /* View+If.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+If.swift"; sourceTree = ""; }; 7E8D7B132CECEE79009AD3DF /* View+OnLoad.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+OnLoad.swift"; sourceTree = ""; }; 7E8D7B142CECEE79009AD3DF /* View+TappableArea.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "View+TappableArea.swift"; sourceTree = ""; }; - 7E8D7B2A2CECEEDF009AD3DF /* AppError.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppError.swift; sourceTree = ""; }; 7E995F062CEAC4B8005B30EE /* another.im.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = another.im.app; sourceTree = BUILT_PRODUCTS_DIR; }; 7E995F202CEAC5D2005B30EE /* AnotherIMApp.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AnotherIMApp.swift; sourceTree = ""; }; 7E995F222CEAC5D2005B30EE /* RootView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootView.swift; sourceTree = ""; }; @@ -677,6 +673,7 @@ 7ED6F0162CECC3AB0035B3B7 /* Colors.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Colors.xcassets; sourceTree = ""; }; 7ED6F0182CECC3BF0035B3B7 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; 7FA9582E4CC566FE5466C557 /* Pods-Monal.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Monal.debug.xcconfig"; path = "Target Support Files/Pods-Monal/Pods-Monal.debug.xcconfig"; sourceTree = ""; }; + 82D4382FFF3D97C4E1D7727C /* RegistrationScreen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = RegistrationScreen.swift; sourceTree = ""; }; 840E23C828ADA56900A7FAC9 /* MLUploadQueueCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MLUploadQueueCell.m; sourceTree = ""; }; 840E23C928ADA56900A7FAC9 /* MLUploadQueueCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MLUploadQueueCell.h; sourceTree = ""; }; 8414ADFA2A7ABAC900EFFCCC /* LibMonalRustSwiftBridge */ = {isa = PBXFileReference; lastKnownFileType = wrapper; name = LibMonalRustSwiftBridge; path = ../rust/LibMonalRustSwiftBridge; sourceTree = ""; }; @@ -867,6 +864,7 @@ C1F5C7A72775DA000001F295 /* MLContactSoftwareVersionInfo.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MLContactSoftwareVersionInfo.h; sourceTree = ""; }; C1F5C7A82775DA000001F295 /* MLContactSoftwareVersionInfo.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MLContactSoftwareVersionInfo.m; sourceTree = ""; }; C1F5C7AB2777621B0001F295 /* ContactResources.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContactResources.swift; sourceTree = ""; }; + CCF3CF336EBAA5802383370F /* WelcomeScreen.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = WelcomeScreen.swift; sourceTree = ""; }; D02192F22C89BB3800202A59 /* BlockedUsers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlockedUsers.swift; sourceTree = ""; }; D0FA79B02C7E5C7400216D2A /* ServerDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ServerDetails.swift; sourceTree = ""; }; D310A8387B2EB10761312F77 /* Pods-NotificaionService.appstore.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-NotificaionService.appstore.xcconfig"; path = "Target Support Files/Pods-NotificaionService/Pods-NotificaionService.appstore.xcconfig"; sourceTree = ""; }; @@ -1403,7 +1401,7 @@ name = tools; sourceTree = ""; }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + 29B97314FDCFA39411CA2CEA = { isa = PBXGroup; children = ( 8414ADF92A7ABAC900EFFCCC /* Packages */, @@ -1450,6 +1448,17 @@ name = Resources; sourceTree = ""; }; + 54D8CBD8978DA29C88226FBB /* Enter */ = { + isa = PBXGroup; + children = ( + CCF3CF336EBAA5802383370F /* WelcomeScreen.swift */, + 2D8673A73C41D0B1697FE97D /* LoginScreen.swift */, + 82D4382FFF3D97C4E1D7727C /* RegistrationScreen.swift */, + ); + name = Enter; + path = Enter; + sourceTree = ""; + }; 7E71758C2CECC5C70059F30B /* Strings */ = { isa = PBXGroup; children = ( @@ -1461,11 +1470,9 @@ 7E8D7AE42CECD037009AD3DF /* Views */ = { isa = PBXGroup; children = ( - 7E8D7AE82CECE9A8009AD3DF /* LoginScreen.swift */, - 7E8D7AE92CECE9A8009AD3DF /* RegistrationScreen.swift */, 7E995F222CEAC5D2005B30EE /* RootView.swift */, - 7E8D7AEA2CECE9A8009AD3DF /* WelcomeScreen.swift */, 7E8D7AF92CECEDB3009AD3DF /* SharedComponents */, + 54D8CBD8978DA29C88226FBB /* Enter */, ); path = Views; sourceTree = ""; @@ -1474,7 +1481,6 @@ isa = PBXGroup; children = ( 7E6AF38E2CEB9110004328B5 /* MonalXmppWrapper.swift */, - 7E8D7B2A2CECEEDF009AD3DF /* AppError.swift */, ); path = XMPP; sourceTree = ""; @@ -2028,7 +2034,7 @@ eu, "es-AR", ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + mainGroup = 29B97314FDCFA39411CA2CEA; packageReferences = ( C1F5C7AD2777638B0001F295 /* XCRemoteSwiftPackageReference "swift-collections" */, 841898A82957712000FEC77D /* XCRemoteSwiftPackageReference "ViewExtractor" */, @@ -2586,7 +2592,6 @@ buildActionMask = 2147483647; files = ( 7E995F242CEAC5D2005B30EE /* AnotherIMApp.swift in Sources */, - 7E8D7AEB2CECE9A8009AD3DF /* LoginScreen.swift in Sources */, 7E8D7AF12CECEB30009AD3DF /* Images+Generated.swift in Sources */, 7E8D7AF22CECEB30009AD3DF /* Strings+Generated.swift in Sources */, 7E8D7AF32CECEB30009AD3DF /* Colors+Generated.swift in Sources */, @@ -2610,16 +2615,16 @@ 7E8D7B272CECEE79009AD3DF /* UIImage+Crop.swift in Sources */, 7E8D7B282CECEE79009AD3DF /* String+Extensions.swift in Sources */, 7E8D7B292CECEE79009AD3DF /* View+OnLoad.swift in Sources */, - 7E8D7AEC2CECE9A8009AD3DF /* RegistrationScreen.swift in Sources */, 7E8D7AFA2CECEDB3009AD3DF /* SharedListRow.swift in Sources */, - 7E8D7B2B2CECEEDF009AD3DF /* AppError.swift in Sources */, 7E8D7AFB2CECEDB3009AD3DF /* SharedSectionTitle.swift in Sources */, 7E8D7AFC2CECEDB3009AD3DF /* SharedNavigationBar.swift in Sources */, 7E8D7AFD2CECEDB3009AD3DF /* UniversalInputCollection.swift in Sources */, 7E8D7AFE2CECEDB3009AD3DF /* LoadingScreen.swift in Sources */, - 7E8D7AED2CECE9A8009AD3DF /* WelcomeScreen.swift in Sources */, 7E995F252CEAC5D2005B30EE /* RootView.swift in Sources */, 7E6AF38F2CEB9110004328B5 /* MonalXmppWrapper.swift in Sources */, + 335B19D1B8E6A4D5FE71380C /* WelcomeScreen.swift in Sources */, + C11E557980B75AA90738EC9C /* LoginScreen.swift in Sources */, + 1C8760F8FB99C27D0C3A6ED1 /* RegistrationScreen.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/Monal/another.im/AnotherIMApp.swift b/Monal/another.im/AnotherIMApp.swift index 4568126..12ddadd 100644 --- a/Monal/another.im/AnotherIMApp.swift +++ b/Monal/another.im/AnotherIMApp.swift @@ -1,4 +1,3 @@ -import SwiftfulRouting import SwiftUI @main @@ -7,10 +6,8 @@ struct AnotherIMApp: App { var body: some Scene { WindowGroup { - RouterView { _ in - RootView() - } - .environmentObject(wrapper) + RootView() + .environmentObject(wrapper) } } } diff --git a/Monal/another.im/Helpers/PHImageManager+Fetch.swift b/Monal/another.im/Helpers/PHImageManager+Fetch.swift index 5bec4a8..3446d34 100644 --- a/Monal/another.im/Helpers/PHImageManager+Fetch.swift +++ b/Monal/another.im/Helpers/PHImageManager+Fetch.swift @@ -1,43 +1,43 @@ -import Photos -import UIKit - -extension PHImageManager { - func getPhoto(for asset: PHAsset) async throws -> UIImage { - let options = PHImageRequestOptions() - options.version = .original - options.isSynchronous = true - return try await withCheckedThrowingContinuation { continuation in - requestImage( - for: asset, - targetSize: PHImageManagerMaximumSize, - contentMode: .aspectFill, - options: options - ) { image, _ in - if let image { - continuation.resume(returning: image) - } else { - continuation.resume(throwing: AppError.imageNotFound) - } - } - } - } - - func getVideo(for asset: PHAsset) async throws -> AVAsset { - let options = PHVideoRequestOptions() - options.version = .original - options.deliveryMode = .highQualityFormat - options.isNetworkAccessAllowed = true - return try await withCheckedThrowingContinuation { continuation in - requestAVAsset( - forVideo: asset, - options: options - ) { avAsset, _, _ in - if let avAsset { - continuation.resume(returning: avAsset) - } else { - continuation.resume(throwing: AppError.videoNotFound) - } - } - } - } -} +// import Photos +// import UIKit +// +// extension PHImageManager { +// func getPhoto(for asset: PHAsset) async throws -> UIImage { +// let options = PHImageRequestOptions() +// options.version = .original +// options.isSynchronous = true +// return try await withCheckedThrowingContinuation { continuation in +// requestImage( +// for: asset, +// targetSize: PHImageManagerMaximumSize, +// contentMode: .aspectFill, +// options: options +// ) { image, _ in +// if let image { +// continuation.resume(returning: image) +// } else { +// continuation.resume(throwing: AppError.imageNotFound) +// } +// } +// } +// } +// +// func getVideo(for asset: PHAsset) async throws -> AVAsset { +// let options = PHVideoRequestOptions() +// options.version = .original +// options.deliveryMode = .highQualityFormat +// options.isNetworkAccessAllowed = true +// return try await withCheckedThrowingContinuation { continuation in +// requestAVAsset( +// forVideo: asset, +// options: options +// ) { avAsset, _, _ in +// if let avAsset { +// continuation.resume(returning: avAsset) +// } else { +// continuation.resume(throwing: AppError.videoNotFound) +// } +// } +// } +// } +// } diff --git a/Monal/another.im/Views/LoginScreen.swift b/Monal/another.im/Views/Enter/LoginScreen.swift similarity index 100% rename from Monal/another.im/Views/LoginScreen.swift rename to Monal/another.im/Views/Enter/LoginScreen.swift diff --git a/Monal/another.im/Views/RegistrationScreen.swift b/Monal/another.im/Views/Enter/RegistrationScreen.swift similarity index 100% rename from Monal/another.im/Views/RegistrationScreen.swift rename to Monal/another.im/Views/Enter/RegistrationScreen.swift diff --git a/Monal/another.im/Views/WelcomeScreen.swift b/Monal/another.im/Views/Enter/WelcomeScreen.swift similarity index 100% rename from Monal/another.im/Views/WelcomeScreen.swift rename to Monal/another.im/Views/Enter/WelcomeScreen.swift diff --git a/Monal/another.im/Views/RootView.swift b/Monal/another.im/Views/RootView.swift index 8c34747..3dabf5a 100644 --- a/Monal/another.im/Views/RootView.swift +++ b/Monal/another.im/Views/RootView.swift @@ -1,25 +1,16 @@ +import SwiftfulRouting import SwiftUI struct RootView: View { @EnvironmentObject var wrapper: MonalXmppWrapper - @Environment(\.router) var router var body: some View { - ZStack { - Color.Material.Background.dark - Image(.aimLogo) - .resizable() - .frame(width: 200, height: 200) - } - .ignoresSafeArea() - .onAppear { - switch wrapper.accountsAvailability { - case .noAccounts, .allDisabled: + if wrapper.accountsAvailability == .someEnabled { + // main flow here + EmptyView() + } else { + RouterView { _ in WelcomeScreen() - - case .someEnabled: - // here will be main flow - EmptyView() } } } diff --git a/Monal/another.im/XMPP/AppError.swift b/Monal/another.im/XMPP/AppError.swift deleted file mode 100644 index bacb47a..0000000 --- a/Monal/another.im/XMPP/AppError.swift +++ /dev/null @@ -1,12 +0,0 @@ -enum AppError: Error { - case clientNotFound - case rosterNotFound - case imageNotFound - case videoNotFound - case noData - case fileTooBig - case invalidContentType - case invalidLocalName - case featureNotSupported - case securityError -}