replaced deprecated APIs
This commit is contained in:
parent
5017969ff7
commit
4bb405a5e4
|
@ -852,10 +852,11 @@ bail:
|
||||||
goto bail;
|
goto bail;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ignore leak warning
|
//ignore warning
|
||||||
#pragma clang diagnostic push
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wpointer-to-int-cast"
|
||||||
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
#pragma clang diagnostic ignored "-Warc-performSelector-leaks"
|
||||||
|
|
||||||
//grab connection ID
|
//grab connection ID
|
||||||
objectID = (UInt32)[device performSelector:methodSelector withObject:nil];
|
objectID = (UInt32)[device performSelector:methodSelector withObject:nil];
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="422" height="133"/>
|
<rect key="contentRect" x="196" y="240" width="422" height="133"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="18122" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="21225" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<deployment identifier="macosx"/>
|
<deployment identifier="macosx"/>
|
||||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="18122"/>
|
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="21225"/>
|
||||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<objects>
|
<objects>
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
<rect key="contentRect" x="196" y="240" width="486" height="301"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
|
|
|
@ -161,10 +161,10 @@ extern os_log_t logHandle;
|
||||||
|
|
||||||
//app path
|
//app path
|
||||||
NSURL* appPath = nil;
|
NSURL* appPath = nil;
|
||||||
|
|
||||||
//error
|
|
||||||
NSError* error = nil;
|
|
||||||
|
|
||||||
|
//app config
|
||||||
|
NSWorkspaceOpenConfiguration* configuration = nil;
|
||||||
|
|
||||||
//grab tag
|
//grab tag
|
||||||
action = ((NSButton*)sender).tag;
|
action = ((NSButton*)sender).tag;
|
||||||
|
|
||||||
|
@ -235,21 +235,47 @@ extern os_log_t logHandle;
|
||||||
//init app path
|
//init app path
|
||||||
appPath = [NSURL fileURLWithPath:[@"/Applications" stringByAppendingPathComponent:APP_NAME]];
|
appPath = [NSURL fileURLWithPath:[@"/Applications" stringByAppendingPathComponent:APP_NAME]];
|
||||||
|
|
||||||
//dbg msg
|
//alloc configuration
|
||||||
os_log_debug(logHandle, "now launching: %{public}@", appPath);
|
configuration = [[NSWorkspaceOpenConfiguration alloc] init];
|
||||||
|
|
||||||
|
//set args
|
||||||
|
configuration.arguments = @[INITIAL_LAUNCH];
|
||||||
|
|
||||||
|
//unset recent
|
||||||
|
configuration.addsToRecentItems = NO;
|
||||||
|
|
||||||
|
//dbg msg
|
||||||
|
os_log_debug(logHandle, "now launching: %{public}@", appPath.path);
|
||||||
|
|
||||||
//launch it
|
//launch it
|
||||||
if(nil == [[NSWorkspace sharedWorkspace] launchApplicationAtURL:appPath options:0 configuration:@{NSWorkspaceLaunchConfigurationArguments:@[INITIAL_LAUNCH]} error:&error])
|
[NSWorkspace.sharedWorkspace openApplicationAtURL:appPath configuration:configuration completionHandler:^(NSRunningApplication * _Nullable application, NSError * _Nullable error)
|
||||||
{
|
{
|
||||||
//err msg
|
#pragma unused(application)
|
||||||
os_log_error(logHandle, "ERROR: failed to launch %{public}@ (error: %{public}@)", appPath, error);
|
|
||||||
}
|
//error?
|
||||||
|
if(nil != error)
|
||||||
|
{
|
||||||
|
//err msg
|
||||||
|
os_log_error(logHandle, "ERROR: failed to launch %{public}@ (error: %{public}@)", appPath, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
//close window
|
||||||
|
// triggers cleanup logic
|
||||||
|
dispatch_sync(dispatch_get_main_queue(),
|
||||||
|
^{
|
||||||
|
[self.window close];
|
||||||
|
});
|
||||||
|
|
||||||
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
//close window
|
else
|
||||||
// triggers cleanup logic
|
{
|
||||||
[self.window close];
|
//close window
|
||||||
|
// triggers cleanup logic
|
||||||
|
[self.window close];
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +326,7 @@ extern os_log_t logHandle;
|
||||||
|
|
||||||
//open URL
|
//open URL
|
||||||
// invokes user's default browser
|
// invokes user's default browser
|
||||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:ERRORS_URL]];
|
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:ERRORS_URL]];
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -561,8 +587,12 @@ bail:
|
||||||
//exit on main thread
|
//exit on main thread
|
||||||
dispatch_async(dispatch_get_main_queue(),
|
dispatch_async(dispatch_get_main_queue(),
|
||||||
^{
|
^{
|
||||||
//exit
|
|
||||||
[NSApp terminate:self];
|
//dbg msg
|
||||||
|
os_log_debug(logHandle, "%{public}@ exiting...", [NSProcessInfo.processInfo.arguments.firstObject lastPathComponent]);
|
||||||
|
|
||||||
|
//exit
|
||||||
|
[NSApp terminate:self];
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
<window allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="F0z-JX-Cv5">
|
||||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" texturedBackground="YES"/>
|
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="523" height="237"/>
|
<rect key="contentRect" x="196" y="240" width="523" height="237"/>
|
||||||
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
<rect key="screenRect" x="0.0" y="0.0" width="3440" height="1415"/>
|
||||||
<view key="contentView" id="se5-gp-TjO">
|
<view key="contentView" id="se5-gp-TjO">
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <CommonCrypto/CommonDigest.h>
|
#import <CommonCrypto/CommonDigest.h>
|
||||||
#import <SystemConfiguration/SystemConfiguration.h>
|
#import <SystemConfiguration/SystemConfiguration.h>
|
||||||
|
#import <UniformTypeIdentifiers/UniformTypeIdentifiers.h>
|
||||||
|
|
||||||
/* GLOBALS */
|
/* GLOBALS */
|
||||||
|
|
||||||
|
@ -888,8 +889,8 @@ NSImage* getIconForProcess(NSString* path)
|
||||||
if(YES != [NSFileManager.defaultManager fileExistsAtPath:path])
|
if(YES != [NSFileManager.defaultManager fileExistsAtPath:path])
|
||||||
{
|
{
|
||||||
//set icon to system 'application' icon
|
//set icon to system 'application' icon
|
||||||
icon = [NSWorkspace.sharedWorkspace iconForFileType: NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
icon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"app"]];
|
||||||
|
|
||||||
//set size to 64 @2x
|
//set size to 64 @2x
|
||||||
[icon setSize:NSMakeSize(128, 128)];
|
[icon setSize:NSMakeSize(128, 128)];
|
||||||
|
|
||||||
|
@ -946,8 +947,8 @@ NSImage* getIconForProcess(NSString* path)
|
||||||
if(nil == documentIcon)
|
if(nil == documentIcon)
|
||||||
{
|
{
|
||||||
//load
|
//load
|
||||||
documentIcon = [[NSWorkspace sharedWorkspace] iconForFileType:
|
documentIcon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"txt"]];
|
||||||
NSFileTypeForHFSTypeCode(kGenericDocumentIcon)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//if 'iconForFile' method doesn't find and icon, it returns the system 'document' icon
|
//if 'iconForFile' method doesn't find and icon, it returns the system 'document' icon
|
||||||
|
@ -955,8 +956,7 @@ NSImage* getIconForProcess(NSString* path)
|
||||||
if(YES == [icon isEqual:documentIcon])
|
if(YES == [icon isEqual:documentIcon])
|
||||||
{
|
{
|
||||||
//set icon to system 'application' icon
|
//set icon to system 'application' icon
|
||||||
icon = [[NSWorkspace sharedWorkspace]
|
icon = [NSWorkspace.sharedWorkspace iconForContentType:[UTType typeWithFilenameExtension:@"app"]];
|
||||||
iconForFileType: NSFileTypeForHFSTypeCode(kGenericApplicationIcon)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//'iconForFileType' returns small icons
|
//'iconForFileType' returns small icons
|
||||||
|
|
|
@ -2,4 +2,4 @@ Patrons (2^6+):
|
||||||
Jan Koum, Nick, Shain Singh, Christian Blümlein, Rocky Zadok, Cane Juice, M S
|
Jan Koum, Nick, Shain Singh, Christian Blümlein, Rocky Zadok, Cane Juice, M S
|
||||||
|
|
||||||
Friends of Objective-See:
|
Friends of Objective-See:
|
||||||
Kandji, Jamf, Mosyle, CleanMyMac X, Kolide, Fleet, Palo Alto Networks, SmugMug, Guardian Mobile Firewall, iVerify, Halo Privacy
|
Kandji, Jamf, Mosyle, CleanMyMac X, Kolide, Fleet, Palo Alto Networks, Sophos, SmugMug, Guardian Mobile Firewall, iVerify, Halo Privacy
|
||||||
|
|
Loading…
Reference in New Issue