Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alin23 committed Dec 12, 2017
1 parent 72a0794 commit 5658df6
Show file tree
Hide file tree
Showing 51 changed files with 2,727 additions and 967 deletions.
25 changes: 25 additions & 0 deletions .gitignore
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
22 changes: 22 additions & 0 deletions AdaptiveService/AdaptiveService.entitlements
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>
66 changes: 66 additions & 0 deletions AdaptiveService/AppDelegate.swift
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 AdaptiveService/Assets.xcassets/AppIcon.appiconset/Contents.json
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"
}
}
683 changes: 683 additions & 0 deletions AdaptiveService/Base.lproj/Main.storyboard

Large diffs are not rendered by default.

14 changes: 13 additions & 1 deletion AdaptivoUITests/Info.plist → AdaptiveService/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,33 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LSBackgroundOnly</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Alin. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
//
// ViewController.swift
// Adaptivo
// AdaptiveService
//
// Created by Alin on 30/11/2017.
// Created by Alin on 03/12/2017.
// Copyright © 2017 Alin. All rights reserved.
//

Expand Down
Loading

0 comments on commit 5658df6

Please sign in to comment.