Skip to content

Commit

Permalink
Re-enable Sandbox (#287)
Browse files Browse the repository at this point in the history
Merging now to get a couple of important changes onto master.
  • Loading branch information
johnno1962 authored Dec 20, 2020
1 parent f2337bb commit 8a39ac5
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
10 changes: 8 additions & 2 deletions InjectionIII/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by John Holdsworth on 06/11/2017.
// Copyright © 2017 John Holdsworth. All rights reserved.
//
// $Id: //depot/ResidentEval/InjectionIII/AppDelegate.swift#98 $
// $Id: //depot/ResidentEval/InjectionIII/AppDelegate.swift#101 $
//

import Cocoa
Expand Down Expand Up @@ -33,6 +33,7 @@ class AppDelegate : NSObject, NSApplicationDelegate {
@IBOutlet weak var frontItem: NSMenuItem!
@IBOutlet weak var feedbackItem: NSMenuItem!
@IBOutlet weak var lookupItem: NSMenuItem!
@IBOutlet weak var sponsorItem: NSMenuItem!
@IBOutlet var statusItem: NSStatusItem!

var watchedDirectories = Set<String>()
Expand Down Expand Up @@ -63,6 +64,11 @@ class AppDelegate : NSObject, NSApplicationDelegate {
statusItem.isEnabled = true
statusItem.title = ""

if isSandboxed {
sponsorItem.isHidden = true
updateItem.isHidden = true
}

InjectionServer.startServer(INJECTION_ADDRESS)

if !FileManager.default.fileExists(atPath:
Expand Down Expand Up @@ -105,7 +111,7 @@ class AppDelegate : NSObject, NSApplicationDelegate {
}

let nextUpdateCheck = defaults.double(forKey: UserDefaultsUpdateCheck)
if nextUpdateCheck != 0.0 {
if !isSandboxed && nextUpdateCheck != 0.0 {
updateItem.state = .on
if Date.timeIntervalSinceReferenceDate > nextUpdateCheck {
self.updateCheck(nil)
Expand Down
7 changes: 4 additions & 3 deletions InjectionIII/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="16097" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17506"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="16097"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -22,6 +22,7 @@
<outlet property="frontItem" destination="wFq-Rv-gfa" id="MPU-fL-HYl"/>
<outlet property="lookupItem" destination="4Bd-Sy-26q" id="Orx-2R-4gC"/>
<outlet property="remoteItem" destination="of9-Ja-9Yf" id="z57-Ut-oxK"/>
<outlet property="sponsorItem" destination="LVU-Kn-bbK" id="reC-fj-vjS"/>
<outlet property="startItem" destination="vsd-ll-3nr" id="ODN-wa-BTp"/>
<outlet property="statusMenu" destination="V8Q-mq-A2f" id="Epo-HD-J21"/>
<outlet property="traceExclude" destination="K7d-6S-sPe" id="Nde-Aw-W6F"/>
Expand Down Expand Up @@ -663,7 +664,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="335" y="390" width="480" height="360"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="480" height="360"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down Expand Up @@ -962,7 +963,7 @@
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="1940" y="1086" width="376" height="166"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
<view key="contentView" id="Qow-ez-PwQ">
<rect key="frame" x="0.0" y="0.0" width="376" height="166"/>
<autoresizingMask key="autoresizingMask"/>
Expand Down
2 changes: 1 addition & 1 deletion InjectionIII/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundleShortVersionString</key>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleVersion</key>
<string>5627</string>
<string>5633</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion InjectionIII/InjectionIII.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>com.apple.security.app-sandbox</key>
<false/>
<true/>
<key>com.apple.security.files.user-selected.read-only</key>
<true/>
<key>com.apple.security.network.server</key>
Expand Down
9 changes: 4 additions & 5 deletions InjectionIII/UpdateCheck.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// Created by John Holdsworth on 17/09/2020.
// Copyright © 2020 John Holdsworth. All rights reserved.
//
// $Id: //depot/ResidentEval/InjectionIII/UpdateCheck.swift#6 $
// $Id: //depot/ResidentEval/InjectionIII/UpdateCheck.swift#8 $
//

import Foundation
Expand All @@ -14,7 +14,8 @@ extension AppDelegate {

@IBAction func updateCheck(_ sender: NSMenuItem?) {

URLSession(configuration: .default).dataTask(with: URL(string:
URLSession(configuration: .default).dataTask(with:
URL(string:
"https://api.github.com/repos/johnno1962/InjectionIII/releases")!) {
data, response, error in
do {
Expand Down Expand Up @@ -70,9 +71,7 @@ extension AppDelegate {
}
}
else if let error = error {
if appDelegate.isSandboxed {
throw error
}
throw error
}
} catch {
DispatchQueue.main.async {
Expand Down
2 changes: 1 addition & 1 deletion SwiftTrace

0 comments on commit 8a39ac5

Please sign in to comment.