From 5b54612d91129afb92aee01e14984e7e2e401709 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 6 May 2015 20:41:51 -0700 Subject: Pass authtoken in from user, and add a wrapper for web UI on Mac. --- ext/mac-ui-macgap1-wrapper/LICENSE | 25 + .../MacGap.xcodeproj/project.pbxproj | 492 +++ .../project.xcworkspace/contents.xcworkspacedata | 7 + .../xcshareddata/MacGap.xccheckout | 41 + .../UserInterfaceState.xcuserstate | Bin 0 -> 46675 bytes .../api.xcuserdatad/UserInterfaceState.xcuserstate | Bin 0 -> 18268 bytes .../api.xcuserdatad/WorkspaceSettings.xcsettings | 10 + .../UserInterfaceState.xcuserstate | Bin 0 -> 27811 bytes .../WorkspaceSettings.xcsettings | 10 + .../xcdebugger/Breakpoints.xcbkptlist | 131 + .../Alex.xcuserdatad/xcschemes/MacGap.xcscheme | 86 + .../xcschemes/xcschememanagement.plist | 22 + .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 + .../api.xcuserdatad/xcschemes/MacGap.xcscheme | 88 + .../xcschemes/xcschememanagement.plist | 22 + .../xcdebugger/Breakpoints.xcbkptlist | 161 + .../liamks.xcuserdatad/xcschemes/MacGap.xcscheme | 84 + .../xcschemes/xcschememanagement.plist | 22 + ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.h | 18 + ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m | 110 + .../MacGap/Classes/CallbackDelegate.h | 20 + .../MacGap/Classes/CallbackDelegate.m | 168 + .../MacGap/Classes/Commands/App.h | 21 + .../MacGap/Classes/Commands/App.m | 128 + .../MacGap/Classes/Commands/Command.h | 18 + .../MacGap/Classes/Commands/Command.m | 28 + .../MacGap/Classes/Commands/Dock.h | 11 + .../MacGap/Classes/Commands/Dock.m | 31 + .../MacGap/Classes/Commands/MenuItemProxy.h | 31 + .../MacGap/Classes/Commands/MenuItemProxy.m | 150 + .../MacGap/Classes/Commands/MenuProxy.h | 31 + .../MacGap/Classes/Commands/MenuProxy.m | 233 ++ .../MacGap/Classes/Commands/Notice.h | 26 + .../MacGap/Classes/Commands/Notice.m | 108 + .../MacGap/Classes/Commands/Path.h | 21 + .../MacGap/Classes/Commands/Path.m | 53 + .../MacGap/Classes/Commands/Sound.h | 17 + .../MacGap/Classes/Commands/Sound.m | 97 + .../MacGap/Classes/Commands/UserDefaults.h | 43 + .../MacGap/Classes/Commands/UserDefaults.m | 211 ++ .../MacGap/Classes/Commands/fonts.h | 9 + .../MacGap/Classes/Commands/fonts.m | 48 + .../MacGap/Classes/Constants.h | 7 + .../MacGap/Classes/ContentView.h | 15 + .../MacGap/Classes/ContentView.m | 68 + .../MacGap/Classes/JSEventHelper.h | 20 + .../MacGap/Classes/JSEventHelper.m | 41 + ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.h | 20 + ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.m | 93 + .../MacGap/Classes/WebViewDelegate.h | 49 + .../MacGap/Classes/WebViewDelegate.m | 206 ++ ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.h | 23 + ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.m | 94 + ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.h | 10 + ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m | 51 + .../MacGap/MacGap-Info.plist | 34 + .../MacGap/MacGap-Prefix.pch | 15 + .../MacGap/WindowController.h | 13 + .../MacGap/WindowController.m | 54 + .../MacGap/en.lproj/Credits.rtf | 13 + .../MacGap/en.lproj/InfoPlist.strings | 2 + .../MacGap/en.lproj/MainMenu.xib | 3404 ++++++++++++++++++++ .../MacGap/en.lproj/Window.xib | 337 ++ ext/mac-ui-macgap1-wrapper/MacGap/main.m | 14 + ext/mac-ui-macgap1-wrapper/README.md | 36 + ext/mac-ui-macgap1-wrapper/application.icns | Bin 0 -> 88566 bytes ext/mac-ui-macgap1-wrapper/public/index.html | 33 + ui/main.jsx | 49 +- 68 files changed, 7537 insertions(+), 1 deletion(-) create mode 100644 ext/mac-ui-macgap1-wrapper/LICENSE create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/WorkspaceSettings.xcsettings create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/UserInterfaceState.xcuserstate create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/WorkspaceSettings.xcsettings create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.h create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.m create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.h create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.m create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.h create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.m create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.h create mode 100755 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Constants.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Prefix.pch create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/WindowController.h create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/WindowController.m create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Credits.rtf create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/InfoPlist.strings create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/MainMenu.xib create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Window.xib create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/main.m create mode 100644 ext/mac-ui-macgap1-wrapper/README.md create mode 100644 ext/mac-ui-macgap1-wrapper/application.icns create mode 100644 ext/mac-ui-macgap1-wrapper/public/index.html diff --git a/ext/mac-ui-macgap1-wrapper/LICENSE b/ext/mac-ui-macgap1-wrapper/LICENSE new file mode 100644 index 00000000..c7fd4a4a --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/LICENSE @@ -0,0 +1,25 @@ +MacGap was ported from phonegap-mac, and is under the same license (MIT) + +The MIT License +***************** + +Copyright (c) <2012> + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj new file mode 100644 index 00000000..ea339cf0 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj @@ -0,0 +1,492 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1495814F15C15CCC00E1CFE5 /* Notice.m in Sources */ = {isa = PBXBuildFile; fileRef = 1495814E15C15CCC00E1CFE5 /* Notice.m */; }; + 6F169DA718CC332E005EDDF3 /* Command.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F169DA618CC332E005EDDF3 /* Command.m */; }; + 6F169DAA18CC35FD005EDDF3 /* CallbackDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F169DA918CC35FD005EDDF3 /* CallbackDelegate.m */; }; + 6F169DAC18CD8A4A005EDDF3 /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6F169DAB18CD8A4A005EDDF3 /* JavaScriptCore.framework */; }; + 6F169DB118CD906F005EDDF3 /* MenuItemProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F169DAE18CD906F005EDDF3 /* MenuItemProxy.m */; }; + 6F169DB218CD906F005EDDF3 /* MenuProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6F169DB018CD906F005EDDF3 /* MenuProxy.m */; }; + 6FD672B618FE618E00C0DAAD /* UserDefaults.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FD672B518FE618E00C0DAAD /* UserDefaults.m */; }; + 6FD6E4ED18C2D48C00DFFBE6 /* fonts.m in Sources */ = {isa = PBXBuildFile; fileRef = 6FD6E4EC18C2D48C00DFFBE6 /* fonts.m */; }; + 88746BEE14CCA435001E160E /* JSEventHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 88746BED14CCA435001E160E /* JSEventHelper.m */; }; + 88C0646014BDE10A00E4BCE2 /* Window.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0645F14BDE10A00E4BCE2 /* Window.m */; }; + 88C0646614BDEC5800E4BCE2 /* Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88C0646414BDEC5800E4BCE2 /* Window.xib */; }; + 88C0646D14BDF6A600E4BCE2 /* WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0646C14BDF6A600E4BCE2 /* WindowController.m */; }; + C1C2B9911AFB0CF10060D7C2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C2B9901AFB0CF10060D7C2 /* Security.framework */; }; + F2B80016179E0FC100B069A8 /* Clipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = F2B80015179E0FC100B069A8 /* Clipboard.m */; }; + FA32509D14BA813600BF0781 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA32509C14BA813600BF0781 /* WebKit.framework */; }; + FA3250C314BA85E700BF0781 /* ContentView.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250BC14BA85E700BF0781 /* ContentView.m */; }; + FA3250C514BA85E700BF0781 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250BE14BA85E700BF0781 /* Utils.m */; }; + FA3250C714BA85E700BF0781 /* WebViewDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250C014BA85E700BF0781 /* WebViewDelegate.m */; }; + FA3250D314BA860800BF0781 /* App.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250C914BA860800BF0781 /* App.m */; }; + FA3250D514BA860800BF0781 /* Dock.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250CB14BA860800BF0781 /* Dock.m */; }; + FA3250D914BA860800BF0781 /* Path.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250CF14BA860800BF0781 /* Path.m */; }; + FA3250DB14BA860800BF0781 /* Sound.m in Sources */ = {isa = PBXBuildFile; fileRef = FA3250D114BA860800BF0781 /* Sound.m */; }; + FA3250E514BA883A00BF0781 /* public in Resources */ = {isa = PBXBuildFile; fileRef = FA3250E414BA883A00BF0781 /* public */; }; + FA3250E714BA8BCE00BF0781 /* application.icns in Resources */ = {isa = PBXBuildFile; fileRef = FA3250E614BA8BCE00BF0781 /* application.icns */; }; + FA3F7742168F70790027B324 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA3F7741168F70780027B324 /* Cocoa.framework */; }; + FAE451C914BA79C600190544 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = FAE451C714BA79C600190544 /* InfoPlist.strings */; }; + FAE451CB14BA79C600190544 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE451CA14BA79C600190544 /* main.m */; }; + FAE451CF14BA79C600190544 /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = FAE451CD14BA79C600190544 /* Credits.rtf */; }; + FAE451D214BA79C600190544 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = FAE451D114BA79C600190544 /* AppDelegate.m */; }; + FAE451D514BA79C600190544 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = FAE451D314BA79C600190544 /* MainMenu.xib */; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + FA3250DD14BA876F00BF0781 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 1495814D15C15CCC00E1CFE5 /* Notice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Notice.h; path = Classes/Commands/Notice.h; sourceTree = ""; }; + 1495814E15C15CCC00E1CFE5 /* Notice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Notice.m; path = Classes/Commands/Notice.m; sourceTree = ""; }; + 6F169DA518CC332E005EDDF3 /* Command.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Command.h; path = Classes/Commands/Command.h; sourceTree = ""; }; + 6F169DA618CC332E005EDDF3 /* Command.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Command.m; path = Classes/Commands/Command.m; sourceTree = ""; }; + 6F169DA818CC35FD005EDDF3 /* CallbackDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CallbackDelegate.h; path = Classes/CallbackDelegate.h; sourceTree = ""; }; + 6F169DA918CC35FD005EDDF3 /* CallbackDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CallbackDelegate.m; path = Classes/CallbackDelegate.m; sourceTree = ""; }; + 6F169DAB18CD8A4A005EDDF3 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; + 6F169DAD18CD906F005EDDF3 /* MenuItemProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MenuItemProxy.h; path = Classes/Commands/MenuItemProxy.h; sourceTree = ""; }; + 6F169DAE18CD906F005EDDF3 /* MenuItemProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MenuItemProxy.m; path = Classes/Commands/MenuItemProxy.m; sourceTree = ""; }; + 6F169DAF18CD906F005EDDF3 /* MenuProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MenuProxy.h; path = Classes/Commands/MenuProxy.h; sourceTree = ""; }; + 6F169DB018CD906F005EDDF3 /* MenuProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MenuProxy.m; path = Classes/Commands/MenuProxy.m; sourceTree = ""; }; + 6FD672B418FE618E00C0DAAD /* UserDefaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UserDefaults.h; path = Classes/Commands/UserDefaults.h; sourceTree = ""; }; + 6FD672B518FE618E00C0DAAD /* UserDefaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = UserDefaults.m; path = Classes/Commands/UserDefaults.m; sourceTree = ""; }; + 6FD6E4EB18C2D48200DFFBE6 /* fonts.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = fonts.h; path = Classes/Commands/fonts.h; sourceTree = ""; }; + 6FD6E4EC18C2D48C00DFFBE6 /* fonts.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = fonts.m; path = Classes/Commands/fonts.m; sourceTree = ""; }; + 88746BEC14CCA435001E160E /* JSEventHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JSEventHelper.h; path = Classes/JSEventHelper.h; sourceTree = ""; }; + 88746BED14CCA435001E160E /* JSEventHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = JSEventHelper.m; path = Classes/JSEventHelper.m; sourceTree = ""; }; + 88C0645E14BDE10A00E4BCE2 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Window.h; path = Classes/Window.h; sourceTree = ""; }; + 88C0645F14BDE10A00E4BCE2 /* Window.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Window.m; path = Classes/Window.m; sourceTree = ""; }; + 88C0646514BDEC5800E4BCE2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Window.xib; sourceTree = ""; }; + 88C0646B14BDF6A600E4BCE2 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowController.h; sourceTree = ""; }; + 88C0646C14BDF6A600E4BCE2 /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowController.m; sourceTree = ""; }; + C1C2B9901AFB0CF10060D7C2 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + F2B80014179E0FC100B069A8 /* Clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clipboard.h; sourceTree = ""; }; + F2B80015179E0FC100B069A8 /* Clipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Clipboard.m; sourceTree = ""; }; + FA32509C14BA813600BF0781 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; }; + FA3250BA14BA85E700BF0781 /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Constants.h; path = Classes/Constants.h; sourceTree = ""; }; + FA3250BB14BA85E700BF0781 /* ContentView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = ContentView.h; path = Classes/ContentView.h; sourceTree = ""; }; + FA3250BC14BA85E700BF0781 /* ContentView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = ContentView.m; path = Classes/ContentView.m; sourceTree = ""; }; + FA3250BD14BA85E700BF0781 /* Utils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Utils.h; path = Classes/Utils.h; sourceTree = ""; }; + FA3250BE14BA85E700BF0781 /* Utils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Utils.m; path = Classes/Utils.m; sourceTree = ""; }; + FA3250BF14BA85E700BF0781 /* WebViewDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebViewDelegate.h; path = Classes/WebViewDelegate.h; sourceTree = ""; }; + FA3250C014BA85E700BF0781 /* WebViewDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = WebViewDelegate.m; path = Classes/WebViewDelegate.m; sourceTree = ""; }; + FA3250C814BA860800BF0781 /* App.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = App.h; path = Classes/Commands/App.h; sourceTree = ""; }; + FA3250C914BA860800BF0781 /* App.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = App.m; path = Classes/Commands/App.m; sourceTree = ""; }; + FA3250CA14BA860800BF0781 /* Dock.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Dock.h; path = Classes/Commands/Dock.h; sourceTree = ""; }; + FA3250CB14BA860800BF0781 /* Dock.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Dock.m; path = Classes/Commands/Dock.m; sourceTree = ""; }; + FA3250CE14BA860800BF0781 /* Path.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Path.h; path = Classes/Commands/Path.h; sourceTree = ""; }; + FA3250CF14BA860800BF0781 /* Path.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Path.m; path = Classes/Commands/Path.m; sourceTree = ""; }; + FA3250D014BA860800BF0781 /* Sound.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = Sound.h; path = Classes/Commands/Sound.h; sourceTree = ""; }; + FA3250D114BA860800BF0781 /* Sound.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = Sound.m; path = Classes/Commands/Sound.m; sourceTree = ""; }; + FA3250E414BA883A00BF0781 /* public */ = {isa = PBXFileReference; lastKnownFileType = folder; path = public; sourceTree = ""; }; + FA3250E614BA8BCE00BF0781 /* application.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = application.icns; sourceTree = SOURCE_ROOT; }; + FA3F7741168F70780027B324 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/Cocoa.framework; sourceTree = DEVELOPER_DIR; }; + FAE451BA14BA79C600190544 /* ZeroTier One.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ZeroTier One.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + FAE451BE14BA79C600190544 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; }; + FAE451C114BA79C600190544 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; }; + FAE451C214BA79C600190544 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; }; + FAE451C314BA79C600190544 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + FAE451C614BA79C600190544 /* MacGap-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "MacGap-Info.plist"; sourceTree = ""; }; + FAE451C814BA79C600190544 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + FAE451CA14BA79C600190544 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + FAE451CC14BA79C600190544 /* MacGap-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MacGap-Prefix.pch"; sourceTree = ""; }; + FAE451CE14BA79C600190544 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; + FAE451D014BA79C600190544 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + FAE451D114BA79C600190544 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + FAE451D414BA79C600190544 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + FAE451B714BA79C600190544 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C1C2B9911AFB0CF10060D7C2 /* Security.framework in Frameworks */, + 6F169DAC18CD8A4A005EDDF3 /* JavaScriptCore.framework in Frameworks */, + FA3F7742168F70790027B324 /* Cocoa.framework in Frameworks */, + FA32509D14BA813600BF0781 /* WebKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + FA3250E014BA87B800BF0781 /* Classes */ = { + isa = PBXGroup; + children = ( + FA3250E114BA87DD00BF0781 /* Commands */, + FA3250BA14BA85E700BF0781 /* Constants.h */, + 6F169DA818CC35FD005EDDF3 /* CallbackDelegate.h */, + 6F169DA918CC35FD005EDDF3 /* CallbackDelegate.m */, + FA3250BB14BA85E700BF0781 /* ContentView.h */, + FA3250BC14BA85E700BF0781 /* ContentView.m */, + FA3250BF14BA85E700BF0781 /* WebViewDelegate.h */, + FA3250C014BA85E700BF0781 /* WebViewDelegate.m */, + 88C0646B14BDF6A600E4BCE2 /* WindowController.h */, + 88C0646C14BDF6A600E4BCE2 /* WindowController.m */, + ); + name = Classes; + sourceTree = ""; + }; + FA3250E114BA87DD00BF0781 /* Commands */ = { + isa = PBXGroup; + children = ( + 6F169DA518CC332E005EDDF3 /* Command.h */, + 6F169DA618CC332E005EDDF3 /* Command.m */, + 1495814D15C15CCC00E1CFE5 /* Notice.h */, + 1495814E15C15CCC00E1CFE5 /* Notice.m */, + FA3250CA14BA860800BF0781 /* Dock.h */, + FA3250CB14BA860800BF0781 /* Dock.m */, + 6FD6E4EB18C2D48200DFFBE6 /* fonts.h */, + 6FD6E4EC18C2D48C00DFFBE6 /* fonts.m */, + FA3250BD14BA85E700BF0781 /* Utils.h */, + FA3250BE14BA85E700BF0781 /* Utils.m */, + 6FD672B418FE618E00C0DAAD /* UserDefaults.h */, + 6FD672B518FE618E00C0DAAD /* UserDefaults.m */, + FA3250CE14BA860800BF0781 /* Path.h */, + FA3250CF14BA860800BF0781 /* Path.m */, + FA3250D014BA860800BF0781 /* Sound.h */, + FA3250D114BA860800BF0781 /* Sound.m */, + FA3250C814BA860800BF0781 /* App.h */, + FA3250C914BA860800BF0781 /* App.m */, + 6F169DAD18CD906F005EDDF3 /* MenuItemProxy.h */, + 6F169DAE18CD906F005EDDF3 /* MenuItemProxy.m */, + 6F169DAF18CD906F005EDDF3 /* MenuProxy.h */, + 6F169DB018CD906F005EDDF3 /* MenuProxy.m */, + 88C0645E14BDE10A00E4BCE2 /* Window.h */, + 88C0645F14BDE10A00E4BCE2 /* Window.m */, + 88746BEC14CCA435001E160E /* JSEventHelper.h */, + 88746BED14CCA435001E160E /* JSEventHelper.m */, + F2B80014179E0FC100B069A8 /* Clipboard.h */, + F2B80015179E0FC100B069A8 /* Clipboard.m */, + ); + name = Commands; + sourceTree = ""; + }; + FAE451AF14BA79C600190544 = { + isa = PBXGroup; + children = ( + FA3F7741168F70780027B324 /* Cocoa.framework */, + FA3250E414BA883A00BF0781 /* public */, + FAE451C414BA79C600190544 /* MacGap */, + FAE451BD14BA79C600190544 /* Frameworks */, + FAE451BB14BA79C600190544 /* Products */, + ); + sourceTree = ""; + }; + FAE451BB14BA79C600190544 /* Products */ = { + isa = PBXGroup; + children = ( + FAE451BA14BA79C600190544 /* ZeroTier One.app */, + ); + name = Products; + sourceTree = ""; + }; + FAE451BD14BA79C600190544 /* Frameworks */ = { + isa = PBXGroup; + children = ( + C1C2B9901AFB0CF10060D7C2 /* Security.framework */, + 6F169DAB18CD8A4A005EDDF3 /* JavaScriptCore.framework */, + FA32509C14BA813600BF0781 /* WebKit.framework */, + FAE451BE14BA79C600190544 /* Cocoa.framework */, + FAE451C014BA79C600190544 /* Other Frameworks */, + ); + name = Frameworks; + sourceTree = ""; + }; + FAE451C014BA79C600190544 /* Other Frameworks */ = { + isa = PBXGroup; + children = ( + FAE451C114BA79C600190544 /* AppKit.framework */, + FAE451C214BA79C600190544 /* CoreData.framework */, + FAE451C314BA79C600190544 /* Foundation.framework */, + ); + name = "Other Frameworks"; + sourceTree = ""; + }; + FAE451C414BA79C600190544 /* MacGap */ = { + isa = PBXGroup; + children = ( + FA3250E014BA87B800BF0781 /* Classes */, + FAE451D014BA79C600190544 /* AppDelegate.h */, + FAE451D114BA79C600190544 /* AppDelegate.m */, + FAE451D314BA79C600190544 /* MainMenu.xib */, + 88C0646414BDEC5800E4BCE2 /* Window.xib */, + FAE451C514BA79C600190544 /* Supporting Files */, + ); + path = MacGap; + sourceTree = ""; + }; + FAE451C514BA79C600190544 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + FA3250E614BA8BCE00BF0781 /* application.icns */, + FAE451C614BA79C600190544 /* MacGap-Info.plist */, + FAE451C714BA79C600190544 /* InfoPlist.strings */, + FAE451CA14BA79C600190544 /* main.m */, + FAE451CC14BA79C600190544 /* MacGap-Prefix.pch */, + FAE451CD14BA79C600190544 /* Credits.rtf */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + FAE451B914BA79C600190544 /* MacGap */ = { + isa = PBXNativeTarget; + buildConfigurationList = FAE451D814BA79C600190544 /* Build configuration list for PBXNativeTarget "MacGap" */; + buildPhases = ( + FAE451B814BA79C600190544 /* Resources */, + FAE451B614BA79C600190544 /* Sources */, + FAE451B714BA79C600190544 /* Frameworks */, + FA3250DD14BA876F00BF0781 /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = MacGap; + productName = MacGap; + productReference = FAE451BA14BA79C600190544 /* ZeroTier One.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + FAE451B114BA79C600190544 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0450; + ORGANIZATIONNAME = Twitter; + }; + buildConfigurationList = FAE451B414BA79C600190544 /* Build configuration list for PBXProject "MacGap" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = FAE451AF14BA79C600190544; + productRefGroup = FAE451BB14BA79C600190544 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + FAE451B914BA79C600190544 /* MacGap */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + FAE451B814BA79C600190544 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FA3250E514BA883A00BF0781 /* public in Resources */, + FAE451C914BA79C600190544 /* InfoPlist.strings in Resources */, + FAE451CF14BA79C600190544 /* Credits.rtf in Resources */, + FAE451D514BA79C600190544 /* MainMenu.xib in Resources */, + FA3250E714BA8BCE00BF0781 /* application.icns in Resources */, + 88C0646614BDEC5800E4BCE2 /* Window.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + FAE451B614BA79C600190544 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 6F169DAA18CC35FD005EDDF3 /* CallbackDelegate.m in Sources */, + FA3250D314BA860800BF0781 /* App.m in Sources */, + FA3250D514BA860800BF0781 /* Dock.m in Sources */, + FA3250D914BA860800BF0781 /* Path.m in Sources */, + FA3250DB14BA860800BF0781 /* Sound.m in Sources */, + FA3250C314BA85E700BF0781 /* ContentView.m in Sources */, + FA3250C514BA85E700BF0781 /* Utils.m in Sources */, + FA3250C714BA85E700BF0781 /* WebViewDelegate.m in Sources */, + FAE451CB14BA79C600190544 /* main.m in Sources */, + 6F169DB118CD906F005EDDF3 /* MenuItemProxy.m in Sources */, + FAE451D214BA79C600190544 /* AppDelegate.m in Sources */, + 6F169DA718CC332E005EDDF3 /* Command.m in Sources */, + 6FD672B618FE618E00C0DAAD /* UserDefaults.m in Sources */, + 88C0646014BDE10A00E4BCE2 /* Window.m in Sources */, + 6F169DB218CD906F005EDDF3 /* MenuProxy.m in Sources */, + 88C0646D14BDF6A600E4BCE2 /* WindowController.m in Sources */, + 6FD6E4ED18C2D48C00DFFBE6 /* fonts.m in Sources */, + 88746BEE14CCA435001E160E /* JSEventHelper.m in Sources */, + 1495814F15C15CCC00E1CFE5 /* Notice.m in Sources */, + F2B80016179E0FC100B069A8 /* Clipboard.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXVariantGroup section */ + 88C0646414BDEC5800E4BCE2 /* Window.xib */ = { + isa = PBXVariantGroup; + children = ( + 88C0646514BDEC5800E4BCE2 /* en */, + ); + name = Window.xib; + sourceTree = ""; + }; + FAE451C714BA79C600190544 /* InfoPlist.strings */ = { + isa = PBXVariantGroup; + children = ( + FAE451C814BA79C600190544 /* en */, + ); + name = InfoPlist.strings; + sourceTree = ""; + }; + FAE451CD14BA79C600190544 /* Credits.rtf */ = { + isa = PBXVariantGroup; + children = ( + FAE451CE14BA79C600190544 /* en */, + ); + name = Credits.rtf; + sourceTree = ""; + }; + FAE451D314BA79C600190544 /* MainMenu.xib */ = { + isa = PBXVariantGroup; + children = ( + FAE451D414BA79C600190544 /* en */, + ); + name = MainMenu.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + FAE451D614BA79C600190544 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_NAME = "ZeroTier One"; + SDKROOT = ""; + }; + name = Debug; + }; + FAE451D714BA79C600190544 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_STANDARD_64_BIT)"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_ENABLE_OBJC_EXCEPTIONS = YES; + GCC_VERSION = ""; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "ZeroTier One"; + SDKROOT = ""; + }; + name = Release; + }; + FAE451D914BA79C600190544 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/MacGap\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "MacGap/MacGap-Prefix.pch"; + GCC_VERSION = ""; + INFOPLIST_FILE = "MacGap/MacGap-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "ZeroTier One"; + SDKROOT = macosx; + WRAPPER_EXTENSION = app; + }; + name = Debug; + }; + FAE451DA14BA79C600190544 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; + CLANG_CXX_LIBRARY = "compiler-default"; + COMBINE_HIDPI_IMAGES = YES; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/MacGap\"", + ); + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "MacGap/MacGap-Prefix.pch"; + GCC_VERSION = ""; + INFOPLIST_FILE = "MacGap/MacGap-Info.plist"; + MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_NAME = "ZeroTier One"; + SDKROOT = macosx; + WRAPPER_EXTENSION = app; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + FAE451B414BA79C600190544 /* Build configuration list for PBXProject "MacGap" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FAE451D614BA79C600190544 /* Debug */, + FAE451D714BA79C600190544 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FAE451D814BA79C600190544 /* Build configuration list for PBXNativeTarget "MacGap" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FAE451D914BA79C600190544 /* Debug */, + FAE451DA14BA79C600190544 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = FAE451B114BA79C600190544 /* Project object */; +} diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..88f36fc7 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout new file mode 100644 index 00000000..b2ea215d --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 4D486E78-E297-4CC3-AAAE-1A58EDAC87E6 + IDESourceControlProjectName + MacGap + IDESourceControlProjectOriginsDictionary + + 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + https://github.com/MacGapProject/MacGap1.git + + IDESourceControlProjectPath + MacGap.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + ../.. + + IDESourceControlProjectURL + https://github.com/MacGapProject/MacGap1.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + IDESourceControlWCCName + MacGap1 + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..20281812 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/Alex.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..04ade238 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/WorkspaceSettings.xcsettings b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..659c8766 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/UserInterfaceState.xcuserstate b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..822ed3cb Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/WorkspaceSettings.xcsettings b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/WorkspaceSettings.xcsettings new file mode 100644 index 00000000..6ff33e60 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/liamks.xcuserdatad/WorkspaceSettings.xcsettings @@ -0,0 +1,10 @@ + + + + + IDEWorkspaceUserSettings_HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges + + IDEWorkspaceUserSettings_SnapshotAutomaticallyBeforeSignificantChanges + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 00000000..38f66126 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme new file mode 100644 index 00000000..0aaad582 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..921f1a6f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + MacGap.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + FAE451B914BA79C600190544 + + primary + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 00000000..fe2b4541 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,5 @@ + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme new file mode 100644 index 00000000..2555dc89 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..921f1a6f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + MacGap.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + FAE451B914BA79C600190544 + + primary + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist new file mode 100644 index 00000000..8e541eab --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist @@ -0,0 +1,161 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme new file mode 100644 index 00000000..872d6d7d --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..921f1a6f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + MacGap.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + FAE451B914BA79C600190544 + + primary + + + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.h b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.h new file mode 100644 index 00000000..bf7370b5 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.h @@ -0,0 +1,18 @@ +// +// AppDelegate.h +// MacGap +// +// Created by Alex MacCaw on 08/01/2012. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import +#import "Classes/ContentView.h" + +#import "WindowController.h" + +@interface AppDelegate : NSObject + +@property (retain, nonatomic) WindowController *windowController; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m new file mode 100644 index 00000000..96a3e820 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m @@ -0,0 +1,110 @@ +// +// AppDelegate.m +// MacGap +// +// Created by Alex MacCaw on 08/01/2012. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "AppDelegate.h" + +@implementation AppDelegate + +@synthesize windowController; + +- (void) applicationWillFinishLaunching:(NSNotification *)aNotification +{ +} + +-(BOOL)applicationShouldHandleReopen:(NSApplication*)application + hasVisibleWindows:(BOOL)visibleWindows{ + if(!visibleWindows){ + [self.windowController.window makeKeyAndOrderFront: nil]; + } + return YES; +} + +- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { + return YES; +} + +- (void) applicationDidFinishLaunching:(NSNotification *)aNotification { + // Create authorization reference + OSStatus status; + AuthorizationRef authorizationRef; + + // AuthorizationCreate and pass NULL as the initial + // AuthorizationRights set so that the AuthorizationRef gets created + // successfully, and then later call AuthorizationCopyRights to + // determine or extend the allowable rights. + // http://developer.apple.com/qa/qa2001/qa1172.html + status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef); + if (status != errAuthorizationSuccess) + { + NSLog(@"Error Creating Initial Authorization: %d", status); + return; + } + + // kAuthorizationRightExecute == "system.privilege.admin" + AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0}; + AuthorizationRights rights = {1, &right}; + AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | + kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; + + // Call AuthorizationCopyRights to determine or extend the allowable rights. + status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL); + if (status != errAuthorizationSuccess) + { + NSLog(@"Copy Rights Unsuccessful: %d", status); + return; + } + + // use rm tool with -rf + char *tool = "/bin/cat"; + char *args[] = {"/Library/Application Support/ZeroTier/One/authtoken.secret", NULL}; + FILE *pipe = NULL; + + status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, args, &pipe); + if (status != errAuthorizationSuccess) + { + NSLog(@"Error: %d", status); + } + + char url[16384]; + memset(url,0,sizeof(url)); + if (pipe) { + char buf[16384]; + + FILE *pf = fopen("/Library/Application Support/ZeroTier/One/zerotier-one.port","r"); + long n = fread(buf,1,sizeof(buf)-1,pf); + long port = 9993; // default + if (n > 0) { + buf[n] = (char)0; + port = strtol(buf,(char **)0,10); + } + fclose(pf); + + n = (long)fread(buf,1,sizeof(buf)-1,pipe); + if (n > 0) { + buf[n] = (char)0; + snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf); + } + fclose(pipe); + } + + // The only way to guarantee that a credential acquired when you + // request a right is not shared with other authorization instances is + // to destroy the credential. To do so, call the AuthorizationFree + // function with the flag kAuthorizationFlagDestroyRights. + // http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/02authconcepts/chapter_2_section_7.html + status = AuthorizationFree(authorizationRef, kAuthorizationFlagDestroyRights); + + NSString *urlStr = [[NSString alloc] initWithCString:url]; + self.windowController = [[WindowController alloc] initWithURL: urlStr]; + [self.windowController showWindow: [NSApplication sharedApplication].delegate]; + self.windowController.contentView.webView.alphaValue = 1.0; + self.windowController.contentView.alphaValue = 1.0; + [self.windowController showWindow:self]; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.h new file mode 100755 index 00000000..0f31ee41 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.h @@ -0,0 +1,20 @@ +// +// CallbackDelegate.h +// MacGap +// +// Created by Joe Hildebrand on 1/10/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "Command.h" + +@interface CallbackDelegate : Command { +} + +@property JSObjectRef callback; + +- (id) initWithContext:(JSContextRef)aContext forCallback:(WebScriptObject*)aCallback; +- (id) call; +- (id) callWithParams:(id)firstOrNil, ... NS_REQUIRES_NIL_TERMINATION; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.m new file mode 100755 index 00000000..5ce8fbe3 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/CallbackDelegate.m @@ -0,0 +1,168 @@ +// +// CallbackDelegate.m +// MacGap +// +// Created by Joe Hildebrand on 1/10/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "CallbackDelegate.h" +#import + +@implementation CallbackDelegate + +@synthesize callback; + +- (id) initWithContext:(JSContextRef)aContext forCallback:(WebScriptObject*)aCallback +{ + if (!aCallback) + return nil; + if ([aCallback isKindOfClass:[WebUndefined class]]) + return nil; + + self = [super initWithContext:aContext]; + if (!self) + return nil; + + callback = [aCallback JSObject]; + JSValueProtect(context, callback); + return self; +} + +- (void) dealloc +{ + if (callback) + { + JSValueUnprotect(context, callback); + callback = nil; + } +} + +- (id) objectFromValue:(JSValueRef)val +{ + JSStringRef jstr; + NSString *rets; + + switch(JSValueGetType(context, val)) + { + case kJSTypeUndefined: + case kJSTypeNull: + return nil; + case kJSTypeBoolean: + return [NSNumber numberWithBool:JSValueToBoolean(context, val)]; + case kJSTypeNumber: + return [NSNumber numberWithDouble:JSValueToNumber(context, val, NULL)]; + case kJSTypeString: + jstr = JSValueToStringCopy(context, val, NULL); + size_t sz = JSStringGetMaximumUTF8CStringSize(jstr); + char *buf = (char*)malloc(sz); + JSStringGetUTF8CString(jstr, buf, sz); + rets = [NSString stringWithUTF8String:buf]; + free(buf); + return rets; + case kJSTypeObject: + // TODO: dictionary or something + return nil; + default: + NSAssert(false, @"Invalid JavaScript type"); + return nil; + } +} + +- (JSValueRef) valueFromObject:(id)obj +{ + JSValueRef val = nil; + if (!obj) + { + val = JSValueMakeNull(context); + } + else if ([obj isKindOfClass:[NSString class]]) + { + JSStringRef jstr = JSStringCreateWithUTF8CString([obj UTF8String]); + val = JSValueMakeString(context, jstr); + JSStringRelease(jstr); + } + else if ([obj isKindOfClass:[NSNumber class]]) + { + val = JSValueMakeNumber(context, [obj doubleValue]); + } + else if ([obj isKindOfClass:[NSDictionary class]]) + { + JSObjectRef o = JSObjectMake(context, NULL, NULL); + for (NSString *key in obj) + { + JSStringRef kstr = JSStringCreateWithUTF8CString([key UTF8String]); + JSValueRef v = [self valueFromObject:[obj objectForKey:key]]; + + JSObjectSetProperty(context, o, kstr, v, kJSPropertyAttributeNone, NULL); + JSStringRelease(kstr); + } + val = o; + } + else if ([obj isKindOfClass:[NSArray class]]) + { + NSUInteger pcount = [obj count]; + JSValueRef jsArgs[pcount]; + NSUInteger i=0; + for (id v in obj) + { + jsArgs[i++] = [self valueFromObject:v]; + } + val = JSObjectMakeArray(context, pcount, jsArgs, NULL); + } + else if ([obj isKindOfClass:[NSDate class]]) + { + NSTimeInterval secs = [obj timeIntervalSince1970]; + JSValueRef jsArgs[1]; + // call the Date(milliseconds) constructor in JS + jsArgs[0] = JSValueMakeNumber(context, secs * 1000.0); + val = JSObjectMakeDate(context, 1, jsArgs, NULL); + } + else + { + NSLog(@"Warning: unknown object type for: %@", obj); + val = JSValueMakeUndefined(context); + } + return val; +} + +- (id) call +{ + NSAssert(callback, @"Callback required"); + if (!JSObjectIsFunction(context, callback)) + return nil; + + JSValueRef jsArgs[0]; + JSValueRef ret = JSObjectCallAsFunction(context, callback, NULL, 0, jsArgs, NULL); + return [self objectFromValue:ret]; +} + +- (id) callWithParams:(id)firstOrNil, ... +{ + NSAssert(callback, @"Callback required"); + if (!JSObjectIsFunction(context, callback)) + return nil; + NSUInteger pcount = 0; + id p; + va_list args; + va_start(args, firstOrNil); + for (p=firstOrNil; p; p=va_arg(args, id)) + { + pcount++; + } + va_end(args); + + JSValueRef jsArgs[pcount]; + NSUInteger j = 0; + va_start(args, firstOrNil); + for (p=firstOrNil; p; p=va_arg(args, id)) + { + jsArgs[j++] = [self valueFromObject:p]; + } + va_end(args); + + JSValueRef ret = JSObjectCallAsFunction(context, callback, NULL, j, jsArgs, NULL); + return [self objectFromValue:ret]; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.h new file mode 100644 index 00000000..f65ba61e --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.h @@ -0,0 +1,21 @@ +#import + +#import "WindowController.h" + +@interface App : NSObject { + +} + +@property (nonatomic, retain) WebView *webView; + +- (id) initWithWebView:(WebView *)view; + +- (void) terminate; +- (void) activate; +- (void) hide; +- (void) unhide; +- (void) beep; +- (void) bounce; +- (void) setCustomUserAgent:(NSString *)userAgentString; +- (NSNumber*) systemIdleTime; +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.m new file mode 100644 index 00000000..6d47a17e --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/App.m @@ -0,0 +1,128 @@ +#import "App.h" + +#import "JSEventHelper.h" + +@implementation App + +@synthesize webView; + +- (id) initWithWebView:(WebView *) view{ + self = [super init]; + + if (self) { + self.webView = view; + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self + selector: @selector(receiveSleepNotification:) + name: NSWorkspaceWillSleepNotification object: NULL]; + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self + selector: @selector(receiveWakeNotification:) + name: NSWorkspaceDidWakeNotification object: NULL]; + [[[NSWorkspace sharedWorkspace] notificationCenter] addObserver: self + selector: @selector(receiveActivateNotification:) + name: NSWorkspaceDidActivateApplicationNotification object: NULL]; + } + + return self; +} + +- (void) terminate { + [NSApp terminate:nil]; +} + +- (void) activate { + [NSApp activateIgnoringOtherApps:YES]; +} + +- (void) hide { + [NSApp hide:nil]; +} + +- (void) unhide { + [NSApp unhide:nil]; +} + +- (void)beep { + NSBeep(); +} + +- (void) bounce { + [NSApp requestUserAttention:NSInformationalRequest]; +} + +- (void)setCustomUserAgent:(NSString *)userAgentString { + [self.webView setCustomUserAgent: userAgentString]; +} + +- (void) open:(NSString*)url { + [[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:url]]; +} + +- (void) launch:(NSString *)name { + [[NSWorkspace sharedWorkspace] launchApplication:name]; +} + +- (void)receiveSleepNotification:(NSNotification*)note{ + [JSEventHelper triggerEvent:@"sleep" forWebView:self.webView]; +} + +- (void) receiveWakeNotification:(NSNotification*)note{ + [JSEventHelper triggerEvent:@"wake" forWebView:self.webView]; +} + +- (void) receiveActivateNotification:(NSNotification*)notification{ + NSDictionary* userInfo = [notification userInfo]; + NSRunningApplication* runningApplication = [userInfo objectForKey:NSWorkspaceApplicationKey]; + if (runningApplication) { + NSMutableDictionary* applicationDidGetFocusDict = [[NSMutableDictionary alloc] initWithCapacity:2]; + [applicationDidGetFocusDict setObject:runningApplication.localizedName + forKey:@"localizedName"]; + [applicationDidGetFocusDict setObject:[runningApplication.bundleURL absoluteString] + forKey:@"bundleURL"]; + + [JSEventHelper triggerEvent:@"appActivated" withArgs:applicationDidGetFocusDict forWebView:self.webView]; + } +} + + + + +/* + To get the elapsed time since the previous input event—keyboard, mouse, or tablet—specify kCGAnyInputEventType. + */ +- (NSNumber*)systemIdleTime { + CFTimeInterval timeSinceLastEvent = CGEventSourceSecondsSinceLastEventType(kCGEventSourceStateHIDSystemState, kCGAnyInputEventType); + + return [NSNumber numberWithDouble:timeSinceLastEvent]; +} + + + + ++ (NSString*) webScriptNameForSelector:(SEL)selector +{ + id result = nil; + + if (selector == @selector(open:)) { + result = @"open"; + } else if (selector == @selector(launch:)) { + result = @"launch"; + } else if (selector == @selector(setCustomUserAgent:)) { + result = @"setCustomUserAgent"; + } else if (selector == @selector(systemIdleTime)) { + result = @"systemIdleTime"; + } + + return result; +} + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return NO; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.h new file mode 100755 index 00000000..65d6b6d4 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.h @@ -0,0 +1,18 @@ +// +// Command.h +// MacGap +// +// Created by Joe Hildebrand on 1/10/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import +#import + +@interface Command : NSObject { + JSContextRef context; +} + +- (id) initWithContext:(JSContextRef)aContext; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.m new file mode 100755 index 00000000..39b85630 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Command.m @@ -0,0 +1,28 @@ +// +// Command.m +// MacGap +// +// Created by Joe Hildebrand on 1/10/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "Command.h" +#import + +@implementation Command + +- (id) initWithContext:(JSContextRef)aContext { + self = [super init]; + if (!self) + return nil; + context = aContext; + JSGlobalContextRetain((JSGlobalContextRef)context); + return self; +} + +- (void)dealloc +{ + if (context) + JSGlobalContextRelease((JSGlobalContextRef)context); +} +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.h new file mode 100644 index 00000000..b3c533d7 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.h @@ -0,0 +1,11 @@ +#import + +@interface Dock : NSObject { + +} +- (void) setBadge:(NSString*)value; +- (NSString *) badge; + +@property (readwrite, copy) NSString *badge; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.m new file mode 100644 index 00000000..a4494d16 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Dock.m @@ -0,0 +1,31 @@ +#import "Dock.h" + +@implementation Dock + +@synthesize badge; + +- (void) setBadge:(NSString *)value +{ + NSDockTile *tile = [[NSApplication sharedApplication] dockTile]; + [tile setBadgeLabel:value]; +} + +- (NSString *) badge +{ + NSDockTile *tile = [[NSApplication sharedApplication] dockTile]; + return [tile badgeLabel]; +} + +#pragma mark WebScripting Protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return NO; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return NO; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.h new file mode 100755 index 00000000..d765978f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.h @@ -0,0 +1,31 @@ +// +// MenuItemProxy.h +// MacGap +// +// Created by Joe Hildebrand on 1/15/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "Command.h" +#import "CallbackDelegate.h" + +@class MenuProxy; + +@interface MenuItemProxy : Command { + NSMenuItem *item; + CallbackDelegate *callback; +} + ++ (MenuItemProxy*) proxyWithContext:(JSContextRef)aContext andMenuItem:(NSMenuItem*)anItem; + +- (MenuProxy*)addSubmenu; + +- (void) remove; +- (void) setCallback:(WebScriptObject*)aCallback; +- (void) setKey:(NSString*)keyCommand; +- (void) setTitle:(NSString*)title; +- (void) enable; +- (void) disable; +- (MenuProxy*)submenu; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.m new file mode 100755 index 00000000..7b9702cc --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuItemProxy.m @@ -0,0 +1,150 @@ +// +// MenuItemProxy.m +// MacGap +// +// Created by Joe Hildebrand on 1/15/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "MenuItemProxy.h" +#import "MenuProxy.h" + +@implementation MenuItemProxy + +- (id) initWithContext:(JSContextRef)aContext andMenuItem:(NSMenuItem*)anItem +{ + NSAssert(anItem, @"anItem required"); + self = [super initWithContext:aContext]; + if (!self) + return nil; + item = anItem; + item.representedObject = self; + + return self; +} + ++ (MenuItemProxy*) proxyWithContext:(JSContextRef)aContext andMenuItem:(NSMenuItem*)anItem +{ + MenuItemProxy *proxy = [anItem representedObject]; + if (proxy) + { + NSLog(@"MIP Cache hit"); + NSAssert([proxy class] == [MenuItemProxy class], @"Bad proxy"); + return proxy; + } + return [[MenuItemProxy alloc] initWithContext:aContext andMenuItem:anItem]; +} + +- (NSString*) description +{ + return [item description]; +} + +- (MenuProxy*)addSubmenu +{ + NSMenu *s = [item submenu]; + if (!s) + { + s = [[NSMenu alloc] initWithTitle:@"FFFFFFOOOOO"]; + [item setSubmenu:s]; + } + return [MenuProxy proxyWithContext:context andMenu:s]; +} + +- (void) remove +{ + NSMenu *menu = [item menu]; + [menu removeItem:item]; +} + +- (void)callCallback:(id)sender +{ + [callback callWithParams:[sender title], nil]; +} + +- (void) setCallback:(WebScriptObject*)aCallback +{ + NSAssert(item, @"item required"); + callback = [[CallbackDelegate alloc] initWithContext:context forCallback:aCallback]; + [item setAction:@selector(callCallback:)]; + [item setTarget:self]; +} + +- (void)setKey:(NSString*)keyCommand +{ + NSString *aKey = [MenuProxy getKeyFromString:keyCommand]; + [item setKeyEquivalent:aKey]; + + NSUInteger modifiers = [MenuProxy getModifiersFromString:keyCommand]; + [item setKeyEquivalentModifierMask:modifiers]; +} + +- (void) setTitle:(NSString*)title +{ + [item setTitle:title]; +} + +- (MenuProxy*)submenu; +{ + // TODO: make this work as a property + NSMenu *s = [item submenu]; + if (!s) + return nil; + return [MenuProxy proxyWithContext:context andMenu:s]; +} + +- (void) enable +{ + [item setEnabled:YES]; +} + +- (void) disable +{ + [item setEnabled:NO]; +} + +#pragma mark WebScripting protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return [self webScriptNameForSelector:selector] == nil; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector +{ + id result = nil; + + if (selector == @selector(addSubmenu)) { + result = @"addSubmenu"; + } + else if (selector == @selector(remove)) { + result = @"remove"; + } + else if (selector == @selector(setCallback:)) { + result = @"setCallback"; + } + else if (selector == @selector(setKey:)) { + result = @"setKey"; + } + else if (selector == @selector(setTitle:)) { + result = @"setTitle"; + } + else if (selector == @selector(submenu)) { + result = @"submenu"; + } + else if (selector == @selector(enable)) { + result = @"enable"; + } + else if (selector == @selector(disable)) { + result = @"disable"; + } + + return result; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.h new file mode 100755 index 00000000..afd6c6ed --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.h @@ -0,0 +1,31 @@ +// +// MenuProxy.h +// MacGap +// +// Created by Joe Hildebrand on 1/14/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "Command.h" + +@class MenuItemProxy; + +@interface MenuProxy : Command { + NSMenu *menu; +} + ++ (MenuProxy*)proxyWithContext:(JSContextRef)aContext andMenu:(NSMenu*)aMenu; + +- (MenuItemProxy*)addItemWithTitle:(NSString*)title + keyEquivalent:(NSString*)aKey + callback:(WebScriptObject*)aCallback + atIndex:(NSInteger)index; + +- (MenuItemProxy*)addSeparator; +- (MenuItemProxy*)itemForKey:(id)key; +- (MenuProxy*)removeItem:(id)key; + ++ (NSString*)getKeyFromString:(NSString*)keyCommand; ++ (NSUInteger*)getModifiersFromString:(NSString*)keyCommand; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.m new file mode 100755 index 00000000..5bc10a76 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/MenuProxy.m @@ -0,0 +1,233 @@ +// +// MenuProxy.m +// MacGap +// +// Created by Joe Hildebrand on 1/14/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import +#import + +#import "MenuProxy.h" +#import "MenuItemProxy.h" + +static char REPRESENTED_OBJECT; + +@interface NSMenu (represented) +@property (strong) id representedObject; +@end + +@implementation NSMenu (represented) + +- (id) representedObject +{ + return objc_getAssociatedObject(self, &REPRESENTED_OBJECT); +} + +- (void) setRepresentedObject:(id)representedObject +{ + objc_setAssociatedObject(self, + &REPRESENTED_OBJECT, + representedObject, + OBJC_ASSOCIATION_RETAIN); +} + +@end + +@implementation MenuProxy + +- (id) initWithContext:(JSContextRef)aContext andMenu:(NSMenu*)aMenu +{ + self = [super initWithContext:aContext]; + if (!self) + return nil; + menu = aMenu; + menu.representedObject = self; + return self; +} + ++ (MenuProxy*)proxyWithContext:(JSContextRef)aContext andMenu:(NSMenu*)aMenu +{ + // singleton-ish. + MenuProxy *ret = [aMenu representedObject]; + if (ret) + { + NSLog(@"MP cache hit"); + return ret; + } + return [[MenuProxy alloc] initWithContext:aContext andMenu:aMenu]; +} + +- (void) dealloc +{ + menu.representedObject = nil; +} + +- (NSString*) description +{ + return [menu description]; +} + +static BOOL isNullish(id o) +{ + if (!o) + return YES; + if ([o isKindOfClass:[WebUndefined class]]) + return YES; + return NO; +} + +- (MenuItemProxy*)addItemWithTitle:(NSString*)title + keyEquivalent:(NSString*)keyCommand + callback:(WebScriptObject*)aCallback + atIndex:(NSInteger)index +{ + if (isNullish(title)) + title = @""; + + NSString *aKey = [MenuProxy getKeyFromString:keyCommand]; + NSMenuItem *item = nil; + + if(index) { + item = [menu insertItemWithTitle:title action:nil keyEquivalent:aKey atIndex:index ]; + } else { + item = [menu addItemWithTitle:title action:nil keyEquivalent:aKey ]; + + } + + // Set the modifiers. + NSUInteger modifiers = [MenuProxy getModifiersFromString:keyCommand]; + [item setKeyEquivalentModifierMask:modifiers]; + + if(!menu.supermenu) { + NSMenu *s = [[NSMenu alloc] initWithTitle:title]; + [item setSubmenu:s]; + } + + MenuItemProxy *mip = [MenuItemProxy proxyWithContext:context andMenuItem:item]; + if (!isNullish(aCallback)) + [mip setCallback:aCallback]; + + + return mip; +} + ++ (NSString*)getKeyFromString:(NSString*)keyCommand { + if (isNullish(keyCommand)) + keyCommand = @""; + + // Obtain the key (if there are modifiers, it will be the last character). + NSString *aKey = @""; + if ([keyCommand length] > 0) { + aKey = [keyCommand substringFromIndex:[keyCommand length] - 1]; + } + + return aKey; +} + ++ (NSUInteger*)getModifiersFromString:(NSString*)keyCommand { + // aKeys may optionally specify one or more modifiers. + NSUInteger modifiers = 0; + + if ([keyCommand rangeOfString:@"caps"].location != NSNotFound) modifiers += NSAlphaShiftKeyMask; + if ([keyCommand rangeOfString:@"shift"].location != NSNotFound) modifiers += NSShiftKeyMask; + if ([keyCommand rangeOfString:@"cmd"].location != NSNotFound) modifiers += NSCommandKeyMask; + if ([keyCommand rangeOfString:@"ctrl"].location != NSNotFound) modifiers += NSControlKeyMask; + if ([keyCommand rangeOfString:@"opt"].location != NSNotFound) modifiers += NSAlternateKeyMask; + if ([keyCommand rangeOfString:@"alt"].location != NSNotFound) modifiers += NSAlternateKeyMask; + + return modifiers; +} + +- (MenuItemProxy*)addSeparator +{ + NSMenuItem *sep = [NSMenuItem separatorItem]; + [menu addItem:sep]; + return [MenuItemProxy proxyWithContext:context andMenuItem:sep]; +} + +- (MenuItemProxy*)itemForKey:(id)key +{ + if (isNullish(key)) + return nil; + NSMenuItem *item = nil; + if ([key isKindOfClass:[NSNumber class]]) + { + item = [menu itemAtIndex:[key intValue]]; + } + else if ([key isKindOfClass:[NSString class]]) + { + item = [menu itemWithTitle:key]; + if (!item) + { + // Try again, with ... appended. e.g. "Save..." + item = [menu itemWithTitle: + [key stringByAppendingString:@"\u2026"]]; + } + } + if (!item) + return nil; + + return [MenuItemProxy proxyWithContext:context andMenuItem:item]; +} + +- (MenuProxy*)removeItem:(id)key +{ + if (isNullish(key)) + return nil; + + NSMenuItem *item = nil; + if ([key isKindOfClass:[NSNumber class]]) + { + item = [menu itemAtIndex:[key intValue]]; + } + else if ([key isKindOfClass:[NSString class]]) + { + item = [menu itemWithTitle:key]; + if (!item) + { + // Try again, with ... appended. e.g. "Save..." + item = [menu itemWithTitle: + [key stringByAppendingString:@"\u2026"]]; + } + } + if (!item) + return nil; + + [menu removeItem:item]; + return [MenuProxy proxyWithContext:context andMenu:menu]; +} + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return [self webScriptNameForSelector:selector] == nil; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector +{ + id result = nil; + + if (selector == @selector(addItemWithTitle:keyEquivalent:callback:atIndex:)) { + result = @"addItem"; + } + else if (selector == @selector(addSeparator)) { + result = @"addSeparator"; + } + else if (selector == @selector(itemForKey:)) { + result = @"getItem"; + } + else if (selector == @selector(removeItem:)) { + result = @"removeMenu"; + } + + return result; +} + + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.h new file mode 100644 index 00000000..51077a43 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.h @@ -0,0 +1,26 @@ +// +// Notice.h +// MacGap +// +// Created by Christian Sullivan on 7/26/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import +#import "WindowController.h" + +#define APP_NOTICE_NOTIFICATION @"Notice" + +@interface Notice : NSObject { + +} + +@property (nonatomic, retain) WebView *webView; + +- (id) initWithWebView:(WebView *)view; +- (void) notify:(NSDictionary*)message; +- (void) close:(NSString*)notificationId; ++ (BOOL) available; + +@end + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.m new file mode 100644 index 00000000..a4095f9f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Notice.m @@ -0,0 +1,108 @@ +// +// Notice.m +// MacGap +// +// Created by Christian Sullivan on 7/26/12. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "Notice.h" + +#import "JSEventHelper.h" + +@implementation Notice + +- (id) initWithWebView:(WebView*)view +{ + if(self = [super init]) { + self.webView = view; + [[NSUserNotificationCenter defaultUserNotificationCenter] setDelegate:self]; + } + return self; +} + +- (void) notify:(NSDictionary *)message { + NSUserNotification *notification = [[NSUserNotification alloc] init]; + [notification setTitle:[message valueForKey:@"title"]]; + [notification setInformativeText:[message valueForKey:@"content"]]; + [notification setDeliveryDate:[NSDate dateWithTimeInterval:0 sinceDate:[NSDate date]]]; + BOOL playSound = true; // optional parameter, false only when {sound: false} + @try { + NSNumber *s = [message valueForKey:@"sound"]; + if ([[s className] isEqual: @"__NSCFBoolean"]) { + playSound = [s boolValue]; + } + } + @catch (NSException *exception) { + } + if (playSound) { + [notification setSoundName:NSUserNotificationDefaultSoundName]; + } + NSString *id = @""; // optional, needed for close + @try { + id = [message valueForKey:@"id"]; + } + @catch (NSException *exception) { + } + [notification setUserInfo:[NSDictionary dictionaryWithObjectsAndKeys:id, @"id", nil]]; + NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; + [center scheduleNotification:notification]; +} + +// close all notifications with id == notificationId or close all notifications if notificationId == "*" +- (void) close:(NSString*)notificationId { + NSUserNotificationCenter *center = [NSUserNotificationCenter defaultUserNotificationCenter]; + for(NSUserNotification * deliveredNote in center.deliveredNotifications) { + if ([notificationId isEqualToString:@"*"] || [deliveredNote.userInfo[@"id"] isEqualToString:notificationId]) { + [center removeDeliveredNotification: deliveredNote]; + } + } +} + ++ (BOOL) available { + if ([NSUserNotificationCenter respondsToSelector:@selector(defaultUserNotificationCenter)]) + return YES; + + return NO; +} + +- (void) userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification +{ + NSString *notificationId = [notification.userInfo valueForKey:@"id"]; + [JSEventHelper triggerEvent:@"macgap.notify.activated" forDetail:notificationId forWebView:self.webView]; +} + +#pragma mark WebScripting Protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + BOOL result = YES; + if (selector == @selector(notify:)) + result = NO; + if (selector == @selector(close:)) + result = NO; + + return result; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector +{ + id result = nil; + + if (selector == @selector(notify:)) { + result = @"notify"; + } + if (selector == @selector(close:)) { + result = @"close"; + } + + return result; +} + +// right now exclude all properties (eg keys) ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.h new file mode 100644 index 00000000..f931340d --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.h @@ -0,0 +1,21 @@ +#import + +@interface Path : NSObject { + +} + +- (NSString *) application; +- (NSString *) resource; +- (NSString *) documents; +- (NSString *) library; +- (NSString *) home; +- (NSString *) temp; + +@property (readonly,copy) NSString* application; +@property (readonly,copy) NSString* resource; +@property (readonly,copy) NSString* documents; +@property (readonly,copy) NSString* library; +@property (readonly,copy) NSString* home; +@property (readonly,copy) NSString* temp; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.m new file mode 100644 index 00000000..8c54100f --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Path.m @@ -0,0 +1,53 @@ +#import "Path.h" + +@implementation Path + +@synthesize application; +@synthesize resource; +@synthesize documents; +@synthesize library; +@synthesize home; +@synthesize temp; + +- (NSString *)application { + return [[NSBundle mainBundle] bundlePath]; +} + +- (NSString *)resource { + return [[NSBundle mainBundle] resourcePath]; +} + +- (NSString *)documents { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + return [paths objectAtIndex:0]; +} + +- (NSString *)library { + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); + NSLog( @"%@", paths ); + return [paths objectAtIndex:0]; +} + +- (NSString *)home { + return NSHomeDirectory(); +} + +- (NSString *)temp { + return NSTemporaryDirectory(); +} + +#pragma mark WebScripting Protocol + +/* checks whether a selector is acceptable to be called from JavaScript */ ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return NO; +} + +// right now exclude all properties (eg keys) ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return NO; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.h new file mode 100644 index 00000000..06707643 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.h @@ -0,0 +1,17 @@ +#import +#import "Command.h" +#import "CallbackDelegate.h" + + +@interface Sound : Command { + +} + +// pending callbacks for sounds being played, to keep +// ARC from freeing them too early +@property (nonatomic, strong) NSMutableSet *pending; + +- (void) play:(NSString*)file onComplete:(WebScriptObject*)callback; +- (void) playSystem:(NSString*)name onComplete:(WebScriptObject*)callback; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.m new file mode 100644 index 00000000..9f4a44db --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/Sound.m @@ -0,0 +1,97 @@ +#import "Sound.h" + + +@interface PlayDelegate : CallbackDelegate { +} + +@property (nonatomic, weak) Sound *sound; + +- (id) initWithContext:(JSContextRef)aContext + forCallback:(WebScriptObject*)aCallback + withSound:(Sound*)aSound; +@end + +@implementation PlayDelegate + +@synthesize sound; + +- (id) initWithContext:(JSContextRef)aContext + forCallback:(WebScriptObject*)aCallback + withSound:(Sound*)aSound +{ + self = [super initWithContext:aContext forCallback:aCallback]; + if (!self) + return nil; + sound = aSound; + return self; +} + +- (void)sound:(NSSound *)aSound didFinishPlaying:(BOOL)finishedPlaying { + [self callWithParams:[aSound name], nil]; + [sound.pending removeObject:self]; +} + +@end + +@implementation Sound + +@synthesize pending; + +- (id) initWithContext:(JSContextRef)aContext { + self = [super initWithContext:aContext]; + if (!self) { + return nil; + } + + pending = [NSMutableSet new]; + return self; +} + +- (void) playSound:(NSSound*)sound onComplete:(WebScriptObject*)callback { + if (callback != (id)[WebUndefined undefined]) { + PlayDelegate *d = [[PlayDelegate alloc] initWithContext:context + forCallback:callback + withSound:self]; + [pending addObject:d]; + [sound setDelegate:d]; + } + [sound play]; +} + +- (void) play:(NSString*)file onComplete:(WebScriptObject*)callback { + NSURL* fileUrl = [NSURL fileURLWithPath:[[Utils sharedInstance] pathForResource:file]]; + DebugNSLog(@"Sound file:%@", [fileUrl description]); + + NSSound* sound = [[NSSound alloc] initWithContentsOfURL:fileUrl byReference:YES]; + [self playSound:sound onComplete:callback]; +} + +- (void) playSystem:(NSString*)name onComplete:(WebScriptObject*)callback { + NSSound *systemSound = [NSSound soundNamed:name]; + [self playSound:systemSound onComplete:callback]; +} + +#pragma mark WebScripting Protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector { + return [self webScriptNameForSelector:selector] == nil; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name { + return YES; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector { + id result = nil; + + if (selector == @selector(play:onComplete:)) { + result = @"play"; + } + else if (selector == @selector(playSystem:onComplete:)) { + result = @"playSystem"; + } + + return result; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.h new file mode 100644 index 00000000..269191b3 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.h @@ -0,0 +1,43 @@ +// +// UserDefaults.h +// MacGap +// +// Created by Jeff Hanbury on 16/04/2014. +// Copyright (c) 2014 Twitter. All rights reserved. +// + +#import + +#import "WindowController.h" + +@interface UserDefaults : NSObject + +@property (nonatomic, retain) WebView *webView; + +- (id) initWithWebView:(WebView *)view; +- (NSString*) getMyDefaults; +- (NSDictionary*) myDefaultsDictionary; +- (void) removeObjectForKey:(NSString*)key; +- (NSArray*) getUserDefaultsKeys; + +- (NSString*) addPrefix:(NSString*)key; + +- (void) setString:(NSString*)key withValue:(NSString*)value; +- (NSString*) getString:(NSString*)key; + +- (void) setInteger:(NSString*)key withValue:(NSString*)value; +- (NSNumber*) getInteger:(NSString*)key; + +- (void) setBool:(NSString*)key withValue:(NSString*)value; +- (NSNumber*) getBool:(NSString*)key; + +- (void) setFloat:(NSString*)key withValue:(NSString*)value; +- (NSNumber*) getFloat:(NSString*)key; + +// Could also be implemented: +//– setObject:forKey: +//– setDouble:forKey: +//– setURL:forKey: + +@end + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.m new file mode 100644 index 00000000..48568710 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/UserDefaults.m @@ -0,0 +1,211 @@ +// +// UserDefaults.m +// MacGap +// +// Created by Jeff Hanbury on 16/04/2014. +// Copyright (c) 2014 Twitter. All rights reserved. +// + +#import "UserDefaults.h" +#import "JSEventHelper.h" + +@interface UserDefaults() { + +} + +-(void) setupNotificationCenter; + +@end + + +@implementation UserDefaults + +- (id) initWithWebView:(WebView *) view{ + self = [super init]; + + if (self) { + self.webView = view; + [self setupNotificationCenter]; + } + + return self; +} + + +-(void) setupNotificationCenter{ + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(defaultsChanged:) + name:NSUserDefaultsDidChangeNotification + object:nil]; +} + +- (void)defaultsChanged:(NSNotification *)notification { + NSDictionary* returnDict = [self myDefaultsDictionary]; + [JSEventHelper triggerEvent:@"userDefaultsChanged" withArgs:returnDict forWebView:self.webView]; +} + +- (NSString*) getMyDefaults { + NSDictionary* myDefaults = [self myDefaultsDictionary]; + + return [[Utils sharedInstance] convertDictionaryToJSON:myDefaults]; +} + +- (NSDictionary*) myDefaultsDictionary { + NSString* prefix = [kWebScriptNamespace stringByAppendingString:@"_"]; + NSMutableDictionary* returnDict = [[NSMutableDictionary alloc] init]; + + // Get the user defaults. + NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; + + // Build up a dictionary containing just the items beginning with our + // prefix. + for (NSString* key in [self getUserDefaultsKeys]) { + if ([key hasPrefix:prefix]) { + id val = [defaults valueForKey:key]; + [returnDict setObject:val forKey:key]; + } + } + + return returnDict; +} + +- (NSArray*) getUserDefaultsKeys { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + return [[prefs dictionaryRepresentation] allKeys]; +} + +- (void) removeObjectForKey:(NSString*)key { + NSString* prefixedKey; + prefixedKey = [self addPrefix:key]; + + [[NSUserDefaults standardUserDefaults] removeObjectForKey:prefixedKey]; + [[NSUserDefaults standardUserDefaults] synchronize]; +} + +// Check we have a standard prefix for JS-modified keys, for security purposes. +// If not, add it. This stops JavaScript from ever being able to modify keys +// it did not create. +- (NSString*) addPrefix:(NSString*)key { + NSString* prefix; + prefix = [kWebScriptNamespace stringByAppendingString:@"_"]; + + if (![key hasPrefix:prefix]) { + key = [prefix stringByAppendingString:key]; + } + return key; +} + +// String + +- (void) setString:(NSString*)key withValue:(NSString*)value { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + NSString* prefixedKey; + prefixedKey = [self addPrefix:key]; + [prefs setObject:value forKey:prefixedKey]; +} + +- (NSString*) getString:(NSString *)key { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + return [prefs stringForKey:key]; +} + +// All the following must convert their type to NSNumber for JavaScript. + +// Integer + +- (void) setInteger:(NSString*)key withValue:(NSString*)value { + NSString* prefixedKey; + prefixedKey = [self addPrefix:key]; + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + NSInteger myInt = [value intValue]; + [prefs setInteger:myInt forKey:prefixedKey]; +} + +- (NSNumber*) getInteger:(NSString *)key { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + return [NSNumber numberWithInteger:[prefs integerForKey:key]]; +} + +// Boolean + +- (void) setBool:(NSString*)key withValue:(NSString*)value { + NSString* prefixedKey; + prefixedKey = [self addPrefix:key]; + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + BOOL myBool = [value boolValue]; + [prefs setBool:myBool forKey:prefixedKey]; +} + +- (NSNumber*) getBool:(NSString *)key { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + return [NSNumber numberWithBool:[prefs boolForKey:key]]; +} + +// Float + +- (void) setFloat:(NSString*)key withValue:(NSString*)value { + NSString* prefixedKey; + prefixedKey = [self addPrefix:key]; + + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + float myFloat = [value floatValue]; + [prefs setFloat:myFloat forKey:prefixedKey]; +} + +- (NSNumber*) getFloat:(NSString *)key { + NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; + return [NSNumber numberWithFloat:[prefs floatForKey:key]]; +} + + +#pragma mark WebScripting Protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector { + return NO; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector { + id result = nil; + + if (selector == @selector(getMyDefaults)) { + result = @"getMyDefaults"; + } + + if (selector == @selector(removeObjectForKey:)) { + result = @"removeObjectForKey"; + } + + else if (selector == @selector(setString:withValue:)) { + result = @"setString"; + } else if (selector == @selector(getString:)) { + result = @"getString"; + } + + else if (selector == @selector(setInteger:withValue:)) { + result = @"setInteger"; + } else if (selector == @selector(getInteger:)) { + result = @"getInteger"; + } + + else if (selector == @selector(setBool:withValue:)) { + result = @"setBool"; + } else if (selector == @selector(getBool:)) { + result = @"getBool"; + } + + else if (selector == @selector(setFloat:withValue:)) { + result = @"setFloat"; + } else if (selector == @selector(getFloat:)) { + result = @"getFloat"; + } + + return result; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name { + return NO; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.h new file mode 100644 index 00000000..62c7b7e8 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.h @@ -0,0 +1,9 @@ +@interface Fonts : NSObject { +} + +- (NSArray*) availableFonts; +- (NSArray*) availableFontFamilies; +- (NSArray*) availableMembersOfFontFamily:(NSString*)fontFamily; +- (CGFloat) defaultLineHeightForFont:(NSString *)theFontName ofSize:(CGFloat)theFontSize; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.m new file mode 100644 index 00000000..b17818a5 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Commands/fonts.m @@ -0,0 +1,48 @@ +#import "fonts.h" + +@implementation Fonts + + +- (NSArray*) availableFonts { + return [[NSFontManager sharedFontManager] availableFonts]; +} + +- (NSArray*) availableFontFamilies { + return [[NSFontManager sharedFontManager] availableFontFamilies]; +} + +- (NSArray*) availableMembersOfFontFamily:(NSString *)fontFamily { + return [[NSFontManager sharedFontManager] availableMembersOfFontFamily:fontFamily]; +} + +- (CGFloat) defaultLineHeightForFont:(NSString*)theFontName ofSize:(CGFloat)theFontSize { + NSFont *theFont = [NSFont fontWithName:theFontName size:theFontSize]; + NSLayoutManager *lm = [[NSLayoutManager alloc] init]; + + return [lm defaultLineHeightForFont:theFont]; +} + + +#pragma mark WebScripting Protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector { + return NO; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector { + id result = nil; + + if (selector == @selector(availableMembersOfFontFamily:)) { + result = @"availableMembersOfFontFamily"; + } else if (selector == @selector(defaultLineHeightForFont:ofSize:)) { + result = @"defaultLineHeightForFont"; + } + + return result; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name { + return NO; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Constants.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Constants.h new file mode 100644 index 00000000..1fe59d6c --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Constants.h @@ -0,0 +1,7 @@ +// Application constants + +#define kStartPage @"http://127.0.0.1:9993/" + +#define kStartFolder @"." + +#define kWebScriptNamespace @"macgap" \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.h new file mode 100644 index 00000000..65890a5e --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.h @@ -0,0 +1,15 @@ +#import +#import + +@class WebViewDelegate; + +@interface ContentView : NSView { + IBOutlet WebView* webView; + WebViewDelegate* delegate; +} + +@property (retain) WebView* webView; +@property (retain) WebViewDelegate* delegate; +@property (strong) IBOutlet NSMenu *mainMenu; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.m new file mode 100644 index 00000000..24e58cd1 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/ContentView.m @@ -0,0 +1,68 @@ +#import "ContentView.h" +#import "WebViewDelegate.h" +#import "AppDelegate.h" +#import "JSEventHelper.h" + +@interface WebPreferences (WebPreferencesPrivate) + - (void)_setLocalStorageDatabasePath:(NSString *)path; + - (void) setLocalStorageEnabled: (BOOL) localStorageEnabled; + - (void) setDatabasesEnabled:(BOOL)databasesEnabled; + - (void) setDeveloperExtrasEnabled:(BOOL)developerExtrasEnabled; + - (void) setWebGLEnabled:(BOOL)webGLEnabled; + - (void) setOfflineWebApplicationCacheEnabled:(BOOL)offlineWebApplicationCacheEnabled; +@end + +@implementation ContentView + +@synthesize webView, delegate, mainMenu; + +- (void) awakeFromNib +{ + WebPreferences *webPrefs = [WebPreferences standardPreferences]; + + NSString *cappBundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]; + NSString *applicationSupportFile = [@"~/Library/Application Support/" stringByExpandingTildeInPath]; + NSString *savePath = [NSString pathWithComponents:[NSArray arrayWithObjects:applicationSupportFile, cappBundleName, @"LocalStorage", nil]]; + [webPrefs _setLocalStorageDatabasePath:savePath]; + [webPrefs setLocalStorageEnabled:YES]; + [webPrefs setDatabasesEnabled:YES]; + [webPrefs setDeveloperExtrasEnabled:[[NSUserDefaults standardUserDefaults] boolForKey: @"developer"]]; + [webPrefs setOfflineWebApplicationCacheEnabled:YES]; + [webPrefs setWebGLEnabled:YES]; + + [self.webView setPreferences:webPrefs]; + + NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage + sharedHTTPCookieStorage]; + [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; + + [self.webView setApplicationNameForUserAgent: @"MacGap"]; + + self.delegate = [[WebViewDelegate alloc] initWithMenu:[NSApp mainMenu]]; + [self.webView setFrameLoadDelegate:self.delegate]; + [self.webView setUIDelegate:self.delegate]; + [self.webView setResourceLoadDelegate:self.delegate]; + [self.webView setDownloadDelegate:self.delegate]; + [self.webView setPolicyDelegate:self.delegate]; + [self.webView setDrawsBackground:NO]; + [self.webView setShouldCloseWithWindow:NO]; + + [self.webView setGroupName:@"MacGap"]; + +} + +- (void) windowResized:(NSNotification*)notification; +{ + NSWindow* window = (NSWindow*)notification.object; + NSSize size = [window frame].size; + + DebugNSLog(@"window width = %f, window height = %f", size.width, size.height); + + bool isFullScreen = (window.styleMask & NSFullScreenWindowMask) == NSFullScreenWindowMask; + int titleBarHeight = isFullScreen ? 0 : [[Utils sharedInstance] titleBarHeight:window]; + + [self.webView setFrame:NSMakeRect(0, 0, size.width, size.height - titleBarHeight)]; + [JSEventHelper triggerEvent:@"orientationchange" forWebView:self.webView]; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.h new file mode 100644 index 00000000..401f3e39 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.h @@ -0,0 +1,20 @@ +// +// Helper.h +// MacGap +// +// Created by Liam Kaufman Simpkins on 12-01-22. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import +#import "WindowController.h" + +@interface JSEventHelper : NSObject + ++ (void) triggerEvent:(NSString *)event forWebView:(WebView *)webView; ++ (void) triggerEvent:(NSString *)event withArgs:(NSDictionary *)args forWebView:(WebView *)webView; ++ (void) triggerEvent:(NSString *)event withArgs:(NSDictionary *)args forObject:(NSString *)objName forWebView:(WebView *)webView; ++ (void) triggerEvent:(NSString *)event forDetail:(NSString *)detail forWebView:(WebView *)webView; ++ (void) triggerEvent:(NSString *)event forDetail:(NSString *)detail forObject:(NSString *)objName forWebView:(WebView *)webView; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.m new file mode 100644 index 00000000..65406b3c --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/JSEventHelper.m @@ -0,0 +1,41 @@ +// +// Helper.m +// MacGap +// +// Created by Liam Kaufman Simpkins on 12-01-22. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import "JSEventHelper.h" + +@implementation JSEventHelper + ++ (void) triggerEvent:(NSString *)event forWebView:(WebView *)webView { + [self triggerEvent:event withArgs:[NSMutableDictionary dictionary] forObject:@"document" forWebView:webView]; +} + ++ (void) triggerEvent:(NSString *)event withArgs:(NSDictionary *)args forWebView:(WebView *)webView { + [self triggerEvent:event withArgs:args forObject:@"document" forWebView:webView]; +} + ++ (void) triggerEvent:(NSString *)event withArgs:(NSDictionary *)args forObject:(NSString *)objName forWebView:(WebView *)webView { + + // Convert args Dictionary to JSON. + NSString* jsonString = [[Utils sharedInstance] convertDictionaryToJSON:args]; + + // Create the event JavaScript and run it. + NSString * str = [NSString stringWithFormat:@"var e = document.createEvent('Events'); e.initEvent('%@', true, false); e.data=%@; %@.dispatchEvent(e); ", event, jsonString, objName]; + [webView stringByEvaluatingJavaScriptFromString:str]; +} + ++ (void) triggerEvent:(NSString *)event forDetail:(NSString *)detail forWebView:(WebView *)webView { + [self triggerEvent:event forDetail:detail forObject:@"document" forWebView:webView]; +} + ++ (void) triggerEvent:(NSString *)event forDetail:(NSString *)detail forObject:(NSString *)objName forWebView:(WebView *)webView { + NSString *detailEscaped = [detail stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]; + NSString *str = [NSString stringWithFormat:@"var e = new CustomEvent('%@', { 'detail': decodeURIComponent(\"%@\") }); %@.dispatchEvent(e); ", event, detailEscaped, objName]; + [webView stringByEvaluatingJavaScriptFromString:str]; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.h new file mode 100644 index 00000000..f573d881 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.h @@ -0,0 +1,20 @@ +#import +#import + +#define DEG_EPS 0.001 +#define fequal(a,b) (fabs((a) - (b)) < DEG_EPS) +#define fequalzero(a) (fabs(a) < DEG_EPS) + +@class LoadingView; + +@interface Utils : NSObject { +} + +- (float) titleBarHeight:(NSWindow*)aWindow; +- (NSString*) pathForResource:(NSString*)resourcepath; +- (NSString*) convertDictionaryToJSON:(NSDictionary*)dict; +- (NSArray*) convertJSarrayToNSArray:(WebScriptObject*)jsArray; + ++ (Utils*) sharedInstance; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.m new file mode 100644 index 00000000..8d85c294 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Utils.m @@ -0,0 +1,93 @@ +#import "Utils.h" +#import + +static Utils* sharedInstance = nil; + +@implementation Utils + +- (float) titleBarHeight:(NSWindow*)aWindow +{ + NSRect frame = [aWindow frame]; + NSRect contentRect = [NSWindow contentRectForFrameRect: frame + styleMask: NSTitledWindowMask]; + + return (frame.size.height - contentRect.size.height); +} + +- (NSString*) pathForResource:(NSString*)resourcepath +{ + NSBundle * mainBundle = [NSBundle mainBundle]; + NSMutableArray *directoryParts = [NSMutableArray arrayWithArray:[resourcepath componentsSeparatedByString:@"/"]]; + NSString *filename = [directoryParts lastObject]; + [directoryParts removeLastObject]; + + NSString *directoryStr = [NSString stringWithFormat:@"%@/%@", kStartFolder, [directoryParts componentsJoinedByString:@"/"]]; + return [mainBundle pathForResource:filename + ofType:@"" + inDirectory:directoryStr]; +} + +- (NSString*) convertDictionaryToJSON:(NSDictionary*)dict { + // Convert defaults Dictionary to JSON. + NSError *error; + NSData *jsonData = [NSJSONSerialization + dataWithJSONObject:dict + options:NSJSONWritingPrettyPrinted // Pass 0 if you don't care about the readability of the generated string + error:&error]; + + NSString *jsonString; + if (! jsonData) { + NSLog(@"Got an error converting to JSON: %@", error); + } + else { + jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + } + + return jsonString; +} + +// Convert JavaScript array (arrives as a WebScriptObject) into an NSArray of strings. +- (NSArray*) convertJSarrayToNSArray:(WebScriptObject*)jsArray { + NSInteger count = [[jsArray valueForKey:@"length"] integerValue]; + + NSMutableArray *args = [NSMutableArray array]; + for (int i = 0; i < count; i++) { + NSString *item = [jsArray webScriptValueAtIndex:i]; + if ([item isKindOfClass:[NSString class]]) { + [args addObject:item]; + } + } + + return args; +} + +#pragma mark - +#pragma mark Singleton methods + ++ (Utils*) sharedInstance +{ + @synchronized(self) + { + if (sharedInstance == nil){ + sharedInstance = [[Utils alloc] init]; + } + } + return sharedInstance; +} + ++ (id) allocWithZone:(NSZone *)zone { + @synchronized(self) { + if (sharedInstance == nil) { + sharedInstance = [super allocWithZone:zone]; + return sharedInstance; // assignment and return on first allocation + } + } + return nil; // on subsequent allocation attempts return nil +} + +- (id) copyWithZone:(NSZone *)zone +{ + return self; +} + +@end \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.h new file mode 100644 index 00000000..49c6da6b --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.h @@ -0,0 +1,49 @@ +#import +#import + +@class Sound; +@class Dock; +@class Growl; +@class Notice; +@class Path; +@class App; +@class Window; +@class Clipboard; +@class Fonts; +@class MenuProxy; +@class UserDefaults; + +@class WindowController; + +@interface WebViewDelegate : NSObject { + Sound* sound; + Dock* dock; + Growl* growl; + Notice* notice; + Path* path; + App* app; + Window* window; + Clipboard* clipboard; + Fonts* fonts; + NSMenu *mainMenu; + UserDefaults* userDefaults; +} + + + +@property (nonatomic, retain) Sound* sound; +@property (nonatomic, retain) Dock* dock; +@property (nonatomic, retain) Growl* growl; +@property (nonatomic, retain) Notice* notice; +@property (nonatomic, retain) Path* path; +@property (nonatomic, retain) App* app; +@property (nonatomic, retain) Window* window; +@property (nonatomic, retain) Clipboard* clipboard; +@property (nonatomic, retain) Fonts* fonts; +@property (nonatomic, retain) MenuProxy* menu; +@property (nonatomic, retain) UserDefaults* userDefaults; + +@property (nonatomic, retain) WindowController *requestedWindow; + +- (id) initWithMenu:(NSMenu*)menu; +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.m new file mode 100644 index 00000000..50578018 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/WebViewDelegate.m @@ -0,0 +1,206 @@ +#import "WebViewDelegate.h" +#import "Sound.h" +#import "Dock.h" +#import "Notice.h" +#import "Path.h" +#import "App.h" +#import "Window.h" +#import "WindowController.h" +#import "Clipboard.h" +#import "Fonts.h" +#import "MenuProxy.h" +#import "UserDefaults.h" + +@implementation WebViewDelegate + +@synthesize sound; +@synthesize dock; +@synthesize growl; +@synthesize notice; +@synthesize path; +@synthesize app; +@synthesize window; +@synthesize requestedWindow; +@synthesize clipboard; +@synthesize fonts; +@synthesize menu; +@synthesize userDefaults; + +- (id) initWithMenu:(NSMenu*)aMenu +{ + self = [super init]; + if (!self) + return nil; + + mainMenu = aMenu; + return self; +} + +- (void) webView:(WebView*)webView didClearWindowObject:(WebScriptObject*)windowScriptObject forFrame:(WebFrame *)frame +{ + JSContextRef context = [frame globalContext]; + if (self.sound == nil) { self.sound = [[Sound alloc] initWithContext:context]; } + if (self.dock == nil) { self.dock = [Dock new]; } + if (self.path == nil) { self.path = [Path new]; } + if (self.clipboard == nil) { self.clipboard = [Clipboard new]; } + if (self.fonts == nil) { self.fonts = [Fonts new]; } + + if (self.notice == nil && [Notice available] == YES) { + self.notice = [[Notice alloc] initWithWebView:webView]; + } + + if (self.app == nil) { + self.app = [[App alloc] initWithWebView:webView]; + } + + if (self.window == nil) { + self.window = [[Window alloc] initWithWebView:webView]; + } + + if (self.menu == nil) { + self.menu = [MenuProxy proxyWithContext:context andMenu:mainMenu]; + } + + if (self.userDefaults == nil) { + self.userDefaults = [[UserDefaults alloc] initWithWebView:webView]; + } + + [windowScriptObject setValue:self forKey:kWebScriptNamespace]; +} + + +- (void)webView:(WebView *)sender runOpenPanelForFileButtonWithResultListener:(id < WebOpenPanelResultListener >)resultListener allowMultipleFiles:(BOOL)allowMultipleFiles{ + + NSOpenPanel * openDlg = [NSOpenPanel openPanel]; + + [openDlg setCanChooseFiles:YES]; + [openDlg setCanChooseDirectories:NO]; + + [openDlg beginWithCompletionHandler:^(NSInteger result){ + if (result == NSFileHandlingPanelOKButton) { + NSArray * files = [[openDlg URLs] valueForKey: @"relativePath"]; + [resultListener chooseFilenames: files]; + } else { + [resultListener cancel]; + } + }]; +} + +- (void) webView:(WebView*)webView addMessageToConsole:(NSDictionary*)message +{ + if (![message isKindOfClass:[NSDictionary class]]) { + return; + } + + NSLog(@"JavaScript console: %@:%@: %@", + [[message objectForKey:@"sourceURL"] lastPathComponent], // could be nil + [message objectForKey:@"lineNumber"], + [message objectForKey:@"message"]); +} + +- (void)webView:(WebView *)sender runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame +{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:@"OK"]; + [alert setMessageText:message]; + [alert setAlertStyle:NSWarningAlertStyle]; + [alert runModal]; +} + +- (BOOL)webView:(WebView *)sender runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WebFrame *)frame +{ + NSAlert *alert = [[NSAlert alloc] init]; + [alert addButtonWithTitle:@"Yes"]; + [alert addButtonWithTitle:@"No"]; + [alert setMessageText:message]; + [alert setAlertStyle:NSWarningAlertStyle]; + + if ([alert runModal] == NSAlertFirstButtonReturn) + return YES; + else + return NO; +} + +/* + By default the size of a database is set to 0 [1]. When a database is being created + it calls this delegate method to get an increase in quota size - or call an error. + PS this method is defined in WebUIDelegatePrivate and may make it difficult, but + not impossible [2], to get an app accepted into the mac app store. + + Further reading: + [1] http://stackoverflow.com/questions/353808/implementing-a-webview-database-quota-delegate + [2] http://stackoverflow.com/questions/4527905/how-do-i-enable-local-storage-in-my-webkit-based-application/4608549#4608549 + */ +- (void)webView:(WebView *)sender frame:(WebFrame *)frame exceededDatabaseQuotaForSecurityOrigin:(id) origin database:(NSString *)databaseIdentifier +{ + static const unsigned long long defaultQuota = 5 * 1024 * 1024; + if ([origin respondsToSelector: @selector(setQuota:)]) { + [origin performSelector:@selector(setQuota:) withObject:[NSNumber numberWithLongLong: defaultQuota]]; + } else { + NSLog(@"could not increase quota for %lld", defaultQuota); + } +} + +- (NSArray *)webView:(WebView *)sender contextMenuItemsForElement:(NSDictionary *)element defaultMenuItems:(NSArray *)defaultMenuItems +{ + NSMutableArray *webViewMenuItems = [defaultMenuItems mutableCopy]; + + if (webViewMenuItems) + { + NSEnumerator *itemEnumerator = [defaultMenuItems objectEnumerator]; + NSMenuItem *menuItem = nil; + while ((menuItem = [itemEnumerator nextObject])) + { + NSInteger tag = [menuItem tag]; + + switch (tag) + { + case WebMenuItemTagOpenLinkInNewWindow: + case WebMenuItemTagDownloadLinkToDisk: + case WebMenuItemTagCopyLinkToClipboard: + case WebMenuItemTagOpenImageInNewWindow: + case WebMenuItemTagDownloadImageToDisk: + case WebMenuItemTagCopyImageToClipboard: + case WebMenuItemTagOpenFrameInNewWindow: + case WebMenuItemTagGoBack: + case WebMenuItemTagGoForward: + case WebMenuItemTagStop: + case WebMenuItemTagOpenWithDefaultApplication: + case WebMenuItemTagReload: + [webViewMenuItems removeObjectIdenticalTo: menuItem]; + } + } + } + + return webViewMenuItems; +} + +- (WebView *)webView:(WebView *)sender createWebViewWithRequest:(NSURLRequest *)request{ + requestedWindow = [[WindowController alloc] initWithRequest:request]; + return requestedWindow.contentView.webView; +} + +- (void)webViewShow:(WebView *)sender{ + [requestedWindow showWindow:sender]; +} + +- (void)webView:(WebView *)webView decidePolicyForNewWindowAction:(NSDictionary *)actionInformation request:(NSURLRequest *)request newFrameName:(NSString *)frameName decisionListener:(id < WebPolicyDecisionListener >)listener +{ + [[NSWorkspace sharedWorkspace] openURL:[request URL]]; + [listener ignore]; +} + +#pragma mark WebScripting protocol + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return YES; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return NO; +} + + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.h b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.h new file mode 100644 index 00000000..f721376e --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.h @@ -0,0 +1,23 @@ +#import + +#import "WindowController.h" + +@interface Window : NSObject{ + CGRect _oldRestoreFrame; +} + +@property (retain, nonatomic) WindowController *windowController; +@property (nonatomic, retain) WebView *webView; + +- (id) initWithWebView:(WebView *)view; +- (void) open:(NSDictionary *)properties; +- (void) move:(NSDictionary *)properties; +- (void) resize:(NSDictionary *) properties; +- (Boolean) isMaximized; +- (CGFloat) getX; +- (CGFloat) getY; +- (void) maximize; +- (void) restore; +- (void) toggleFullscreen; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.m b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.m new file mode 100644 index 00000000..2444f62e --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Classes/Window.m @@ -0,0 +1,94 @@ +#import "Window.h" + +@implementation Window + +@synthesize windowController, webView; + +- (id) initWithWebView:(WebView*)view +{ + if(self = [super init]) { + self.webView = view; + } + return self; +} + +- (void) open:(NSDictionary *)properties +{ + self.windowController = [[WindowController alloc] initWithURL:[properties valueForKey:@"url"]]; + [self.windowController showWindow: [NSApplication sharedApplication].delegate]; + [self.windowController.window makeKeyWindow]; +} + +- (void) minimize { + [[NSApp mainWindow] miniaturize:[NSApp mainWindow]]; +} + +- (void) toggleFullscreen { + [[NSApp mainWindow] toggleFullScreen:[NSApp mainWindow]]; +} + +- (void) maximize { + CGRect a = [NSApp mainWindow].frame; + _oldRestoreFrame = CGRectMake(a.origin.x, a.origin.y, a.size.width, a.size.height); + [[NSApp mainWindow] setFrame:[[NSScreen mainScreen] visibleFrame] display:YES]; +} + +- (Boolean) isMaximized { + NSRect a = [NSApp mainWindow].frame; + NSRect b = [[NSScreen mainScreen] visibleFrame]; + return a.origin.x == b.origin.x && a.origin.y == b.origin.y && a.size.width == b.size.width && a.size.height == b.size.height; +} + +- (CGFloat) getX { + NSRect frame = [self.webView window].frame; + return frame.origin.x; +} + +- (CGFloat) getY { + NSRect frame = [self.webView window].frame; + return frame.origin.y; +} + +- (void) move:(NSDictionary *)properties +{ + NSRect frame = [self.webView window].frame; + frame.origin.x = [[properties valueForKey:@"x"] doubleValue]; + frame.origin.y = [[properties valueForKey:@"y"] doubleValue]; + [[self.webView window] setFrame:frame display:YES]; + +} + +- (void) resize:(NSDictionary *) properties +{ + NSRect frame = [self.webView window].frame; + frame.size.width = [[properties valueForKey:@"width"] doubleValue]; + frame.size.height = [[properties valueForKey:@"height"] doubleValue]; + [[self.webView window] setFrame:frame display:YES]; +} + + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return NO; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector{ + id result = nil; + + if (selector == @selector(open:)) { + result = @"open"; + }else if (selector == @selector(move:)){ + result = @"move"; + }else if (selector == @selector(resize:)){ + result = @"resize"; + } + + return result; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.h b/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.h new file mode 100644 index 00000000..6c1a2f51 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.h @@ -0,0 +1,10 @@ +#import + +@interface Clipboard : NSObject { + +} + +- (void) copy:(NSString*)text; +- (NSString *) paste; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m b/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m new file mode 100644 index 00000000..1c18dea3 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Clipboard.m @@ -0,0 +1,51 @@ +// +// clipboard.m +// MacGap +// +// Created by David Zorychta on 2013-07-22. +// Copyright (c) 2013 Twitter. All rights reserved. +// + +#import "Clipboard.h" + +@implementation Clipboard + +- (void) copy:(NSString*)text { + [[NSPasteboard generalPasteboard] clearContents]; + [[NSPasteboard generalPasteboard] setString:text forType:NSStringPboardType]; +} + +- (NSString *) paste { + NSPasteboard *pasteboard = [NSPasteboard generalPasteboard]; + NSArray *classArray = [NSArray arrayWithObject:[NSString class]]; + NSDictionary *options = [NSDictionary dictionary]; + BOOL ok = [pasteboard canReadObjectForClasses:classArray options:options]; + if (ok) { + NSArray *objectsToPaste = [pasteboard readObjectsForClasses:classArray options:options]; + return (NSString *) [objectsToPaste objectAtIndex:0]; + } + return @""; +} + ++ (NSString*) webScriptNameForSelector:(SEL)selector +{ + id result = nil; + + if (selector == @selector(copy:)) { + result = @"copy"; + } + + return result; +} + ++ (BOOL) isSelectorExcludedFromWebScript:(SEL)selector +{ + return NO; +} + ++ (BOOL) isKeyExcludedFromWebScript:(const char*)name +{ + return YES; +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist new file mode 100644 index 00000000..2031cefc --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist @@ -0,0 +1,34 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ZeroTier One + CFBundleIconFile + application.icns + CFBundleIdentifier + com.zerotier.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ZeroTier One + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSApplicationCategoryType + public.app-category.utilities + LSMinimumSystemVersion + ${MACOSX_DEPLOYMENT_TARGET} + NSMainNibFile + MainMenu + NSPrincipalClass + NSApplication + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Prefix.pch b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Prefix.pch new file mode 100644 index 00000000..ad05e842 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Prefix.pch @@ -0,0 +1,15 @@ +// +// Prefix header for all source files of the 'MacGap' target in the 'MacGap' project +// + +#ifdef __OBJC__ + #ifdef _DEBUG + #define DebugNSLog(format, ...) NSLog(format, ## __VA_ARGS__) + #else + #define DebugNSLog(format, ...) + #endif + + #import + #import "Constants.h" + #import "Utils.h" +#endif diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.h b/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.h new file mode 100644 index 00000000..72927eff --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.h @@ -0,0 +1,13 @@ +#import +#import "ContentView.h" + +@interface WindowController : NSWindowController { + +} + +- (id) initWithURL:(NSString *) url; +- (id) initWithRequest: (NSURLRequest *)request; +@property (retain) NSURL * url; +@property (retain) IBOutlet ContentView *contentView; + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.m b/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.m new file mode 100644 index 00000000..2765a2e3 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/WindowController.m @@ -0,0 +1,54 @@ +#import "WindowController.h" + + +@interface WindowController() { + +} + +-(void) notificationCenter; + +@end + +@implementation WindowController + +@synthesize contentView, url; + +- (id) initWithURL:(NSString *) relativeURL{ + self = [super initWithWindowNibName:@"Window"]; + self.url = [NSURL URLWithString:relativeURL relativeToURL:[[NSBundle mainBundle] resourceURL]]; + + [self.window setFrameAutosaveName:@"MacGapWindow"]; + [self notificationCenter]; + + return self; +} + +-(id) initWithRequest: (NSURLRequest *)request{ + self = [super initWithWindowNibName:@"Window"]; + [self notificationCenter]; + [[self.contentView.webView mainFrame] loadRequest:request]; + + return self; +} + +-(void) notificationCenter{ + [[NSNotificationCenter defaultCenter] addObserver:self.contentView + selector:@selector(windowResized:) + name:NSWindowDidResizeNotification + object:[self window]]; +} + +- (void)windowDidLoad +{ + [super windowDidLoad]; + + if (self.url != nil) { + [self.contentView.webView setMainFrameURL:[self.url absoluteString]]; + } + + + // Implement this method to handle any initialization after your + // window controller's window has been loaded from its nib file. +} + +@end diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Credits.rtf b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Credits.rtf new file mode 100644 index 00000000..6f388f66 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Credits.rtf @@ -0,0 +1,13 @@ +{\rtf1\ansi\ansicpg1252\cocoartf1347\cocoasubrtf570 +{\fonttbl\f0\fswiss\fcharset0 Helvetica;} +{\colortbl;\red255\green255\blue255;} +\vieww9600\viewh8400\viewkind0 +\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720 + +\f0\b\fs24 \cf0 (c)2011-2015 ZeroTier, Inc.\ +Licensed under the GNU GPLv3\ +\ +UI Wrapper MacGap (c) Twitter, Inc.\ +Licensed under the MIT License\ +http://macgap.com/\ +} \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/InfoPlist.strings b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/InfoPlist.strings new file mode 100644 index 00000000..477b28ff --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/MainMenu.xib b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/MainMenu.xib new file mode 100644 index 00000000..998c505a --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/MainMenu.xib @@ -0,0 +1,3404 @@ + + + + 1080 + 14D136 + 7702 + 1347.57 + 758.70 + + com.apple.InterfaceBuilder.CocoaPlugin + 7702 + + + NSCustomObject + NSMenu + NSMenuItem + + + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + + NSApplication + + + FirstResponder + + + NSApplication + + + AppDelegate + + + AMainMenu + + + + ZeroTier One + + 1048576 + 2147483647 + + NSImage + NSMenuCheckmark + + + NSImage + NSMenuMixedState + + submenuAction: + + + ZeroTier One + + + + About ZeroTier One + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Preferences… + , + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Services + + 1048576 + 2147483647 + + + submenuAction: + + + Services + + _NSServicesMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Hide MacGap + h + 1048576 + 2147483647 + + + + + + Hide Others + h + 1572864 + 2147483647 + + + + + + Show All + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Quit ZeroTier One + q + 1048576 + 2147483647 + + + + + _NSAppleMenu + + + + + File + + 1048576 + 2147483647 + + + submenuAction: + + + File + + + + New + n + 1048576 + 2147483647 + + + + + + Open… + o + 1048576 + 2147483647 + + + + + + Open Recent + + 1048576 + 2147483647 + + + submenuAction: + + + Open Recent + + + + Clear Menu + + 1048576 + 2147483647 + + + + + _NSRecentDocumentsMenu + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Close + w + 1048576 + 2147483647 + + + + + + Save… + s + 1048576 + 2147483647 + + + + + + Revert to Saved + + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Page Setup... + P + 1179648 + 2147483647 + + + + + + + Print… + p + 1048576 + 2147483647 + + + + + + + + + Edit + + 1048576 + 2147483647 + + + submenuAction: + + + Edit + + + + Undo + z + 1048576 + 2147483647 + + + + + + Redo + Z + 1179648 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Cut + x + 1048576 + 2147483647 + + + + + + Copy + c + 1048576 + 2147483647 + + + + + + Paste + v + 1048576 + 2147483647 + + + + + + Paste and Match Style + V + 1572864 + 2147483647 + + + + + + Delete + + 1048576 + 2147483647 + + + + + + Select All + a + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Find + + 1048576 + 2147483647 + + + submenuAction: + + + Find + + + + Find… + f + 1048576 + 2147483647 + + + 1 + + + + Find and Replace… + f + 1572864 + 2147483647 + + + 12 + + + + Find Next + g + 1048576 + 2147483647 + + + 2 + + + + Find Previous + G + 1179648 + 2147483647 + + + 3 + + + + Use Selection for Find + e + 1048576 + 2147483647 + + + 7 + + + + Jump to Selection + j + 1048576 + 2147483647 + + + + + + + + + Spelling and Grammar + + 1048576 + 2147483647 + + + submenuAction: + + + Spelling and Grammar + + + + Show Spelling and Grammar + : + 1048576 + 2147483647 + + + + + + Check Document Now + ; + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Check Spelling While Typing + + 1048576 + 2147483647 + + + + + + Check Grammar With Spelling + + 1048576 + 2147483647 + + + + + + Correct Spelling Automatically + + 2147483647 + + + + + + + + + Substitutions + + 1048576 + 2147483647 + + + submenuAction: + + + Substitutions + + + + Show Substitutions + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Smart Copy/Paste + f + 1048576 + 2147483647 + + + 1 + + + + Smart Quotes + g + 1048576 + 2147483647 + + + 2 + + + + Smart Dashes + + 2147483647 + + + + + + Smart Links + G + 1179648 + 2147483647 + + + 3 + + + + Text Replacement + + 2147483647 + + + + + + + + + Transformations + + 2147483647 + + + submenuAction: + + + Transformations + + + + Make Upper Case + + 2147483647 + + + + + + Make Lower Case + + 2147483647 + + + + + + Capitalize + + 2147483647 + + + + + + + + + Speech + + 1048576 + 2147483647 + + + submenuAction: + + + Speech + + + + Start Speaking + + 1048576 + 2147483647 + + + + + + Stop Speaking + + 1048576 + 2147483647 + + + + + + + + + + + + Format + + 2147483647 + + + submenuAction: + + + Format + + + + Font + + 2147483647 + + + submenuAction: + + + Font + + + + Show Fonts + t + 1048576 + 2147483647 + + + + + + Bold + b + 1048576 + 2147483647 + + + 2 + + + + Italic + i + 1048576 + 2147483647 + + + 1 + + + + Underline + u + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Bigger + + + 1048576 + 2147483647 + + + 3 + + + + Smaller + - + 1048576 + 2147483647 + + + 4 + + + + YES + YES + + + 2147483647 + + + + + + Kern + + 2147483647 + + + submenuAction: + + + Kern + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Tighten + + 2147483647 + + + + + + Loosen + + 2147483647 + + + + + + + + + Ligature + + 2147483647 + + + submenuAction: + + + Ligature + + + + Use Default + + 2147483647 + + + + + + Use None + + 2147483647 + + + + + + Use All + + 2147483647 + + + + + + + + + Baseline + + 2147483647 + + + submenuAction: + + + Baseline + + + + Use Default + + 2147483647 + + + + + + Superscript + + 2147483647 + + + + + + Subscript + + 2147483647 + + + + + + Raise + + 2147483647 + + + + + + Lower + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Colors + C + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Copy Style + c + 1572864 + 2147483647 + + + + + + Paste Style + v + 1572864 + 2147483647 + + + + + _NSFontMenu + + + + + Text + + 2147483647 + + + submenuAction: + + + Text + + + + Align Left + { + 1048576 + 2147483647 + + + + + + Center + | + 1048576 + 2147483647 + + + + + + Justify + + 2147483647 + + + + + + Align Right + } + 1048576 + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + Writing Direction + + 2147483647 + + + submenuAction: + + + Writing Direction + + + + YES + Paragraph + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + YES + YES + + + 2147483647 + + + + + + YES + Selection + + 2147483647 + + + + + + CURlZmF1bHQ + + 2147483647 + + + + + + CUxlZnQgdG8gUmlnaHQ + + 2147483647 + + + + + + CVJpZ2h0IHRvIExlZnQ + + 2147483647 + + + + + + + + + YES + YES + + + 2147483647 + + + + + + Show Ruler + + 2147483647 + + + + + + Copy Ruler + c + 1310720 + 2147483647 + + + + + + Paste Ruler + v + 1310720 + 2147483647 + + + + + + + + + + + + View + + 1048576 + 2147483647 + + + submenuAction: + + + View + + + + Show Toolbar + t + 1572864 + 2147483647 + + + + + + Customize Toolbar… + + 1048576 + 2147483647 + + + + + + + + + Window + + 1048576 + 2147483647 + + + submenuAction: + + + Window + + + + Minimize + m + 1048576 + 2147483647 + + + + + + Zoom + + 1048576 + 2147483647 + + + + + + YES + YES + + + 1048576 + 2147483647 + + + + + + Bring All to Front + + 1048576 + 2147483647 + + + + + _NSWindowsMenu + + + + + Help + + 2147483647 + + + submenuAction: + + + Help + + + + ZeroTier One Help + ? + 1048576 + 2147483647 + + + + + _NSHelpMenu + + + + _NSMainMenu + + + + + + + terminate: + + + + 449 + + + + orderFrontStandardAboutPanel: + + + + 142 + + + + delegate + + + + 547 + + + + performMiniaturize: + + + + 37 + + + + arrangeInFront: + + + + 39 + + + + print: + + + + 86 + + + + runPageLayout: + + + + 87 + + + + clearRecentDocuments: + + + + 127 + + + + performClose: + + + + 193 + + + + toggleContinuousSpellChecking: + + + + 222 + + + + undo: + + + + 223 + + + + copy: + + + + 224 + + + + checkSpelling: + + + + 225 + + + + paste: + + + + 226 + + + + stopSpeaking: + + + + 227 + + + + cut: + + + + 228 + + + + showGuessPanel: + + + + 230 + + + + redo: + + + + 231 + + + + selectAll: + + + + 232 + + + + startSpeaking: + + + + 233 + + + + delete: + + + + 235 + + + + performZoom: + + + + 240 + + + + performFindPanelAction: + + + + 241 + + + + centerSelectionInVisibleArea: + + + + 245 + + + + toggleGrammarChecking: + + + + 347 + + + + toggleSmartInsertDelete: + + + + 355 + + + + toggleAutomaticQuoteSubstitution: + + + + 356 + + + + toggleAutomaticLinkDetection: + + + + 357 + + + + saveDocument: + + + + 362 + + + + revertDocumentToSaved: + + + + 364 + + + + runToolbarCustomizationPalette: + + + + 365 + + + + toggleToolbarShown: + + + + 366 + + + + hide: + + + + 367 + + + + hideOtherApplications: + + + + 368 + + + + unhideAllApplications: + + + + 370 + + + + newDocument: + + + + 373 + + + + openDocument: + + + + 374 + + + + raiseBaseline: + + + + 426 + + + + lowerBaseline: + + + + 427 + + + + copyFont: + + + + 428 + + + + subscript: + + + + 429 + + + + superscript: + + + + 430 + + + + tightenKerning: + + + + 431 + + + + underline: + + + + 432 + + + + orderFrontColorPanel: + + + + 433 + + + + useAllLigatures: + + + + 434 + + + + loosenKerning: + + + + 435 + + + + pasteFont: + + + + 436 + + + + unscript: + + + + 437 + + + + useStandardKerning: + + + + 438 + + + + useStandardLigatures: + + + + 439 + + + + turnOffLigatures: + + + + 440 + + + + turnOffKerning: + + + + 441 + + + + toggleAutomaticSpellingCorrection: + + + + 456 + + + + orderFrontSubstitutionsPanel: + + + + 458 + + + + toggleAutomaticDashSubstitution: + + + + 461 + + + + toggleAutomaticTextReplacement: + + + + 463 + + + + uppercaseWord: + + + + 464 + + + + capitalizeWord: + + + + 467 + + + + lowercaseWord: + + + + 468 + + + + pasteAsPlainText: + + + + 486 + + + + performFindPanelAction: + + + + 487 + + + + performFindPanelAction: + + + + 488 + + + + performFindPanelAction: + + + + 489 + + + + showHelp: + + + + 493 + + + + alignCenter: + + + + 518 + + + + pasteRuler: + + + + 519 + + + + toggleRuler: + + + + 520 + + + + alignRight: + + + + 521 + + + + copyRuler: + + + + 522 + + + + alignJustified: + + + + 523 + + + + alignLeft: + + + + 524 + + + + makeBaseWritingDirectionNatural: + + + + 525 + + + + makeBaseWritingDirectionLeftToRight: + + + + 526 + + + + makeBaseWritingDirectionRightToLeft: + + + + 527 + + + + makeTextWritingDirectionNatural: + + + + 528 + + + + makeTextWritingDirectionLeftToRight: + + + + 529 + + + + makeTextWritingDirectionRightToLeft: + + + + 530 + + + + performFindPanelAction: + + + + 535 + + + + delegate + + + + 545 + + + + + + 0 + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 29 + + + + + + + + + + + + + + 19 + + + + + + + + 56 + + + + + + + + 217 + + + + + + + + 83 + + + + + + + + 81 + + + + + + + + + + + + + + + + + 75 + + + + + 78 + + + + + 72 + + + + + 82 + + + + + 124 + + + + + + + + 77 + + + + + 73 + + + + + 79 + + + + + 112 + + + + + 74 + + + + + 125 + + + + + + + + 126 + + + + + 205 + + + + + + + + + + + + + + + + + + + + + + 202 + + + + + 198 + + + + + 207 + + + + + 214 + + + + + 199 + + + + + 203 + + + + + 197 + + + + + 206 + + + + + 215 + + + + + 218 + + + + + + + + 216 + + + + + + + + 200 + + + + + + + + + + + + + 219 + + + + + 201 + + + + + 204 + + + + + 220 + + + + + + + + + + + + + 213 + + + + + 210 + + + + + 221 + + + + + 208 + + + + + 209 + + + + + 57 + + + + + + + + + + + + + + + + + + 58 + + + + + 134 + + + + + 150 + + + + + 136 + + + + + 144 + + + + + 129 + + + + + 143 + + + + + 236 + + + + + 131 + + + + + + + + 149 + + + + + 145 + + + + + 130 + + + + + 24 + + + + + + + + + + + 92 + + + + + 5 + + + + + 239 + + + + + 23 + + + + + 295 + + + + + + + + 296 + + + + + + + + + 297 + + + + + 298 + + + + + 211 + + + + + + + + 212 + + + + + + + + + 195 + + + + + 196 + + + + + 346 + + + + + 348 + + + + + + + + 349 + + + + + + + + + + + + + + 350 + + + + + 351 + + + + + 354 + + + + + 375 + + + + + + + + 376 + + + + + + + + + 377 + + + + + + + + 388 + + + + + + + + + + + + + + + + + + + + + + + 389 + + + + + 390 + + + + + 391 + + + + + 392 + + + + + 393 + + + + + 394 + + + + + 395 + + + + + 396 + + + + + 397 + + + + + + + + 398 + + + + + + + + 399 + + + + + + + + 400 + + + + + 401 + + + + + 402 + + + + + 403 + + + + + 404 + + + + + 405 + + + + + + + + + + + + 406 + + + + + 407 + + + + + 408 + + + + + 409 + + + + + 410 + + + + + 411 + + + + + + + + + + 412 + + + + + 413 + + + + + 414 + + + + + 415 + + + + + + + + + + + 416 + + + + + 417 + + + + + 418 + + + + + 419 + + + + + 450 + + + + + + + + 451 + + + + + + + + + + 452 + + + + + 453 + + + + + 454 + + + + + 457 + + + + + 459 + + + + + 460 + + + + + 462 + + + + + 465 + + + + + 466 + + + + + 485 + + + + + 490 + + + + + + + + 491 + + + + + + + + 492 + + + + + 496 + + + + + + + + 497 + + + + + + + + + + + + + + + + + 498 + + + + + 499 + + + + + 500 + + + + + 501 + + + + + 502 + + + + + 503 + + + + + + + + 504 + + + + + 505 + + + + + 506 + + + + + 507 + + + + + 508 + + + + + + + + + + + + + + + + 509 + + + + + 510 + + + + + 511 + + + + + 512 + + + + + 513 + + + + + 514 + + + + + 515 + + + + + 516 + + + + + 517 + + + + + 534 + + + + + 546 + + + + + + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + + + 547 + + + + + AppDelegate + NSObject + + IBProjectSource + ../MacGap/AppDelegate.h + + + + + + NSApplication + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSApplication.h + + + + NSBrowser + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSBrowser.h + + + + NSControl + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSControl.h + + + + NSDocument + NSObject + + id + id + id + id + id + id + + + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocument.h + + + + NSDocumentController + NSObject + + id + id + id + id + + + + clearRecentDocuments: + id + + + newDocument: + id + + + openDocument: + id + + + saveAllDocuments: + id + + + + IBFrameworkSource + AppKit.framework/Headers/NSDocumentController.h + + + + NSFormatter + NSObject + + IBFrameworkSource + Foundation.framework/Headers/NSFormatter.h + + + + NSMatrix + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSMatrix.h + + + + NSMenu + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenu.h + + + + NSMenuItem + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSMenuItem.h + + + + NSMovieView + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSMovieView.h + + + + NSPopover + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSPopover.h + + + + NSResponder + NSObject + + IBFrameworkSource + AppKit.framework/Headers/NSResponder.h + + + + NSTableView + NSControl + + IBFrameworkSource + AppKit.framework/Headers/NSTableView.h + + + + NSText + NSView + + IBFrameworkSource + AppKit.framework/Headers/NSText.h + + + + NSTextView + NSText + + IBFrameworkSource + AppKit.framework/Headers/NSTextView.h + + + + NSView + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSView.h + + + + NSViewController + NSResponder + + view + NSView + + + view + + view + NSView + + + + IBFrameworkSource + AppKit.framework/Headers/NSViewController.h + + + + NSWindow + NSResponder + + IBFrameworkSource + AppKit.framework/Headers/NSWindow.h + + + + WebView + NSView + + id + id + id + id + id + id + id + id + id + id + id + + + + goBack: + id + + + goForward: + id + + + makeTextLarger: + id + + + makeTextSmaller: + id + + + makeTextStandardSize: + id + + + reload: + id + + + reloadFromOrigin: + id + + + stopLoading: + id + + + takeStringURLFrom: + id + + + toggleContinuousSpellChecking: + id + + + toggleSmartInsertDelete: + id + + + + IBFrameworkSource + WebKit.framework/Headers/WebView.h + + + + + 0 + IBCocoaFramework + NO + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + {12, 12} + {10, 2} + + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Window.xib b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Window.xib new file mode 100644 index 00000000..70d0c57b --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/en.lproj/Window.xib @@ -0,0 +1,337 @@ + + + + 1070 + 11C74 + 1938 + 1138.23 + 567.00 + + YES + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + YES + 1938 + 822 + + + + YES + NSWindowTemplate + NSView + NSCustomObject + WebView + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + WindowController + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{196, 240}, {758, 410}} + 544735232 + Window + NSWindow + + + + + 256 + + YES + + + 274 + + YES + + YES + Apple HTML pasteboard type + Apple PDF pasteboard type + Apple PICT pasteboard type + Apple URL pasteboard type + Apple Web Archive pasteboard type + NSColor pasteboard type + NSFilenamesPboardType + NSStringPboardType + NeXT RTFD pasteboard type + NeXT Rich Text Format v1.0 pasteboard type + NeXT TIFF v4.0 pasteboard type + WebURLsWithTitlesPboardType + public.png + public.url + public.url-name + + + {758, 410} + + + + 2 + _NS:51 + + + + + + YES + + YES + WebKitDefaultFixedFontSize + WebKitDefaultFontSize + WebKitMinimumFontSize + + + YES + + + + + + + YES + YES + + + {758, 410} + + + + + {{0, 0}, {1920, 1178}} + {10000000000000, 10000000000000} + 128 + YES + + + + + YES + + + contentView + + + + 23 + + + + window + + + + 25 + + + + title: contentView.webView.mainFrameTitle + + + + + + title: contentView.webView.mainFrameTitle + title + contentView.webView.mainFrameTitle + 2 + + + 31 + + + + webView + + + + 19 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 1 + + + YES + + + + + + 2 + + + YES + + + + + + 5 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 1.IBPluginDependency + 1.IBWindowTemplateEditedContentRect + 1.NSWindowTemplate.visibleAtLaunch + 2.CustomClassName + 2.IBPluginDependency + 5.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{357, 418}, {480, 270}} + + ContentView + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.WebKitIBPlugin + + + + YES + + + + + + YES + + + + + 31 + + + + YES + + ContentView + NSView + + webView + WebView + + + webView + + webView + WebView + + + + IBProjectSource + ./Classes/ContentView.h + + + + WebView + + reloadFromOrigin: + id + + + reloadFromOrigin: + + reloadFromOrigin: + id + + + + IBProjectSource + ./Classes/WebView.h + + + + WindowController + NSWindowController + + contentView + ContentView + + + contentView + + contentView + ContentView + + + + IBProjectSource + ./Classes/WindowController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/main.m b/ext/mac-ui-macgap1-wrapper/MacGap/main.m new file mode 100644 index 00000000..4ad50ad5 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/main.m @@ -0,0 +1,14 @@ +// +// main.m +// MacGap +// +// Created by Alex MacCaw on 08/01/2012. +// Copyright (c) 2012 Twitter. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) +{ + return NSApplicationMain(argc, (const char **)argv); +} diff --git a/ext/mac-ui-macgap1-wrapper/README.md b/ext/mac-ui-macgap1-wrapper/README.md new file mode 100644 index 00000000..bc69b132 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/README.md @@ -0,0 +1,36 @@ +#MacGap + +The MacGap project provides HTML/JS/CSS developers an Xcode project for developing Native OSX Apps that run in OSX's WebView and take advantage of WebKit technologies. + +The project exposes a JavaScript API for OS X integration, such as displaying native OS X 10.9 notifications. The MacGap project is extremely lightweight and nimble; a blank application is about 980KB. + +### Features: +* tiny compiled app sizes +* Mac App Store compatible +* access to many Mac OS X-specific features + +##Pre-requisites + +MacGap works on OSX 10.6 and later. + +Generate apps with the [macgap generator](http://github.com/maccman/macgap-rb), no compile necessary. + + gem install macgap + + macgap new myapp + macgap build myapp + +##API + +MacGap exposes an object called `macgap` inside JavaScript. You can use it to alter the Dock icon and display Growl notifications, amongst other things. The API is documented in the WIKI on GitHub: https://github.com/maccman/macgap/wiki + + +##Attributes + +MacGap was forked/ported from Phonegap-mac. It's under the same license (MIT). + +##Custom Build + +To build, make sure you have installed the latest Mac OSX Core Library. Download at [http://developer.apple.com/](http://developer.apple.com/). + +Just clone the repository and build in Xcode. The file `public/index.html` is loaded on startup. diff --git a/ext/mac-ui-macgap1-wrapper/application.icns b/ext/mac-ui-macgap1-wrapper/application.icns new file mode 100644 index 00000000..e4bcb281 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/application.icns differ diff --git a/ext/mac-ui-macgap1-wrapper/public/index.html b/ext/mac-ui-macgap1-wrapper/public/index.html new file mode 100644 index 00000000..9fab9325 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/public/index.html @@ -0,0 +1,33 @@ + + + + MacGap + + + + + + + +

MacGap

+ + \ No newline at end of file diff --git a/ui/main.jsx b/ui/main.jsx index 01c300e9..aa4c8bf1 100644 --- a/ui/main.jsx +++ b/ui/main.jsx @@ -1,4 +1,51 @@ +/* + * ZeroTier One - Network Virtualization Everywhere + * Copyright (C) 2011-2015 ZeroTier, Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + * + * -- + * + * ZeroTier may be used and distributed under the terms of the GPLv3, which + * are available at: http://www.gnu.org/licenses/gpl-3.0.html + * + * If you would like to embed ZeroTier into a commercial application or + * redistribute it in a modified binary form, please contact ZeroTier Networks + * LLC. Start here: http://www.zerotier.com/ + */ + +function getUrlParameter(parameter) +{ + var currLocation = window.location.search; + if (currLocation.indexOf('?') < 0) + return ''; + var parArr = currLocation.split("?")[1].split("&"); + for(var i = 0; i < parArr.length; i++){ + parr = parArr[i].split("="); + if (parr[0] == parameter) { + return decodeURIComponent(parr[1]); + } + } + return ''; +} + +var ztAuthToken = getUrlParameter('authToken'); +if ((!ztAuthToken)||(ztAuthToken.length <= 0)) { + ztAuthToken = prompt('No authToken specified in URL. Enter token from\nauthtoken.secret to authorize.'); +} + React.render( - , + , document.getElementById('main') ); -- cgit v1.2.3 From d56e9fce415e5b764091921dd5cedde175fbcf7d Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 6 May 2015 20:45:02 -0700 Subject: Get user data out of repo. --- .gitignore | 1 + .../MacGap.xcodeproj/project.pbxproj | 6 + .../xcshareddata/MacGap.xccheckout | 18 +-- .../api.xcuserdatad/UserInterfaceState.xcuserstate | Bin 18268 -> 19568 bytes .../xcdebugger/Breakpoints.xcbkptlist | 131 ----------------- .../Alex.xcuserdatad/xcschemes/MacGap.xcscheme | 86 ----------- .../xcschemes/xcschememanagement.plist | 22 --- .../xcdebugger/Breakpoints_v2.xcbkptlist | 5 - .../xcdebugger/Breakpoints.xcbkptlist | 161 --------------------- .../liamks.xcuserdatad/xcschemes/MacGap.xcscheme | 84 ----------- .../xcschemes/xcschememanagement.plist | 22 --- .../AppIcon.appiconset/Contents.json | 63 ++++++++ .../AppIcon.appiconset/application128x128.png | Bin 0 -> 11247 bytes .../AppIcon.appiconset/application16x16.png | Bin 0 -> 715 bytes .../AppIcon.appiconset/application256x256.png | Bin 0 -> 29043 bytes .../AppIcon.appiconset/application32x32.png | Bin 0 -> 1787 bytes .../AppIcon.appiconset/application512x512.png | Bin 0 -> 57374 bytes .../MacGap/MacGap-Info.plist | 2 - ext/mac-ui-macgap1-wrapper/README.md | 38 +---- 19 files changed, 83 insertions(+), 556 deletions(-) delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png create mode 100644 ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png diff --git a/.gitignore b/.gitignore index db660e14..f789b3b7 100755 --- a/.gitignore +++ b/.gitignore @@ -39,3 +39,4 @@ /root-topology/*.secret /root-topology/test/supernodes /root-topology/test/test-root-topology +xcuserdata diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj index ea339cf0..9d71cecc 100644 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 88C0646014BDE10A00E4BCE2 /* Window.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0645F14BDE10A00E4BCE2 /* Window.m */; }; 88C0646614BDEC5800E4BCE2 /* Window.xib in Resources */ = {isa = PBXBuildFile; fileRef = 88C0646414BDEC5800E4BCE2 /* Window.xib */; }; 88C0646D14BDF6A600E4BCE2 /* WindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = 88C0646C14BDF6A600E4BCE2 /* WindowController.m */; }; + C13A649D1AFB171100CB31FE /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C13A649C1AFB171100CB31FE /* Images.xcassets */; }; C1C2B9911AFB0CF10060D7C2 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C1C2B9901AFB0CF10060D7C2 /* Security.framework */; }; F2B80016179E0FC100B069A8 /* Clipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = F2B80015179E0FC100B069A8 /* Clipboard.m */; }; FA32509D14BA813600BF0781 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA32509C14BA813600BF0781 /* WebKit.framework */; }; @@ -74,6 +75,7 @@ 88C0646514BDEC5800E4BCE2 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/Window.xib; sourceTree = ""; }; 88C0646B14BDF6A600E4BCE2 /* WindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowController.h; sourceTree = ""; }; 88C0646C14BDF6A600E4BCE2 /* WindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WindowController.m; sourceTree = ""; }; + C13A649C1AFB171100CB31FE /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; C1C2B9901AFB0CF10060D7C2 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; F2B80014179E0FC100B069A8 /* Clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Clipboard.h; sourceTree = ""; }; F2B80015179E0FC100B069A8 /* Clipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Clipboard.m; sourceTree = ""; }; @@ -227,6 +229,7 @@ FAE451D114BA79C600190544 /* AppDelegate.m */, FAE451D314BA79C600190544 /* MainMenu.xib */, 88C0646414BDEC5800E4BCE2 /* Window.xib */, + C13A649C1AFB171100CB31FE /* Images.xcassets */, FAE451C514BA79C600190544 /* Supporting Files */, ); path = MacGap; @@ -299,6 +302,7 @@ files = ( FA3250E514BA883A00BF0781 /* public in Resources */, FAE451C914BA79C600190544 /* InfoPlist.strings in Resources */, + C13A649D1AFB171100CB31FE /* Images.xcassets in Resources */, FAE451CF14BA79C600190544 /* Credits.rtf in Resources */, FAE451D514BA79C600190544 /* MainMenu.xib in Resources */, FA3250E714BA8BCE00BF0781 /* application.icns in Resources */, @@ -426,6 +430,7 @@ FAE451D914BA79C600190544 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; COMBINE_HIDPI_IMAGES = YES; @@ -447,6 +452,7 @@ FAE451DA14BA79C600190544 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "compiler-default"; CLANG_CXX_LIBRARY = "compiler-default"; COMBINE_HIDPI_IMAGES = YES; diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout index b2ea215d..2a06dbc5 100644 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout +++ b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcshareddata/MacGap.xccheckout @@ -10,31 +10,31 @@ MacGap IDESourceControlProjectOriginsDictionary - 60776BB1B4F98ABFCF3BD8223221516D7FB415ED - https://github.com/MacGapProject/MacGap1.git + ABA3617E9F0148F844A82502F0D808DE6591AA97 + http://adam.ierymenko@git.int.zerotier.com/zerotier/zerotierone IDESourceControlProjectPath - MacGap.xcodeproj + ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj IDESourceControlProjectRelativeInstallPathDictionary - 60776BB1B4F98ABFCF3BD8223221516D7FB415ED - ../.. + ABA3617E9F0148F844A82502F0D808DE6591AA97 + ../../../.. IDESourceControlProjectURL - https://github.com/MacGapProject/MacGap1.git + http://adam.ierymenko@git.int.zerotier.com/zerotier/zerotierone IDESourceControlProjectVersion 111 IDESourceControlProjectWCCIdentifier - 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + ABA3617E9F0148F844A82502F0D808DE6591AA97 IDESourceControlProjectWCConfigurations IDESourceControlRepositoryExtensionIdentifierKey public.vcs.git IDESourceControlWCCIdentifierKey - 60776BB1B4F98ABFCF3BD8223221516D7FB415ED + ABA3617E9F0148F844A82502F0D808DE6591AA97 IDESourceControlWCCName - MacGap1 + ZeroTierOne diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate index 04ade238..6dfcf6d0 100644 Binary files a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate and b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist deleted file mode 100644 index 38f66126..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme deleted file mode 100644 index 0aaad582..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/MacGap.xcscheme +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 921f1a6f..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/Alex.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - MacGap.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - FAE451B914BA79C600190544 - - primary - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist deleted file mode 100644 index fe2b4541..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +++ /dev/null @@ -1,5 +0,0 @@ - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist deleted file mode 100644 index 8e541eab..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme deleted file mode 100644 index 872d6d7d..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/MacGap.xcscheme +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 921f1a6f..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/liamks.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - MacGap.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - FAE451B914BA79C600190544 - - primary - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..2592eae9 --- /dev/null +++ b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,63 @@ +{ + "images" : [ + { + "idiom" : "mac", + "scale" : "2x", + "size" : "16x16" + }, + { + "size" : "16x16", + "idiom" : "mac", + "filename" : "application16x16.png", + "scale" : "1x" + }, + { + "size" : "32x32", + "idiom" : "mac", + "filename" : "application32x32.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "32x32" + }, + { + "size" : "128x128", + "idiom" : "mac", + "filename" : "application128x128.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "128x128" + }, + { + "size" : "256x256", + "idiom" : "mac", + "filename" : "application256x256.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "256x256" + }, + { + "size" : "512x512", + "idiom" : "mac", + "filename" : "application512x512.png", + "scale" : "1x" + }, + { + "idiom" : "mac", + "scale" : "2x", + "size" : "512x512" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png new file mode 100644 index 00000000..93dd80a1 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application128x128.png differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png new file mode 100644 index 00000000..3aa19da6 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application16x16.png differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png new file mode 100644 index 00000000..c30106b7 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application256x256.png differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png new file mode 100644 index 00000000..05ff6cb8 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application32x32.png differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png new file mode 100644 index 00000000..b6b9da61 Binary files /dev/null and b/ext/mac-ui-macgap1-wrapper/MacGap/Images.xcassets/AppIcon.appiconset/application512x512.png differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist index 2031cefc..3730da8f 100644 --- a/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist +++ b/ext/mac-ui-macgap1-wrapper/MacGap/MacGap-Info.plist @@ -6,8 +6,6 @@ en CFBundleExecutable ZeroTier One - CFBundleIconFile - application.icns CFBundleIdentifier com.zerotier.$(PRODUCT_NAME:rfc1034identifier) CFBundleInfoDictionaryVersion diff --git a/ext/mac-ui-macgap1-wrapper/README.md b/ext/mac-ui-macgap1-wrapper/README.md index bc69b132..daf3eae9 100644 --- a/ext/mac-ui-macgap1-wrapper/README.md +++ b/ext/mac-ui-macgap1-wrapper/README.md @@ -1,36 +1,6 @@ -#MacGap +Mac Web UI Wrapper +====== -The MacGap project provides HTML/JS/CSS developers an Xcode project for developing Native OSX Apps that run in OSX's WebView and take advantage of WebKit technologies. +This is a modified version of MacGap1 which launches a WebKit view and accesses the local ZeroTier service at its web URL. It builds the URL from the authtoken.secret file in the system home (or the user home) and the zerotier-one.port file that ZeroTier creates to advertise its control port. -The project exposes a JavaScript API for OS X integration, such as displaying native OS X 10.9 notifications. The MacGap project is extremely lightweight and nimble; a blank application is about 980KB. - -### Features: -* tiny compiled app sizes -* Mac App Store compatible -* access to many Mac OS X-specific features - -##Pre-requisites - -MacGap works on OSX 10.6 and later. - -Generate apps with the [macgap generator](http://github.com/maccman/macgap-rb), no compile necessary. - - gem install macgap - - macgap new myapp - macgap build myapp - -##API - -MacGap exposes an object called `macgap` inside JavaScript. You can use it to alter the Dock icon and display Growl notifications, amongst other things. The API is documented in the WIKI on GitHub: https://github.com/maccman/macgap/wiki - - -##Attributes - -MacGap was forked/ported from Phonegap-mac. It's under the same license (MIT). - -##Custom Build - -To build, make sure you have installed the latest Mac OSX Core Library. Download at [http://developer.apple.com/](http://developer.apple.com/). - -Just clone the repository and build in Xcode. The file `public/index.html` is loaded on startup. +It's based on the original MacGap1 source by Twitter, Inc. which is licensed under the MIT license. -- cgit v1.2.3 From 4426899e8c9469518325f39f173151b3535ac20e Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 6 May 2015 21:02:59 -0700 Subject: Add support for local user account caching of authtoken.secret as in old UI -- this is now pretty much working. --- .gitignore | 2 +- .../api.xcuserdatad/UserInterfaceState.xcuserstate | Bin 19568 -> 0 bytes .../api.xcuserdatad/xcschemes/MacGap.xcscheme | 88 ------------ .../xcschemes/xcschememanagement.plist | 22 --- ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m | 153 +++++++++++++-------- 5 files changed, 95 insertions(+), 170 deletions(-) delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme delete mode 100644 ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist diff --git a/.gitignore b/.gitignore index f789b3b7..4a24c4db 100755 --- a/.gitignore +++ b/.gitignore @@ -39,4 +39,4 @@ /root-topology/*.secret /root-topology/test/supernodes /root-topology/test/test-root-topology -xcuserdata +/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/* diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate deleted file mode 100644 index 6dfcf6d0..00000000 Binary files a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/project.xcworkspace/xcuserdata/api.xcuserdatad/UserInterfaceState.xcuserstate and /dev/null differ diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme deleted file mode 100644 index 2555dc89..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/MacGap.xcscheme +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist b/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist deleted file mode 100644 index 921f1a6f..00000000 --- a/ext/mac-ui-macgap1-wrapper/MacGap.xcodeproj/xcuserdata/api.xcuserdatad/xcschemes/xcschememanagement.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - SchemeUserState - - MacGap.xcscheme - - orderHint - 0 - - - SuppressBuildableAutocreation - - FAE451B914BA79C600190544 - - primary - - - - - diff --git a/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m index 96a3e820..3e25ca13 100644 --- a/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m +++ b/ext/mac-ui-macgap1-wrapper/MacGap/AppDelegate.m @@ -7,6 +7,8 @@ // #import "AppDelegate.h" +#include +#include @implementation AppDelegate @@ -29,75 +31,108 @@ } - (void) applicationDidFinishLaunching:(NSNotification *)aNotification { - // Create authorization reference - OSStatus status; - AuthorizationRef authorizationRef; - - // AuthorizationCreate and pass NULL as the initial - // AuthorizationRights set so that the AuthorizationRef gets created - // successfully, and then later call AuthorizationCopyRights to - // determine or extend the allowable rights. - // http://developer.apple.com/qa/qa2001/qa1172.html - status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef); - if (status != errAuthorizationSuccess) - { - NSLog(@"Error Creating Initial Authorization: %d", status); - return; - } - - // kAuthorizationRightExecute == "system.privilege.admin" - AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0}; - AuthorizationRights rights = {1, &right}; - AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | - kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; - - // Call AuthorizationCopyRights to determine or extend the allowable rights. - status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL); - if (status != errAuthorizationSuccess) - { - NSLog(@"Copy Rights Unsuccessful: %d", status); - return; - } - - // use rm tool with -rf - char *tool = "/bin/cat"; - char *args[] = {"/Library/Application Support/ZeroTier/One/authtoken.secret", NULL}; - FILE *pipe = NULL; - - status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, args, &pipe); - if (status != errAuthorizationSuccess) - { - NSLog(@"Error: %d", status); - } - - char url[16384]; - memset(url,0,sizeof(url)); - if (pipe) { - char buf[16384]; + char buf[16384],userAuthTokenPath[4096]; - FILE *pf = fopen("/Library/Application Support/ZeroTier/One/zerotier-one.port","r"); + FILE *pf = fopen("/Library/Application Support/ZeroTier/One/zerotier-one.port","r"); + long port = 9993; // default + if (pf) { long n = fread(buf,1,sizeof(buf)-1,pf); - long port = 9993; // default if (n > 0) { buf[n] = (char)0; port = strtol(buf,(char **)0,10); } fclose(pf); + } - n = (long)fread(buf,1,sizeof(buf)-1,pipe); - if (n > 0) { - buf[n] = (char)0; - snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf); + char url[16384]; + memset(url,0,sizeof(url)); + + const char *homeDir = getenv("HOME"); + if (homeDir) { + snprintf(userAuthTokenPath,sizeof(userAuthTokenPath),"%s/Library/Application Support/ZeroTier/One/authtoken.secret",homeDir); + pf = fopen(userAuthTokenPath,"r"); + if (pf) { + long n = fread(buf,1,sizeof(buf)-1,pf); + if (n > 0) { + buf[n] = (char)0; + snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf); + } + fclose(pf); + } + } + + if (!url[0]) { + // Create authorization reference + OSStatus status; + AuthorizationRef authorizationRef; + + // AuthorizationCreate and pass NULL as the initial + // AuthorizationRights set so that the AuthorizationRef gets created + // successfully, and then later call AuthorizationCopyRights to + // determine or extend the allowable rights. + // http://developer.apple.com/qa/qa2001/qa1172.html + status = AuthorizationCreate(NULL, kAuthorizationEmptyEnvironment, kAuthorizationFlagDefaults, &authorizationRef); + if (status != errAuthorizationSuccess) + { + NSLog(@"Error Creating Initial Authorization: %d", status); + return; + } + + // kAuthorizationRightExecute == "system.privilege.admin" + AuthorizationItem right = {kAuthorizationRightExecute, 0, NULL, 0}; + AuthorizationRights rights = {1, &right}; + AuthorizationFlags flags = kAuthorizationFlagDefaults | kAuthorizationFlagInteractionAllowed | + kAuthorizationFlagPreAuthorize | kAuthorizationFlagExtendRights; + + // Call AuthorizationCopyRights to determine or extend the allowable rights. + status = AuthorizationCopyRights(authorizationRef, &rights, NULL, flags, NULL); + if (status != errAuthorizationSuccess) + { + NSLog(@"Copy Rights Unsuccessful: %d", status); + return; } - fclose(pipe); + + // use rm tool with -rf + char *tool = "/bin/cat"; + char *args[] = {"/Library/Application Support/ZeroTier/One/authtoken.secret", NULL}; + FILE *pipe = NULL; + + status = AuthorizationExecuteWithPrivileges(authorizationRef, tool, kAuthorizationFlagDefaults, args, &pipe); + if (status != errAuthorizationSuccess) + { + NSLog(@"Error: %d", status); + } + + if (pipe) { + long n = (long)fread(buf,1,sizeof(buf)-1,pipe); + if (n > 0) { + buf[n] = (char)0; + snprintf(url,sizeof(url),"http://127.0.0.1:%ld/index.html?authToken=%s",port,buf); + + if (homeDir) { + snprintf(userAuthTokenPath,sizeof(userAuthTokenPath),"%s/Library/Application Support/ZeroTier",homeDir); + mkdir(userAuthTokenPath,0755); + snprintf(userAuthTokenPath,sizeof(userAuthTokenPath),"%s/Library/Application Support/ZeroTier/One",homeDir); + mkdir(userAuthTokenPath,0755); + snprintf(userAuthTokenPath,sizeof(userAuthTokenPath),"%s/Library/Application Support/ZeroTier/One/authtoken.secret",homeDir); + pf = fopen(userAuthTokenPath,"w"); + if (pf) { + fwrite(buf,1,strlen(buf),pf); + fclose(pf); + chmod(userAuthTokenPath,0600); + } + } + } + fclose(pipe); + } + + // The only way to guarantee that a credential acquired when you + // request a right is not shared with other authorization instances is + // to destroy the credential. To do so, call the AuthorizationFree + // function with the flag kAuthorizationFlagDestroyRights. + // http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/02authconcepts/chapter_2_section_7.html + status = AuthorizationFree(authorizationRef, kAuthorizationFlagDestroyRights); } - - // The only way to guarantee that a credential acquired when you - // request a right is not shared with other authorization instances is - // to destroy the credential. To do so, call the AuthorizationFree - // function with the flag kAuthorizationFlagDestroyRights. - // http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/02authconcepts/chapter_2_section_7.html - status = AuthorizationFree(authorizationRef, kAuthorizationFlagDestroyRights); NSString *urlStr = [[NSString alloc] initWithCString:url]; self.windowController = [[WindowController alloc] initWithURL: urlStr]; -- cgit v1.2.3