diff --git a/Armchair.xcodeproj/project.pbxproj b/Armchair.xcodeproj/project.pbxproj index e4b55d4..cac8322 100644 --- a/Armchair.xcodeproj/project.pbxproj +++ b/Armchair.xcodeproj/project.pbxproj @@ -8,9 +8,7 @@ /* Begin PBXBuildFile section */ E6D8B8F119C756A4001AD043 /* Armchair.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Armchair.swift */; }; - E6D8B8F419C756A4001AD043 /* Armchair.h in Headers */ = {isa = PBXBuildFile; fileRef = F8111E3819A95C8B0040E7D1 /* Armchair.h */; settings = {ATTRIBUTES = (Public, ); }; }; E6D8B92D19C880A9001AD043 /* ArmchairTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E6D8B92C19C880A9001AD043 /* ArmchairTests.swift */; }; - F8111E3919A95C8B0040E7D1 /* Armchair.h in Headers */ = {isa = PBXBuildFile; fileRef = F8111E3819A95C8B0040E7D1 /* Armchair.h */; settings = {ATTRIBUTES = (Public, ); }; }; F897FF4119AA800700AB5182 /* Armchair.swift in Sources */ = {isa = PBXBuildFile; fileRef = F897FF4019AA800700AB5182 /* Armchair.swift */; }; /* End PBXBuildFile section */ @@ -108,25 +106,6 @@ }; /* End PBXGroup section */ -/* Begin PBXHeadersBuildPhase section */ - E6D8B8F319C756A4001AD043 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - E6D8B8F419C756A4001AD043 /* Armchair.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - F8111E3019A95C8B0040E7D1 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - F8111E3919A95C8B0040E7D1 /* Armchair.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - /* Begin PBXNativeTarget section */ E6D8B8EF19C756A4001AD043 /* ArmchairMac */ = { isa = PBXNativeTarget; @@ -134,7 +113,6 @@ buildPhases = ( E6D8B8F019C756A4001AD043 /* Sources */, E6D8B8F219C756A4001AD043 /* Frameworks */, - E6D8B8F319C756A4001AD043 /* Headers */, E6D8B8F519C756A4001AD043 /* Resources */, ); buildRules = ( @@ -170,7 +148,6 @@ buildPhases = ( F8111E2E19A95C8B0040E7D1 /* Sources */, F8111E2F19A95C8B0040E7D1 /* Frameworks */, - F8111E3019A95C8B0040E7D1 /* Headers */, F8111E3119A95C8B0040E7D1 /* Resources */, ); buildRules = ( diff --git a/Example/AppDelegate.h b/Example/AppDelegate.h deleted file mode 100644 index 36d79f2..0000000 --- a/Example/AppDelegate.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// AppDelegate.h -// Mac Example -// -// Created by Matt Coneybeare on 9/15/14. -// Copyright (c) 2014 Armchair. All rights reserved. -// - -#import - -@interface AppDelegate : NSObject - - -@end - diff --git a/Example/AppDelegate.m b/Example/AppDelegate.m deleted file mode 100644 index a51fcb7..0000000 --- a/Example/AppDelegate.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// AppDelegate.m -// Mac Example -// -// Created by Matt Coneybeare on 9/15/14. -// Copyright (c) 2014 Armchair. All rights reserved. -// - -#import "AppDelegate.h" - -@import Armchair; - -//#import "Armchair-Bridging-Header.h" - -@interface AppDelegate () - -@property (weak) IBOutlet NSWindow *window; - -@end - -@implementation AppDelegate - -- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { - // Insert code here to initialize your application -} - -- (void)applicationWillTerminate:(NSNotification *)aNotification { - // Insert code here to tear down your application -} - -@end diff --git a/Example/AppDelegate.swift b/Example/AppDelegate.swift index 9a8c8d2..34ee2e0 100644 --- a/Example/AppDelegate.swift +++ b/Example/AppDelegate.swift @@ -20,13 +20,39 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -import UIKit +#if os(iOS) + + import UIKit + + @UIApplicationMain + class AppDelegate: UIResponder, UIApplicationDelegate { + var window: UIWindow? + + func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { + return true + } + } + + let iPhoto = "497786065" // iPhoto iOS + +#elseif os(OSX) + + import Cocoa + + @NSApplicationMain + class AppDelegate: NSObject, NSApplicationDelegate { + @IBOutlet weak var window: NSWindow! + + } + + let iPhoto = "408981381" // iPhoto Mac + +#else +#endif + import Armchair -@UIApplicationMain -class AppDelegate: UIResponder, UIApplicationDelegate { - - // MARK: - UIApplicationDelegate +extension AppDelegate { override class func initialize() { AppDelegate.setupArmchair() @@ -36,23 +62,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Normally, all the setup would be here. // But, because we are presenting a few different setups in the example, // The config will be in the view controllers - // Armchair.appID("364709193") // iBooks + // Armchair.appID("408981381") // iPhoto // // It is always best to load Armchair as early as possible // because it needs to receive application life-cycle notifications // // NOTE: The appID call always has to go before any other Armchair calls - Armchair.appID("364709193") + Armchair.appID(iPhoto) Armchair.debugEnabled(true) } - - var window: UIWindow? - - // MARK: - UIApplicationDelegate - - func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { - return true - } - } + diff --git a/Example/Base.lproj/Main.storyboard b/Example/Base.lproj/Main.storyboard index ba0f08d..13f6a8e 100644 --- a/Example/Base.lproj/Main.storyboard +++ b/Example/Base.lproj/Main.storyboard @@ -1,8 +1,8 @@ - + - - + + @@ -89,9 +89,24 @@ + + + @@ -131,6 +146,7 @@ + diff --git a/Example/Base.lproj/MainMenu.xib b/Example/Base.lproj/MainMenu.xib index 26e19a9..7909c1b 100644 --- a/Example/Base.lproj/MainMenu.xib +++ b/Example/Base.lproj/MainMenu.xib @@ -1,7 +1,6 @@ - + - @@ -12,7 +11,12 @@ - + + + + + + @@ -663,41 +667,43 @@ - - - - - + + + + + - + - - + + + + - + - + - + - + - + - - - - - - - - - - - + + + + + + + + - - - - - - + + + + + + + + - - + + diff --git a/Example/ViewController.swift b/Example/ViewController.swift index eea6fc6..cd70e3c 100644 --- a/Example/ViewController.swift +++ b/Example/ViewController.swift @@ -20,16 +20,24 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. +#if os(iOS) import UIKit +class ViewController: UIViewController { } +#elseif os(OSX) +import Cocoa +class ViewController: NSViewController { } +#else +#endif + import Armchair -class ViewController: UIViewController { +extension ViewController { @IBAction func presentStandardPrompt(AnyObject) { resetAppReviewManager() // The AppID is the only required setup - Armchair.appID("364709193") // iBooks + Armchair.appID(iPhoto) // Debug means that it will popup on the next available change Armchair.debugEnabled(true) @@ -42,7 +50,7 @@ class ViewController: UIViewController { resetAppReviewManager() // The AppID is the only required setup - Armchair.appID("364709193") // iBooks + Armchair.appID(iPhoto) // Debug means that it will popup on the next available change Armchair.debugEnabled(true) @@ -95,9 +103,10 @@ class ViewController: UIViewController { Armchair.onDidDisplayAlert() { println("[Example App] We just displayed the rating prompt") } Armchair.onDidOptToRate() { println("[Example App] The user just opted to rate") } Armchair.onDidOptToRemindLater({ println("[Example App] The user just opted to remind later") }) +#if os(iOS) Armchair.onWillPresentModalView({ println("[Example App] About to present the modal view. Animated: \($0)") }) Armchair.onDidDismissModalView({ println("[Example App] Just dismissed the modal view. Animated: \($0)") }) - +#endif // Armchair has sensible defaults for the NSUserDefault keys it uses, but you can customize that here Armchair.setKey("kSettingsSignificantEventTally", ArmchairKey.SignificantEventCount) @@ -124,12 +133,13 @@ class ViewController: UIViewController { return true }) } - + +#if os(iOS) @IBAction func presentStoreKitPrompt(AnyObject) { resetAppReviewManager() // The AppID is the only required setup - Armchair.appID("364709193") // iBooks + Armchair.appID(iPhoto) // Debug means that it will popup on the next available change Armchair.debugEnabled(true) @@ -145,8 +155,19 @@ class ViewController: UIViewController { // true here means it is ok to show, but it doesn't matter because we have debug on. Armchair.userDidSignificantEvent(true) } - +#endif + func resetAppReviewManager() { Armchair.resetDefaults() } + + @IBAction func openUrbanApps(AnyObject) { + let url = NSURL(string: "http://urbanapps.com") +#if os(iOS) + UIApplication.sharedApplication().openURL(url!) +#elseif os(OSX) + NSWorkspace.sharedWorkspace().openURL(url) +#else +#endif + } } diff --git a/Example/logo.png b/Example/logo.png new file mode 100644 index 0000000..9457397 Binary files /dev/null and b/Example/logo.png differ diff --git a/Mac Example.xcodeproj/project.pbxproj b/Mac Example.xcodeproj/project.pbxproj index f8aef92..3201cf2 100644 --- a/Mac Example.xcodeproj/project.pbxproj +++ b/Mac Example.xcodeproj/project.pbxproj @@ -7,156 +7,151 @@ objects = { /* Begin PBXBuildFile section */ - E671B64619C8D6CB00851BFD /* Armchair.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */; }; - E6BB678A19C8D1720031C112 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = E6BB678119C8D1720031C112 /* AppDelegate.m */; }; - E6BB678C19C8D1720031C112 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E6BB678519C8D1720031C112 /* MainMenu.xib */; }; - E6BB678F19C8D1720031C112 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = E6BB678919C8D1720031C112 /* main.m */; }; - E6E5F4C519C8E1A4008A6C1B /* armchair.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */; }; + E60FA7C019C908FE00179D70 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E60FA7BF19C908FE00179D70 /* AppDelegate.swift */; }; + E60FA7F119C90C7D00179D70 /* armchair.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E60FA7E819C90C7D00179D70 /* armchair.jpg */; }; + E60FA7F419C90C7D00179D70 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E60FA7EE19C90C7D00179D70 /* Icon.png */; }; + E60FA7F519C90C7D00179D70 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E60FA7EF19C90C7D00179D70 /* Images.xcassets */; }; + E60FA80519C90D8F00179D70 /* Armchair.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E60FA80019C90D3500179D70 /* Armchair.framework */; }; + E60FA80A19C9123800179D70 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E60FA80919C9123800179D70 /* ViewController.swift */; }; + E60FA81319C9172A00179D70 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = E60FA81119C9172A00179D70 /* MainMenu.xib */; }; + E60FA81619C91FA300179D70 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = E60FA81519C91FA300179D70 /* logo.png */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ - E6631F6B19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + E60FA7FD19C90D3500179D70 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; proxyType = 2; remoteGlobalIDString = E6D8B8B519C7274F001AD043; remoteInfo = Armchair; }; - E6631F6D19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + E60FA7FF19C90D3500179D70 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; proxyType = 2; remoteGlobalIDString = E6D8B8F919C756A4001AD043; remoteInfo = ArmchairMac; }; - E6631F6F19C8CA5C00F5F4EA /* PBXContainerItemProxy */ = { + E60FA80119C90D3500179D70 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; proxyType = 2; remoteGlobalIDString = E6D8B92819C880A9001AD043; remoteInfo = ArmchairTests; }; - E6E5F4BC19C8DFA3008A6C1B /* PBXContainerItemProxy */ = { + E60FA80319C90D7100179D70 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; - containerPortal = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + containerPortal = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; proxyType = 1; remoteGlobalIDString = E6D8B8EF19C756A4001AD043; remoteInfo = ArmchairMac; }; /* End PBXContainerItemProxy section */ -/* Begin PBXCopyFilesBuildPhase section */ - E6631F7319C8CAF200F5F4EA /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 7; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - /* Begin PBXFileReference section */ - E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Armchair.xcodeproj; sourceTree = ""; }; - E6BB678019C8D1720031C112 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = Example/AppDelegate.h; sourceTree = ""; }; - E6BB678119C8D1720031C112 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = Example/AppDelegate.m; sourceTree = ""; }; - E6BB678619C8D1720031C112 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = MainMenu.xib; sourceTree = ""; }; - E6BB678819C8D1720031C112 /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Info-Mac.plist"; path = "Example/Info-Mac.plist"; sourceTree = ""; }; - E6BB678919C8D1720031C112 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Example/main.m; sourceTree = ""; }; - E6D8B8C719C75292001AD043 /* Mac Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mac Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; - E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = armchair.jpg; path = Example/armchair.jpg; sourceTree = ""; }; + E60FA7BA19C908FE00179D70 /* Mac Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Mac Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + E60FA7BF19C908FE00179D70 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Example/AppDelegate.swift; sourceTree = ""; }; + E60FA7E819C90C7D00179D70 /* armchair.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; name = armchair.jpg; path = Example/armchair.jpg; sourceTree = SOURCE_ROOT; }; + E60FA7EE19C90C7D00179D70 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Icon.png; path = Example/Icon.png; sourceTree = SOURCE_ROOT; }; + E60FA7EF19C90C7D00179D70 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = Example/Images.xcassets; sourceTree = SOURCE_ROOT; }; + E60FA7F019C90C7D00179D70 /* Info-Mac.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "Info-Mac.plist"; path = "Example/Info-Mac.plist"; sourceTree = SOURCE_ROOT; }; + E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = Armchair.xcodeproj; sourceTree = ""; }; + E60FA80919C9123800179D70 /* ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ViewController.swift; path = Example/ViewController.swift; sourceTree = ""; }; + E60FA81219C9172A00179D70 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Example/Base.lproj/MainMenu.xib; sourceTree = SOURCE_ROOT; }; + E60FA81519C91FA300179D70 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = logo.png; path = Example/logo.png; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ - E6D8B8C419C75292001AD043 /* Frameworks */ = { + E60FA7B719C908FE00179D70 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - E671B64619C8D6CB00851BFD /* Armchair.framework in Frameworks */, + E60FA80519C90D8F00179D70 /* Armchair.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - E6631F6619C8CA5C00F5F4EA /* Products */ = { + E60FA7B119C908FE00179D70 = { isa = PBXGroup; children = ( - E6631F6C19C8CA5C00F5F4EA /* Armchair.framework */, - E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */, - E6631F7019C8CA5C00F5F4EA /* ArmchairTests.xctest */, + E60FA7E319C909D100179D70 /* Source */, + E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */, + E60FA7BA19C908FE00179D70 /* Mac Example.app */, ); - name = Products; sourceTree = ""; }; - E6BB679019C8D1800031C112 /* Source */ = { + E60FA7BC19C908FE00179D70 /* Supporting Files */ = { isa = PBXGroup; children = ( - E6BB678019C8D1720031C112 /* AppDelegate.h */, - E6BB678119C8D1720031C112 /* AppDelegate.m */, - E6BB678519C8D1720031C112 /* MainMenu.xib */, - E6BB679119C8D1AB0031C112 /* Supporting Files */, + E60FA81119C9172A00179D70 /* MainMenu.xib */, + E60FA7E819C90C7D00179D70 /* armchair.jpg */, + E60FA7EE19C90C7D00179D70 /* Icon.png */, + E60FA81519C91FA300179D70 /* logo.png */, + E60FA7EF19C90C7D00179D70 /* Images.xcassets */, + E60FA7F019C90C7D00179D70 /* Info-Mac.plist */, + ); + name = "Supporting Files"; + path = "Mac Example"; + sourceTree = ""; + }; + E60FA7E319C909D100179D70 /* Source */ = { + isa = PBXGroup; + children = ( + E60FA7BF19C908FE00179D70 /* AppDelegate.swift */, + E60FA80919C9123800179D70 /* ViewController.swift */, + E60FA7BC19C908FE00179D70 /* Supporting Files */, ); name = Source; sourceTree = ""; }; - E6BB679119C8D1AB0031C112 /* Supporting Files */ = { + E60FA7F819C90D3500179D70 /* Products */ = { isa = PBXGroup; children = ( - E6E5F4C419C8E1A4008A6C1B /* armchair.jpg */, - E6BB678819C8D1720031C112 /* Info-Mac.plist */, - E6BB678919C8D1720031C112 /* main.m */, - ); - name = "Supporting Files"; - sourceTree = ""; - }; - E6D8B8BE19C75292001AD043 = { - isa = PBXGroup; - children = ( - E6BB679019C8D1800031C112 /* Source */, - E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */, - E6D8B8C719C75292001AD043 /* Mac Example.app */, + E60FA7FE19C90D3500179D70 /* Armchair.framework */, + E60FA80019C90D3500179D70 /* Armchair.framework */, + E60FA80219C90D3500179D70 /* ArmchairTests.xctest */, ); + name = Products; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - E6D8B8C619C75292001AD043 /* Mac Example */ = { + E60FA7B919C908FE00179D70 /* Mac Example */ = { isa = PBXNativeTarget; - buildConfigurationList = E6D8B8E419C75292001AD043 /* Build configuration list for PBXNativeTarget "Mac Example" */; + buildConfigurationList = E60FA7D419C908FE00179D70 /* Build configuration list for PBXNativeTarget "Mac Example" */; buildPhases = ( - E6D8B8C319C75292001AD043 /* Sources */, - E6D8B8C419C75292001AD043 /* Frameworks */, - E6D8B8C519C75292001AD043 /* Resources */, - E6631F7319C8CAF200F5F4EA /* CopyFiles */, + E60FA7B619C908FE00179D70 /* Sources */, + E60FA7B719C908FE00179D70 /* Frameworks */, + E60FA7B819C908FE00179D70 /* Resources */, ); buildRules = ( ); dependencies = ( - E6E5F4BD19C8DFA3008A6C1B /* PBXTargetDependency */, + E60FA80419C90D7100179D70 /* PBXTargetDependency */, ); name = "Mac Example"; productName = "Mac Example"; - productReference = E6D8B8C719C75292001AD043 /* Mac Example.app */; + productReference = E60FA7BA19C908FE00179D70 /* Mac Example.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ - E6D8B8BF19C75292001AD043 /* Project object */ = { + E60FA7B219C908FE00179D70 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0600; + LastUpgradeCheck = 0610; ORGANIZATIONNAME = Armchair; TargetAttributes = { - E6D8B8C619C75292001AD043 = { - CreatedOnToolsVersion = 6.0; + E60FA7B919C908FE00179D70 = { + CreatedOnToolsVersion = 6.1; }; }; }; - buildConfigurationList = E6D8B8C219C75292001AD043 /* Build configuration list for PBXProject "Mac Example" */; + buildConfigurationList = E60FA7B519C908FE00179D70 /* Build configuration list for PBXProject "Mac Example" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; @@ -164,92 +159,94 @@ en, Base, ); - mainGroup = E6D8B8BE19C75292001AD043; - productRefGroup = E6D8B8BE19C75292001AD043; + mainGroup = E60FA7B119C908FE00179D70; + productRefGroup = E60FA7B119C908FE00179D70; projectDirPath = ""; projectReferences = ( { - ProductGroup = E6631F6619C8CA5C00F5F4EA /* Products */; - ProjectRef = E6631F6519C8CA5C00F5F4EA /* Armchair.xcodeproj */; + ProductGroup = E60FA7F819C90D3500179D70 /* Products */; + ProjectRef = E60FA7F719C90D3500179D70 /* Armchair.xcodeproj */; }, ); projectRoot = ""; targets = ( - E6D8B8C619C75292001AD043 /* Mac Example */, + E60FA7B919C908FE00179D70 /* Mac Example */, ); }; /* End PBXProject section */ /* Begin PBXReferenceProxy section */ - E6631F6C19C8CA5C00F5F4EA /* Armchair.framework */ = { + E60FA7FE19C90D3500179D70 /* Armchair.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = Armchair.framework; - remoteRef = E6631F6B19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + remoteRef = E60FA7FD19C90D3500179D70 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - E6631F6E19C8CA5C00F5F4EA /* Armchair.framework */ = { + E60FA80019C90D3500179D70 /* Armchair.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; path = Armchair.framework; - remoteRef = E6631F6D19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + remoteRef = E60FA7FF19C90D3500179D70 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; - E6631F7019C8CA5C00F5F4EA /* ArmchairTests.xctest */ = { + E60FA80219C90D3500179D70 /* ArmchairTests.xctest */ = { isa = PBXReferenceProxy; fileType = wrapper.cfbundle; path = ArmchairTests.xctest; - remoteRef = E6631F6F19C8CA5C00F5F4EA /* PBXContainerItemProxy */; + remoteRef = E60FA80119C90D3500179D70 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ - E6D8B8C519C75292001AD043 /* Resources */ = { + E60FA7B819C908FE00179D70 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - E6E5F4C519C8E1A4008A6C1B /* armchair.jpg in Resources */, - E6BB678C19C8D1720031C112 /* MainMenu.xib in Resources */, + E60FA7F419C90C7D00179D70 /* Icon.png in Resources */, + E60FA81619C91FA300179D70 /* logo.png in Resources */, + E60FA81319C9172A00179D70 /* MainMenu.xib in Resources */, + E60FA7F519C90C7D00179D70 /* Images.xcassets in Resources */, + E60FA7F119C90C7D00179D70 /* armchair.jpg in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ - E6D8B8C319C75292001AD043 /* Sources */ = { + E60FA7B619C908FE00179D70 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - E6BB678F19C8D1720031C112 /* main.m in Sources */, - E6BB678A19C8D1720031C112 /* AppDelegate.m in Sources */, + E60FA80A19C9123800179D70 /* ViewController.swift in Sources */, + E60FA7C019C908FE00179D70 /* AppDelegate.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ - E6E5F4BD19C8DFA3008A6C1B /* PBXTargetDependency */ = { + E60FA80419C90D7100179D70 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = ArmchairMac; - targetProxy = E6E5F4BC19C8DFA3008A6C1B /* PBXContainerItemProxy */; + targetProxy = E60FA80319C90D7100179D70 /* PBXContainerItemProxy */; }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - E6BB678519C8D1720031C112 /* MainMenu.xib */ = { + E60FA81119C9172A00179D70 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - E6BB678619C8D1720031C112 /* Base */, + E60FA81219C9172A00179D70 /* Base */, ); name = MainMenu.xib; - path = Example/Base.lproj; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ - E6D8B8E219C75292001AD043 /* Debug */ = { + E60FA7D219C908FE00179D70 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -283,14 +280,15 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; - E6D8B8E319C75292001AD043 /* Release */ = { + E60FA7D319C908FE00179D70 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; @@ -319,40 +317,30 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.9; + MACOSX_DEPLOYMENT_TARGET = 10.10; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = macosx; }; name = Release; }; - E6D8B8E519C75292001AD043 /* Debug */ = { + E60FA7D519C908FE00179D70 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/build/Debug", - ); - INFOPLIST_FILE = "$(SRCROOT)/Example/Info-Mac.plist"; + INFOPLIST_FILE = "Example/Info-Mac.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Debug; }; - E6D8B8E619C75292001AD043 /* Release */ = { + E60FA7D619C908FE00179D70 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; COMBINE_HIDPI_IMAGES = YES; - EMBEDDED_CONTENT_CONTAINS_SWIFT = NO; - FRAMEWORK_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/build/Debug", - ); - INFOPLIST_FILE = "$(SRCROOT)/Example/Info-Mac.plist"; + INFOPLIST_FILE = "Example/Info-Mac.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.9; PRODUCT_NAME = "$(TARGET_NAME)"; }; name = Release; @@ -360,25 +348,25 @@ /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ - E6D8B8C219C75292001AD043 /* Build configuration list for PBXProject "Mac Example" */ = { + E60FA7B519C908FE00179D70 /* Build configuration list for PBXProject "Mac Example" */ = { isa = XCConfigurationList; buildConfigurations = ( - E6D8B8E219C75292001AD043 /* Debug */, - E6D8B8E319C75292001AD043 /* Release */, + E60FA7D219C908FE00179D70 /* Debug */, + E60FA7D319C908FE00179D70 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E6D8B8E419C75292001AD043 /* Build configuration list for PBXNativeTarget "Mac Example" */ = { + E60FA7D419C908FE00179D70 /* Build configuration list for PBXNativeTarget "Mac Example" */ = { isa = XCConfigurationList; buildConfigurations = ( - E6D8B8E519C75292001AD043 /* Debug */, - E6D8B8E619C75292001AD043 /* Release */, + E60FA7D519C908FE00179D70 /* Debug */, + E60FA7D619C908FE00179D70 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; - rootObject = E6D8B8BF19C75292001AD043 /* Project object */; + rootObject = E60FA7B219C908FE00179D70 /* Project object */; } diff --git a/Mac Example.xcodeproj/project.xcworkspace/xcshareddata/Mac Example.xccheckout b/Mac Example.xcodeproj/project.xcworkspace/xcshareddata/Mac Example.xccheckout deleted file mode 100644 index 3776d61..0000000 --- a/Mac Example.xcodeproj/project.xcworkspace/xcshareddata/Mac Example.xccheckout +++ /dev/null @@ -1,41 +0,0 @@ - - - - - IDESourceControlProjectFavoriteDictionaryKey - - IDESourceControlProjectIdentifier - FB71943B-E489-41AE-8AD8-62BD5AFECCF8 - IDESourceControlProjectName - Mac Example - IDESourceControlProjectOriginsDictionary - - 6094D9F4198D56F78EB1B455EC894F8A44DC0039 - github.com:UrbanApps/Armchair.git - - IDESourceControlProjectPath - Mac Example/Mac Example.xcodeproj - IDESourceControlProjectRelativeInstallPathDictionary - - 6094D9F4198D56F78EB1B455EC894F8A44DC0039 - ../../.. - - IDESourceControlProjectURL - github.com:UrbanApps/Armchair.git - IDESourceControlProjectVersion - 111 - IDESourceControlProjectWCCIdentifier - 6094D9F4198D56F78EB1B455EC894F8A44DC0039 - IDESourceControlProjectWCConfigurations - - - IDESourceControlRepositoryExtensionIdentifierKey - public.vcs.git - IDESourceControlWCCIdentifierKey - 6094D9F4198D56F78EB1B455EC894F8A44DC0039 - IDESourceControlWCCName - Armchair - - - - diff --git a/Mac Example.xcodeproj/project.xcworkspace/xcuserdata/coneybeare.xcuserdatad/UserInterfaceState.xcuserstate b/Mac Example.xcodeproj/project.xcworkspace/xcuserdata/coneybeare.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 1f0352a..0000000 Binary files a/Mac Example.xcodeproj/project.xcworkspace/xcuserdata/coneybeare.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme b/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme deleted file mode 100644 index ce14201..0000000 --- a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/Mac Example.xcscheme +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/xcschememanagement.plist b/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index c991ae2..0000000 --- a/Mac Example.xcodeproj/xcuserdata/coneybeare.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,27 +0,0 @@ - - - - - SchemeUserState - - Mac Example.xcscheme - - orderHint - 1 - - - SuppressBuildableAutocreation - - E6D8B8C619C75292001AD043 - - primary - - - E6D8B8D919C75292001AD043 - - primary - - - - - diff --git a/Source/Armchair.swift b/Source/Armchair.swift index f93e83f..4d27ab2 100644 --- a/Source/Armchair.swift +++ b/Source/Armchair.swift @@ -621,12 +621,7 @@ public enum ArmchairKey: String, Printable { public var description : String { get { -#if os(iOS) - return self.toRaw() -#elseif os(OSX) return self.rawValue -#else -#endif } } } @@ -778,7 +773,13 @@ public class Manager : ArmchairManager { private var tracksNewVersions: Bool = true private var shouldPromptIfRated: Bool = true private var useMainAppBundleForLocalizations: Bool = false - private var debugEnabled: Bool = false + private var debugEnabled: Bool = false { + didSet { + if self.debugEnabled { + debugLog("Debug enabled for app: \(appID)") + } + } + } // If you aren't going to set an affiliate code yourself, please leave this as is. // It is my affiliate code. It is better that somebody's code is used rather than nobody's. @@ -1169,12 +1170,17 @@ public class Manager : ArmchairManager { alert.messageText = reviewTitle alert.informativeText = reviewMessage alert.addButtonWithTitle(rateButtonTitle) - alert.addButtonWithTitle(remindButtonTitle) + if showsRemindButton() { + alert.addButtonWithTitle(remindButtonTitle) + } alert.addButtonWithTitle(cancelButtonTitle) ratingAlert = alert if let window = NSApplication.sharedApplication().keyWindow { - alert.beginSheetModalForWindow(window, modalDelegate: self, didEndSelector: "alertDidEnd:returnCode:", contextInfo: nil) + alert.beginSheetModalForWindow(window) { + (response: NSModalResponse) in + self.handleNSAlertReturnCode(response) + } } else { var returnCode = alert.runModal() handleNSAlertReturnCode(returnCode) @@ -1235,24 +1241,24 @@ public class Manager : ArmchairManager { private func handleNSAlertReturnCode(returnCode: NSInteger) { switch (returnCode) { - case NSAlertAlternateReturn: - // they don't want to rate it - dontRate() - case NSAlertDefaultReturn: + case NSAlertFirstButtonReturn: // they want to rate it _rateApp() - case NSAlertOtherReturn: - // remind them later - remindMeLater() + case NSAlertSecondButtonReturn: + // remind them later or cancel + if showsRemindButton() { + remindMeLater() + } else { + dontRate() + } + case NSAlertThirdButtonReturn: + // they don't want to rate it + dontRate() default: return } } - private func alertDidEnd(alert: NSAlert, returnCode: NSInteger) { - handleNSAlertReturnCode(returnCode) - } - #else #endif @@ -1324,7 +1330,7 @@ public class Manager : ArmchairManager { //Use the standard openUrl method } else { let url = NSURL(string: reviewURLString()) - UIApplication.sharedApplication().openURL(url) + UIApplication.sharedApplication().openURL(url!) } if UIDevice.currentDevice().model.rangeOfString("Simulator") != nil { @@ -1335,7 +1341,11 @@ public class Manager : ArmchairManager { debugLog(" - Or try copy/pasting \(fakeURL) into a browser on your computer.") } #elseif os(OSX) - NSWorkspace.sharedWorkspace().openURL(NSURL(string: reviewURLString())) + var url = NSURL(string: reviewURLString()) + var opened = NSWorkspace.sharedWorkspace().openURL(url) + if !opened { + debugLog("Failed to open \(url)") + } #else #endif } @@ -1617,7 +1627,10 @@ public class Manager : ArmchairManager { alert.dismissWithClickedButtonIndex(alert.cancelButtonIndex, animated: false) } #elseif os(OSX) - NSApp.endSheet(NSApplication.sharedApplication().keyWindow) + if let window = NSApplication.sharedApplication().keyWindow { + NSApp.endSheet(window) + } + #else #endif ratingAlert = nil diff --git a/assets/armchair.png b/assets/armchair.png new file mode 100644 index 0000000..1f42470 Binary files /dev/null and b/assets/armchair.png differ diff --git a/iOS Example.xcodeproj/project.pbxproj b/iOS Example.xcodeproj/project.pbxproj index 9ecf4d2..de50f3d 100644 --- a/iOS Example.xcodeproj/project.pbxproj +++ b/iOS Example.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + E60FA81819C9219600179D70 /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = E60FA81719C9219600179D70 /* logo.png */; }; E6D8B8EC19C75559001AD043 /* Armchair.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E6D8B8BB19C7382B001AD043 /* Armchair.framework */; }; E6E5F4C319C8E18E008A6C1B /* armchair.jpg in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4C219C8E18E008A6C1B /* armchair.jpg */; }; E6E5F4CD19C8E388008A6C1B /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = E6E5F4CC19C8E388008A6C1B /* Icon.png */; }; @@ -61,6 +62,7 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ + E60FA81719C9219600179D70 /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; E6C49DC519C23C91006A4544 /* iOS Example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "iOS Example.app"; sourceTree = BUILT_PRODUCTS_DIR; }; E6E5F4C219C8E18E008A6C1B /* armchair.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = armchair.jpg; sourceTree = ""; }; E6E5F4CC19C8E388008A6C1B /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = ""; }; @@ -121,6 +123,7 @@ E6E5F4CE19C8E3C6008A6C1B /* Images.xcassets */, E6E5F4CC19C8E388008A6C1B /* Icon.png */, E6E5F4C219C8E18E008A6C1B /* armchair.jpg */, + E60FA81719C9219600179D70 /* logo.png */, F8111E0919A951050040E7D1 /* Info-iOS.plist */, ); name = "Supporting Files"; @@ -216,6 +219,7 @@ buildActionMask = 2147483647; files = ( E6E5F4C319C8E18E008A6C1B /* armchair.jpg in Resources */, + E60FA81819C9219600179D70 /* logo.png in Resources */, E6E5F4CF19C8E3C6008A6C1B /* Images.xcassets in Resources */, F8111E1219A951050040E7D1 /* Main.storyboard in Resources */, E6E5F4CD19C8E388008A6C1B /* Icon.png in Resources */, @@ -341,6 +345,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; GCC_PREPROCESSOR_DEFINITIONS = "$(inherited)"; INFOPLIST_FILE = "$(SRCROOT)/Example/Info-iOS.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; @@ -356,6 +361,7 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CODE_SIGN_IDENTITY = "iPhone Developer"; + EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; INFOPLIST_FILE = "$(SRCROOT)/Example/Info-iOS.plist"; IPHONEOS_DEPLOYMENT_TARGET = 7.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";