Skip to content

Commit

Permalink
added return to cloud login and wait message
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Jul 17, 2022
1 parent 03e929f commit f29ea30
Show file tree
Hide file tree
Showing 22 changed files with 1,339 additions and 99 deletions.
101 changes: 101 additions & 0 deletions XCreds Login Overlay/AppDelegate.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
//
// AppDelegate.swift
// XCreds Login Overlay
//
// Created by Timothy Perfitt on 7/16/22.
//

import Cocoa
import AppKit
@main
struct MyMain {
static func main() -> Void {
sleep(5)
let _ = NSApplicationMain(CommandLine.argc, CommandLine.unsafeArgv)
}
}

class AppDelegate: NSObject, NSApplicationDelegate {

@IBOutlet var window: NSWindow!
@IBOutlet var waitWindow: NSWindow!

@IBAction func cloudLoginButtonPressed(_ sender: Any) {

waitWindow.level = .modalPanel
waitWindow.canBecomeVisibleWithoutLogin = true
let screenRect = NSScreen.screens[0].visibleFrame

let screenWidth = screenRect.width
let screenHeight = screenRect.height
let waitWindowWidth = waitWindow.frame.width

let newPos = NSMakePoint(screenWidth/2-waitWindowWidth/2, screenHeight/2)
waitWindow.setFrameOrigin(newPos)
waitWindow.makeKeyAndOrderFront(self)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) {


if AuthorizationDBManager.shared.rightExists(right: "loginwindow:login"){
TCSLogWithMark("setting standard login back to XCreds login")
let _ = AuthorizationDBManager.shared.replace(right:"loginwindow:login", withNewRight: "XCredsLoginPlugin:LoginWindow")
let _ = cliTask("/usr/bin/killall loginwindow")

}
}
}

/*
(void)showStatusBar:(__unused id)sender{
[self updateStatus:self];
[self.returnToBootRunnerWindow setLevel:NSScreenSaverWindowLevel];
[self.returnToBootRunnerWindow setCanBecomeVisibleWithoutLogin:YES];
[self.returnToBootRunnerWindow setHidesOnDeactivate:NO];
[self.returnToBootRunnerWindow setOpaque:NO];
[self.returnToBootRunnerWindow orderFront:self];
NSRect statusWindowRect=self.returnToBootRunnerWindow.frame;
NSRect screenRect=[[[NSScreen screens] objectAtIndex:0] visibleFrame];
statusWindowRect.size.width=screenRect.size.width;
statusWindowRect.origin=screenRect.origin;
[self.returnToBootRunnerWindow setFrame:statusWindowRect display:YES];
}
*/
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
window.level = .modalPanel
window.canBecomeVisibleWithoutLogin=true
NSApp.activate(ignoringOtherApps: true)
window.hidesOnDeactivate=false
window.isOpaque=false
window.orderFrontRegardless()


var statusWindowRect=window.frame
let screenRect = NSScreen.screens[0].visibleFrame


statusWindowRect.size.width=screenRect.size.width
statusWindowRect.origin=screenRect.origin;
window.setFrame(statusWindowRect, display: true, animate: false)

}

func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}

func applicationSupportsSecureRestorableState(_ app: NSApplication) -> Bool {
return true
}


}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"colors" : [
{
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"images" : [
{
"idiom" : "mac",
"scale" : "1x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "16x16"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "32x32"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "128x128"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "256x256"
},
{
"idiom" : "mac",
"scale" : "1x",
"size" : "512x512"
},
{
"idiom" : "mac",
"scale" : "2x",
"size" : "512x512"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
6 changes: 6 additions & 0 deletions XCreds Login Overlay/Assets.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}

0 comments on commit f29ea30

Please sign in to comment.