-
Notifications
You must be signed in to change notification settings - Fork 16
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
feat: [FC-0047] Account Settings and Profile split #397
Conversation
Thanks for the pull request, @IvanStepanok! Please note that it may take us up to several weeks or months to complete a review and merge your PR. Feel free to add as much of the following information to the ticket as you can:
All technical communication about the code itself will be done via the GitHub pull request interface. As a reminder, our process documentation is here. Please let us know once your PR is ready for our review and all tests are green. |
default_config/dev/config.yaml
Outdated
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that a undesired change, revert it.
@@ -27,7 +27,7 @@ public struct SignInView: View { | |||
public var body: some View { | |||
ZStack(alignment: .top) { | |||
VStack { | |||
ThemeAssets.authBackground.swiftUIImage | |||
ThemeAssets.titleBackground.swiftUIImage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about renaming it to headerBackground?
Core/Core/SwiftGen/Assets.swift
Outdated
@@ -111,6 +112,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 settingsIcon = ImageAsset(name: "settingsIcon") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we don't use the word icon
for icons, how about just renaming it to settings
?
@IvanStepanok, please check this, the profile data in ProfileView does not change if I change it on the manage account screen. Simulator.Screen.Recording.-.iPhone.15.Pro.-.2024-04-22.at.11.03.24.mp4 |
.foregroundColor(Theme.Colors.textSecondary) | ||
if viewModel.userModel?.shortBiography != "" { | ||
VStack(alignment: .leading, spacing: 6) { | ||
Text("About Me") // Add Localization, delete old ProfileLocalization.info |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to resources
Button(action: { viewModel.router.back() }, label: { | ||
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) | ||
.backButtonStyle(color: Theme.Colors.loginNavigationText) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format to the each param on own line.
// MARK: - Manage Account | ||
@ViewBuilder | ||
private var manageAccount: some View { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove extra space
} | ||
}) | ||
.accessibilityIdentifier("video_settings_button") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove extra space
.cardStyle(bgColor: Theme.Colors.textInputUnfocusedBackground, | ||
strokeColor: .clear) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format each parameter on its own line.
Task { | ||
await viewModel.logOut() | ||
} | ||
}, type: .logOut |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format each parameter on its own line.
Button(action: { viewModel.router.back() }, label: { | ||
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template) | ||
.backButtonStyle(color: Theme.Colors.loginNavigationText) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please format each parameter on its own line.
Please add navigation titles for each controller and fix long tap back navigation: 2024-04-22.13.49.11.mov |
fix navigation titles and back buttons on few screens
Hi @forgotvas and thanks for the review! I fixed the back buttons and titles in the video settings too. Thanks!🙏 Screen.Recording.2024-04-25.at.11.29.01.mov |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Started reviewing PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The review is currently underway. Kindly attend to the suggested changes made up to this stage.
@@ -260,7 +251,8 @@ struct EditProfileView_Previews: PreviewProvider { | |||
yearOfBirth: 0, | |||
country: "Ukraine", | |||
shortBiography: "", | |||
isFullProfile: true | |||
isFullProfile: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove trailing whitespace to address warning:
Trailing Whitespace Violation: Lines should not have trailing whitespace (trailing_whitespace)
} | ||
|
||
var body: some View { | ||
NavigationView { | ||
VideoDownloadQualityView( | ||
downloadQuality: downloadQuality, | ||
didSelect: didSelect, | ||
analytics: analytics | ||
analytics: analytics, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation
@@ -694,6 +694,20 @@ public class Router: AuthorizationRouter, | |||
navigationController.pushViewController(controller, animated: true) | |||
} | |||
|
|||
public func showVideoSettings() { | |||
let viewModel = Container.shared.resolve(SettingsViewModel.self)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid force unwrapping to avoid potential crash. We can update like this:
guard let viewModel = Container.shared.resolve(SettingsViewModel.self) else { return }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your suggestion to use a guard-let to avoid potential crashes by force unwrapping. While this is generally good practice, in this specific context, the force unwrap is intentional. Our application's design guarantees that the SettingsViewModel will always be present in the container when this function is called. Introducing a guard-let would imply a possibility of SettingsViewModel not being available, which contradicts our current architecture and could potentially confuse future maintainers about the assumptions in our codebase. Let's keep the force unwrap as an assertion of our design guarantees.
} | ||
|
||
public func showManageAccount() { | ||
let viewModel = Container.shared.resolve(ManageAccountViewModel.self)! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
guard let viewModel = Container.shared.resolve(ManageAccountViewModel.self) else { return }
OpenEdX/View/MainScreenView.swift
Outdated
@@ -17,7 +17,6 @@ import Theme | |||
|
|||
struct MainScreenView: View { | |||
|
|||
@State private var settingsTapped: Bool = false | |||
@State private var disableAllTabs: Bool = false | |||
@State private var updateAvaliable: Bool = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: updateAvailable
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove new line.
.foregroundColor(Theme.Colors.textSecondary) | ||
if viewModel.userModel?.shortBiography != "" { | ||
VStack(alignment: .leading, spacing: 6) { | ||
Text(ProfileLocalization.about) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing Whitespace Violation
.padding(.horizontal, 24) | ||
.font(Theme.Fonts.labelLarge) | ||
.foregroundColor(Theme.Colors.textSecondary) | ||
if viewModel.userModel?.shortBiography != "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems, we can update like:
if let bio = viewModel.userModel?.shortBiography, bio != "" {
VStack(alignment: .leading, spacing: 6) {
Text(ProfileLocalization.about)
.font(Theme.Fonts.titleSmall)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("profile_info_text")
Text(bio)
.font(Theme.Fonts.bodyMedium)
.foregroundColor(Theme.Colors.textPrimary)
.accessibilityIdentifier("bio_text")
}
|
||
private var url: URL? | ||
@Binding private var image: UIImage? | ||
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please discard this change.
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please discard this change.
Thank you, @shafqat-muneer, for the review! All requests have been satisfied. Ready for another pass 🙌 |
ProgressBar(size: 40, lineWidth: 8) | ||
.padding(.top, 200) | ||
.padding(.horizontal) | ||
.accessibilityIdentifier("progressbar") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Based on the convention being followed, shouldn't it be named progress_bar
?
.padding(.horizontal) | ||
.accessibilityIdentifier("progressbar") | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove new line
"ABOUT" = "About Me"; | ||
"EDIT_PROFILE" = "Edit Profile"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the use of all caps intentional, given that conventionally, all words except the first one are in small caps? If it's according to design then we can communicate to designer about the protocol which is being followed across the application.
If it's addressable then need to address to all other places.
) | ||
|
||
|
||
await viewModel.logOut() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove extra newline.
@IvanStepanok Thank you for considering the feedback. 🎉
Simulator.Screen.Recording.-.iPhone.15.-.2024-05-01.at.13.19.39.mp4 |
Hi, @shafqat-muneer, and thanks for the review! All problems are fixed. 🙌 |
@IvanStepanok Thanks for addressing the feedback. 🎉 It seems minor indentation / formatting related comments are missed. Please also address them before merge. Separate issue is create here for this observed problem.
|
Hi, @shafqat-muneer, please take a look 🙌 |
Hi @IvanStepanok |
@IvanStepanok 🎉 Your pull request was merged! Please take a moment to answer a two question survey so we can improve your experience in the future. |
Split account settings and the user profile
Design: https://www.figma.com/file/iZ56YMjbRMShCCDxqrqRrR/Open-edX-Mobile-App-All-Screens-v2.1?type=design&node-id=0-1&mode=design
Quick demo:
Setting button on Discover, Dashboard and Profile screens.
Light and Dark themes:
Settings screen:
Manage account:
Landscape:
Ipad: