123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515 |
- //
- // MyTDTopicCreateVC.m
- // smartRhino
- //
- // Created by niuzhen on 2019/12/20.
- // Copyright © 2019 tederen. All rights reserved.
- //
- #import "MyTDTopicCreateVC.h"
- #import "LYLPhotoTailoringTool.h"
- #import "FWZFileGetTool.h"
- #import "FWZGetNoteBookTool.h"
- #import "RichTextEditViewController.h"
- #import "AddLookUpUserSecondVC.h"
- #import "MyTDTopicSelectExtentVC.h"
- #import "FecordJoinWorkFlowListController.h"
- #import "_NoInputAccessoryView.h"
- #import "SelectSaveVC.h"
- #import "ShowBtn.h"
- #import "HomeDetailController.h"
- #import "ChatMsgNoticeDetailVC.h"
- #import "NoteBookDetailVC.h"
- #import "MyFavoriteVC.h"
- #import "NoteBookVC.h"
- #import "TDInterLeterDetailVC.h"
- #import "FileOpenViewController.h"
- #import "EMChatFileShowVC.h"
- #import "MyTDTopicCreateVC.h"
- #import "NoticeUnreadVC.h"
- #import "TDGroupInfoListVC.h"
- #import "DownFileViewController.h"
- #import "CountDataVC.h"
- #import "WorkFlowDetailsController.h"
- #import "MyTDGroupViewController.h"
- #import "MoveViewController.h"
- #import "ShowKeepNoticeAlert.h"
- #import "YCMenuView.h"
- #import "MyApprovalPageDetail.h"
- #import "OtherNoteBookVC.h"
- #import "OtherFavoriteVC.h"
- #import <objc/runtime.h>
- @interface MyTDTopicCreateVC ()<WKUIDelegate,WKNavigationDelegate,UIScrollViewDelegate,WKScriptMessageHandler>
- @property (weak, nonatomic) IBOutlet UIView *NavBarV;
- @property (weak, nonatomic) IBOutlet UIButton *DoneBtn;
- @property (nonatomic,strong) WKWebView *webView;
- @property (weak, nonatomic) IBOutlet UILabel *TitleL;
- @property (nonatomic,assign) CGFloat keyBoardH;
- @property (nonatomic,assign) BOOL isShoujianren;
- @property (nonatomic,assign) BOOL isChaosongren;
- @property (nonatomic,assign) BOOL isNull;
- @property (nonatomic,assign) NSInteger meetingId;
- @property (nonatomic,strong) NSMutableArray <SelectModel *> *chaoShongArray;
- @property (nonatomic,strong) NSMutableArray <SelectModel *> *shouJianArray;
- @property (nonatomic,strong) NSMutableArray * MeetingArray;
- @property (strong, nonatomic) ShowBtn * titleBtn;
- @property (copy, nonatomic) NSDictionary * H5JsonDict;
- @end
- @implementation MyTDTopicCreateVC
- + (MyTDTopicCreateVC *)initMyTDTopicCreateVC{
- MyTDTopicCreateVC *controller = [StoryboardManager.shared.myTDTopicExtent instantiateViewControllerWithIdentifier:@"MyTDTopicCreateVC"];
- return controller;
- }
- - (ShowBtn *)titleBtn
- {
- if (!_titleBtn) {
- _titleBtn = [[ShowBtn alloc] init];
- }
- return _titleBtn;
- }
- -(NSMutableArray *)getMenuDataSource{
- NSMutableArray *menuDataSourceArray = [[NSMutableArray alloc] init];
- NSArray * titleArray = @[@"写信件",@"匿名信"];
- for(int i = 0;i < titleArray.count;i ++){
- NSString *titleStr = [titleArray objectAtIndex:i];
- WS(weakSelf);
- YCMenuAction *actionMenu = [YCMenuAction actionWithTitle:titleStr image:nil handler:^(YCMenuAction *action) {
- [weakSelf autoSizeBtn:action.title];
- if([@"写信件" isEqualToString:action.title]){
- weakSelf.MailType = 1;
- }
- else if ([@"匿名信" isEqualToString:action.title]){
- weakSelf.MailType = 2;
- }else{
- weakSelf.MailType = 1;
- }
- }];
- [menuDataSourceArray addObject:actionMenu];
- }
- return menuDataSourceArray;
- }
- - (void)autoSizeBtn:(NSString *)title
- {
- if (title.length > 9) {
- NSRange range1 = NSMakeRange(9, title.length - 9);
- NSString *resultStr1 = [title stringByReplacingCharactersInRange:range1 withString:@"..."];
- [self.titleBtn setLabelTitle:resultStr1];
- }else{
- [self.titleBtn setLabelTitle:title];
- }
- WS(weakSelf);
- [self.titleBtn mas_remakeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(weakSelf.NavBarV);
- }];
- [self.NavBarV layoutIfNeeded];
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- [self.DoneBtn setEnabled:NO];
- self.fd_prefersNavigationBarHidden = YES;
- WS(weakSelf);
- [self.DoneBtn setAction:^{
- [weakSelf submit];
- }];
- [self.NavBarV addSubview:self.titleBtn];
- [self.titleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
- make.center.mas_equalTo(weakSelf.NavBarV);
- }];
- [self.view addSubview:self.webView];
- [self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
- make.top.mas_equalTo(weakSelf.NavBarV.mas_bottom);
- make.left.right.mas_equalTo(weakSelf.view);
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(weakSelf.view.mas_bottom);
- }
- }];
- self.webView.UIDelegate = self;
- // 导航代理
- self.webView.navigationDelegate = self;
- self.webView.scrollView.delegate = self;
- self.automaticallyAdjustsScrollViewInsets = YES;
- NSURL *pathUrl = [NSURL URLWithString:HtmlHost(@"/mobile/editor")];
- // NSURL *pathUrl = [NSURL URLWithString:@"http://192.168.0.118:8080/admin/mobile/editor"];
- NSURLRequest *request = [NSURLRequest requestWithURL:pathUrl];
- [self.webView loadRequest:request];
- // [self hideWKWebviewKeyboardShortcutBar:self.webView];
-
- switch (self.type) {
- case CollectModel_Notice:
- {
- self.TitleL.hidden = NO;
- self.titleBtn.hidden = YES;
- self.TitleL.text = @"写通知";
- }
- break;
- case CollectModel_Toipc:
- {
- self.TitleL.hidden = NO;
- self.titleBtn.hidden = YES;
- self.TitleL.text = @"新建话题";
- }
- break;
- case CollectModel_NewTopic:
- {
- [self setDowntitleBtn];
- self.TitleL.hidden = YES;
- self.titleBtn.hidden = NO;
- if (self.FolderName.length > 0) {
- [self autoSizeBtn:self.FolderName];
- }else{
- [self getTopicDefault];
- }
- }
- break;
- case CollectModel_NoteBook:
- {
- [self selectFold];
- self.TitleL.hidden = YES;
- self.titleBtn.hidden = NO;
- if (self.FolderName.length > 0) {
- [self autoSizeBtn:self.FolderName];
- }else{
- [self getNoteDefault];
- }
- }
- break;
- case CollectModel_Group:
- {
- self.TitleL.hidden = NO;
- self.titleBtn.hidden = YES;
- self.TitleL.text = @"新建话题";
- }
- break;
- case CollectModel_InterMail:
- {
- if (self.replayType == MailReplayOne || self.replayType == MailReplayAll) {
- self.TitleL.hidden = NO;
- self.titleBtn.hidden = YES;
- self.TitleL.text = @"回复信函";
- }else{
- self.TitleL.hidden = YES;
- self.titleBtn.hidden = NO;
- [self selectMailType];
- if (self.MailType == 2) {
- [self autoSizeBtn:@"匿名信"];
- }else{
- [self autoSizeBtn:@"写信件"];
- self.MailType = 1;
- }
- }
- }
- break;
- case CollectModel_meetMian:
- {
- self.TitleL.hidden = NO;
- self.titleBtn.hidden = YES;
- self.TitleL.text = @"会议纪要";
- }
- break;
- default:
- break;
- }
- if (self.isEdit) {
- if (self.isFromDraft) {
- [self.DoneBtn setTitle:@"发送" forState:UIControlStateNormal];
- }else{
- [self.DoneBtn setTitle:@"完成" forState:UIControlStateNormal];
- }
- }else{
- if (self.type == CollectModel_NewTopic || self.type == CollectModel_Toipc || self.type == CollectModel_NoteBook) {
- [self.DoneBtn setTitle:@"完成" forState:UIControlStateNormal];
- }else{
- [self.DoneBtn setTitle:@"发送" forState:UIControlStateNormal];
- }
- }
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(ChangetitleBtn:) name:SELECTEXTENTSUCCESS object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectMeetSearch:) name:SELECTMEETFECORD object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillShow:) name:UIKeyboardWillShowNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyBoardWillHide:) name:UIKeyboardWillHideNotification object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(recviveChaoSongRen:) name:NOTIFI_ChaoSongRen object:nil];
- [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(selectFolder:) name:NOTIFI_SELECTCREATENOTEFOLDER object:nil];
- }
- - (void)selectMailType
- {
- WS(weakSelf);
- [self.titleBtn setAction:^{
- NSMutableArray *menuDataSourceArray = [weakSelf getMenuDataSource];
- YCMenuView *view = [YCMenuView menuWithActions:menuDataSourceArray width:114 relyonView:weakSelf.titleBtn];
- view.menuColor = RGB(255, 255, 255);
- view.separatorColor = RGB(234, 234, 234);
- view.textColor = RGB(102, 102, 102);
- view.textFont = [UIFont systemFontOfSize:16.0];
- view.menuCellHeight = 43.5;
- view.maxDisplayCount = 10;
- view.offset = -6;
- [view show];
- }];
- }
- - (void)upDateAction:(NSString *)action
- {
- [self.webView evaluateJavaScript:action completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data=====%@",data);
- NSLog(@"error=====%@",error);
- }];
- }
- - (void)getTopicDefault
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_APP_Middle_Enjoy_Defaul),21];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- NSInteger MiddleId = [[responseObject objectForKey:@"MiddleId"] integerValue];
- if (MiddleId > 0) {
- weakSelf.FolderId = [[responseObject objectForKey:@"MiddleId"] integerValue];
- [weakSelf setSelectExtentText:[responseObject objectForKey:@"FolderName"]];
- }else{
- weakSelf.FolderId = 0;
- [weakSelf autoSizeBtn:@"选择发布范围"];
- }
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)getNoteDefault
- {
- WS(weakSelf);
- NSString * url = [NSString stringWithFormat:@"%@%d",Host(API_APP_Middle_Enjoy_Defaul),4];
- [[HttpManager sharedHttpManager] GETUrl:url parameters:@{} responseStyle:JOSN success:^(id _Nonnull responseObject) {
- dispatch_async(dispatch_get_main_queue(), ^{
- NSInteger MiddleId = [[responseObject objectForKey:@"MiddleId"] integerValue];
- if (MiddleId > 0) {
- weakSelf.FolderId = [[responseObject objectForKey:@"MiddleId"] integerValue];
- [weakSelf autoSizeBtn:[responseObject objectForKey:@"FolderName"]];
- }else{
- weakSelf.FolderId = 0;
- [weakSelf autoSizeBtn:@"根目录"];
- }
- });
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- - (void)selectFold{
- WS(weakSelf);
- [self.titleBtn setAction:^{
- SelectSaveVC * vc = [SelectSaveVC initSelectSaveVC];
- vc.isFromCreateBookVc = YES;
- vc.TypeId = CreateNotesType;
- vc.ParentId = 0;
- vc.FolderIds = @[].mutableCopy;
- vc.titleStr = @"选择存入范围";
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- }
- - (void)selectFolder:(NSNotification *)noti
- {
- NSDictionary * dict = noti.userInfo;
- [self autoSizeBtn:[dict objectForKey:@"FolderName"]];
- self.FolderId = [[dict objectForKey:@"FolderId"] integerValue];
- }
- - (void)ChangetitleBtn:(NSNotification *)notification
- {
- NSDictionary * dict = notification.userInfo;
- NSString * title = [NSString stringWithFormat:@"%@",[dict objectForKey:@"Name"]];
- self.FolderId = [[dict objectForKey:@"Id"] integerValue];
- if (title.length > 0) {
- [self setSelectExtentText:title];
- }
- }
- - (void)setDowntitleBtn
- {
- WS(weakSelf);
- [self.titleBtn setAction:^{
- MyTDTopicSelectExtentVC * vc = [MyTDTopicSelectExtentVC initMyTDTopicSelectExtentVC];
- vc.isSubVC = NO;
- vc.titleStr = @"选择发布范围";
- [weakSelf.navigationController pushViewController:vc animated:YES];
- }];
- }
- - (void)setSelectExtentText:(NSString *)title
- {
- if (title.length > 5) {
- NSRange range1 = NSMakeRange(5, title.length - 5);
- NSString *resultStr1 = [title stringByReplacingCharactersInRange:range1 withString:@"..."];
- NSString * title = [NSString stringWithFormat:@"发布范围:%@",resultStr1];
- [self autoSizeBtn:title];
- }else{
- NSString * cusTitle = [NSString stringWithFormat:@"发布范围:%@",title];
- [self autoSizeBtn:cusTitle];
- }
- }
- #pragma mark - layload
- - (WKWebView *)webView
- {
- if (!_webView) {
- WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init];
- // 实例化对象
- WKUserContentController* userContent = [[WKUserContentController alloc] init];
- [userContent addScriptMessageHandler:self name:@"chosePic"];
- [userContent addScriptMessageHandler:self name:@"toPZ"];
- [userContent addScriptMessageHandler:self name:@"toBJ"];
- [userContent addScriptMessageHandler:self name:@"toSC"];
- [userContent addScriptMessageHandler:self name:@"toWJ"];
- [userContent addScriptMessageHandler:self name:@"keyBoard"];
- [userContent addScriptMessageHandler:self name:@"approverCheckUsers"];
- [userContent addScriptMessageHandler:self name:@"carbonCopyUsers"];
- [userContent addScriptMessageHandler:self name:@"changeState"];
- [userContent addScriptMessageHandler:self name:@"getType"];
- [userContent addScriptMessageHandler:self name:@"to"];
- [userContent addScriptMessageHandler:self name:@"getJp"];
- [userContent addScriptMessageHandler:self name:@"postH"];
- configuration.userContentController = userContent;
- WKPreferences *preferences = [WKPreferences new];
- preferences.javaScriptCanOpenWindowsAutomatically = YES;
- preferences.minimumFontSize = 10.0;
- configuration.preferences = preferences;
- // 初始化WKWebView
- _webView = [[WKWebView alloc]initWithFrame:CGRectZero configuration:configuration];
- _NoInputAccessoryView *noInputView = [[_NoInputAccessoryView alloc] init];
- [noInputView removeInputAccessoryViewFromWKWebView:_webView];
- // UI代理
- }
- return _webView;
- }
- -(NSMutableArray<SelectModel *> *)shouJianArray{
- if(!_shouJianArray){
- _shouJianArray = [[NSMutableArray alloc] init];
- }
- return _shouJianArray;
- }
- -(NSMutableArray<SelectModel *> *)chaoShongArray{
- if(!_chaoShongArray){
- _chaoShongArray = [[NSMutableArray alloc] init];
- }
- return _chaoShongArray;
- }
- #pragma mark - KeyBoard
- - (void)keyBoardWillShow:(NSNotification *)note
- {
- // 获取用户信息
- NSDictionary *userInfo = [NSDictionary dictionaryWithDictionary:note.userInfo];
- // 获取键盘高度
- CGRect keyBoardBounds = [[userInfo objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
- if (IS_IPHONEX) {
- self.keyBoardH = keyBoardBounds.size.height - 34;
- }else{
- self.keyBoardH = keyBoardBounds.size.height;
- }
- WS(weakSelf);
- [self.webView evaluateJavaScript:@"textFocus()" completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- if (weakSelf.shouModel) {
- NSDictionary * dict = @{@"SourceId":@(weakSelf.shouModel.SourceId),@"SourceName":weakSelf.shouModel.SourceName};
- NSString *jsonString = [NSString stringWithFormat:@"getApproverCheckUsersList('%@')",[weakSelf arrayToJSONModel:@[dict]]];
- [weakSelf.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"%@",error);
- }];
- }
- NSLog(@"keyShow");
- }];
- }
- - (void)keyBoardWillHide:(NSNotification *)note
- {
- self.keyBoardH = 0.f;
- [self.webView evaluateJavaScript:@"textBlur()" completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"keyHidden");
- }];
- }
- #pragma mark - WKScriptMessageHandler
- - (void)userContentController:(nonnull WKUserContentController *)userContentController didReceiveScriptMessage:(nonnull WKScriptMessage *)message {
- WS(weakSelf);
- NSLog(@"messageName:%@",message.name);
- if ([message.name isEqualToString:@"chosePic"]) {
- [self chatBarDidPhotoAction];
- }
- if ([message.name isEqualToString:@"toPZ"]) {
- [[LYLPhotoTailoringTool sharedTool] selectPhotoWithPhoroOrCamera:SelectPhotoWithTypePhoroOrCamera2 crop:YES showImgBlock:^(NSString *imageUrlStr) {
- } choosImgBlock:^(UIImage *image) {
- [weakSelf didSelectImage:@[image]];
- }];
- }
- if ([message.name isEqualToString:@"toBJ"]) {
- [[FWZGetNoteBookTool sharedTool] openNoteBookListChooseNoteBookBlock:^(NSMutableArray<MyNoteBookSubModel *> * _Nonnull noteArr) {
- NSLog(@"SmartBarNotes %@",noteArr);
- [weakSelf disSelectNoteBook:noteArr];
- }];
- }
- if ([message.name isEqualToString:@"toSC"]) {
- [[FWZGetNoteBookTool sharedTool] openCollectListChooseCollectBlock:^(NSMutableArray<MyFavoriteSubModel *> * _Nonnull collectArr) {
- NSLog(@"SmartBarCollection %@",collectArr);
- [weakSelf disSelectCollect:collectArr];
- }];
- }
- if ([message.name isEqualToString:@"toWJ"]) {
- [[FWZFileGetTool sharedTool] openFileWithCrop:YES showImgBlock:^(NSString * _Nonnull fileUrlStr) {
-
- } choosFileBlock:^(NSData * _Nonnull fileData, NSString * _Nonnull fileName) {
- SHOWLOADING
- [[HttpManager sharedHttpManager] HeaderUploadFileUrl:Host(Modify_UserImages_Post) parameters:@{} fileData:fileData fileKey:@"file" fileName:fileName mimeType:@"multipart/form-data" success:^(id _Nonnull responseObject) {
- REMOVESHOW
- NSDictionary * dict = responseObject[0];
- if ([dict[@"FileType"] isEqualToString:@"image"]) {
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)CollectModel_Image,dict[@"FileName"],(long)[dict[@"FileId"] integerValue],@"",dict[@"MinAbsolutePath"],dict[@"AbsolutePath"],(long)[AppUserModel sharedAppUserModel].Id];
- [weakSelf upDateAction:jsonString];
- }else{
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)CollectModel_file,dict[@"FileName"],(long)[dict[@"FileId"] integerValue],@"",dict[@"MinAbsolutePath"],dict[@"AbsolutePath"],(long)[AppUserModel sharedAppUserModel].Id];
- [weakSelf upDateAction:jsonString];
- }
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- }];
- }];
- }
- if ([message.name isEqualToString:@"keyBoard"]) {
- NSString *jsonString = [NSString stringWithFormat:@"getIosKeyBorad('%f')",self.keyBoardH];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- }];
- }
- if ([message.name isEqualToString:@"changeState"]) {
- NSLog(@"msgBody:%@",message.body);
- NSInteger status = [message.body integerValue];
- if (status == 1) {
- self.isNull = NO;
- [self.DoneBtn setEnabled:YES];
- }else{
- self.isNull = YES;
- [self.DoneBtn setEnabled:NO];
- }
- }
- if ([message.name isEqualToString:@"approverCheckUsers"]) {
- if (self.type == CollectModel_meetMian) {
- [self selectMeeting];
- }else{
- self.isShoujianren = YES;
- self.isChaosongren = NO;
- [self selectPeopleWithType:1];
- }
- }
- if ([message.name isEqualToString:@"getJp"]) {
- [self allowDisplayingKeyboardWithoutUserAction];
- }
- if ([message.name isEqualToString:@"carbonCopyUsers"]) {
- self.isShoujianren = NO;
- self.isChaosongren = YES;
- [self selectPeopleWithType:2];
- }
- if ([message.name isEqualToString:@"getType"]) {
- NSString *jsonString = [NSString stringWithFormat:@"getType('%d','%d','%ld','%@','%ld')",self.type,self.isEdit,(long)self.Id,USERDEFAULTSGET(@"LOGINTOKEN"),(long)self.replayType];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- if (weakSelf.isReturn) {
- FlowAttachmentsModel * model = weakSelf.sendModel;
- NSInteger fileType = model.SoureTypeId;
- if (fileType == CollectModel_file) {
- if (model.MinUrl.length > 0) {
- fileType = CollectModel_Image;
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidImg('%@','%@','%ld')",model.Url,model.Title,(long)[self returnType:model.Url]];
- [weakSelf upDateAction:jsonString];
- }else{
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)model.SoureTypeId,model.Title,(long)model.SoureId,model.Author.length > 0 ? model.Author : @"",model.MinUrl,model.Url,(long)weakSelf.sendModel.SourceUserId];
- [weakSelf upDateAction:jsonString];
- }
- }else if(fileType == CollectModel_Text){
- [weakSelf.webView paste:weakSelf.sendModel.Title];
- }else if(fileType == CollectModel_Image){
- [weakSelf didSelectImage:@[weakSelf.sendImage]];
- }else{
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)model.SoureTypeId,model.Title,(long)model.SoureId,model.Author.length > 0 ? model.Author : @"",model.MinUrl,model.Url,(long)weakSelf.sendModel.SourceUserId];
- [weakSelf upDateAction:jsonString];
- }
- }
- }];
- }
- if ([message.name isEqualToString:@"to"]) {
- NSLog(@"msgBody:%@",message.body);
- NSDictionary * dict = (NSDictionary *)message.body;
- [self pushVCWithDict:dict];
- }
- if ([message.name isEqualToString:@"postH"]) {
- NSInteger H = [message.body integerValue];
- if (H < 0) {
- [self.webView mas_updateConstraints:^(MASConstraintMaker *make) {
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom).offset(H);
- } else {
- make.bottom.equalTo(weakSelf.view.mas_bottom).offset(H);
- }
- }];
- }else{
- [self.webView mas_updateConstraints:^(MASConstraintMaker *make) {
- if (@available(iOS 11.0, *)) {
- make.bottom.equalTo(weakSelf.view.mas_safeAreaLayoutGuideBottom);
- } else {
- make.bottom.equalTo(weakSelf.view.mas_bottom);
- }
- }];
- }
- [self.view setNeedsLayout];
- [self.view layoutIfNeeded];
- }
- }
- - (void)pushVCWithDict:(NSDictionary *)dict
- {
- NSInteger Id = [dict[@"id"] integerValue];
- NSInteger userId = [dict[@"userId"] integerValue];
- NSString * title = dict[@"title"];
- WS(weakSelf);
- switch ([dict[@"type"] integerValue]) {
- case CollectModel_Group:
- {
- TDGroupInfoListVC * vc = [TDGroupInfoListVC initTDGroupInfoListVC];
- vc.GroupId = Id;
- vc.titleStr = title;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_file:{
- DownFileViewController * vc = [[DownFileViewController alloc] init];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.Title = title;
- model.SoureId = Id;
- model.Url = dict[@"bigurl"];
- model.MinUrl = dict[@"smallurl"];
- vc.model = model;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Image:{
- DownFileViewController * vc = [[DownFileViewController alloc] init];
- FlowAttachmentsModel * model = [[FlowAttachmentsModel alloc] init];
- model.Title = title;
- model.SoureId = Id;
- model.Url = dict[@"bigurl"];
- model.MinUrl = dict[@"smallurl"];
- vc.model = model;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Aritle:{
- SHOWLOADING
- [[HttpManager sharedHttpManager] GETWithUrl:[NSString stringWithFormat:@"%@%ld",Article_Detail_Get,(long)Id] parameters:@{} success:^(id _Nonnull responseObject) {
- REMOVESHOW;
- Item *itemModel = [[Item alloc]initWithDictionary:responseObject error:nil];
- HomeDetailController *homeDetail = [[HomeDetailController alloc] init];
- [homeDetail loadCurrentModel:itemModel];
- [weakSelf.navigationController pushViewController:homeDetail animated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }break;
- case CollectModel_Notice:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Notice;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Toipc:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_Toipc;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NewTopic:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NewTopic;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_NoteBook:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_NoteBook;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_Collect:{
-
- }break;
- case CollectModel_CollectFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id) {
- MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherFavoriteVC *vc = [OtherFavoriteVC initOtherFavoriteVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_NoteFile:{
- if (userId == [AppUserModel sharedAppUserModel].Id) {
- NoteBookVC *vc = [NoteBookVC initNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.VisitUserId = 0;
- [self.navigationController pushViewController:vc animated:YES];
- }else{
- OtherNoteBookVC *vc = [OtherNoteBookVC initOtherNoteBookVC];
- vc.listType = Id == 0 ? MyFavoriteListLevelTypeA : MyFavoriteListLevelTypeB;
- vc.ParentId = 0;
- vc.FolderId = Id;
- vc.myTitle = title;
- vc.VisitUserId = userId;
- [self.navigationController pushViewController:vc animated:YES];
- }
- }break;
- case CollectModel_InterMail:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_InterMail;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_meetDetail:{
- WorkFlowDetailsController *vc = [[WorkFlowDetailsController alloc] initWithId:Id];
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_work:{
- MyApprovalPageDetail * vc = [[MyApprovalPageDetail alloc]init];
- vc.pageType = Type_ONEC;
- vc.indexId = Id;
- vc.title = title;
- vc.TodoId = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_meetMian:{
- MyTDTopicDetailVC * vc = [MyTDTopicDetailVC initMyTDTopicDetailVC];
- vc.type = CollectModel_meetMian;
- vc.Id = Id;
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_financeCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 0;
- vc.titleStr = @"财务统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_affairsCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 1;
- vc.titleStr = @"人事统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- case CollectModel_publishCount:{
- CountDataVC *vc = [CountDataVC initCountDataVC];
- vc.index = 2;
- vc.titleStr = @"出版统计";
- [self.navigationController pushViewController:vc animated:YES];
- }break;
- default:
- break;
- }
- }
- #pragma mark - 选择关联会议
- - (void)selectMeeting
- {
- WS(weakSelf);
- FecordJoinWorkFlowListController *vc = [[FecordJoinWorkFlowListController alloc] init];
- [vc setSelectedMeetingBlock:^(NSString * _Nonnull mid, NSString * _Nonnull meetingName) {
- weakSelf.meetingId = [mid integerValue];
- NSDictionary * dict = @{@"SourceId":mid,@"SourceName":meetingName};
- NSString *jsonString = [NSString stringWithFormat:@"getApproverCheckUsersList('%@')",[self arrayToJSONModel:@[dict]]];
- [weakSelf.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- }];
- vc.IsSelect = YES;
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)selectMeetSearch:(NSNotification *)notification
- {
- NSDictionary * dict = notification.userInfo;
- self.meetingId = [[dict objectForKey:@"Id"] integerValue];
- NSDictionary * paraDict = @{@"SourceId":[dict objectForKey:@"Id"],@"SourceName":[dict objectForKey:@"Name"]};
- NSString *jsonString = [NSString stringWithFormat:@"getApproverCheckUsersList('%@')",[self arrayToJSONModel:@[paraDict]]];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- }
- - (void)selectPeopleWithType:(NSInteger)type {
- AddLookUpUserSecondVC *vc = [[AddLookUpUserSecondVC alloc] init];
- vc.isAllSelected = YES;
- Department *defaltGroupSetion = [[Department alloc]init];
- defaltGroupSetion.Name = @"单位通讯录";
- defaltGroupSetion.Id = 0;
- defaltGroupSetion.SourceId = 0;
- defaltGroupSetion.SourceType = 1;
- defaltGroupSetion.SourceName = @"单位通讯录";
- defaltGroupSetion.MiddleType = type;
- Department *myGroupSetion = [[Department alloc]init];
- myGroupSetion.Name = @"自建通讯录";
- myGroupSetion.Id = 0;
- myGroupSetion.MiddleType = type;
- myGroupSetion.SourceType = 3;
- myGroupSetion.SourceId = 0;
- myGroupSetion.SourceName = @"自建通讯录";
- vc.isAllSelected = YES;
- vc.departSourceDataArray = @[defaltGroupSetion,myGroupSetion].mutableCopy;
- vc.isDefalutPage = 1;
- vc.titleStr = self.type == CollectModel_meetMian ? @"发送范围" : @"选人";
- [self.navigationController pushViewController:vc animated:YES];
- }
- - (void)recviveChaoSongRen:(NSNotification *)notification{
- if (self.isShoujianren) {
- NSMutableArray <SelectModel *>* array = notification.userInfo[@"selectPeople"];
- if (array.count > 0) {
- NSLog(@"shouJianArray结果数据组%@",array);
- NSString *jsonString = [NSString stringWithFormat:@"getApproverCheckUsersList('%@')",[self arrayToJSONModel:array]];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- }
- }
- if (self.isChaosongren) {
- NSMutableArray <SelectModel *>* array = notification.userInfo[@"selectPeople"];
- if (array.count > 0) {
- NSLog(@"chaoShongArray结果数据组%@",array);
- NSString *jsonString = [NSString stringWithFormat:@"getCarbonCopyUsersList('%@')",[self arrayToJSONModel:array]];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"data:%@",data);
- NSLog(@"error:%@",error);
- }];
- }
- }
- }
- #pragma mark - 选择图片
- - (void)chatBarDidPhotoAction
- {
- WS(weakSelf);
- [self.view endEditing:YES];
- TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:nil];
- [imagePickerVc setNavLeftBarButtonSettingBlock:^(UIButton *leftButton){
- leftButton.hidden = YES;
- }];
- imagePickerVc.showSelectBtn = NO;
- imagePickerVc.allowCrop = YES;
- imagePickerVc.cropRect = CGRectMake(0, (SCREEN_HEIGHT - SCREEN_WIDTH) * 0.5, SCREEN_WIDTH, SCREEN_WIDTH);
- imagePickerVc.allowTakePicture = NO;
- imagePickerVc.allowTakeVideo = NO;
- imagePickerVc.allowPickingOriginalPhoto = NO;
- imagePickerVc.allowPickingGif = NO;
- [imagePickerVc setIsStatusBarDefault:YES];
- [imagePickerVc setNaviTitleColor:[UIColor blackColor]];
- [imagePickerVc setBarItemTextColor:[UIColor blackColor]];
- [imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
- PHAsset *asset = assets.firstObject;
- switch (asset.mediaType) {
- case PHAssetMediaTypeVideo: {
-
- } break;
- case PHAssetMediaTypeImage: {
- [weakSelf didSelectImage:photos];
- } break;
- case PHAssetMediaTypeAudio:
- break;
- case PHAssetMediaTypeUnknown:
- break;
- default: break;
- }
- }];
- [self presentViewController:imagePickerVc animated:YES completion:nil];
- }
- - (void)didSelectImage:(NSArray *)images
- {
- NSMutableArray * array = [NSMutableArray array];
- for (UIImage * image in images) {
- NSData *data = UIImageJPEGRepresentation(image, 1);
- [array addObject:data];
- }
- WS(weakSelf);
- NSString *urlString = [[NSString alloc] initWithFormat:@"%@%@",BaseUrl,Modify_UserImages_Post];
- [[HttpManager sharedHttpManager] HeaderUploadUrl:urlString parameters:@{} pictureArray:array pictureKey:@"file" success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- for (NSDictionary * dict in responseObject) {
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidImg('%@','%@','%ld')",dict[@"AbsolutePath"],dict[@"FileName"],(long)CollectModel_Image];
- [weakSelf upDateAction:jsonString];
- }
- } failure:^(NSError * _Nonnull error) {
-
- }];
- }
- #pragma mark - 选择笔记
- - (void)disSelectNoteBook:(NSMutableArray<MyNoteBookSubModel *>*_Nonnull )noteArr{
- for (MyNoteBookSubModel *dataModel in noteArr ) {
- if (dataModel.AttributeValue == 1) {
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)CollectModel_NoteBook,dataModel.Title,(long)dataModel.MiddleId,dataModel.Name,@"",@"",(long)dataModel.UserId];
- [self upDateAction:jsonString];
- }else{
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)CollectModel_NoteFile,dataModel.FolderName,(long)dataModel.Id,[AppUserModel sharedAppUserModel].Name,@"",@"",(long)dataModel.UserId];
- [self upDateAction:jsonString];
- }
- }
- }
- #pragma mark - 选择收藏
- - (void)disSelectCollect:(NSMutableArray<MyFavoriteSubModel *> * _Nonnull) collectArr{
- for (MyFavoriteSubModel *dataModel in collectArr ) {
- if(dataModel.AttributeValue == 1)
- {
- NSString * author = @"";
- switch (dataModel.CollectionType) {
- case CollectModel_file:
- {
- if (dataModel.Data.MinFile.length > 0) {
- dataModel.CollectionType = CollectModel_Image;
- }
- }
- break;
- case CollectModel_Text:///1
- {
- dataModel.CollectionType = CollectModel_Aritle;
- }
- break;
- case CollectModel_CollectFile:
- {
- dataModel.CollectionType = CollectModel_Aritle;
- author = dataModel.Data.Author.length > 0 ? [NSString stringWithFormat:@"来自-%@的收藏",dataModel.Data.Author] : @"";
- }
- break;
- case CollectModel_NoteFile:
- {
- dataModel.CollectionType = CollectModel_Aritle;
- author = dataModel.Data.Author.length > 0 ? [NSString stringWithFormat:@"来自-%@的笔记",dataModel.Data.Author] : @"";
- }
- break;
- default:
- {
- author = dataModel.Data.Author.length > 0 ? dataModel.Data.Author : @"";
- }
- break;
- }
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)dataModel.CollectionType,dataModel.Title,(long)dataModel.CollectionDataId,author,dataModel.Data.MinFile,dataModel.Data.File,(long)(dataModel.SourceUserId == 0 ? dataModel.UserId : dataModel.SourceUserId)];
- [self upDateAction:jsonString];
- }else{
- NSString *jsonString = [NSString stringWithFormat:@"getAndroidNoteCollection('%ld','%@','%ld','%@','%@','%@','%ld')",(long)CollectModel_CollectFile,dataModel.FolderName,(long)dataModel.Id,[AppUserModel sharedAppUserModel].Name,@"",@"",(long)(dataModel.SourceUserId == 0 ? dataModel.UserId : dataModel.SourceUserId)];
- [self upDateAction:jsonString];
- }
- }
- }
- #pragma mark - WKScriptMessageHandler
- -(NSString *)convertToJson:(NSDictionary *)dict
- {
- NSError *error;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dict options:NSJSONWritingPrettyPrinted error:&error];
- NSString *jsonString;
- if (!jsonData) {
- NSLog(@"%@",error);
- }else{
- jsonString = [[NSString alloc]initWithData:jsonData encoding:NSUTF8StringEncoding];
- }
- NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
- NSRange range = {0,jsonString.length};
- //去掉字符串中的空格
- [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
- NSRange range2 = {0,mutStr.length};
- //去掉字符串中的换行符
- [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
- return mutStr;
- }
- #pragma mark - WKUIDelegete
- - (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(nonnull NSString *)message initiatedByFrame:(nonnull WKFrameInfo *)frame completionHandler:(nonnull void (^)(void))completionHandler
- {
- NSLog(@"%@",message);
- completionHandler();
- }
- - (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(nonnull NSString *)message initiatedByFrame:(nonnull WKFrameInfo *)frame completionHandler:(nonnull void (^)(BOOL))completionHandler
- {
- NSLog(@"223123");
- completionHandler(YES);
- }
- - (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(nonnull NSString *)prompt defaultText:(nullable NSString *)defaultText initiatedByFrame:(nonnull WKFrameInfo *)frame completionHandler:(nonnull void (^)(NSString * _Nullable))completionHandler
- {
- NSLog(@"323123");
- completionHandler(@"111");
- }
- #pragma mark - 提交富文本
- - (void)submit
- {
- NSString *jsonString = [NSString stringWithFormat:@"getEditorText()"];
- [self.webView evaluateJavaScript:jsonString completionHandler:^(id _Nullable data, NSError * _Nullable error) {
- NSLog(@"submit:%@",data);
- NSDictionary * dict = (NSDictionary *)data;
- switch (self.type) {
- case CollectModel_Notice:
- {
- [self submitNotice:dict];
- }
- break;
- case CollectModel_Toipc:
- {
- if (self.isEdit) {
- [self changeTopic:dict];
- }else{
- [self submitTopic:dict];
- }
- }
- break;
- case CollectModel_NewTopic:
- {
- if (self.isEdit) {
- [self changeNoteBook:dict];
- }else{
- [self submitNoteBook:dict];
- }
- }
- break;
- case CollectModel_Group:
- {
- if (self.isEdit) {
- [self changeTopic:dict];
- }else{
- [self submitTopic:dict];
- }
- }
- break;
- case CollectModel_meetMian:
- {
- if (self.isEdit) {
- [self changeMeeting:dict];
- }else{
- [self submitMeeting:dict];
- }
- }
- break;
- case CollectModel_NoteBook:
- {
- if (self.isEdit) {
- [self changeNoteBook:dict];
- }else{
- [self submitNoteBook:dict];
- }
- }
- break;
- case CollectModel_InterMail:
- {
- [self submitMail:dict];
- }
- break;
- default:
- break;
- }
- }];
- }
- #pragma mark - 提交通知
- - (void)submitNotice:(NSDictionary *)dict
- {
- self.H5JsonDict = dict;
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
-
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [paraDict setValue:self.isDraft ? @(2) : @(1) forKey:@"NoticeType"];
- [paraDict setValue:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:dict[@"AddresseeUserMiddles"] forKey:@"AddresseeUserMiddles"];
- [paraDict setObject:dict[@"CcUserMiddles"] forKey:@"CcUserMiddles"];
- [paraDict setObject:[self arrayToJSONString:jsonArray] forKey:@"Content"];
- NSArray * addArray = self.H5JsonDict[@"AddresseeUserMiddles"];
- NSArray * ccArray = self.H5JsonDict[@"CcUserMiddles"];
- if ([self.H5JsonDict[@"Title"] length] == 0 &&
- [self.H5JsonDict[@"html"] length] == 0 &&
- addArray.count == 0 &&
- ccArray.count == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- if (self.isEdit) {
- [paraDict setObject:@(self.Id) forKey:@"Id"];
- [self sentChangeNotice:paraDict withNoticeType:self.isDraft ? 2 : 1];
- }else{
- [self sentNoticeRequeast:paraDict withNoticeType:self.isDraft ? 2 : 1];
- }
- }
- - (void)sentChangeNotice:(NSMutableDictionary *)dic withNoticeType:(NSInteger)NoticeType{
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(API_NOTICE_EDIT) parameters:dic responseStyle:DATA success:^(id _Nonnull responseObject) {
- REMOVESHOW
- if(NoticeType == 1){
- SHOWSUCCESS(@"通知已经发送");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- }else{
- SHOWSUCCESS(@"通知已经存放草稿箱");
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)sentNoticeRequeast:(NSMutableDictionary *)dic withNoticeType:(NSInteger)NoticeType{
- WS(weakSelf);
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_NOTICE_ADD) parameters:dic success:^(id _Nonnull responseObject) {
- REMOVESHOW
- if(NoticeType == 1){
- SHOWSUCCESS(@"通知已经发送");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- }else{
- SHOWSUCCESS(@"通知已经存放草稿箱");
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- #pragma mark - 提交话题
- - (void)submitTopic:(NSDictionary *)dict
- {
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
-
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [paraDict setObject:@(self.Id) forKey:@"GroupId"];
- [paraDict setObject:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:[self arrayTosumbitString:jsonArray] forKey:@"Content"];
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- SHOWLOADING
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(APP_Topic_Add) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- REMOVESHOW
- SHOWSUCCESS(@"创建成功");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- [weakSelf back1];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error])
- }];
- }
- #pragma mark - 修改话题
- - (void)changeTopic:(NSDictionary *)dict
- {
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
-
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@(self.Id) forKey:@"Id"];
- [paraDict setValue:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:[self arrayTosumbitString:jsonArray] forKey:@"Content"];
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- WS(weakSelf);
- SHOWLOADING
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_APP_Topic_Update) parameters:paraDict responseStyle:DATA success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- REMOVESHOW
- SHOWSUCCESS(@"创建成功");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
-
- }];
- }
- #pragma mark - 提交会议纪要
- - (void)submitMeeting:(NSDictionary *)dict
- {
- NSString * html = dict[@"html"];
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:dict[@"CcUserMiddles"] forKey:@"AddresseeUserMiddles"];
- if (self.meetingId > 0) {
- [paraDict setObject:@(self.meetingId) forKey:@"MeetingId"];
- }
- [paraDict setObject:html forKey:@"Content"];
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- SHOWLOADING
- WS(weakSelf);
- [[HttpManager sharedHttpManager] POSTUrl:Host(MeetingSummary) parameters:paraDict responseStyle:JOSN success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"创建成功");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)changeMeeting:(NSDictionary *)dict
- {
- NSString * html = dict[@"html"];
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:dict[@"CcUserMiddles"] forKey:@"AddresseeUserMiddles"];
- if (self.meetingId > 0) {
- [paraDict setObject:@(self.meetingId) forKey:@"MeetingId"];
- }
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- [paraDict setObject:html forKey:@"Content"];
- SHOWLOADING
- WS(weakSelf);
- NSString * meetId = [NSString stringWithFormat:@"%ld",(long)self.Id];
- [[HttpManager sharedHttpManager] PUTUrl:Host(UpdateMeeting(meetId)) parameters:paraDict success:^(id _Nonnull responseObject) {
- REMOVESHOW
- SHOWSUCCESS(@"修改会议纪要成功");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- REMOVESHOW
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- #pragma mark - 提交笔记
- - (void)submitNoteBook:(NSDictionary *)dict
- {
- WS(weakSelf);
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [paraDict setObject:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:(self.type == CollectModel_NewTopic ? @(1) : @(0)) forKey:@"IsTopic"];
- [paraDict setObject:[self arrayTosumbitString:jsonArray] forKey:@"Content"];
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- if (self.type == CollectModel_NewTopic && self.FolderId == 0) {
- SHOWERROR(@"请选择发布范围");
- return;
- }
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_CreateNoteBook) parameters:paraDict success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- SHOWSUCCESS(@"创建成功");
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- [weakSelf back1];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (void)changeNoteBook:(NSDictionary *)dict
- {
- WS(weakSelf);
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [paraDict setObject:@(self.Id) forKey:@"Id"];
- [paraDict setObject:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:[self arrayTosumbitString:jsonArray] forKey:@"Content"];
- if ([dict[@"Title"] length] == 0 && html.length == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- if (self.type == CollectModel_NewTopic && self.FolderId == 0) {
- SHOWERROR(@"请选择发布范围");
- return;
- }
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_NoteBook_Modify) parameters:paraDict success:^(id _Nonnull responseObject) {
- NSLog(@"%@",responseObject);
- if (weakSelf.upDateBlock) {
- weakSelf.upDateBlock();
- }
- SHOWSUCCESS(@"修改成功");
- [weakSelf.navigationController popViewControllerAnimated:YES];
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- #pragma mark - 提交站内信
- - (void)submitMail:(NSDictionary *)dict
- {
- self.H5JsonDict = dict;
- NSString * html = dict[@"html"];
- NSArray * jsonArray = dict[@"json"];
-
- NSMutableDictionary * paraDict = [NSMutableDictionary dictionary];
- [paraDict setObject:dict[@"Title"] forKey:@"Title"];
- [paraDict setObject:@([AppUserModel sharedAppUserModel].Id) forKey:@"UserId"];
- [paraDict setValue:@(self.FolderId) forKey:@"FolderId"];
- [paraDict setObject:html forKey:@"HtmlContent"];
- [paraDict setObject:dict[@"AddresseeUserMiddles"] forKey:@"AddresseeUserMiddles"];
- [paraDict setObject:dict[@"CcUserMiddles"] forKey:@"CcUserMiddles"];
- [paraDict setObject:[self arrayToJSONString:jsonArray] forKey:@"Content"];
- [paraDict setObject:@(self.MailType) forKey:@"MissiveType"];///1 正常 2 匿名
- [paraDict setObject:@(self.Id) forKey:@"ParentId"];///回复ID
- [paraDict setObject:@(self.isDraft ? 2 : 1) forKey:@"MissiveAttributeType"];///1 发送 2 草稿
- NSArray * addArray = self.H5JsonDict[@"AddresseeUserMiddles"];
- NSArray * ccArray = self.H5JsonDict[@"CcUserMiddles"];
- if ([self.H5JsonDict[@"Title"] length] == 0 &&
- [self.H5JsonDict[@"html"] length] == 0 &&
- addArray.count == 0 &&
- ccArray.count == 0) {
- SHOWERROR(@"请填写标题或内容");
- return;
- }
- if (self.isEdit) {
- if (self.replayType == MailReplayOne || self.replayType == MailReplayAll) {
-
- }else{
- [paraDict setObject:@(self.Id) forKey:@"Id"];
- }
- }
- [self sentMailRequeast:paraDict];
- }
- - (void)sentMailRequeast:(NSMutableDictionary *)dic
- {
- WS(weakSelf);
- [[HttpManager sharedHttpManager] PUTUrl:Host(API_InterLetterModify) parameters:dic success:^(id _Nonnull responseObject) {
- if(weakSelf.isDraft){
- SHOWSUCCESS(@"站内信已经存放草稿箱");
- }else{
- SHOWSUCCESS(@"站内信已经发送");
- }
- if (weakSelf.replayType == MailReplayOne || weakSelf.replayType == MailReplayAll) {
- [weakSelf backMailList];
- }else{
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }
- } failure:^(NSError * _Nonnull error) {
- SHOWERROR([ZYCTool handerResultData:error]);
- }];
- }
- - (NSString *)arrayToJSONModel:(NSArray *)array
- {
- NSMutableArray * mArray = [NSMutableArray array];
- for (SelectModel * model in array) {
- NSDictionary * dict = [model modelToJSONObject];
- [mArray addObject:@{@"SourceType":dict[@"SourceType"],@"SourceId":dict[@"SourceId"],@"SourceName":dict[@"SourceName"],@"MiddleType":@(self.type)}];
- }
- return [self arrayToJSONString:mArray];
- }
- - (NSString *)arrayTosumbitString:(NSArray *)array
- {
- NSError *error = nil;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:&error];
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
- NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
- return mutStr;
- }
- - (NSString *)arrayToJSONString:(NSArray *)array
- {
- NSError *error = nil;
- NSData *jsonData = [NSJSONSerialization dataWithJSONObject:array options:NSJSONWritingPrettyPrinted error:&error];
- NSString *jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
- NSMutableString *mutStr = [NSMutableString stringWithString:jsonString];
- NSRange range = {0,jsonString.length};
- //去掉字符串中的空格
- [mutStr replaceOccurrencesOfString:@" " withString:@"" options:NSLiteralSearch range:range];
- NSRange range2 = {0,mutStr.length};
- //去掉字符串中的换行符
- [mutStr replaceOccurrencesOfString:@"\n" withString:@"" options:NSLiteralSearch range:range2];
- return mutStr;
- }
- - (void)dealloc {
- [self.webView stopLoading];
- self.webView.UIDelegate = nil;
- self.webView.navigationDelegate = nil;
- self.webView.scrollView.delegate = nil;
- [self.webView removeFromSuperview];
- WKWebsiteDataStore *dateStore = [WKWebsiteDataStore defaultDataStore];
- [dateStore fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes]
- completionHandler:^(NSArray * __nonnull records) {
- for (WKWebsiteDataRecord *record in records)
- {
- [[WKWebsiteDataStore defaultDataStore] removeDataOfTypes:record.dataTypes
- forDataRecords:@[record]
- completionHandler:^{
- NSLog(@"Cookies for %@ deleted successfully",record.displayName);
- }];
- }
- }];
- WKUserContentController *userCC = self.webView.configuration.userContentController;
- [userCC removeScriptMessageHandlerForName:@"chosePic"];
- [userCC removeScriptMessageHandlerForName:@"toPZ"];
- [userCC removeScriptMessageHandlerForName:@"toBJ"];
- [userCC removeScriptMessageHandlerForName:@"getJp"];
- [userCC removeScriptMessageHandlerForName:@"toSC"];
- [userCC removeScriptMessageHandlerForName:@"toWJ"];
- [userCC removeScriptMessageHandlerForName:@"keyBoard"];
- [userCC removeScriptMessageHandlerForName:@"getType"];
- [userCC removeScriptMessageHandlerForName:@"approverCheckUsers"];
- [userCC removeScriptMessageHandlerForName:@"carbonCopyUsers"];
- [userCC removeScriptMessageHandlerForName:@"changeState"];
- [userCC removeScriptMessageHandlerForName:@"to"];
- [userCC removeScriptMessageHandlerForName:@"postH"];
- [userCC removeAllUserScripts];
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- }
- //- (void)hideWKWebviewKeyboardShortcutBar:(WKWebView *)webView {
- // UIView *targetView;
- //
- // for (UIView *view in webView.scrollView.subviews) {
- // if([[view.class description] hasPrefix:@"WKContent"]) {
- // targetView = view;
- // }
- // }
- // if (!targetView) {
- // return;
- // }
- // NSString *noInputAccessoryViewClassName = [NSString stringWithFormat:@"%@_NoInputAccessoryView", targetView.class.superclass];
- // Class newClass = NSClassFromString(noInputAccessoryViewClassName);
- //
- // if(newClass == nil) {
- // newClass = objc_allocateClassPair(targetView.class, [noInputAccessoryViewClassName cStringUsingEncoding:NSASCIIStringEncoding], 0);
- // if(!newClass) {
- // return;
- // }
- //
- // Method method = class_getInstanceMethod([_NoInputAccessoryView class], @selector(inputAccessoryView));
- //
- // class_addMethod(newClass, @selector(inputAccessoryView), method_getImplementation(method), method_getTypeEncoding(method));
- //
- // objc_registerClassPair(newClass);
- // }
- //
- // object_setClass(targetView, newClass);
- //}
- - (CollectModelType)returnType:(NSString *)url
- {
- NSString * name = [[url pathExtension] lowercaseString];
- if([name hasSuffix:@"png"] || [name hasSuffix:@"jpg"] || [name hasSuffix:@"jpeg"] || [name hasSuffix:@"bmp"]){
- return CollectModel_Image;
- }else{
- return CollectModel_file;
- }
- }
- #pragma mark - 通知存草稿箱
- - (void)backAction:(id)sender{
- if (self.type == CollectModel_Notice || self.type == CollectModel_InterMail) {
- if (self.isNull) {
- [super backAction:sender];
- }else{
- [self saveToDraftBox];
- }
- }else{
- [super backAction:sender];
- }
- }
- - (void)saveToDraftBox
- {
- WS(weakSelf);
- [[ShowKeepNoticeAlert initShowKeepNoticeAlertConfirm:^{
- weakSelf.isDraft = YES;
- [weakSelf submit];
- } cancle:^(ShowKeepNoticeCloseType colseType) {
- if(colseType == ShowKeepNoticeCloseType1){
- [weakSelf.navigationController popViewControllerAnimated:YES];
- }
- }] show];
- }
- - (void)backMailList
- {
- for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i > 0 ;i --) {
- if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"TDInterLeterHomeViewController")]) {
- [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
- return;
- }
- }
- }
- - (void)back1
- {
- if (self.isReturn) {
- for ( NSInteger i = (self.navigationController.viewControllers.count - 1); i > 0 ;i --) {
- if ([self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"CountDataVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyApprovalPageDetail")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"WorkFlowOrderController")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"WorkFlowDetailsController")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"TDGroupInfoListVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"OtherNoteBookVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"OtherFavoriteVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"NoteBookVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"EMChatViewController")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyFavoriteVC")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"HomeDetailController")]
- || [self.navigationController.viewControllers[i] isKindOfClass:NSClassFromString(@"MyTDTopicDetailVC")]) {
- [self.navigationController popToViewController:self.navigationController.viewControllers[i] animated:YES];
- return;
- }
- }
- }else{
- [self.navigationController popViewControllerAnimated:YES];
- }
- }
- #pragma mark - JS调起键盘
- - (void)allowDisplayingKeyboardWithoutUserAction {
- Class class = NSClassFromString(@"WKContentView");
- NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0};
- NSOperatingSystemVersion iOS_12_2_0 = (NSOperatingSystemVersion){12, 2, 0};
- NSOperatingSystemVersion iOS_13_0_0 = (NSOperatingSystemVersion){13, 0, 0};
- char * methodSignature = "_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:";
-
- if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_13_0_0]) {
- methodSignature = "_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:";
- } else if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_12_2_0]) {
- methodSignature = "_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:";
- }
-
- if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) {
- SEL selector = sel_getUid(methodSignature);
- Method method = class_getInstanceMethod(class, selector);
- IMP original = method_getImplementation(method);
- IMP override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) {
- ((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4);
- });
- method_setImplementation(method, override);
- } else {
- SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:");
- Method method = class_getInstanceMethod(class, selector);
- IMP original = method_getImplementation(method);
- IMP override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, id arg3) {
- ((void (*)(id, SEL, void*, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3);
- });
- method_setImplementation(method, override);
- }
- }
- @end
|