Skip to content

Conversation

@kvld
Copy link
Contributor

@kvld kvld commented Aug 29, 2017

Задача: #APPS-1420

Коротко для Release Notes, в формате «Сделали/Добавили/Исправили N»:
Исправлено отображение аватаров

Описание:
SVGKit плохо рендерит текст в svg аватаре. Теперь пытаемся сами взять текст из полученного аватара, после чего генерируем новый средствами UIKit.

@kvld kvld added the main label Aug 29, 2017
@kvld kvld added this to the 1.42 milestone Aug 29, 2017
@kvld kvld self-assigned this Aug 29, 2017
@kvld kvld requested a review from Ostrenkiy August 29, 2017 14:30
private func extractLetters(from svgString: String) -> String? {
let xmlWOClosingTags = svgString.replacingOccurrences(of: "</text></svg>", with: "")
let letters = xmlWOClosingTags.components(separatedBy: ">").last
return letters
Copy link
Contributor

Choose a reason for hiding this comment

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

Возможно, тут стоит проверить длину letters, чтобы не получилось, что мы что-то другое распарсили

import Alamofire
import SVGKit

class AvatarImageView: UIImageView {
Copy link
Contributor

Choose a reason for hiding this comment

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

Здесь стоит еще делать setRoundedBounds() для UIImageView. Так мы в дальнейшем сможем изменять форму всех аватаров одновременно, не изменяя ее во всех местах, где AvatarImageView задействован

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Теперь делаем setRoundedBounds(width: 0) внутри вьюхи (из других мест это выпилено).
При этом, в TeacherCollectionViewCell есть вызов setRoundedBounds(width: 1, color: UIColor.white). Нам действительно нужна однопиксельная обводка у аватарок преподавателей на странице инфы о курсе? 🤔

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 Author

Choose a reason for hiding this comment

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

выпилено

@Ostrenkiy Ostrenkiy merged commit 7cd34eb into dev Aug 30, 2017
@Ostrenkiy Ostrenkiy deleted the fix/user-avatars branch August 30, 2017 18:01
@Ostrenkiy Ostrenkiy mentioned this pull request Sep 7, 2017
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