From 3a8e096b85ba481776cc479a233e46ae53d67964 Mon Sep 17 00:00:00 2001 From: Oleg991 Date: Sun, 2 Feb 2025 17:00:57 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=B5=D1=80=D1=81=D0=B8=D1=8E=20=D0=B4=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D0=B9=D0=BD-=D1=81=D0=B8=D1=81=D1=82=D0=B5=D0=BC=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit И подставил пикер аватарки из дизайн-системы --- SwiftUI-WorkoutApp.xcodeproj/project.pbxproj | 10 ++--- .../xcshareddata/swiftpm/Package.resolved | 8 ++-- .../EditProfile/AvatarPickerView.swift | 40 ------------------- .../EditProfile/EditProfileScreen.swift | 2 +- 4 files changed, 8 insertions(+), 52 deletions(-) delete mode 100644 SwiftUI-WorkoutApp/Screens/Profile/EditProfile/AvatarPickerView.swift diff --git a/SwiftUI-WorkoutApp.xcodeproj/project.pbxproj b/SwiftUI-WorkoutApp.xcodeproj/project.pbxproj index 7037b23c..58439c18 100644 --- a/SwiftUI-WorkoutApp.xcodeproj/project.pbxproj +++ b/SwiftUI-WorkoutApp.xcodeproj/project.pbxproj @@ -39,7 +39,6 @@ 6765B2562D451771006164AB /* UIImage+toMediaFile.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6765B2552D451771006164AB /* UIImage+toMediaFile.swift */; }; 6765B2582D4544C8006164AB /* MainUserProfileScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6765B2572D4544C8006164AB /* MainUserProfileScreen.swift */; }; 6765B25B2D455D5C006164AB /* ProfileViews.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6765B25A2D455D5C006164AB /* ProfileViews.swift */; }; - 6765B25D2D46B024006164AB /* AvatarPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6765B25C2D46B024006164AB /* AvatarPickerView.swift */; }; 6765B2612D46C0F6006164AB /* InfoPlist.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 6765B2602D46C0F6006164AB /* InfoPlist.xcstrings */; }; 6766A036284603CA0033F1E8 /* TabViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6766A035284603CA0033F1E8 /* TabViewModel.swift */; }; 676D5A612D48BF0700EE5E9E /* String+localized.swift in Sources */ = {isa = PBXBuildFile; fileRef = 676D5A602D48BF0700EE5E9E /* String+localized.swift */; }; @@ -131,7 +130,6 @@ 6765B2552D451771006164AB /* UIImage+toMediaFile.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIImage+toMediaFile.swift"; sourceTree = ""; }; 6765B2572D4544C8006164AB /* MainUserProfileScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainUserProfileScreen.swift; sourceTree = ""; }; 6765B25A2D455D5C006164AB /* ProfileViews.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProfileViews.swift; sourceTree = ""; }; - 6765B25C2D46B024006164AB /* AvatarPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AvatarPickerView.swift; sourceTree = ""; }; 6765B2602D46C0F6006164AB /* InfoPlist.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = InfoPlist.xcstrings; sourceTree = ""; }; 6766A035284603CA0033F1E8 /* TabViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabViewModel.swift; sourceTree = ""; }; 676D5A602D48BF0700EE5E9E /* String+localized.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+localized.swift"; sourceTree = ""; }; @@ -318,7 +316,6 @@ children = ( 6798AA83280C0F7D00DB76F1 /* EditProfileScreen.swift */, 6747575528113419002F0A24 /* ChangePasswordScreen.swift */, - 6765B25C2D46B024006164AB /* AvatarPickerView.swift */, ); path = EditProfile; sourceTree = ""; @@ -644,7 +641,6 @@ 674D0623282A9896007E75C6 /* SearchUsersScreen.swift in Sources */, 67A4710D2AEED8F8004D341D /* PastEventStorage.swift in Sources */, 675FB8DB2ADDB87200C9671F /* ParksMapScreen+LocationSettingReminderView.swift in Sources */, - 6765B25D2D46B024006164AB /* AvatarPickerView.swift in Sources */, 6747575628113419002F0A24 /* ChangePasswordScreen.swift in Sources */, 67515699283FEC3100501346 /* PickedImagesGrid.swift in Sources */, 67FBF64F28338A2E008A7968 /* EventDetailsScreen.swift in Sources */, @@ -873,7 +869,7 @@ CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES; CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content"; DEVELOPMENT_TEAM = CR68PP2Z3F; ENABLE_PREVIEWS = YES; @@ -923,7 +919,7 @@ CLANG_TIDY_MISC_REDUNDANT_EXPRESSION = YES; CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY = YES; CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4; + CURRENT_PROJECT_VERSION = 5; DEVELOPMENT_ASSET_PATHS = "SwiftUI-WorkoutApp/Preview\\ Content/PreviewContent.swift SwiftUI-WorkoutApp/Preview\\ Content"; DEVELOPMENT_TEAM = CR68PP2Z3F; ENABLE_PREVIEWS = YES; @@ -1021,7 +1017,7 @@ repositoryURL = "https://github.com/OlegEremenko991/SWDesignSystem"; requirement = { kind = upToNextMajorVersion; - minimumVersion = 1.8.0; + minimumVersion = 1.9.0; }; }; 67F9534D2964A5700077DFDC /* XCRemoteSwiftPackageReference "ImagePicker" */ = { diff --git a/SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved index 22794cf0..6e5ed136 100644 --- a/SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/SwiftUI-WorkoutApp.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/OlegEremenko991/CachedAsyncImage991", "state" : { - "revision" : "e308c3519417eba297c26b1d7c41eae20ccbf0e1", - "version" : "1.1.0" + "revision" : "7c625daaadea6c56f2c739af70374c0b7ca41112", + "version" : "1.2.0" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/OlegEremenko991/SWDesignSystem", "state" : { - "revision" : "185fa4c9f9d725f621f8d51db50293bb304dbdf3", - "version" : "1.8.0" + "revision" : "34ae97ce48e84c2847c108e65fcd559de7c4a50e", + "version" : "1.9.0" } } ], diff --git a/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/AvatarPickerView.swift b/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/AvatarPickerView.swift deleted file mode 100644 index 822fc741..00000000 --- a/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/AvatarPickerView.swift +++ /dev/null @@ -1,40 +0,0 @@ -import SwiftUI - -struct AvatarPickerView: UIViewControllerRepresentable { - let completion: (UIImage) -> Void - @Environment(\.dismiss) private var dismiss - - func makeUIViewController(context: Context) -> UIImagePickerController { - let picker = UIImagePickerController() - picker.sourceType = .photoLibrary - picker.allowsEditing = true - picker.delegate = context.coordinator - return picker - } - - func updateUIViewController(_: UIImagePickerController, context _: Context) {} - - func makeCoordinator() -> Coordinator { .init(self) } - - final class Coordinator: NSObject, UINavigationControllerDelegate, UIImagePickerControllerDelegate { - let parent: AvatarPickerView - - init(_ parent: AvatarPickerView) { - self.parent = parent - } - - func imagePickerController( - _: UIImagePickerController, - didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any] - ) { - if let image = info[.editedImage] as? UIImage ?? info[.originalImage] as? UIImage { - parent.completion(image) - } - parent.dismiss() - } - - func imagePickerControllerDidCancel(_: UIImagePickerController) { - parent.dismiss() - } - } -} diff --git a/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/EditProfileScreen.swift b/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/EditProfileScreen.swift index fb33e005..fcc46736 100644 --- a/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/EditProfileScreen.swift +++ b/SwiftUI-WorkoutApp/Screens/Profile/EditProfile/EditProfileScreen.swift @@ -110,7 +110,7 @@ private extension EditProfileScreen { .buttonStyle(SWButtonStyle(mode: .tinted, size: .large, maxWidth: nil)) .padding(.bottom, 8) .sheet(isPresented: $showImagePicker) { - AvatarPickerView { + SWImagePicker { newAvatarImageModel = .init(uiImage: $0) userForm.image = $0.toMediaFile() }