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

Conversation

IvanStepanok
Copy link
Contributor

@IvanStepanok IvanStepanok commented Apr 17, 2024

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.
ezgif-1-d38260a5e3

Light and Dark themes:

Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 58 20 Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 58 17

Settings screen:

Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 58 59 Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 59 00

Manage account:

Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 12 03 53 Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 12 03 51

Landscape:

Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 59 30
Simulator Screenshot - iPhone 15 Pro Max - 2024-04-19 at 11 59 22

Ipad:

Simulator Screenshot - iPad mini (6th generation) - 2024-04-19 at 11 59 12 Simulator Screenshot - iPad mini (6th generation) - 2024-04-19 at 11 59 09

@openedx-webhooks
Copy link

openedx-webhooks commented Apr 17, 2024

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:

  • supporting documentation
  • Open edX discussion forum threads
  • timeline information ("this must be merged by XX date", and why that is)
  • partner information ("this is a course on edx.org")
  • any other information that can help Product understand the context for the PR

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.

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Apr 17, 2024
@volodymyr-chekyrta volodymyr-chekyrta changed the title Feat/account settings and profile split feat: [FC-0047] Account Settings and Profile split Apr 18, 2024

Copy link
Contributor

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
Copy link
Contributor

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?

@@ -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")
Copy link
Contributor

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?

@volodymyr-chekyrta
Copy link
Contributor

@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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to resources

Comment on lines 44 to 47
Button(action: { viewModel.router.back() }, label: {
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.backButtonStyle(color: Theme.Colors.loginNavigationText)
})
Copy link
Contributor

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 {

Copy link
Contributor

@volodymyr-chekyrta volodymyr-chekyrta Apr 22, 2024

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")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra space

Comment on lines 205 to 206
.cardStyle(bgColor: Theme.Colors.textInputUnfocusedBackground,
strokeColor: .clear)
Copy link
Contributor

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
Copy link
Contributor

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.

Comment on lines 43 to 46
Button(action: { viewModel.router.back() }, label: {
CoreAssets.arrowLeft.swiftUIImage.renderingMode(.template)
.backButtonStyle(color: Theme.Colors.loginNavigationText)
})
Copy link
Contributor

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.

@volodymyr-chekyrta volodymyr-chekyrta marked this pull request as ready for review April 22, 2024 09:53
@forgotvas
Copy link
Contributor

Please add navigation titles for each controller and fix long tap back navigation:

2024-04-22.13.49.11.mov

@forgotvas forgotvas removed the request for review from rnr April 22, 2024 10:57
@forgotvas
Copy link
Contributor

forgotvas commented Apr 22, 2024

Is that design decision to hide info on profile overview? In develop build i can see "year of birth" and "bio", in that branch only bio and only on profile screen:

develop profile Manage account
Simulator Screenshot - iPad (10th generation) - 2024-04-22 at 14 52 21 Simulator Screenshot - iPad (10th generation) - 2024-04-22 at 14 52 22 Simulator Screenshot - iPad (10th generation) - 2024-04-22 at 14 52 42

@IvanStepanok
Copy link
Contributor Author

Hi @forgotvas and thanks for the review!
The year of birth was removed by design, it's true, I double-checked it:
https://www.figma.com/file/iZ56YMjbRMShCCDxqrqRrR/Open-edX-Mobile-App-All-Screens-v2.1?type=design&node-id=0-1&mode=design

I fixed the back buttons and titles in the video settings too. Thanks!🙏

Screen.Recording.2024-04-25.at.11.29.01.mov

forgotvas
forgotvas previously approved these changes Apr 25, 2024
Copy link
Contributor

@forgotvas forgotvas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@shafqat-muneer
Copy link
Contributor

Started reviewing PR

@shafqat-muneer
Copy link
Contributor

The location of the back button varies across screens in landscape mode.

Screens
Simulator Screenshot - iPhone 12 (17 2) - 2024-04-26 at 16 21 46
Simulator Screenshot - iPhone 12 (17 2) - 2024-04-26 at 16 30 26
Simulator Screenshot - iPhone 12 (17 2) - 2024-04-26 at 16 30 42

Copy link
Contributor

@shafqat-muneer shafqat-muneer left a 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,
Copy link
Contributor

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,
Copy link
Contributor

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)!
Copy link
Contributor

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 }

Copy link
Contributor Author

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)!
Copy link
Contributor

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 }

@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: updateAvailable

Comment on lines 141 to 146

Copy link
Contributor

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)
Copy link
Contributor

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 != "" {
Copy link
Contributor

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")
            }

Comment on lines 294 to 208

private var url: URL?
@Binding private var image: UIImage?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discard this change.

Comment on lines 306 to 217

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please discard this change.

@IvanStepanok
Copy link
Contributor Author

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")
Copy link
Contributor

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 {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove new line

Comment on lines +11 to +12
"ABOUT" = "About Me";
"EDIT_PROFILE" = "Edit Profile";
Copy link
Contributor

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.

Comment on lines 41 to 45
)


await viewModel.logOut()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove extra newline.

@shafqat-muneer
Copy link
Contributor

@IvanStepanok Thank you for considering the feedback. 🎉
Overall, I have a few additional minor observations that might require attention.

  • Observed overlapping on manage account and settings screens
Settings Manage Account
Simulator Screenshot - iPhone 15 - 2024-05-01 at 12 58 06 Simulator Screenshot - iPhone 15 - 2024-05-01 at 12 58 10
  • Safe area is visible in Video download quality screen and it's covered in Video settings screen.
Video download quality Video settings
Simulator Screenshot - iPhone 15 - 2024-05-01 at 12 51 01 Simulator Screenshot - iPhone 15 - 2024-05-01 at 12 51 04
  • The position of the back arrow appears to be incorrect in comparison to the other screens.
    Simulator Screenshot - iPhone 15 - 2024-05-01 at 13 01 14

  • Finally, although it may not be directly related to the changes made in this pull request, I noticed it while reviewing the PR. We might want to address it in a separate PR. In the pre-login user experience, the course details aren't opening; it consistently shows an error.

Simulator.Screen.Recording.-.iPhone.15.-.2024-05-01.at.13.19.39.mp4

@IvanStepanok
Copy link
Contributor Author

Hi, @shafqat-muneer, and thanks for the review! All problems are fixed. 🙌
Simulator Screenshot - iPhone 15 - 2024-05-03 at 15 59 11
Simulator Screenshot - iPhone 15 - 2024-05-03 at 15 59 09
Simulator Screenshot - iPhone 15 - 2024-05-03 at 15 59 06
Simulator Screenshot - iPhone 15 - 2024-05-03 at 15 37 24
Simulator Screenshot - iPhone 15 - 2024-05-03 at 15 37 22
Simulator Screenshot - iPhone 15 - 2024-05-04 at 14 05 12

@shafqat-muneer
Copy link
Contributor

@IvanStepanok Thanks for addressing the feedback. 🎉
All changes LGTM 👍. PR is approved.

It seems minor indentation / formatting related comments are missed. Please also address them before merge.

Separate issue is create here for this observed problem.

Finally, although it may not be directly related to the changes made in this pull request, I noticed it while reviewing the PR. We might want to address it in a separate PR. In the pre-login user experience, the course details aren't opening; it consistently shows an error.

shafqat-muneer
shafqat-muneer previously approved these changes May 6, 2024
@IvanStepanok
Copy link
Contributor Author

Hi, @shafqat-muneer, please take a look 🙌

@shafqat-muneer
Copy link
Contributor

Hi @IvanStepanok
Thanks
LGTM 👍

@volodymyr-chekyrta volodymyr-chekyrta merged commit 4706755 into openedx:develop May 7, 2024
3 checks passed
@openedx-webhooks
Copy link

@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.

@volodymyr-chekyrta volodymyr-chekyrta deleted the feat/account_settings_and_profile_split branch May 7, 2024 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants