Skip to content

Commit

Permalink
Remove deprecated methods in API, rename defaultBrowser -> setDefault…
Browse files Browse the repository at this point in the history
…Browser
  • Loading branch information
John Sterling committed Jun 29, 2015
1 parent b485aae commit cf62b50
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
10 changes: 3 additions & 7 deletions Finicky/Finicky/FNAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,18 @@ import Foundation
import JavaScriptCore

@objc protocol FinickyAPIExports : JSExport {
static func defaultBrowser(browser: String?) -> Void
static func config(data: [NSObject : AnyObject]!) -> String
static func setDefaultBrowser(browser: String?) -> Void
static func onUrl(handler: JSValue) -> Void
}

@objc class FinickyAPI : NSObject, FinickyAPIExports {

private static var urlHandlers = Array<JSValue>()

class func defaultBrowser(browser: String?) -> Void {
class func setDefaultBrowser(browser: String?) -> Void {
AppDelegate.defaultBrowser = browser
}

class func config(data: [NSObject : AnyObject]!) -> String {
return "deprecated"
}

class func onUrl(handler: JSValue) -> Void {
urlHandlers.append(handler)
Expand All @@ -43,7 +39,7 @@ import JavaScriptCore
@return A dictionary keyed with "url" and "bundleIdentifier" with
the new url and bundle identifier to spawn
*/
func

class func callUrlHandlers(originalUrl: String) -> Dictionary<String, String> {
var strategy : Dictionary<String, String> = [
"url": originalUrl,
Expand Down
11 changes: 1 addition & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,7 @@ Create a file called `.finicky.js` in your home directory.

```javascript

finicky.defaultBrowser('com.google.Chrome')

// Open work stuff in Canary
finicky.onUrl(function(url) {
if (url.match(/^https?:\/\/\bitbucket\.org|trello\.com|([a-z]+)?.google\.com)/)) {
return {
bundleIdentifier: 'com.google.Chrome.canary'
}
}
});
finicky.setDefaultBrowser('com.google.Chrome')

// Open social network links in Google Chrome
finicky.onUrl(function(url) {
Expand Down

0 comments on commit cf62b50

Please sign in to comment.