Fixed auto auth #80

This commit is contained in:
Sunnyyoung 2018-04-26 22:44:46 +08:00
parent 8b434cd666
commit deaee34a86
6 changed files with 28 additions and 22 deletions

View File

@ -10,6 +10,12 @@ DEPENDENCIES:
- JRSwizzle
- YYModel
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- GCDWebServer
- JRSwizzle
- YYModel
SPEC CHECKSUMS:
GCDWebServer: 8d67ee9f634b4bb91eb4b8aee440318a5fc6debd
JRSwizzle: dd5ead5d913a0f29e7f558200165849f006bb1e3
@ -17,4 +23,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: af44d62b300e2c55cb63386ec4be3227b93c7761
COCOAPODS: 1.4.0
COCOAPODS: 1.5.0

View File

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>17D102</string>
<string>17E202</string>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -27,17 +27,17 @@
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>9C40b</string>
<string>9E145</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>17C76</string>
<string>17E189</string>
<key>DTSDKName</key>
<string>macosx10.13</string>
<key>DTXcode</key>
<string>0920</string>
<string>0930</string>
<key>DTXcodeBuild</key>
<string>9C40b</string>
<string>9E145</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017年 Sunnyyoung. All rights reserved.</string>
</dict>

View File

@ -210,7 +210,6 @@
7DF842231F40583F00D42D79 /* Frameworks */,
7DF842241F40583F00D42D79 /* Headers */,
7DF842251F40583F00D42D79 /* Resources */,
B75BB08B5F9B62E8FF4DEE05 /* [CP] Copy Pods Resources */,
7DF842611F40592100D42D79 /* Export Framework */,
);
buildRules = (
@ -267,21 +266,6 @@
/* End PBXResourcesBuildPhase section */
/* Begin PBXShellScriptBuildPhase section */
B75BB08B5F9B62E8FF4DEE05 /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-WeChatTweak/Pods-WeChatTweak-resources.sh\"\n";
showEnvVarsInLog = 0;
};
CB198514792C1F69F3B65026 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -48,6 +48,7 @@ static void __attribute__((constructor)) tweak(void) {
[objc_getClass("AppDelegate") jr_swizzleMethod:NSSelectorFromString(@"applicationDidFinishLaunching:") withMethod:@selector(tweak_applicationDidFinishLaunching:) error:nil];
[objc_getClass("LogoutCGI") jr_swizzleMethod:NSSelectorFromString(@"sendLogoutCGIWithCompletion:") withMethod:@selector(tweak_sendLogoutCGIWithCompletion:) error:nil];
[objc_getClass("AccountService") jr_swizzleMethod:NSSelectorFromString(@"onAuthOKOfUser:withSessionKey:withServerId:autoAuthKey:isAutoAuth:") withMethod:@selector(tweak_onAuthOKOfUser:withSessionKey:withServerId:autoAuthKey:isAutoAuth:) error:nil];
[objc_getClass("AccountService") jr_swizzleMethod:NSSelectorFromString(@"ManualLogout") withMethod:@selector(tweak_ManualLogout) error:nil];
[objc_getClass("MessageService") jr_swizzleMethod:NSSelectorFromString(@"onRevokeMsg:") withMethod:@selector(tweak_onRevokeMsg:) error:nil];
[objc_getClass("CUtility") jr_swizzleClassMethod:NSSelectorFromString(@"HasWechatInstance") withClassMethod:@selector(tweak_HasWechatInstance) error:nil];
[objc_getClass("MASPreferencesWindowController") jr_swizzleMethod:NSSelectorFromString(@"initWithViewControllers:") withMethod:@selector(tweak_initWithViewControllers:) error:nil];
@ -176,6 +177,13 @@ static void __attribute__((constructor)) tweak(void) {
[self tweak_sendLogoutCGIWithCompletion:completion];
}
- (void)tweak_ManualLogout {
BOOL enabledAutoAuth = [[NSUserDefaults standardUserDefaults] boolForKey:WeChatTweakPreferenceAutoAuthKey];
if (!enabledAutoAuth) {
[self tweak_ManualLogout];
}
}
#pragma mark - Preferences Window
- (id)tweak_initWithViewControllers:(NSArray *)arg1 {