Skip to content

Commit

Permalink
feat: [FC-0047] Account Settings and Profile split (#397)
Browse files Browse the repository at this point in the history
* feat: Separate account settings and profile editing

* feat: changes according to desing

* feat: update background colors

* feat: update missed email value in tests

* fix: resume old design

* fix: changes after the code review

* fix: code formatting on ManageAccountView

* fix: changes after code review

fix navigation titles and back buttons on few screens

* feat: updates after shafqat-muneer code review

* feat: fixes after review

* feat: changes after code review
  • Loading branch information
IvanStepanok authored May 7, 2024
1 parent 565ce6e commit 4706755
Show file tree
Hide file tree
Showing 46 changed files with 1,438 additions and 674 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct SignInView: View {
public var body: some View {
ZStack(alignment: .top) {
VStack {
ThemeAssets.authBackground.swiftUIImage
ThemeAssets.headerBackground.swiftUIImage
.resizable()
.edgesIgnoringSafeArea(.top)
.accessibilityIdentifier("auth_bg_image")
Expand Down Expand Up @@ -144,7 +144,7 @@ public struct SignInView: View {
HStack(alignment: .center) {
ProgressBar(size: 40, lineWidth: 8)
.padding(20)
.accessibilityIdentifier("progressbar")
.accessibilityIdentifier("progress_bar")
}.frame(maxWidth: .infinity)
} else {
StyledButton(CoreLocalization.SignIn.logInBtn) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public struct SignUpView: View {
public var body: some View {
ZStack(alignment: .top) {
VStack {
ThemeAssets.authBackground.swiftUIImage
ThemeAssets.headerBackground.swiftUIImage
.resizable()
.edgesIgnoringSafeArea(.top)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public struct ResetPasswordView: View {
GeometryReader { proxy in
ZStack(alignment: .top) {
VStack {
ThemeAssets.authBackground.swiftUIImage
ThemeAssets.headerBackground.swiftUIImage
.resizable()
.edgesIgnoringSafeArea(.top)
}
Expand Down Expand Up @@ -117,7 +117,7 @@ public struct ResetPasswordView: View {
HStack(alignment: .center) {
ProgressBar(size: 40, lineWidth: 8)
.padding(20)
.accessibilityIdentifier("progressbar")
.accessibilityIdentifier("progress_bar")
}.frame(maxWidth: .infinity)
} else {
StyledButton(AuthLocalization.Forgot.request) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "deleteAccount.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Core/Core/Assets.xcassets/settings.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "settingsIcon.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
4 changes: 4 additions & 0 deletions Core/Core/Assets.xcassets/settings.imageset/settingsIcon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion Core/Core/Data/Model/Data_UserProfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ public extension DataLayer.UserProfile {
country: country ?? "",
spokenLanguage: languageProficiencies?[safe: 0]?.code ?? "",
shortBiography: bio ?? "",
isFullProfile: accountPrivacy?.boolValue ?? true)
isFullProfile: accountPrivacy?.boolValue ?? true,
email: email ?? "")
}
}
6 changes: 5 additions & 1 deletion Core/Core/Domain/Model/UserProfile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public struct UserProfile: Hashable {
public let spokenLanguage: String?
public let shortBiography: String
public let isFullProfile: Bool
public let email: String

public init(
avatarUrl: String,
Expand All @@ -27,7 +28,8 @@ public struct UserProfile: Hashable {
country: String,
spokenLanguage: String? = nil,
shortBiography: String,
isFullProfile: Bool
isFullProfile: Bool,
email: String
) {
self.avatarUrl = avatarUrl
self.name = name
Expand All @@ -38,6 +40,7 @@ public struct UserProfile: Hashable {
self.spokenLanguage = spokenLanguage
self.shortBiography = shortBiography
self.isFullProfile = isFullProfile
self.email = email
}

public init() {
Expand All @@ -50,5 +53,6 @@ public struct UserProfile: Hashable {
self.spokenLanguage = ""
self.shortBiography = ""
self.isFullProfile = true
self.email = ""
}
}
2 changes: 2 additions & 0 deletions Core/Core/SwiftGen/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public enum CoreAssets {
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")
Expand Down Expand Up @@ -113,6 +114,7 @@ public enum CoreAssets {
public static let noWifiMini = ImageAsset(name: "noWifiMini")
public static let notAvaliable = ImageAsset(name: "notAvaliable")
public static let playVideo = ImageAsset(name: "playVideo")
public static let settings = ImageAsset(name: "settings")
public static let star = ImageAsset(name: "star")
public static let starOutline = ImageAsset(name: "star_outline")
public static let warning = ImageAsset(name: "warning")
Expand Down
4 changes: 3 additions & 1 deletion Core/Core/View/Base/NavigationBar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public struct NavigationBar: View {
private let rightButtonType: ButtonType?
private let rightButtonAction: (() -> Void)?
@Binding private var rightButtonIsActive: Bool
@Environment (\.isHorizontal) private var isHorizontal

public init(title: String,
titleColor: Color = Theme.Colors.navigationBarTintColor,
Expand Down Expand Up @@ -53,8 +54,9 @@ public struct NavigationBar: View {
if leftButton {
VStack {
BackNavigationButton(color: leftButtonColor, action: leftButtonAction)
.padding(8)
.backViewStyle()
.padding(.leading, isHorizontal ? 48 : 0)
.accessibilityIdentifier("back_button")
}
.frame(minWidth: 0,
maxWidth: .infinity,
Expand Down
127 changes: 80 additions & 47 deletions Core/Core/View/Base/VideoDownloadQualityView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,14 @@ public struct VideoDownloadQualityView: View {
@StateObject
private var viewModel: VideoDownloadQualityViewModel
private var analytics: CoreAnalytics
private var router: BaseRouter
@Environment (\.isHorizontal) private var isHorizontal

public init(
downloadQuality: DownloadQuality,
didSelect: ((DownloadQuality) -> Void)?,
analytics: CoreAnalytics
analytics: CoreAnalytics,
router: BaseRouter
) {
self._viewModel = StateObject(
wrappedValue: .init(
Expand All @@ -46,64 +49,94 @@ public struct VideoDownloadQualityView: View {
)
)
self.analytics = analytics
self.router = router
}

public var body: some View {
GeometryReader { proxy in
ZStack(alignment: .top) {
// MARK: - Page Body
ScrollView {
VStack(alignment: .leading, spacing: 24) {
ForEach(viewModel.downloadQuality, id: \.self) { quality in
Button(action: {
analytics.videoQualityChanged(
.videoDownloadQualityChanged,
bivalue: .videoDownloadQualityChanged,
value: quality.value ?? "",
oldValue: viewModel.selectedDownloadQuality.value ?? ""
)

viewModel.selectedDownloadQuality = quality
}, label: {
HStack {
SettingsCell(
title: quality.title,
description: quality.description
VStack {
ThemeAssets.headerBackground.swiftUIImage
.resizable()
.edgesIgnoringSafeArea(.top)
}
.frame(maxWidth: .infinity, maxHeight: 200)
.accessibilityIdentifier("auth_bg_image")

// MARK: - Page name
VStack(alignment: .center) {
ZStack {
HStack {
Text(CoreLocalization.Settings.videoDownloadQualityTitle)
.titleSettings(color: Theme.Colors.loginNavigationText)
.accessibilityIdentifier("manage_account_text")
}
VStack {
BackNavigationButton(
color: Theme.Colors.loginNavigationText,
action: {
router.back()
}
)
.backViewStyle()
.padding(.leading, isHorizontal ? 48 : 0)
.accessibilityIdentifier("back_button")

}.frame(minWidth: 0,
maxWidth: .infinity,
alignment: .topLeading)
}
// MARK: - Page Body
ScrollView {
VStack(alignment: .leading, spacing: 24) {
ForEach(viewModel.downloadQuality, id: \.self) { quality in
Button(action: {
analytics.videoQualityChanged(
.videoDownloadQualityChanged,
bivalue: .videoDownloadQualityChanged,
value: quality.value ?? "",
oldValue: viewModel.selectedDownloadQuality.value ?? ""
)
.accessibilityElement(children: .ignore)
.accessibilityLabel("\(quality.title) \(quality.description ?? "")")
Spacer()
CoreAssets.checkmark.swiftUIImage
.renderingMode(.template)
.foregroundColor(Theme.Colors.accentXColor)
.opacity(quality == viewModel.selectedDownloadQuality ? 1 : 0)
.accessibilityIdentifier("checkmark_image")

}
.foregroundColor(Theme.Colors.textPrimary)
})
.accessibilityIdentifier("select_quality_button")
Divider()
viewModel.selectedDownloadQuality = quality
}, label: {
HStack {
SettingsCell(
title: quality.title,
description: quality.description
)
.accessibilityElement(children: .ignore)
.accessibilityLabel("\(quality.title) \(quality.description ?? "")")
Spacer()
CoreAssets.checkmark.swiftUIImage
.renderingMode(.template)
.foregroundColor(Theme.Colors.accentXColor)
.opacity(quality == viewModel.selectedDownloadQuality ? 1 : 0)
.accessibilityIdentifier("checkmark_image")

}
.foregroundColor(Theme.Colors.textPrimary)
})
.accessibilityIdentifier("select_quality_button")
Divider()
}
}
.frameLimit(width: proxy.size.width)
.padding(.horizontal, 24)
.padding(.top, 24)
}
.frame(
minWidth: 0,
maxWidth: .infinity,
alignment: .topLeading
)
.padding(.horizontal, 24)
.frameLimit(width: proxy.size.width)
.roundedBackground(Theme.Colors.background)
}
.padding(.top, 8)
}
.navigationBarHidden(false)
.navigationBarBackButtonHidden(false)
.navigationTitle(CoreLocalization.Settings.videoDownloadQualityTitle)
.background(
Theme.Colors.background
.ignoresSafeArea()
)
}
.navigationBarHidden(true)
.navigationBarBackButtonHidden(true)
.navigationTitle(CoreLocalization.Settings.videoDownloadQualityTitle)
.ignoresSafeArea(.all, edges: .horizontal)
.background(
Theme.Colors.background
.ignoresSafeArea()
)
}
}

Expand Down
3 changes: 2 additions & 1 deletion Course/Course/Presentation/Outline/CourseOutlineView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ public struct CourseOutlineView: View {
VideoDownloadQualityContainerView(
downloadQuality: $0.downloadQuality,
didSelect: viewModel.update(downloadQuality:),
analytics: viewModel.coreAnalytics
analytics: viewModel.coreAnalytics,
router: viewModel.router
)
}
}
Expand Down
Loading

0 comments on commit 4706755

Please sign in to comment.