mirror of
https://github.com/UrbanApps/Armchair.git
synced 2026-04-24 09:48:36 +02:00
fix swift 3 compile issue for mac os
This commit is contained in:
1
.swift-version
Normal file
1
.swift-version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
3.0
|
||||||
@@ -538,6 +538,7 @@
|
|||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@@ -562,6 +563,7 @@
|
|||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SKIP_INSTALL = YES;
|
SKIP_INSTALL = YES;
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "";
|
SWIFT_OBJC_BRIDGING_HEADER = "";
|
||||||
|
SWIFT_VERSION = 3.0;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -724,7 +724,7 @@ public struct AppiraterKey {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
open class ArmchairManager : NSObject, UIAlertViewDelegate, SKStoreProductViewControllerDelegate { }
|
open class ArmchairManager : NSObject, UIAlertViewDelegate, SKStoreProductViewControllerDelegate { }
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
public class ArmchairManager : NSObject, NSAlertDelegate { }
|
open class ArmchairManager : NSObject, NSAlertDelegate { }
|
||||||
#else
|
#else
|
||||||
// Untested, and currently unsupported
|
// Untested, and currently unsupported
|
||||||
#endif
|
#endif
|
||||||
@@ -734,7 +734,7 @@ open class Manager : ArmchairManager {
|
|||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
fileprivate var operatingSystemVersion = NSString(string: UIDevice.current.systemVersion).doubleValue
|
fileprivate var operatingSystemVersion = NSString(string: UIDevice.current.systemVersion).doubleValue
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
private var operatingSystemVersion = Double(NSProcessInfo.processInfo().operatingSystemVersion.majorVersion)
|
private var operatingSystemVersion = Double(ProcessInfo.processInfo.operatingSystemVersion.majorVersion)
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1239,21 +1239,21 @@ open class Manager : ArmchairManager {
|
|||||||
let alert: NSAlert = NSAlert()
|
let alert: NSAlert = NSAlert()
|
||||||
alert.messageText = reviewTitle
|
alert.messageText = reviewTitle
|
||||||
alert.informativeText = reviewMessage
|
alert.informativeText = reviewMessage
|
||||||
alert.addButtonWithTitle(rateButtonTitle)
|
alert.addButton(withTitle: rateButtonTitle)
|
||||||
if showsRemindButton() {
|
if showsRemindButton() {
|
||||||
alert.addButtonWithTitle(remindButtonTitle!)
|
alert.addButton(withTitle: remindButtonTitle!)
|
||||||
}
|
}
|
||||||
alert.addButtonWithTitle(cancelButtonTitle)
|
alert.addButton(withTitle: cancelButtonTitle)
|
||||||
ratingAlert = alert
|
ratingAlert = alert
|
||||||
|
|
||||||
if let window = NSApplication.sharedApplication().keyWindow {
|
if let window = NSApplication.shared().keyWindow {
|
||||||
alert.beginSheetModalForWindow(window) {
|
alert.beginSheetModal(for: window) {
|
||||||
(response: NSModalResponse) in
|
(response: NSModalResponse) in
|
||||||
self.handleNSAlertReturnCode(response)
|
self.handleNSAlert(returnCode: response)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let returnCode = alert.runModal()
|
let returnCode = alert.runModal()
|
||||||
handleNSAlertReturnCode(returnCode)
|
handleNSAlert(returnCode:returnCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let closure = self.didDisplayAlertClosure {
|
if let closure = self.didDisplayAlertClosure {
|
||||||
@@ -1309,7 +1309,7 @@ open class Manager : ArmchairManager {
|
|||||||
|
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
|
|
||||||
private func handleNSAlertReturnCode(returnCode: NSInteger) {
|
private func handleNSAlert(returnCode: NSInteger) {
|
||||||
switch (returnCode) {
|
switch (returnCode) {
|
||||||
case NSAlertFirstButtonReturn:
|
case NSAlertFirstButtonReturn:
|
||||||
// they want to rate it
|
// they want to rate it
|
||||||
@@ -1407,8 +1407,8 @@ open class Manager : ArmchairManager {
|
|||||||
debugLog(" - Or try copy/pasting \(fakeURL) into a browser on your computer.")
|
debugLog(" - Or try copy/pasting \(fakeURL) into a browser on your computer.")
|
||||||
}
|
}
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
if let url = NSURL(string: reviewURLString()) {
|
if let url = URL(string: reviewURLString()) {
|
||||||
let opened = NSWorkspace.sharedWorkspace().openURL(url)
|
let opened = NSWorkspace.shared().open(url)
|
||||||
if !opened {
|
if !opened {
|
||||||
debugLog("Failed to open \(url)")
|
debugLog("Failed to open \(url)")
|
||||||
}
|
}
|
||||||
@@ -1702,7 +1702,7 @@ open class Manager : ArmchairManager {
|
|||||||
alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false)
|
alert.dismiss(withClickedButtonIndex: alert.cancelButtonIndex, animated: false)
|
||||||
}
|
}
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
if let window = NSApplication.sharedApplication().keyWindow {
|
if let window = NSApplication.shared().keyWindow {
|
||||||
if let parent = window.sheetParent {
|
if let parent = window.sheetParent {
|
||||||
parent.endSheet(window)
|
parent.endSheet(window)
|
||||||
}
|
}
|
||||||
@@ -1769,9 +1769,9 @@ open class Manager : ArmchairManager {
|
|||||||
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidFinishLaunching(_:)), name: NSNotification.Name.UIApplicationDidFinishLaunching, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationDidFinishLaunching(_:)), name: NSNotification.Name.UIApplicationDidFinishLaunching, object: nil)
|
||||||
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(UIApplicationDelegate.applicationWillEnterForeground(_:)), name: NSNotification.Name.UIApplicationWillEnterForeground, object: nil)
|
||||||
#elseif os(OSX)
|
#elseif os(OSX)
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "appWillResignActive:", name: NSApplicationWillResignActiveNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(Manager.appWillResignActive(_:)), name: NSNotification.Name.NSApplicationWillResignActive, object: nil)
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "applicationDidFinishLaunching:", name: NSApplicationDidFinishLaunchingNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(NSApplicationDelegate.applicationDidFinishLaunching(_:)), name: NSNotification.Name.NSApplicationDidFinishLaunching, object: nil)
|
||||||
NSNotificationCenter.defaultCenter().addObserver(self, selector: "applicationWillEnterForeground:", name: NSApplicationWillBecomeActiveNotification, object: nil)
|
NotificationCenter.default.addObserver(self, selector: #selector(Manager.applicationWillEnterForeground(_:)), name: NSNotification.Name.NSApplicationWillBecomeActive, object: nil)
|
||||||
#else
|
#else
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user