-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
2,727 additions
and
967 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
### Xcode.gitignore | ||
# Xcode | ||
# | ||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||
|
||
## Build generated | ||
build/ | ||
DerivedData/ | ||
|
||
## Various settings | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata/ | ||
|
||
## Other | ||
*.moved-aside | ||
*.xccheckout | ||
*.xcscmblueprint | ||
Carthage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.security.app-sandbox</key> | ||
<true/> | ||
<key>com.apple.security.device.usb</key> | ||
<true/> | ||
<key>com.apple.security.files.user-selected.read-only</key> | ||
<true/> | ||
<key>com.apple.security.network.client</key> | ||
<true/> | ||
<key>com.apple.security.personal-information.location</key> | ||
<true/> | ||
<key>com.apple.security.temporary-exception.sbpl</key> | ||
<array> | ||
<string>(allow iokit-open)</string> | ||
<string>(allow iokit-set-properties (iokit-property "ConsoleUID"))</string> | ||
<string>(allow mach-lookup (global-name "com.apple.AssetCacheLocatorService"))</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// | ||
// AppDelegate.swift | ||
// AdaptiveService | ||
// | ||
// Created by Alin on 03/12/2017. | ||
// Copyright © 2017 Alin. All rights reserved. | ||
// | ||
|
||
import Cocoa | ||
import SwiftyBeaver | ||
|
||
let log = SwiftyBeaver.self | ||
|
||
extension Notification.Name { | ||
static let killLauncher = Notification.Name("killLauncher") | ||
} | ||
|
||
@NSApplicationMain | ||
class AppDelegate: NSObject, NSApplicationDelegate { | ||
|
||
@objc func terminate() { | ||
NSApp.terminate(nil) | ||
} | ||
|
||
func applicationDidFinishLaunching(_ aNotification: Notification) { | ||
let console = ConsoleDestination() | ||
let file = FileDestination() | ||
|
||
log.addDestination(console) | ||
log.addDestination(file) | ||
|
||
let mainAppIdentifier = "com.alinp.AdaptiveService" | ||
let runningApps = NSWorkspace.shared.runningApplications | ||
let isRunning = (runningApps.first(where: { app in app.bundleIdentifier == mainAppIdentifier }) != nil) | ||
|
||
if !isRunning { | ||
DistributedNotificationCenter.default().addObserver( | ||
self, | ||
selector: #selector(self.terminate), | ||
name: .killLauncher, | ||
object: mainAppIdentifier) | ||
|
||
let path = Bundle.main.bundlePath as NSString | ||
var components = path.pathComponents | ||
components.removeLast() | ||
components.removeLast() | ||
components.removeLast() | ||
components.append("MacOS") | ||
components.append("Adaptivo") | ||
|
||
let newPath = NSString.path(withComponents: components) | ||
|
||
NSWorkspace.shared.launchApplication(newPath) | ||
} | ||
else { | ||
self.terminate() | ||
} | ||
} | ||
|
||
func applicationWillTerminate(_ aNotification: Notification) { | ||
// Insert code here to tear down your application | ||
} | ||
|
||
|
||
} | ||
|
58 changes: 58 additions & 0 deletions
58
AdaptiveService/Assets.xcassets/AppIcon.appiconset/Contents.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"idiom" : "mac", | ||
"size" : "16x16", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "16x16", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "32x32", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "32x32", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "128x128", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "128x128", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "256x256", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "256x256", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "512x512", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"idiom" : "mac", | ||
"size" : "512x512", | ||
"scale" : "2x" | ||
} | ||
], | ||
"info" : { | ||
"version" : 1, | ||
"author" : "xcode" | ||
} | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
Adaptivo/ViewController.swift → AdaptiveService/ViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.