-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathTweak.xm
76 lines (56 loc) · 2.53 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#import "iOSWeChatFakeLocation.h"
#import <CoreLocation/CoreLocation.h>
%hook SeePeopleNearByLogicController
- (void)onRetrieveLocationOK:(CLLocation*)location
{
CGFloat lat = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PD_FAKE_LOCATION_LAT"] doubleValue];
CGFloat lng = [[[NSUserDefaults standardUserDefaults] objectForKey:@"PD_FAKE_LOCATION_LNG"] doubleValue];
if (lat < 0.1 || lng < 0.1) {
lat = 35.707013;
lng = 139.730562;
}
location = [[CLLocation alloc] initWithLatitude:lat longitude:lng];
%orig;
}
%end
%hook NewSettingViewController
- (void)reloadTableData {
%orig;
MMTableViewInfo *tableViewInfo = MSHookIvar<id>(self, "m_tableViewInfo");
MMTableViewSectionInfo *sectionInfo = [%c(MMTableViewSectionInfo) sectionInfoDefaut];
MMTableViewCellInfo *fakeLocationCell = [%c(MMTableViewCellInfo) normalCellForSel:@selector(fakeLocation) target:self title:@"伪装定位" accessoryType:1];
[sectionInfo addCell:fakeLocationCell];
[tableViewInfo insertSection:sectionInfo At:0];
MMTableView *tableView = [tableViewInfo getTableView];
[tableView reloadData];
}
static MMPickLocationViewController* pickLocationViewController = nil;
%new
- (void)fakeLocation {
pickLocationViewController = [[%c(MMPickLocationViewController) alloc] initWithScene:0 OnlyUseUserLocation:NO];
pickLocationViewController.delegate = self;
MMUINavigationController* nc = [[%c(MMUINavigationController) alloc] initWithRootViewController:pickLocationViewController];
[self PresentModalViewController:nc animated:YES];
}
%new
- (UIBarButtonItem *)onGetRightBarButton {
return [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(onSureSeletctedLocation)];
}
%new
- (void)onCancelSeletctedLocation {
if (pickLocationViewController) {
[pickLocationViewController DismissMyselfAnimated:YES];
[pickLocationViewController reportOnDone];
}
}
%new
- (void)onSureSeletctedLocation {
if (pickLocationViewController) {
[pickLocationViewController DismissMyselfAnimated:YES];
POIInfo* poiItem = [pickLocationViewController getCurrentPOIInfo];
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:poiItem.coordinate.latitude] forKey:@"PD_FAKE_LOCATION_LAT"];
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithDouble:poiItem.coordinate.longitude] forKey:@"PD_FAKE_LOCATION_LNG"];
[pickLocationViewController reportOnDone];
}
}
%end