Skip to content

Commit

Permalink
Bulk product request w/o stats if needed and Fix Feedback submission …
Browse files Browse the repository at this point in the history
…contentType
  • Loading branch information
sergioazua committed May 19, 2017
1 parent be32c77 commit 76dfc46
Show file tree
Hide file tree
Showing 15 changed files with 49 additions and 36 deletions.
2 changes: 1 addition & 1 deletion BVSDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

Pod::Spec.new do |s|
s.name = "BVSDK"
s.version = '6.5.3'
s.version = '6.5.4'
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' }
Expand Down
4 changes: 2 additions & 2 deletions BVSDK/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>6.5.3</string>
<string>6.5.4</string>
<key>CFBundleVersion</key>
<string>6.5.3</string>
<string>6.5.4</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSPrincipalClass</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<string>44</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
2 changes: 1 addition & 1 deletion Examples/BVSDKDemo/BVReviewContentExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>1.1.0</string>
<key>CFBundleVersion</key>
<string>37</string>
<string>44</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down
8 changes: 4 additions & 4 deletions Examples/BVSDKDemo/BVSDKDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2374,7 +2374,7 @@
CODE_SIGN_ENTITLEMENTS = BVSDKDemo/BVSDKDemo.entitlements;
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 37;
CURRENT_PROJECT_VERSION = 44;
DEVELOPMENT_TEAM = TH9FFAVND4;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -2407,7 +2407,7 @@
CODE_SIGN_ENTITLEMENTS = BVSDKDemo/BVSDKDemo.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 37;
CURRENT_PROJECT_VERSION = 44;
DEVELOPMENT_TEAM = TH9FFAVND4;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
Expand Down Expand Up @@ -2467,7 +2467,7 @@
CODE_SIGN_ENTITLEMENTS = "Curations Custom Post Extension/Curations Custom Post Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 37;
CURRENT_PROJECT_VERSION = 44;
DEVELOPMENT_TEAM = TH9FFAVND4;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "Curations Custom Post Extension/Info.plist";
Expand Down Expand Up @@ -2499,7 +2499,7 @@
CODE_SIGN_ENTITLEMENTS = "Curations Custom Post Extension/Curations Custom Post Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
CURRENT_PROJECT_VERSION = 37;
CURRENT_PROJECT_VERSION = 44;
DEVELOPMENT_TEAM = TH9FFAVND4;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = "Curations Custom Post Extension/Info.plist";
Expand Down
21 changes: 16 additions & 5 deletions Examples/BVSDKDemo/BVSDKDemo/HomeViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -305,21 +305,32 @@ class HomeViewController: UIViewController, UICollectionViewDataSource, UICollec
if canLoadRecommendations {
loadRecommendations()
}else {
loadConversations()
loadConversations(omitStats: false)
}
}

func loadConversations() {
func loadConversations(omitStats : Bool) {
let req = BVBulkProductRequest().addProductSort(.averageOverallRating, order: .descending)
.add(.totalReviewCount, filterOperator: .greaterThanOrEqualTo, value: "35")
.add(.totalReviewCount, filterOperator: .greaterThanOrEqualTo, value: "10")
.add(.isActive, filterOperator: .equalTo, value: "true")
.add(.isDisabled, filterOperator: .equalTo, value: "false")
.includeStatistics(.reviews)
if (!omitStats){
req.includeStatistics(.reviews)
}
req.sortIncludedReviews(.rating, order: .descending)
req.load({(response) in
self.doneLoading(response.results)
}){(errs) in
self.doneLoading(with: errs.first!)

if ((errs.first?.localizedDescription.lowercased().range(of: "must use non bulk filter value")) != nil &&
omitStats == false){

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!)
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion Examples/BVSDKDemo/BVSDKDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>37</string>
<string>44</string>
<key>Fabric</key>
<dict>
<key>APIKey</key>
Expand Down
2 changes: 1 addition & 1 deletion Examples/BVSDKDemo/BVSDKDemoTests/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>37</string>
<string>44</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>37</string>
<string>44</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
12 changes: 6 additions & 6 deletions Examples/BVSDKDemo/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ PODS:
- Bolts/AppLinks (1.8.4):
- Bolts/Tasks
- Bolts/Tasks (1.8.4)
- BVSDK/BVCurations (6.5.0):
- BVSDK/BVCurations (6.5.3):
- BVSDK/Core
- BVSDK/BVLocation (6.5.0):
- BVSDK/BVLocation (6.5.3):
- BVSDK/Core
- BVSDK/BVNotifications (6.5.0):
- BVSDK/BVNotifications (6.5.3):
- BVSDK/BVLocation
- BVSDK/BVPIN
- BVSDK/BVPIN (6.5.0):
- BVSDK/BVPIN (6.5.3):
- BVSDK/Core
- BVSDK/Core (6.5.0)
- BVSDK/Core (6.5.3)
- Crashlytics (3.8.3):
- Fabric (~> 1.6.3)
- Fabric (1.6.11)
Expand Down Expand Up @@ -88,7 +88,7 @@ CHECKOUT OPTIONS:

SPEC CHECKSUMS:
Bolts: 8a7995239dbe724f9cba2248b766d48b7ebdd322
BVSDK: f71d4466f852ca86901bd703c1cb10b896634dbf
BVSDK: 6ece9146d08c9d70f62db4b99c7e1916137ede22
Crashlytics: 2b6dbe138a42395577cfa73dfa1aa7248cadf39e
Fabric: 5911403591946b8228ab1c51d98f1d7137e863c6
FBSDKCoreKit: 894b2b6eda6a4c8c4204e92e59cc355709ef045c
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ class MyReviewTableViewCell: BVReviewTableViewCell {

// Add any context data values, if present. E.g. Age, Gender, other....
for contextDataValue in (review?.contextDataValues)! {
titleString?.append("\n\(contextDataValue.dimensionLabel!): \(contextDataValue.valueLabel!)")
let value = contextDataValue.valueLabel ?? "Value Not defined"
let label = contextDataValue.dimensionLabel ?? "Label Not defined"
titleString?.append("\n\(label): \(value)")
}

reviewTitle.text = titleString
Expand All @@ -62,7 +64,9 @@ class MyReviewTableViewCell: BVReviewTableViewCell {

// Check and see if this reviewer supplied any of the secondary ratings
for rating : BVSecondaryRating in (review?.secondaryRatings)! {
secondaryRatingsText += " \(rating.label!)(\(rating.value!)) "
let value = rating.value as! NSInteger
let label = rating.label ?? "Label Not defined"
secondaryRatingsText += " \(label)(\(value)) "
}

secondaryRatingsText += "]"
Expand Down
6 changes: 3 additions & 3 deletions Examples/Conversations/Swift/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- BVSDK/BVConversations (6.5.1):
- BVSDK/BVConversations (6.5.3):
- BVSDK/Core
- BVSDK/Core (6.5.1)
- BVSDK/Core (6.5.3)

DEPENDENCIES:
- BVSDK/BVConversations (from `../../../`)
Expand All @@ -11,7 +11,7 @@ EXTERNAL SOURCES:
:path: "../../../"

SPEC CHECKSUMS:
BVSDK: 508f05ebe74170687c9b51cede20d42033e502d8
BVSDK: 6ece9146d08c9d70f62db4b99c7e1916137ede22

PODFILE CHECKSUM: ff51a28f7873cf9d401e0c25277fa303397c7510

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ -(nonnull NSDictionary*)createSubmissionParameters {
parameters[@"userid"] = self.userId;
parameters[@"contentId"] = self.contentId;

self.contentType = 0;

// Set the content type
if (self.contentType == BVFeedbackContentTypeReview){
parameters[@"contentType"] = @"review";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ class ConversationsDisplayTests: XCTestCase {
XCTAssertEqual(review.photos.count, 1)
XCTAssertEqual(review.photos.first?.caption, "Etiam malesuada ultricies urna in scelerisque. Sed viverra blandit nibh non egestas. Sed rhoncus, ipsum in vehicula imperdiet, purus lectus sodales erat, eget ornare lacus lectus ac leo. Suspendisse tristique sollicitudin ultricies. Aliquam erat volutpat.")
XCTAssertEqual(review.photos.first?.identifier, "72586")
XCTAssertEqual(review.photos.first?.sizes?.thumbnailUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photoThumb.jpg?client=APIReadOnlySandbox")
XCTAssertEqual(review.photos.first?.sizes?.normalUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photo.jpg?client=APIReadOnlySandbox")
XCTAssertNotNil(review.photos.first?.sizes?.thumbnailUrl)
XCTAssertTrue((review.photos.first?.sizes?.normalUrl?.lowercased().contains("jpg?client=apireadonlysandbox"))!)

XCTAssertEqual(review.contextDataValues.count, 1)
let cdv = review.contextDataValues.first!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ class ReviewDisplayTests: XCTestCase {
XCTAssertEqual(review.photos.count, 1)
XCTAssertEqual(review.photos.first?.caption, "Etiam malesuada ultricies urna in scelerisque. Sed viverra blandit nibh non egestas. Sed rhoncus, ipsum in vehicula imperdiet, purus lectus sodales erat, eget ornare lacus lectus ac leo. Suspendisse tristique sollicitudin ultricies. Aliquam erat volutpat.")
XCTAssertEqual(review.photos.first?.identifier, "72586")
XCTAssertEqual(review.photos.first?.sizes?.thumbnailUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photoThumb.jpg?client=APIReadOnlySandbox")
XCTAssertEqual(review.photos.first?.sizes?.normalUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photo.jpg?client=APIReadOnlySandbox")
XCTAssertNotNil(review.photos.first?.sizes?.thumbnailUrl)
XCTAssertTrue((review.photos.first?.sizes?.normalUrl?.lowercased().contains("jpg?client=apireadonlysandbox"))!)

XCTAssertEqual(review.contextDataValues.count, 1)
let cdv = review.contextDataValues.first!
Expand Down Expand Up @@ -181,8 +181,8 @@ class ReviewDisplayTests: XCTestCase {
XCTAssertEqual(review.photos.count, 1)
XCTAssertEqual(review.photos.first?.caption, "Etiam malesuada ultricies urna in scelerisque. Sed viverra blandit nibh non egestas. Sed rhoncus, ipsum in vehicula imperdiet, purus lectus sodales erat, eget ornare lacus lectus ac leo. Suspendisse tristique sollicitudin ultricies. Aliquam erat volutpat.")
XCTAssertEqual(review.photos.first?.identifier, "72586")
XCTAssertEqual(review.photos.first?.sizes?.thumbnailUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photoThumb.jpg?client=APIReadOnlySandbox")
XCTAssertEqual(review.photos.first?.sizes?.normalUrl, "https://reviews.apitestcustomer.bazaarvoice.com/bvstaging/5556/72586/photo.jpg?client=APIReadOnlySandbox")
XCTAssertNotNil(review.photos.first?.sizes?.thumbnailUrl)
XCTAssertTrue((review.photos.first?.sizes?.normalUrl?.lowercased().contains("jpg?client=apireadonlysandbox"))!)

XCTAssertEqual(review.contextDataValues.count, 1)
let cdv = review.contextDataValues.first!
Expand Down

0 comments on commit 76dfc46

Please sign in to comment.