From 722b59dd49439d831fe65dc4d15b5ce056cf6d83 Mon Sep 17 00:00:00 2001 From: Saeed Bashir Date: Wed, 2 Oct 2024 16:32:58 +0500 Subject: [PATCH] chore: Elm theme improvements on Profile (#82) --- .../Profile/bg_delete.imageset/Contents.json | 22 ----------- .../bg_delete.imageset/bg_delete 1.svg | 7 ---- .../bg_delete.imageset/delete_bg_light.svg | 7 ---- .../delete_char.imageset/delete_char.svg | 9 +---- .../delete_eyes.imageset/Contents.json | 12 ------ .../delete_eyes.imageset/delete_eyes.svg | 7 ---- .../Profile/noAvatar.imageset/Contents.json | 12 +----- .../noAvatar.imageset/Group 82 (1).svg | 20 ---------- .../Profile/noAvatar.imageset/Group 82-2.svg | 20 ---------- .../Profile/noAvatar.imageset/noavatar.svg | 12 ++++++ Core/Core/SwiftGen/Assets.swift | 2 - .../DeleteAccount/DeleteAccountView.swift | 14 ++++--- .../EditProfile/EditProfileView.swift | 24 ++++++------ .../Presentation/Profile/ProfileView.swift | 12 +++++- .../DeleteAccountBG.colorset/Contents.json | 38 +++++++++++++++++++ Theme/Theme/SwiftGen/ThemeAssets.swift | 1 + Theme/Theme/Theme.swift | 1 + 17 files changed, 86 insertions(+), 134 deletions(-) delete mode 100644 Core/Core/Assets.xcassets/Profile/bg_delete.imageset/Contents.json delete mode 100644 Core/Core/Assets.xcassets/Profile/bg_delete.imageset/bg_delete 1.svg delete mode 100644 Core/Core/Assets.xcassets/Profile/bg_delete.imageset/delete_bg_light.svg delete mode 100644 Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/Contents.json delete mode 100644 Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/delete_eyes.svg delete mode 100644 Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82 (1).svg delete mode 100644 Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82-2.svg create mode 100644 Core/Core/Assets.xcassets/Profile/noAvatar.imageset/noavatar.svg create mode 100644 Theme/Theme/Assets.xcassets/Colors/DeleteAccountBG.colorset/Contents.json diff --git a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/Contents.json b/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/Contents.json deleted file mode 100644 index 118426dbb..000000000 --- a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/Contents.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "images" : [ - { - "filename" : "delete_bg_light.svg", - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "bg_delete 1.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/bg_delete 1.svg b/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/bg_delete 1.svg deleted file mode 100644 index 92b146822..000000000 --- a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/bg_delete 1.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/delete_bg_light.svg b/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/delete_bg_light.svg deleted file mode 100644 index 96007a9b5..000000000 --- a/Core/Core/Assets.xcassets/Profile/bg_delete.imageset/delete_bg_light.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Core/Core/Assets.xcassets/Profile/delete_char.imageset/delete_char.svg b/Core/Core/Assets.xcassets/Profile/delete_char.imageset/delete_char.svg index d1422ad6a..629486222 100644 --- a/Core/Core/Assets.xcassets/Profile/delete_char.imageset/delete_char.svg +++ b/Core/Core/Assets.xcassets/Profile/delete_char.imageset/delete_char.svg @@ -1,8 +1,3 @@ - - - - - - - + + diff --git a/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/Contents.json b/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/Contents.json deleted file mode 100644 index 19c371f58..000000000 --- a/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "delete_eyes.svg", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/delete_eyes.svg b/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/delete_eyes.svg deleted file mode 100644 index af854563b..000000000 --- a/Core/Core/Assets.xcassets/Profile/delete_eyes.imageset/delete_eyes.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Contents.json b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Contents.json index a92e0ba79..39a9d81a0 100644 --- a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Contents.json +++ b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Contents.json @@ -1,17 +1,7 @@ { "images" : [ { - "filename" : "Group 82 (1).svg", - "idiom" : "universal" - }, - { - "appearances" : [ - { - "appearance" : "luminosity", - "value" : "dark" - } - ], - "filename" : "Group 82-2.svg", + "filename" : "noavatar.svg", "idiom" : "universal" } ], diff --git a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82 (1).svg b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82 (1).svg deleted file mode 100644 index 378c7d3c7..000000000 --- a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82 (1).svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82-2.svg b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82-2.svg deleted file mode 100644 index 787fcfd88..000000000 --- a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/Group 82-2.svg +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/noavatar.svg b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/noavatar.svg new file mode 100644 index 000000000..af8187de2 --- /dev/null +++ b/Core/Core/Assets.xcassets/Profile/noAvatar.imageset/noavatar.svg @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/Core/Core/SwiftGen/Assets.swift b/Core/Core/SwiftGen/Assets.swift index 7deaa6b50..013603f90 100644 --- a/Core/Core/SwiftGen/Assets.swift +++ b/Core/Core/SwiftGen/Assets.swift @@ -81,11 +81,9 @@ public enum CoreAssets { public static let profile = ImageAsset(name: "profile") public static let programs = ImageAsset(name: "programs") public static let addPhoto = ImageAsset(name: "addPhoto") - public static let bgDelete = ImageAsset(name: "bg_delete") public static let checkmark = ImageAsset(name: "checkmark") public static let deleteAccount = ImageAsset(name: "deleteAccount") public static let deleteChar = ImageAsset(name: "delete_char") - public static let deleteEyes = ImageAsset(name: "delete_eyes") public static let done = ImageAsset(name: "done") public static let gallery = ImageAsset(name: "gallery") public static let leaveProfile = ImageAsset(name: "leaveProfile") diff --git a/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift b/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift index 40303b16b..968288a3f 100644 --- a/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift +++ b/Profile/Profile/Presentation/DeleteAccount/DeleteAccountView.swift @@ -26,12 +26,14 @@ public struct DeleteAccountView: View { VStack { Group { ZStack { - CoreAssets.bgDelete.swiftUIImage - CoreAssets.deleteChar.swiftUIImage - .foregroundColor(Theme.Colors.accentXColor) - .offset(y: -31) - CoreAssets.deleteEyes.swiftUIImage - .offset(x: -7, y: -27) + Circle() + .foregroundColor(Theme.Colors.deleteAccountBG) + .frame(width: 104, height: 104) + CoreAssets.deleteChar.swiftUIImage.renderingMode(.template) + .resizable() + .foregroundColor(Theme.Colors.white) + .frame(width: 60, height: 60) + .offset(y: -5) .accessibilityIdentifier("delete_account_image") }.padding(.top, 50) diff --git a/Profile/Profile/Presentation/EditProfile/EditProfileView.swift b/Profile/Profile/Presentation/EditProfile/EditProfileView.swift index c74c3d332..f48b7586e 100644 --- a/Profile/Profile/Presentation/EditProfile/EditProfileView.swift +++ b/Profile/Profile/Presentation/EditProfile/EditProfileView.swift @@ -43,18 +43,18 @@ public struct EditProfileView: View { } }, label: { UserAvatar(url: viewModel.userModel.avatarUrl, image: $viewModel.inputImage) - .padding(.top, 30) - .overlay( - ZStack { - if !viewModel.userModel.requiresParentalConsent { - Circle().frame(width: 36, height: 36) - .foregroundColor(Theme.Colors.accentXColor) - - CoreAssets.addPhoto.swiftUIImage.renderingMode(.template) - .foregroundColor(Theme.Colors.primaryButtonTextColor) - } - }.offset(x: 36, y: 50) - ) + .padding(.top, 30) + .overlay( + ZStack { + if !viewModel.userModel.requiresParentalConsent { + Circle().frame(width: 36, height: 36) + .foregroundColor(Theme.Colors.accentXColor) + + CoreAssets.addPhoto.swiftUIImage.renderingMode(.template) + .foregroundColor(Theme.Colors.primaryButtonTextColor) + } + }.offset(x: 36, y: 50) + ) }) .disabled(viewModel.userModel.requiresParentalConsent) .accessibilityIdentifier("change_profile_image_button") diff --git a/Profile/Profile/Presentation/Profile/ProfileView.swift b/Profile/Profile/Presentation/Profile/ProfileView.swift index 3d4f52864..d0404903b 100644 --- a/Profile/Profile/Presentation/Profile/ProfileView.swift +++ b/Profile/Profile/Presentation/Profile/ProfileView.swift @@ -200,14 +200,16 @@ struct ProfileView_Previews: PreviewProvider { struct UserAvatar: View { private var url: URL? + private var borderColor: Color @Binding private var image: UIImage? - init(url: String, image: Binding) { + init(url: String, image: Binding, borderColor: Color = Theme.Colors.avatarStroke) { if let rightUrl = URL(string: url) { self.url = rightUrl } else { self.url = nil } self._image = image + self.borderColor = borderColor } var body: some View { ZStack { @@ -217,6 +219,10 @@ struct UserAvatar: View { .scaledToFill() .frame(width: 80, height: 80) .cornerRadius(40) + .overlay { + Circle() + .stroke(borderColor, lineWidth: 1) + } } else { KFImage(url) .onFailureImage(CoreAssets.noCourseImage.image) @@ -224,6 +230,10 @@ struct UserAvatar: View { .scaledToFill() .frame(width: 80, height: 80) .cornerRadius(40) + .overlay { + Circle() + .stroke(borderColor, lineWidth: 1) + } } } } diff --git a/Theme/Theme/Assets.xcassets/Colors/DeleteAccountBG.colorset/Contents.json b/Theme/Theme/Assets.xcassets/Colors/DeleteAccountBG.colorset/Contents.json new file mode 100644 index 000000000..bf1a96417 --- /dev/null +++ b/Theme/Theme/Assets.xcassets/Colors/DeleteAccountBG.colorset/Contents.json @@ -0,0 +1,38 @@ +{ + "colors" : [ + { + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "1.000", + "green" : "0.408", + "red" : "0.235" + } + }, + "idiom" : "universal" + }, + { + "appearances" : [ + { + "appearance" : "luminosity", + "value" : "dark" + } + ], + "color" : { + "color-space" : "srgb", + "components" : { + "alpha" : "1.000", + "blue" : "0xF8", + "green" : "0x78", + "red" : "0x53" + } + }, + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Theme/Theme/SwiftGen/ThemeAssets.swift b/Theme/Theme/SwiftGen/ThemeAssets.swift index 90d186d78..90ca10246 100644 --- a/Theme/Theme/SwiftGen/ThemeAssets.swift +++ b/Theme/Theme/SwiftGen/ThemeAssets.swift @@ -46,6 +46,7 @@ public enum ThemeAssets { public static let pastDueTimelineColor = ColorAsset(name: "pastDueTimelineColor") public static let primaryHeaderColor = ColorAsset(name: "primaryHeaderColor") public static let secondaryHeaderColor = ColorAsset(name: "secondaryHeaderColor") + public static let deleteAccountBG = ColorAsset(name: "DeleteAccountBG") public static let infoColor = ColorAsset(name: "InfoColor") public static let irreversibleAlert = ColorAsset(name: "IrreversibleAlert") public static let loginBackground = ColorAsset(name: "LoginBackground") diff --git a/Theme/Theme/Theme.swift b/Theme/Theme/Theme.swift index 8d5446d4a..336e4e603 100644 --- a/Theme/Theme/Theme.swift +++ b/Theme/Theme/Theme.swift @@ -75,6 +75,7 @@ public struct Theme { public private(set) static var secondaryHeaderColor = ThemeAssets.secondaryHeaderColor.swiftUIColor public private(set) static var courseCardShadow = ThemeAssets.courseCardShadow.swiftUIColor public private(set) static var courseCardBackground = ThemeAssets.courseCardBackground.swiftUIColor + public private(set) static var deleteAccountBG = ThemeAssets.deleteAccountBG.swiftUIColor public static func update( accentColor: Color = ThemeAssets.accentColor.swiftUIColor,