From 0aceddeb205645a1e55efc50a52ee2c42389c630 Mon Sep 17 00:00:00 2001 From: Abishekh S Kamath Date: Mon, 25 Jul 2022 16:13:31 +0530 Subject: [PATCH 1/4] Add Sort by relevancy --- BVSDK.xcodeproj/project.pbxproj | 36 +++++++++++++++ .../Requests/Review/BVBaseReviewsRequest.h | 4 ++ .../Requests/Review/BVBaseReviewsRequest.m | 14 ++++++ .../BVConversationDisplay.h | 1 + .../BVRelevancySortTypeValue.h | 14 ++++++ .../BVReviewsRelevancySortOptionValue.h | 12 +++++ .../Sorting & Filtering/BVSortOptionValues.h | 1 + .../Sorting & Filtering/BVSortTypeValues.h | 13 ++++++ .../Private/BVRelevancySortType.h | 16 +++++++ .../Private/BVRelevancySortType.m | 45 ++++++++++++++++++ .../Private/BVReviewsRelevancySortOption.h | 17 +++++++ .../Private/BVReviewsRelevancySortOption.m | 46 +++++++++++++++++++ .../Sorting & Filtering/Private/BVSort.h | 8 ++++ .../Sorting & Filtering/Private/BVSort.m | 10 ++++ .../Sorting & Filtering/Private/BVSortType.h | 16 +++++++ .../Sorting & Filtering/Private/BVSortType.m | 36 +++++++++++++++ .../DisplayTests/ReviewDisplayTests.swift | 28 +++++++++++ 17 files changed, 317 insertions(+) create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/BVRelevancySortTypeValue.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/BVReviewsRelevancySortOptionValue.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/BVSortTypeValues.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.m create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.m create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.h create mode 100644 BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.m diff --git a/BVSDK.xcodeproj/project.pbxproj b/BVSDK.xcodeproj/project.pbxproj index 9982a11a..27e2af83 100644 --- a/BVSDK.xcodeproj/project.pbxproj +++ b/BVSDK.xcodeproj/project.pbxproj @@ -40,6 +40,15 @@ 15BE4D261E55F03200C12B57 /* BVCurationsUICollectionView.m in Sources */ = {isa = PBXBuildFile; fileRef = 870F133E1E490B5200D46BE6 /* BVCurationsUICollectionView.m */; }; 15D4F83B1DF5D5F800E6B30D /* testNotificationProductConfig.json in Resources */ = {isa = PBXBuildFile; fileRef = 15D4F83A1DF5D5F800E6B30D /* testNotificationProductConfig.json */; }; 15D4F83F1DF5EC3C00E6B30D /* ph.png in Resources */ = {isa = PBXBuildFile; fileRef = 15D4F83E1DF5EC3C00E6B30D /* ph.png */; }; + 2E0672CE288C1DE2008D2AF7 /* BVReviewsRelevancySortOptionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672CD288C1DE2008D2AF7 /* BVReviewsRelevancySortOptionValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2E0672D3288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672D1288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.h */; }; + 2E0672D4288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E0672D2288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.m */; }; + 2E0672D6288C3FFA008D2AF7 /* BVSortTypeValues.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672D5288C3FFA008D2AF7 /* BVSortTypeValues.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2E0672DC288C5420008D2AF7 /* BVSortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672DB288C5420008D2AF7 /* BVSortType.h */; }; + 2E0672DE288C542E008D2AF7 /* BVSortType.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E0672DD288C542E008D2AF7 /* BVSortType.m */; }; + 2E0672E0288C54F8008D2AF7 /* BVRelevancySortType.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672DF288C54F8008D2AF7 /* BVRelevancySortType.h */; }; + 2E0672E2288C550A008D2AF7 /* BVRelevancySortType.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E0672E1288C550A008D2AF7 /* BVRelevancySortType.m */; }; + 2E0672E4288C55C8008D2AF7 /* BVRelevancySortTypeValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E0672E3288C55C8008D2AF7 /* BVRelevancySortTypeValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2E371E592808226B008D9223 /* BVSecondaryRatingsDistributionElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E371E572808226B008D9223 /* BVSecondaryRatingsDistributionElement.h */; settings = {ATTRIBUTES = (Public, ); }; }; 2E371E5A2808226B008D9223 /* BVSecondaryRatingsDistributionElement.m in Sources */ = {isa = PBXBuildFile; fileRef = 2E371E582808226B008D9223 /* BVSecondaryRatingsDistributionElement.m */; }; 2E371E5D280824BE008D9223 /* BVSecondaryRatingsDistributionValue.h in Headers */ = {isa = PBXBuildFile; fileRef = 2E371E5B280824BE008D9223 /* BVSecondaryRatingsDistributionValue.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -693,6 +702,15 @@ 15D4F83A1DF5D5F800E6B30D /* testNotificationProductConfig.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = testNotificationProductConfig.json; sourceTree = ""; }; 15D4F83E1DF5EC3C00E6B30D /* ph.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ph.png; sourceTree = ""; }; 15D4F8451DF5EFFF00E6B30D /* BVSDKTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "BVSDKTests-Bridging-Header.h"; sourceTree = ""; }; + 2E0672CD288C1DE2008D2AF7 /* BVReviewsRelevancySortOptionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVReviewsRelevancySortOptionValue.h; sourceTree = ""; }; + 2E0672D1288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVReviewsRelevancySortOption.h; sourceTree = ""; }; + 2E0672D2288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BVReviewsRelevancySortOption.m; sourceTree = ""; }; + 2E0672D5288C3FFA008D2AF7 /* BVSortTypeValues.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVSortTypeValues.h; sourceTree = ""; }; + 2E0672DB288C5420008D2AF7 /* BVSortType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVSortType.h; sourceTree = ""; }; + 2E0672DD288C542E008D2AF7 /* BVSortType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVSortType.m; sourceTree = ""; }; + 2E0672DF288C54F8008D2AF7 /* BVRelevancySortType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVRelevancySortType.h; sourceTree = ""; }; + 2E0672E1288C550A008D2AF7 /* BVRelevancySortType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVRelevancySortType.m; sourceTree = ""; }; + 2E0672E3288C55C8008D2AF7 /* BVRelevancySortTypeValue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVRelevancySortTypeValue.h; sourceTree = ""; }; 2E371E572808226B008D9223 /* BVSecondaryRatingsDistributionElement.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVSecondaryRatingsDistributionElement.h; sourceTree = ""; }; 2E371E582808226B008D9223 /* BVSecondaryRatingsDistributionElement.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BVSecondaryRatingsDistributionElement.m; sourceTree = ""; }; 2E371E5B280824BE008D9223 /* BVSecondaryRatingsDistributionValue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVSecondaryRatingsDistributionValue.h; sourceTree = ""; }; @@ -1758,6 +1776,7 @@ B583B122200E8ABD001E9548 /* BVFilterTypeValues.h */, B583B120200E8ABD001E9548 /* BVIncludeTypeValues.h */, B5BE769D200EA4DD002BA818 /* BVMonotonicSortOrderValue.h */, + 2E0672E3288C55C8008D2AF7 /* BVRelevancySortTypeValue.h */, B5BE768D200E9FD2002BA818 /* BVProductFilterValue.h */, B5BE769F200EA53A002BA818 /* BVProductIncludeTypeValue.h */, B5BE76A1200EA58A002BA818 /* BVProductsSortOptionValue.h */, @@ -1769,8 +1788,10 @@ B5BE76A5200EA666002BA818 /* BVReviewIncludeTypeValue.h */, B5BE76A7200EA6B4002BA818 /* BVReviewsSortOptionValue.h */, 2EA5DD952824FDA4006B0949 /* BVReviewsCustomOrderSortOptionValue.h */, + 2E0672CD288C1DE2008D2AF7 /* BVReviewsRelevancySortOptionValue.h */, B583B124200E8ABE001E9548 /* BVSortOptionValues.h */, B583B121200E8ABD001E9548 /* BVSortOrderValues.h */, + 2E0672D5288C3FFA008D2AF7 /* BVSortTypeValues.h */, B583B11E200E888C001E9548 /* Private */, ); path = "Sorting & Filtering"; @@ -2315,6 +2336,8 @@ B583AEE82009486C001E9548 /* BVIncludeType.m */, B583AEDB2007FB59001E9548 /* BVMonotonicSortOrder.h */, B583AEDC2007FB59001E9548 /* BVMonotonicSortOrder.m */, + 2E0672DF288C54F8008D2AF7 /* BVRelevancySortType.h */, + 2E0672E1288C550A008D2AF7 /* BVRelevancySortType.m */, 2E88C044282A38C4007B77B0 /* BVCustomSortOrder.h */, 2E88C045282A38C4007B77B0 /* BVCustomSortOrder.m */, 87F2DB781DAD585E00FB43F3 /* BVProductFilterType.h */, @@ -2335,12 +2358,16 @@ 87D424E81E89C32E00147FDB /* BVReviewIncludeType.m */, 87F2DB861DAD585E00FB43F3 /* BVReviewsSortOption.h */, 87F2DB871DAD585E00FB43F3 /* BVReviewsSortOption.m */, + 2E0672D1288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.h */, + 2E0672D2288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.m */, 87F2DB7E1DAD585E00FB43F3 /* BVSort.h */, 87F2DB7F1DAD585E00FB43F3 /* BVSort.m */, B583AEDF200816A4001E9548 /* BVSortOption.h */, B583AEE0200816A4001E9548 /* BVSortOption.m */, B583AED72007F80A001E9548 /* BVSortOrder.h */, B583AED82007F80A001E9548 /* BVSortOrder.m */, + 2E0672DB288C5420008D2AF7 /* BVSortType.h */, + 2E0672DD288C542E008D2AF7 /* BVSortType.m */, 2EA5DD972825110E006B0949 /* BVReviewsCustomOrderSortOption.h */, 2EA5DD982825110E006B0949 /* BVReviewsCustomOrderSortOption.m */, ); @@ -2729,6 +2756,7 @@ 87F2DD0F1DAD585E00FB43F3 /* BVReviewsCollectionView.h in Headers */, B583B127200E8ABE001E9548 /* BVSortOrderValues.h in Headers */, 87F2DCCB1DAD585E00FB43F3 /* BVAnswerSubmission.h in Headers */, + 2E0672D3288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.h in Headers */, B588E7002124A23600F76040 /* BVRecommendationsRequestOptions.h in Headers */, 87F2DCD91DAD585E00FB43F3 /* BVSubmission.h in Headers */, 5FE2C0811F6B05100090DD55 /* BVErrorCode.h in Headers */, @@ -2740,6 +2768,7 @@ 87F2DCEB1DAD585E00FB43F3 /* BVSubmittedQuestion.h in Headers */, B586398D214AFBD000EFD763 /* BVModelUtil.h in Headers */, B57B8330215E8A31006B378E /* BVFeedbackSubmissionErrorResponse.h in Headers */, + 2E0672E0288C54F8008D2AF7 /* BVRelevancySortType.h in Headers */, 87F2DC7A1DAD585E00FB43F3 /* BVPhotoSizes.h in Headers */, B583B126200E8ABE001E9548 /* BVIncludeTypeValues.h in Headers */, B586399A214AFD7400EFD763 /* BVBaseReviewsRequest+Private.h in Headers */, @@ -2855,6 +2884,7 @@ 8754117D1E1F201E006C5C6E /* BVProductReviewRichNotificationCenter.h in Headers */, 875411791E1F201E006C5C6E /* BVProductReviewNotificationCenter.h in Headers */, 875410B41E1F10DF006C5C6E /* BVStoreReviewNotificationViewController.h in Headers */, + 2E0672DC288C5420008D2AF7 /* BVSortType.h in Headers */, B58639B1214AFE0A00EFD763 /* BVMultiPart+NSURLRequest.h in Headers */, B583B128200E8ABE001E9548 /* BVFilterTypeValues.h in Headers */, 875410B01E1F10DF006C5C6E /* BVNotificationViewController.h in Headers */, @@ -2916,8 +2946,11 @@ B5BE787720113462002BA818 /* BVBulkRatingIncludeTypeValue.h in Headers */, 873DC48F1E7482840080FA03 /* BVAnalyticEventManager.h in Headers */, 873DC4A11E7482840080FA03 /* BVTransactionItem.h in Headers */, + 2E0672CE288C1DE2008D2AF7 /* BVReviewsRelevancySortOptionValue.h in Headers */, 873DC4911E7482840080FA03 /* BVConversionEvent.h in Headers */, 873DC4971E7482840080FA03 /* BVInViewEvent.h in Headers */, + 2E0672D6288C3FFA008D2AF7 /* BVSortTypeValues.h in Headers */, + 2E0672E4288C55C8008D2AF7 /* BVRelevancySortTypeValue.h in Headers */, 873DC49B1E7482840080FA03 /* BVPersonalizationEvent.h in Headers */, B5BE76A0200EA53D002BA818 /* BVProductIncludeTypeValue.h in Headers */, B58639B2214AFE0A00EFD763 /* BVSDKManager+Private.h in Headers */, @@ -3265,6 +3298,7 @@ 87F2DC831DAD585E00FB43F3 /* BVQuestionsAndAnswersResponse.m in Sources */, 87F2DD3E1DAD585E00FB43F3 /* BVRecommendationsLoader.m in Sources */, 87F2DCAC1DAD585E00FB43F3 /* BVProductDisplayPageRequest.m in Sources */, + 2E0672DE288C542E008D2AF7 /* BVSortType.m in Sources */, B5A764DC1FE1917C00B5DC9A /* BVStoreIncludeType.m in Sources */, 87F2DC961DAD585E00FB43F3 /* BVProduct.m in Sources */, 87EDAFDA1EDDD3E200FA07C0 /* BVCommentSubmissionErrorResponse.m in Sources */, @@ -3289,6 +3323,7 @@ 875411801E1F201E006C5C6E /* BVProductReviewSimpleNotificationCenter.m in Sources */, B58639D6214AFEC800EFD763 /* BVRecommendationsRequestOptionsUtil.m in Sources */, B583AEDE2007FB59001E9548 /* BVMonotonicSortOrder.m in Sources */, + 2E0672E2288C550A008D2AF7 /* BVRelevancySortType.m in Sources */, 87F2DD231DAD585E00FB43F3 /* BVCurationsFeedLoader.m in Sources */, B5A764C91FE1912800B5DC9A /* BVStore.m in Sources */, 873DC4A21E7482840080FA03 /* BVTransactionItem.m in Sources */, @@ -3459,6 +3494,7 @@ 87F2DCA81DAD585E00FB43F3 /* BVBulkRatingsRequest.m in Sources */, 873DC49C1E7482840080FA03 /* BVPersonalizationEvent.m in Sources */, 2E998AD72789B4C20036DE64 /* BVFeature.m in Sources */, + 2E0672D4288C3AD5008D2AF7 /* BVReviewsRelevancySortOption.m in Sources */, 9FB5C45F243DA6690057BA34 /* BVReviewHighlightsReview.m in Sources */, 87C5FE9E1E229168004EE6E8 /* BVProductReviewNotificationConfigurationLoader.m in Sources */, B58639CA214AFE8700EFD763 /* BVLocaleServiceManager.m in Sources */, diff --git a/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.h b/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.h index b7eea9cb..80eb1053 100644 --- a/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.h +++ b/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.h @@ -39,6 +39,10 @@ sortByReviewsSortOptionValue:(BVReviewsSortOptionValue)reviewsSortOptionValue sortByReviewsCustomOrderSortOptionValue:(BVReviewsCustomOrderSortOptionValue)reviewsCustomOrderSortOptionValue customSortOrder:(nonnull NSArray *)customSortOrder; +- (nonnull instancetype) +sortByReviewsRelevancySortOptionValue:(BVReviewsRelevancySortOptionValue)reviewsRelevancySortOptionValue + relevancySortTypeValue:(BVRelevancySortTypeValue)relevancySortTypeValue; + - (nonnull instancetype) filterOnReviewFilterValue:(BVReviewFilterValue)reviewFilterValue relationalFilterOperatorValue: diff --git a/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.m b/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.m index 29832c3d..cbe114e0 100644 --- a/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.m +++ b/BVSDK/BVConversations/Display/Requests/Review/BVBaseReviewsRequest.m @@ -14,6 +14,7 @@ #import "BVFilter.h" #import "BVMonotonicSortOrder.h" #import "BVCustomSortOrder.h" +#import "BVRelevancySortType.h" #import "BVProduct.h" #import "BVRelationalFilterOperator.h" #import "BVReview.h" @@ -21,6 +22,7 @@ #import "BVReviewIncludeType.h" #import "BVReviewsSortOption.h" #import "BVReviewsCustomOrderSortOption.h" +#import "BVReviewsRelevancySortOption.h" #import "BVSort.h" #import "BVStringKeyValuePair.h" @@ -169,6 +171,18 @@ - (nonnull instancetype)includeReviewIncludeTypeValue: return self; } +- (nonnull instancetype) +sortByReviewsRelevancySortOptionValue:(BVReviewsRelevancySortOptionValue)reviewsRelevancySortOptionValue + relevancySortTypeValue:(BVRelevancySortTypeValue)relevancySortTypeValue { + BVSort *sort = [[BVSort alloc] + initWithSortOption:[BVReviewsRelevancySortOption + sortOptionWithRawValue:reviewsRelevancySortOptionValue] + sortType:[BVRelevancySortType + sortTypeWithRawValue:relevancySortTypeValue]]; + [self.sorts addObject:sort]; + return self; +} + - (nonnull instancetype) filterOnReviewFilterValue:(BVReviewFilterValue)reviewFilterValue relationalFilterOperatorValue: diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/BVConversationDisplay.h b/BVSDK/BVConversations/Display/Sorting & Filtering/BVConversationDisplay.h index 48cb0781..de654697 100644 --- a/BVSDK/BVConversations/Display/Sorting & Filtering/BVConversationDisplay.h +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/BVConversationDisplay.h @@ -15,5 +15,6 @@ #import "BVIncludeTypeValues.h" #import "BVSortOptionValues.h" #import "BVSortOrderValues.h" +#import "BVSortTypeValues.h" #endif /* BVCONVERSATIONDISPLAY_H */ diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/BVRelevancySortTypeValue.h b/BVSDK/BVConversations/Display/Sorting & Filtering/BVRelevancySortTypeValue.h new file mode 100644 index 00000000..f5210922 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/BVRelevancySortTypeValue.h @@ -0,0 +1,14 @@ +// +// BVRelevancySortTypeValue.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import + +typedef NS_ENUM(NSInteger, BVRelevancySortTypeValue) { + BVRelevancySortTypeValueA2, +}; + + diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/BVReviewsRelevancySortOptionValue.h b/BVSDK/BVConversations/Display/Sorting & Filtering/BVReviewsRelevancySortOptionValue.h new file mode 100644 index 00000000..14dfefa8 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/BVReviewsRelevancySortOptionValue.h @@ -0,0 +1,12 @@ +// +// BVReviewsRelevancySortOptionValue.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// +#import + +typedef NS_ENUM(NSInteger, BVReviewsRelevancySortOptionValue) { + BVReviewsRelevancySortOptionValueRelevancy +}; + diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortOptionValues.h b/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortOptionValues.h index aff2c6cb..95d4d758 100644 --- a/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortOptionValues.h +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortOptionValues.h @@ -17,5 +17,6 @@ #import "BVReviewsSortOptionValue.h" #import "BVReviewsCustomOrderSortOptionValue.h" +#import "BVReviewsRelevancySortOptionValue.h" #endif /* BVSORTOPTIONVALUES_H */ diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortTypeValues.h b/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortTypeValues.h new file mode 100644 index 00000000..900b6f0b --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/BVSortTypeValues.h @@ -0,0 +1,13 @@ +// +// BVSortTypeValues.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#ifndef BVSortTypeValues_h +#define BVSortTypeValues_h + +#import "BVRelevancySortTypeValue.h" + +#endif /* BVSortTypeValues_h */ diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.h b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.h new file mode 100644 index 00000000..44e83bdb --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.h @@ -0,0 +1,16 @@ +// +// BVRelevancySortType.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVRelevancySortTypeValue.h" +#import "BVSortType.h" + +@interface BVRelevancySortType : BVSortType + +- (nonnull instancetype)initWithRelevancySortTypeValue: + (BVRelevancySortTypeValue)relevancySortTypeValue; + +@end diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.m b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.m new file mode 100644 index 00000000..2bbc3423 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVRelevancySortType.m @@ -0,0 +1,45 @@ +// +// BVRelevancySortType.m +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVRelevancySortType.h" + +@interface BVRelevancySortType () +@property(nonnull, nonatomic, strong) NSString *value; +@end + +@implementation BVRelevancySortType + ++ (nonnull NSString *)toSortTypeParameterStringWithRawValue: + (NSInteger)rawValue { + return [BVRelevancySortType sortTypeWithRawValue:rawValue].value; +} + ++ (nonnull instancetype)sortTypeWithRawValue:(NSInteger)rawValue { + return [[BVRelevancySortType alloc] initWithRawValue:rawValue]; +} + +- (nonnull instancetype)initWithRawValue:(NSInteger)rawValue { + if ((self = [super initWithRawValue:rawValue])) { + switch (rawValue) { + case BVRelevancySortTypeValueA2: + self.value = @"A2"; + break; + } + } + return self; +} + +- (nonnull NSString *)toSortTypeParameterString { + return self.value; +} + +- (nonnull instancetype)initWithRelevancySortTypeValue: + (BVRelevancySortTypeValue)relevancySortTypeValue { + return [BVRelevancySortType sortTypeWithRawValue:relevancySortTypeValue]; +} + +@end diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.h b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.h new file mode 100644 index 00000000..205e41fb --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.h @@ -0,0 +1,17 @@ +// +// BVReviewsRelevancySortOption.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVReviewsRelevancySortOptionValue.h" +#import "BVSortOption.h" + +@interface BVReviewsRelevancySortOption : BVSortOption + +- (nonnull instancetype)initWithReviewsRelevancySortOptionValue: + (BVReviewsRelevancySortOptionValue)reviewsRelevancySortOptionValue; + +@end + diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.m b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.m new file mode 100644 index 00000000..a35295a1 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVReviewsRelevancySortOption.m @@ -0,0 +1,46 @@ +// +// BVReviewsRelevancySortOption.m +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVReviewsRelevancySortOption.h" + +@interface BVReviewsRelevancySortOption () +@property(nonnull, nonatomic, strong) NSString *value; +@end + +@implementation BVReviewsRelevancySortOption + ++ (nonnull NSString *)toSortOptionParameterStringWithRawValue: + (NSInteger)rawValue { + return [BVReviewsRelevancySortOption sortOptionWithRawValue:rawValue].value; +} + ++ (nonnull instancetype)sortOptionWithRawValue:(NSInteger)rawValue { + return [[BVReviewsRelevancySortOption alloc] initWithRawValue:rawValue]; +} + +- (nonnull instancetype)initWithRawValue:(NSInteger)rawValue { + if ((self = [super initWithRawValue:rawValue])) { + switch (rawValue) { + case BVReviewsRelevancySortOptionValueRelevancy: + self.value = @"Relevancy"; + break; + } + } + return self; +} + +- (nonnull NSString *)toSortOptionParameterString { + return self.value; +} + +- (nonnull instancetype)initWithReviewsRelevancySortOptionValue: + (BVReviewsRelevancySortOptionValue)reviewsRelevancySortOptionValue { + return [BVReviewsRelevancySortOption sortOptionWithRawValue:reviewsRelevancySortOptionValue]; +} + + +@end diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.h b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.h index a1061fc5..f3838f80 100644 --- a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.h +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.h @@ -25,6 +25,12 @@ - (nonnull NSString *)toCustomSortOrderParameterString; @end +@protocol BVSortTypeProtocol ++ (nonnull NSString *)toSortTypeParameterStringWithRawValue: + (NSInteger)rawValue; +- (nonnull NSString *)toSortTypeParameterString; +@end + @interface BVSort : NSObject - (nonnull id)initWithSortOption:(nonnull id)sortOption @@ -34,6 +40,8 @@ (nonnull id)sortOrder; - (nonnull id)initWithCustomOrderSortOption:(nonnull id)customOrderSortOption customSortOrder:(nonnull id)customSortOrder; +- (nonnull id)initWithSortOption:(nonnull id)sortOption + sortType:(nonnull id)sortType; - (nonnull NSString *)toParameterString; @end diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.m b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.m index 260dc401..1fb5dc97 100644 --- a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.m +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSort.m @@ -44,6 +44,16 @@ - (nonnull id)initWithCustomOrderSortOption:(nonnull id)cu return self; } +- (nonnull id)initWithSortOption:(nonnull id)sortOption + sortType:(nonnull id)sortType { + if ((self = [super init])) { + self.sortOption = [sortOption toSortOptionParameterString]; + self.sortOrder = [sortType toSortTypeParameterString]; + } + return self; +} + + - (nonnull NSString *)toParameterString { return [NSString stringWithFormat:@"%@:%@", self.sortOption, self.sortOrder]; } diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.h b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.h new file mode 100644 index 00000000..8cb341c9 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.h @@ -0,0 +1,16 @@ +// +// BVSortOrder.h +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVSort.h" + +@interface BVSortType : NSObject + ++ (nonnull instancetype)sortTypeWithRawValue:(NSInteger)rawValue; +- (nonnull instancetype)initWithRawValue:(NSInteger)rawValue; +- (nonnull instancetype)__unavailable init; + +@end diff --git a/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.m b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.m new file mode 100644 index 00000000..d9b6a947 --- /dev/null +++ b/BVSDK/BVConversations/Display/Sorting & Filtering/Private/BVSortType.m @@ -0,0 +1,36 @@ +// +// BVSortType.m +// BVSDK +// +// Copyright © 2022 Bazaarvoice. All rights reserved. +// + +#import "BVSortType.h" + +@implementation BVSortType + ++ (nonnull instancetype)sortTypeWithRawValue:(NSInteger)rawValue { + NSAssert(NO, @"sortTypeWithRawValue: should be overriden by the subclass"); + return [super init]; +} + ++ (nonnull NSString *)toSortTypeParameterStringWithRawValue: + (NSInteger)rawValue { + NSAssert(NO, @"toSortTypeParameterStringWithRawValue: should be " + @"overriden by the subclass"); + return @""; +} + +- (nonnull instancetype)initWithRawValue:(NSInteger)rawValue { + // Discards the rawValue as this should be overridden and mapped appropriately + // by the subclass. + return [super init]; +} + +- (nonnull NSString *)toSortTypeParameterString { + NSAssert(NO, + @"toSortTypeParameterString should be overriden by the subclass"); + return @""; +} + +@end diff --git a/BVSDKTests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift b/BVSDKTests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift index 4923a55a..2fe3ab4e 100644 --- a/BVSDKTests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift +++ b/BVSDKTests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift @@ -796,4 +796,32 @@ class ReviewDisplayTests: XCTestCase { } } + + func testReviewRelevancySort() { + + let configDict = ["clientId": "mobile_test_customer_stg", + "apiKeyConversations": "caht73JSvhpl41pvD8vrIIPjLeMR0oPV6vMyd15lM2sig"]; + BVSDKManager.configure(withConfiguration: configDict, configType: .staging) + + let expectation = self.expectation(description: "testReviewRelevancySort") + + let request = BVReviewsRequest(productId: "product1", limit: 20, offset: 0) + .sort(by: .relevancy, relevancySortTypeValue: .A2) + + request.load({ (response) in + + XCTAssertEqual(response.results.first?.identifier ?? "" , "34016202") + expectation.fulfill() + + }) { (error) in + + XCTFail("review display request error: \(error)") + expectation.fulfill() + } + + self.waitForExpectations(timeout: 1000) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + } } From 63f0b01ea9596d1fbaf063c3bbeeb772fe27051e Mon Sep 17 00:00:00 2001 From: Abishekh-S-Kamath Date: Mon, 25 Jul 2022 16:41:26 +0530 Subject: [PATCH 2/4] Release 8.9.0 --- BVSDK.podspec | 2 +- BVSDK/BVCommon/BVSDKConstants.h | 2 +- BVSDK/Support/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BVSDK.podspec b/BVSDK.podspec index ed35d3d0..d4ce3642 100644 --- a/BVSDK.podspec +++ b/BVSDK.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "BVSDK" - s.version = '8.8.0' + s.version = '8.9.0' s.homepage = 'https://developer.bazaarvoice.com/' s.license = { :type => 'Commercial', :text => 'See https://developer.bazaarvoice.com/API_Terms_of_Use' } s.author = { 'Bazaarvoice' => 'support@bazaarvoice.com' } diff --git a/BVSDK/BVCommon/BVSDKConstants.h b/BVSDK/BVCommon/BVSDKConstants.h index 97c403d9..10b18d5e 100644 --- a/BVSDK/BVCommon/BVSDKConstants.h +++ b/BVSDK/BVCommon/BVSDKConstants.h @@ -10,7 +10,7 @@ #define BVSDKConstants_h /// Provides the master version of the SDK. -#define BV_SDK_VERSION @"8.8.0" +#define BV_SDK_VERSION @"8.9.0" /// Conversation SDK Version #define SDK_HEADER_NAME @"X-UA-BV-SDK" diff --git a/BVSDK/Support/Info.plist b/BVSDK/Support/Info.plist index 52f390b7..b5fa62c9 100644 --- a/BVSDK/Support/Info.plist +++ b/BVSDK/Support/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 8.8.0 + 8.9.0 CFBundleVersion 1 LSApplicationCategoryType From c2bb0da0b8650aecaffe381c5224d069512cbd6a Mon Sep 17 00:00:00 2001 From: chetan shanbag Date: Mon, 10 Oct 2022 14:30:41 +0530 Subject: [PATCH 3/4] Updated the terms of use (#327) --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index dc6bf4aa..6f29f42d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ Copyright (c) 2015 Bazaarvoice, Inc. -https://developer.bazaarvoice.com/legal/terms_of_use for Bazaarvoice's Terms of Use. +https://www.bazaarvoice.com/legal/terms-of-use/api/ for Bazaarvoice's Terms of Use. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, From e824561b7801ecdc7907c5217db5ad6fdfcecee7 Mon Sep 17 00:00:00 2001 From: cheta24 Date: Mon, 10 Oct 2022 14:52:20 +0530 Subject: [PATCH 4/4] Release 8.9.1 --- BVSDK.podspec | 2 +- BVSDK/BVCommon/BVSDKConstants.h | 2 +- BVSDK/Support/Info.plist | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/BVSDK.podspec b/BVSDK.podspec index d4ce3642..4a2bc334 100644 --- a/BVSDK.podspec +++ b/BVSDK.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "BVSDK" - s.version = '8.9.0' + s.version = '8.9.1' s.homepage = 'https://developer.bazaarvoice.com/' s.license = { :type => 'Commercial', :text => 'See https://developer.bazaarvoice.com/API_Terms_of_Use' } s.author = { 'Bazaarvoice' => 'support@bazaarvoice.com' } diff --git a/BVSDK/BVCommon/BVSDKConstants.h b/BVSDK/BVCommon/BVSDKConstants.h index 10b18d5e..ef29ae44 100644 --- a/BVSDK/BVCommon/BVSDKConstants.h +++ b/BVSDK/BVCommon/BVSDKConstants.h @@ -10,7 +10,7 @@ #define BVSDKConstants_h /// Provides the master version of the SDK. -#define BV_SDK_VERSION @"8.9.0" +#define BV_SDK_VERSION @"8.9.1" /// Conversation SDK Version #define SDK_HEADER_NAME @"X-UA-BV-SDK" diff --git a/BVSDK/Support/Info.plist b/BVSDK/Support/Info.plist index b5fa62c9..f494e945 100644 --- a/BVSDK/Support/Info.plist +++ b/BVSDK/Support/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 8.9.0 + 8.9.1 CFBundleVersion 1 LSApplicationCategoryType