Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [FC-0047] Account Settings and Profile split #397

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading