Skip to content

Commit

Permalink
Release 1.0.1.
Browse files Browse the repository at this point in the history
* GCB-316: Move `GrandCentralBoard/Utilities` → `GCBUtilities`

* GCB-316: Add podspec for `GCBUtilities`

* GCB-316: Add `GCBUtilities` to Podfile

* GCB-316: Run `pod install`

* GCB-316: Move `NSDate` extensinon to `GCBUtilities`

* GCB-316: Remove `Manager` type dependency from `GCBUtilities`

* GCB-316: Run `pod install`

* GCB-316: Make necessary interfaces public; Add missing imports

* GCB-316: Fix missing parameter error after refactoring

* GCB-316: Fix usages of `LabelWithSpacing` in XIBs

* GCB-316: Add missing imports in unit tests target

* GCB-224: Remove unused code.

* GCB-224: Add missing query parameter which enables children bonuses.

* GCB-224: Fix: commented bonuses not displayed.

* GCB-224: Fix SwiftLint warnings.

* GCB-224: CR - improve sorting.

* GCB-224: CR - simplify flatten().

* GCB-316: CR fix - remove extra space

* GCB-268: Remove unneeded let in if statements

* GCB-268: Add PageViewsSourceTests

* GCB-314: Remove header view from Analytics

* GCB-314: Remove title of TableWidgetView

* GCB-314: Update design of TableViewCell

* GCB-314: Gardening

* GCB-314: Fix Swiftlint warnings

* Add FBSnapshotTestCase pod

* Run pod install

* Add FB_REFERENCE_IMAGE_DIR to schemes

* GCB-328: Add CircleChartView

* GCB-328: Normalize CircleChartItems

* GCB-328: Add CircleChartViewTests

* GCB-275: Display event's "starts in" based on clock's time, not the current time

it allows for events located anywhere in the time.

* GCB-275: Remove blink effect and assets

* GCB-275: Update clock assets

* GCB-275: Present current time and upcoming event

* GCB-275: Change widget background

* GCB-328: Add CircleChartViewModel

* GCB-328: Add @IBDesignable to CircleChartView

* GCB-275: Add unit tests

* GCB-275: Wrap words for long event name

* GCB-275: Fix widget background

* GCB-275: Make outlets private

* GCB-310: Add WidgetTemplateView.

* GCB-310: Add nib's to the bundle.

* GCB-310: Add header and content view.

* GCB-310: WidgetTemplateView implementing ViewModelRendering.

* GCB-310: Setup propely WidgetTemplateView with contentView.

* GCB-310: Add default colors for GCB.

* GCB-310: Add header elements.

* GCB-310: Configure template view with layout settings.

* GCB-310: Add comments.

* GCB-310: Fix layout.

* GCB-310: Cleaning.

* GCB-310: CR - improve initializaiton.

* GCB-310: Add snapshot tests.

* GCB-310: CR - cleaning.

* GCB-310: CR - improve constraints.

* GCB-310: CR - fix content view margins.

* GCB-310: Add public init.

* GCB-275: CR - use common color definition

* GCB-276: Change background color.

* GCB-276: Add green edge to the bubble.

* GCB-276: Remove unused code.

* GCB-327: Add view model to configure template error view

* GCB-327: Add snapshot tests

* GCB-327: Set up error view with default icon

* GCB-327: Run `pod install`

* GCB-276: CR - fix color space for widget background color

* GCB-327: CR - remove unused code

* GCB-346: Add numberOfBubbles to bonus widget settings.

* GCB-346: Set up bonus widget wiht number of people defined in configuration file.

* GCB-347: Display header and description for bonus widget.

* GCB-347: Add default number of bubbles.

* GCB-347: Renaming.

* GCB-350: Decode value from configuration file

* GCB-350: Pass value to widget and provide default

* GCB-347: Stick to convention.

* GCB-329: Make LabelWithSpacing react to property changes

* GCB-329: Add HarvestWidgetView.xib

* GCB-329: Use HarvestWidgetView in HarvestWidget

* GCB-329: Fix LabelWithSpacing, apply attributes when text set

* GCB-329: Fix Circle charts spacing

* GCB-329: Set up Harvest Widget with empty model on init

* GCB-329: Add UIColor+BillingColor

* GCB-329: Display Harvest source result

* GCB-329: Gardening

* GCB-329: Update HarvestWidget tests

* GCB-329: Make startAngle IBInspectable in CircleChart

* GCB-329: Reverse CircleChart direction

* GCB-329: Fix circle charts start angle in HarvestWidgetView

* GCB-329: Update Harvest view model tests

* GCB-329: Add loading indicator to HarvestWidget

* GCB-329: Update Harvest Widget fonts

* GCB-329: Fix constraints

* GCB-347: CR - hold reference to widget view wrapper.

* GCB-349: Wrap widget with header view.

* GCB-349: CR - hold reference to widget view wrapper.

* GCB-282: Display header and description for blog widget.

* GCB-349: CR - hold reference to widget view wrapper.

* GCB-349: Remove trailing whitespace.

* GCB-329: Gardening

* GCB-329: Fix Harvest Widget circle items ordering

* GCB-349: CR - Create WidgetTemplateView only when it's needed.

* GCB-281: Add header view

* GCB-281: Center charts vertically in container

* GCB-345: Display users average group on right chart, Harvest

* GCB-345: Refactor Harvest ViewModel tests

* GCB-282: Stick to design with fonts.

* GCB-281: Add localization in widget header

* GCB-177: Add Error View to Watch Widget

* GCB-177: Add snapshot tests

* GCB-177: Fix adding error view to WatchWidget

* GCB-177: Move error handling logic WatchWidget

* GCB-177: Gardening

* GCB-345: Gardening

* GCB-329: Fix circle color when empty

* GCB-329: Add snapshot test for HarvestWidgetView

* GCB-303: Add error view to HarvestWidget

* GCB-303: Add HarvestWidgetSnapshotTests

* GCB-303: Remove unneeded mainView

* GCB-302: Render error and no data case in widget

* GCB-307: Add error view to ImageWidget

* GCB-307: Add ImageWidgetSnapshotTests

* GCB-307: Gardening

* GCB-302: Fix cell background color

* GCB-302: Add snapshot tests

* GCB-307: Change 'Cat Photos' to 'Photos'

* GCB-301: Add error view in bonus widget.

* GCB-302: CR - imrove strings and fix switch indentation

* GCB-302: CR - fix error state not being displayed after "no data" state

* GCB-301: Refactor to enable testing.

* GCB-301: Add snapshot tests.

* GCB-301: Change to better naming.

* GCB-301: CR - use localized strings.

* GCB-301: Extract widget title.

* GCB-301: CR - string localization.

* GCB-301: CR - Fix retain cicle.

* GCB-302: CR - fix warning about AL being modified from background thread

* GCB-302: CR - unify indentation

* GCB-302: CR - unify `mainView` hierarchy with Bonusly widget

* Fix Widget Template content margin

* Fix reports array slicing

* CR: fix reports array slicing

* Add badges.

* GCB-355: Change image widget configuration json to specify title and optional subtitle

* GCB-355: Display widget title in error state or "Photos" if title not provided

* GCB-355: Fix indentation

* GCB-355: Update snapshot tests

* Add GitHubCell

* Add GitHubSnapshotTests, fix the implementation

* Add GitHubWidget

* Add GitHubWidgetView

* Add GitHubWidgetSnapshotTests, fix implementation

* Limit displayed repositories to 3

* Filter out repositories with 0 PRs

* Gardening

* Make `GrandCentralBoard` class deprecated, closes #127.

* Change from `mvp` to `develop`.

* Fix Travis, build only master and develop on push

* Remove checking the branch.

* GCB-355: CR - use `struct` instead of tuple

* GCB-355: CR - add snapshot test for empty subtitle configuration

* CR: small fixes

* CR: Fix GitHubCell label's font size and letter spacing

* Cleaner travis script.

* Fix table view

* Add GitHubSourceNoDataError

* Add error and no_pr view to GitHubWidget

* Add testWidgetWithNoDataReturned

* Make GitHub error message localized

* Add GitHubWidgetBuilder, GitHubWidgetSettings

* Gardening

* Add MessageBubbleView for SlackWidget

* Use MessageBubbleView in SlackWidget

* CR: Set recordMode=false in snapshot test

* CR: Fix GitHubWidgetViewModel initialization

* Use autolayout instead of manual calculations in `layoutSubviews`.

* Don't fetch PRs if total issues count is 0

* Fix GitHubDataProviderTests

* Use guard instead of if

* Make configureWithViewModel public in template view

* Add snapshot test for WidgetTemplateView

* Fix setting layout multiple times, add current/defaultLayoutSettings properties

* Update README to add information about GCBCore and Cocoa Pods.

* Add information about illustration.

* How to show a view and start the refresher.

* Remove unused image.

* Introduce `BillableDates` model

* Ignore weekends in Harvest widget by default

* CR: remove unneeded setNeedsLayout

* CR - use calendar's method for determining weekend

* CR - always use the current date for fetching Havest data

* CR - move dates creation to `NSCalendar` extension

* Move non-related to core assets and code to GCBUtilities

* Fix tests

* Set version to 1.0.1

* Remove resources.
  • Loading branch information
ochococo committed Jun 6, 2016
1 parent 40c7964 commit fa2eb23
Show file tree
Hide file tree
Showing 344 changed files with 10,535 additions and 4,982 deletions.
6 changes: 5 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ script:
- "./scripts/travis-script.sh"
notifications:
email:
on_success: never
on_success: never
branches:
only:
- master
- develop
4 changes: 1 addition & 3 deletions GCBCore.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = 'GCBCore'
s.version = '1.0.0'
s.version = '1.0.1'
s.license = 'GPLv3'
s.summary = 'Hang a TV in your open space or team room to show everyone what`s up and get them up to speed.'
s.homepage = 'https://github.com/macoscope/GrandCentralBoard'
Expand All @@ -11,8 +11,6 @@ Pod::Spec.new do |s|
s.requires_arc = true
s.tvos.deployment_target = '9.0'

s.source_files = 'GCBCore/**/*.swift'

s.dependency 'Alamofire', '~> 3.0'
s.dependency 'Decodable', '~> 0.4'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import UIKit

/// The errors that `GrandCentralBoard` can throw.
/// The errors that `GrandCentralBoardController` can throw.
public enum GrandCentralBoardError: ErrorType, HavingMessage {
case WrongWidgetsCount

Expand All @@ -31,7 +31,7 @@ public protocol Configurable: class {
}

/// This is a controller class that stacks views on `ViewStacking` view and schedules updates for Widgets using object conforming to `SchedulingJobs`.
public final class GrandCentralBoard {
public class GrandCentralBoardController {

private let stack: ViewStacking
private let scheduler: SchedulingJobs
Expand All @@ -41,7 +41,7 @@ public final class GrandCentralBoard {
private var widgets: [WidgetControlling] = []

/**
Initialize the `GrandCentralBoard`.
Initialize the `GrandCentralBoardController`.

- parameter scheduler: scheduling updates for widgets.
- parameter stack: a view having the ability to stack views.
Expand All @@ -53,7 +53,7 @@ public final class GrandCentralBoard {
}
}

extension GrandCentralBoard: Configurable {
extension GrandCentralBoardController: Configurable {

public func configure(configuration: Configuration) throws {

Expand Down Expand Up @@ -87,3 +87,8 @@ extension GrandCentralBoard: Configurable {
}
}
}

@available(*, deprecated, message="`GrandCentralBoard` class name is deprecated, use the replacement class `GrandCentralBoardController` as in v1.5 this class will cease to exist.")
public final class GrandCentralBoard : GrandCentralBoardController {

}
22 changes: 22 additions & 0 deletions GCBUtilities.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Pod::Spec.new do |s|

s.name = 'GCBUtilities'
s.version = '0.0.1'
s.license = 'GPLv3'
s.summary = 'Hang a TV in your open space or team room to show everyone what`s up and get them up to speed.'
s.homepage = 'https://github.com/macoscope/GrandCentralBoard'
s.authors = { 'Oktawian Chojnacki' => '[email protected]' }
s.source = { git: 'https://github.com/macoscope/GrandCentralBoard.git', tag: s.version }

s.requires_arc = true
s.tvos.deployment_target = '9.0'

s.source_files = 'GCBUtilities/**/*.swift'

s.dependency 'Alamofire', '~> 3.0'
s.dependency 'Decodable', '~> 0.4'
s.dependency 'Operations', '~> 2.9'
s.dependency 'GCBCore'

end

20 changes: 20 additions & 0 deletions GCBUtilities/Extensions/NSBundle.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// NSBundle.swift
// Pods
//
// Created by Maciek Grzybowski on 18.05.2016.
//
//

import Foundation


internal extension NSBundle {

class func resourcesBundle() -> NSBundle {
let mainBundle = NSBundle(forClass: WidgetTemplateView.self)
let resourcesBundleURL = mainBundle.URLForResource("GCBUtilitiesBundle", withExtension: "bundle")!
return NSBundle(URL: resourcesBundleURL)!

}
}
File renamed without changes.
32 changes: 32 additions & 0 deletions GCBUtilities/Extensions/UIColor.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
//
// Created by Krzysztof Werys on 10.03.2016.
// Copyright © 2016 Oktawian Chojnacki. All rights reserved.
//

import UIKit

public extension UIColor {
static func gcb_redColor() -> UIColor {
return UIColor(red: 208/255, green: 22/255, blue: 43/255, alpha: 1.0)
}

static func gcb_greenColor() -> UIColor {
return UIColor(red: 35/255, green: 208/255, blue: 165/255, alpha: 1.0)
}

static func gcb_fadedOrangeColor() -> UIColor {
return UIColor(red: 246/255, green: 157/255, blue: 67/255, alpha: 1.0)
}

static func gcb_blackColor() -> UIColor {
return UIColor(red: 26/255, green: 26/255, blue: 26/255, alpha: 1.0)
}

static func gcb_whitetextColor() -> UIColor {
return UIColor(red: 255/255, green: 255/255, blue: 255/255, alpha: 1.0)
}

static func gcb_blackTwoColor() -> UIColor {
return UIColor(red: 32/255, green: 32/255, blue: 32/255, alpha: 1.0)
}
}
Binary file added GCBUtilities/Resources/gcb-error-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@

import Decodable

struct AccessToken: Decodable {
public struct AccessToken: Decodable {

let token: String
let expireDate: NSDate
public let token: String
public let expireDate: NSDate

init(token: String, expiresIn: Int) {
public init(token: String, expiresIn: Int) {
self.token = token
self.expireDate = NSDate(timeIntervalSinceNow: NSTimeInterval(expiresIn))
}

static func decode(json: AnyObject) throws -> AccessToken {
public static func decode(json: AnyObject) throws -> AccessToken {
return try AccessToken(token: json => "access_token", expiresIn: json => "expires_in")
}

func isExpired() -> Bool {
public func isExpired() -> Bool {
return NSDate() >= expireDate
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,22 @@

import Alamofire
import Operations
import GCBCore

enum APIDataError: ErrorType {

public enum APIDataError: ErrorType {
case IncorrectRequestParameters
case AuthorizationError
case ModelDecodeError(ErrorType)
case UnderlyingError(NSError)
}

protocol APIDataProviding {
public protocol APIDataProviding {
func request(method: Method, url: NSURL, parameters: [String: AnyObject]?,
encoding: ParameterEncoding, completion: ResultType<AnyObject, APIDataError>.result -> Void)
encoding: ParameterEncoding, completion: GCBCore.Result<AnyObject> -> Void)
}

final class GoogleAPIDataProvider: APIDataProviding {
public final class GoogleAPIDataProvider: APIDataProviding {

private let tokenProvider: OAuth2TokenProviding
private var accessToken: AccessToken?
Expand All @@ -30,7 +32,7 @@ final class GoogleAPIDataProvider: APIDataProviding {

private let operationQueue = OperationQueue()

init(tokenProvider: OAuth2TokenProviding, networkRequestManager: NetworkRequestManager = Manager()) {
public init(tokenProvider: OAuth2TokenProviding, networkRequestManager: NetworkRequestManager) {
self.tokenProvider = tokenProvider
self.networkRequestManager = networkRequestManager
}
Expand All @@ -52,12 +54,12 @@ final class GoogleAPIDataProvider: APIDataProviding {
return refreshTokenOperation
}

func request(method: Method, url: NSURL, parameters: [String: AnyObject]?, encoding: ParameterEncoding = .URL,
completion: ResultType<AnyObject, APIDataError>.result -> Void) {
public func request(method: Method, url: NSURL, parameters: [String: AnyObject]?, encoding: ParameterEncoding = .URL,
completion: GCBCore.Result<AnyObject> -> Void) {

let fetchDataOperation = BlockOperation (block: { [weak self] (continueWithError) in
guard let strongSelf = self, let accessToken = strongSelf.accessToken?.token else {
completion(.Failure(.AuthorizationError))
guard let strongSelf = self, accessToken = strongSelf.accessToken?.token else {
completion(.Failure(APIDataError.AuthorizationError))
continueWithError(error: APIDataError.AuthorizationError)
return
}
Expand All @@ -66,7 +68,7 @@ final class GoogleAPIDataProvider: APIDataProviding {

strongSelf.networkRequestManager.requestJSON(method, url: url, parameters: parameters, headers: headers, encoding: encoding) { result in
switch result {
case .Failure(let error): completion(.Failure(.UnderlyingError(error)))
case .Failure(let error): completion(.Failure(error))
case .Success(let value): completion(.Success(value))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,46 @@
//

import Alamofire
import GCBCore

enum RefreshTokenError: ErrorType {
public enum RefreshTokenError: ErrorType {
case FailedResponseParsing
case UnderlyingError(NSError)
}

protocol OAuth2TokenProviding {
func accessTokenFromRefreshToken(completion: (ResultType<AccessToken, RefreshTokenError>.result) -> Void)
public protocol OAuth2TokenProviding {
func accessTokenFromRefreshToken(completion: (GCBCore.Result<AccessToken>) -> Void)
}

private let googleRefreshTokenURL = "https://accounts.google.com/o/oauth2/token"

final class GoogleTokenProvider: OAuth2TokenProviding {
public final class GoogleTokenProvider: OAuth2TokenProviding {

private let clientID, clientSecret: String
private let refreshToken: String
private let refreshURL: URLStringConvertible

init(clientID: String, clientSecret: String, refreshToken: String, refreshURL: URLStringConvertible = googleRefreshTokenURL) {
public init(clientID: String, clientSecret: String, refreshToken: String, refreshURL: URLStringConvertible = googleRefreshTokenURL) {
self.clientID = clientID
self.clientSecret = clientSecret
self.refreshToken = refreshToken
self.refreshURL = refreshURL
}

func accessTokenFromRefreshToken(completion: (ResultType<AccessToken, RefreshTokenError>.result) -> Void) {
public func accessTokenFromRefreshToken(completion: (GCBCore.Result<AccessToken>) -> Void) {
Alamofire.request(.POST, googleRefreshTokenURL, parameters: [
"client_id": clientID,
"client_secret": clientSecret,
"refresh_token": refreshToken,
"grant_type": "refresh_token"
]).responseJSON { response in
switch response.result {
case .Failure(let error): completion(.Failure(.UnderlyingError(error)))
case .Failure(let error): completion(.Failure(RefreshTokenError.UnderlyingError(error)))
case .Success(let json):
if let tokenResponse = try? AccessToken.decode(json) {
completion(.Success(tokenResponse))
} else {
completion(.Failure(.FailedResponseParsing))
completion(.Failure(RefreshTokenError.FailedResponseParsing))
}
}
}
Expand Down
49 changes: 49 additions & 0 deletions GCBUtilities/Utilities/LabelWithSpacing.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Created by Oktawian Chojnacki on 08.09.2015.
// Copyright (c) 2015 Macoscope. All rights reserved.
//

import UIKit


public class LabelWithSpacing: UILabel {

@IBInspectable public var kerning: Float = 1.0 {
didSet { applyCustomAttributes() }
}
@IBInspectable public var lineSpace: CGFloat = 0.0 {
didSet { applyCustomAttributes() }
}

public override var text: String? {
didSet { applyCustomAttributes() }
}

public override func awakeFromNib() {
super.awakeFromNib()
applyCustomAttributes()
}

public func applyCustomAttributes() {
guard let text = text else {
attributedText = nil
return
}

let attributedString = NSMutableAttributedString(string: text)
attributedString.beginEditing()
if lineSpace > 0.0 {
let paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = lineSpace
attributedString.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle,
range: NSRange(location: 0, length: text.characters.count))
}

attributedString.addAttribute(NSKernAttributeName, value: kerning,
range: NSRange(location: 0, length: text.characters.count))
attributedString.endEditing()
attributedText = attributedString

sizeToFit()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
//

import Foundation
import GCBCore


public enum Method: String {
case OPTIONS, GET, HEAD, POST, PUT, PATCH, DELETE, TRACE, CONNECT
Expand All @@ -16,7 +18,7 @@ public enum ParameterEncoding {
case URL, URLEncodedInURL, JSON, PropertyList(NSPropertyListFormat, NSPropertyListWriteOptions)
}

protocol NetworkRequestManager {
public protocol NetworkRequestManager {
func requestJSON(method: Method, url: NSURL, parameters: [String : AnyObject]?, headers: [String : String]?,
encoding: ParameterEncoding, completion: (ResultType<AnyObject, NSError>.result) -> Void)
encoding: ParameterEncoding, completion: (Result<AnyObject>) -> Void)
}
Loading

0 comments on commit fa2eb23

Please sign in to comment.