diff --git a/AveNoAnimationsInMailPlugin/AveHookBootstrapper.m b/AveNoAnimationsInMailPlugin/AveHookBootstrapper.m index 795a60c..756c72c 100644 --- a/AveNoAnimationsInMailPlugin/AveHookBootstrapper.m +++ b/AveNoAnimationsInMailPlugin/AveHookBootstrapper.m @@ -14,9 +14,9 @@ @implementation AveHookBootstrapper static BOOL elCapitanOverrideTransactionDurationToZero = NO; -+(BOOL)isElCapitan ++(BOOL)isAtLeastElCapitan { - static BOOL isElCapitan = NO; + static BOOL isAtLeastElCapitan = NO; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ @@ -26,11 +26,31 @@ +(BOOL)isElCapitan NSOperatingSystemVersion version = {0}; version.majorVersion = 10; version.minorVersion = 11; // el cap - isElCapitan = [processInfo isOperatingSystemAtLeastVersion:version]; + isAtLeastElCapitan = [processInfo isOperatingSystemAtLeastVersion:version]; } }); - return isElCapitan; + return isAtLeastElCapitan; +} + + ++(BOOL)isAtLeastSierra +{ + static BOOL isAtLeastSierra = NO; + + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSProcessInfo* processInfo = [NSProcessInfo processInfo]; + if([processInfo respondsToSelector:@selector(isOperatingSystemAtLeastVersion:)]) + { + NSOperatingSystemVersion version = {0}; + version.majorVersion = 10; + version.minorVersion = 12; // sierra + isAtLeastSierra = [processInfo isOperatingSystemAtLeastVersion:version]; + } + }); + + return isAtLeastSierra; } static IMP AveReplaceMethod(Class class, BOOL isMetaClass, SEL sel, id block) { @@ -118,6 +138,22 @@ +(void)aveElCapitanSwizzleComposeWindowControllerPerformSendAnimation }); } +// -[ComposeWindowController _performSendAnimationWithCompletion:](void * self, void * _cmd, void * arg2) { ++(void)aveSierraSwizzleComposeWindowControllerPerformSendAnimationWithCompletion +{ + Class class = NSClassFromString(@"ComposeWindowController"); + SEL sel = @selector(_performSendAnimationWithCompletion:); + __block IMP originalImplementation = AveReplaceInstanceMethod(class, sel, ^(id obj, id block){ + elCapitanOverrideTransactionDurationToZero = YES; + if(originalImplementation != NULL) + { + ((void(*)(id, SEL, id))originalImplementation)(obj, sel, block); + } + + elCapitanOverrideTransactionDurationToZero = NO; + }); +} + +(void)aveElCapitanSwizzlePopoutAnimationController_animateFrom_to_withCompletion { Class class = NSClassFromString(@"PopoutAnimationController"); @@ -226,6 +262,11 @@ -(void)_performSendAnimation } } +- (void)_performSendAnimationWithCompletion:(id)block +{ + NSLog(@"Ave _performSendAnimationWithCompletion: should not be called in our class!"); +} + // this will never be called, but we define it so we can call it in the swizzled // method _performSendAnimation in this class. However, _performSendAnimation will // only be called in the context of DocumentEditor, so -[DocumentEditor _sendAnimationCompleted] @@ -276,7 +317,8 @@ +(void)aveSwizzleWindowTransformAnimation +(void)load { NSLog(@"Ave: Loaded, time to start swizzling"); - if([self isElCapitan]) + + if([self isAtLeastElCapitan]) { [self aveElCapitanSwizzleCATransactionSetAnimationDuration]; [self aveElCapitanSwizzleNSAnimationContextSetDuration]; @@ -285,6 +327,11 @@ +(void)load [self aveElCapitanswizzlePopoutAnimationController_internalTransitionAnimationWithDestination_fadeOut]; [self aveElCapitanSwizzleWindowTransformAnimation__animationDurationForAnimationType]; [self aveElCapitanSwizzleFullScreenWindowController_animateModalWindowClose]; + + if([self isAtLeastSierra]) + { + [self aveSierraSwizzleComposeWindowControllerPerformSendAnimationWithCompletion]; + } } else { diff --git a/AveNoAnimationsInMailPlugin/AveNoAnimationsInMailPlugin-Info.plist b/AveNoAnimationsInMailPlugin/AveNoAnimationsInMailPlugin-Info.plist index 25f11ce..82bf681 100644 --- a/AveNoAnimationsInMailPlugin/AveNoAnimationsInMailPlugin-Info.plist +++ b/AveNoAnimationsInMailPlugin/AveNoAnimationsInMailPlugin-Info.plist @@ -21,11 +21,18 @@ CFBundleSignature ???? CFBundleVersion - 1.2 + 1.3 NSHumanReadableCopyright - Copyright © 2015 AveApps. All rights reserved. + Copyright © 2017 AveApps. All rights reserved. NSPrincipalClass AveHookBootstrapper + Supported10.12PluginCompatibilityUUIDs + + # mail 10.0 (macOS Sierra 10.12) + 36CCB8BB-2207-455E-89BC-B9D6E47ABB5B + # mail 10.2 (macOS Sierra 10.12.2) + 1CD3B36A-0E3B-4A26-8F7E-5BDF96AAC97E + SupportedPluginCompatibilityUUIDs # All Mail UUIDs @@ -76,10 +83,5 @@ # for macOS Sierra 36CCB8BB-2207-455E-89BC-B9D6E47ABB5B - Supported10.12PluginCompatibilityUUIDs - - # mail 10.0 (macOS Sierra 10.12) - 36CCB8BB-2207-455E-89BC-B9D6E47ABB5B - diff --git a/Output/AveNoAnimationsInMailPlugin.mailbundle.zip b/Output/AveNoAnimationsInMailPlugin.mailbundle.zip index 211f3c5..40306ce 100644 Binary files a/Output/AveNoAnimationsInMailPlugin.mailbundle.zip and b/Output/AveNoAnimationsInMailPlugin.mailbundle.zip differ diff --git a/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/Info.plist b/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/Info.plist index e77a0ca..8bc7c65 100644 --- a/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/Info.plist +++ b/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/Info.plist @@ -3,7 +3,7 @@ BuildMachineOSBuild - 15G1004 + 16C68 CFBundleDevelopmentRegion English CFBundleExecutable @@ -25,29 +25,31 @@ MacOSX CFBundleVersion - 1.2 + 1.3 DTCompiler com.apple.compilers.llvm.clang.1_0 DTPlatformBuild - 7D1014 + 8C1002 DTPlatformVersion GM DTSDKBuild - 15E60 + 16C58 DTSDKName - macosx10.11 + macosx10.12 DTXcode - 0731 + 0821 DTXcodeBuild - 7D1014 + 8C1002 NSHumanReadableCopyright - Copyright © 2015 AveApps. All rights reserved. + Copyright © 2017 AveApps. All rights reserved. NSPrincipalClass AveHookBootstrapper Supported10.12PluginCompatibilityUUIDs # mail 10.0 (macOS Sierra 10.12) 36CCB8BB-2207-455E-89BC-B9D6E47ABB5B + # mail 10.2 (macOS Sierra 10.12.2) + 1CD3B36A-0E3B-4A26-8F7E-5BDF96AAC97E SupportedPluginCompatibilityUUIDs diff --git a/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/MacOS/AveNoAnimationsInMailPlugin b/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/MacOS/AveNoAnimationsInMailPlugin index 98adef3..91cfe51 100755 Binary files a/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/MacOS/AveNoAnimationsInMailPlugin and b/Output/AveNoAnimationsInMailPlugin.mailbundle/Contents/MacOS/AveNoAnimationsInMailPlugin differ diff --git a/Output/DisableMailAnimationsForOSX.pkg b/Output/DisableMailAnimationsForOSX.pkg index 1276fe9..3425b85 100644 Binary files a/Output/DisableMailAnimationsForOSX.pkg and b/Output/DisableMailAnimationsForOSX.pkg differ