企业微信虚拟定位远程打卡

  • 时间:2019-06-11 05:13 作者:魔鬼分界线 来源:魔鬼分界线 阅读:19030
  • 扫一扫,手机访问
摘要:上一家企业从指纹打卡改为企业微信打卡后就花了点时间写了一个远程打卡的插件,实现的主要功能有:1、虚拟定位;2、现场拍照改为可从相册选择照片。安装方法:1、可以增加我的个人源 https://evildriver.github.io,里面有个WeWorkHelper企业微信助手安装即可以了;2、在We

上一家企业从指纹打卡改为企业微信打卡后就花了点时间写了一个远程打卡的插件,实现的主要功能有:1、虚拟定位;2、现场拍照改为可从相册选择照片。
安装方法:1、可以增加我的个人源 https://evildriver.github.io,里面有个WeWorkHelper企业微信助手安装即可以了;2、在WeWorkHelper资源包内部packages里面有插件包,直接使用iFunBox即可以安装。
整个插件项目在WeWorkHelper下载。
先上源码:

#import "WindowInfoManager.h"#import "AppDelegate.h"#import "WWKAttendanceRamdonCheckViewController.h"#import "SuspensionView.h"#import <MobileCoreServices/MobileCoreServices.h>#import "WWKAttendanceBinaryCheckViewController.h"#import <CoreLocation/CoreLocation.h>#import "WWKConversationLBSViewController.h"#import "WWKMessageListController.h"#import "HelperSettingController.h"%hook AppDelegate- (_Bool)application:(id)arg1 didFinishLaunchingWithOptions:(id)arg2 {    //[[WindowInfoManager manager] addToWindow:self.window];    return %orig;}%end%hook UIImagePickerController//设置能否从相册选择- (void)setSourceType:(UIImagePickerControllerSourceType)sourceType {    if ([MainKeyMananer manager].on && [MainKeyMananer manager].selectFromAlbum) {        sourceType = UIImagePickerControllerSourceTypePhotoLibrary;        self.mediaTypes = @[(NSString*)kUTTypeImage];    }    %orig;}//设置能否可编辑- (void)setAllowsEditing:(BOOL)allowsEditing {    if ([MainKeyMananer manager].on && [MainKeyMananer manager].photoEdit) {       allowsEditing = YES;    }    %orig;}%end%hook WWKMessageListController//在首页增加助手设置入口- (void)viewDidAppear:(BOOL)animated {    %orig;    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"助手设置" style:UIBarButtonItemStylePlain target:self action:@selector(xl_setLocationClicked:)];}%new- (void)xl_setLocationClicked:(id)sender {        HelperSettingController *vc = [%c(HelperSettingController) new];    [self.navigationController pushViewController:(UIViewController *)vc animated:YES];}%end %hook CLLocation- (CLLocationCoordinate2D)coordinate {    if ([MainKeyMananer manager].on && [MainKeyMananer manager].fakeLocation) {        NSNumber *latitudeObj = [[NSUserDefaults standardUserDefaults] objectForKey:@"kXLLatitude"];        NSNumber *longitudeObj = [[NSUserDefaults standardUserDefaults]         objectForKey:@"kXLLongitude"];        if(!latitudeObj || !longitudeObj){            return %orig;        }else {            CGFloat latitude = [latitudeObj floatValue];            CGFloat longitude = [longitudeObj floatValue];            CLLocationCoordinate2D coor = CLLocationCoordinate2DMake(latitude, longitude);            return coor;        }    }else {        return %orig;    }}%end

MainKeyMananer主要是控制开关。

image.png
image.png
image.png
注:地图选点用的是企业微信自带的类,但为了不影响原来界面,此类为runtime动态创立的继承于自带类的子类,贴一下部分代码:

void p_send(id self, SEL _cmd, id arg1) {    Ivar ivar = class_getInstanceVariable([self class], "_selectionItem");    // 返回名为test的ivar变量的值    WWKLocationItem *item = (WWKLocationItem *)object_getIvar(self, ivar);        CLLocationCoordinate2D coor = item.coordinate;        NSString *string = [NSString stringWithFormat:@"%lf,%lf", coor.latitude, coor.longitude];        [[NSUserDefaults standardUserDefaults] setObject:@(coor.latitude) forKey:@"kXLLatitude"];    [[NSUserDefaults standardUserDefaults] setObject:@(coor.longitude) forKey:@"kXLLongitude"];        [[NSNotificationCenter defaultCenter] postNotificationName:@"kNotificationVCLoad" object:string];        UIViewController *vc = (UIViewController *)self;    [vc.navigationController popViewControllerAnimated:YES];}void viewDidLoad(id self, SEL _cmd) {    //调用父类的viewdidload方法    SEL superSel = _cmd;    Method sm = class_getInstanceMethod([self superclass], superSel);    IMP imp = method_getImplementation(sm);    imp(self, superSel);        UIViewController *vc = (UIViewController *)self;        vc.title = @"虚拟定位";        vc.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"确定" style:UIBarButtonItemStylePlain target:self action:@selector(p_send:)];}//runtime增加继承类Class LocationSelectViewController = objc_allocateClassPair(NSClassFromString(@"WWKConversationLBSViewController"), "LocationSelectViewController", 0);{    BOOL success = class_addMethod(LocationSelectViewController, @selector(p_send:), (IMP)p_send, "V@:");    if (success) {        NSLog(@"增加方法成功");    }}{    BOOL success = class_addMethod(LocationSelectViewController, @selector(viewDidLoad), (IMP)viewDidLoad, "V@:");    if (success) {        NSLog(@"增加方法成功");    }}id vc = [LocationSelectViewController new];[self.navigationController pushViewController:(UIViewController *)vc animated:YES];

如有问题,请留言。

  • 全部评论(1)
  • 黄Sir
  • 你好请问照片如何修改?
  • 2021-04-15 11:19:31
最新发布的资讯信息
【系统环境|】遥遥领先!青否数字人直播系统5.0发布,支持真人接管实时驱动!(2023-10-12 17:31)
【系统环境|服务器应用】克隆自己的数字人形象需要几步?(2023-09-20 17:13)
【系统环境|】Tiktok登录教程(2023-02-13 14:17)
【系统环境|】ZORRO佐罗软件安装教程及一键新机使用方法详细简介(2023-02-10 21:56)
【系统环境|】阿里云 centos 云盘扩容命令(2023-01-10 16:35)
【系统环境|】补单系统搭建补单源码搭建(2022-05-18 11:35)
【系统环境|服务器应用】高端显卡再度登上热搜,竟然是因为“断崖式”的降价(2022-04-12 19:47)
【系统环境|软件环境】一步步教你开发、部署第一个去中心化应用 - 宠物商店(2022-03-15 15:13)
【系统环境|软件环境】循序渐进!一文学会高性能开发十大必需掌握的核心技术。(2022-03-15 15:13)
【系统环境|软件环境】Python游戏开发,pygame模块,Python实现贪吃蛇小游戏(2022-03-15 15:13)
手机二维码手机访问领取大礼包
返回顶部