Skip to content

Commit

Permalink
Merge pull request #198 from mercadolibre/feature/retrocompatible-loyal
Browse files Browse the repository at this point in the history
Revert LoyalCongrats component
  • Loading branch information
gmaceira authored Jul 10, 2023
2 parents a37bd51 + 55cd83d commit 8cb312d
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 289 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## Unreleased
### Fixed
- Se revierten cambios de LoyaltyCongrats para agilizar otros desarrollos

## [1.56.1] - 2023-07-10
### Fixed
- Modificada firma de LoyaltyHeader para que sea retrocompatible
Expand Down
8 changes: 0 additions & 8 deletions Example/Example_BusinessComponents.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@
33ED96B624D142310064E271 /* HybridCarouselData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33ED96B524D142310064E271 /* HybridCarouselData.swift */; };
4284FE6E2555B40F00F48818 /* CoverCarouselData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4284FE6D2555B40F00F48818 /* CoverCarouselData.swift */; };
4284FE702555BD5200F48818 /* Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4284FE6F2555BD5200F48818 /* Helper.swift */; };
92F4AFC42A37E8FD00AF0A2C /* LoyaltyImageDataWithAction.swift in Sources */ = {isa = PBXBuildFile; fileRef = 92F4AFC32A37E8FD00AF0A2C /* LoyaltyImageDataWithAction.swift */; };
A82EF2D92C2A892A4253BA89 /* Pods_Example_BusinessComponents.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 67CB00EFC55C11D0A04B60BA /* Pods_Example_BusinessComponents.framework */; };
ACD03E532A04338F0029D6F3 /* LoyaltyImageData.swift in Sources */ = {isa = PBXBuildFile; fileRef = ACD03E522A04338F0029D6F3 /* LoyaltyImageData.swift */; };
CE20251324A418FE0071323E /* ActionCardData.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE20251224A418FE0071323E /* ActionCardData.swift */; };
CEE9F37C232FD72F0000C9CA /* DownloadAppData.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE9F37B232FD72F0000C9CA /* DownloadAppData.swift */; };
CEE9F390233062880000C9CA /* CrossSellingBoxData.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEE9F38F233062880000C9CA /* CrossSellingBoxData.swift */; };
Expand Down Expand Up @@ -57,8 +55,6 @@
4284FE6F2555BD5200F48818 /* Helper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Helper.swift; sourceTree = "<group>"; };
5A8E99986BC059211F6FE304 /* Pods-Example_BusinessComponents.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Example_BusinessComponents.release.xcconfig"; path = "Target Support Files/Pods-Example_BusinessComponents/Pods-Example_BusinessComponents.release.xcconfig"; sourceTree = "<group>"; };
67CB00EFC55C11D0A04B60BA /* Pods_Example_BusinessComponents.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Example_BusinessComponents.framework; sourceTree = BUILT_PRODUCTS_DIR; };
92F4AFC32A37E8FD00AF0A2C /* LoyaltyImageDataWithAction.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyImageDataWithAction.swift; sourceTree = "<group>"; };
ACD03E522A04338F0029D6F3 /* LoyaltyImageData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoyaltyImageData.swift; sourceTree = "<group>"; };
CE20251224A418FE0071323E /* ActionCardData.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ActionCardData.swift; sourceTree = "<group>"; };
CEE9F37B232FD72F0000C9CA /* DownloadAppData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadAppData.swift; sourceTree = "<group>"; };
CEE9F38F233062880000C9CA /* CrossSellingBoxData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CrossSellingBoxData.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -127,8 +123,6 @@
33ED96B524D142310064E271 /* HybridCarouselData.swift */,
4284FE6D2555B40F00F48818 /* CoverCarouselData.swift */,
337D483D24E3B3D00019A082 /* MultipleRowData.swift */,
ACD03E522A04338F0029D6F3 /* LoyaltyImageData.swift */,
92F4AFC32A37E8FD00AF0A2C /* LoyaltyImageDataWithAction.swift */,
);
path = MockData;
sourceTree = "<group>";
Expand Down Expand Up @@ -292,7 +286,6 @@
4284FE702555BD5200F48818 /* Helper.swift in Sources */,
4284FE6E2555B40F00F48818 /* CoverCarouselData.swift in Sources */,
0F660AFB23305CA9001B52DA /* LoyaltyHeaderData.swift in Sources */,
92F4AFC42A37E8FD00AF0A2C /* LoyaltyImageDataWithAction.swift in Sources */,
23DECA26232D28E80083D01F /* DiscountDataForTestUpdate.swift in Sources */,
33CE31E52451EC60005B94A5 /* DiscountTouchpointsGridData.swift in Sources */,
0F23688B2332A83F00941C09 /* ItemDescriptionData.swift in Sources */,
Expand All @@ -303,7 +296,6 @@
CEE9F390233062880000C9CA /* CrossSellingBoxData.swift in Sources */,
337D483E24E3B3D10019A082 /* MultipleRowData.swift in Sources */,
33ED96B624D142310064E271 /* HybridCarouselData.swift in Sources */,
ACD03E532A04338F0029D6F3 /* LoyaltyImageData.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
34 changes: 0 additions & 34 deletions Example/Example_BusinessComponents/MockData/LoyaltyImageData.swift

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ import MLBusinessComponents

class LoyaltyRingData: NSObject, MLBusinessLoyaltyRingData {

func getRingNumber() -> NSNumber? {
func getRingNumber() -> Int {
return 3
}

func getRingHexaColor() -> String? {
func getRingHexaColor() -> String {
return "#17aad6"
}

func getRingPercentage() -> NSNumber? {
func getRingPercentage() -> Float {
return 0.80
}

Expand Down
37 changes: 4 additions & 33 deletions Example/Example_BusinessComponents/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ extension ViewController {
private func setupView(_ receiver: MLBusinessLoyaltyBroadcastReceiver) {
let newRingView = setupRingView(receiver)
self.ringView = newRingView
let loyalImgView = setupLoyalRowWithImageAndAction(bottomOf: newRingView)
let loyalImgViewWithoutAction = setupLoyalRowWithImageAndWithoutAction(bottomOf: loyalImgView)
let dividingLineView = setupDividingLineView(bottomOf: loyalImgViewWithoutAction)
let dividingLineView = setupDividingLineView(bottomOf: newRingView)
let itemDescriptionView = setupItemDescriptionView(bottomOf: dividingLineView)
let crossSellingBoxView = setupCrossSellingBoxView(bottomOf: itemDescriptionView)
let discountView = setupDiscountView(numberOfItems: 6, bottomOf: crossSellingBoxView)
Expand Down Expand Up @@ -94,39 +92,12 @@ extension ViewController {

let broadcaster = MLBusinessLoyaltyBroadcaster.instance as MLBusinessLoyaltyBroadcaster
broadcaster.register(receiver)
broadcaster.updateInfo(MLBusinessLoyaltyBroadcastData(level: ringData.getRingNumber(),
percentage: ringData.getRingPercentage(),
primaryColor: ringData.getRingHexaColor()))

return ringView
}

private func setupLoyalRowWithImageAndAction(bottomOf targetView: UIView) -> MLBusinessLoyaltyRingView {
let loyaltyData = LoyaltyImageDataWithAction()
let loyalRowWithImageAndAction = MLBusinessLoyaltyRingView(loyaltyData, fillPercentProgress: false)

containerView.addSubview(loyalRowWithImageAndAction)

NSLayoutConstraint.activate([
loyalRowWithImageAndAction.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 16),
loyalRowWithImageAndAction.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -16),
loyalRowWithImageAndAction.topAnchor.constraint(equalTo: targetView.bottomAnchor, constant: 20)
])

return loyalRowWithImageAndAction
}

private func setupLoyalRowWithImageAndWithoutAction(bottomOf targetView: UIView) -> MLBusinessLoyaltyRingView {
let loyaltyData = LoyaltyImageData()
let loyalRowWithImage = MLBusinessLoyaltyRingView(loyaltyData, fillPercentProgress: false)

containerView.addSubview(loyalRowWithImage)

NSLayoutConstraint.activate([
loyalRowWithImage.leadingAnchor.constraint(equalTo: containerView.leadingAnchor, constant: 16),
loyalRowWithImage.trailingAnchor.constraint(equalTo: containerView.trailingAnchor, constant: -16),
loyalRowWithImage.topAnchor.constraint(equalTo: targetView.bottomAnchor, constant: 20)
])

return loyalRowWithImage
}

private func setupDividingLineView(bottomOf targetView: UIView) -> UIView {
let dividingLineView = MLBusinessDividingLineView(hasTriangle: true)
Expand Down
12 changes: 6 additions & 6 deletions Source/Components/Loyalty/MLBusinessLoyaltyRingData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
import UIKit

@objc public protocol MLBusinessLoyaltyRingData: NSObjectProtocol {
@objc optional func getRingHexaColor() -> String?
@objc optional func getRingNumber() -> NSNumber?
@objc optional func getRingPercentage() -> NSNumber?
@objc func getRingHexaColor() -> String
@objc func getRingNumber() -> Int
@objc func getRingPercentage() -> Float
@objc func getTitle() -> String
@objc optional func getSubtitle() -> String?
@objc optional func getButtonTitle() -> String?
@objc optional func getButtonDeepLink() -> String?
@objc optional func getSubtitle() -> String
@objc func getButtonTitle() -> String
@objc func getButtonDeepLink() -> String
@objc optional func getImageUrl() -> String?
}
Loading

0 comments on commit 8cb312d

Please sign in to comment.