From cddae04f2eab090d212bbd6dcde5e10ff85b92f9 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Fri, 29 Jul 2022 21:08:11 +0700 Subject: [PATCH 01/16] feat: Add initial files for Cart module --- Package.swift | 6 +++++ .../Sources/Cart protocols/CartSyncable.swift | 25 +++++++++++++++++++ .../Cart protocols/CartUpdatable.swift | 9 +++++++ .../Classes/IgnoringErrorsRepeatClosure.swift | 23 +++++++++++++++++ .../Models/BaseErrorResponseBody.swift | 8 ++++++ TIEcommerce/Sources/Models/Cart.swift | 10 ++++++++ TIEcommerce/Sources/Models/CartProduct.swift | 14 +++++++++++ .../Sources/Models/CartProductPrice.swift | 8 ++++++ TIEcommerce/TIEcommerce.podspec | 16 ++++++++++++ 9 files changed, 119 insertions(+) create mode 100644 TIEcommerce/Sources/Cart protocols/CartSyncable.swift create mode 100644 TIEcommerce/Sources/Cart protocols/CartUpdatable.swift create mode 100644 TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift create mode 100644 TIEcommerce/Sources/Models/BaseErrorResponseBody.swift create mode 100644 TIEcommerce/Sources/Models/Cart.swift create mode 100644 TIEcommerce/Sources/Models/CartProduct.swift create mode 100644 TIEcommerce/Sources/Models/CartProductPrice.swift create mode 100644 TIEcommerce/TIEcommerce.podspec diff --git a/Package.swift b/Package.swift index 5a2f0396..cff7e790 100644 --- a/Package.swift +++ b/Package.swift @@ -37,6 +37,9 @@ let package = Package( .library(name: "TITransitions", targets: ["TITransitions"]), .library(name: "TIPagination", targets: ["TIPagination"]), .library(name: "TIAuth", targets: ["TIAuth"]), + + //MARK: - Skolkovo + .library(name: "TIEcommerce", targets: ["TIEcommerce"]) ], dependencies: [ .package(url: "https://github.com/maxsokolov/TableKit.git", .upToNextMajor(from: "2.11.0")), @@ -80,6 +83,9 @@ let package = Package( .target(name: "TIPagination", dependencies: ["Cursors", "TISwiftUtils"], path: "TIPagination/Sources"), .target(name: "TIAuth", dependencies: ["TIFoundationUtils"], path: "TIAuth/Sources"), + //MARK: - Skolkovo + .target(name: "TIEcommerce", dependencies: ["TIEcommerce"], path: "TIEcommerce/Sources"), + // MARK: - Tests .testTarget( diff --git a/TIEcommerce/Sources/Cart protocols/CartSyncable.swift b/TIEcommerce/Sources/Cart protocols/CartSyncable.swift new file mode 100644 index 00000000..f0a41232 --- /dev/null +++ b/TIEcommerce/Sources/Cart protocols/CartSyncable.swift @@ -0,0 +1,25 @@ +import Foundation + +///Содержит абстрактный метод, позволяющий получить на выходе итоговую локальную корзину. Должен поддерживать две стратегии работы: +///- замена локальной корзины серверной `func replace(localCart:, with:) -> CartModelProtocol` +///- слияние локальной корзины с серверной (детали слияния определяются в проекте) `func merge(localCart:, remoteCart:) -> CartModelProtocol` +protocol CartSyncable { + /** + Cлияние локальной корзины с серверной + - Parameters: + - localCart: `Cart` – локальная корзина + - remoteCart: `Cart` – серверная корзина + - Returns: `Cart` – совмещенная корзина + */ + func merge(localCart: Cart, + remoteCart: Cart) -> Cart + /** + Замена локальной корзины серверной + - Parameters: + - localCart: `Cart` – локальная корзина + - remoteCart: `Cart` – серверная корзина + - Returns: `Cart` – серверная корзина + */ + func replace(localCart: Cart, + with remoteCart: Cart) -> Cart +} diff --git a/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift b/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift new file mode 100644 index 00000000..78c8ad2b --- /dev/null +++ b/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift @@ -0,0 +1,9 @@ +import Foundation + +///Содержит абстрактный метод, позволяющий отправить локальную корзину полностью и получить в ответ серверную корзину +protocol CartUpdatable { + ///Отправляем локальную корзину полностью и получаем в ответ серверную корзину или ошибку + func loadRemoteCart(from localCart: Cart, + successCompletion: ParameterClosure?, + failureCompletion: ParameterClosure?) +} diff --git a/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift b/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift new file mode 100644 index 00000000..8dc92f4d --- /dev/null +++ b/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift @@ -0,0 +1,23 @@ +import Foundation + +///При получении ошибки из `gnoringErrors` повторение отправки до `numberOfAttempts` раз +class IgnoringErrorsRepeatClosure { + private(set) var numberOfAttempts: Int + private var ignoringErrors: Set + + init(ignoringErrors: Set = [], numberOfAttempts: Int) { + self.ignoringErrors = ignoringErrors + self.numberOfAttempts = numberOfAttempts + } + + func performIfNeeded(with error: BaseErrorResponseBody, + repeatClosure: VoidClosure, + errorCompletion: ParameterClosure?) { + if ignoringErrors.contains(error) && numberOfAttempts > 0 { + numberOfAttempts -= 1 + repeatClosure() + } else { + errorCompletion?(error) + } + } +} diff --git a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift new file mode 100644 index 00000000..0ecf98c0 --- /dev/null +++ b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift @@ -0,0 +1,8 @@ +import Foundation + +struct BaseErrorResponseBody: Decodable, Equatable, Hashable { + ///Код ошибки + let errorCode: Int + ///Текст сообщения об ошибке + let errorMessage: String +} diff --git a/TIEcommerce/Sources/Models/Cart.swift b/TIEcommerce/Sources/Models/Cart.swift new file mode 100644 index 00000000..3e67416e --- /dev/null +++ b/TIEcommerce/Sources/Models/Cart.swift @@ -0,0 +1,10 @@ +import Foundation + +protocol Cart { + ///Продукты в корзине пользователя + var products: [CartProduct] { get } + ///Применённые промокоды + var promocodes: [String] { get } + ///Количество доступных бонусов для использования + var availableBonuses: Int? { get } +} diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift new file mode 100644 index 00000000..98f7b251 --- /dev/null +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -0,0 +1,14 @@ +import Foundation + +protocol CartProduct { + ///Идентификатор продукта + var id: String { get } + ///Цена в определённой валюте + var price: CartProductPrice { get } + ///Сколько единиц есть доступно + var availableCount: Int? { get } + ///Варианты товара (фасовка, цвет, размер, и т.п.) + var variants: [CartProduct?] { get } + ///Количество бонусов, которые будут начислены при покупке + var bonuses: Int? { get } +} diff --git a/TIEcommerce/Sources/Models/CartProductPrice.swift b/TIEcommerce/Sources/Models/CartProductPrice.swift new file mode 100644 index 00000000..5047b728 --- /dev/null +++ b/TIEcommerce/Sources/Models/CartProductPrice.swift @@ -0,0 +1,8 @@ +import Foundation + +protocol CartProductPrice { + ///Стоимость + var value: Int { get } + ///Трехсимвольный код валюты в ISO 4217 + var currencyCode: String { get } +} diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec new file mode 100644 index 00000000..fcbb0d88 --- /dev/null +++ b/TIEcommerce/TIEcommerce.podspec @@ -0,0 +1,16 @@ +Pod::Spec.new do |s| + s.name = 'TIEcommerce' + s.version = '1.25.0' + s.summary = 'Cart' + s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name + s.license = { :type => 'MIT', :file => 'LICENSE' } + s.author = { 'petropavel13' => 'ivan.smolin@touchin.ru' } + s.source = { :git => 'https://github.com/TouchInstinct/LeadKit.git', :tag => s.version.to_s } + + s.ios.deployment_target = '13.0' + s.swift_versions = ['5.3'] + + s.source_files = s.name + '/Sources/**/*' + + s.dependency 'TIFoundationUtils', s.version.to_s +end From ea1392f279d7d11343862134f4672f6716fa48cf Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Mon, 1 Aug 2022 08:59:54 +0700 Subject: [PATCH 02/16] fix: package.swift file --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index cff7e790..6eb07f65 100644 --- a/Package.swift +++ b/Package.swift @@ -84,7 +84,7 @@ let package = Package( .target(name: "TIAuth", dependencies: ["TIFoundationUtils"], path: "TIAuth/Sources"), //MARK: - Skolkovo - .target(name: "TIEcommerce", dependencies: ["TIEcommerce"], path: "TIEcommerce/Sources"), + .target(name: "TIEcommerce", path: "TIEcommerce/Sources"), // MARK: - Tests From c92b9bf5631c836e173fdbcfef47151587b55af2 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Mon, 1 Aug 2022 15:17:21 +0700 Subject: [PATCH 03/16] feat: Add CartEditable block --- .../Sources/Cart protocols/CartEditable.swift | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 TIEcommerce/Sources/Cart protocols/CartEditable.swift diff --git a/TIEcommerce/Sources/Cart protocols/CartEditable.swift b/TIEcommerce/Sources/Cart protocols/CartEditable.swift new file mode 100644 index 00000000..c5bb1e99 --- /dev/null +++ b/TIEcommerce/Sources/Cart protocols/CartEditable.swift @@ -0,0 +1,33 @@ +import Foundation + +///Изменение количества единиц товара +/// +///Интерфейс для модели товара с опциональным полем доступного количества товара и применение изменений в интерфейсе модели локальной корзины +protocol ProductCountInCartHolder { + // у тебя массив продуктов с количеством лежит локально, и вот ты его заменяешь на то, что пришло + var countInCart: Int? { get set } +} + +protocol ProductCountInCartDelegate: AnyObject { + func countInCartDidChanged(count: Int, productID: Int) +} + +///Выбор варианта товара +/// +///Интерфейс для модели товара с массивом доступных вариантов и применение изменений в интерфейсе модели локальной корзины. +///Вариант является интерфейсом товара, но конкретная модель может быть другой. +///(Под вариантом подразумевается разная фасовка, цвет, размер и пр. характеристики товара.) +protocol ChoosableProductVariant { + ///Варианты товара (фасовка, цвет, размер, и т.п.) + var variants: [CartProduct] { get } + +} + +///Возможность вернуть товар в корзину +/// +///В интерфейсе локальной корзины должны присуствовать товары, которые были удалены из корзины, но которые можно вернуть. +///При отправке корзины на оформление заказа эти товары не учитываются. +protocol RemovableProductCart { + var removedProducts: [CartProduct] { get set } +} + From 48ac99c7d822a3506c820fad8b6cc6b14daf7afa Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Mon, 1 Aug 2022 19:29:35 +0700 Subject: [PATCH 04/16] feat: Add receipt, cart service --- Package.swift | 2 +- .../Sources/Cart protocols/Receipt.swift | 41 +++++++++++++++++++ TIEcommerce/Sources/Classes/CartService.swift | 38 +++++++++++++++++ .../Classes/IgnoringErrorsRepeatClosure.swift | 5 +++ TIEcommerce/Sources/Models/CartProduct.swift | 2 +- 5 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 TIEcommerce/Sources/Cart protocols/Receipt.swift create mode 100644 TIEcommerce/Sources/Classes/CartService.swift diff --git a/Package.swift b/Package.swift index 6eb07f65..1041d827 100644 --- a/Package.swift +++ b/Package.swift @@ -84,7 +84,7 @@ let package = Package( .target(name: "TIAuth", dependencies: ["TIFoundationUtils"], path: "TIAuth/Sources"), //MARK: - Skolkovo - .target(name: "TIEcommerce", path: "TIEcommerce/Sources"), + .target(name: "TIEcommerce", dependencies: ["TIFoundationUtils"], path: "TIEcommerce/Sources"), // MARK: - Tests diff --git a/TIEcommerce/Sources/Cart protocols/Receipt.swift b/TIEcommerce/Sources/Cart protocols/Receipt.swift new file mode 100644 index 00000000..65b42365 --- /dev/null +++ b/TIEcommerce/Sources/Cart protocols/Receipt.swift @@ -0,0 +1,41 @@ +import Foundation + +///Предварительный расчёт стоимости товаров +/// +///В интерфейсе модели товара должна присуствовать текущая цена исходя из которой можно рассчитать итоговую стоимость всей корзины +protocol ProductPriceHolder { + ///Цена в определённой валюте + var price: CartProductPrice { get } +} + +///Применение промокодов +/// +///В интерфейсе локальной корзины должна присуствовать возможность применения или удаления промокода. Промокодов в корзине может быть несколько. У промокода должно присутсвовать опциональное поле discount, для расчёта скидки в сумме чека. +protocol PromocodesHolder { + var promocodes: [Promocode] { get set } +} + +protocol Promocode { + var discount: CartProductPrice? { get } +} + +///Расчёт бонусов +/// +///В интерфейсе товара должно присуствовать опциональное поле бонусов, которое будет суммироваться для отображения в чеке. +protocol BonusesHolder { + ///Количество бонусов, которые будут начислены при покупке + var bonuses: Int? { get } +} + +///В интерфейсе серверной корзины должно присуствовать опциональное поле с количеством доступных бонусов для использования. +protocol AvailableBonusesHolder { + ///Количество доступных бонусов для использования + var availableBonuses: Int? { get } +} + +///Товары не доступные для заказа +/// +///По аналогии с удалёнными товарами из корзины, товары не доступные для заказа не должны попадать на стадию оформления заказа и не должны расчиываться в общей сумме корзины +protocol NotAvailableProductsHolder { + var notAvailableProducts: [CartProduct] { get set } +} diff --git a/TIEcommerce/Sources/Classes/CartService.swift b/TIEcommerce/Sources/Classes/CartService.swift new file mode 100644 index 00000000..d33df149 --- /dev/null +++ b/TIEcommerce/Sources/Classes/CartService.swift @@ -0,0 +1,38 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +import Foundation +import TIFoundationUtils + +protocol CartPublisher { + func subscribeOnCartChanging(completion: ParameterClosure)) -> Cancellable + func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable +} + +open class CartService: RemovableProductCart, NotAvailableProductsHolder, PromocodesHolder { + open private(set) var localCart: Cart? + open private(set) var removedProducts: [CartProduct] + open private(set) var notAvailableProducts: [CartProduct] + open private(set) var promocodes: [Promocode] + + open func updateCountInCart(for product: CartProduct, count: Int) { } + open func updateCountInCart(for productId: Int, count: Int) { } +} diff --git a/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift b/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift index 8dc92f4d..59e234de 100644 --- a/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift +++ b/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift @@ -5,6 +5,11 @@ class IgnoringErrorsRepeatClosure { private(set) var numberOfAttempts: Int private var ignoringErrors: Set + /* + немного не так, должен быть метод который принимает BaseErrorResponse и associatedType NetworkError и возвращает true если можно попробовать повторить + + ну и closure с запросом в ответ возвращает EndpointErrorResult из TINetworking + */ init(ignoringErrors: Set = [], numberOfAttempts: Int) { self.ignoringErrors = ignoringErrors self.numberOfAttempts = numberOfAttempts diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift index 98f7b251..da6d3113 100644 --- a/TIEcommerce/Sources/Models/CartProduct.swift +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -1,6 +1,6 @@ import Foundation -protocol CartProduct { +protocol CartProduct: ProductPriceHolder, BonusesHolder { ///Идентификатор продукта var id: String { get } ///Цена в определённой валюте From 179a368fe501160ca2756b82fe2c97c43f879914 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Mon, 1 Aug 2022 21:09:49 +0700 Subject: [PATCH 05/16] fix: Delete useless protocols, add cartRequestExecutor --- .../Sources/Cart protocols/CartEditable.swift | 33 --------------- .../Sources/Cart protocols/CartSyncable.swift | 25 ----------- .../Cart protocols/CartUpdatable.swift | 9 ---- .../Sources/Cart protocols/Receipt.swift | 41 ------------------- .../Sources/Classes/CartRequestExecutor.swift | 8 ++++ .../Classes/IgnoringErrorsRepeatClosure.swift | 28 ------------- .../{Classes => Models}/CartService.swift | 40 ++++++++++++++---- .../{CartProductPrice.swift => Price.swift} | 2 +- TIEcommerce/Sources/Models/Promocode.swift | 8 ++++ 9 files changed, 49 insertions(+), 145 deletions(-) delete mode 100644 TIEcommerce/Sources/Cart protocols/CartEditable.swift delete mode 100644 TIEcommerce/Sources/Cart protocols/CartSyncable.swift delete mode 100644 TIEcommerce/Sources/Cart protocols/CartUpdatable.swift delete mode 100644 TIEcommerce/Sources/Cart protocols/Receipt.swift create mode 100644 TIEcommerce/Sources/Classes/CartRequestExecutor.swift delete mode 100644 TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift rename TIEcommerce/Sources/{Classes => Models}/CartService.swift (50%) rename TIEcommerce/Sources/Models/{CartProductPrice.swift => Price.swift} (86%) create mode 100644 TIEcommerce/Sources/Models/Promocode.swift diff --git a/TIEcommerce/Sources/Cart protocols/CartEditable.swift b/TIEcommerce/Sources/Cart protocols/CartEditable.swift deleted file mode 100644 index c5bb1e99..00000000 --- a/TIEcommerce/Sources/Cart protocols/CartEditable.swift +++ /dev/null @@ -1,33 +0,0 @@ -import Foundation - -///Изменение количества единиц товара -/// -///Интерфейс для модели товара с опциональным полем доступного количества товара и применение изменений в интерфейсе модели локальной корзины -protocol ProductCountInCartHolder { - // у тебя массив продуктов с количеством лежит локально, и вот ты его заменяешь на то, что пришло - var countInCart: Int? { get set } -} - -protocol ProductCountInCartDelegate: AnyObject { - func countInCartDidChanged(count: Int, productID: Int) -} - -///Выбор варианта товара -/// -///Интерфейс для модели товара с массивом доступных вариантов и применение изменений в интерфейсе модели локальной корзины. -///Вариант является интерфейсом товара, но конкретная модель может быть другой. -///(Под вариантом подразумевается разная фасовка, цвет, размер и пр. характеристики товара.) -protocol ChoosableProductVariant { - ///Варианты товара (фасовка, цвет, размер, и т.п.) - var variants: [CartProduct] { get } - -} - -///Возможность вернуть товар в корзину -/// -///В интерфейсе локальной корзины должны присуствовать товары, которые были удалены из корзины, но которые можно вернуть. -///При отправке корзины на оформление заказа эти товары не учитываются. -protocol RemovableProductCart { - var removedProducts: [CartProduct] { get set } -} - diff --git a/TIEcommerce/Sources/Cart protocols/CartSyncable.swift b/TIEcommerce/Sources/Cart protocols/CartSyncable.swift deleted file mode 100644 index f0a41232..00000000 --- a/TIEcommerce/Sources/Cart protocols/CartSyncable.swift +++ /dev/null @@ -1,25 +0,0 @@ -import Foundation - -///Содержит абстрактный метод, позволяющий получить на выходе итоговую локальную корзину. Должен поддерживать две стратегии работы: -///- замена локальной корзины серверной `func replace(localCart:, with:) -> CartModelProtocol` -///- слияние локальной корзины с серверной (детали слияния определяются в проекте) `func merge(localCart:, remoteCart:) -> CartModelProtocol` -protocol CartSyncable { - /** - Cлияние локальной корзины с серверной - - Parameters: - - localCart: `Cart` – локальная корзина - - remoteCart: `Cart` – серверная корзина - - Returns: `Cart` – совмещенная корзина - */ - func merge(localCart: Cart, - remoteCart: Cart) -> Cart - /** - Замена локальной корзины серверной - - Parameters: - - localCart: `Cart` – локальная корзина - - remoteCart: `Cart` – серверная корзина - - Returns: `Cart` – серверная корзина - */ - func replace(localCart: Cart, - with remoteCart: Cart) -> Cart -} diff --git a/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift b/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift deleted file mode 100644 index 78c8ad2b..00000000 --- a/TIEcommerce/Sources/Cart protocols/CartUpdatable.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -///Содержит абстрактный метод, позволяющий отправить локальную корзину полностью и получить в ответ серверную корзину -protocol CartUpdatable { - ///Отправляем локальную корзину полностью и получаем в ответ серверную корзину или ошибку - func loadRemoteCart(from localCart: Cart, - successCompletion: ParameterClosure?, - failureCompletion: ParameterClosure?) -} diff --git a/TIEcommerce/Sources/Cart protocols/Receipt.swift b/TIEcommerce/Sources/Cart protocols/Receipt.swift deleted file mode 100644 index 65b42365..00000000 --- a/TIEcommerce/Sources/Cart protocols/Receipt.swift +++ /dev/null @@ -1,41 +0,0 @@ -import Foundation - -///Предварительный расчёт стоимости товаров -/// -///В интерфейсе модели товара должна присуствовать текущая цена исходя из которой можно рассчитать итоговую стоимость всей корзины -protocol ProductPriceHolder { - ///Цена в определённой валюте - var price: CartProductPrice { get } -} - -///Применение промокодов -/// -///В интерфейсе локальной корзины должна присуствовать возможность применения или удаления промокода. Промокодов в корзине может быть несколько. У промокода должно присутсвовать опциональное поле discount, для расчёта скидки в сумме чека. -protocol PromocodesHolder { - var promocodes: [Promocode] { get set } -} - -protocol Promocode { - var discount: CartProductPrice? { get } -} - -///Расчёт бонусов -/// -///В интерфейсе товара должно присуствовать опциональное поле бонусов, которое будет суммироваться для отображения в чеке. -protocol BonusesHolder { - ///Количество бонусов, которые будут начислены при покупке - var bonuses: Int? { get } -} - -///В интерфейсе серверной корзины должно присуствовать опциональное поле с количеством доступных бонусов для использования. -protocol AvailableBonusesHolder { - ///Количество доступных бонусов для использования - var availableBonuses: Int? { get } -} - -///Товары не доступные для заказа -/// -///По аналогии с удалёнными товарами из корзины, товары не доступные для заказа не должны попадать на стадию оформления заказа и не должны расчиываться в общей сумме корзины -protocol NotAvailableProductsHolder { - var notAvailableProducts: [CartProduct] { get set } -} diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift new file mode 100644 index 00000000..a587c7f9 --- /dev/null +++ b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift @@ -0,0 +1,8 @@ +// +// File.swift +// +// +// Created by  Григорий Бойко on 01.08.2022. +// + +import Foundation diff --git a/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift b/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift deleted file mode 100644 index 59e234de..00000000 --- a/TIEcommerce/Sources/Classes/IgnoringErrorsRepeatClosure.swift +++ /dev/null @@ -1,28 +0,0 @@ -import Foundation - -///При получении ошибки из `gnoringErrors` повторение отправки до `numberOfAttempts` раз -class IgnoringErrorsRepeatClosure { - private(set) var numberOfAttempts: Int - private var ignoringErrors: Set - - /* - немного не так, должен быть метод который принимает BaseErrorResponse и associatedType NetworkError и возвращает true если можно попробовать повторить - - ну и closure с запросом в ответ возвращает EndpointErrorResult из TINetworking - */ - init(ignoringErrors: Set = [], numberOfAttempts: Int) { - self.ignoringErrors = ignoringErrors - self.numberOfAttempts = numberOfAttempts - } - - func performIfNeeded(with error: BaseErrorResponseBody, - repeatClosure: VoidClosure, - errorCompletion: ParameterClosure?) { - if ignoringErrors.contains(error) && numberOfAttempts > 0 { - numberOfAttempts -= 1 - repeatClosure() - } else { - errorCompletion?(error) - } - } -} diff --git a/TIEcommerce/Sources/Classes/CartService.swift b/TIEcommerce/Sources/Models/CartService.swift similarity index 50% rename from TIEcommerce/Sources/Classes/CartService.swift rename to TIEcommerce/Sources/Models/CartService.swift index d33df149..a689db37 100644 --- a/TIEcommerce/Sources/Classes/CartService.swift +++ b/TIEcommerce/Sources/Models/CartService.swift @@ -21,18 +21,42 @@ import Foundation import TIFoundationUtils +import TISwiftUtils protocol CartPublisher { - func subscribeOnCartChanging(completion: ParameterClosure)) -> Cancellable + associatedtype Cart + func subscribeOnCartChanging(completion: ParameterClosure) -> Cancellable func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable } -open class CartService: RemovableProductCart, NotAvailableProductsHolder, PromocodesHolder { - open private(set) var localCart: Cart? - open private(set) var removedProducts: [CartProduct] - open private(set) var notAvailableProducts: [CartProduct] - open private(set) var promocodes: [Promocode] +protocol CartService { + var localCart: Cart? { get } + var removedProducts: [CartProduct] { get } + var notAvailableProducts: [CartProduct] { get } + var promocodes: [Promocode] { get } - open func updateCountInCart(for product: CartProduct, count: Int) { } - open func updateCountInCart(for productId: Int, count: Int) { } + func updateCountInCart(for product: CartProduct, count: Int) + func updateCountInCart(for productId: Int, count: Int) + + func loadRemoteCart(from localCart: Cart, + successCompletion: ParameterClosure?, + failureCompletion: ParameterClosure?) + /** + Cлияние локальной корзины с серверной + - Parameters: + - localCart: `Cart` – локальная корзина + - remoteCart: `Cart` – серверная корзина + - Returns: `Cart` – совмещенная корзина + */ + func merge(localCart: Cart, + remoteCart: Cart) -> Cart + /** + Замена локальной корзины серверной + - Parameters: + - localCart: `Cart` – локальная корзина + - remoteCart: `Cart` – серверная корзина + - Returns: `Cart` – серверная корзина + */ + func replace(localCart: Cart, + with remoteCart: Cart) -> Cart } diff --git a/TIEcommerce/Sources/Models/CartProductPrice.swift b/TIEcommerce/Sources/Models/Price.swift similarity index 86% rename from TIEcommerce/Sources/Models/CartProductPrice.swift rename to TIEcommerce/Sources/Models/Price.swift index 5047b728..0e5adf3c 100644 --- a/TIEcommerce/Sources/Models/CartProductPrice.swift +++ b/TIEcommerce/Sources/Models/Price.swift @@ -1,6 +1,6 @@ import Foundation -protocol CartProductPrice { +protocol Price { ///Стоимость var value: Int { get } ///Трехсимвольный код валюты в ISO 4217 diff --git a/TIEcommerce/Sources/Models/Promocode.swift b/TIEcommerce/Sources/Models/Promocode.swift new file mode 100644 index 00000000..a587c7f9 --- /dev/null +++ b/TIEcommerce/Sources/Models/Promocode.swift @@ -0,0 +1,8 @@ +// +// File.swift +// +// +// Created by  Григорий Бойко on 01.08.2022. +// + +import Foundation From 343c40888d1a96de810bf646701d60970a05492d Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Mon, 1 Aug 2022 21:11:39 +0700 Subject: [PATCH 06/16] fix: add actual changes --- Package.swift | 2 +- .../Sources/Classes/CartRequestExecutor.swift | 60 ++++++++++++++++--- .../Models/BaseErrorResponseBody.swift | 6 +- TIEcommerce/Sources/Models/CartProduct.swift | 6 +- TIEcommerce/Sources/Models/Promocode.swift | 11 ++-- TIEcommerce/TIEcommerce.podspec | 4 +- 6 files changed, 66 insertions(+), 23 deletions(-) diff --git a/Package.swift b/Package.swift index 1041d827..0dc55fe0 100644 --- a/Package.swift +++ b/Package.swift @@ -84,7 +84,7 @@ let package = Package( .target(name: "TIAuth", dependencies: ["TIFoundationUtils"], path: "TIAuth/Sources"), //MARK: - Skolkovo - .target(name: "TIEcommerce", dependencies: ["TIFoundationUtils"], path: "TIEcommerce/Sources"), + .target(name: "TIEcommerce", dependencies: ["TIFoundationUtils", "TISwiftUtils", "TINetworking"], path: "TIEcommerce/Sources"), // MARK: - Tests diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift index a587c7f9..8b700d84 100644 --- a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift +++ b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift @@ -1,8 +1,54 @@ -// -// File.swift -// -// -// Created by  Григорий Бойко on 01.08.2022. -// +import TIFoundationUtils +import TINetworking -import Foundation +open class CartRequestExecutor: Cancellable { + public typealias ExecutionCompletion = (EndpointRecoverableRequestResult) -> Void + public typealias ExecutionClosure = (ExecutionCompletion) -> Cancellable + + public typealias SuccessCompletion = (S) -> Void + + private let executionClosure: ExecutionClosure + public var successCompletion: SuccessCompletion + + private var executingRequest: Cancellable? + + public init(executionClosure: @escaping ExecutionClosure, successCompletion: @escaping SuccessCompletion) { + self.executionClosure = executionClosure + self.successCompletion = successCompletion + } + + open func execute() { + executingRequest?.cancel() + + _ = executionClosure { [weak self] in + switch $0 { + case let .success(result): + self?.handle(successResult: result) + case let .failure(errorCollection): + self?.handle(failure: errorCollection) + } + } + } + + open func handle(successResult: S) { + successCompletion(successResult) + } + + open func handle(failure: ErrorCollection>) { + if shouldRetry(failure: failure) && 0 < 3 { + execute() + } + } + + open func shouldRetry(failure: ErrorCollection>) -> Bool { + if case .networkError = failure.failures.first { + return true + } + + return false + } + + open func cancel() { + executingRequest?.cancel() + } +} diff --git a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift index 0ecf98c0..79fd24cf 100644 --- a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift +++ b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift @@ -1,8 +1,8 @@ import Foundation -struct BaseErrorResponseBody: Decodable, Equatable, Hashable { +protocol BaseErrorResponseBody: Decodable, Hashable { ///Код ошибки - let errorCode: Int + var errorCode: Int { get } ///Текст сообщения об ошибке - let errorMessage: String + var errorMessage: String { get } } diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift index da6d3113..06b7b976 100644 --- a/TIEcommerce/Sources/Models/CartProduct.swift +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -1,14 +1,14 @@ import Foundation -protocol CartProduct: ProductPriceHolder, BonusesHolder { +protocol CartProduct { ///Идентификатор продукта var id: String { get } ///Цена в определённой валюте - var price: CartProductPrice { get } + var price: Price { get } ///Сколько единиц есть доступно var availableCount: Int? { get } ///Варианты товара (фасовка, цвет, размер, и т.п.) - var variants: [CartProduct?] { get } + var variants: [CartProduct] { get } ///Количество бонусов, которые будут начислены при покупке var bonuses: Int? { get } } diff --git a/TIEcommerce/Sources/Models/Promocode.swift b/TIEcommerce/Sources/Models/Promocode.swift index a587c7f9..9a0896d0 100644 --- a/TIEcommerce/Sources/Models/Promocode.swift +++ b/TIEcommerce/Sources/Models/Promocode.swift @@ -1,8 +1,5 @@ -// -// File.swift -// -// -// Created by  Григорий Бойко on 01.08.2022. -// - import Foundation + +protocol Promocode { + var discount: Price? { get } +} diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index fcbb0d88..becd7e54 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,13 +1,13 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' s.version = '1.25.0' - s.summary = 'Cart' + s.summary = 'Cart, products, promocodes, bonuses, receipt and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'petropavel13' => 'ivan.smolin@touchin.ru' } s.source = { :git => 'https://github.com/TouchInstinct/LeadKit.git', :tag => s.version.to_s } - s.ios.deployment_target = '13.0' + s.ios.deployment_target = '10.0' s.swift_versions = ['5.3'] s.source_files = s.name + '/Sources/**/*' From eb66a4e8caa7bc57c1037493e262c71c2258578f Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 11:38:35 +0700 Subject: [PATCH 07/16] fix: Comments from pull request --- .../Sources/Classes/CartRequestExecutor.swift | 32 ++++++++++++++++-- .../Models/BaseErrorResponseBody.swift | 23 ++++++++++++- TIEcommerce/Sources/Models/Cart.swift | 23 ++++++++++++- TIEcommerce/Sources/Models/CartProduct.swift | 23 ++++++++++++- TIEcommerce/Sources/Models/CartService.swift | 33 +++++++++---------- TIEcommerce/Sources/Models/Price.swift | 23 ++++++++++++- TIEcommerce/Sources/Models/Promocode.swift | 23 ++++++++++++- 7 files changed, 155 insertions(+), 25 deletions(-) diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift index 8b700d84..e37e53e2 100644 --- a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift +++ b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift @@ -1,3 +1,24 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import TIFoundationUtils import TINetworking @@ -11,16 +32,20 @@ open class CartRequestExecutor: Cancellable { public var successCompletion: SuccessCompletion private var executingRequest: Cancellable? + private var numberOfAttempts: Int - public init(executionClosure: @escaping ExecutionClosure, successCompletion: @escaping SuccessCompletion) { + public init(executionClosure: @escaping ExecutionClosure, + successCompletion: @escaping SuccessCompletion, + numberOfAttempts: Int = 3) { self.executionClosure = executionClosure self.successCompletion = successCompletion + self.numberOfAttempts = numberOfAttempts } open func execute() { executingRequest?.cancel() - _ = executionClosure { [weak self] in + executingRequest = executionClosure { [weak self] in switch $0 { case let .success(result): self?.handle(successResult: result) @@ -35,7 +60,8 @@ open class CartRequestExecutor: Cancellable { } open func handle(failure: ErrorCollection>) { - if shouldRetry(failure: failure) && 0 < 3 { + if shouldRetry(failure: failure) && numberOfAttempts > 0 { + numberOfAttempts -= 1 execute() } } diff --git a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift index 79fd24cf..541b79a2 100644 --- a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift +++ b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift @@ -1,6 +1,27 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import Foundation -protocol BaseErrorResponseBody: Decodable, Hashable { +public protocol BaseErrorResponseBody: Decodable, Hashable { ///Код ошибки var errorCode: Int { get } ///Текст сообщения об ошибке diff --git a/TIEcommerce/Sources/Models/Cart.swift b/TIEcommerce/Sources/Models/Cart.swift index 3e67416e..86aaeb9c 100644 --- a/TIEcommerce/Sources/Models/Cart.swift +++ b/TIEcommerce/Sources/Models/Cart.swift @@ -1,6 +1,27 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import Foundation -protocol Cart { +public protocol Cart { ///Продукты в корзине пользователя var products: [CartProduct] { get } ///Применённые промокоды diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift index 06b7b976..8c3873bb 100644 --- a/TIEcommerce/Sources/Models/CartProduct.swift +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -1,6 +1,27 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import Foundation -protocol CartProduct { +public protocol CartProduct { ///Идентификатор продукта var id: String { get } ///Цена в определённой валюте diff --git a/TIEcommerce/Sources/Models/CartService.swift b/TIEcommerce/Sources/Models/CartService.swift index a689db37..ebee1948 100644 --- a/TIEcommerce/Sources/Models/CartService.swift +++ b/TIEcommerce/Sources/Models/CartService.swift @@ -23,23 +23,19 @@ import Foundation import TIFoundationUtils import TISwiftUtils -protocol CartPublisher { - associatedtype Cart - func subscribeOnCartChanging(completion: ParameterClosure) -> Cancellable - func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable -} - -protocol CartService { - var localCart: Cart? { get } - var removedProducts: [CartProduct] { get } - var notAvailableProducts: [CartProduct] { get } +public protocol CartService { + associatedtype CartType: Cart + associatedtype CartProductType: CartProduct + + var localCart: CartType? { get } + var removedProducts: [CartProductType] { get } + var notAvailableProducts: [CartProductType] { get } var promocodes: [Promocode] { get } - func updateCountInCart(for product: CartProduct, count: Int) + func updateCountInCart(for product: CartProductType, count: Int) func updateCountInCart(for productId: Int, count: Int) - func loadRemoteCart(from localCart: Cart, - successCompletion: ParameterClosure?, + func loadRemoteCart(successCompletion: ParameterClosure?, failureCompletion: ParameterClosure?) /** Cлияние локальной корзины с серверной @@ -48,8 +44,8 @@ protocol CartService { - remoteCart: `Cart` – серверная корзина - Returns: `Cart` – совмещенная корзина */ - func merge(localCart: Cart, - remoteCart: Cart) -> Cart + func merge(localCart: CartType, + remoteCart: CartType) -> CartType /** Замена локальной корзины серверной - Parameters: @@ -57,6 +53,9 @@ protocol CartService { - remoteCart: `Cart` – серверная корзина - Returns: `Cart` – серверная корзина */ - func replace(localCart: Cart, - with remoteCart: Cart) -> Cart + func replace(localCart: CartType, + with remoteCart: CartType) -> CartType + + func subscribeOnCartChanging(completion: ParameterClosure) -> Cancellable + func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable } diff --git a/TIEcommerce/Sources/Models/Price.swift b/TIEcommerce/Sources/Models/Price.swift index 0e5adf3c..e94558d6 100644 --- a/TIEcommerce/Sources/Models/Price.swift +++ b/TIEcommerce/Sources/Models/Price.swift @@ -1,6 +1,27 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import Foundation -protocol Price { +public protocol Price { ///Стоимость var value: Int { get } ///Трехсимвольный код валюты в ISO 4217 diff --git a/TIEcommerce/Sources/Models/Promocode.swift b/TIEcommerce/Sources/Models/Promocode.swift index 9a0896d0..58ab9faa 100644 --- a/TIEcommerce/Sources/Models/Promocode.swift +++ b/TIEcommerce/Sources/Models/Promocode.swift @@ -1,5 +1,26 @@ +// +// Copyright (c) 2022 Touch Instinct +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the Software), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + import Foundation -protocol Promocode { +public protocol Promocode { var discount: Price? { get } } From d5479f745c2b7916dd9220c7e62f37473d2d494a Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 12:18:09 +0700 Subject: [PATCH 08/16] feat: Add promocodes and bonuses logic --- TIEcommerce/Sources/Models/CartService.swift | 31 ++++++++++++++++---- 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/TIEcommerce/Sources/Models/CartService.swift b/TIEcommerce/Sources/Models/CartService.swift index ebee1948..baf29b08 100644 --- a/TIEcommerce/Sources/Models/CartService.swift +++ b/TIEcommerce/Sources/Models/CartService.swift @@ -30,32 +30,51 @@ public protocol CartService { var localCart: CartType? { get } var removedProducts: [CartProductType] { get } var notAvailableProducts: [CartProductType] { get } + ///Примененные промокоды var promocodes: [Promocode] { get } + ///Примененные бонусы + var appliedBonuses: Int? { get } + //MARK: - Work with products func updateCountInCart(for product: CartProductType, count: Int) func updateCountInCart(for productId: Int, count: Int) + ///Возможность вернуть товар в корзину + func recoverProductBy(id: Int) + + //MARK: - Work with promocodes + ///Применить какой-нибудь промокод + func applyPromocode(_ promocode: String, + successCompletion: ParameterClosure?, + failureCompletion: ParameterClosure?) + ///Удалить примененный промокод + func removePromocode(_ promocode: String, + successCompletion: ParameterClosure?, + failureCompletion: ParameterClosure?) + + //MARK: - Network func loadRemoteCart(successCompletion: ParameterClosure?, failureCompletion: ParameterClosure?) + + //MARK: - Work with local cart /** Cлияние локальной корзины с серверной - Parameters: - - localCart: `Cart` – локальная корзина - remoteCart: `Cart` – серверная корзина - Returns: `Cart` – совмещенная корзина */ - func merge(localCart: CartType, - remoteCart: CartType) -> CartType + func mergeLocalCart(with remoteCart: CartType) -> CartType /** Замена локальной корзины серверной - Parameters: - - localCart: `Cart` – локальная корзина - remoteCart: `Cart` – серверная корзина - Returns: `Cart` – серверная корзина */ - func replace(localCart: CartType, - with remoteCart: CartType) -> CartType + func replaceLocalCart(with remoteCart: CartType) -> CartType + //MARK: - Subscribe on changes + ///Подписаться на изменение корзины func subscribeOnCartChanging(completion: ParameterClosure) -> Cancellable + //Подписаться на изменение продукта по ID func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable } From 1db3bdb9444c19c81f0ac531a7eec7974c24eb52 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 16:21:00 +0700 Subject: [PATCH 09/16] feat: Update podspec to 1.27, small models changes --- LeadKit.podspec | 2 +- TIAppleMapUtils/TIAppleMapUtils.podspec | 2 +- TIAuth/TIAuth.podspec | 2 +- .../Sources/Classes/CartRequestExecutor.swift | 10 +++---- .../Models/BaseErrorResponseBody.swift | 2 +- TIEcommerce/Sources/Models/Cart.swift | 2 +- TIEcommerce/Sources/Models/CartProduct.swift | 2 +- TIEcommerce/Sources/Models/CartService.swift | 12 ++++---- TIEcommerce/Sources/Models/Price.swift | 29 ------------------- TIEcommerce/Sources/Models/Promocode.swift | 3 +- TIEcommerce/TIEcommerce.podspec | 2 +- TIFoundationUtils/TIFoundationUtils.podspec | 2 +- TIGoogleMapUtils/TIGoogleMapUtils.podspec | 2 +- TIKeychainUtils/TIKeychainUtils.podspec | 2 +- TIMapUtils/TIMapUtils.podspec | 2 +- TIMoyaNetworking/TIMoyaNetworking.podspec | 2 +- TINetworking/TINetworking.podspec | 2 +- TINetworkingCache/TINetworkingCache.podspec | 2 +- TIPagination/TIPagination.podspec | 2 +- TISwiftUICore/TISwiftUICore.podspec | 2 +- TISwiftUtils/TISwiftUtils.podspec | 2 +- TITableKitUtils/TITableKitUtils.podspec | 2 +- TITransitions/TITransitions.podspec | 2 +- TIUIElements/TIUIElements.podspec | 2 +- TIUIKitCore/TIUIKitCore.podspec | 2 +- TIYandexMapUtils/TIYandexMapUtils.podspec | 2 +- 26 files changed, 34 insertions(+), 64 deletions(-) delete mode 100644 TIEcommerce/Sources/Models/Price.swift diff --git a/LeadKit.podspec b/LeadKit.podspec index 336bb65a..f2a981bd 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "1.25.0" + s.version = "1.27" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index 6abd13a9..ebbd201b 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIAuth/TIAuth.podspec b/TIAuth/TIAuth.podspec index d8652513..abc1035e 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Login, registration, confirmation and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift index e37e53e2..0dccc3a1 100644 --- a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift +++ b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift @@ -32,14 +32,14 @@ open class CartRequestExecutor: Cancellable { public var successCompletion: SuccessCompletion private var executingRequest: Cancellable? - private var numberOfAttempts: Int + private var attemptsLeft: Int public init(executionClosure: @escaping ExecutionClosure, successCompletion: @escaping SuccessCompletion, - numberOfAttempts: Int = 3) { + attemptsLeft: Int = 3) { self.executionClosure = executionClosure self.successCompletion = successCompletion - self.numberOfAttempts = numberOfAttempts + self.attemptsLeft = attemptsLeft } open func execute() { @@ -60,8 +60,8 @@ open class CartRequestExecutor: Cancellable { } open func handle(failure: ErrorCollection>) { - if shouldRetry(failure: failure) && numberOfAttempts > 0 { - numberOfAttempts -= 1 + if shouldRetry(failure: failure) && attemptsLeft > 0 { + attemptsLeft -= 1 execute() } } diff --git a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift index 541b79a2..9600e880 100644 --- a/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift +++ b/TIEcommerce/Sources/Models/BaseErrorResponseBody.swift @@ -21,7 +21,7 @@ import Foundation -public protocol BaseErrorResponseBody: Decodable, Hashable { +public protocol BaseErrorResponseBody { ///Код ошибки var errorCode: Int { get } ///Текст сообщения об ошибке diff --git a/TIEcommerce/Sources/Models/Cart.swift b/TIEcommerce/Sources/Models/Cart.swift index 86aaeb9c..6f294719 100644 --- a/TIEcommerce/Sources/Models/Cart.swift +++ b/TIEcommerce/Sources/Models/Cart.swift @@ -25,7 +25,7 @@ public protocol Cart { ///Продукты в корзине пользователя var products: [CartProduct] { get } ///Применённые промокоды - var promocodes: [String] { get } + var promocodes: [Promocode] { get } ///Количество доступных бонусов для использования var availableBonuses: Int? { get } } diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift index 8c3873bb..e4bac41e 100644 --- a/TIEcommerce/Sources/Models/CartProduct.swift +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -25,7 +25,7 @@ public protocol CartProduct { ///Идентификатор продукта var id: String { get } ///Цена в определённой валюте - var price: Price { get } + var price: Int { get } ///Сколько единиц есть доступно var availableCount: Int? { get } ///Варианты товара (фасовка, цвет, размер, и т.п.) diff --git a/TIEcommerce/Sources/Models/CartService.swift b/TIEcommerce/Sources/Models/CartService.swift index baf29b08..ec8f449b 100644 --- a/TIEcommerce/Sources/Models/CartService.swift +++ b/TIEcommerce/Sources/Models/CartService.swift @@ -30,20 +30,18 @@ public protocol CartService { var localCart: CartType? { get } var removedProducts: [CartProductType] { get } var notAvailableProducts: [CartProductType] { get } - ///Примененные промокоды - var promocodes: [Promocode] { get } ///Примененные бонусы var appliedBonuses: Int? { get } //MARK: - Work with products func updateCountInCart(for product: CartProductType, count: Int) - func updateCountInCart(for productId: Int, count: Int) + func updateCountInCart(for productId: String, count: Int) ///Возможность вернуть товар в корзину - func recoverProductBy(id: Int) + func recoverProductBy(id: String) //MARK: - Work with promocodes - ///Применить какой-нибудь промокод + ///Применить промокод func applyPromocode(_ promocode: String, successCompletion: ParameterClosure?, failureCompletion: ParameterClosure?) @@ -75,6 +73,6 @@ public protocol CartService { //MARK: - Subscribe on changes ///Подписаться на изменение корзины func subscribeOnCartChanging(completion: ParameterClosure) -> Cancellable - //Подписаться на изменение продукта по ID - func subscribeOnProductChanging(productId: Int, completion: ParameterClosure) -> Cancellable + ///Подписаться на изменение продукта по ID + func subscribeOnProductChanging(productId: String, completion: ParameterClosure) -> Cancellable } diff --git a/TIEcommerce/Sources/Models/Price.swift b/TIEcommerce/Sources/Models/Price.swift deleted file mode 100644 index e94558d6..00000000 --- a/TIEcommerce/Sources/Models/Price.swift +++ /dev/null @@ -1,29 +0,0 @@ -// -// Copyright (c) 2022 Touch Instinct -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the Software), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. - -import Foundation - -public protocol Price { - ///Стоимость - var value: Int { get } - ///Трехсимвольный код валюты в ISO 4217 - var currencyCode: String { get } -} diff --git a/TIEcommerce/Sources/Models/Promocode.swift b/TIEcommerce/Sources/Models/Promocode.swift index 58ab9faa..9ad5ed9f 100644 --- a/TIEcommerce/Sources/Models/Promocode.swift +++ b/TIEcommerce/Sources/Models/Promocode.swift @@ -22,5 +22,6 @@ import Foundation public protocol Promocode { - var discount: Price? { get } + var code: String { get } + var discount: Int? { get } } diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index becd7e54..0751e8f3 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Cart, products, promocodes, bonuses, receipt and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIFoundationUtils/TIFoundationUtils.podspec b/TIFoundationUtils/TIFoundationUtils.podspec index 810a7f45..96851218 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for Foundation framework classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIGoogleMapUtils/TIGoogleMapUtils.podspec b/TIGoogleMapUtils/TIGoogleMapUtils.podspec index 790c4dd8..7dcb60d5 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIKeychainUtils/TIKeychainUtils.podspec b/TIKeychainUtils/TIKeychainUtils.podspec index 39854a47..f6b2e1e9 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for Keychain classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMapUtils/TIMapUtils.podspec b/TIMapUtils/TIMapUtils.podspec index a1a7209e..f9a311d0 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for map objects clustering and interacting.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMoyaNetworking/TIMoyaNetworking.podspec b/TIMoyaNetworking/TIMoyaNetworking.podspec index dc0a75de..c33a5086 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Moya + Swagger network service.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworking/TINetworking.podspec b/TINetworking/TINetworking.podspec index 21b43ccc..edeb8160 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Swagger-frendly networking layer helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworkingCache/TINetworkingCache.podspec b/TINetworkingCache/TINetworkingCache.podspec index c6fa6d8c..010d4d98 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Caching results of EndpointRequests.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIPagination/TIPagination.podspec b/TIPagination/TIPagination.podspec index 09bb506a..2e9a2946 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Generic pagination component.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUICore/TISwiftUICore.podspec b/TISwiftUICore/TISwiftUICore.podspec index ef648a77..b3a99ac9 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Core UI elements: protocols, views and helpers..' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUtils/TISwiftUtils.podspec b/TISwiftUtils/TISwiftUtils.podspec index 97617f0c..8fb7ae49 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Bunch of useful helpers for Swift development.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITableKitUtils/TITableKitUtils.podspec b/TITableKitUtils/TITableKitUtils.podspec index ccc38b69..5266a9ab 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for TableKit classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITransitions/TITransitions.podspec b/TITransitions/TITransitions.podspec index b8d87899..957d2b0a 100644 --- a/TITransitions/TITransitions.podspec +++ b/TITransitions/TITransitions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITransitions' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of custom transitions to present controller. ' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index cef0fd05..89988d44 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Bunch of useful protocols and views.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIKitCore/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index 89449881..e944c129 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Core UI elements: protocols, views and helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIYandexMapUtils/TIYandexMapUtils.podspec b/TIYandexMapUtils/TIYandexMapUtils.podspec index bff21073..41926ac0 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.25.0' + s.version = '1.27' s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } From 8cfd3b466c3680ef1096cd746ea0be07141d0500 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 17:08:03 +0700 Subject: [PATCH 10/16] fix: Remove optional for cart --- TIEcommerce/Sources/Models/CartService.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TIEcommerce/Sources/Models/CartService.swift b/TIEcommerce/Sources/Models/CartService.swift index ec8f449b..51311355 100644 --- a/TIEcommerce/Sources/Models/CartService.swift +++ b/TIEcommerce/Sources/Models/CartService.swift @@ -27,7 +27,7 @@ public protocol CartService { associatedtype CartType: Cart associatedtype CartProductType: CartProduct - var localCart: CartType? { get } + var localCart: CartType { get } var removedProducts: [CartProductType] { get } var notAvailableProducts: [CartProductType] { get } ///Примененные бонусы From 50d59857a79a3758d9072ac118d62359963c2b0a Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 21:41:45 +0700 Subject: [PATCH 11/16] fix: change podspec to 1.27.0 --- LeadKit.podspec | 2 +- TIAppleMapUtils/TIAppleMapUtils.podspec | 2 +- TIAuth/TIAuth.podspec | 2 +- TIEcommerce/Sources/Classes/CartRequestExecutor.swift | 5 +++-- TIEcommerce/TIEcommerce.podspec | 2 +- TIFoundationUtils/TIFoundationUtils.podspec | 2 +- TIGoogleMapUtils/TIGoogleMapUtils.podspec | 2 +- TIKeychainUtils/TIKeychainUtils.podspec | 2 +- TIMapUtils/TIMapUtils.podspec | 2 +- TIMoyaNetworking/TIMoyaNetworking.podspec | 2 +- TINetworking/TINetworking.podspec | 2 +- TINetworkingCache/TINetworkingCache.podspec | 2 +- TIPagination/TIPagination.podspec | 2 +- TISwiftUICore/TISwiftUICore.podspec | 2 +- TISwiftUtils/TISwiftUtils.podspec | 2 +- TITableKitUtils/TITableKitUtils.podspec | 2 +- TITransitions/TITransitions.podspec | 2 +- TIUIElements/TIUIElements.podspec | 2 +- TIUIKitCore/TIUIKitCore.podspec | 2 +- TIYandexMapUtils/TIYandexMapUtils.podspec | 2 +- 20 files changed, 22 insertions(+), 21 deletions(-) diff --git a/LeadKit.podspec b/LeadKit.podspec index f2a981bd..28b0aa87 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "1.27" + s.version = "1.27.0" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index ebbd201b..f857ab3f 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIAuth/TIAuth.podspec b/TIAuth/TIAuth.podspec index abc1035e..f68d6ff7 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Login, registration, confirmation and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift index 0dccc3a1..44361c6d 100644 --- a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift +++ b/TIEcommerce/Sources/Classes/CartRequestExecutor.swift @@ -36,10 +36,11 @@ open class CartRequestExecutor: Cancellable { public init(executionClosure: @escaping ExecutionClosure, successCompletion: @escaping SuccessCompletion, - attemptsLeft: Int = 3) { + numberOfAttempts: Int = 3) { + self.executionClosure = executionClosure self.successCompletion = successCompletion - self.attemptsLeft = attemptsLeft + self.attemptsLeft = numberOfAttempts } open func execute() { diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index 0751e8f3..e513faf0 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Cart, products, promocodes, bonuses, receipt and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIFoundationUtils/TIFoundationUtils.podspec b/TIFoundationUtils/TIFoundationUtils.podspec index 96851218..035a2433 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for Foundation framework classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIGoogleMapUtils/TIGoogleMapUtils.podspec b/TIGoogleMapUtils/TIGoogleMapUtils.podspec index 7dcb60d5..752ffe82 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIKeychainUtils/TIKeychainUtils.podspec b/TIKeychainUtils/TIKeychainUtils.podspec index f6b2e1e9..8e778bb4 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for Keychain classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMapUtils/TIMapUtils.podspec b/TIMapUtils/TIMapUtils.podspec index f9a311d0..67345fd0 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for map objects clustering and interacting.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMoyaNetworking/TIMoyaNetworking.podspec b/TIMoyaNetworking/TIMoyaNetworking.podspec index c33a5086..e0a634e1 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Moya + Swagger network service.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworking/TINetworking.podspec b/TINetworking/TINetworking.podspec index edeb8160..20132c74 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Swagger-frendly networking layer helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworkingCache/TINetworkingCache.podspec b/TINetworkingCache/TINetworkingCache.podspec index 010d4d98..8dc517e2 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Caching results of EndpointRequests.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIPagination/TIPagination.podspec b/TIPagination/TIPagination.podspec index 2e9a2946..ac599fa7 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Generic pagination component.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUICore/TISwiftUICore.podspec b/TISwiftUICore/TISwiftUICore.podspec index b3a99ac9..64e3a7a0 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Core UI elements: protocols, views and helpers..' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUtils/TISwiftUtils.podspec b/TISwiftUtils/TISwiftUtils.podspec index 8fb7ae49..a428cafe 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Bunch of useful helpers for Swift development.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITableKitUtils/TITableKitUtils.podspec b/TITableKitUtils/TITableKitUtils.podspec index 5266a9ab..67120a39 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for TableKit classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITransitions/TITransitions.podspec b/TITransitions/TITransitions.podspec index 957d2b0a..c580421c 100644 --- a/TITransitions/TITransitions.podspec +++ b/TITransitions/TITransitions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITransitions' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of custom transitions to present controller. ' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 89988d44..1d7ed3ee 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Bunch of useful protocols and views.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIKitCore/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index e944c129..dfa3cc61 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Core UI elements: protocols, views and helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIYandexMapUtils/TIYandexMapUtils.podspec b/TIYandexMapUtils/TIYandexMapUtils.podspec index 41926ac0..f11d9032 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.27' + s.version = '1.27.0' s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } From b57f2058129b2ca7a9068e83b22ea5f604003a31 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 22:08:44 +0700 Subject: [PATCH 12/16] feat: add TINetworking dependency --- TIEcommerce/TIEcommerce.podspec | 1 + 1 file changed, 1 insertion(+) diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index e513faf0..493ebd95 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -13,4 +13,5 @@ Pod::Spec.new do |s| s.source_files = s.name + '/Sources/**/*' s.dependency 'TIFoundationUtils', s.version.to_s + s.dependency 'TINetworking', s.version.to_s end From 28126dae4b3ff0555289efac6221fbad1e641c97 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 22:14:38 +0700 Subject: [PATCH 13/16] feat: edit changelog and podspec summary --- CHANGELOG.md | 4 ++++ TIEcommerce/TIEcommerce.podspec | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 975c1300..cf225fbd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +### 1.27.0 + +- **Add**: Cart, products, promocodes, bonuses and other related actions + ### 1.25.0 - **Update**: `RequestError` cases now contain additional url assotiated value diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index 493ebd95..6aa4922b 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' s.version = '1.27.0' - s.summary = 'Cart, products, promocodes, bonuses, receipt and other related actions' + s.summary = 'Cart, products, promocodes, bonuses and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } s.author = { 'petropavel13' => 'ivan.smolin@touchin.ru' } From 651892d18201adefd7bc550b7c02f20dde3e78d7 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Tue, 2 Aug 2022 22:16:37 +0700 Subject: [PATCH 14/16] fix: edit changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf225fbd..1b25c7f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ### 1.27.0 -- **Add**: Cart, products, promocodes, bonuses and other related actions +- **Add**: `TIEcommerce` module with Cart, products, promocodes, bonuses and other related actions. ### 1.25.0 From 617ebbfde174bc6cc6065e835e9142fe19aa63f1 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Wed, 3 Aug 2022 16:33:48 +0700 Subject: [PATCH 15/16] fix: Comments from pull request --- .../{CartRequestExecutor.swift => RequestExecutor.swift} | 9 ++++----- TIEcommerce/Sources/Models/CartProduct.swift | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) rename TIEcommerce/Sources/Classes/{CartRequestExecutor.swift => RequestExecutor.swift} (96%) diff --git a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift b/TIEcommerce/Sources/Classes/RequestExecutor.swift similarity index 96% rename from TIEcommerce/Sources/Classes/CartRequestExecutor.swift rename to TIEcommerce/Sources/Classes/RequestExecutor.swift index 44361c6d..45df5c0a 100644 --- a/TIEcommerce/Sources/Classes/CartRequestExecutor.swift +++ b/TIEcommerce/Sources/Classes/RequestExecutor.swift @@ -22,17 +22,16 @@ import TIFoundationUtils import TINetworking -open class CartRequestExecutor: Cancellable { +open class RequestExecutor: Cancellable { public typealias ExecutionCompletion = (EndpointRecoverableRequestResult) -> Void public typealias ExecutionClosure = (ExecutionCompletion) -> Cancellable - public typealias SuccessCompletion = (S) -> Void private let executionClosure: ExecutionClosure - public var successCompletion: SuccessCompletion - private var executingRequest: Cancellable? private var attemptsLeft: Int + + public var successCompletion: SuccessCompletion public init(executionClosure: @escaping ExecutionClosure, successCompletion: @escaping SuccessCompletion, @@ -44,7 +43,7 @@ open class CartRequestExecutor: Cancellable { } open func execute() { - executingRequest?.cancel() + cancel() executingRequest = executionClosure { [weak self] in switch $0 { diff --git a/TIEcommerce/Sources/Models/CartProduct.swift b/TIEcommerce/Sources/Models/CartProduct.swift index e4bac41e..e64a61dc 100644 --- a/TIEcommerce/Sources/Models/CartProduct.swift +++ b/TIEcommerce/Sources/Models/CartProduct.swift @@ -26,7 +26,7 @@ public protocol CartProduct { var id: String { get } ///Цена в определённой валюте var price: Int { get } - ///Сколько единиц есть доступно + ///Количество доступных единиц var availableCount: Int? { get } ///Варианты товара (фасовка, цвет, размер, и т.п.) var variants: [CartProduct] { get } From b7b95f0ef433b9819eeb80c7ae353af2ebb07698 Mon Sep 17 00:00:00 2001 From: Grigory Boyko Date: Wed, 3 Aug 2022 22:14:30 +0700 Subject: [PATCH 16/16] feat: change version --- CHANGELOG.md | 2 +- LeadKit.podspec | 2 +- TIAppleMapUtils/TIAppleMapUtils.podspec | 2 +- TIAuth/TIAuth.podspec | 2 +- TIEcommerce/TIEcommerce.podspec | 2 +- TIFoundationUtils/TIFoundationUtils.podspec | 2 +- TIGoogleMapUtils/TIGoogleMapUtils.podspec | 2 +- TIKeychainUtils/TIKeychainUtils.podspec | 2 +- TIMapUtils/TIMapUtils.podspec | 2 +- TIMoyaNetworking/TIMoyaNetworking.podspec | 2 +- TINetworking/TINetworking.podspec | 2 +- TINetworkingCache/TINetworkingCache.podspec | 2 +- TIPagination/TIPagination.podspec | 2 +- TISwiftUICore/TISwiftUICore.podspec | 2 +- TISwiftUtils/TISwiftUtils.podspec | 2 +- TITableKitUtils/TITableKitUtils.podspec | 2 +- TITransitions/TITransitions.podspec | 2 +- TIUIElements/TIUIElements.podspec | 2 +- TIUIKitCore/TIUIKitCore.podspec | 2 +- TIYandexMapUtils/TIYandexMapUtils.podspec | 2 +- 20 files changed, 20 insertions(+), 20 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b25c7f0..a52570d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -### 1.27.0 +### 1.26.0 - **Add**: `TIEcommerce` module with Cart, products, promocodes, bonuses and other related actions. diff --git a/LeadKit.podspec b/LeadKit.podspec index 28b0aa87..73d7a3ad 100644 --- a/LeadKit.podspec +++ b/LeadKit.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = "LeadKit" - s.version = "1.27.0" + s.version = "1.26.0" s.summary = "iOS framework with a bunch of tools for rapid development" s.homepage = "https://github.com/TouchInstinct/LeadKit" s.license = "Apache License, Version 2.0" diff --git a/TIAppleMapUtils/TIAppleMapUtils.podspec b/TIAppleMapUtils/TIAppleMapUtils.podspec index f857ab3f..d91b18ad 100644 --- a/TIAppleMapUtils/TIAppleMapUtils.podspec +++ b/TIAppleMapUtils/TIAppleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAppleMapUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIAuth/TIAuth.podspec b/TIAuth/TIAuth.podspec index f68d6ff7..82232708 100644 --- a/TIAuth/TIAuth.podspec +++ b/TIAuth/TIAuth.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIAuth' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Login, registration, confirmation and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIEcommerce/TIEcommerce.podspec b/TIEcommerce/TIEcommerce.podspec index 6aa4922b..7d799182 100644 --- a/TIEcommerce/TIEcommerce.podspec +++ b/TIEcommerce/TIEcommerce.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIEcommerce' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Cart, products, promocodes, bonuses and other related actions' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIFoundationUtils/TIFoundationUtils.podspec b/TIFoundationUtils/TIFoundationUtils.podspec index 035a2433..dcd13a5d 100644 --- a/TIFoundationUtils/TIFoundationUtils.podspec +++ b/TIFoundationUtils/TIFoundationUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIFoundationUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for Foundation framework classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIGoogleMapUtils/TIGoogleMapUtils.podspec b/TIGoogleMapUtils/TIGoogleMapUtils.podspec index 752ffe82..7f2f1f87 100644 --- a/TIGoogleMapUtils/TIGoogleMapUtils.podspec +++ b/TIGoogleMapUtils/TIGoogleMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIGoogleMapUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIKeychainUtils/TIKeychainUtils.podspec b/TIKeychainUtils/TIKeychainUtils.podspec index 8e778bb4..e3882911 100644 --- a/TIKeychainUtils/TIKeychainUtils.podspec +++ b/TIKeychainUtils/TIKeychainUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIKeychainUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for Keychain classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMapUtils/TIMapUtils.podspec b/TIMapUtils/TIMapUtils.podspec index 67345fd0..84eb2fe3 100644 --- a/TIMapUtils/TIMapUtils.podspec +++ b/TIMapUtils/TIMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMapUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for map objects clustering and interacting.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIMoyaNetworking/TIMoyaNetworking.podspec b/TIMoyaNetworking/TIMoyaNetworking.podspec index e0a634e1..dcd00647 100644 --- a/TIMoyaNetworking/TIMoyaNetworking.podspec +++ b/TIMoyaNetworking/TIMoyaNetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIMoyaNetworking' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Moya + Swagger network service.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworking/TINetworking.podspec b/TINetworking/TINetworking.podspec index 20132c74..056d5d3e 100644 --- a/TINetworking/TINetworking.podspec +++ b/TINetworking/TINetworking.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworking' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Swagger-frendly networking layer helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TINetworkingCache/TINetworkingCache.podspec b/TINetworkingCache/TINetworkingCache.podspec index 8dc517e2..4aaf3ecd 100644 --- a/TINetworkingCache/TINetworkingCache.podspec +++ b/TINetworkingCache/TINetworkingCache.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TINetworkingCache' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Caching results of EndpointRequests.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIPagination/TIPagination.podspec b/TIPagination/TIPagination.podspec index ac599fa7..ecfd469c 100644 --- a/TIPagination/TIPagination.podspec +++ b/TIPagination/TIPagination.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIPagination' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Generic pagination component.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUICore/TISwiftUICore.podspec b/TISwiftUICore/TISwiftUICore.podspec index 64e3a7a0..f02f9b8e 100644 --- a/TISwiftUICore/TISwiftUICore.podspec +++ b/TISwiftUICore/TISwiftUICore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUICore' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Core UI elements: protocols, views and helpers..' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TISwiftUtils/TISwiftUtils.podspec b/TISwiftUtils/TISwiftUtils.podspec index a428cafe..a1a3a852 100644 --- a/TISwiftUtils/TISwiftUtils.podspec +++ b/TISwiftUtils/TISwiftUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TISwiftUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Bunch of useful helpers for Swift development.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITableKitUtils/TITableKitUtils.podspec b/TITableKitUtils/TITableKitUtils.podspec index 67120a39..b8c53df7 100644 --- a/TITableKitUtils/TITableKitUtils.podspec +++ b/TITableKitUtils/TITableKitUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITableKitUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for TableKit classes.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TITransitions/TITransitions.podspec b/TITransitions/TITransitions.podspec index c580421c..d9ba5558 100644 --- a/TITransitions/TITransitions.podspec +++ b/TITransitions/TITransitions.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TITransitions' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of custom transitions to present controller. ' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIElements/TIUIElements.podspec b/TIUIElements/TIUIElements.podspec index 1d7ed3ee..e8025fae 100644 --- a/TIUIElements/TIUIElements.podspec +++ b/TIUIElements/TIUIElements.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIElements' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Bunch of useful protocols and views.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIUIKitCore/TIUIKitCore.podspec b/TIUIKitCore/TIUIKitCore.podspec index dfa3cc61..86c57202 100644 --- a/TIUIKitCore/TIUIKitCore.podspec +++ b/TIUIKitCore/TIUIKitCore.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIUIKitCore' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Core UI elements: protocols, views and helpers.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' } diff --git a/TIYandexMapUtils/TIYandexMapUtils.podspec b/TIYandexMapUtils/TIYandexMapUtils.podspec index f11d9032..e6db32b2 100644 --- a/TIYandexMapUtils/TIYandexMapUtils.podspec +++ b/TIYandexMapUtils/TIYandexMapUtils.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'TIYandexMapUtils' - s.version = '1.27.0' + s.version = '1.26.0' s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.' s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name s.license = { :type => 'MIT', :file => 'LICENSE' }