Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deprecation warnings and increase deployment target to 10.13 for Xcode 14 #150

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ let package = Package(
name: "ShortcutRecorder",
defaultLocalization: "en",
platforms: [
.macOS(.v10_11)
.macOS(.v10_13)
],
products: [
.library(name: "ShortcutRecorder", targets: ["ShortcutRecorder"])
Expand Down
4 changes: 2 additions & 2 deletions ShortcutRecorder.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.13;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = "-fstack-protector";
RUN_CLANG_STATIC_ANALYZER = YES;
Expand Down Expand Up @@ -925,7 +925,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.11;
MACOSX_DEPLOYMENT_TARGET = 10.13;
OTHER_CFLAGS = "-fstack-protector";
RUN_CLANG_STATIC_ANALYZER = YES;
SDKROOT = macosx;
Expand Down
12 changes: 6 additions & 6 deletions Sources/ShortcutRecorder/SRKeyBindingTransformer.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// CC BY 4.0
//

#import <os/trace.h>
#import <os/log.h>

#import "ShortcutRecorder/SRKeyCodeTransformer.h"

Expand Down Expand Up @@ -56,7 +56,7 @@ - (SRShortcut *)transformedValue:(NSString *)aValue

if (keyCodeString.length != 1)
{
os_trace_error("#Error unexpected key symbol");
os_log_error(OS_LOG_DEFAULT, "#Error unexpected key symbol");
return nil;
}

Expand All @@ -79,7 +79,7 @@ - (SRShortcut *)transformedValue:(NSString *)aValue

if (!keyCode)
{
os_trace_error("#Error unexpected key symbol");
os_log_error(OS_LOG_DEFAULT, "#Error unexpected key symbol");
return nil;
}

Expand Down Expand Up @@ -148,22 +148,22 @@ - (NSString *)reverseTransformedValue:(SRShortcut *)aValue
{
if (![aValue isKindOfClass:NSDictionary.class] && ![aValue isKindOfClass:SRShortcut.class])
{
os_trace_error("#Error invalid class of the value");
os_log_error(OS_LOG_DEFAULT, "#Error invalid class of the value");
return nil;
}

NSNumber *keyCode = aValue[SRShortcutKeyKeyCode];
if (![keyCode isKindOfClass:NSNumber.class])
{
os_trace_error("#Error invalid key code");
os_log_error(OS_LOG_DEFAULT, "#Error invalid key code");
return nil;
}

NSString *keyCodeSymbol = [SRASCIISymbolicKeyCodeTransformer.sharedTransformer transformedValue:keyCode];

if (!keyCodeSymbol)
{
os_trace_error("#Error unexpected key code");
os_log_error(OS_LOG_DEFAULT, "#Error unexpected key code");
return nil;
}

Expand Down
40 changes: 20 additions & 20 deletions Sources/ShortcutRecorder/SRKeyCodeTransformer.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// CC BY 4.0
//

#import <os/trace.h>
#import <os/activity.h>
#import <os/log.h>

#import "ShortcutRecorder/SRCommon.h"
#import "ShortcutRecorder/SRShortcut.h"
Expand Down Expand Up @@ -173,7 +173,7 @@ - (nullable NSString *)translateKeyCode:(SRKeyCode)aKeyCode

if (!inputSource)
{
os_trace_error("#Critical Failed to create an input source");
os_log_error(OS_LOG_DEFAULT, "#Critical Failed to create an input source");
return nil;
}

Expand All @@ -191,7 +191,7 @@ - (nullable NSString *)translateKeyCode:(SRKeyCode)aKeyCode
keyCode:aKeyCode];
}
else
os_trace_error("#Error Input source misses an ID");
os_log_error(OS_LOG_DEFAULT, "#Error Input source misses an ID");
}

@synchronized (self)
Expand All @@ -204,11 +204,11 @@ - (nullable NSString *)translateKeyCode:(SRKeyCode)aKeyCode

if (translation)
{
os_trace_debug("Translation cache hit");
os_log_debug(OS_LOG_DEFAULT, "Translation cache hit");
return translation;
}
else
os_trace_debug("Translation cache miss");
os_log_debug(OS_LOG_DEFAULT, "Translation cache miss");
}

CFDataRef layoutData = TISGetInputSourceProperty(inputSource, kTISPropertyUnicodeKeyLayoutData);
Expand All @@ -228,15 +228,15 @@ - (nullable NSString *)translateKeyCode:(SRKeyCode)aKeyCode
chars);
if (error != noErr)
{
os_trace_error("#Error Unable to translate keyCode %hu and modifierFlags %lu: %d",
os_log_error(OS_LOG_DEFAULT, "#Error Unable to translate keyCode %hu and modifierFlags %lu: %d",
aKeyCode,
anImplicitModifierFlags,
error);
return nil;
}
else if (actualLength == 0)
{
os_trace_debug("#Error No translation exists for keyCode %hu and modifierFlags %lu",
os_log_debug(OS_LOG_DEFAULT, "#Error No translation exists for keyCode %hu and modifierFlags %lu",
aKeyCode,
anImplicitModifierFlags);
return nil;
Expand Down Expand Up @@ -287,7 +287,7 @@ - (NSNumber *)keyCodeForTranslation:(NSString *)aTranslation

if (!inputSource)
{
os_trace_error("#Critical Failed to create an input source");
os_log_error(OS_LOG_DEFAULT, "#Critical Failed to create an input source");
return nil;
}

Expand All @@ -297,7 +297,7 @@ - (NSNumber *)keyCodeForTranslation:(NSString *)aTranslation

if (!sourceIdentifier)
{
os_trace_error("#Error Input source misses an ID");
os_log_error(OS_LOG_DEFAULT, "#Error Input source misses an ID");
return nil;
}

Expand All @@ -306,7 +306,7 @@ - (NSNumber *)keyCodeForTranslation:(NSString *)aTranslation
if ([_inputSourceIdentifier isEqualToString:sourceIdentifier])
return _translationToKeyCode[aTranslation];

os_trace_debug("Updating translation -> key code mapping");
os_log_debug(OS_LOG_DEFAULT, "Updating translation -> key code mapping");

__auto_type knownKeyCodes = SRKeyCodeTransformer.knownKeyCodes;
NSMutableDictionary *newTranslationToKeyCode = [NSMutableDictionary dictionaryWithCapacity:knownKeyCodes.count];
Expand Down Expand Up @@ -348,7 +348,7 @@ - (instancetype)init
{
if (self.class == SRKeyCodeTransformer.class)
{
os_trace_error("#Developer #Error Use SRSymbolicKeyCodeTransformer instead");
os_log_error(OS_LOG_DEFAULT, "#Developer #Error Use SRSymbolicKeyCodeTransformer instead");
return SRSymbolicKeyCodeTransformer.sharedTransformer;
}
else
Expand All @@ -359,7 +359,7 @@ - (instancetype)initWithInputSource:(id)anInputSource
{
if (self.class == SRKeyCodeTransformer.class)
{
os_trace_error("#Developer #Error Use SRSymbolicKeyCodeTransformer instead");
os_log_error(OS_LOG_DEFAULT, "#Developer #Error Use SRSymbolicKeyCodeTransformer instead");
return [[SRSymbolicKeyCodeTransformer alloc] initWithInputSource:anInputSource];
}
else
Expand Down Expand Up @@ -774,7 +774,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue
os_activity_initiate("Key Code -> Literal", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid key code");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid key code");
return;
}

Expand Down Expand Up @@ -824,7 +824,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue
os_activity_initiate("Key Code -> Symbol", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid key code");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid key code");
return;
}

Expand Down Expand Up @@ -874,7 +874,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue
os_activity_initiate("Key Code -> ASCII Literal", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid key code");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid key code");
return;
}

Expand All @@ -900,7 +900,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue
os_activity_initiate("ASCII Literal -> Key Code", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSString.class] || !aValue.length)
{
os_trace_error("#Error Invalid ASCII literal");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid ASCII literal");
return;
}

Expand Down Expand Up @@ -1111,7 +1111,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue

if (!result)
{
os_trace_error("#Error Invalid value for reverse transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for reverse transformation");
}

return result;
Expand Down Expand Up @@ -1154,7 +1154,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue
os_activity_initiate("Key Code -> ASCII Symbol", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid key code");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid key code");
return;
}

Expand All @@ -1180,7 +1180,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue
os_activity_initiate("ASCII Symbol -> Key Code", OS_ACTIVITY_FLAG_DEFAULT, ^{
if (![aValue isKindOfClass:NSString.class] || aValue.length > 1)
{
os_trace_error("#Error Invalid ASCII symbol");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid ASCII symbol");
return;
}

Expand Down Expand Up @@ -1336,7 +1336,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue
});

if (!result)
os_trace_error("#Error Invalid value for reverse transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for reverse transformation");

return result;
}
Expand Down
10 changes: 5 additions & 5 deletions Sources/ShortcutRecorder/SRModifierFlagsTransformer.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// CC BY 4.0
//

#import <os/trace.h>
#import <os/log.h>

#import "ShortcutRecorder/SRCommon.h"

Expand Down Expand Up @@ -66,7 +66,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue layoutDirection:(NSUserInterfa
{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid value for transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for transformation");
return nil;
}

Expand Down Expand Up @@ -117,7 +117,7 @@ - (NSString *)transformedValue:(NSNumber *)aValue layoutDirection:(NSUserInterfa
{
if (![aValue isKindOfClass:NSNumber.class])
{
os_trace_error("#Error Invalid value for transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for transformation");
return nil;
}

Expand Down Expand Up @@ -146,7 +146,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue
{
if (![aValue isKindOfClass:NSString.class])
{
os_trace_error("#Error Invalid value for reverse transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for reverse transformation");
return nil;
}

Expand Down Expand Up @@ -174,7 +174,7 @@ - (NSNumber *)reverseTransformedValue:(NSString *)aValue

if (foundInvalidSubstring)
{
os_trace_error("#Error Invalid value for reverse transformation");
os_log_error(OS_LOG_DEFAULT, "#Error Invalid value for reverse transformation");
return nil;
}

Expand Down
Loading