Skip to content

Commit

Permalink
Merge pull request #23 from dtrenz/rc-1.0.2
Browse files Browse the repository at this point in the history
1.0.2 Release Candidate
  • Loading branch information
dtrenz committed Feb 19, 2016
2 parents 3f4d54a + 19b0bb5 commit eecd87e
Show file tree
Hide file tree
Showing 24 changed files with 504 additions and 77 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
build/
DerivedData

# Slather code coverage artifacts
cobertura.xml

## Various settings
*.pbxuser
!default.pbxuser
Expand Down
4 changes: 4 additions & 0 deletions .slather.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
coverage_service: cobertura_xml
xcodeproj: LaunchGate.xcodeproj
source_directory: Source
output_directory: .
17 changes: 11 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
branches:
only:
- develop
- master
- develop
- master
language: objective-c
osx_image: xcode7.2
notifications:
Expand All @@ -13,8 +13,13 @@ notifications:
on_start: never
on_success: change
before_install:
- gem install cocoapods
- pod install
- rvm use $RVM_RUBY_VERSION
- gem install cocoapods
- gem install slather
- pod install
after_success:
- slather
- bash <(curl -s https://codecov.io/bash) -f cobertura.xml
script:
- set -o pipefail && xcodebuild clean test -workspace LaunchGate.xcworkspace -scheme LaunchGate -destination 'platform=iOS Simulator,name=iPhone 6s' ONLY_ACTIVE_ARCH=NO | xcpretty
- pod lib lint
- set -o pipefail && xcodebuild clean test -workspace LaunchGate.xcworkspace -scheme LaunchGate -destination 'platform=iOS Simulator,name=iPhone 6s' ONLY_ACTIVE_ARCH=YES | xcpretty
- pod lib lint
26 changes: 14 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,25 @@
All notable changes to this project will be documented in this file.
`LaunchGate` adheres to [Semantic Versioning](http://semver.org/).

## [1.0.1](https://github.com/dtrenz/LaunchGate/releases/tag/1.0.1)
Released on 2016-02-12.
## [1.0.2](https://github.com/dtrenz/LaunchGate/releases/tag/1.0.2)
Released on 2016-02-18.

#### Added
- Inline documentation to public API
- More test coverage
- Cobertura coverage report generation via Slather
- Codecov.io coverage report CI

#### Updated
- NA

#### Fixed
- NA
- Previously, all configuration items (alert, optionalUpdate,
requiredUpdate) were required in the remote JSON configuration file. Now, they
are all optional, which now matches the documentation in the README.

## [1.0.1](https://github.com/dtrenz/LaunchGate/releases/tag/1.0.1)
Released on 2016-02-12.

#### Added
- Inline documentation to public API

## [1.0.0](https://github.com/dtrenz/LaunchGate/releases/tag/1.0.0)
Released on 2016-02-12.
Expand All @@ -26,10 +34,4 @@ Released on 2016-02-12.
- Documentation & Screenshots
- Example iOS project

#### Updated
- NA

#### Fixed
- NA

---
2 changes: 1 addition & 1 deletion LaunchGate.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "LaunchGate"
s.version = "1.0.1"
s.version = "1.0.2"
s.summary = <<-SUMMARY
LaunchGate makes it easy to let users know when an update to your app is available.
SUMMARY
Expand Down
20 changes: 20 additions & 0 deletions LaunchGate.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,17 @@
C5478DED1C6968DF00843BA3 /* SpecHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5478DE11C6968D900843BA3 /* SpecHelper.swift */; };
C5478DEE1C6968DF00843BA3 /* ConfigurationSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5478DE21C6968D900843BA3 /* ConfigurationSpec.swift */; };
C54CD9661C6BBAF50049E669 /* Memory.swift in Sources */ = {isa = PBXBuildFile; fileRef = C54CD9651C6BBAF50049E669 /* Memory.swift */; };
C5A110021C73D6D500ACA109 /* config-alert.json in Resources */ = {isa = PBXBuildFile; fileRef = C54758521C73D692000A6EFA /* config-alert.json */; };
C5A110031C73D6D900ACA109 /* config-required.json in Resources */ = {isa = PBXBuildFile; fileRef = C547584E1C73CC17000A6EFA /* config-required.json */; };
C5A110041C73D6DC00ACA109 /* config-optional.json in Resources */ = {isa = PBXBuildFile; fileRef = C547584C1C73CBF8000A6EFA /* config-optional.json */; };
C5A8787A1C6A74DD004599C2 /* config-malformed-alert.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A8786E1C6A74B9004599C2 /* config-malformed-alert.json */; };
C5A8787B1C6A74DD004599C2 /* config-malformed-empty.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A8786F1C6A74B9004599C2 /* config-malformed-empty.json */; };
C5A8787C1C6A74DD004599C2 /* config-malformed-ios.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A878701C6A74B9004599C2 /* config-malformed-ios.json */; };
C5A8787D1C6A74DD004599C2 /* config-malformed-optional.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A878711C6A74B9004599C2 /* config-malformed-optional.json */; };
C5A8787E1C6A74DD004599C2 /* config-malformed-required.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A878721C6A74B9004599C2 /* config-malformed-required.json */; };
C5A8787F1C6A74DD004599C2 /* config.json in Resources */ = {isa = PBXBuildFile; fileRef = C5A878731C6A74B9004599C2 /* config.json */; };
C5ACC55D1C75240F009AE9F0 /* MemorySpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ACC55C1C75240F009AE9F0 /* MemorySpec.swift */; };
C5ACF5341C74EF72009C1729 /* DialogManagerSpec.swift in Sources */ = {isa = PBXBuildFile; fileRef = C5ACF5331C74EF72009C1729 /* DialogManagerSpec.swift */; };
C5C04BD11C696767007397D0 /* LaunchGate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C5C04BC61C696767007397D0 /* LaunchGate.framework */; };
/* End PBXBuildFile section */

Expand All @@ -46,6 +51,9 @@
/* Begin PBXFileReference section */
14E919E48184B1E85E4115F1 /* Pods_LaunchGateTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_LaunchGateTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
B39FB08149E97FF0556C997D /* Pods-LaunchGateTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LaunchGateTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-LaunchGateTests/Pods-LaunchGateTests.release.xcconfig"; sourceTree = "<group>"; };
C547584C1C73CBF8000A6EFA /* config-optional.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "config-optional.json"; sourceTree = "<group>"; };
C547584E1C73CC17000A6EFA /* config-required.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "config-required.json"; sourceTree = "<group>"; };
C54758521C73D692000A6EFA /* config-alert.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "config-alert.json"; sourceTree = "<group>"; };
C5478DC81C6968C800843BA3 /* AlertConfiguration.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AlertConfiguration.swift; path = Source/AlertConfiguration.swift; sourceTree = SOURCE_ROOT; };
C5478DC91C6968C800843BA3 /* DialogManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DialogManager.swift; path = Source/DialogManager.swift; sourceTree = SOURCE_ROOT; };
C5478DCA1C6968C800843BA3 /* LaunchGate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = LaunchGate.swift; path = Source/LaunchGate.swift; sourceTree = SOURCE_ROOT; };
Expand All @@ -70,6 +78,8 @@
C5A878711C6A74B9004599C2 /* config-malformed-optional.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "config-malformed-optional.json"; sourceTree = "<group>"; };
C5A878721C6A74B9004599C2 /* config-malformed-required.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "config-malformed-required.json"; sourceTree = "<group>"; };
C5A878731C6A74B9004599C2 /* config.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = config.json; sourceTree = "<group>"; };
C5ACC55C1C75240F009AE9F0 /* MemorySpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MemorySpec.swift; path = Tests/MemorySpec.swift; sourceTree = SOURCE_ROOT; };
C5ACF5331C74EF72009C1729 /* DialogManagerSpec.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DialogManagerSpec.swift; path = Tests/DialogManagerSpec.swift; sourceTree = SOURCE_ROOT; };
C5C04BC61C696767007397D0 /* LaunchGate.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LaunchGate.framework; sourceTree = BUILT_PRODUCTS_DIR; };
C5C04BD01C696767007397D0 /* LaunchGateTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = LaunchGateTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
E2A3DA34DC3D21E902E20A86 /* Pods-LaunchGateTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LaunchGateTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-LaunchGateTests/Pods-LaunchGateTests.debug.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -120,7 +130,10 @@
C5A878701C6A74B9004599C2 /* config-malformed-ios.json */,
C5A878711C6A74B9004599C2 /* config-malformed-optional.json */,
C5A878721C6A74B9004599C2 /* config-malformed-required.json */,
C547584C1C73CBF8000A6EFA /* config-optional.json */,
C547584E1C73CC17000A6EFA /* config-required.json */,
C5A878731C6A74B9004599C2 /* config.json */,
C54758521C73D692000A6EFA /* config-alert.json */,
);
name = Fixtures;
path = Tests/Fixtures;
Expand Down Expand Up @@ -187,7 +200,9 @@
children = (
C5478DE21C6968D900843BA3 /* ConfigurationSpec.swift */,
C5478DDE1C6968D900843BA3 /* DefaultParserSpec.swift */,
C5ACF5331C74EF72009C1729 /* DialogManagerSpec.swift */,
C5478DE01C6968D900843BA3 /* LaunchGateSpec.swift */,
C5ACC55C1C75240F009AE9F0 /* MemorySpec.swift */,
C5478DDF1C6968D900843BA3 /* RemoteFileManagerSpec.swift */,
C5478DE11C6968D900843BA3 /* SpecHelper.swift */,
C5A8786D1C6A74B9004599C2 /* Fixtures */,
Expand Down Expand Up @@ -299,9 +314,12 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
C5A110031C73D6D900ACA109 /* config-required.json in Resources */,
C5A110041C73D6DC00ACA109 /* config-optional.json in Resources */,
C5A8787F1C6A74DD004599C2 /* config.json in Resources */,
C5A8787B1C6A74DD004599C2 /* config-malformed-empty.json in Resources */,
C5A8787A1C6A74DD004599C2 /* config-malformed-alert.json in Resources */,
C5A110021C73D6D500ACA109 /* config-alert.json in Resources */,
C5A8787C1C6A74DD004599C2 /* config-malformed-ios.json in Resources */,
C5A8787E1C6A74DD004599C2 /* config-malformed-required.json in Resources */,
C5A8787D1C6A74DD004599C2 /* config-malformed-optional.json in Resources */,
Expand Down Expand Up @@ -398,7 +416,9 @@
C5478DEB1C6968DF00843BA3 /* RemoteFileManagerSpec.swift in Sources */,
C5478DEC1C6968DF00843BA3 /* LaunchGateSpec.swift in Sources */,
C5478DEA1C6968DF00843BA3 /* DefaultParserSpec.swift in Sources */,
C5ACF5341C74EF72009C1729 /* DialogManagerSpec.swift in Sources */,
C5478DEE1C6968DF00843BA3 /* ConfigurationSpec.swift in Sources */,
C5ACC55D1C75240F009AE9F0 /* MemorySpec.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
[![Version](https://img.shields.io/cocoapods/v/LaunchGate.svg?style=flat)](http://cocoapods.org/pods/LaunchGate)
[![License](https://img.shields.io/cocoapods/l/LaunchGate.svg?style=flat)](http://cocoapods.org/pods/LaunchGate)
[![Platform](https://img.shields.io/cocoapods/p/LaunchGate.svg?style=flat)](http://cocoapods.org/pods/LaunchGate)
<a href="http://www.detroitlabs.com/"><img src="https://img.shields.io/badge/sponsor-Detroit%20Labs-000000.svg?style=flat"></a>
[![codecov.io](https://codecov.io/github/dtrenz/LaunchGate/coverage.svg?branch=develop)](https://codecov.io/github/dtrenz/LaunchGate?branch=develop)
[![Sponsored by Detroit Labs](https://img.shields.io/badge/sponsor-Detroit%20Labs-000000.svg?style=flat)](http://www.detroitlabs.com)

LaunchGate makes it easy to let users know when an update
to your app is available.
Expand Down
33 changes: 21 additions & 12 deletions Source/DefaultParser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,21 @@ class DefaultParser: LaunchGateParser {

guard let config = json["ios"] as? JSON else { throw Error.UnableToParseConfigurationObject }

let alert = try DefaultParser.parseAlert(config)
let optionalUpdate = try DefaultParser.parseOptionalUpdate(config)
let requiredUpdate = try DefaultParser.parseRequiredUpdate(config)
var alert: AlertConfiguration?
var optionalUpdate: UpdateConfiguration?
var requiredUpdate: UpdateConfiguration?

if let alertJSON = config["alert"] as? JSON {
alert = try DefaultParser.parseAlert(alertJSON)
}

if let optionalUpdateJSON = config["optionalUpdate"] as? JSON {
optionalUpdate = try DefaultParser.parseOptionalUpdate(optionalUpdateJSON)
}

if let requiredUpdateJSON = config["requiredUpdate"] as? JSON {
requiredUpdate = try DefaultParser.parseRequiredUpdate(requiredUpdateJSON)
}

return LaunchGateConfiguration(alert: alert, optionalUpdate: optionalUpdate, requiredUpdate: requiredUpdate)
} catch let error as DefaultParser.Error {
Expand All @@ -57,25 +69,22 @@ class DefaultParser: LaunchGateParser {
}

private static func parseAlert(json: JSON) throws -> AlertConfiguration? {
guard let alertObject = json["alert"] as? JSON else { throw Error.UnableToParseAlert }
guard let message = alertObject["message"] as? String else { throw Error.UnableToParseAlert }
guard let blocking = alertObject["blocking"] as? Bool else { throw Error.UnableToParseAlert }
guard let message = json["message"] as? String else { throw Error.UnableToParseAlert }
guard let blocking = json["blocking"] as? Bool else { throw Error.UnableToParseAlert }

return AlertConfiguration(message: message, blocking: blocking)
}

private static func parseOptionalUpdate(json: JSON) throws -> UpdateConfiguration? {
guard let updateObject = json["optionalUpdate"] as? JSON else { throw Error.UnableToParseOptionalUpdate }
guard let version = updateObject["optionalVersion"] as? String else { throw Error.UnableToParseOptionalUpdate }
guard let message = updateObject["message"] as? String else { throw Error.UnableToParseOptionalUpdate }
guard let version = json["optionalVersion"] as? String else { throw Error.UnableToParseOptionalUpdate }
guard let message = json["message"] as? String else { throw Error.UnableToParseOptionalUpdate }

return UpdateConfiguration(version: version, message: message)
}

private static func parseRequiredUpdate(json: JSON) throws -> UpdateConfiguration? {
guard let updateObject = json["requiredUpdate"] as? JSON else { throw Error.UnableToParseRequiredUpdate }
guard let version = updateObject["minimumVersion"] as? String else { throw Error.UnableToParseRequiredUpdate }
guard let message = updateObject["message"] as? String else { throw Error.UnableToParseRequiredUpdate }
guard let version = json["minimumVersion"] as? String else { throw Error.UnableToParseRequiredUpdate }
guard let message = json["message"] as? String else { throw Error.UnableToParseRequiredUpdate }

return UpdateConfiguration(version: version, message: message)
}
Expand Down
12 changes: 7 additions & 5 deletions Source/DialogManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,9 @@ class DialogManager {
}
}

// MARK: - Private Methods

// MARK: Custom Alert Controllers

private func createAlertController(type: DialogType, message: String) -> UIAlertController {
func createAlertController(type: DialogType, message: String) -> UIAlertController {
let alertController = UIAlertController(title: nil, message: message, preferredStyle: .Alert)

switch type {
Expand All @@ -71,9 +69,9 @@ class DialogManager {
return alertController
}

private func displayAlertController(alert: UIAlertController, completion: (() -> Void)?) {
func displayAlertController(alert: UIAlertController, completion: (() -> Void)?) {
dispatch_async(dispatch_get_main_queue()) { [] in
if let topViewController = UIApplication.sharedApplication().keyWindow?.rootViewController {
if let topViewController = self.topViewController() {
topViewController.presentViewController(alert, animated: true) {
if let completion = completion {
completion()
Expand All @@ -83,6 +81,10 @@ class DialogManager {
}
}

func topViewController() -> UIViewController? {
return UIApplication.sharedApplication().keyWindow?.rootViewController
}

// MARK: Custom Alert Actions

private func dismissActon() -> UIAlertAction {
Expand Down
2 changes: 1 addition & 1 deletion Source/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<string>1.0.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
10 changes: 4 additions & 6 deletions Source/RemoteFileManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ class RemoteFileManager {
}

func fetchRemoteFile(callback: (NSData) -> Void) {
let request = NSURLRequest(URL: remoteFileURL)

performRemoteFileRequest(request, responseHandler: callback)
performRemoteFileRequest(NSURLSession.sharedSession(), url: remoteFileURL, responseHandler: callback)
}

func performRemoteFileRequest(request: NSURLRequest, responseHandler: (data: NSData) -> Void) {
let session = NSURLSession.sharedSession().dataTaskWithRequest(request) { (data, response, error) -> Void in
func performRemoteFileRequest(session: NSURLSession, url: NSURL, responseHandler: (data: NSData) -> Void) {
let task = session.dataTaskWithURL(url) { (data, response, error) -> Void in
if let error = error {
print("LaunchGate — Error: \(error.localizedDescription)")
}
Expand All @@ -37,7 +35,7 @@ class RemoteFileManager {
responseHandler(data: data)
}

session.resume()
task.resume()
}

}
Loading

0 comments on commit eecd87e

Please sign in to comment.