Conversation
…ARK in services Constants.swift moves into AuthConfiguration.swift and gains an AuthConfiguration struct with a .standard default. All services (OAuth2Service, ProfileService, ProfileImageService, ImagesListService) now read URLs/keys via AuthConfiguration.standard.* instead of the flat Constants enum. While here, group every service file with a consistent MARK structure — Properties / Initialization / Public Methods / Private Methods — so they read uniformly side by side. Same MARK polish for LogoutService and SingleImageViewController.
…ure(_:) DI Introduce one presenter per screen and split protocols on both sides: - WebView: AuthHelper (URL/code logic) + WebViewPresenter + protocols. WebViewViewController shrinks to UI + KVO + segue plumbing; logger removed (duplicated URLSession+data and OAuth2Service). - AuthViewController: builds presenter once in prepare(for:) via configure(_:), drops the unused logger. - Profile: ProfilePresenter owns ProfileService / ProfileImageService / LogoutService and formats the display strings. ProfileViewController becomes a thin view conforming to ProfileViewControllerProtocol; placeholder texts removed (presenter populates immediately), avatar size centralized in a static constant, colors extracted as .subtitleGray / .logoutRed in UIColor+Extensions, logout button picks up an accessibility identifier for UI tests. - ImagesList: ImagesListPresenter owns photos array, pagination trigger and like toggling. ImagesListViewController forwards dataSource/delegate calls to the presenter and exposes setLoading / reloadRow / showLikeError / updateTableViewAnimated. TabBarController wires both Profile and ImagesList via the new configure(_:) entry point so the presenter↔view link can't be half-finished. View-side `presenter` is now a private IUO — fail-fast if anyone instantiates the VC without configure(_:). showAlert helper drops its now-unused parameter notes; the rest is just API renames flowing from MVP.
Wire up two new targets in the project (ImageFeedTests and ImageFeedUITests as PBXFileSystemSynchronizedRootGroups so new files in the test folders auto-attach without manual pbxproj edits) and add the first round of unit tests for the three MVP modules: - WebView: testViewControllerCallsViewDidLoad, testPresenterCallsLoadRequest, testProgressVisibleWhenLessThenOne, testProgressHiddenWhenOne, testAuthHelperAuthURL, testCodeFromURL. - Profile: testViewControllerCallsViewDidLoad, testPresenterCallsUpdateAvatarOnViewDidLoad, testPresenterShowsLogoutConfirmation. - ImagesList: testViewControllerCallsViewDidLoad, testNumberOfRowsReflectsPresenterPhotos, testWillDisplayIsForwardedToPresenter. Tests live in feature folders (WebView/, Profile/, ImagesList/) so a test sits next to its spies and stays clear of unrelated screens. Each ViewControllerSpy / PresenterSpy implements the matching MVP protocol and exposes only the flags the tests assert on.
…ty ids
Add UI-test coverage for the three required scenarios:
- testAuth — taps Authenticate, waits for the Unsplash WebView,
fills the login form, submits and waits until the feed table
appears.
- testFeed — scrolls the feed, toggles a like twice, opens a cell
full-screen, zooms in/out and returns via Back Button.
- testProfile — waits for the feed, switches to the profile tab,
asserts the user's name and login render, taps the logout button,
confirms the "Пока, пока!" dialog and waits for the Authenticate
button to come back — closing the round trip required by the spec.
Storyboard gains accessibility identifiers ("Authenticate",
"Like Button", "Back Button") used by these tests.
….timeout Pull every element query out of the assertion lines in testProfile — nameLabel, loginLabel, logoutButton, logoutAlert, confirmLogoutButton each get a named let, so a failed lookup points at the right name in the failure log instead of a long XCUIElement chain. Adds the second profile field assertion (LOGIN) that was missing. Across the file, swap the redundant ImageFeedUITests.timeout for Self.timeout — shorter, and re-reading "ImageFeedUITests.timeout" inside ImageFeedUITests was noise.
Owner
Author
Kirchberg
approved these changes
May 25, 2026
|
|
||
| // MARK: - Private Methods | ||
|
|
||
| private func makeAuthRequest() -> URLRequest { |
There was a problem hiding this comment.
Остался приватный метод makeAuthRequest, который дублирует ответственность AuthHelper и нигде не используется. Лучше удалить его, чтобы презентер не хранил лишнюю бизнес-логику и архитектура MVP оставалась чище
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

No description provided.