Skip to content

Sprint 13#6

Open
vilaabo wants to merge 5 commits into
mainfrom
sprint_13
Open

Sprint 13#6
vilaabo wants to merge 5 commits into
mainfrom
sprint_13

Conversation

@vilaabo

@vilaabo vilaabo commented May 25, 2026

Copy link
Copy Markdown
Owner

No description provided.

vilaabo added 5 commits May 25, 2026 20:29
…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.
@vilaabo

vilaabo commented May 25, 2026

Copy link
Copy Markdown
Owner Author

На момент отправки этого пул-реквеста на ревью в чек-листе 13-го спринта присутствовал пункт: «Приложение должно поддерживать устройства iPhone с iOS 13 или выше, предусмотрен только портретный режим». В формулировке ошибка, видимо, с прошлых версий курса: указана iOS 13, тогда как корректная минимальная версия - iOS 17. Я уточнил этот момент у наставника в чате и получил следующий ответ:

image


// MARK: - Private Methods

private func makeAuthRequest() -> URLRequest {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Остался приватный метод makeAuthRequest, который дублирует ответственность AuthHelper и нигде не используется. Лучше удалить его, чтобы презентер не хранил лишнюю бизнес-логику и архитектура MVP оставалась чище

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants