更新部分代码

更新部分代码
This commit is contained in:
DKJone
2019-01-23 13:29:44 +08:00
parent a9ec53a367
commit 30db0bfdf3
20 changed files with 1612 additions and 127 deletions
+59 -4
View File
@@ -1,6 +1,61 @@
#line 1 "/mycode/github/DKWechatHelper/dkhelper/dkhelperDylib/Logos/dkhelperDylib.xm"
#import <UIKit/UIKit.h>
#import "DKHelper.h"
#import "DKHelperSettingController.h"
// *** DO NOT EDIT THIS FILE! ***
// This file is generated by Logos processing using dkhelperDylib.xm during each build.
// Logos by Dustin Howett
// See http://iphonedevwiki.net/index.php/Logos
#include <substrate.h>
#if defined(__clang__)
#if __has_feature(objc_arc)
#define _LOGOS_SELF_TYPE_NORMAL __unsafe_unretained
#define _LOGOS_SELF_TYPE_INIT __attribute__((ns_consumed))
#define _LOGOS_SELF_CONST const
#define _LOGOS_RETURN_RETAINED __attribute__((ns_returns_retained))
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif
#else
#define _LOGOS_SELF_TYPE_NORMAL
#define _LOGOS_SELF_TYPE_INIT
#define _LOGOS_SELF_CONST
#define _LOGOS_RETURN_RETAINED
#endif
@class WCTableViewNormalCellManager; @class UIViewController; @class NewSettingViewController;
static void (*_logos_orig$_ungrouped$NewSettingViewController$reloadTableData)(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL); static void _logos_method$_ungrouped$NewSettingViewController$reloadTableData(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL); static void _logos_method$_ungrouped$NewSettingViewController$setting(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST, SEL); static void (*_logos_orig$_ungrouped$UIViewController$viewWillAppear$)(_LOGOS_SELF_TYPE_NORMAL UIViewController* _LOGOS_SELF_CONST, SEL, BOOL); static void _logos_method$_ungrouped$UIViewController$viewWillAppear$(_LOGOS_SELF_TYPE_NORMAL UIViewController* _LOGOS_SELF_CONST, SEL, BOOL);
static __inline__ __attribute__((always_inline)) __attribute__((unused)) Class _logos_static_class_lookup$WCTableViewNormalCellManager(void) { static Class _klass; if(!_klass) { _klass = objc_getClass("WCTableViewNormalCellManager"); } return _klass; }
#line 6 "/mycode/github/DKWechatHelper/dkhelper/dkhelperDylib/Logos/dkhelperDylib.xm"
static void _logos_method$_ungrouped$NewSettingViewController$reloadTableData(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd){
_logos_orig$_ungrouped$NewSettingViewController$reloadTableData(self, _cmd);
WCTableViewManager *tableViewMgr = MSHookIvar<id>(self, "m_tableViewMgr");
MMTableView *tableView = [tableViewMgr getTableView];
WCTableViewNormalCellManager *newCell = [_logos_static_class_lookup$WCTableViewNormalCellManager() normalCellForSel:@selector(setting) target:self title:@"微信小助手"];
[((WCTableViewSectionManager*)tableViewMgr.sections[0]) addCell: newCell];
[tableView reloadData];
}
static void _logos_method$_ungrouped$NewSettingViewController$setting(_LOGOS_SELF_TYPE_NORMAL NewSettingViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd) {
UIViewController *vc = [[DKHelperSettingController alloc] init];
[((UIViewController *)self).navigationController PushViewController:vc animated:true];
}
static void _logos_method$_ungrouped$UIViewController$viewWillAppear$(_LOGOS_SELF_TYPE_NORMAL UIViewController* _LOGOS_SELF_CONST __unused self, SEL __unused _cmd, BOOL animated){
_logos_orig$_ungrouped$UIViewController$viewWillAppear$(self, _cmd, animated);
NSLog(@"\n***********************************************\n\t%@ appear\n***********************************************\n",NSStringFromClass([(NSObject*)self class]));
}
static __attribute__((constructor)) void _logosLocalInit() {
{Class _logos_class$_ungrouped$NewSettingViewController = objc_getClass("NewSettingViewController"); MSHookMessageEx(_logos_class$_ungrouped$NewSettingViewController, @selector(reloadTableData), (IMP)&_logos_method$_ungrouped$NewSettingViewController$reloadTableData, (IMP*)&_logos_orig$_ungrouped$NewSettingViewController$reloadTableData);{ char _typeEncoding[1024]; unsigned int i = 0; _typeEncoding[i] = 'v'; i += 1; _typeEncoding[i] = '@'; i += 1; _typeEncoding[i] = ':'; i += 1; _typeEncoding[i] = '\0'; class_addMethod(_logos_class$_ungrouped$NewSettingViewController, @selector(setting), (IMP)&_logos_method$_ungrouped$NewSettingViewController$setting, _typeEncoding); }Class _logos_class$_ungrouped$UIViewController = objc_getClass("UIViewController"); MSHookMessageEx(_logos_class$_ungrouped$UIViewController, @selector(viewWillAppear:), (IMP)&_logos_method$_ungrouped$UIViewController$viewWillAppear$, (IMP*)&_logos_orig$_ungrouped$UIViewController$viewWillAppear$);} }
#line 33 "/mycode/github/DKWechatHelper/dkhelper/dkhelperDylib/Logos/dkhelperDylib.xm"
+23 -51
View File
@@ -1,60 +1,32 @@
// See http://iphonedevwiki.net/index.php/Logos
#import <UIKit/UIKit.h>
#import "DKHelper.h"
#import "DKHelperSettingController.h"
@interface CustomViewController
@property (nonatomic, copy) NSString* newProperty;
+ (void)classMethod;
- (NSString*)getMyName;
- (void)newMethod:(NSString*) output;
@end
%hook CustomViewController
+ (void)classMethod
{
%log;
%orig;
%hook NewSettingViewController
- (void)reloadTableData{
%orig;
WCTableViewManager *tableViewMgr = MSHookIvar<id>(self, "m_tableViewMgr");
MMTableView *tableView = [tableViewMgr getTableView];
WCTableViewNormalCellManager *newCell = [%c(WCTableViewNormalCellManager) normalCellForSel:@selector(setting) target:self title:@"微信小助手"];
[((WCTableViewSectionManager*)tableViewMgr.sections[0]) addCell: newCell];
[tableView reloadData];
}
%new
-(void)newMethod:(NSString*) output{
NSLog(@"This is a new method : %@", output);
}
%new
- (id)newProperty {
return objc_getAssociatedObject(self, @selector(newProperty));
}
%new
- (void)setNewProperty:(id)value {
objc_setAssociatedObject(self, @selector(newProperty), value, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
- (NSString*)getMyName
{
%log;
NSString* password = MSHookIvar<NSString*>(self,"_password");
NSLog(@"password:%@", password);
[%c(CustomViewController) classMethod];
[self newMethod:@"output"];
self.newProperty = @"newProperty";
NSLog(@"newProperty : %@", self.newProperty);
return %orig();
- (void)setting {
UIViewController *vc = [[DKHelperSettingController alloc] init];
[((UIViewController *)self).navigationController PushViewController:vc animated:true];
}
%end
%hook UIViewController
- (void)viewWillAppear:(BOOL)animated{
%orig;
NSLog(@"\n***********************************************\n\t%@ appear\n***********************************************\n",NSStringFromClass([(NSObject*)self class]));
}
%end