bazaarvoice / bv-ios-swift-sdk

Bazaarvoice's Swift SDK

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rating Only Reviews

W3xly opened this issue · comments

Hello,

we are currently having a problem sending a review from your SDK (1.11.1). Respectively, we are able to send review, but unfortunately not all sent values ​​are entered into the database.

Specifically, I'm not able to upload photos. When I compared our reviews with those sent from the Android SDK, we always see Ratings Only in review. I found isRatingsOnly parameter in the SDK, but I don't have the option to change it to false anywhere. Honestly, I have no idea if changing this parameter would help, but it's the only thing I could think of.

UPDATE: isRatingsOnly is not problem, it's determined by length of review. But the problem with photos is still the same. 😔

Here is our implementation for sending a review.

    func submitReview(_ review: NewReview) async throws -> Bool {
        let bvReview = BVReview(
            productId: review.productCode,
            reviewText: review.reviewText,
            reviewTitle: review.reviewTitle,
            reviewRating: review.overallRating
        )

        guard let submission = BVReviewSubmission(bvReview) else { return false }
        submission.configure(configuration)
        submission.add(.locale(locale))

        submission.add(.agree(true))
        submission.add(.email(review.userEmail))
        submission.add(.nickname(review.userName))
        submission.add(.photos(review.photos.compactMap { BVPhoto($0) }))
        submission.add(.submit)

        if let userRecommends = review.userRecommends {
            submission.add(.recommended(userRecommends))
        }

        return try await withCheckedThrowingContinuation { continuation in
            submission.handler { result in
                switch result {
                case .success:
                    continuation.resume(returning: true)
                case .failure(let errors):
                    guard let error = errors.first else {
                        continuation.resume(returning: false)
                        return
                    }
                    continuation.resume(throwing: error)
                }
            }

            submission.async()
        }
    }

Already in response I see there are no photos and isRatingsOnly is set to nil. Only parameters that are not nil, are:

  • authorSubmissionToken
  • locale
  • isRecommended
  • rating
  • reviewText
  • submissionTimeString
  • title
  • submissionId
  • typicalHoursToPost

Review from BV search request.

        {
            "Id": "34741077",
            "CID": Private I guess..,
            "SourceClient": "notino",
            "LastModeratedTime": "2023-04-25T09:45:03.000+00:00",
            "LastModificationTime": "2023-04-25T09:45:03.000+00:00",
            "ProductId": "SCWIGRW_KCOL10",
            "AuthorId": "ims8g5ltsiye1dh0au0jzxjh9",
            "ContentLocale": "de_AT",
            "IsFeatured": false,
            "TotalInappropriateFeedbackCount": 0,
            "TotalClientResponseCount": 0,
            "TotalCommentCount": 0,
            "Rating": 4,
            "IsRatingsOnly": true,
            "IsRecommended": true,
            "TotalFeedbackCount": 0,
            "TotalNegativeFeedbackCount": 0,
            "TotalPositiveFeedbackCount": 0,
            "ModerationStatus": "APPROVED",
            "SubmissionId": "r220580-de_16824156OIMwk9JZoD",
            "SubmissionTime": "2023-04-25T09:41:24.000+00:00",
            "UserNickname": "Test Test",
            "ProductRecommendationIds": [],
            "TagDimensionsOrder": [],
            "InappropriateFeedbackList": [],
            "SecondaryRatingsOrder": [],
            "AdditionalFields": {},
            "ContextDataValuesOrder": [],
            "IsSyndicated": false,
            "Photos": [],
            "CommentIds": [],
            "UserLocation": null,
            "CampaignId": null,
            "Badges": {},
            "Title": null,
            "TagDimensions": {},
            "SecondaryRatings": {},
            "Cons": null,
            "ContextDataValues": {},
            "ReviewText": null,
            "Pros": null,
            "AdditionalFieldsOrder": [],
            "Helpfulness": null,
            "RatingRange": 5,
            "Videos": [],
            "BadgesOrder": [],
            "ClientResponses": []
        }

Do you have any idea please?

Thanks!

John..

For anyone who can have same problem, the issue was, that BVPhoto needs to be initialized with some caption value - even it's optional and nil by default. init(_ image: UIImage, _ caption: String? = nil) .. I think it's worth fixing.