|
|
|
@ -6,7 +6,7 @@ import SessionUIKit
|
|
|
|
|
final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
|
|
|
|
|
private static let autoScrollingTimeInterval: TimeInterval = 10
|
|
|
|
|
private var labelStrings: [NSAttributedString] = []
|
|
|
|
|
private var labelTypes: [LabelType] = []
|
|
|
|
|
private var labelTypes: [LabelType] = [.empty]
|
|
|
|
|
private var labelSize: CGSize = .zero
|
|
|
|
|
private var shouldAutoScroll: Bool = false
|
|
|
|
|
private var timer: Timer?
|
|
|
|
@ -28,6 +28,7 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
|
|
|
|
|
case notificationSettings
|
|
|
|
|
case userCount
|
|
|
|
|
case disappearingMessageSetting
|
|
|
|
|
case empty
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public var currentLabelType: LabelType {
|
|
|
|
@ -58,6 +59,7 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
|
|
|
|
|
result.themeCurrentPageIndicatorTintColor = .textPrimary
|
|
|
|
|
result.themePageIndicatorTintColor = .textSecondary
|
|
|
|
|
result.themeTintColor = .textPrimary
|
|
|
|
|
result.currentPage = 0
|
|
|
|
|
result.set(.height, to: 5)
|
|
|
|
|
result.transform = CGAffineTransform(scaleX: 0.5, y: 0.5)
|
|
|
|
|
return result
|
|
|
|
@ -81,7 +83,7 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
|
|
|
|
|
|
|
|
|
|
// MARK: - Initialization
|
|
|
|
|
|
|
|
|
|
init(labelStrings: [NSAttributedString] = [], labelTypes: [LabelType] = [], labelSize: CGSize = .zero, shouldAutoScroll: Bool = false) {
|
|
|
|
|
init(labelStrings: [NSAttributedString] = [], labelTypes: [LabelType] = [.empty], labelSize: CGSize = .zero, shouldAutoScroll: Bool = false) {
|
|
|
|
|
super.init(frame: .zero)
|
|
|
|
|
setUpViewHierarchy()
|
|
|
|
|
self.update(with: labelStrings, labelTypes: labelTypes, labelSize: labelSize, shouldAutoScroll: shouldAutoScroll)
|
|
|
|
@ -93,9 +95,9 @@ final class SessionLabelCarouselView: UIView, UIScrollViewDelegate {
|
|
|
|
|
|
|
|
|
|
// MARK: - Content
|
|
|
|
|
|
|
|
|
|
public func update(with labelStrings: [NSAttributedString] = [], labelTypes: [LabelType] = [], labelSize: CGSize = .zero, shouldAutoScroll: Bool = false) {
|
|
|
|
|
public func update(with labelStrings: [NSAttributedString], labelTypes: [LabelType], labelSize: CGSize = .zero, shouldAutoScroll: Bool = false) {
|
|
|
|
|
self.labelStrings = labelStrings
|
|
|
|
|
self.labelTypes = labelTypes
|
|
|
|
|
self.labelTypes = labelTypes.isEmpty ? [.empty] : labelTypes
|
|
|
|
|
self.labelSize = labelSize
|
|
|
|
|
self.shouldAutoScroll = shouldAutoScroll
|
|
|
|
|
self.shouldScroll = labelStrings.count > 1
|
|
|
|
|