Skip to content
Snippets Groups Projects
Unverified Commit dcd89c30 authored by Spotlight Deveaux's avatar Spotlight Deveaux :fox:
Browse files

Convert to Swift 4.2

parent 16d34ad4
No related branches found
No related tags found
No related merge requests found
......@@ -258,7 +258,8 @@
TargetAttributes = {
4279D57F1F4686AB00558889 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 2F5AW9EGL6;
DevelopmentTeam = NP873NYDVX;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
SystemCapabilities = {
com.apple.Sandbox = {
......@@ -269,12 +270,14 @@
4279D58E1F4686AE00558889 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 2F5AW9EGL6;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
TestTargetID = 4279D57F1F4686AB00558889;
};
4279D5991F4686AE00558889 = {
CreatedOnToolsVersion = 8.2.1;
DevelopmentTeam = 2F5AW9EGL6;
LastSwiftMigration = 1000;
ProvisioningStyle = Automatic;
TestTargetID = 4279D57F1F4686AB00558889;
};
......@@ -583,14 +586,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 2F5AW9EGL6;
DEVELOPMENT_TEAM = NP873NYDVX;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Screenshottr/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.Screenshottr;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
VALID_ARCHS = x86_64;
};
name = Debug;
......@@ -602,14 +606,15 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = 2F5AW9EGL6;
DEVELOPMENT_TEAM = NP873NYDVX;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
INFOPLIST_FILE = Screenshottr/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.Screenshottr;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
VALID_ARCHS = x86_64;
};
name = Release;
......@@ -626,7 +631,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.ScreenshottrTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Screenshottr.app/Contents/MacOS/Screenshottr";
};
name = Debug;
......@@ -643,7 +649,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.ScreenshottrTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/Screenshottr.app/Contents/MacOS/Screenshottr";
};
name = Release;
......@@ -659,7 +666,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.ScreenshottrUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = Screenshottr;
};
name = Debug;
......@@ -675,7 +683,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = io.github.spotlightishere.ScreenshottrUITests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.2;
TEST_TARGET_NAME = Screenshottr;
};
name = Release;
......
......@@ -12,10 +12,10 @@ import SKQueue
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
let statusItem = NSStatusBar.system().statusItem(withLength: NSVariableStatusItemLength)
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.variableLength)
let popover = NSPopover()
let viewController = PopoverMenu(nibName: "PopoverMenu",
bundle: Bundle.main)!
bundle: Bundle.main)
func applicationDidFinishLaunching(_ aNotification: Notification) {
statusItem.image = NSImage(named: "status_icon")
......@@ -29,11 +29,11 @@ class AppDelegate: NSObject, NSApplicationDelegate {
queue?.addPath(NSSearchPathForDirectoriesInDomains(.desktopDirectory, .userDomainMask, true)[0], notifyingAbout: .Write)
}
func quitApplication() {
NSApplication.shared().terminate(self)
@objc func quitApplication() {
NSApplication.shared.terminate(self)
}
func togglePopover(sender: AnyObject?) {
@objc func togglePopover(sender: AnyObject?) {
if popover.isShown {
closePopover(sender: sender)
} else {
......
......@@ -62,7 +62,7 @@ class GCPAuthHandler {
redirectHTTPHandler.currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, callback: {
(authState, redirectError) in
NSRunningApplication.current().activate(options: [.activateAllWindows, .activateIgnoringOtherApps])
NSRunningApplication.current.activate(options: [.activateAllWindows, .activateIgnoringOtherApps])
if (authState != nil) {
let gtmAuthorization = GTMAppAuthFetcherAuthorization.init(authState: authState!)
authorizedService.authorizer = gtmAuthorization
......
......@@ -20,7 +20,7 @@ class PomfManager {
NSLocalizedDescriptionKey : NSLocalizedString("Unsuccessful", value: "Go to Settings and enter a Pomf upload url.", comment: "") ,
NSLocalizedFailureReasonErrorKey : NSLocalizedString("Unsuccessful", value: "Go to Settings and enter a Pomf upload url.", comment: "")
]
completionHandler(NSError(domain: "pomf.error.ufukdup.yourcodesucks.nopermission.getatoken.slideinto.deans.dms", code: 666420, userInfo: userInfo), "https://google.com")
completionHandler(NSError(domain: "pomf.error.ufukdup.yourcodesucks.nopermission.getatoken.slideinto.deans.dms", code: 666420, userInfo: userInfo as? [String : Any]), "https://google.com")
return
}
......@@ -56,7 +56,7 @@ class PomfManager {
NSLocalizedFailureReasonErrorKey : NSLocalizedString("Unsuccessful", value: description, comment: "")
]
let errorCode : Int = parsedData["errorcode"] as! Int
completionHandler(NSError(domain: "PomfErrorDomain", code: errorCode, userInfo: userInfo), "https://google.com")
completionHandler(NSError(domain: "PomfErrorDomain", code: errorCode, userInfo: userInfo as? [String : Any]), "https://google.com")
return
}
......
......@@ -33,12 +33,12 @@ class PopoverMenu: NSViewController {
settingsMenu.addItem(quitItem)
}
func presentSettingsDialog(sender: Any) {
@objc func presentSettingsDialog(sender: Any) {
let mwc: SettingsView! = SettingsView(windowNibName: "SettingsView")
mwc.window!.orderFront(self)
}
func openDialog(sender: Any) {
@objc func openDialog(sender: Any) {
let dialog = NSOpenPanel();
dialog.title = "Choose a file to upload.";
......@@ -48,7 +48,7 @@ class PopoverMenu: NSViewController {
dialog.canCreateDirectories = false;
dialog.allowsMultipleSelection = false;
if (dialog.runModal() == NSModalResponseOK) {
if (dialog.runModal() == .OK) {
let result = dialog.url // Pathname of the file
if (result != nil) {
......@@ -62,7 +62,7 @@ class PopoverMenu: NSViewController {
}
@IBAction func toggleGearMenu(_ sender: Any) {
if let event = NSApplication.shared().currentEvent {
if let event = NSApplication.shared.currentEvent {
NSMenu.popUpContextMenu(settingsMenu, with: event, for: sender as! NSView)
}
}
......
......@@ -34,7 +34,7 @@ class UploadManager : NSObject {
do {
// Grab contents by predicate, convert to array, loop through array with paths
let allFiles = try fileManager.contentsOfDirectory(atPath: path)
let toSeach: [String] = (allFiles as NSArray).flatMap({ $0 as? String })
let toSeach: [String] = (allFiles as NSArray).compactMap({ $0 as? String })
var toUpload: [URL] = []
for fileName in toSeach {
......@@ -88,8 +88,8 @@ class UploadManager : NSObject {
self.showFailureNotification(errorText: error!.localizedDescription)
handler()
} else {
NSPasteboard.general().clearContents()
NSPasteboard.general().setString(url, forType: NSPasteboardTypeString)
NSPasteboard.general.clearContents()
NSPasteboard.general.setString(url, forType: .string)
print("File available at \(url)")
if (shouldDelete) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment