-
Notifications
You must be signed in to change notification settings - Fork 0
Implemented settings, blocked users, updated profile page, and pop-ups #76
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
base: main
Are you sure you want to change the base?
Conversation
- Moved edit profile button - Shifted details stack view
- Changed slider track to correct UIImage - Changed slider thumb to smaller slider thumb - Set navigation bar to hidden when view appears / set to false when view disapp ears in ProfileVC - allows button to be pressed - Created settings button in ProfileVC - Changed edit profile button in ProfileVC - Shifted settingsButton, editButton, and profileImageView - Removed image from Roadtrip Favorites details, replaced with UILabel's - Created SettingsViewController, able to push to SettingsVC from ProfileVC - Created custom class SettingsCellView for settings cells - Added properties to UI extension files
…rofile image - Created `BlockedUsersViewController` that displays all the blocked users or an empty state if there's no blocked users (TODO: networking calls) - Created `BlockedUserTableViewCell` that contains the user profile image and name, as well as a button to block/unblock the user - Updates the list of blocked users after leaving the blocked users page and returning back to the page - Modified `EditProfileViewController` to present a pop up once tapping the delete account button, which provides the option to either delete account or cancel - Modified `EditProfileViewController` to save the uploaded profile photo (fixed) - Added lines in between cells in `SettingsViewController`, and added functionality to pushing the blockedUsersVC and signing out of the app - Deleted unused code in `User` model - Created `getBlockedUsers` to get all the blocked users in `NetworkManager` - Added necessary fonts and images to extension files - Removed main UIView in `EmptyStateView` and replaced with UIStackView so that if there is no title, only the subtitle will appear on screen with the proper constraints - Created `PopUpViewController` as a custom class that can be initialized as a pop up that contains a title, subtitle, and two buttons for either performing an action or canceling; includes blur effect in background
- Once clicking the unblock button, displays pop up to choose whether to unblock the user or to cancel - User will still be displayed on block users page, but the button changed to block; this button only changes after confirming - If the user decides to block some other user again, the button will change to the unblock state again - When leaving the page and re-entering, the proper list of blocked users will display - `PopUpViewController` title parameter updated to take in an attributed string instead of a string, so that specific styling can be specified - Dummy data for the blocked users is included in the `User` model
- And other small issues
vinnie4k
left a comment
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.
Great work! Next time, please break up your PRs. All of these features should be broken down into ~4 different PRs. I briefly skimmed your code, but please keep this in mind next time.
Request me again once you have addressed my comments.
| 2C6BE1AD29EF8106007EA3AA /* Keys.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Keys.plist; path = ../../../../../../Keys.plist; sourceTree = "<group>"; }; | ||
| 2C6BE1AE29EF8106007EA3AA /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "GoogleService-Info.plist"; path = "../../../../../../GoogleService-Info.plist"; sourceTree = "<group>"; }; |
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.
Make sure you don't have dependency issues when removing these from the project.
| 2C6BE1AE29EF8106007EA3AA /* GoogleService-Info.plist */, | ||
| 2C6BE1AD29EF8106007EA3AA /* Keys.plist */, |
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.
Same as above.
| private let userLabel = UILabel() | ||
| private let unblockButton = UIButton() |
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.
Put these in order.
| private let unblockButton = UIButton() | ||
|
|
||
| static let reuse = "BlockedUserCellReuse" | ||
| weak var delegate: BlockedUsersDelegate? |
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.
I don't think this is being used anywhere. Mark it as private.
| self.user = user | ||
| profileImageView.sd_setImage(with: URL(string: user.profilePicUrl ?? ""), placeholderImage: UIImage.scooped.emptyImage) | ||
| userLabel.text = "\(user.firstName) \(user.lastName)" | ||
| self.delegate = delegate |
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.
self.user = user and self.delegate = delegate should be right on top of one another.
| popUpVC.configure( | ||
| title: attributedTitle, | ||
| subtitle: "", | ||
| actionButtonText: "Unblock", | ||
| delegate: 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.
You can do this directly through the initializer if you define it like such. See my message at the very bottom.
| private func setupEmptyStateView() { | ||
| emptyStateView.setup( | ||
| image: UIImage(), | ||
| title: "", | ||
| subtitle: "No blocked users" | ||
| ) | ||
| view.addSubview(emptyStateView) | ||
|
|
||
| emptyStateView.snp.makeConstraints { make in | ||
| make.edges.equalToSuperview() | ||
| } | ||
| } |
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.
Nice use of the EmptyStateView class to make things reusable.
|
|
||
| @objc private func doAction() { | ||
| dismiss(animated: true) | ||
| delegate?.acceptPopUp() |
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.
This is why we use a weak reference for delegates. If you didn't use a weak reference, this right here would cause a retain cycle. You would be dismissing this instance and then still having a strong reference to the delegate.
| do { | ||
| let blockedUsers = try jsonDecoder.decode([BaseUser].self, from: data) | ||
| completion(.success(blockedUsers)) | ||
| } catch { | ||
| completion(.failure(error)) | ||
| } | ||
| case .failure(let error): | ||
| completion(.failure(error)) | ||
| print("Request getBlockedUsers Failed: \(error.localizedDescription)") | ||
| } |
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.
I'm not a fan of how Scooped does networking. There are too many unnecessary print statements as well as inconsistencies with them. Logging is a powerful tool and should not be abused. I would note this in the handoff doc.
| "scale" : "2x" | ||
| }, | ||
| { | ||
| "filename" : "SliderThumb.png", |
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.
Also, in the video you sent, the circle looks a bit transparent.
Overview
Implemented settings and blocked users pages. Updated profile page according to new design. Created custom classes for settings' cells and pop up views. Adjusted some views and other minor changes.
Changes Made
Settings Cell View
SettingsCellView, which contains the setting name label and icon. Created for the settings page.Settings Page
SettingsViewController, which containsSettingCellViews for blocked users, reporting a problem, and signing out.UITapGestureRecognizerattached to it, which performs their respective actions when tapping on the cell.BlockedUsersViewController.LoginViewController.Pop Up View Controller
PopUpViewControllerto be used to initialize and display a pop up, which contains a title, subtitle, cancel button, and action button, on top of a blurred background.UIStackViewto display these elements so that the spacing is correct with or without a subtitle.PopUpViewDelegate, so that any view can conform to the protocol and implement the action for when the "confirm/action" button of the pop up is clicked.Empty State View
UIViewand replaced with aUIStackView.setupfunction to make setting up a title conditional on having a title.Blocked Users Page
BlockedUsersTableViewCell, which contains the blocked user's profile image, name, and an unblock/block button.BlockedUserViewController, which asks the user to confirm unblocking.BlockedUsersViewController, which displays a list of all the users blocked using a table view. When there are no blocked users, an empty state is displayed instead.blockedUsersDummyDatais stored in theUsers.swiftfile as an extension to theBaseUserclass. This should be removed after implementing networking.Profile Page
viewWillAppearandviewWillDisappear, so that the buttons near the top of the screen are interactable.containerViewand added them to theview. Updated images and constraints to align with design.SettingsViewControllerwhen tapped. This button is only displayed when the user is viewing their own profile.ImageLabelViews toUILabels. Adjusted spacing and other code to adopt the change.Edit Profile Page
EditProfileViewController.LoginViewControlleris pushed. Otherwise, the pop up view is dismissed.updateAuthenticatedUserRequest. Correctedprof_picargument in theupdateAuthenticatedUseranddeleteUsernetwork request.Other Changes
getBlockedUsersnetwork call that returns an array of the currently blocked users.PreferencesViewControllerandEditProfileViewController.Userclass fromUser.swiftdue to being unused code.Extension+UIImage.swift.Extension+UIFont.swiftandExtension+UIColor.swift.Test Coverage
BlockedUserViewControllerfor when a user is unblocked, unblocked then blocked again, leaving the page and returning back to the page, no users are blocked, etc.EditProfileViewControllerto ensure profile image is being saved for my user.Next Steps
allBlockedUsersnetwork request if necessary once the backend issue is resolved.SettingsViewControlleronce implemented.Screenshots
Before: Profile Page
Before: Edit Profile Page
After
profile-settings.mp4