Skip to content

Commit

Permalink
v0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishiraj Sharma authored and Rishiraj Sharma committed Jul 13, 2018
1 parent 5ca174c commit dc317b2
Show file tree
Hide file tree
Showing 87 changed files with 2,802 additions and 994 deletions.
Binary file added .DS_Store
Binary file not shown.
Empty file modified LICENSE
100644 → 100755
Empty file.
13 changes: 2 additions & 11 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Swiftness v0.1
# swiftness-private-beta

![swiftness](https://media.giphy.com/media/26DN65NTQsapJWWrK/giphy.gif)
![Alt Text](https://media.giphy.com/media/3o7WIB0KBZfmGpVV6w/giphy.gif)


**Download:** https://github.com/ehrishirajsharma/Swiftness/releases/download/v0.1/Swiftness-v0.1.app.zip
Expand All @@ -14,13 +14,6 @@ For other operating systems, please follow this poll: https://swiftness-app.type
(I will start working on other platforms as soon as macOS version gets stable)


**Formatting**

Formatting shortcuts are supported, e.g.

- ⌘ + B --> Bold
- ⌘ + I --> Italic

# **Sharing templates file:**


Expand Down Expand Up @@ -48,8 +41,6 @@ A file will be available named reports.xyz - copy and share it to others.
- [ ] Notes for different targets
- [ ] Templates for specific environment profiles (e.g. bug-hunters can maintain multiple versions of vulnerability-template according to the platforms: HackerOne, Bugcrowd, Synack, etc.)
- [ ] Easiest way to share templates, checklist and notes to other users
- [ ] Password protection
- [ ] Lables/tags for templates



Expand Down
140 changes: 109 additions & 31 deletions Swiftness.xcodeproj/project.pbxproj
100644 → 100755

Large diffs are not rendered by default.

Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?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>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
47 changes: 39 additions & 8 deletions Swiftness/AppDelegate.swift
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Cocoa
class AppDelegate: NSObject, NSApplicationDelegate {

// MARK: - Properties
let templateManager = TemplateManager()
let dataManager = DataManager()

private lazy var statusItem: NSStatusItem = {
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
Expand All @@ -14,8 +14,9 @@ class AppDelegate: NSObject, NSApplicationDelegate {

private lazy var popover: NSPopover = {
let popover = NSPopover()
let statusBarViewController = NSStoryboard.statusBarViewController()
statusBarViewController?.delegate = self
let statusBarViewController = NSStoryboard.statusBarViewController
statusBarViewController.delegate = self
statusBarViewController.dataManager = dataManager
popover.contentViewController = statusBarViewController
popover.behavior = .transient
return popover
Expand All @@ -32,10 +33,33 @@ class AppDelegate: NSObject, NSApplicationDelegate {
return eventMonitor
}()

var mainWindowController: WindowController {
return NSApplication.shared.mainWindow?.windowController as! WindowController
}

@IBAction func export(_ sender: Any) {
let windowController = NSStoryboard.exportWindowController
let viewController = windowController.contentViewController as! ExportViewController
viewController.dataManager = dataManager
NSApplication.shared.mainWindow?.beginSheet(windowController.window!)
}

@IBAction func `import`(_ sender: Any) {
let openPanel = NSOpenPanel()
openPanel.allowedFileTypes = [DataManager.fileExtension]
openPanel.allowsOtherFileTypes = false
openPanel.begin { result in
guard result == .OK else { return }
self.dataManager.load(url: openPanel.url!)
self.mainWindowController.dataManager = self.dataManager
}
}

// MARK: - Overrides
func applicationDidFinishLaunching(_ aNotification: Notification) {
mainWindowController.dataManager = dataManager
hideMainWindow()
statusItem.button?.image = NSImage(named: NSImage.Name(rawValue: "link"))
statusItem.button?.image = NSImage.statusBar
}

}
Expand All @@ -44,7 +68,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {
extension AppDelegate: MainWindowDelegate {

func hideMainWindow() {
NSApp.hide(nil)
NSApp.setActivationPolicy(.accessory)
}

Expand All @@ -53,7 +76,17 @@ extension AppDelegate: MainWindowDelegate {
NSApp.setActivationPolicy(.regular)
}
closePopover()
NSApp.activate(ignoringOtherApps: true)
dirtyHackToUnfreezeMenu()
}

func dirtyHackToUnfreezeMenu() {
if (NSRunningApplication.runningApplications(withBundleIdentifier: "com.apple.dock").first?.activate(options: []))! {
let deadlineTime = DispatchTime.now() + .milliseconds(200)
DispatchQueue.main.asyncAfter(deadline: deadlineTime) {
NSApp.setActivationPolicy(.regular)
NSApp.activate(ignoringOtherApps: true)
}
}
}

}
Expand All @@ -78,8 +111,6 @@ private extension AppDelegate {
func showPopover() {
guard let statusItemButton = statusItem.button else { return }

(popover.contentViewController as? StatusBarViewController)?.templateManager = templateManager

if !NSApp.isHidden {
NSApp.activate(ignoringOtherApps: true)
}
Expand Down
Loading

0 comments on commit dc317b2

Please sign in to comment.