Skip to content
This repository has been archived by the owner on Jul 6, 2022. It is now read-only.

Commit

Permalink
Merge branch '0.2'
Browse files Browse the repository at this point in the history
# Conflicts:
#	Noti/AppDelegate.swift
#	Noti/Base.lproj/Main.storyboard
#	Noti/PreferencesViewController.swift
#	Noti/PushManager.swift
#	Noti/StatusMenuController.swift
#	Podfile
  • Loading branch information
jariz committed Dec 27, 2016
2 parents 2f7b317 + 38dfa0c commit 895a6f4
Show file tree
Hide file tree
Showing 40 changed files with 702 additions and 238 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
osx_image: xcode7.3
osx_image: xcode8.2
language: objective-c
xcode_workspace: Noti.xcworkspace
xcode_scheme: Noti
xcode_scheme: Noti
install:
- sudo gem install xcpretty xcpretty-travis-formatter
- pod install
script: xcodebuild -workspace Noti.xcworkspace -scheme Noti | xcpretty -f `xcpretty-travis-formatter`
37 changes: 28 additions & 9 deletions Noti.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
4901D3CF1D1C121D005F1641 /* StatusMenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901D3CE1D1C121D005F1641 /* StatusMenuController.swift */; };
4901D3D31D23E6AB005F1641 /* IntroViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901D3D21D23E6AB005F1641 /* IntroViewController.swift */; };
498275F21D35101A00AB7029 /* Crypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498275F11D35101A00AB7029 /* Crypt.swift */; };
498275FB1D3567D500AB7029 /* SwCrypt.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498275FA1D3567D500AB7029 /* SwCrypt.swift */; };
498499FE1D1BE46F007FC963 /* PushManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 498499FD1D1BE46F007FC963 /* PushManager.swift */; };
499DD0F61D2ACA0B00BB759D /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 499DD0F51D2ACA0B00BB759D /* .gitignore */; };
499DD0F81D2D7BBF00BB759D /* Ephemerals.swift in Sources */ = {isa = PBXBuildFile; fileRef = 499DD0F71D2D7BBF00BB759D /* Ephemerals.swift */; };
Expand All @@ -28,12 +27,12 @@
4901D3CE1D1C121D005F1641 /* StatusMenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StatusMenuController.swift; sourceTree = "<group>"; };
4901D3D21D23E6AB005F1641 /* IntroViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = IntroViewController.swift; sourceTree = "<group>"; };
498275F11D35101A00AB7029 /* Crypt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Crypt.swift; sourceTree = "<group>"; };
498275F91D3567D500AB7029 /* SwCrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SwCrypt.h; sourceTree = "<group>"; };
498275FA1D3567D500AB7029 /* SwCrypt.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SwCrypt.swift; sourceTree = "<group>"; };
498499FD1D1BE46F007FC963 /* PushManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PushManager.swift; sourceTree = "<group>"; };
499DD0F51D2ACA0B00BB759D /* .gitignore */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = .gitignore; sourceTree = "<group>"; };
499DD0F71D2D7BBF00BB759D /* Ephemerals.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Ephemerals.swift; sourceTree = "<group>"; };
499DD0FB1D2D8FAC00BB759D /* RoundedImage.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RoundedImage.swift; sourceTree = "<group>"; };
49AE29361DB4D19500B61843 /* libSwCrypt.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libSwCrypt.a; path = SwCrypt/build/Debug/libSwCrypt.a; sourceTree = "<group>"; };
49AE29531DB4D86E00B61843 /* SwCrypt.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SwCrypt.framework; path = SwCrypt/build/Debug/SwCrypt.framework; sourceTree = "<group>"; };
49B43B081D1ADFB200A24585 /* Noti.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Noti.app; sourceTree = BUILT_PRODUCTS_DIR; };
49B43B0B1D1ADFB200A24585 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
49B43B0D1D1ADFB200A24585 /* AuthViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AuthViewController.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -80,8 +79,6 @@
49B43B0A1D1ADFB200A24585 /* Noti */ = {
isa = PBXGroup;
children = (
498275F91D3567D500AB7029 /* SwCrypt.h */,
498275FA1D3567D500AB7029 /* SwCrypt.swift */,
49B43B0B1D1ADFB200A24585 /* AppDelegate.swift */,
49B43B0D1D1ADFB200A24585 /* AuthViewController.swift */,
49B43B0F1D1ADFB200A24585 /* Assets.xcassets */,
Expand All @@ -100,6 +97,8 @@
5BAC699C03C9C573FDF4B2D8 /* Frameworks */ = {
isa = PBXGroup;
children = (
49AE29531DB4D86E00B61843 /* SwCrypt.framework */,
49AE29361DB4D19500B61843 /* libSwCrypt.a */,
B2C7615AF577BAEAF32B8516 /* Pods_Noti.framework */,
);
name = Frameworks;
Expand Down Expand Up @@ -149,7 +148,8 @@
TargetAttributes = {
49B43B071D1ADFB200A24585 = {
CreatedOnToolsVersion = 7.3.1;
DevelopmentTeam = JHKDY4UQ72;
LastSwiftMigration = 0800;
ProvisioningStyle = Manual;
};
};
};
Expand Down Expand Up @@ -238,7 +238,6 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
498275FB1D3567D500AB7029 /* SwCrypt.swift in Sources */,
4901D3D31D23E6AB005F1641 /* IntroViewController.swift in Sources */,
499DD0FC1D2D8FAC00BB759D /* RoundedImage.swift in Sources */,
498499FE1D1BE46F007FC963 /* PushManager.swift in Sources */,
Expand Down Expand Up @@ -353,11 +352,21 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = "";
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SwCrypt/build/Debug",
);
INFOPLIST_FILE = Noti/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SwCrypt/build/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = io.jari.Noti;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Debug;
};
Expand All @@ -368,11 +377,21 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CODE_SIGN_IDENTITY = "Developer ID Application";
COMBINE_HIDPI_IMAGES = YES;
DEVELOPMENT_TEAM = JHKDY4UQ72;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SwCrypt/build/Debug",
);
INFOPLIST_FILE = Noti/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"$(PROJECT_DIR)/SwCrypt/build/Debug",
);
MACOSX_DEPLOYMENT_TARGET = 10.11;
PRODUCT_BUNDLE_IDENTIFIER = io.jari.Noti;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 3.0;
};
name = Release;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,38 @@
<Bucket
type = "0"
version = "2.0">
<Breakpoints>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "Yes"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Noti/SwCrypt.swift"
timestampString = "498149114.304063"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "9"
endingLineNumber = "9"
landmarkName = "SecError"
landmarkType = "13">
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
<BreakpointContent
shouldBeEnabled = "No"
ignoreCount = "0"
continueAfterRunningActions = "No"
filePath = "Noti/PushManager.swift"
timestampString = "504373796.799237"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "296"
endingLineNumber = "296"
landmarkName = "setPassword(password:)"
landmarkType = "7">
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Bucket>
31 changes: 25 additions & 6 deletions Noti/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,15 @@ import Starscream
class AppDelegate: NSObject, NSApplicationDelegate {

var pushManager: PushManager?
let userDefaults: NSUserDefaults = NSUserDefaults.standardUserDefaults()
let userDefaults: UserDefaults = UserDefaults.standard
var iwc:NSWindowController?;

func setPassword(password: String) {
pushManager?.setPassword(password: password)
}

func loadPushManager() {
let token = userDefaults.stringForKey("token")
let token = userDefaults.string(forKey: "token")

if(token != nil) {
pushManager = PushManager(token: token!)
Expand All @@ -29,18 +33,33 @@ class AppDelegate: NSObject, NSApplicationDelegate {
}

let storyboard = NSStoryboard(name: "Main", bundle: nil)
iwc = storyboard.instantiateControllerWithIdentifier("IntroWindowController") as? NSWindowController
NSApplication.sharedApplication().activateIgnoringOtherApps(true)
iwc = storyboard.instantiateController(withIdentifier: "IntroWindowController") as? NSWindowController
NSApplication.shared().activate(ignoringOtherApps: true)
iwc!.showWindow(self)
iwc!.window?.makeKeyAndOrderFront(self)
}
}

func displayPreferencesWindow() {
if(pushManager == nil) {
let alert = NSAlert()
alert.messageText = "Please authorize Noti before changing it's preferences."
alert.runModal()
return;
}

let storyboard = NSStoryboard(name: "Main", bundle: nil)
pwc = storyboard.instantiateController(withIdentifier: "PreferencesWindowController") as? NSWindowController
NSApplication.shared().activate(ignoringOtherApps: true)
pwc!.showWindow(self)
pwc!.window?.makeKeyAndOrderFront(self)
}

func applicationDidFinishLaunching(aNotification: NSNotification) {
func applicationDidFinishLaunching(_ aNotification: Notification) {
loadPushManager()
}

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

Expand Down
Binary file removed Noti/Assets.xcassets/AppIcon.appiconset/128.png
Binary file not shown.
Binary file not shown.
Binary file removed Noti/Assets.xcassets/AppIcon.appiconset/16.png
Binary file not shown.
Binary file not shown.
Binary file removed Noti/Assets.xcassets/AppIcon.appiconset/256.png
Binary file not shown.
Binary file not shown.
Binary file removed Noti/Assets.xcassets/AppIcon.appiconset/32.png
Binary file not shown.
Binary file removed Noti/Assets.xcassets/AppIcon.appiconset/512.png
Binary file not shown.
Binary file not shown.
20 changes: 10 additions & 10 deletions Noti/Assets.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,61 +3,61 @@
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "16.png",
"filename" : "noti_product_16.png",
"scale" : "1x"
},
{
"size" : "16x16",
"idiom" : "mac",
"filename" : "16@2x.png",
"filename" : "noti_product_16@2x.png",
"scale" : "2x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "32.png",
"filename" : "noti_product_32.png",
"scale" : "1x"
},
{
"size" : "32x32",
"idiom" : "mac",
"filename" : "32@2x.png",
"filename" : "noti_product_32@2x.png",
"scale" : "2x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "128.png",
"filename" : "noti_product_128.png",
"scale" : "1x"
},
{
"size" : "128x128",
"idiom" : "mac",
"filename" : "128@2x.png",
"filename" : "noti_product_128@2x.png",
"scale" : "2x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "256.png",
"filename" : "noti_product_256.png",
"scale" : "1x"
},
{
"size" : "256x256",
"idiom" : "mac",
"filename" : "256@2x.png",
"filename" : "noti_product_256@2x.png",
"scale" : "2x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "512.png",
"filename" : "noti_product_512-1.png",
"scale" : "1x"
},
{
"size" : "512x512",
"idiom" : "mac",
"filename" : "512@2x.png",
"filename" : "noti_product_512@2x.png",
"scale" : "2x"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions Noti/Assets.xcassets/NotiGeneral.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"images" : [
{
"idiom" : "mac",
"filename" : "NotiGeneral.png",
"scale" : "1x"
},
{
"idiom" : "mac",
"filename" : "[email protected]",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions Noti/AuthViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import WebKit
class AuthViewController: NSViewController, WebFrameLoadDelegate {

@IBOutlet weak var webView: WebView!
let userDefaults: NSUserDefaults = NSUserDefaults.standardUserDefaults()
let userDefaults: UserDefaults = UserDefaults.standard

override func viewDidLoad() {
super.viewDidLoad()

let req = NSURLRequest(URL:NSURL(string:"https://www.pushbullet.com/authorize?client_id=QTVK7zATuEcu4sME8TrwLBMuoW7vC7Wr&redirect_uri=about:blank&response_type=token&scope=everything")!)
let req = URLRequest(url:URL(string:"https://www.pushbullet.com/authorize?client_id=QTVK7zATuEcu4sME8TrwLBMuoW7vC7Wr&redirect_uri=about:blank&response_type=token&scope=everything")!)
webView.frameLoadDelegate = self
webView.mainFrame.loadRequest(req)
webView.mainFrame.load(req)
}

override func viewDidAppear() {
Expand All @@ -29,23 +29,23 @@ class AuthViewController: NSViewController, WebFrameLoadDelegate {
}
}

func webView(sender: WebView!, didFinishLoadForFrame frame: WebFrame!) {
func webView(_ sender: WebView!, didFinishLoadFor frame: WebFrame!) {
//remove fugly loader that is stuck on page, even after loading (pushbullet get your shit together pls ty)
sender.stringByEvaluatingJavaScriptFromString("var uglyDivs = document.querySelectorAll(\"#onecup .agree-page div:not(#header), #onecup .agree-page #header\"); if(uglyDivs.length > 0) for (var i = 0; i < uglyDivs.length; i++) uglyDivs[i].remove()")
sender.stringByEvaluatingJavaScript(from: "var uglyDivs = document.querySelectorAll(\"#onecup .agree-page div:not(#header), #onecup .agree-page #header\"); if(uglyDivs.length > 0) for (var i = 0; i < uglyDivs.length; i++) uglyDivs[i].remove()")

if let ds = frame.dataSource {
if let url = ds.response.URL {
if let url = ds.response.url {
if url.absoluteString.hasPrefix("about:blank") {
let token = (url.absoluteString as NSString).substringFromIndex(27)
let appDelegate = NSApplication.sharedApplication().delegate as! AppDelegate
let token = (url.absoluteString as NSString).substring(from: 27)
let appDelegate = NSApplication.shared().delegate as! AppDelegate

print("Got token!", token, "saving and restarting PushManager")

userDefaults.setValue(token, forKeyPath: "token")
appDelegate.loadPushManager()

self.view.window?.close()
NSNotificationCenter.defaultCenter().postNotificationName("AuthSuccess", object: nil)
NotificationCenter.default.post(name: Notification.Name(rawValue: "AuthSuccess"), object: nil)
}
}
}
Expand Down
Loading

0 comments on commit 895a6f4

Please sign in to comment.