Merge branch 'master' into feature/deeplink_api

# Conflicts:
#	CHANGELOG.md
This commit is contained in:
Nikita Semenov 2023-03-30 15:19:27 +03:00
commit 2245765b27
26 changed files with 111 additions and 28 deletions

View File

@ -1,8 +1,12 @@
# Changelog
### 1.42.0
- **Added**: TIDeeplink to support deeplink API
### 1.41.0
- **Added**: TIDeeplink to support deeplink API
- **Update**: added callbacks for views while skeletons change status to presented or hidden
### 1.40.0

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIAppleMapUtils'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIAuth'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Login, registration, confirmation and other related actions'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIDeveloperUtils'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Universal web view API'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIEcommerce'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Cart, products, promocodes, bonuses and other related actions'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIFoundationUtils'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Set of helpers for Foundation framework classes.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIGoogleMapUtils'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIKeychainUtils'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Set of helpers for Keychain classes.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIMapUtils'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Set of helpers for map objects clustering and interacting.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIMoyaNetworking'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Moya + Swagger network service.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TINetworking'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Swagger-frendly networking layer helpers.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TINetworkingCache'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Caching results of EndpointRequests.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIPagination'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Generic pagination component.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TISwiftUICore'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Core UI elements: protocols, views and helpers.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TISwiftUtils'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Bunch of useful helpers for Swift development.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TITableKitUtils'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Set of helpers for TableKit classes.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -66,7 +66,7 @@ open class SkeletonsConfiguration {
// MARK: - Open methods
open func createSkeletonLayer(for baseView: UIView) -> SkeletonLayer {
SkeletonLayer(config: self, baseView: baseView)
SkeletonLayer(config: self, skeletonsPresenterView: baseView)
}
open func configureAppearance(layer: SkeletonLayer) {

View File

@ -24,4 +24,20 @@ import class UIKit.UIView
public protocol Skeletonable {
var viewsToSkeletons: [UIView] { get }
func skeletonsChangedState(_ state: SkeletonsState)
}
extension Skeletonable where Self: UIView {
public var viewsToSkeletons: [UIView] {
subviews
}
public func skeletonsChangedState(_ state: SkeletonsState) {
// Empty realization
}
}
public enum SkeletonsState {
case shown
case hidden
}

View File

@ -65,9 +65,11 @@ open class SkeletonLayer: CAShapeLayer {
private var viewBoundsObservation: NSKeyValueObservation?
private var applicationStateObservation: NSObjectProtocol?
private weak var layerOwnerView: UIView?
private weak var skeletonsPresenterView: UIView?
public var configuration: SkeletonsConfiguration
public var isSkeletonsHolder: Bool = false
public weak var baseView: UIView?
public var isAnimating: Bool {
animationLayer.animation(forKey: Constants.animationKeyPath) != nil
@ -82,9 +84,9 @@ open class SkeletonLayer: CAShapeLayer {
super.init(layer: layer)
}
public init(config: SkeletonsConfiguration, baseView: UIView) {
public init(config: SkeletonsConfiguration, skeletonsPresenterView: UIView) {
self.configuration = config
self.baseView = baseView
self.skeletonsPresenterView = skeletonsPresenterView
super.init()
}
@ -98,6 +100,8 @@ open class SkeletonLayer: CAShapeLayer {
// MARK: - Open methods
open func bind(to viewType: ViewType) {
layerOwnerView = viewType.view
configureAppearance(viewType)
updateGeometry(viewType: viewType)
@ -118,6 +122,14 @@ open class SkeletonLayer: CAShapeLayer {
configuration.configurationDelegate?.layerDidConfigured(self, forViewType: viewType)
}
open func skeletonsChangedState(_ state: SkeletonsState) {
guard let skeletonableView = layerOwnerView as? Skeletonable else {
return
}
skeletonableView.skeletonsChangedState(state)
}
open func remove(from view: UIView) {
stopAnimation()
removeFromSuperlayer()
@ -126,6 +138,8 @@ open class SkeletonLayer: CAShapeLayer {
if let observation = applicationStateObservation {
NotificationCenter.default.removeObserver(observation)
}
skeletonsChangedState(.hidden)
}
open func startAnimation() {
@ -163,7 +177,7 @@ open class SkeletonLayer: CAShapeLayer {
}
private func updateGeometry(viewType: ViewType) {
let rect = viewType.view.convert(viewType.view.bounds, to: baseView)
let rect = viewType.view.convert(viewType.view.bounds, to: skeletonsPresenterView)
switch viewType {
case let .textView(textView):

View File

@ -50,6 +50,7 @@ extension UIView {
return layer
}
.insert(onto: self)
.skeletonsShown()
}
public func hideSkeletons() {
@ -104,10 +105,22 @@ extension UIView {
// MARK: - Helper extension
extension Array where Element: CALayer {
public func insert(onto view: UIView, at index: UInt32 = .max) {
extension Array where Element: SkeletonLayer {
@discardableResult
public func skeletonsShown() -> Self {
self.forEach { subLayer in
subLayer.skeletonsChangedState(.shown)
}
return self
}
@discardableResult
public func insert(onto view: UIView, at index: UInt32 = .max) -> Self {
self.forEach { subLayer in
view.layer.insertSublayer(subLayer, at: index)
}
return self
}
}

View File

@ -302,6 +302,19 @@ DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) {
titleSubtitleView.hideSkeletons()
}
//: Если на конкретной view необходимо отслеживать появление скелетонов, то можно законформить ее под протокол Skeletonable:
extension DefaultPlaceholderImageView: Skeletonable {
public func skeletonsChangedState(_ state: SkeletonsState) {
switch state {
case .shown:
placeholderView.isHidden = false
case .hidden:
placeholderView.isHidden = true
}
}
}
//: ## Тестовый сконфигурированный контроллер
import PlaygroundSupport

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIUIElements'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Bunch of useful protocols and views.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }
@ -11,7 +11,14 @@ Pod::Spec.new do |s|
s.ios.deployment_target = '11.0'
s.swift_versions = ['5.3']
s.source_files = s.name + '/Sources/**/*'
sources = '/Sources/**/*'
if ENV["DEVELOPMENT_INSTALL"] # installing using :path =>
s.source_files = sources
s.exclude_files = s.name + '.app'
else
s.source_files = s.name + sources
s.exclude_files = s.name + '/*.app'
end
s.dependency 'TIUIKitCore', s.version.to_s
s.dependency 'TISwiftUtils', s.version.to_s

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIUIKitCore'
s.version = '1.40.0'
s.version = '1.42.0'
s.summary = 'Core UI elements: protocols, views and helpers.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIWebView'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Universal web view API'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'TIYandexMapUtils'
s.version = '1.40.0'
s.version = '1.41.0'
s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.'
s.homepage = 'https://gitlab.ti/touchinstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
s.license = { :type => 'MIT', :file => 'LICENSE' }

View File

@ -324,6 +324,22 @@ DispatchQueue.main.asyncAfter(deadline: .now() + .seconds(3)) {
}
```
Если на конкретной view необходимо отслеживать появление скелетонов, то можно законформить ее под протокол Skeletonable:
```swift
extension DefaultPlaceholderImageView: Skeletonable {
public func skeletonsChangedState(_ state: SkeletonsState) {
switch state {
case .shown:
placeholderView.isHidden = false
case .hidden:
placeholderView.isHidden = true
}
}
}
```
## Тестовый сконфигурированный контроллер
```swift