From e7904606c186b92f78a5a104496431f63b54e8c3 Mon Sep 17 00:00:00 2001 From: Sergio Azua Date: Fri, 19 May 2017 10:50:11 -0500 Subject: [PATCH] - Add support for comments display and including comments with a reviews request - Update the /Examples/Conversations examples to demonstrate how to fetch comments - Bump BVSDK version to 6.7.0 --- BVSDK.podspec | 2 +- BVSDK.xcodeproj/project.pbxproj | 80 ++++++- BVSDK/BVSDK.h | 4 + BVSDK/Info.plist | 4 +- .../BVSDKDemo/HomeViewController.swift | 2 +- .../project.pbxproj | 40 +++- .../Base.lproj/Main.storyboard | 74 ++++++- .../CommentsViewController.h | 12 + .../CommentsViewController.m | 68 ++++++ .../MyAnswerTableViewCell.xib | 15 +- .../MyCommentTableViewCell.h | 16 ++ .../MyCommentTableViewCell.m | 33 +++ .../MyCommentTableViewCell.xib | 52 +++++ .../MyReviewTableViewCell.m | 2 +- .../ReviewsViewController.m | 1 + Examples/Conversations/Obj-C/Podfile.lock | 6 +- .../project.pbxproj | 18 +- .../Base.lproj/Main.storyboard | 80 ++++++- .../CommentsViewController.swift | 67 ++++++ .../ConversationsExample/Constants.swift | 3 + .../MyAnswerTableViewCell.xib | 12 +- .../MyCommentTableViewCell.swift | 27 +++ .../MyCommentTableViewCell.xib | 52 +++++ .../MyQuestionTableViewCell.xib | 20 +- .../MyReviewTableViewCell.swift | 5 + .../ReviewsViewController.swift | 1 + Examples/Conversations/Swift/Podfile.lock | 7 +- Examples/Curations/Swift/Podfile.lock | 8 +- Pod/BVCommon/BVSDKConstants.h | 4 +- .../Display/BVCommentIncludeType.h | 24 ++ .../Display/BVCommentIncludeType.m | 22 ++ .../Display/BVReviewIncludeType.h | 3 +- .../Display/BVReviewIncludeType.m | 4 +- .../Display/Model/BVAuthorResponse.h | 1 + .../Display/Model/BVCommentsResponse.h | 15 ++ .../Display/Model/BVCommentsResponse.m | 16 ++ .../Display/Model/BVConversationsInclude.h | 4 + .../Display/Model/BVConversationsInclude.m | 33 ++- .../GenericConversationsResult/BVComment.h | 42 ++++ .../GenericConversationsResult/BVComment.m | 53 +++++ .../GenericConversationsResult/BVReview.h | 2 + .../GenericConversationsResult/BVReview.m | 12 + .../Requests/BVBaseConversationsResponse.m | 2 +- .../Display/Requests/BVBaseReviewsRequest.h | 1 - .../Display/Requests/BVCommentsRequest.h | 42 ++++ .../Display/Requests/BVCommentsRequest.m | 161 ++++++++++++++ .../Display/Requests/BVConversationsRequest.m | 3 +- .../Sorting & Filtering/BVCommentFilterType.h | 39 ++++ .../Sorting & Filtering/BVCommentFilterType.m | 36 +++ .../Sorting & Filtering/BVReviewFilterType.h | 2 +- .../BVSortOptionsComments.h | 37 ++++ .../BVSortOptionsComments.m | 33 +++ .../DisplayTests/CommentsDisplayTests.swift | 208 ++++++++++++++++++ .../DisplayTests/ReviewDisplayTests.swift | 44 +++- 54 files changed, 1463 insertions(+), 91 deletions(-) create mode 100644 Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.h create mode 100644 Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.m create mode 100644 Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.h create mode 100644 Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.m create mode 100644 Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.xib create mode 100644 Examples/Conversations/Swift/ConversationsExample/CommentsViewController.swift create mode 100644 Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.swift create mode 100644 Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.xib create mode 100644 Pod/BVConversations/Display/BVCommentIncludeType.h create mode 100644 Pod/BVConversations/Display/BVCommentIncludeType.m create mode 100644 Pod/BVConversations/Display/Model/BVCommentsResponse.h create mode 100644 Pod/BVConversations/Display/Model/BVCommentsResponse.m create mode 100644 Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.h create mode 100644 Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.m create mode 100644 Pod/BVConversations/Display/Requests/BVCommentsRequest.h create mode 100644 Pod/BVConversations/Display/Requests/BVCommentsRequest.m create mode 100644 Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.h create mode 100644 Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.m create mode 100644 Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.h create mode 100644 Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.m create mode 100644 Tests/Tests/ConversationsTests/DisplayTests/CommentsDisplayTests.swift diff --git a/BVSDK.podspec b/BVSDK.podspec index 05ad806a..bd31fd6e 100644 --- a/BVSDK.podspec +++ b/BVSDK.podspec @@ -9,7 +9,7 @@ Pod::Spec.new do |s| s.name = "BVSDK" - s.version = '6.5.4' + s.version = '6.7.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.xcodeproj/project.pbxproj b/BVSDK.xcodeproj/project.pbxproj index a3b7a9b1..ea5c7bd2 100644 --- a/BVSDK.xcodeproj/project.pbxproj +++ b/BVSDK.xcodeproj/project.pbxproj @@ -122,6 +122,13 @@ 87A9ECC21E1DB9B300666636 /* BVPINRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 87A9ECBE1E1DB9B300666636 /* BVPINRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; 87A9ECC31E1DB9B300666636 /* BVPINRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 87A9ECBF1E1DB9B300666636 /* BVPINRequest.m */; }; 87B3DADE1E522D2C00DE7843 /* UIImage+BundleLocator.h in Headers */ = {isa = PBXBuildFile; fileRef = 87B3DADD1E522D2C00DE7843 /* UIImage+BundleLocator.h */; settings = {ATTRIBUTES = (Private, ); }; }; + 87B6DF9C1ECA3A0F00B75835 /* CommentsDisplayTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87B6DF9B1ECA3A0F00B75835 /* CommentsDisplayTests.swift */; }; + 87B6DFA11ECA424300B75835 /* BVCommentsRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 87B6DF9F1ECA424300B75835 /* BVCommentsRequest.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87B6DFA21ECA424300B75835 /* BVCommentsRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 87B6DFA01ECA424300B75835 /* BVCommentsRequest.m */; }; + 87B6DFA51ECA484400B75835 /* BVComment.h in Headers */ = {isa = PBXBuildFile; fileRef = 87B6DFA31ECA484400B75835 /* BVComment.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87B6DFA61ECA484400B75835 /* BVComment.m in Sources */ = {isa = PBXBuildFile; fileRef = 87B6DFA41ECA484400B75835 /* BVComment.m */; }; + 87B6DFA91ECA49B600B75835 /* BVCommentsResponse.h in Headers */ = {isa = PBXBuildFile; fileRef = 87B6DFA71ECA49B600B75835 /* BVCommentsResponse.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87B6DFAA1ECA49B600B75835 /* BVCommentsResponse.m in Sources */ = {isa = PBXBuildFile; fileRef = 87B6DFA81ECA49B600B75835 /* BVCommentsResponse.m */; }; 87C5FE991E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 87C5FE971E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.h */; settings = {ATTRIBUTES = (Public, ); }; }; 87C5FE9A1E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C5FE981E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.m */; }; 87C5FE9D1E229168004EE6E8 /* BVProductReviewNotificationConfigurationLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 87C5FE9B1E229168004EE6E8 /* BVProductReviewNotificationConfigurationLoader.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -165,6 +172,12 @@ 87D425281E8EE39700147FDB /* BVViewedCGCEvent.m in Sources */ = {isa = PBXBuildFile; fileRef = 87D425261E8EE39700147FDB /* BVViewedCGCEvent.m */; }; 87DA86DD1E5229C5002E7860 /* UIImage+BundleLocator.m in Sources */ = {isa = PBXBuildFile; fileRef = 87DA86DB1E5229C5002E7860 /* UIImage+BundleLocator.m */; }; 87E28C831E5F88FE00915FDB /* BVPixelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E28C821E5F88FE00915FDB /* BVPixelTests.m */; }; + 87E810E51ECCA0190032C753 /* BVSortOptionsComments.h in Headers */ = {isa = PBXBuildFile; fileRef = 87E810E31ECCA0190032C753 /* BVSortOptionsComments.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87E810E61ECCA0190032C753 /* BVSortOptionsComments.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E810E41ECCA0190032C753 /* BVSortOptionsComments.m */; }; + 87E810E91ECCA3CF0032C753 /* BVCommentFilterType.h in Headers */ = {isa = PBXBuildFile; fileRef = 87E810E71ECCA3CF0032C753 /* BVCommentFilterType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87E810EA1ECCA3CF0032C753 /* BVCommentFilterType.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E810E81ECCA3CF0032C753 /* BVCommentFilterType.m */; }; + 87E810ED1ECCC4CD0032C753 /* BVCommentIncludeType.h in Headers */ = {isa = PBXBuildFile; fileRef = 87E810EB1ECCC4CD0032C753 /* BVCommentIncludeType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 87E810EE1ECCC4CD0032C753 /* BVCommentIncludeType.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E810EC1ECCC4CD0032C753 /* BVCommentIncludeType.m */; }; 87F2DAB11DAD579D00FB43F3 /* BVSDK.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 87F2DAA71DAD579D00FB43F3 /* BVSDK.framework */; }; 87F2DAB81DAD579D00FB43F3 /* BVSDK.h in Headers */ = {isa = PBXBuildFile; fileRef = 87F2DAAA1DAD579D00FB43F3 /* BVSDK.h */; settings = {ATTRIBUTES = (Public, ); }; }; 87F2DC171DAD585E00FB43F3 /* BVAdsMessageInterceptor.h in Headers */ = {isa = PBXBuildFile; fileRef = 87F2DAC31DAD585E00FB43F3 /* BVAdsMessageInterceptor.h */; settings = {ATTRIBUTES = (Private, ); }; }; @@ -608,6 +621,13 @@ 87A9ECBE1E1DB9B300666636 /* BVPINRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVPINRequest.h; sourceTree = ""; }; 87A9ECBF1E1DB9B300666636 /* BVPINRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVPINRequest.m; sourceTree = ""; }; 87B3DADD1E522D2C00DE7843 /* UIImage+BundleLocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+BundleLocator.h"; sourceTree = ""; }; + 87B6DF9B1ECA3A0F00B75835 /* CommentsDisplayTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentsDisplayTests.swift; sourceTree = ""; }; + 87B6DF9F1ECA424300B75835 /* BVCommentsRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVCommentsRequest.h; sourceTree = ""; }; + 87B6DFA01ECA424300B75835 /* BVCommentsRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVCommentsRequest.m; sourceTree = ""; }; + 87B6DFA31ECA484400B75835 /* BVComment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVComment.h; sourceTree = ""; }; + 87B6DFA41ECA484400B75835 /* BVComment.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVComment.m; sourceTree = ""; }; + 87B6DFA71ECA49B600B75835 /* BVCommentsResponse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVCommentsResponse.h; sourceTree = ""; }; + 87B6DFA81ECA49B600B75835 /* BVCommentsResponse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVCommentsResponse.m; sourceTree = ""; }; 87B8A7D7272FA8AE6BF8BFBA /* Pods_BVSDK_BVSDKTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_BVSDK_BVSDKTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 87C5FE971E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVStoreNotificationConfigurationLoader.h; sourceTree = ""; }; 87C5FE981E22914C004EE6E8 /* BVStoreNotificationConfigurationLoader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVStoreNotificationConfigurationLoader.m; sourceTree = ""; }; @@ -651,6 +671,12 @@ 87D425261E8EE39700147FDB /* BVViewedCGCEvent.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BVViewedCGCEvent.m; path = BVPixelEvents/BVViewedCGCEvent.m; sourceTree = ""; }; 87DA86DB1E5229C5002E7860 /* UIImage+BundleLocator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImage+BundleLocator.m"; sourceTree = ""; }; 87E28C821E5F88FE00915FDB /* BVPixelTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BVPixelTests.m; path = Tests/BVPixelTests.m; sourceTree = SOURCE_ROOT; }; + 87E810E31ECCA0190032C753 /* BVSortOptionsComments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVSortOptionsComments.h; sourceTree = ""; }; + 87E810E41ECCA0190032C753 /* BVSortOptionsComments.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVSortOptionsComments.m; sourceTree = ""; }; + 87E810E71ECCA3CF0032C753 /* BVCommentFilterType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVCommentFilterType.h; sourceTree = ""; }; + 87E810E81ECCA3CF0032C753 /* BVCommentFilterType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVCommentFilterType.m; sourceTree = ""; }; + 87E810EB1ECCC4CD0032C753 /* BVCommentIncludeType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BVCommentIncludeType.h; sourceTree = ""; }; + 87E810EC1ECCC4CD0032C753 /* BVCommentIncludeType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BVCommentIncludeType.m; sourceTree = ""; }; 87F2DAA71DAD579D00FB43F3 /* BVSDK.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BVSDK.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 87F2DAAA1DAD579D00FB43F3 /* BVSDK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BVSDK.h; sourceTree = ""; }; 87F2DAAB1DAD579D00FB43F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; @@ -1312,6 +1338,8 @@ 87C5FF651E393ED3004EE6E8 /* BVAuthorContentType.m */, 87C5FF681E394C73004EE6E8 /* BVAuthorInclude.h */, 87C5FF691E394C73004EE6E8 /* BVAuthorInclude.m */, + 87E810EB1ECCC4CD0032C753 /* BVCommentIncludeType.h */, + 87E810EC1ECCC4CD0032C753 /* BVCommentIncludeType.m */, 87D424E71E89C32E00147FDB /* BVReviewIncludeType.h */, 87D424E81E89C32E00147FDB /* BVReviewIncludeType.m */, 87F2DB5D1DAD585E00FB43F3 /* PDPContentType.h */, @@ -1326,12 +1354,18 @@ 87F2DB121DAD585E00FB43F3 /* Model */ = { isa = PBXGroup; children = ( + 87C5FF5A1E36A8B7004EE6E8 /* BVAuthorResponse.h */, + 87C5FF5B1E36A8B7004EE6E8 /* BVAuthorResponse.m */, 87F2DB131DAD585E00FB43F3 /* BVBadge.h */, 87F2DB141DAD585E00FB43F3 /* BVBadge.m */, 87F2DB151DAD585E00FB43F3 /* BVBadgeType.h */, 87F2DB161DAD585E00FB43F3 /* BVBadgeType.m */, + 1539745A1E719B9600BA52C1 /* BVBaseConversationsResponse.h */, + 1539745B1E719B9600BA52C1 /* BVBaseConversationsResponse.m */, 87F2DB171DAD585E00FB43F3 /* BVBrand.h */, 87F2DB181DAD585E00FB43F3 /* BVBrand.m */, + 150FC2C41E71C21700717041 /* BVBulkProductResponse.h */, + 150FC2C51E71C21700717041 /* BVBulkProductResponse.m */, 87F2DB191DAD585E00FB43F3 /* BVBulkRatingsResponse.h */, 87F2DB1A1DAD585E00FB43F3 /* BVBulkRatingsResponse.m */, 87F2DB1B1DAD585E00FB43F3 /* BVContextDataValue.h */, @@ -1340,6 +1374,8 @@ 87F2DB1E1DAD585E00FB43F3 /* BVConversationsError.m */, 87F2DB1F1DAD585E00FB43F3 /* BVConversationsErrorResponse.h */, 87F2DB201DAD585E00FB43F3 /* BVConversationsErrorResponse.m */, + 87B6DFA71ECA49B600B75835 /* BVCommentsResponse.h */, + 87B6DFA81ECA49B600B75835 /* BVCommentsResponse.m */, 87F2DB211DAD585E00FB43F3 /* BVConversationsInclude.h */, 87F2DB221DAD585E00FB43F3 /* BVConversationsInclude.m */, 87F2DB231DAD585E00FB43F3 /* BVDimensionAndDistributionUtil.h */, @@ -1358,12 +1394,8 @@ 87F2DB321DAD585E00FB43F3 /* BVPhotoSizes.m */, 87F2DB331DAD585E00FB43F3 /* BVProductsResponse.h */, 87F2DB341DAD585E00FB43F3 /* BVProductsResponse.m */, - 150FC2C41E71C21700717041 /* BVBulkProductResponse.h */, - 150FC2C51E71C21700717041 /* BVBulkProductResponse.m */, 87F2DB351DAD585E00FB43F3 /* BVProductStatistics.h */, 87F2DB361DAD585E00FB43F3 /* BVProductStatistics.m */, - 87C5FF5A1E36A8B7004EE6E8 /* BVAuthorResponse.h */, - 87C5FF5B1E36A8B7004EE6E8 /* BVAuthorResponse.m */, 87F2DB371DAD585E00FB43F3 /* BVQAStatistics.h */, 87F2DB381DAD585E00FB43F3 /* BVQAStatistics.m */, 87F2DB391DAD585E00FB43F3 /* BVQuestionsAndAnswersResponse.h */, @@ -1385,8 +1417,6 @@ 87F2DB471DAD585E00FB43F3 /* BVSecondaryRatingsAverages.m */, 87F2DB481DAD585E00FB43F3 /* BVVideo.h */, 87F2DB491DAD585E00FB43F3 /* BVVideo.m */, - 1539745A1E719B9600BA52C1 /* BVBaseConversationsResponse.h */, - 1539745B1E719B9600BA52C1 /* BVBaseConversationsResponse.m */, 87F2DB4A1DAD585E00FB43F3 /* GenericConversationsResult */, 87F2DB581DAD585E00FB43F3 /* Stores */, ); @@ -1399,14 +1429,16 @@ 87F2DB2C1DAD585E00FB43F3 /* BVGenericConversationsResult.h */, 87F2DB4B1DAD585E00FB43F3 /* BVAnswer.h */, 87F2DB4C1DAD585E00FB43F3 /* BVAnswer.m */, + 87C5FF601E36B416004EE6E8 /* BVAuthor.h */, + 87C5FF611E36B416004EE6E8 /* BVAuthor.m */, + 87B6DFA31ECA484400B75835 /* BVComment.h */, + 87B6DFA41ECA484400B75835 /* BVComment.m */, 87F2DB4D1DAD585E00FB43F3 /* BVProduct.h */, 87F2DB4E1DAD585E00FB43F3 /* BVProduct.m */, 87F2DB4F1DAD585E00FB43F3 /* BVQuestion.h */, 87F2DB501DAD585E00FB43F3 /* BVQuestion.m */, 87F2DB511DAD585E00FB43F3 /* BVReview.h */, 87F2DB521DAD585E00FB43F3 /* BVReview.m */, - 87C5FF601E36B416004EE6E8 /* BVAuthor.h */, - 87C5FF611E36B416004EE6E8 /* BVAuthor.m */, 87F2DB531DAD585E00FB43F3 /* Stores */, ); path = GenericConversationsResult; @@ -1437,12 +1469,16 @@ 87F2DB611DAD585E00FB43F3 /* Requests */ = { isa = PBXGroup; children = ( + 87C5FF561E368DF2004EE6E8 /* BVAuthorRequest.h */, + 87C5FF571E368DF2004EE6E8 /* BVAuthorRequest.m */, 153974451E6F151500BA52C1 /* BVBaseReviewsRequest.h */, 153974461E6F151500BA52C1 /* BVBaseReviewsRequest.m */, 150FC2C81E71C58B00717041 /* BVBaseProductRequest.h */, 150FC2C91E71C58B00717041 /* BVBaseProductRequest.m */, 87F2DB621DAD585E00FB43F3 /* BVBulkRatingsRequest.h */, 87F2DB631DAD585E00FB43F3 /* BVBulkRatingsRequest.m */, + 87B6DF9F1ECA424300B75835 /* BVCommentsRequest.h */, + 87B6DFA01ECA424300B75835 /* BVCommentsRequest.m */, 87F2DB641DAD585E00FB43F3 /* BVConversationsRequest.h */, 87F2DB651DAD585E00FB43F3 /* BVConversationsRequest.m */, 87F2DB661DAD585E00FB43F3 /* BVProductDisplayPageRequest.h */, @@ -1456,8 +1492,6 @@ 87F2DB691DAD585E00FB43F3 /* BVQuestionsAndAnswersRequest.m */, 87F2DB6A1DAD585E00FB43F3 /* BVReviewsRequest.h */, 87F2DB6B1DAD585E00FB43F3 /* BVReviewsRequest.m */, - 87C5FF561E368DF2004EE6E8 /* BVAuthorRequest.h */, - 87C5FF571E368DF2004EE6E8 /* BVAuthorRequest.m */, 87F2DB6C1DAD585E00FB43F3 /* Stores */, ); path = Requests; @@ -1479,6 +1513,8 @@ children = ( 87F2DB721DAD585E00FB43F3 /* BVBulkRatingsFilterType.h */, 87F2DB731DAD585E00FB43F3 /* BVBulkRatingsFilterType.m */, + 87E810E71ECCA3CF0032C753 /* BVCommentFilterType.h */, + 87E810E81ECCA3CF0032C753 /* BVCommentFilterType.m */, 87F2DB741DAD585E00FB43F3 /* BVFilter.h */, 87F2DB751DAD585E00FB43F3 /* BVFilter.m */, 87F2DB761DAD585E00FB43F3 /* BVFilterOperator.h */, @@ -1493,6 +1529,8 @@ 87F2DB7F1DAD585E00FB43F3 /* BVSort.m */, 87F2DB801DAD585E00FB43F3 /* BVSortOptionAnswers.h */, 87F2DB811DAD585E00FB43F3 /* BVSortOptionAnswers.m */, + 87E810E31ECCA0190032C753 /* BVSortOptionsComments.h */, + 87E810E41ECCA0190032C753 /* BVSortOptionsComments.m */, 87F2DB821DAD585E00FB43F3 /* BVSortOptionProducts.h */, 87F2DB831DAD585E00FB43F3 /* BVSortOptionProducts.m */, 87F2DB841DAD585E00FB43F3 /* BVSortOptionQuestions.h */, @@ -1892,6 +1930,7 @@ 87C5FF5E1E36AB70004EE6E8 /* ProfileDisplayTests.swift */, 87F2DDF71DAD945D00FB43F3 /* QuestionDisplayTests.swift */, 87F2DDF81DAD945D00FB43F3 /* ReviewDisplayTests.swift */, + 87B6DF9B1ECA3A0F00B75835 /* CommentsDisplayTests.swift */, 87F2DDF91DAD945D00FB43F3 /* StoresTests */, ); path = DisplayTests; @@ -2153,7 +2192,13 @@ 87D424E91E89C32E00147FDB /* BVReviewIncludeType.h in Headers */, 87D425271E8EE39700147FDB /* BVViewedCGCEvent.h in Headers */, 8777BB421EBA3823008C4715 /* BVSyndicationSource.h in Headers */, + 87B6DFA11ECA424300B75835 /* BVCommentsRequest.h in Headers */, + 87B6DFA91ECA49B600B75835 /* BVCommentsResponse.h in Headers */, 879A628B1E80502100F46ECA /* BVBasePIIEvent.h in Headers */, + 87B6DFA51ECA484400B75835 /* BVComment.h in Headers */, + 87E810E91ECCA3CF0032C753 /* BVCommentFilterType.h in Headers */, + 87E810ED1ECCC4CD0032C753 /* BVCommentIncludeType.h in Headers */, + 87E810E51ECCA0190032C753 /* BVSortOptionsComments.h in Headers */, 87F2DC241DAD585E00FB43F3 /* BVContextualInterests.h in Headers */, 87F2DC251DAD585E00FB43F3 /* BVGMBLSighting.h in Headers */, 87F2DC271DAD585E00FB43F3 /* BVGMBLVisit.h in Headers */, @@ -2218,6 +2263,7 @@ TargetAttributes = { 87F2DAA61DAD579D00FB43F3 = { CreatedOnToolsVersion = 8.0; + LastSwiftMigration = 0830; ProvisioningStyle = Automatic; }; 87F2DAAF1DAD579D00FB43F3 = { @@ -2486,6 +2532,8 @@ 87F2DCB01DAD585E00FB43F3 /* BVReviewsRequest.m in Sources */, 87F2DC9A1DAD585E00FB43F3 /* BVReview.m in Sources */, 875410B11E1F10DF006C5C6E /* BVNotificationViewController.m in Sources */, + 87E810EA1ECCA3CF0032C753 /* BVCommentFilterType.m in Sources */, + 87B6DFAA1ECA49B600B75835 /* BVCommentsResponse.m in Sources */, 873DC49E1E7482840080FA03 /* BVPixelTypes.m in Sources */, 875411821E1F201E006C5C6E /* BVStoreReviewNotificationCenter.m in Sources */, 87F2DCB61DAD585E00FB43F3 /* BVBulkRatingsFilterType.m in Sources */, @@ -2495,6 +2543,7 @@ 87F2DCDE1DAD585E00FB43F3 /* BVSubmissionErrorResponse.m in Sources */, 87F2DC921DAD585E00FB43F3 /* BVVideo.m in Sources */, 153974481E6F151500BA52C1 /* BVBaseReviewsRequest.m in Sources */, + 87E810E61ECCA0190032C753 /* BVSortOptionsComments.m in Sources */, 87F2DCB21DAD585E00FB43F3 /* BVBulkStoreItemsRequest.m in Sources */, 87F2DCE41DAD585E00FB43F3 /* BVUploadableStorePhoto.m in Sources */, 875411761E1F201E006C5C6E /* BVNotificationsAnalyticsHelper.m in Sources */, @@ -2544,6 +2593,7 @@ 87F2DC741DAD585E00FB43F3 /* BVDistributionValue.m in Sources */, 87F2DCC01DAD585E00FB43F3 /* BVReviewFilterType.m in Sources */, 87C5FEC81E22A05D004EE6E8 /* BVViewsHelper.m in Sources */, + 87E810EE1ECCC4CD0032C753 /* BVCommentIncludeType.m in Sources */, 87F2DCB81DAD585E00FB43F3 /* BVFilter.m in Sources */, 87F2DC7F1DAD585E00FB43F3 /* BVProductStatistics.m in Sources */, 87F2DC771DAD585E00FB43F3 /* BVModelUtil.m in Sources */, @@ -2564,6 +2614,8 @@ 87F2DC631DAD585E00FB43F3 /* BVBulkRatingsResponse.m in Sources */, 87F2DCC61DAD585E00FB43F3 /* BVSortOptionProducts.m in Sources */, 87F2DD161DAD585E00FB43F3 /* BVReviewView.m in Sources */, + 87B6DFA21ECA424300B75835 /* BVCommentsRequest.m in Sources */, + 87B6DFA61ECA484400B75835 /* BVComment.m in Sources */, 87F2DC8E1DAD585E00FB43F3 /* BVSecondaryRating.m in Sources */, 87F2DD191DAD585E00FB43F3 /* BVCurationsAddPostRequest.m in Sources */, ); @@ -2573,6 +2625,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + 87B6DF9C1ECA3A0F00B75835 /* CommentsDisplayTests.swift in Sources */, 87F2DD641DAD5E9400FB43F3 /* BVUserProfileTests.m in Sources */, 87F2DE171DAD945D00FB43F3 /* StoreReviewSubmissionTests.swift in Sources */, 87F2DE0C1DAD945D00FB43F3 /* ReviewDisplayTests.swift in Sources */, @@ -2716,6 +2769,7 @@ 87F2DABC1DAD579D00FB43F3 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2734,12 +2788,15 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bazaarvoice.bvsdk; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; 87F2DABD1DAD579D00FB43F3 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_MODULES = YES; CODE_SIGN_IDENTITY = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; @@ -2758,6 +2815,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.bazaarvoice.bvsdk; PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; }; name = Release; }; @@ -2765,7 +2823,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 3462CE8D50CC0B93A458E62C /* Pods-BVSDKTests.debug.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = BVSDKTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.bazaarvoice.bvsdk.BVSDKTests; @@ -2779,7 +2836,6 @@ isa = XCBuildConfiguration; baseConfigurationReference = 89529D79D81B13BA86882542 /* Pods-BVSDKTests.release.xcconfig */; buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; INFOPLIST_FILE = BVSDKTests/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.bazaarvoice.bvsdk.BVSDKTests; diff --git a/BVSDK/BVSDK.h b/BVSDK/BVSDK.h index 4e00673e..30266a04 100644 --- a/BVSDK/BVSDK.h +++ b/BVSDK/BVSDK.h @@ -99,6 +99,7 @@ FOUNDATION_EXPORT const unsigned char BVSDKVersionString[]; #import #import #import +#import #import #import #import @@ -111,6 +112,9 @@ FOUNDATION_EXPORT const unsigned char BVSDKVersionString[]; #import #import +#import +#import + // Curations #import #import diff --git a/BVSDK/Info.plist b/BVSDK/Info.plist index fc7bae4d..ad8809c8 100644 --- a/BVSDK/Info.plist +++ b/BVSDK/Info.plist @@ -15,9 +15,9 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 6.5.4 + 6.7.0 CFBundleVersion - 6.5.4 + 6.7.0 LSApplicationCategoryType NSPrincipalClass diff --git a/Examples/BVSDKDemo/BVSDKDemo/HomeViewController.swift b/Examples/BVSDKDemo/BVSDKDemo/HomeViewController.swift index e8d79c84..db4c7f2f 100644 --- a/Examples/BVSDKDemo/BVSDKDemo/HomeViewController.swift +++ b/Examples/BVSDKDemo/BVSDKDemo/HomeViewController.swift @@ -391,7 +391,7 @@ class HomeViewController: UIViewController, UICollectionViewDataSource, UICollec print("WARNING: The API Key being used does not support the use of bulk requests, so included review statistics will not be included.") self.loadConversations(omitStats: true) - + } else { self.doneLoading(with: errs.first!) } diff --git a/Examples/Conversations/Obj-C/ConversationsExample.xcodeproj/project.pbxproj b/Examples/Conversations/Obj-C/ConversationsExample.xcodeproj/project.pbxproj index 4db67643..d36cbea4 100644 --- a/Examples/Conversations/Obj-C/ConversationsExample.xcodeproj/project.pbxproj +++ b/Examples/Conversations/Obj-C/ConversationsExample.xcodeproj/project.pbxproj @@ -23,6 +23,9 @@ 87C5FF701E3A64B2004EE6E8 /* AuthorViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C5FF6F1E3A64B2004EE6E8 /* AuthorViewController.m */; }; 87C768431D4BB0AB0091E5A1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87C768391D4BB0AB0091E5A1 /* Assets.xcassets */; }; 87C7684C1D4BB1660091E5A1 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87C7684B1D4BB1660091E5A1 /* RootViewController.m */; }; + 87E810F91ECE4E710032C753 /* CommentsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E810F81ECE4E710032C753 /* CommentsViewController.m */; }; + 87E810FD1ECE50100032C753 /* MyCommentTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 87E810FB1ECE50100032C753 /* MyCommentTableViewCell.m */; }; + 87E810FE1ECE50100032C753 /* MyCommentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 87E810FC1ECE50100032C753 /* MyCommentTableViewCell.xib */; }; 87EB7D7D1D4BF2140014D5F9 /* QuestionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87EB7D7C1D4BF2140014D5F9 /* QuestionsViewController.m */; }; 87EB7D801D4BF5040014D5F9 /* PDPViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 87EB7D7F1D4BF5040014D5F9 /* PDPViewController.m */; }; 87EB7D831D4BFB890014D5F9 /* StatisticTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 87EB7D821D4BFB890014D5F9 /* StatisticTableViewCell.m */; }; @@ -60,6 +63,11 @@ 87C768391D4BB0AB0091E5A1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../../shared/Assets.xcassets; sourceTree = ""; }; 87C7684A1D4BB1660091E5A1 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewController.h; path = ConversationsExample/RootViewController.h; sourceTree = SOURCE_ROOT; }; 87C7684B1D4BB1660091E5A1 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewController.m; path = ConversationsExample/RootViewController.m; sourceTree = SOURCE_ROOT; }; + 87E810F71ECE4E710032C753 /* CommentsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CommentsViewController.h; sourceTree = ""; }; + 87E810F81ECE4E710032C753 /* CommentsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CommentsViewController.m; sourceTree = ""; }; + 87E810FA1ECE50100032C753 /* MyCommentTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyCommentTableViewCell.h; sourceTree = ""; }; + 87E810FB1ECE50100032C753 /* MyCommentTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyCommentTableViewCell.m; sourceTree = ""; }; + 87E810FC1ECE50100032C753 /* MyCommentTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MyCommentTableViewCell.xib; sourceTree = ""; }; 87EB7D7B1D4BF2140014D5F9 /* QuestionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionsViewController.h; sourceTree = ""; }; 87EB7D7C1D4BF2140014D5F9 /* QuestionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuestionsViewController.m; sourceTree = ""; }; 87EB7D7E1D4BF5040014D5F9 /* PDPViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PDPViewController.h; sourceTree = ""; }; @@ -143,18 +151,20 @@ children = ( 87C7684A1D4BB1660091E5A1 /* RootViewController.h */, 87C7684B1D4BB1660091E5A1 /* RootViewController.m */, - 873C79591D4BF0C90048AD55 /* ReviewsViewController.h */, - 873C795A1D4BF0C90048AD55 /* ReviewsViewController.m */, - 87C5FF6E1E3A64B2004EE6E8 /* AuthorViewController.h */, - 87C5FF6F1E3A64B2004EE6E8 /* AuthorViewController.m */, - 87EB7D7B1D4BF2140014D5F9 /* QuestionsViewController.h */, - 87EB7D7C1D4BF2140014D5F9 /* QuestionsViewController.m */, 87FF7F291D4F90B300019D54 /* AnswersViewController.h */, 87FF7F2A1D4F90B300019D54 /* AnswersViewController.m */, - 87EB7D7E1D4BF5040014D5F9 /* PDPViewController.h */, - 87EB7D7F1D4BF5040014D5F9 /* PDPViewController.m */, + 87C5FF6E1E3A64B2004EE6E8 /* AuthorViewController.h */, + 87C5FF6F1E3A64B2004EE6E8 /* AuthorViewController.m */, + 87E810F71ECE4E710032C753 /* CommentsViewController.h */, + 87E810F81ECE4E710032C753 /* CommentsViewController.m */, 87EB7D841D4CCF0D0014D5F9 /* InlineRatingsViewController.h */, 87EB7D851D4CCF0D0014D5F9 /* InlineRatingsViewController.m */, + 87EB7D7E1D4BF5040014D5F9 /* PDPViewController.h */, + 87EB7D7F1D4BF5040014D5F9 /* PDPViewController.m */, + 87EB7D7B1D4BF2140014D5F9 /* QuestionsViewController.h */, + 87EB7D7C1D4BF2140014D5F9 /* QuestionsViewController.m */, + 873C79591D4BF0C90048AD55 /* ReviewsViewController.h */, + 873C795A1D4BF0C90048AD55 /* ReviewsViewController.m */, ); name = ViewControllers; sourceTree = ""; @@ -162,15 +172,18 @@ 87FF7F331D4F91C200019D54 /* TableViewCells */ = { isa = PBXGroup; children = ( - 8748638A1D4BDDCF00B43F00 /* MyReviewTableViewCell.h */, - 8748638B1D4BDDCF00B43F00 /* MyReviewTableViewCell.m */, - 874863901D4BE47300B43F00 /* MyQuestionTableViewCell.h */, - 874863911D4BE47300B43F00 /* MyQuestionTableViewCell.m */, 87FF7F2F1D4F91B100019D54 /* MyAnswerTableViewCell.h */, 87FF7F301D4F91B100019D54 /* MyAnswerTableViewCell.m */, + 87E810FA1ECE50100032C753 /* MyCommentTableViewCell.h */, + 87E810FB1ECE50100032C753 /* MyCommentTableViewCell.m */, + 874863901D4BE47300B43F00 /* MyQuestionTableViewCell.h */, + 874863911D4BE47300B43F00 /* MyQuestionTableViewCell.m */, + 8748638A1D4BDDCF00B43F00 /* MyReviewTableViewCell.h */, + 8748638B1D4BDDCF00B43F00 /* MyReviewTableViewCell.m */, 87EB7D811D4BFB890014D5F9 /* StatisticTableViewCell.h */, 87EB7D821D4BFB890014D5F9 /* StatisticTableViewCell.m */, 874863931D4BE5FB00B43F00 /* MyAnswerTableViewCell.xib */, + 87E810FC1ECE50100032C753 /* MyCommentTableViewCell.xib */, 874863941D4BE5FB00B43F00 /* MyQuestionTableViewCell.xib */, 874863951D4BE5FB00B43F00 /* MyReviewTableViewCell.xib */, 874863961D4BE5FB00B43F00 /* StatisticTableViewCell.xib */, @@ -258,6 +271,7 @@ 15E077DA1E576854001C89D0 /* bvsdk_config_prod.json in Resources */, 874863891D4BDA8F00B43F00 /* Main.storyboard in Resources */, 8748639A1D4BE5FB00B43F00 /* StatisticTableViewCell.xib in Resources */, + 87E810FE1ECE50100032C753 /* MyCommentTableViewCell.xib in Resources */, 874863991D4BE5FB00B43F00 /* MyReviewTableViewCell.xib in Resources */, 87C768431D4BB0AB0091E5A1 /* Assets.xcassets in Resources */, 15E077D91E576854001C89D0 /* bvsdk_config_staging.json in Resources */, @@ -333,7 +347,9 @@ 876DF55C1CF4E87B005D841F /* AppDelegate.m in Sources */, 874863921D4BE47300B43F00 /* MyQuestionTableViewCell.m in Sources */, 87C5FF701E3A64B2004EE6E8 /* AuthorViewController.m in Sources */, + 87E810FD1ECE50100032C753 /* MyCommentTableViewCell.m in Sources */, 876DF5591CF4E87B005D841F /* main.m in Sources */, + 87E810F91ECE4E710032C753 /* CommentsViewController.m in Sources */, 87C7684C1D4BB1660091E5A1 /* RootViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/Examples/Conversations/Obj-C/ConversationsExample/Base.lproj/Main.storyboard b/Examples/Conversations/Obj-C/ConversationsExample/Base.lproj/Main.storyboard index 6255fc4a..ad32941e 100644 --- a/Examples/Conversations/Obj-C/ConversationsExample/Base.lproj/Main.storyboard +++ b/Examples/Conversations/Obj-C/ConversationsExample/Base.lproj/Main.storyboard @@ -1,8 +1,11 @@ - - + + + + + - + @@ -21,65 +24,82 @@ + + @@ -87,10 +107,11 @@ - + + @@ -98,6 +119,7 @@ + @@ -126,6 +148,7 @@ + @@ -163,6 +186,7 @@ + @@ -187,6 +211,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -200,6 +258,7 @@ + @@ -253,13 +312,14 @@ + - + - + @@ -300,6 +360,7 @@ + @@ -333,6 +394,7 @@ + diff --git a/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.h b/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.h new file mode 100644 index 00000000..3f3fb3a7 --- /dev/null +++ b/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.h @@ -0,0 +1,12 @@ +// +// CommentsViewController.h +// ConversationsExample +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +@interface CommentsViewController : UIViewController + +@end diff --git a/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.m b/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.m new file mode 100644 index 00000000..3f280682 --- /dev/null +++ b/Examples/Conversations/Obj-C/ConversationsExample/CommentsViewController.m @@ -0,0 +1,68 @@ +// +// CommentsViewController.m +// ConversationsExample +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "CommentsViewController.h" +#import "BVComment.h" +#import "MyCommentTableViewCell.h" + +@interface CommentsViewController () + +@property (weak, nonatomic) IBOutlet UITableView *commentsTableView; + +@property NSArray *comments; + +@end + +@implementation CommentsViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + self.comments = [NSArray array]; + + self.commentsTableView.dataSource = self; + self.commentsTableView.estimatedRowHeight = 44; + self.commentsTableView.rowHeight = UITableViewAutomaticDimension; + [self.commentsTableView registerNib:[UINib nibWithNibName:@"MyCommentTableViewCell" bundle:nil] forCellReuseIdentifier:@"MyCommentTableViewCell"]; + + BVCommentsRequest *request = [[BVCommentsRequest alloc] initWithReviewId:@"192548" limit:99 offset:0]; + + [request load:^(BVCommentsResponse * _Nonnull response) { + // success + self.comments = response.results; + [self.commentsTableView reloadData]; + + } failure:^(NSArray * _Nonnull errors) { + // error + NSLog(@"ERROR Loading Comments: %@", errors.firstObject.localizedDescription); + }]; + + +} + +#pragma mark UITableViewDatasource + +-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section{ + return @"Comments"; +} + +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return [self.comments count]; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + + MyCommentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MyCommentTableViewCell"]; + + cell.comment = [self.comments objectAtIndex:indexPath.row]; + + return cell; +} + + + +@end diff --git a/Examples/Conversations/Obj-C/ConversationsExample/MyAnswerTableViewCell.xib b/Examples/Conversations/Obj-C/ConversationsExample/MyAnswerTableViewCell.xib index b0baada7..90a85415 100644 --- a/Examples/Conversations/Obj-C/ConversationsExample/MyAnswerTableViewCell.xib +++ b/Examples/Conversations/Obj-C/ConversationsExample/MyAnswerTableViewCell.xib @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -17,13 +21,11 @@ - @@ -31,7 +33,6 @@ - diff --git a/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.h b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.h new file mode 100644 index 00000000..7f9161df --- /dev/null +++ b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.h @@ -0,0 +1,16 @@ +// +// MyCommentTableViewCell.h +// ConversationsExample +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +@import BVSDK; + +@interface MyCommentTableViewCell : UITableViewCell + +@property (nonatomic, strong) BVComment *comment; + +@end diff --git a/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.m b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.m new file mode 100644 index 00000000..3be03a4c --- /dev/null +++ b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.m @@ -0,0 +1,33 @@ +// +// MyCommentTableViewCell.m +// ConversationsExample +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "MyCommentTableViewCell.h" + +@interface MyCommentTableViewCell () + +@property (weak, nonatomic) IBOutlet UILabel *commentTitle; +@property (weak, nonatomic) IBOutlet UILabel *commentText; + + +@end + + +@implementation MyCommentTableViewCell + +@synthesize comment = _comment; + +- (void)setComment:(BVComment *)comment{ + + _comment = comment; + self.commentTitle.text = self.comment.title ? self.comment.title : @"No title"; + self.commentText.text = self.comment.commentText ? self.comment.commentText : @"No comment text"; + +} + + + +@end diff --git a/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.xib b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.xib new file mode 100644 index 00000000..dfbf8c04 --- /dev/null +++ b/Examples/Conversations/Obj-C/ConversationsExample/MyCommentTableViewCell.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Conversations/Obj-C/ConversationsExample/MyReviewTableViewCell.m b/Examples/Conversations/Obj-C/ConversationsExample/MyReviewTableViewCell.m index 1467648b..c83eba83 100644 --- a/Examples/Conversations/Obj-C/ConversationsExample/MyReviewTableViewCell.m +++ b/Examples/Conversations/Obj-C/ConversationsExample/MyReviewTableViewCell.m @@ -22,7 +22,7 @@ - (void)setReview:(BVReview *)review{ super.review = review; self.reviewTitle.text = review.title; self.reviewText.text = review.reviewText; - + } @end diff --git a/Examples/Conversations/Obj-C/ConversationsExample/ReviewsViewController.m b/Examples/Conversations/Obj-C/ConversationsExample/ReviewsViewController.m index 39117065..e5760f8e 100644 --- a/Examples/Conversations/Obj-C/ConversationsExample/ReviewsViewController.m +++ b/Examples/Conversations/Obj-C/ConversationsExample/ReviewsViewController.m @@ -33,6 +33,7 @@ - (void)viewDidLoad { BVReviewsRequest* request = [[BVReviewsRequest alloc] initWithProductId:@"test1" limit:20 offset:0]; [request addReviewSort:BVSortOptionReviewsSubmissionTime order:BVSortOrderDescending]; + [request addInclude:BVReviewIncludeTypeComments]; [self.reviewsTableView load:request success:^(BVReviewsResponse * _Nonnull response) { self.reviews = response.results; diff --git a/Examples/Conversations/Obj-C/Podfile.lock b/Examples/Conversations/Obj-C/Podfile.lock index 5a2e268f..8ae173e8 100644 --- a/Examples/Conversations/Obj-C/Podfile.lock +++ b/Examples/Conversations/Obj-C/Podfile.lock @@ -1,7 +1,7 @@ PODS: - - BVSDK/BVConversations (6.5.0): + - BVSDK/BVConversations (6.7.0): - BVSDK/Core - - BVSDK/Core (6.5.0) + - BVSDK/Core (6.7.0) DEPENDENCIES: - BVSDK/BVConversations (from `../../../`) @@ -11,7 +11,7 @@ EXTERNAL SOURCES: :path: "../../../" SPEC CHECKSUMS: - BVSDK: f71d4466f852ca86901bd703c1cb10b896634dbf + BVSDK: b7282f1b646d716c65c249d8e6f5a30d93e5419d PODFILE CHECKSUM: 9e1e2f031337aa6807bc35f4e4832b444a6e4d39 diff --git a/Examples/Conversations/Swift/ConversationsExample.xcodeproj/project.pbxproj b/Examples/Conversations/Swift/ConversationsExample.xcodeproj/project.pbxproj index a3318b08..057bfb1c 100644 --- a/Examples/Conversations/Swift/ConversationsExample.xcodeproj/project.pbxproj +++ b/Examples/Conversations/Swift/ConversationsExample.xcodeproj/project.pbxproj @@ -30,6 +30,9 @@ 87A36D2E1D4A911D00C3B41F /* StatisticTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87A36D211D4A911D00C3B41F /* StatisticTableViewCell.swift */; }; 87C5FF721E3AB826004EE6E8 /* AuthorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87C5FF711E3AB826004EE6E8 /* AuthorViewController.swift */; }; 87C768311D4BAEE40091E5A1 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 87C768301D4BAEE40091E5A1 /* Assets.xcassets */; }; + 87E810F11ECE2E810032C753 /* MyCommentTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87E810EF1ECE2E810032C753 /* MyCommentTableViewCell.swift */; }; + 87E810F21ECE2E810032C753 /* MyCommentTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 87E810F01ECE2E810032C753 /* MyCommentTableViewCell.xib */; }; + 87E810F61ECE3B850032C753 /* CommentsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 87E810F51ECE3B850032C753 /* CommentsViewController.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -57,6 +60,9 @@ 87A36D211D4A911D00C3B41F /* StatisticTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatisticTableViewCell.swift; sourceTree = ""; }; 87C5FF711E3AB826004EE6E8 /* AuthorViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AuthorViewController.swift; sourceTree = ""; }; 87C768301D4BAEE40091E5A1 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = ../../shared/Assets.xcassets; sourceTree = ""; }; + 87E810EF1ECE2E810032C753 /* MyCommentTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MyCommentTableViewCell.swift; sourceTree = ""; }; + 87E810F01ECE2E810032C753 /* MyCommentTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MyCommentTableViewCell.xib; sourceTree = ""; }; + 87E810F51ECE3B850032C753 /* CommentsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommentsViewController.swift; sourceTree = ""; }; 909C5142B4FD3F9A67D7946B /* Pods-ConversationsExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConversationsExample.release.xcconfig"; path = "Pods/Target Support Files/Pods-ConversationsExample/Pods-ConversationsExample.release.xcconfig"; sourceTree = ""; }; CFC56A0C9936361286873F90 /* Pods_ConversationsExample.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ConversationsExample.framework; sourceTree = BUILT_PRODUCTS_DIR; }; F0BC9EC056B779FF75705C65 /* Pods-ConversationsExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ConversationsExample.debug.xcconfig"; path = "Pods/Target Support Files/Pods-ConversationsExample/Pods-ConversationsExample.debug.xcconfig"; sourceTree = ""; }; @@ -138,12 +144,13 @@ isa = PBXGroup; children = ( 87A36D201D4A911D00C3B41F /* RootViewController.swift */, - 879143F31CF4F05C00976220 /* ReviewsViewController.swift */, - 87A36D1F1D4A911D00C3B41F /* QuestionsViewController.swift */, + 87C5FF711E3AB826004EE6E8 /* AuthorViewController.swift */, 87A36D161D4A911D00C3B41F /* AnswersViewController.swift */, + 87E810F51ECE3B850032C753 /* CommentsViewController.swift */, 87A36D171D4A911D00C3B41F /* InlineRatingsViewController.swift */, + 879143F31CF4F05C00976220 /* ReviewsViewController.swift */, + 87A36D1F1D4A911D00C3B41F /* QuestionsViewController.swift */, 87A36D1E1D4A911D00C3B41F /* PDPViewController.swift */, - 87C5FF711E3AB826004EE6E8 /* AuthorViewController.swift */, ); name = "View Controllers"; sourceTree = ""; @@ -153,9 +160,11 @@ children = ( 87A36D211D4A911D00C3B41F /* StatisticTableViewCell.swift */, 87A36D181D4A911D00C3B41F /* MyAnswerTableViewCell.swift */, + 87E810EF1ECE2E810032C753 /* MyCommentTableViewCell.swift */, 87A36D1A1D4A911D00C3B41F /* MyQuestionTableViewCell.swift */, 87A36D1C1D4A911D00C3B41F /* MyReviewTableViewCell.swift */, 8748639B1D4BE64A00B43F00 /* MyAnswerTableViewCell.xib */, + 87E810F01ECE2E810032C753 /* MyCommentTableViewCell.xib */, 8748639C1D4BE64A00B43F00 /* MyQuestionTableViewCell.xib */, 8748639D1D4BE64A00B43F00 /* MyReviewTableViewCell.xib */, 8748639E1D4BE64A00B43F00 /* StatisticTableViewCell.xib */, @@ -227,6 +236,7 @@ 8748637B1D4BD8E000B43F00 /* Main.storyboard in Resources */, 15E077DD1E5769CA001C89D0 /* bvsdk_config_prod.json in Resources */, 874863A21D4BE64A00B43F00 /* StatisticTableViewCell.xib in Resources */, + 87E810F21ECE2E810032C753 /* MyCommentTableViewCell.xib in Resources */, 874863A11D4BE64A00B43F00 /* MyReviewTableViewCell.xib in Resources */, 8748637A1D4BD8E000B43F00 /* LaunchScreen.storyboard in Resources */, 15E077DE1E5769CA001C89D0 /* bvsdk_config_staging.json in Resources */, @@ -296,8 +306,10 @@ 87A36D231D4A911D00C3B41F /* AnswersViewController.swift in Sources */, 87C5FF721E3AB826004EE6E8 /* AuthorViewController.swift in Sources */, 87A36D2E1D4A911D00C3B41F /* StatisticTableViewCell.swift in Sources */, + 87E810F11ECE2E810032C753 /* MyCommentTableViewCell.swift in Sources */, 879143F41CF4F05C00976220 /* ReviewsViewController.swift in Sources */, 87A36D241D4A911D00C3B41F /* InlineRatingsViewController.swift in Sources */, + 87E810F61ECE3B850032C753 /* CommentsViewController.swift in Sources */, 8777BB3F1EB7BE18008C4715 /* Constants.swift in Sources */, 879143F21CF4F05C00976220 /* AppDelegate.swift in Sources */, 87A36D2C1D4A911D00C3B41F /* QuestionsViewController.swift in Sources */, diff --git a/Examples/Conversations/Swift/ConversationsExample/Base.lproj/Main.storyboard b/Examples/Conversations/Swift/ConversationsExample/Base.lproj/Main.storyboard index 8b9af977..e07ef36e 100644 --- a/Examples/Conversations/Swift/ConversationsExample/Base.lproj/Main.storyboard +++ b/Examples/Conversations/Swift/ConversationsExample/Base.lproj/Main.storyboard @@ -1,14 +1,17 @@ - - + + + + + - + - + @@ -21,65 +24,82 @@ + + @@ -94,20 +114,22 @@ + - - + + + - + @@ -126,6 +148,7 @@ + @@ -163,6 +186,7 @@ + @@ -200,6 +224,7 @@ + @@ -256,13 +281,14 @@ + - + - + @@ -290,6 +316,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -303,6 +363,7 @@ + @@ -336,6 +397,7 @@ + diff --git a/Examples/Conversations/Swift/ConversationsExample/CommentsViewController.swift b/Examples/Conversations/Swift/ConversationsExample/CommentsViewController.swift new file mode 100644 index 00000000..ef9e4e3a --- /dev/null +++ b/Examples/Conversations/Swift/ConversationsExample/CommentsViewController.swift @@ -0,0 +1,67 @@ +// +// CommentsViewController.swift +// +// Copyright © 2016 Bazaarvoice. All rights reserved. +// + +import UIKit +import BVSDK + +class CommentsViewController: UIViewController, UITableViewDataSource { + + + @IBOutlet weak var commentsTaleView: UITableView! + var comments : [BVComment] = [] + + override func viewDidLoad() { + super.viewDidLoad() + + commentsTaleView.dataSource = self + commentsTaleView.estimatedRowHeight = 44 + commentsTaleView.rowHeight = UITableViewAutomaticDimension + commentsTaleView.register(UINib(nibName: "MyCommentTableViewCell", bundle: nil), forCellReuseIdentifier: "MyCommentTableViewCell") + + let limit : UInt16 = 99 + let offset : UInt16 = 0 + + let request = BVCommentsRequest(reviewId: Constants.TEST_REVIEW_ID_FOR_COMMENTS, limit: limit, offset: offset) + + request.load({ (response) in + + self.comments = response.results + self.commentsTaleView.reloadData() + + }) { (error) in + + print("ERROR fetching comments: \(error.first!.localizedDescription)") + + } + + } + + override func didReceiveMemoryWarning() { + super.didReceiveMemoryWarning() + // Dispose of any resources that can be recreated. + } + + // MARK: UITableViewDatasource + + func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? { + return "Available Comments" + } + + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return comments.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + let tableCell = tableView.dequeueReusableCell(withIdentifier: "MyCommentTableViewCell") as! MyCommentTableViewCell + + tableCell.comment = comments[indexPath.row] + + return tableCell + } + + + +} diff --git a/Examples/Conversations/Swift/ConversationsExample/Constants.swift b/Examples/Conversations/Swift/ConversationsExample/Constants.swift index 763b9f04..ec6daf6f 100644 --- a/Examples/Conversations/Swift/ConversationsExample/Constants.swift +++ b/Examples/Conversations/Swift/ConversationsExample/Constants.swift @@ -18,4 +18,7 @@ struct Constants { // Used for a BVAuthorRequest static let TEST_AUTHOR_ID = "data-gen-user-c3k8hjvtpn03dupvxcui1rj3" + // Review Id with Comments + static let TEST_REVIEW_ID_FOR_COMMENTS = "192548" + } diff --git a/Examples/Conversations/Swift/ConversationsExample/MyAnswerTableViewCell.xib b/Examples/Conversations/Swift/ConversationsExample/MyAnswerTableViewCell.xib index a6b8cad9..40916966 100644 --- a/Examples/Conversations/Swift/ConversationsExample/MyAnswerTableViewCell.xib +++ b/Examples/Conversations/Swift/ConversationsExample/MyAnswerTableViewCell.xib @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -18,7 +22,7 @@ diff --git a/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.swift b/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.swift new file mode 100644 index 00000000..d401e168 --- /dev/null +++ b/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.swift @@ -0,0 +1,27 @@ +// +// MyCommentTableViewCell.swift +// ConversationsExample +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +import UIKit +import BVSDK + +class MyCommentTableViewCell: UITableViewCell { + + @IBOutlet var commentTitle: UILabel! + @IBOutlet var commentLabel: UILabel! + + var comment : BVComment? { + + didSet { + + commentTitle.text = comment?.title ?? "" + commentLabel.text = comment?.commentText ?? "Error" + + } + + } + +} diff --git a/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.xib b/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.xib new file mode 100644 index 00000000..10462002 --- /dev/null +++ b/Examples/Conversations/Swift/ConversationsExample/MyCommentTableViewCell.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Examples/Conversations/Swift/ConversationsExample/MyQuestionTableViewCell.xib b/Examples/Conversations/Swift/ConversationsExample/MyQuestionTableViewCell.xib index 18141d12..6464ed97 100644 --- a/Examples/Conversations/Swift/ConversationsExample/MyQuestionTableViewCell.xib +++ b/Examples/Conversations/Swift/ConversationsExample/MyQuestionTableViewCell.xib @@ -1,9 +1,13 @@ - - + + + + + - + + @@ -15,13 +19,13 @@ - - + - + diff --git a/Examples/Conversations/Swift/ConversationsExample/MyReviewTableViewCell.swift b/Examples/Conversations/Swift/ConversationsExample/MyReviewTableViewCell.swift index c9abcb1e..8e2cbd32 100644 --- a/Examples/Conversations/Swift/ConversationsExample/MyReviewTableViewCell.swift +++ b/Examples/Conversations/Swift/ConversationsExample/MyReviewTableViewCell.swift @@ -73,6 +73,11 @@ class MyReviewTableViewCell: BVReviewTableViewCell { reviewString?.append(secondaryRatingsText) + // check for comments + let commentsText = "\nNum Comments: [\(review!.comments.count)]" + + reviewString?.append(commentsText) + reviewText.text = reviewString } diff --git a/Examples/Conversations/Swift/ConversationsExample/ReviewsViewController.swift b/Examples/Conversations/Swift/ConversationsExample/ReviewsViewController.swift index 7b520f11..33474204 100644 --- a/Examples/Conversations/Swift/ConversationsExample/ReviewsViewController.swift +++ b/Examples/Conversations/Swift/ConversationsExample/ReviewsViewController.swift @@ -24,6 +24,7 @@ class ReviewsViewController: UIViewController, UITableViewDataSource { let reviewsRequest = BVReviewsRequest(productId: Constants.TEST_PRODUCT_ID, limit: 20, offset: 0) reviewsRequest.addReviewSort(.submissionTime, order: .descending) + reviewsRequest.addInclude(.comments) reviewsTableView.load(reviewsRequest, success: { (response) in diff --git a/Examples/Conversations/Swift/Podfile.lock b/Examples/Conversations/Swift/Podfile.lock index 8e143a82..522c9583 100644 --- a/Examples/Conversations/Swift/Podfile.lock +++ b/Examples/Conversations/Swift/Podfile.lock @@ -1,7 +1,7 @@ PODS: - - BVSDK/BVConversations (6.5.3): + - BVSDK/BVConversations (6.7.0): - BVSDK/Core - - BVSDK/Core (6.5.3) + - BVSDK/Core (6.7.0) DEPENDENCIES: - BVSDK/BVConversations (from `../../../`) @@ -11,7 +11,8 @@ EXTERNAL SOURCES: :path: "../../../" SPEC CHECKSUMS: - BVSDK: 6ece9146d08c9d70f62db4b99c7e1916137ede22 + + BVSDK: b7282f1b646d716c65c249d8e6f5a30d93e5419d PODFILE CHECKSUM: ff51a28f7873cf9d401e0c25277fa303397c7510 diff --git a/Examples/Curations/Swift/Podfile.lock b/Examples/Curations/Swift/Podfile.lock index fd916833..e0a9d05e 100644 --- a/Examples/Curations/Swift/Podfile.lock +++ b/Examples/Curations/Swift/Podfile.lock @@ -1,9 +1,9 @@ PODS: - - BVSDK/BVCurations (6.4.1): + - BVSDK/BVCurations (6.5.3): - BVSDK/Core - - BVSDK/BVCurationsUI (6.4.1): + - BVSDK/BVCurationsUI (6.5.3): - BVSDK/BVCurations - - BVSDK/Core (6.4.1) + - BVSDK/Core (6.5.3) - SDWebImage (4.0.0): - SDWebImage/Core (= 4.0.0) - SDWebImage/Core (4.0.0) @@ -18,7 +18,7 @@ EXTERNAL SOURCES: :path: "../../../" SPEC CHECKSUMS: - BVSDK: 783400577005a896591cc18044dcc827103efea2 + BVSDK: 6ece9146d08c9d70f62db4b99c7e1916137ede22 SDWebImage: 76a6348bdc74eb5a55dd08a091ef298e56b55e41 PODFILE CHECKSUM: 8e045d35f4f0feaf99dc296550172bad4f4d99e3 diff --git a/Pod/BVCommon/BVSDKConstants.h b/Pod/BVCommon/BVSDKConstants.h index 7d6b40be..98f41706 100644 --- a/Pod/BVCommon/BVSDKConstants.h +++ b/Pod/BVCommon/BVSDKConstants.h @@ -11,11 +11,11 @@ /// Provides the master version of the SDK. -#define BV_SDK_VERSION @"6.5.3" +#define BV_SDK_VERSION @"6.7.0" /// Conversation SDK Version #define SDK_HEADER_NAME @"X-UA-BV-SDK" -#define SDK_HEADER_VALUE @"IOS_SDK_V653" +#define SDK_HEADER_VALUE @"IOS_SDK_V670" /// Error domain for NSError results, when present. #define BVErrDomain @"com.bvsdk.bazaarvoice" diff --git a/Pod/BVConversations/Display/BVCommentIncludeType.h b/Pod/BVConversations/Display/BVCommentIncludeType.h new file mode 100644 index 00000000..16c94bcd --- /dev/null +++ b/Pod/BVConversations/Display/BVCommentIncludeType.h @@ -0,0 +1,24 @@ +// +// BVCommentIncludeType.h +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +/// Types of Bazaarvoice content that can be included with a Profile. +typedef NS_ENUM(NSInteger, BVCommentIncludeType) { + BVCommentIncludeTypeReviews, + BVCommentIncludeTypeProducts, + BVCommentIncludeTypeAuthors +}; + + +@interface BVCommentIncludeTypeUtil : NSObject + ++(NSString*)toString:(BVCommentIncludeType)type; + +@end + + diff --git a/Pod/BVConversations/Display/BVCommentIncludeType.m b/Pod/BVConversations/Display/BVCommentIncludeType.m new file mode 100644 index 00000000..ffdfb23e --- /dev/null +++ b/Pod/BVConversations/Display/BVCommentIncludeType.m @@ -0,0 +1,22 @@ +// +// BVCommentIncludeType.m +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVCommentIncludeType.h" + +@implementation BVCommentIncludeTypeUtil + ++(NSString*)toString:(BVCommentIncludeType)type{ + + switch (type) { + case BVCommentIncludeTypeProducts: return @"Products"; + case BVCommentIncludeTypeReviews: return @"Reviews"; + case BVCommentIncludeTypeAuthors: return @"Authors"; + } + +} + +@end diff --git a/Pod/BVConversations/Display/BVReviewIncludeType.h b/Pod/BVConversations/Display/BVReviewIncludeType.h index bf80e13c..d3ee1b29 100644 --- a/Pod/BVConversations/Display/BVReviewIncludeType.h +++ b/Pod/BVConversations/Display/BVReviewIncludeType.h @@ -10,7 +10,8 @@ /// Types of Bazaarvoice content that can be included with a Profile. typedef NS_ENUM(NSInteger, BVReviewIncludeType) { - BVReviewIncludeTypeProducts + BVReviewIncludeTypeProducts, + BVReviewIncludeTypeComments }; diff --git a/Pod/BVConversations/Display/BVReviewIncludeType.m b/Pod/BVConversations/Display/BVReviewIncludeType.m index 0ea7c1cc..77d79b2e 100644 --- a/Pod/BVConversations/Display/BVReviewIncludeType.m +++ b/Pod/BVConversations/Display/BVReviewIncludeType.m @@ -11,8 +11,8 @@ @implementation BVReviewIncludeTypeUtil +(NSString*)toString:(BVReviewIncludeType)type { switch (type) { - case BVReviewIncludeTypeProducts: - return @"Products"; + case BVReviewIncludeTypeProducts: return @"Products"; + case BVReviewIncludeTypeComments: return @"Comments"; } } diff --git a/Pod/BVConversations/Display/Model/BVAuthorResponse.h b/Pod/BVConversations/Display/Model/BVAuthorResponse.h index 006d9162..0cfa596c 100644 --- a/Pod/BVConversations/Display/Model/BVAuthorResponse.h +++ b/Pod/BVConversations/Display/Model/BVAuthorResponse.h @@ -9,6 +9,7 @@ #import "BVResponse.h" #import "BVAuthor.h" #import "BVBaseConversationsResponse.h" + @interface BVAuthorResponse : BVBaseConversationsResultsResponse @end diff --git a/Pod/BVConversations/Display/Model/BVCommentsResponse.h b/Pod/BVConversations/Display/Model/BVCommentsResponse.h new file mode 100644 index 00000000..450dbc22 --- /dev/null +++ b/Pod/BVConversations/Display/Model/BVCommentsResponse.h @@ -0,0 +1,15 @@ +// +// BVCommentsResponse.h +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +#import "BVBaseConversationsResponse.h" +#import "BVComment.h" + +@interface BVCommentsResponse : BVBaseConversationsResultsResponse + +@end diff --git a/Pod/BVConversations/Display/Model/BVCommentsResponse.m b/Pod/BVConversations/Display/Model/BVCommentsResponse.m new file mode 100644 index 00000000..7c930b95 --- /dev/null +++ b/Pod/BVConversations/Display/Model/BVCommentsResponse.m @@ -0,0 +1,16 @@ +// +// BVCommentsRespose.m +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVCommentsResponse.h" + +@implementation BVCommentsResponse + +-(id)createResult:(NSDictionary *)raw includes:(BVConversationsInclude *)includes { + return [[BVComment alloc] initWithApiResponse:raw includes:includes]; +} + +@end diff --git a/Pod/BVConversations/Display/Model/BVConversationsInclude.h b/Pod/BVConversations/Display/Model/BVConversationsInclude.h index a4ffef40..4ca953ec 100644 --- a/Pod/BVConversations/Display/Model/BVConversationsInclude.h +++ b/Pod/BVConversations/Display/Model/BVConversationsInclude.h @@ -10,6 +10,8 @@ #import "BVAnswer.h" #import "BVQuestion.h" #import "BVReview.h" +#import "BVComment.h" +#import "BVAuthor.h" /// Internal utility - used only within BVSDK @interface BVConversationsInclude : NSObject @@ -20,6 +22,8 @@ -(BVProduct* _Nullable)getProductById:(NSString* _Nonnull)productId; -(BVReview* _Nullable)getReviewById:(NSString* _Nonnull)reviewId; -(BVQuestion* _Nullable)getQuestionById:(NSString* _Nonnull)questionId; +-(BVComment* _Nullable)getCommentById:(NSString* _Nonnull)commentId; +-(BVAuthor* _Nullable)getAuthorById:(NSString* _Nonnull)authorId; @property (nonatomic, strong, readonly) NSDictionary * _Nonnull apiResponse; diff --git a/Pod/BVConversations/Display/Model/BVConversationsInclude.m b/Pod/BVConversations/Display/Model/BVConversationsInclude.m index 5500ca73..22a11c3c 100644 --- a/Pod/BVConversations/Display/Model/BVConversationsInclude.m +++ b/Pod/BVConversations/Display/Model/BVConversationsInclude.m @@ -13,6 +13,8 @@ @interface BVConversationsInclude() @property NSDictionary* _Nonnull reviews; @property NSDictionary* _Nonnull questions; @property NSDictionary* _Nonnull answers; +@property NSDictionary* _Nonnull comments; +@property NSDictionary* _Nonnull authors; @end @@ -34,6 +36,14 @@ -(BVQuestion* _Nullable)getQuestionById:(NSString* _Nonnull)questionId { return self.questions[questionId]; } +-(BVComment* _Nullable)getCommentById:(NSString *)commentId { + return self.comments[commentId]; +} + +-(BVAuthor* _Nullable)getAuthorById:(NSString *)authorId { + return self.authors[authorId]; +} + -(id _Nonnull)initWithApiResponse:(NSDictionary* _Nonnull)apiResponse { self = [super init]; if(self){ @@ -44,29 +54,42 @@ -(id _Nonnull)initWithApiResponse:(NSDictionary* _Nonnull)apiResponse { for(NSString* key in reviewsDict){ tempReviews[key] = [[BVReview alloc] initWithApiResponse:reviewsDict[key] includes:nil]; } - self.reviews = tempReviews; + self.reviews = [NSDictionary dictionaryWithDictionary:tempReviews]; NSDictionary* questionsDict = apiResponse[@"Questions"]; NSMutableDictionary* tempQuestions = [NSMutableDictionary dictionary]; for(NSString* key in questionsDict){ tempQuestions[key] = [[BVQuestion alloc] initWithApiResponse:questionsDict[key] includes:nil]; } - self.questions = tempQuestions; + self.questions = [NSDictionary dictionaryWithDictionary:tempQuestions]; NSDictionary* productsDict = apiResponse[@"Products"]; NSMutableDictionary* tempProducts = [NSMutableDictionary dictionary]; for(NSString* key in productsDict){ tempProducts[key] = [[BVProduct alloc] initWithApiResponse:productsDict[key] includes:nil]; } - self.products = tempProducts; + self.products = [NSDictionary dictionaryWithDictionary:tempProducts]; NSDictionary* answersDict = apiResponse[@"Answers"]; NSMutableDictionary* tempAnswers = [NSMutableDictionary dictionary]; for(NSString* key in answersDict){ tempAnswers[key] = [[BVAnswer alloc] initWithApiResponse:answersDict[key] includes:nil]; } - self.answers = tempAnswers; - + self.answers = [NSDictionary dictionaryWithDictionary:tempAnswers]; + + NSDictionary* commentsDict = apiResponse[@"Comments"]; + NSMutableDictionary *tempComments = [NSMutableDictionary dictionary]; + for (NSString *key in commentsDict){ + tempComments[key] = [[BVComment alloc] initWithApiResponse:commentsDict[key] includes:nil]; + } + self.comments = [NSDictionary dictionaryWithDictionary:tempComments]; + + NSDictionary* authorsDict = apiResponse[@"Authors"]; + NSMutableDictionary *tempAuthors = [NSMutableDictionary dictionary]; + for (NSString *key in authorsDict){ + tempAuthors[key] = [[BVAuthor alloc] initWithApiResponse:authorsDict[key] includes:nil]; + } + self.authors = [NSDictionary dictionaryWithDictionary:tempAuthors]; } return self; } diff --git a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.h b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.h new file mode 100644 index 00000000..ad00258c --- /dev/null +++ b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.h @@ -0,0 +1,42 @@ +// +// BVComment.h +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +#import "BVGenericConversationsResult.h" +#import "BVBadge.h" + +@interface BVComment : NSObject + +@property (readonly) NSString* _Nullable title; +@property (readonly) NSString* _Nullable commentText; +@property (readonly) NSString* _Nullable reviewId; +@property (readonly) NSString* _Nullable commentId; +@property (readonly) NSString* _Nullable campaignId; + +@property (readonly) NSString* _Nullable userNickname; +@property (readonly) NSString* _Nullable authorId; +@property (readonly) NSString* _Nullable userLocation; +@property (readonly) NSDate* _Nullable submissionTime; +@property (readonly) NSDate* _Nullable lastModeratedTime; +@property (readonly) NSDate* _Nullable lastModificationTime; + +@property (readonly) NSString* _Nullable submissionId; +@property (readonly) NSNumber* _Nullable totalFeedbackCount; +@property (readonly) NSNumber* _Nullable totalPositiveFeedbackCount; +@property (readonly) NSNumber* _Nullable totalNegativeFeedbackCount; + +@property (readonly) NSString* _Nullable contentLocale; + +@property (readonly) NSArray* _Nonnull badges; + +@property (readonly) BOOL isSyndicated; + +@property (nonatomic, strong, readonly) BVConversationsInclude * _Nullable includes; + + +@end diff --git a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.m b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.m new file mode 100644 index 00000000..06fd28f0 --- /dev/null +++ b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVComment.m @@ -0,0 +1,53 @@ +// +// BVComment.m +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVComment.h" +#import "BVNullHelper.h" +#import "BVModelUtil.h" + +@implementation BVComment + +-(id)initWithApiResponse:(NSDictionary *)apiResponse includes:(BVConversationsInclude *)includes { + + self = [super init]; + if(self) { + + _includes = includes; + + SET_IF_NOT_NULL(_userNickname, apiResponse[@"UserNickname"]) + SET_IF_NOT_NULL(_userLocation, apiResponse[@"UserLocation"]) + SET_IF_NOT_NULL(_authorId, apiResponse[@"AuthorId"]) + SET_IF_NOT_NULL(_reviewId, apiResponse[@"ReviewId"]) + SET_IF_NOT_NULL(_commentId, apiResponse[@"Id"]) + SET_IF_NOT_NULL(_commentText, apiResponse[@"CommentText"]) + SET_IF_NOT_NULL(_title, apiResponse[@"Title"]) + + SET_IF_NOT_NULL(_submissionId, apiResponse[@"SubmissionId"]) + SET_IF_NOT_NULL(_totalFeedbackCount, apiResponse[@"TotalFeedbackCount"]) + SET_IF_NOT_NULL(_totalPositiveFeedbackCount, apiResponse[@"TotalPositiveFeedbackCount"]) + SET_IF_NOT_NULL(_totalNegativeFeedbackCount, apiResponse[@"TotalNegativeFeedbackCount"]) + SET_IF_NOT_NULL(_contentLocale, apiResponse[@"ContentLocale"]) + SET_IF_NOT_NULL(_campaignId, apiResponse[@"CampaignId"]) + + _submissionTime = [BVModelUtil convertTimestampToDatetime:apiResponse[@"SubmissionTime"]]; + _lastModeratedTime = [BVModelUtil convertTimestampToDatetime:apiResponse[@"LastModeratedTime"]]; + _lastModificationTime = [BVModelUtil convertTimestampToDatetime:apiResponse[@"LastModificationTime"]]; + + NSNumber* isSyndicated = apiResponse[@"IsSyndicated"]; + if(![isSyndicated isKindOfClass:[NSNull class]]) { + _isSyndicated = [isSyndicated boolValue]; + } + + _badges = [BVModelUtil parseBadges:apiResponse[@"Badges"]]; + + } + + return self; + +} + +@end diff --git a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.h b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.h index 52ef7076..5eea7d13 100644 --- a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.h +++ b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.h @@ -14,6 +14,7 @@ #import "BVBadge.h" #import "BVSecondaryRating.h" #import "BVSyndicationSource.h" +#import "BVComment.h" @class BVProduct; @@ -67,5 +68,6 @@ @property NSDate* _Nullable submissionTime; @property NSDate* _Nullable lastModeratedTime; @property BVSyndicationSource* _Nullable syndicationSource; +@property (readonly) NSArray * _Nonnull comments; @end diff --git a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.m b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.m index 7b14f506..18dc4878 100644 --- a/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.m +++ b/Pod/BVConversations/Display/Model/GenericConversationsResult/BVReview.m @@ -17,6 +17,18 @@ -(id)initWithApiResponse:(NSDictionary *)apiResponse includes:(BVConversationsIn self = [super init]; if(self){ + NSMutableArray *tmpComments = [NSMutableArray array]; + NSArray *commentIds = apiResponse[@"CommentIds"]; + if (commentIds) { + for (NSString *commentId in (NSArray *)commentIds){ + BVComment *comment = [includes getCommentById:commentId]; + if (comment){ + [tmpComments addObject:comment]; + } + } + } + _comments = [NSArray arrayWithArray:tmpComments]; + NSString* productId = apiResponse[@"ProductId"]; self.product = [includes getProductById:productId]; self.cons = apiResponse[@"Cons"]; diff --git a/Pod/BVConversations/Display/Requests/BVBaseConversationsResponse.m b/Pod/BVConversations/Display/Requests/BVBaseConversationsResponse.m index e6d3eff4..55751ba5 100644 --- a/Pod/BVConversations/Display/Requests/BVBaseConversationsResponse.m +++ b/Pod/BVConversations/Display/Requests/BVBaseConversationsResponse.m @@ -31,7 +31,7 @@ -(BVConversationsInclude*)getIncludes:(NSDictionary*)apiResponse { -(id)createResult:(NSDictionary *)raw includes:(BVConversationsInclude *)includes { - NSAssert(YES, @"method should be overridden"); + NSAssert(NO, @"createResult method should be overridden"); return nil; } diff --git a/Pod/BVConversations/Display/Requests/BVBaseReviewsRequest.h b/Pod/BVConversations/Display/Requests/BVBaseReviewsRequest.h index f0528ea2..e52e012a 100644 --- a/Pod/BVConversations/Display/Requests/BVBaseReviewsRequest.h +++ b/Pod/BVConversations/Display/Requests/BVBaseReviewsRequest.h @@ -33,7 +33,6 @@ - (void)sendReviewsAnalytics:(BVReviewsResponse* _Nonnull)reviewsResponse; - (nonnull instancetype)search:(NSString * _Nonnull)search; - - (nonnull instancetype)addInclude:(BVReviewIncludeType)include; - (nonnull instancetype)addSort:(BVSortOptionProducts)option order:(BVSortOrder)order __deprecated_msg("use sortReviews instead"); diff --git a/Pod/BVConversations/Display/Requests/BVCommentsRequest.h b/Pod/BVConversations/Display/Requests/BVCommentsRequest.h new file mode 100644 index 00000000..f88b029e --- /dev/null +++ b/Pod/BVConversations/Display/Requests/BVCommentsRequest.h @@ -0,0 +1,42 @@ +// +// BVCommentsRequest.h +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVConversationsRequest.h" +#import "BVCommentsResponse.h" +#import "BVSort.h" +#import "BVFilter.h" +#import "BVSortOptionsComments.h" +#import "BVCommentFilterType.h" +#import "BVCommentIncludeType.h" + +@interface BVCommentsRequest : BVConversationsRequest + +@property (readonly) NSString* _Nonnull reviewId; +@property (nonatomic, assign, readonly) UInt16 limit; +@property (nonatomic, assign, readonly) UInt16 offset; +@property (nonatomic, strong, readonly) NSMutableArray* _Nonnull sorts; +@property (nonatomic, strong, readonly) NSMutableArray* _Nonnull filters; +@property (nonatomic, strong, readonly) NSMutableArray * _Nonnull includes; +@property (readonly) NSString* _Nonnull commentId; + +- (nonnull instancetype)initWithReviewId:(NSString * _Nonnull)reviewId limit:(UInt16)limit offset:(UInt16)offset; +- (nonnull instancetype)initWithCommentId:(NSString * _Nonnull)commentId; + +- (nonnull instancetype) __unavailable init; + +- (nonnull instancetype)addCommentSort:(BVSortOptionComments)option order:(BVSortOrder)order; + +- (nonnull instancetype)addFilter:(BVCommentFilterType)type filterOperator:(BVFilterOperator)filterOperator value:(NSString * _Nonnull)value; + +- (nonnull instancetype)addFilter:(BVCommentFilterType)type filterOperator:(BVFilterOperator)filterOperator values:(NSArray * _Nonnull)values; + +- (nonnull instancetype)addInclude:(BVCommentIncludeType)include; + + /// Make an asynch http request to fethre the Author's profile data. See the BVAuthorResponse model for availble fields. +- (void)load:(void (^ _Nonnull)(BVCommentsResponse * _Nonnull response))success failure:(ConversationsFailureHandler _Nonnull)failure; + +@end diff --git a/Pod/BVConversations/Display/Requests/BVCommentsRequest.m b/Pod/BVConversations/Display/Requests/BVCommentsRequest.m new file mode 100644 index 00000000..b65e5f81 --- /dev/null +++ b/Pod/BVConversations/Display/Requests/BVCommentsRequest.m @@ -0,0 +1,161 @@ +// +// BVCommentsRequest.m +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVCommentsRequest.h" + +@implementation BVCommentsRequest + +- (nonnull instancetype)initWithReviewId:(NSString * _Nonnull)reviewId limit:(UInt16)limit offset:(UInt16)offset{ + + self = [super init]; + if(self){ + + _reviewId = reviewId; + _limit = limit; + _offset = offset; + _filters = [NSMutableArray array]; + _sorts = [NSMutableArray array]; + _includes = [NSMutableArray array]; + } + + return self; +} + +- (nonnull instancetype)initWithCommentId:(NSString * _Nonnull)commentId{ + + self = [super init]; + if(self){ + + _commentId = commentId; + _filters = [NSMutableArray array]; + _sorts = [NSMutableArray array]; + _includes = [NSMutableArray array]; + } + + return self; +} + +- (void)load:(void (^ _Nonnull)(BVCommentsResponse * _Nonnull response))success failure:(ConversationsFailureHandler _Nonnull)failure{ + + if (self.reviewId && (self.limit < 1 || self.limit > 100)) { + // invalid request + [self sendError:[super limitError:self.limit] failureCallback:failure]; + } + else { + [self loadComments:self completion:success failure:failure]; + } + +} + +- (void)loadComments:(BVConversationsRequest * _Nonnull)request completion:(void (^ _Nonnull)(BVCommentsResponse * _Nonnull response))completion failure:(void (^ _Nonnull)(NSArray * _Nonnull errors))failure { + + [self loadContent:request completion:^(NSDictionary * _Nonnull response) { + + BVCommentsResponse *commentsResponse = [[BVCommentsResponse alloc] initWithApiResponse:response]; + + // invoke success callback on main thread + dispatch_async(dispatch_get_main_queue(), ^{ + completion(commentsResponse); + }); + + // TODO: Analytics +// if (authorResponse && authorResponse.results){ +// [ self sendAuthorAnalytics:authorResponse.results.firstObject]; +// } + + } failure:failure]; +} + +- (NSString * _Nonnull)endpoint { + return @"reviewcomments.json"; +} + +- (NSMutableArray * _Nonnull)createParams { + + NSMutableArray* params = [super createParams]; + + // There are two ways to make a request: 1) with a review Id to get a bunch of comments or 2) just get single review. + if (self.reviewId) { + + [params addObject:[BVStringKeyValuePair pairWithKey:@"Filter" value:[NSString stringWithFormat:@"reviewId:%@", self.reviewId]]]; + [params addObject:[BVStringKeyValuePair pairWithKey:@"Limit" value: [NSString stringWithFormat:@"%i", self.limit]]]; + [params addObject:[BVStringKeyValuePair pairWithKey:@"Offset" value: [NSString stringWithFormat:@"%i", self.offset]]]; + + } else if (self.commentId) { + BVFilter *commentIdFilter = [[BVFilter alloc] initWithType:BVProductFilterTypeId filterOperator:BVFilterOperatorEqualTo value:self.commentId]; + [params addObject:[BVStringKeyValuePair pairWithKey:@"Filter" value:[commentIdFilter toParameterString]]]; + + } else { + + NSAssert(NO, @"You must supply a valid comment or review ID in the supplied initiaizers."); + + } + + for(BVFilter* filter in self.filters) { + [params addObject:[BVStringKeyValuePair pairWithKey:@"Filter" value:[filter toParameterString]]]; + } + + if (self.sorts.count > 0){ + [params addObject:[self sortParams:self.sorts withKey:@"Sort"]]; + } + + if (self.includes.count > 0){ + [params addObject:[BVStringKeyValuePair pairWithKey:@"Include" value:[self includesToParams:self.includes]]]; + } + + return params; +} + + +- (nonnull instancetype)addCommentSort:(BVSortOptionComments)option order:(BVSortOrder)order{ + BVSort* sort = [[BVSort alloc] initWithOptionString:[BVSortOptionsCommentUtil toString:option] order:order]; + [self.sorts addObject:sort]; + return self; +} + +- (nonnull instancetype)addFilter:(BVCommentFilterType)type filterOperator:(BVFilterOperator)filterOperator value:(NSString * _Nonnull)value{ + [self addFilter:type filterOperator:filterOperator values:@[value]]; + return self; +} + +- (nonnull instancetype)addInclude:(BVCommentIncludeType)include{ + + [self.includes addObject:[BVCommentIncludeTypeUtil toString:include]]; + return self; + +} + +- (nonnull instancetype)addFilter:(BVCommentFilterType)type filterOperator:(BVFilterOperator)filterOperator values:(NSArray * _Nonnull)values { + BVFilter* filter = [[BVFilter alloc] initWithString:[BVCommentFilterTypeUtil toString:type] filterOperator:filterOperator values:values]; + [self.filters addObject:filter]; + return self; +} + +-(BVStringKeyValuePair* _Nonnull)sortParams:(NSArray* _Nonnull)sorts withKey:(NSString*)paramKey { + + NSMutableArray* strings = [NSMutableArray array]; + + for(BVSort* sort in sorts) { + [strings addObject:[sort toString]]; + } + + NSString* combined = [strings componentsJoinedByString:@","]; + + return [BVStringKeyValuePair pairWithKey:paramKey value:combined]; + +} + +-(NSString* _Nonnull)includesToParams:(NSArray* _Nonnull)includes { + + + NSArray* sortedArray = [includes sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)]; + + return [sortedArray componentsJoinedByString:@","]; + +} + +@end diff --git a/Pod/BVConversations/Display/Requests/BVConversationsRequest.m b/Pod/BVConversations/Display/Requests/BVConversationsRequest.m index f15b10d0..26cab7d2 100644 --- a/Pod/BVConversations/Display/Requests/BVConversationsRequest.m +++ b/Pod/BVConversations/Display/Requests/BVConversationsRequest.m @@ -59,7 +59,8 @@ -(nonnull instancetype)addAdditionalField:(nonnull NSString*)fieldName value:(no -(NSString* _Nonnull)endpoint { - return @"must be overriden"; + NSAssert(NO, @"endpoint must be overridden by subclass"); + return nil; } +(NSString* _Nonnull)commonEndpoint { diff --git a/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.h b/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.h new file mode 100644 index 00000000..bfd2e959 --- /dev/null +++ b/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.h @@ -0,0 +1,39 @@ +// +// BVCommentFilterType.h +// Conversations +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +/** + The allowable filter types for `BVCommentsRequest` requests. + API Refernce: https://developer.bazaarvoice.com/conversations-api/reference/v5.4/comments/comment-display#filter-options + */ +typedef NS_ENUM(NSInteger, BVCommentFilterType) { + BVCommentFilterTypeId, + BVCommentFilterTypeAuthorId, + BVCommentFilterTypeCampaignId, + BVCommentFilterTypeCategoryAncestorId, + BVCommentFilterTypeContentLocale, + BVCommentFilterTypeIsFeatured, + BVCommentFilterTypeLastModeratedTime, + BVCommentFilterTypeLastModificationTime, + BVCommentFilterTypeModeratorCode, + BVCommentFilterTypeProductId, + BVCommentFilterTypeReviewId, + BVCommentFilterTypeSubmissionId, + BVCommentFilterTypeSubmissionTime, + BVCommentFilterTypeTotalFeedbackCount, + BVCommentFilterTypeTotalNegativeFeedbackCount, + BVCommentFilterTypeTotalPositiveFeedbackCount, + BVCommentFilterTypeUserLocation +}; + + +@interface BVCommentFilterTypeUtil : NSObject + ++(NSString* _Nonnull)toString:(BVCommentFilterType)commentFilterOperator; + +@end diff --git a/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.m b/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.m new file mode 100644 index 00000000..f85c4280 --- /dev/null +++ b/Pod/BVConversations/Display/Sorting & Filtering/BVCommentFilterType.m @@ -0,0 +1,36 @@ +// +// BVCommentFilterType.m +// Conversations +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVCommentFilterType.h" + +@implementation BVCommentFilterTypeUtil + ++(NSString* _Nonnull)toString:(BVCommentFilterType)commentFilterOperator{ + + switch (commentFilterOperator) { + case BVCommentFilterTypeId: return @"Id"; + case BVCommentFilterTypeAuthorId: return @"AuthorId"; + case BVCommentFilterTypeCampaignId: return @"CampaignId"; + case BVCommentFilterTypeCategoryAncestorId: return @"CategoryAncestorId"; + case BVCommentFilterTypeContentLocale: return @"ContentLocale"; + case BVCommentFilterTypeIsFeatured: return @"IsFeatured"; + case BVCommentFilterTypeLastModeratedTime: return @"LastModeratedTime"; + case BVCommentFilterTypeLastModificationTime: return @"LastModificationTime"; + case BVCommentFilterTypeModeratorCode: return @"ModeratorCode"; + case BVCommentFilterTypeProductId: return @"ProductId"; + case BVCommentFilterTypeReviewId: return @"ReviewId"; + case BVCommentFilterTypeSubmissionId: return @"SubmissionId"; + case BVCommentFilterTypeSubmissionTime: return @"SubmissionTime"; + case BVCommentFilterTypeTotalFeedbackCount: return @"TotalFeedbackCount"; + case BVCommentFilterTypeTotalNegativeFeedbackCount: return @"TotalNegativeFeedbackCount"; + case BVCommentFilterTypeTotalPositiveFeedbackCount: return @"TotalPositiveFeedbackCount"; + case BVCommentFilterTypeUserLocation: return @"UserLocation"; + } + +} + +@end diff --git a/Pod/BVConversations/Display/Sorting & Filtering/BVReviewFilterType.h b/Pod/BVConversations/Display/Sorting & Filtering/BVReviewFilterType.h index 5f591d90..6e3bcb9a 100644 --- a/Pod/BVConversations/Display/Sorting & Filtering/BVReviewFilterType.h +++ b/Pod/BVConversations/Display/Sorting & Filtering/BVReviewFilterType.h @@ -7,7 +7,7 @@ #import -/* +/** The allowable filter types for `BVReviewsRequest` requests. */ typedef NS_ENUM(NSInteger, BVReviewFilterType) { diff --git a/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.h b/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.h new file mode 100644 index 00000000..a7d3bae8 --- /dev/null +++ b/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.h @@ -0,0 +1,37 @@ +// +// BVSortOptionsComments.h +// Conversations +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import + +/** + The allowable sort types for `BVCommentsRequest` requests. + API Reference: https://developer.bazaarvoice.com/conversations-api/reference/v5.4/comments/comment-display#sort-options + */ +typedef NS_ENUM(NSInteger, BVSortOptionComments) { + BVSortOptionCommentId, + BVSortOptionCommentAuthorId, + BVSortOptionCommentCampaignId, + BVSortOptionCommentContentLocale, + BVSortOptionCommentsIsFeatured, + BVSortOptionCommentsLastModeratedTime, + BVSortOptionCommentsLastModificationTime, + BVSortOptionCommentsProductId, + BVSortOptionCommentsReviewId, + BVSortOptionCommentsSubmissionId, + BVSortOptionCommentsSubmissionTime, + BVSortOptionCommentsTotalFeedbackCount, + BVSortOptionCommentsTotalNegativeFeedbackCount, + BVSortOptionCommentsTotalPositiveFeedbackCount, + BVSortOptionCommentsUserLocation +}; + + +@interface BVSortOptionsCommentUtil : NSObject + ++(NSString* _Nonnull)toString:(BVSortOptionComments)commentSortOption; + +@end diff --git a/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.m b/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.m new file mode 100644 index 00000000..f5806f9b --- /dev/null +++ b/Pod/BVConversations/Display/Sorting & Filtering/BVSortOptionsComments.m @@ -0,0 +1,33 @@ +// +// BVSortOptionsComments.m +// Conversations +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +#import "BVSortOptionsComments.h" + +@implementation BVSortOptionsCommentUtil + ++(NSString* _Nonnull)toString:(BVSortOptionComments)commentSortOption{ + + switch (commentSortOption) { + case BVSortOptionCommentId: return @"Id"; + case BVSortOptionCommentAuthorId: return @"AuthorId"; + case BVSortOptionCommentCampaignId: return @"CampaignId"; + case BVSortOptionCommentContentLocale: return @"ContentLocale"; + case BVSortOptionCommentsIsFeatured: return @"IsFeatured"; + case BVSortOptionCommentsLastModeratedTime: return @"LastModeratedTime"; + case BVSortOptionCommentsLastModificationTime: return @"LastModificationTime"; + case BVSortOptionCommentsProductId: return @"ProductId"; + case BVSortOptionCommentsReviewId: return @"ReviewId"; + case BVSortOptionCommentsSubmissionId: return @"SubmissionId"; + case BVSortOptionCommentsSubmissionTime: return @"SubmissionTime"; + case BVSortOptionCommentsTotalFeedbackCount: return @"TotalFeedbackCount"; + case BVSortOptionCommentsTotalNegativeFeedbackCount: return @"TotalNegativeFeedbackCount"; + case BVSortOptionCommentsTotalPositiveFeedbackCount: return @"TotalPositiveFeedbackCount"; + case BVSortOptionCommentsUserLocation: return @"UserLocation"; + } +} + +@end diff --git a/Tests/Tests/ConversationsTests/DisplayTests/CommentsDisplayTests.swift b/Tests/Tests/ConversationsTests/DisplayTests/CommentsDisplayTests.swift new file mode 100644 index 00000000..d11972d2 --- /dev/null +++ b/Tests/Tests/ConversationsTests/DisplayTests/CommentsDisplayTests.swift @@ -0,0 +1,208 @@ +// +// CommentsDisplayTests.swift +// BVSDK +// +// Copyright © 2017 Bazaarvoice. All rights reserved. +// + +import XCTest +@testable import BVSDK + +class CommentsDisplayTests: XCTestCase { + + override func setUp() { + super.setUp() + + let configDict = ["clientId": "apitestcustomer", + "apiKeyConversations": "kuy3zj9pr3n7i0wxajrzj04xo"]; + BVSDKManager.configure(withConfiguration: configDict, configType: .staging) + BVSDKManager.shared().setLogLevel(BVLogLevel.verbose) + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testCommentDisplayByReviewId() { + let expectation = self.expectation(description: "testCommentDisplayByReviewId") + + let limit : UInt16 = 99 + let offset : UInt16 = 0 + + let request = BVCommentsRequest(reviewId: "192548", limit: limit, offset: offset) + + request.load({ (response) in + + XCTAssertEqual(response.results.count, 5) + XCTAssertEqual(response.limit?.uint16Value, limit) + XCTAssertEqual(response.offset?.uint16Value, offset) + XCTAssertGreaterThan(response.totalResults!.intValue, 4) + XCTAssertEqual(response.locale, "en_US") + + expectation.fulfill() + + }) { (error) in + + XCTFail("comments by product id display request error: \(error)") + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + } + + func testCommentDisplayByCommentId() { + let expectation = self.expectation(description: "testCommentDisplayByCommentId") + + let request = BVCommentsRequest(commentId: "12024") + + + request.load({ (response) in + + XCTAssertEqual(response.results.count, 1) + + let theComment = response.results.first! + + XCTAssertEqual(theComment.title, "TEST>> I came in the store wanting to try 4 other") + XCTAssertEqual(theComment.authorId, "63kfce2dchdd2f8te9en4xx5y") + XCTAssertEqual(theComment.isSyndicated, false) + XCTAssertEqual(theComment.reviewId, "192548") + XCTAssertEqual(theComment.userLocation, nil) + XCTAssertEqual(theComment.commentText, "TEST>> I came in the store wanting to try 4 other dresses, and didnt even notice this one. I walked by a huge poster, and this beautiful dress caught my eye! It ended up being the first dress I tried on, and it was right then, that I knew this was the right dress. After this dress, I tried on 4 other ones, but decided on buying this one. It fits sooooo perfectly, and it gives your body a wonderful shape.test\nI love this dress sooooooo much!!") + + let calendar = Calendar.current + + let year = calendar.component(.year, from: theComment.submissionTime!) + let month = calendar.component(.month, from: theComment.submissionTime!) + let day = calendar.component(.day, from: theComment.submissionTime!) + + XCTAssertEqual(2011, year) + XCTAssertEqual(6, month) + XCTAssertEqual(27, day) + + XCTAssertNotNil(theComment.lastModeratedTime) + XCTAssertNotNil(theComment.lastModificationTime) + + expectation.fulfill() + + }) { (error) in + + XCTFail("comments by product id display request error: \(error)") + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + + } + + + func testCommentIncludes() { + let expectation = self.expectation(description: "testCommentDisplayByCommentId") + + let request = BVCommentsRequest(commentId: "12024") + request.addInclude(.authors) + request.addInclude(.products) + request.addInclude(.reviews) + + request.load({ (response) in + + XCTAssertEqual(response.results.count, 1) + + let theComment : BVComment = response.results.first! + + // Test included reviews + let theReview : BVReview = (theComment.includes?.getReviewById(theComment.reviewId!))! + XCTAssertNotNil(theReview) + XCTAssertNotNil(theReview.title) + + // Test included products + let theProduct : BVProduct = (theComment.includes?.getProductById(theReview.productId!))! + XCTAssertNotNil(theProduct) + XCTAssertNotNil(theProduct.name) + + // Test included authors + let theAuthor : BVAuthor = (theComment.includes?.getAuthorById(theComment.authorId!))! + XCTAssertNotNil(theAuthor) + XCTAssertNotNil(theAuthor.userNickname) + XCTAssertNotNil(theAuthor.authorId) + + expectation.fulfill() + + }) { (error) in + + XCTFail("comments by product id display request error: \(error)") + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + + } + + func testCommentFilteringSorting() { + let expectation = self.expectation(description: "testCommentDisplayByCommentId") + + let limit : UInt16 = 90 + let offset : UInt16 = 0 + + let request = BVCommentsRequest(reviewId: "192548", limit: limit, offset: offset) + request.addFilter(.contentLocale, filterOperator: .equalTo, value: "en_US") + request.addCommentSort(.commentsSubmissionTime, order: .descending) + + request.load({ (response) in + + XCTAssertEqual(response.results.count, 5) + + expectation.fulfill() + + }) { (error) in + + XCTFail("comments by product id display request error: \(error)") + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + + } + + + + func testCommentWithErrors() { + let expectation = self.expectation(description: "testCommentWithErrors") + + let request = BVCommentsRequest(commentId: "snoochieboochies") + request.addAdditionalField("bad", value: "food") + + request.load({ (response) in + + XCTFail("Call should have failed") + + expectation.fulfill() + + }) { (error) in + + XCTAssertTrue((error.first?.localizedDescription.contains("ERROR_PARAM_INVALID_FILTER_ATTRIBUTE"))!) + + expectation.fulfill() + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + } + + +} diff --git a/Tests/Tests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift b/Tests/Tests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift index 7d7469b0..5315b8f6 100644 --- a/Tests/Tests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift +++ b/Tests/Tests/ConversationsTests/DisplayTests/ReviewDisplayTests.swift @@ -17,7 +17,7 @@ class ReviewDisplayTests: XCTestCase { let configDict = ["clientId": "apitestcustomer", "apiKeyConversations": "kuy3zj9pr3n7i0wxajrzj04xo"]; BVSDKManager.configure(withConfiguration: configDict, configType: .staging) - BVSDKManager.shared().setLogLevel(BVLogLevel.error) + BVSDKManager.shared().setLogLevel(BVLogLevel.verbose) } override func tearDown() { @@ -213,5 +213,47 @@ class ReviewDisplayTests: XCTestCase { } + func testReviewIncludeComments() { + + let expectation = self.expectation(description: "testReviewIncludeComments") + + let request = BVReviewsRequest(productId: "test1", limit: 10, offset: 0) + .addInclude(.comments) + .addFilter(.id, filterOperator: .equalTo, value: "192463") // This review is know to have a comment + + request.load({ (response) in + + XCTAssertEqual(response.results.count, 1) // We filtered on a review id, so there should only be one + + let review : BVReview = response.results.first! + + XCTAssertTrue(review.comments.count >= 1) + + let firstComment = review.comments.first! + + // XCTAssertNotNil(firstComment.title) -- title may be nil + XCTAssertNotNil(firstComment.authorId) + XCTAssertNotNil(firstComment.badges) + XCTAssertNotNil(firstComment.submissionTime) + XCTAssertNotNil(firstComment.commentText) + XCTAssertNotNil(firstComment.contentLocale) + XCTAssertNotNil(firstComment.lastModeratedTime) + XCTAssertNotNil(firstComment.lastModificationTime) + + expectation.fulfill() + + }) { (error) in + + XCTFail("review display request error: \(error)") + + } + + self.waitForExpectations(timeout: 10) { (error) in + XCTAssertNil(error, "Something went horribly wrong, request took too long.") + } + + } + + }