Skip to content

Commit

Permalink
Changed Figma URL Detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh Dunsterville committed Nov 20, 2018
1 parent 6bf5a82 commit 553fbd6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Binary file added .DS_Store
Binary file not shown.
Binary file not shown.
10 changes: 4 additions & 6 deletions Open Figma/StatusMenuController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class StatusMenuController: NSObject {
let hotKey = HotKey(key: .f, modifiers: [.control, .option, .command])
let pasteboard = NSPasteboard.general
let statusItem = NSStatusBar.system.statusItem(withLength: NSStatusItem.squareLength)
let urlPrefix = "https://www.figma.com/"
let figmaURLType = "figma.com/file"


/*
Expand All @@ -46,13 +46,13 @@ class StatusMenuController: NSObject {
@IBOutlet weak var figmaMenu: NSMenu!



/*
-------------------
Actions
-------------------
*/


//Action that runs openFigma
@IBAction func openFigma(_ sender: Any) {
openFigma()
Expand All @@ -64,6 +64,7 @@ class StatusMenuController: NSObject {
}



/*
-------------------
View
Expand Down Expand Up @@ -93,8 +94,6 @@ class StatusMenuController: NSObject {
-------------------
*/



//Opens a Figma URL in the Desktop APP
func openFigma() {
bundleIdentifier = "com.Figma.Desktop"
Expand All @@ -106,8 +105,7 @@ class StatusMenuController: NSObject {
let filePrefix = "figma://"

// Checks to see if what was copied contains a Figma or Staging URL
if originalURL.hasPrefix(urlPrefix) == true {

if originalURL.localizedStandardContains(figmaURLType) {
// Looks in originalURL up to the index of the word file
if let index = (originalURL.range(of: "file/")?.lowerBound) {

Expand Down

0 comments on commit 553fbd6

Please sign in to comment.