Skip to content

Commit

Permalink
- New BVCurationsUI module: Include UI for Curations feed and Skinna…
Browse files Browse the repository at this point in the history
…ble submission dialog.

    - For Cocoapods install, added BVCurationsUI subpsec if you want to install the Curations UI code.
    - Update /Examples/Curations with new UI and submission. Comes with demo key to run out-of-box.
    - Update Curations images in BVSDK.framework to pull from Asset catalog
    - Bump BVSDK to 6.4.0.
    - Updated all the /Examples using Swift to build cleaning with Swift 3.0 compiler.
  • Loading branch information
Tim Kelly committed Feb 15, 2017
1 parent c98a2f0 commit 7b4416c
Show file tree
Hide file tree
Showing 118 changed files with 2,062 additions and 1,876 deletions.
1 change: 1 addition & 0 deletions .swift-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0
8 changes: 7 additions & 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.3.0'
s.version = '6.4.0'
s.homepage = 'https://developer.bazaarvoice.com'
s.license = { :type => 'Commercial', :text => 'See https://developer.bazaarvoice.com/API_Terms_of_Use' }
s.author = { 'Bazaarvoice' => '[email protected]' }
Expand Down Expand Up @@ -48,6 +48,12 @@ Pod::Spec.new do |s|
curations.dependency 'BVSDK/Core'
end

s.subspec 'BVCurationsUI' do |curationsui|
curationsui.source_files = 'Pod/BVCurationsUI/**/*.{h,m}'
curationsui.dependency 'BVSDK/BVCurations'
curationsui.resources = ["Pod/BVCurationsUI/Assets/*.xcassets"]
end

s.subspec 'BVLocation' do |location|
location.source_files = 'Pod/BVLocation/**/*.{h,m}'
location.vendored_frameworks = 'Pod/Frameworks/Gimbal.framework'
Expand Down
84 changes: 60 additions & 24 deletions BVSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions BVSDK/BVSDK.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,20 @@ FOUNDATION_EXPORT const unsigned char BVSDKVersionString[];
#import <BVSDK/BVCurationsFeedLoader.h>
#import <BVSDK/BVCurationsAddPostRequest.h>
#import <BVSDK/BVCurationsAnalyticsHelper.h>
#import <BVSDK/BVCurationsCollectionView.h>
#import <BVSDK/BVCurationsCollectionViewCell.h>
#import <BVSDK/BVCurationsAnalyticsHelper.h>

#import <BVSDK/BVCurationsFeedRequest.h>
#import <BVSDK/BVCurationsFeedItem.h>
#import <BVSDK/BVCurationsAddPostRequest.h>
#import <BVSDK/BVCurationsAnalyticsHelper.h>
#import <BVSDK/BVCurationsCollectionViewCell.h>

#import <BVSDK/BVCurationsFeedLoader.h>
#import <BVSDK/BVCurationsPhotoUploader.h>

// CurationsUI
#import <BVSDK/BVCurationsUICollectionView.h>
#import <BVSDK/BVCurationsPostViewController.h>

// Location
#import <BVSDK/BVPlaceAttributes.h>
#import <BVSDK/BVLocation.h>
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.3.0</string>
<string>6.4.0</string>
<key>CFBundleVersion</key>
<string>6.3.0</string>
<string>6.4.0</string>
<key>LSApplicationCategoryType</key>
<string></string>
<key>NSPrincipalClass</key>
Expand Down
2 changes: 1 addition & 1 deletion BVSDKTests/BVSDKTests-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
#ifndef BVSDKTests_Bridging_Header_h
#define BVSDKTests_Bridging_Header_h

#import "UIImage+Tests.h"
#import "UIImage+BundleLocator.h"
#endif /* BVSDKTests_Bridging_Header_h */
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

@interface UIImage (Tests)
+(UIImage*)testImageNamed:(NSString*) imageName;
@interface UIImage (BundleLocator)
+(UIImage*)bundledImageNamed:(NSString*) imageName;
@end

@interface BundleLocator : NSObject
Expand Down
21 changes: 21 additions & 0 deletions BVSDKTests/UIImage+BundleLocator.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
//
// UIImage+Tests.m
// BVSDK
//
// Copyright © 2016 Bazaarvoice. All rights reserved.
//

#import "UIImage+BundleLocator.h"

@implementation UIImage (BundleLocator)
+(UIImage*)bundledImageNamed:(NSString*) imageName
{

return [UIImage imageNamed:imageName
inBundle:[NSBundle bundleForClass:[BundleLocator class]]
compatibleWithTraitCollection:nil];
}
@end

@implementation BundleLocator
@end
20 changes: 0 additions & 20 deletions BVSDKTests/UIImage+Tests.m

This file was deleted.

18 changes: 1 addition & 17 deletions Examples/BVSDKDemo/BVSDKDemo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
736D4CEF1CDED0C40095EE6B /* ExtensionShareViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4CCD1CDED0C40095EE6B /* ExtensionShareViewController.swift */; };
736D4CF11CDED0C40095EE6B /* icon_bvlogo.png in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CD01CDED0C40095EE6B /* icon_bvlogo.png */; };
736D4CF21CDED0C40095EE6B /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CD11CDED0C40095EE6B /* [email protected] */; };
736D4CF51CDED0C40095EE6B /* DemoCurationsCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4CD61CDED0C40095EE6B /* DemoCurationsCollectionViewCell.swift */; };
736D4CF61CDED0C40095EE6B /* DemoCurationsCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CD71CDED0C40095EE6B /* DemoCurationsCollectionViewCell.xib */; };
736D4CFC1CDED0C40095EE6B /* CurationsFeedItemDetailCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4CE01CDED0C40095EE6B /* CurationsFeedItemDetailCell.swift */; };
736D4CFD1CDED0C40095EE6B /* CurationsFeedItemDetailCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CE11CDED0C40095EE6B /* CurationsFeedItemDetailCell.xib */; };
736D4CFE1CDED0C40095EE6B /* CurationsImageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4CE21CDED0C40095EE6B /* CurationsImageTableViewCell.swift */; };
Expand All @@ -112,8 +110,6 @@
736D4D051CDED0C40095EE6B /* CurationsFeedItemDetailTableViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CE91CDED0C40095EE6B /* CurationsFeedItemDetailTableViewController.xib */; };
736D4D061CDED0C40095EE6B /* CurationsFeedMasterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4CEA1CDED0C40095EE6B /* CurationsFeedMasterViewController.swift */; };
736D4D071CDED0C40095EE6B /* CurationsFeedPageViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 736D4CEB1CDED0C40095EE6B /* CurationsFeedPageViewController.xib */; };
736D4D0A1CDED2870095EE6B /* DemoCurationsController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 736D4D081CDED2870095EE6B /* DemoCurationsController.swift */; };
736D4D0B1CDED2870095EE6B /* DemoCurationsController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 736D4D091CDED2870095EE6B /* DemoCurationsController.xib */; };
737FA0B81CF8AD2700864B1B /* submitReview.json in Resources */ = {isa = PBXBuildFile; fileRef = 737FA0B71CF8AD2700864B1B /* submitReview.json */; };
737FA0BA1CF8AD8200864B1B /* submitQuestion.json in Resources */ = {isa = PBXBuildFile; fileRef = 737FA0B91CF8AD8200864B1B /* submitQuestion.json */; };
737FA0BC1CF8ADB100864B1B /* submitAnswer.json in Resources */ = {isa = PBXBuildFile; fileRef = 737FA0BB1CF8ADB100864B1B /* submitAnswer.json */; };
Expand Down Expand Up @@ -411,7 +407,7 @@
733BCF041CF81F2800045FC2 /* SubmitAnswerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SubmitAnswerViewController.swift; sourceTree = "<group>"; };
733BCF051CF81F2800045FC2 /* SubmitAnswerViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SubmitAnswerViewController.xib; sourceTree = "<group>"; };
7348C3711CE05A30000B6F3C /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
734CF3521CE0414400132462 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
734CF3521CE0414400132462 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; tabWidth = 3; };
7356B23A1CF89FCA004B0121 /* AnswerListHeaderCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AnswerListHeaderCell.swift; sourceTree = "<group>"; };
7356B23B1CF89FCA004B0121 /* AnswerListHeaderCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AnswerListHeaderCell.xib; sourceTree = "<group>"; };
73571C961CEE4DB700FF3220 /* BVSDKDemo.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = BVSDKDemo.entitlements; sourceTree = "<group>"; };
Expand All @@ -431,8 +427,6 @@
736D4CCD1CDED0C40095EE6B /* ExtensionShareViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ExtensionShareViewController.swift; path = ../BVSDKDemo/Curations/ExtensionShareViewController.swift; sourceTree = "<group>"; };
736D4CD01CDED0C40095EE6B /* icon_bvlogo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon_bvlogo.png; sourceTree = "<group>"; };
736D4CD11CDED0C40095EE6B /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "[email protected]"; sourceTree = "<group>"; };
736D4CD61CDED0C40095EE6B /* DemoCurationsCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoCurationsCollectionViewCell.swift; sourceTree = "<group>"; };
736D4CD71CDED0C40095EE6B /* DemoCurationsCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoCurationsCollectionViewCell.xib; sourceTree = "<group>"; };
736D4CE01CDED0C40095EE6B /* CurationsFeedItemDetailCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurationsFeedItemDetailCell.swift; sourceTree = "<group>"; };
736D4CE11CDED0C40095EE6B /* CurationsFeedItemDetailCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CurationsFeedItemDetailCell.xib; sourceTree = "<group>"; };
736D4CE21CDED0C40095EE6B /* CurationsImageTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurationsImageTableViewCell.swift; sourceTree = "<group>"; };
Expand All @@ -445,8 +439,6 @@
736D4CE91CDED0C40095EE6B /* CurationsFeedItemDetailTableViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CurationsFeedItemDetailTableViewController.xib; sourceTree = "<group>"; };
736D4CEA1CDED0C40095EE6B /* CurationsFeedMasterViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CurationsFeedMasterViewController.swift; sourceTree = "<group>"; };
736D4CEB1CDED0C40095EE6B /* CurationsFeedPageViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = CurationsFeedPageViewController.xib; sourceTree = "<group>"; };
736D4D081CDED2870095EE6B /* DemoCurationsController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DemoCurationsController.swift; sourceTree = "<group>"; };
736D4D091CDED2870095EE6B /* DemoCurationsController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DemoCurationsController.xib; sourceTree = "<group>"; };
737FA0B71CF8AD2700864B1B /* submitReview.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = submitReview.json; sourceTree = "<group>"; };
737FA0B91CF8AD8200864B1B /* submitQuestion.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = submitQuestion.json; sourceTree = "<group>"; };
737FA0BB1CF8ADB100864B1B /* submitAnswer.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = submitAnswer.json; sourceTree = "<group>"; };
Expand Down Expand Up @@ -964,10 +956,6 @@
736D4CD51CDED0C40095EE6B /* Curations Feed */ = {
isa = PBXGroup;
children = (
736D4CD61CDED0C40095EE6B /* DemoCurationsCollectionViewCell.swift */,
736D4CD71CDED0C40095EE6B /* DemoCurationsCollectionViewCell.xib */,
736D4D081CDED2870095EE6B /* DemoCurationsController.swift */,
736D4D091CDED2870095EE6B /* DemoCurationsController.xib */,
);
path = "Curations Feed";
sourceTree = "<group>";
Expand Down Expand Up @@ -1562,7 +1550,6 @@
87A02B561E018AC30002701B /* testNotificationProductConfig.json in Resources */,
733BCEF81CF7428200045FC2 /* ForalPro-Regular.otf in Resources */,
878309911CECF4140097FC48 /* RatingsAndReviewsViewController.xib in Resources */,
736D4CF61CDED0C40095EE6B /* DemoCurationsCollectionViewCell.xib in Resources */,
15AE819C1E01A906009C1478 /* PINCollectionViewCell.xib in Resources */,
87CD52421CE610A500FC2726 /* NewProductCurationsTableViewCell.xib in Resources */,
15BA73981DA6852100EAA1E9 /* StoreRatingTableViewCell.xib in Resources */,
Expand Down Expand Up @@ -1601,7 +1588,6 @@
1577DE441DA7E64D00A12B8F /* ReviewTitleTableViewCell.xib in Resources */,
8772167E1D3FDAD4007E5C6C /* conversationsReviewsEnduranceCycles_FilterLocation.json in Resources */,
8791449A1CF8BAAE00976220 /* revolution_cycles.png in Resources */,
736D4D0B1CDED2870095EE6B /* DemoCurationsController.xib in Resources */,
73199AF81CDD84E4006CC59D /* LaunchScreen.storyboard in Resources */,
730A64721CE56A1700580E9C /* RatingTableViewCell.xib in Resources */,
876FF1B61D21DDFF000ED410 /* FacebookLoginViewController.xib in Resources */,
Expand Down Expand Up @@ -1861,7 +1847,6 @@
15D5BEC81D79D10200D34EA0 /* JPSThumbnailAnnotation+Curations.swift in Sources */,
8747F1E21D11C2A000DC8E42 /* PermissionViewController.swift in Sources */,
87BA80821D342E3200AFA54D /* LocationSettings.swift in Sources */,
736D4D0A1CDED2870095EE6B /* DemoCurationsController.swift in Sources */,
871AD4111D08A5B8006583E5 /* ProfileViewController.swift in Sources */,
733843911CED58C800928760 /* WriteReviewViewController.swift in Sources */,
15AE819B1E01A906009C1478 /* PINCollectionViewCell.swift in Sources */,
Expand All @@ -1876,7 +1861,6 @@
15EA71A21DABF3CB00D9A706 /* MPTextView.m in Sources */,
739BDAC91CED47DE007D52CC /* ConversationsModel.swift in Sources */,
87F2D64B1D9ADFF400FB43F3 /* (null) in Sources */,
736D4CF51CDED0C40095EE6B /* DemoCurationsCollectionViewCell.swift in Sources */,
87BA80901D344D9800AFA54D /* StoreLocationTableViewCell.swift in Sources */,
87CF9A651DEE32CD0069D2B9 /* CartManager.swift in Sources */,
736D4CEE1CDED0C40095EE6B /* DateTimeAgo.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ class StoreReviewsViewController: UIViewController, UITableViewDelegate, UITable

// Check sorting and filter FilterOptions
if selectedFilterOption == FilterOptions.highestRating.rawValue {
request.addSort(.rating, order: .descending)
request.addReviewSort(.rating, order: .descending)
} else if selectedFilterOption == FilterOptions.lowestRating.rawValue {
request.addSort(.rating, order: .ascending)
request.addReviewSort(.rating, order: .ascending)
} else if selectedFilterOption == FilterOptions.mostHelpful.rawValue {
request.addSort(.helpfulness, order: .descending)
request.addReviewSort(.helpfulness, order: .descending)
}

self.tableView.load(request, success: { (response) in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,7 @@ class BaseDemoComposeServiceViewController: SLComposeServiceViewController {
color.setFill()
UIRectFill(rect)
if let img = UIImage(named: "icon_bvlogo") {
// sizing here is a little vodoo...cough...hacky
img.draw(in: CGRect(x: (size.width-size.height)/2, y: 0, width: size.height+20, height: size.height))
img.draw(in: CGRect(x: (size.width/2) - (size.height / 2) - 16, y: 1, width: size.height - 2, height: size.height - 2))
}
let image: UIImage = UIGraphicsGetImageFromCurrentImageContext()!
UIGraphicsEndImageContext()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,24 @@ import UIKit
import BVSDK

/** This subclassed UIViewController provides a wrapper around a UIImagePickerController and ShareViewController (subclassed from SLComposeServiceViewController).
*/
class DemoCustomPostViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
*/
let SPINNER_DIMENSION : CGFloat = 200.0


class DemoCustomPostViewController: UIViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {

let shareRequest : BVCurationsAddPostRequest?
var imagePicker = UIImagePickerController()
var placeholderText : String = ""

let spinner = Util.createSpinner(UIColor.bazaarvoiceTeal(), size: CGSize(width: SPINNER_HEIGHT_WIDTH, height: SPINNER_HEIGHT_WIDTH), padding: 50)

init(shareRequest: BVCurationsAddPostRequest, placeholderText : String) {
self.shareRequest = shareRequest
self.placeholderText = placeholderText
super.init(nibName: nil, bundle: nil)
}

required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
Expand Down Expand Up @@ -58,7 +63,7 @@ class DemoCustomPostViewController: UIViewController, UIImagePickerControllerDel

case 2:
self.presentingViewController?.dismiss(animated: true, completion: nil)

default:
// ignored
break
Expand Down Expand Up @@ -105,29 +110,39 @@ class DemoCustomPostViewController: UIViewController, UIImagePickerControllerDel

// image selected...
shareRequest?.image = info[UIImagePickerControllerEditedImage] as! UIImage

// Post an image with a SLComposeServiceViewController
let shareVC = ShareViewController.init(shareRequest: self.shareRequest!)
shareVC?.placeholder = self.placeholderText;
shareVC?.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext;

let shareVC = BVCurationsPostViewController.init(postRequest: self.shareRequest!, logoImage: UIImage(named: "icon_bvlogo")!, bavBarColor: UIColor.bazaarvoiceNavy(), navBarTintColor: UIColor.white)

shareVC.placeholder = "Enter text"
shareVC.modalPresentationStyle = UIModalPresentationStyle.overCurrentContext;

shareVC.didPressCancel = {
self.presentingViewController?.dismiss(animated: true, completion: nil)
}

shareVC.didBeginPost = {
self.spinner.frame.origin = CGPoint(x: self.view.frame.width/2 - SPINNER_HEIGHT_WIDTH/2, y: self.view.frame.height/4)
self.view.addSubview(self.spinner)
}

shareVC?.onDismissComplete = {
() -> Void in
self.presentingViewController?.dismiss(animated: true, completion: nil)
shareVC.didCompletePost = {(error) in
self.presentingViewController?.dismiss(animated: true, completion: nil)
self.spinner.removeFromSuperview()
}

imagePicker.dismiss(animated: true) { () -> Void in

self.present(shareVC!, animated: true) { () -> Void in
self.present(shareVC, animated: true) { () -> Void in
// completion
}

}
}

func imagePickerControllerDidCancel(_ picker: UIImagePickerController) {
self.presentingViewController?.dismiss(animated: true, completion: nil)
}


}
Binary file modified Examples/BVSDKDemo/BVSDKDemo/Curations/Resources/icon_bvlogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 7b4416c

Please sign in to comment.