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

Course info: info tab UI #406

Merged
merged 52 commits into from
Nov 29, 2018
Merged

Conversation

ivan-magda
Copy link
Member

@ivan-magda ivan-magda commented Nov 9, 2018

Задача: #APPS-2060

Описание:
Вкладка для страницы "о курсе", как в макете.

TODO:

  • Цвет иконок должен быть #535366
  • Проверить шрифты

@ivan-magda ivan-magda added the main label Nov 9, 2018
@ivan-magda ivan-magda changed the title Course info: info tab Course info: info tab UI Nov 14, 2018
Stepic/CourseInfoTabInfoInstructorSkeletonView.swift Outdated Show resolved Hide resolved
}
}

private func getBlockIcon(_ block: CourseInfoTabInfoBlock) -> UIImage? {
Copy link
Contributor

Choose a reason for hiding this comment

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

Еще раз: смысла в существовании CourseInfoTabInfoBlock отдельно от CourseInfoTabInfoView мало. Почему бы не перенести CourseInfoTabInfoBlock в CourseInfoTabInfoView.Block и не сделать поля title и icon в енуме?
В любом случае, два метода которые возвращают два разных элемента кортежа – очень странно.

}
}

final class CourseInfoTabInfoBlockView: UIView {
Copy link
Contributor

Choose a reason for hiding this comment

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

Только сейчас наконец-то понял, что это на самом деле header у блоков. Давай назовем его соответствующим образом.

fatalError("init(coder:) has not been implemented")
}

func configure(viewModel: CourseInfoTabInfoBlockViewModelProtocol) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Не нужно это здесь, и соответственно никаких протоколов тоже не нужно. Просто так же открываем поля icon: UIImage? и title: String? и на уровне выше (там где это шапка блока) их задаем.

}

func configure(viewModel: CourseInfoTabInfoInstructorsBlockViewModel) {
self.headerView.configure(viewModel: viewModel)
Copy link
Contributor

Choose a reason for hiding this comment

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

В блоке с инструкторами иконка и тайтл фиксированные, нет необходимости их прокидывать откуда-то.

let description: String
}

struct CourseInfoTabInfoInstructorsBlockViewModel: CourseInfoTabInfoBlockViewModelProtocol {
Copy link
Contributor

Choose a reason for hiding this comment

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

Здесь не нужны протоколы (см. обсуждение в configure) как и отдельные вьюмодели для блоков.

Rename CourseInfoTabInfoBlockSkeletonView.swift -> CourseInfoTabInfoHeaderSkeletonView.swift
Rename CourseInfoTabInfoHeaderSkeletonView.swift -> CourseInfoTabInfoHeaderBlockSkeletonView.swift
Rename CourseInfoTabInfoHeaderView.swift -> CourseInfoTabInfoHeaderBlockView.swift
@kvld kvld modified the milestones: 1.72, 1.73 Nov 15, 2018
self.loadImage(url: self.avatarImageURL)
}
}

private let appearance: Appearance

private lazy var imageView: UIImageView = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Кстати, у нас есть вьюшка CourseCoverImageView, которая может в плейсхолдеры и loadImage с Nuke. Давай ее реюзнем здесь тоже?

Copy link
Member Author

Choose a reason for hiding this comment

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

Да, хорошая идея. Может нам в будущем стоит сделать свою imageView c блэк джеком или переименовать CourseCoverImageView, как что-нибудь более обощенное.

Copy link
Contributor

Choose a reason for hiding this comment

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

Да, переименовать было бы неплохо, она теперь используется много где. Пока поживем с таким названием

Copy link
Contributor

@kvld kvld left a comment

Choose a reason for hiding this comment

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

Я сейчас быстро сам поправлю и вмерджу, но замечания все равно прочитай :)

final class CourseInfoTabInfoBlockSkeletonView: UIView {
let appearance: Appearance
final class CourseInfoTabInfoHeaderBlockSkeletonView: UIView {
private let appearance: Appearance
Copy link
Contributor

Choose a reason for hiding this comment

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

На будущее: appearance необязательно делать приватным. Как минимум, это может понадобиться, если из родительской вьюшки захочется узнать какие-то параметры, связанные с геометрией.

private let appearance: Appearance

private lazy var headerView = CourseInfoTabInfoBlockView()
lazy var headerView = CourseInfoTabInfoHeaderBlockView()
Copy link
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Member Author

Choose a reason for hiding this comment

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

Только сейчас наконец-то понял, что это на самом деле header у блоков. Давай назовем его соответствующим образом.

Copy link
Contributor

Choose a reason for hiding this comment

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

Я про private

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

В PR с логикой переделано, https://github.com/StepicOrg/stepik-ios/pull/411/files#diff-417cd3690ed90cb5b10505f54d0bce66R150
Там можно будет сделать private

@ivan-magda ivan-magda merged commit 585d7a0 into feature/course-info Nov 29, 2018
@ivan-magda ivan-magda deleted the feature/course-info-page branch November 29, 2018 08:25
@kvld kvld restored the feature/course-info-page branch December 6, 2018 13:44
@kvld kvld deleted the feature/course-info-page branch December 6, 2018 13:52
kvld added a commit that referenced this pull request Jan 29, 2019
* Course info: info tab UI (#406)

* Add image resources

* Add course info localizable strings

* Create course info text block view

* Create course info instructors block view

* Layout instructors

* Better spacing

* Update instructors description text color

* Add intro tmp imageView

* Round instructor avatar

* Fix with spacing

* Refactor rename course info type

* Create CourseInfoSkeletonView file

* Create new group CourseInfoTab

* Create view and view model groups

* Load avatar image

* Remove image literal

* Use constructors with no params

* Create CourseInfoTabInfoViewDelegate

* Change type of intro URL

* Refactor extract configure with view model method

* Create block views builder

* Make intro video view

* Refactor rename CourseInfoSkeletonView -> CourseInfoTabInfoSkeletonView

* Remove unnecessary content insets

* Tmp for skeleton

* Add skeletons

* Rearrange groups

* Format code

* Create view controller

* Fix skeleton constraints

* Simplify info block skeleton constraints

* Fix course info block skeleton view setup

* Refactor rename imageView -> iconImageView

* Fix make concreate course info tab view lazy

* Use configure(viewModel:) style

* Remove viewModel from view's constructors

* Refactor rename imageView -> previewImageView

* Use main dark color

* Remove JoinButton appearance struct

* Refactor rename CourseInfoTabInfoBlockType -> CourseInfoTabInfoBlock

* Use inner elements and blocks insets

Vertical spacing:
- Between inner elements 20
- Between blocks 40

* Update source files headers

* Use stepik green color

* Apply fixes for blocks

* Fixes

* Remove private(set) for lazy property

* Refactor rename

Rename CourseInfoTabInfoBlockSkeletonView.swift -> CourseInfoTabInfoHeaderSkeletonView.swift

* Refactor rename

Rename CourseInfoTabInfoHeaderSkeletonView.swift -> CourseInfoTabInfoHeaderBlockSkeletonView.swift

* Refactor rename
Rename CourseInfoTabInfoHeaderView.swift -> CourseInfoTabInfoHeaderBlockView.swift

* Add author view with function

* Use CourseCoverImageView as instructors avatar image view

* Open appearance

* Course info: container UI & header (#404)

* Navigation bar

* Navigation bar

* Scroll view

* blur

* header

* fix steps

* fix extended edges

* fix status bar

* fix

* fix color

* fix scroll

* Fix bounds

* Minor fixes

* Add .zero as default value to init

* Minor fix

* Course info: segmented control (#405)

* segmented control view

* Delegate

* Course info: download button (#413)

* Download button

* Fix

* Course info: modules UI (#415)

* Navigation bar

* Navigation bar

* Scroll view

* blur

* header

* fix steps

* fix extended edges

* fix status bar

* fix

* fix color

* fix scroll

* Fix bounds

* Minor fixes

* Add .zero as default value to init

* Minor fix

* Course info: segmented control (#405)

* segmented control view

* Delegate

* Table header view (with strange behaviour)

* Section header

* Lesson

* Minor fix

* Minor fixes

* Course info: info tab logic (#411)

* Add image resources

* Add course info localizable strings

* Create course info text block view

* Create course info instructors block view

* Layout instructors

* Better spacing

* Update instructors description text color

* Add intro tmp imageView

* Round instructor avatar

* Fix with spacing

* Refactor rename course info type

* Create CourseInfoSkeletonView file

* Create new group CourseInfoTab

* Create view and view model groups

* Load avatar image

* Remove image literal

* Use constructors with no params

* Create CourseInfoTabInfoViewDelegate

* Change type of intro URL

* Refactor extract configure with view model method

* Create block views builder

* Make intro video view

* Refactor rename CourseInfoSkeletonView -> CourseInfoTabInfoSkeletonView

* Remove unnecessary content insets

* Tmp for skeleton

* Add skeletons

* Rearrange groups

* Format code

* Create view controller

* Fix skeleton constraints

* Simplify info block skeleton constraints

* Fix course info block skeleton view setup

* Refactor rename imageView -> iconImageView

* Fix make concreate course info tab view lazy

* Use configure(viewModel:) style

* Remove viewModel from view's constructors

* Refactor rename imageView -> previewImageView

* Use main dark color

* Remove JoinButton appearance struct

* Refactor rename CourseInfoTabInfoBlockType -> CourseInfoTabInfoBlock

* Use inner elements and blocks insets

Vertical spacing:
- Between inner elements 20
- Between blocks 40

* Update source files headers

* Use stepik green color

* Apply fixes for blocks

* Fixes

* Remove private(set) for lazy property

* Refactor rename

Rename CourseInfoTabInfoBlockSkeletonView.swift -> CourseInfoTabInfoHeaderSkeletonView.swift

* Refactor rename

Rename CourseInfoTabInfoHeaderSkeletonView.swift -> CourseInfoTabInfoHeaderBlockSkeletonView.swift

* Refactor rename
Rename CourseInfoTabInfoHeaderView.swift -> CourseInfoTabInfoHeaderBlockView.swift

* Add author view with function

* Make module

* Show dummy info

* Fetch instructors

* Test course info header blocks resources

* Add timeToComplete attribute to the Course entity

* Pluralize time to complete

* Add language attribute to the Course entity

* Localize language

* Add certificate details localizables

* Add certificate threshold attributes to the Course entity

* Format certificate details

* Initial tests for CourseInfoTabInfoPresenter

* Refactor rename

* Use Nimble assertions

* Use Quick

* Set HTML text

* Highlight author

* Add authors attributes to the model

* Show formatted author text

* Trim text

* Filter empty views

* Handle course action

Join course when not enrolled and continue learning from the last step when already enrolled.

* Format certificate text

* Update instructor's description label top offset when empty

* Fix certificate titles

* Set instructors description with HTML text

* Optimize authors and instructors fetching

* Provide intro video url and thumbnail

* Handle click on thumbnail

* Add thumbnail placeholer

* Fix play view centering

* Play intro video

* Fix status bar on exit fullscreen

* Use CourseCoverImageView as instructors avatar image view

* Open appearance

* Add fixes

* Move CourseInfoTabInfoInputProtocol conformance to extension

* Remove states from presenter

* Refactor rename addAuthorView(author:) -> addAuthorView(authorName:)

* Use actionButton prefix

* Move hours from seconds formatting to FormatterHelper

* Create CourseInfoTabInfoViewModelAdapter

* Revert UIViewControllerBasedStatusBarAppearance change

* Change status bar visibility

* Update users fetching

* Update instructor description top constraint

* Move player to controller

* Init player

* Use weak self

* Remove tests :( :( :( :(

* Course info: container logic (#426) & syllabus (#438)

* Merge UI

* Correct intrinsic size for info tab

* Segmented control & scrollview

* Skeleton

* Load course in container

* Info tab

* Video fixes

* Fix instructors

* 16:9 ratio for videos

* Users service for provider

* Fix status bar & header

* Dynamic header height

* Minor fixes

* Fixes

* NSLock -> DispatchSemaphore

* Fix white background

* Course info: syllabus content logic & downloads (#438)

* module basic files

* uipageviewcontroller instead of uiscrollview

* syllabus

* Downloading service

* Routing to info/syllabus tab

* show correct download state

* handle download click

* downloads 💩

* downloads interaction service

* Fixes

* remove unused

* wrapped unit in view model

* Sections deadlines

* Layout fixes

* Completion & failure events

* Add enrolled state

* Fix deep link & last step routers

* Next & previous units service (#422)

* NextLessonService

* Fixes & tests

* fixes

* Present controller with lesson

* Fixes for SDK 11

* Set build for current branch

* Fix navigation bar issues

* Personal deadlines

* Fix after rename

* Exam in syllabus

* "More actions" alert & course sharing

* Main action & drop course

* Set version to 1.75 & increment build

* Add tap proxy view for download buttons

* Fix deadlines view

* Next / previous lesson

* Hide syllabus tab for adaptive courses

* Personal deadlines tooltip

* Make enabled-disabled visual state for cells

* Remove "Downloads" from Settings

* "Download all" logic

* Fix new discussion layout (12 sdk)

* Fix video quality (12 sdk)

* Fix certificates layout (12 sdk)

* Remove action button tab

* Fix semaphore dispose crash

* Update button state after remove

* Set version to 1.76 & increment build

* Fixed downloads

* Force populate sections

* Fix empty units download state error

* Analytics & small fixes

* Remove unused code

* Fix iPad & landscape

* Bump build

* Fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants