RQUpdateView.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. //
  2. // RQUpdateView.m
  3. // SDJK
  4. //
  5. // Created by 张嵘 on 2022/5/19.
  6. //
  7. #import "RQUpdateView.h"
  8. #import "RQYDTXCQuestionModule.h"
  9. #import "RQYDTHCQuestionModule.h"
  10. #import "RQYDTKCQuestionModule.h"
  11. #import "RQYDTMTCQuestionModule.h"
  12. #import "RQYDTZGZJLYQuestionModule.h"
  13. #import "RQYDTZGZKYQuestionModule.h"
  14. #import "RQYDTZGZHYQuestionModule.h"
  15. #import "RQYDTZGZWXPQuestionModule.h"
  16. #import "RQYDTZGZCZCQuestionModule.h"
  17. #import "RQYDTZGZWYCQuestionModule.h"
  18. @interface RQUpdateView ()
  19. @property (weak, nonatomic) IBOutlet UIImageView *updateHeadImageView;
  20. @property (weak, nonatomic) IBOutlet UIImageView *headerImageView;
  21. @property (weak, nonatomic) IBOutlet UIStackView *headerTitleView;
  22. @property (weak, nonatomic) IBOutlet UILabel *headerTitleLabel;
  23. @property (weak, nonatomic) IBOutlet UILabel *titleLabel;
  24. @property (weak, nonatomic) IBOutlet UILabel *subTitleLabel;
  25. @property (weak, nonatomic) IBOutlet UIButton *downloadBtn;
  26. @property (weak, nonatomic) IBOutlet UIStackView *progressView;
  27. @property (weak, nonatomic) IBOutlet UILabel *progressLabel;
  28. @property (weak, nonatomic) IBOutlet UIProgressView *myProgress;
  29. @property (weak, nonatomic) IBOutlet UILabel *requestLabel;
  30. @property (weak, nonatomic) IBOutlet UIImageView *completeImageView;
  31. @property (weak, nonatomic) IBOutlet UIButton *closeBtn;
  32. @property (nonatomic, readwrite, assign) CGFloat progress;
  33. @end
  34. @implementation RQUpdateView
  35. + (instancetype)updateView {
  36. return [super rq_viewFromXib];
  37. }
  38. - (void)awakeFromNib {
  39. [super awakeFromNib];
  40. _progress = 0.f;
  41. _downloadBtn.layer.cornerRadius = RQ_FIT_HORIZONTAL(40.f) / 2.f;
  42. }
  43. - (void)setQuestionUpdateViewType:(RQQuestionUpdateViewType)questionUpdateViewType {
  44. switch (questionUpdateViewType) {
  45. case RQQuestionUpdateViewType_LibDownload: {
  46. _updateHeadImageView.hidden = YES;
  47. _headerImageView.hidden = NO;
  48. _headerTitleView.hidden = NO;
  49. _headerTitleLabel.text = @"让你距离拿本更进一步";
  50. _titleLabel.text = [NSString stringWithFormat:@"%@题库下载",[RQ_YDTQuestion_Module getCarTypeCNTiKuUpdateNameWithCarType:RQ_YDTQuestion_Module.carType]];
  51. _titleLabel.textAlignment = NSTextAlignmentLeft;
  52. _subTitleLabel.hidden = NO;
  53. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  54. _subTitleLabel.text = @"更新题库不会影响做题记录";
  55. _progressView.hidden = YES;
  56. _completeImageView.hidden = YES;
  57. _progressLabel.hidden = YES;
  58. _downloadBtn.hidden = NO;
  59. [_downloadBtn removeAllTargets];
  60. [_downloadBtn addTarget:self action:@selector(updateDB) forControlEvents:UIControlEventTouchUpInside];
  61. [_downloadBtn setTitleNormal:@"立即下载"];
  62. _closeBtn.hidden = NO;
  63. break;
  64. }
  65. case RQQuestionUpdateViewType_ExplainDownload: {
  66. _updateHeadImageView.hidden = YES;
  67. _headerImageView.hidden = NO;
  68. _headerTitleView.hidden = NO;
  69. _headerTitleLabel.text = @"让你距离拿本更进一步";
  70. _titleLabel.text = [NSString stringWithFormat:@"%@下载",@"题目解析"];
  71. _titleLabel.textAlignment = NSTextAlignmentLeft;
  72. _subTitleLabel.hidden = NO;
  73. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  74. _subTitleLabel.text = @"更新题库不会影响做题记录";
  75. _progressView.hidden = YES;
  76. _completeImageView.hidden = YES;
  77. _progressLabel.hidden = YES;
  78. _downloadBtn.hidden = NO;
  79. [_downloadBtn removeAllTargets];
  80. [_downloadBtn addTarget:self action:@selector(updateJS) forControlEvents:UIControlEventTouchUpInside];
  81. [_downloadBtn setTitleNormal:@"立即下载"];
  82. _closeBtn.hidden = NO;
  83. break;
  84. }
  85. case RQQuestionUpdateViewType_ExplainDownloading: {
  86. _updateHeadImageView.hidden = YES;
  87. _headerImageView.hidden = NO;
  88. _headerTitleView.hidden = NO;
  89. _headerTitleLabel.text = @"让你距离拿本更进一步";
  90. _titleLabel.text = [NSString stringWithFormat:@"%@下载中",@"题目解析"];
  91. _titleLabel.textAlignment = NSTextAlignmentLeft;
  92. _subTitleLabel.text = @"";
  93. _subTitleLabel.hidden = YES;
  94. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  95. _progressView.hidden = NO;
  96. _completeImageView.hidden = YES;
  97. _progressLabel.hidden = NO;
  98. _downloadBtn.hidden = YES;
  99. [_downloadBtn setTitleNormal:@"立即下载"];
  100. _closeBtn.hidden = YES;
  101. break;
  102. }
  103. case RQQuestionUpdateViewType_ExplainDownloaded: {
  104. _updateHeadImageView.hidden = YES;
  105. _headerImageView.hidden = NO;
  106. _headerTitleView.hidden = NO;
  107. _headerTitleLabel.text = @"下载完成,祝你早日拿本";
  108. _titleLabel.text = [NSString stringWithFormat:@"%@下载完成",@"题目解析"];
  109. _titleLabel.textAlignment = NSTextAlignmentLeft;
  110. _subTitleLabel.hidden = YES;
  111. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  112. _subTitleLabel.text = @"";
  113. _progressView.hidden = YES;
  114. _completeImageView.hidden = NO;
  115. _progressLabel.hidden = YES;
  116. _downloadBtn.hidden = NO;
  117. [_downloadBtn removeAllTargets];
  118. [_downloadBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  119. [_downloadBtn setTitleNormal:@"完成"];
  120. _closeBtn.hidden = YES;
  121. break;
  122. }
  123. case RQQuestionUpdateViewType_Request: {
  124. _updateHeadImageView.hidden = YES;
  125. _headerImageView.hidden = NO;
  126. _headerTitleView.hidden = NO;
  127. _headerTitleLabel.text = @"让你距离拿本更进一步";
  128. _titleLabel.text = [NSString stringWithFormat:@"%@题库下载中",[RQ_YDTQuestion_Module getCarTypeCNTiKuUpdateNameWithCarType:RQ_YDTQuestion_Module.carType]];
  129. _titleLabel.textAlignment = NSTextAlignmentLeft;
  130. _subTitleLabel.text = @"";
  131. _subTitleLabel.hidden = YES;
  132. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  133. _progressView.hidden = NO;
  134. _completeImageView.hidden = YES;
  135. _progressLabel.hidden = NO;
  136. _downloadBtn.hidden = YES;
  137. [_downloadBtn setTitleNormal:@"立即下载"];
  138. _closeBtn.hidden = YES;
  139. break;
  140. }
  141. case RQQuestionUpdateViewType_Complete: {
  142. _updateHeadImageView.hidden = YES;
  143. _headerImageView.hidden = NO;
  144. _headerTitleView.hidden = NO;
  145. _headerTitleLabel.text = @"下载完成,祝你早日拿本";
  146. _titleLabel.text = [NSString stringWithFormat:@"%@题库下载完成",[RQ_YDTQuestion_Module getCarTypeCNTiKuUpdateNameWithCarType:RQ_YDTQuestion_Module.carType]];
  147. _titleLabel.textAlignment = NSTextAlignmentLeft;
  148. _subTitleLabel.hidden = YES;
  149. _subTitleLabel.textAlignment = NSTextAlignmentLeft;
  150. _subTitleLabel.text = @"";
  151. _progressView.hidden = YES;
  152. _completeImageView.hidden = NO;
  153. _progressLabel.hidden = YES;
  154. _downloadBtn.hidden = NO;
  155. [_downloadBtn removeAllTargets];
  156. [_downloadBtn addTarget:self action:@selector(closeAction) forControlEvents:UIControlEventTouchUpInside];
  157. [_downloadBtn setTitleNormal:@"完成"];
  158. _closeBtn.hidden = YES;
  159. break;
  160. }
  161. case RQQuestionUpdateViewType_Default:
  162. default: {
  163. _updateHeadImageView.hidden = NO;
  164. _headerImageView.hidden = YES;
  165. _headerTitleView.hidden = YES;
  166. _headerTitleLabel.text = @"";
  167. _titleLabel.textAlignment = NSTextAlignmentCenter;
  168. _titleLabel.text = @"发现新版本";
  169. _subTitleLabel.hidden = NO;
  170. _subTitleLabel.textAlignment = NSTextAlignmentCenter;
  171. _subTitleLabel.text = @"全新版本,全新体验,赶快更新吧";
  172. _progressView.hidden = YES;
  173. _completeImageView.hidden = YES;
  174. _progressLabel.hidden = YES;
  175. _downloadBtn.hidden = NO;
  176. [_downloadBtn removeAllTargets];
  177. [_downloadBtn addTarget:self action:@selector(updateApp) forControlEvents:UIControlEventTouchUpInside];
  178. [_downloadBtn setTitleNormal:@"立即更新"];
  179. _closeBtn.hidden = NO;
  180. break;
  181. }
  182. }
  183. [self layoutIfNeeded];
  184. }
  185. - (void)updateDB {
  186. self.questionUpdateViewType = RQQuestionUpdateViewType_Request;
  187. NSString *dbNameStr = [[self.downloadUrl componentsSeparatedByString:@"/"].lastObject componentsSeparatedByString:@"."].firstObject;
  188. @weakify(self)
  189. NSError *error;
  190. /// 题库沙盒路径
  191. NSString *dbPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.db",dbNameStr]];
  192. /// 题库存储路径
  193. NSString *resourcePath = [[NSBundle mainBundle] pathForResource:dbNameStr ofType:@"db"];
  194. if ([RQFileManager isPathExist:dbPath]) {
  195. NSLog(@"数据库path-----%@",dbPath);
  196. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
  197. AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
  198. NSURL *url = [NSURL URLWithString:self.downloadUrl];
  199. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
  200. NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
  201. @strongify(self)
  202. dispatch_sync(dispatch_get_main_queue(), ^{
  203. _progress = downloadProgress.fractionCompleted;
  204. NSLog(@"%f",_progress);
  205. self.progressLabel.text = [NSString stringWithFormat:@"%.f%%",_progress * 100];
  206. [self.myProgress setProgress:_progress];
  207. });
  208. } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
  209. NSURL *pathURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
  210. return [pathURL URLByAppendingPathComponent:[NSString stringWithFormat:@"new%@",[response suggestedFilename]]];
  211. } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
  212. @strongify(self)
  213. if (!error) {
  214. /// 下载完成的存储路径
  215. NSString *resourcePath1 = filePath.path;
  216. switch (RQ_YDTQuestion_Module.carType) {
  217. case RQHomePageCarType_Car:
  218. [RQ_YDT_XC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  219. break;
  220. case RQHomePageCarType_Truck:
  221. [RQ_YDT_HC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  222. break;
  223. case RQHomePageCarType_Bus:
  224. [RQ_YDT_KC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  225. break;
  226. case RQHomePageCarType_Motorcycle:
  227. [RQ_YDT_MTC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  228. break;
  229. case RQHomePageCarType_ZGZ_JLY:
  230. [RQ_YDT_ZGZ_JLY_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  231. break;
  232. case RQHomePageCarType_ZGZ_KY:
  233. [RQ_YDT_ZGZ_KY_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  234. break;
  235. case RQHomePageCarType_ZGZ_HY:
  236. [RQ_YDT_ZGZ_HY_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  237. break;
  238. case RQHomePageCarType_ZGZ_WXP:
  239. [RQ_YDT_ZGZ_WXP_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  240. break;
  241. case RQHomePageCarType_ZGZ_CZC:
  242. [RQ_YDT_ZGZ_CZC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  243. break;
  244. case RQHomePageCarType_ZGZ_WYC:
  245. [RQ_YDT_ZGZ_WYC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  246. break;
  247. default:
  248. [RQ_YDT_XC_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  249. break;
  250. }
  251. self.questionUpdateViewType = RQQuestionUpdateViewType_Complete;
  252. [MBProgressHUD rq_showProgressHUD:@"升级题库中..."];
  253. dispatch_async(dispatch_get_global_queue(0, 0), ^{
  254. @strongify(self)
  255. /// 处理耗时操作的代码块...
  256. [RQ_YDTQuestion_Module saveQuestionsWithSubjectOneArr:[RQ_YDTQuestion_Module getQuestionWithSubject:RQHomePageSubjectType_SubjectOne exerciseType:RQExerciseType_Sequential]];
  257. [RQ_YDTQuestion_Module saveQuestionsWithSubjectFourArr:[RQ_YDTQuestion_Module getQuestionWithSubject:RQHomePageSubjectType_SubjectFour exerciseType:RQExerciseType_Sequential]];
  258. /// 通知主线程刷新
  259. dispatch_async(dispatch_get_main_queue(), ^{
  260. /// 回调或者说是通知主线程刷新,
  261. [MBProgressHUD rq_hideHUD];
  262. [RQ_APPDELEGATE.services popViewModelAnimated:YES];
  263. [MBProgressHUD rq_showTips:@"题库升级成功"];
  264. if (RQ_USER_MANAGER.isLogin) {
  265. [[RQ_HTTP_Service getMyScoreWithSubject:RQHomePageSubjectType_SubjectOne] subscribeNext:^(NSArray *examResultModelArr) {
  266. RQ_COMMON_MANAGER.myExamOneCount = examResultModelArr.count;
  267. RQ_COMMON_MANAGER.examResultOneListArr = examResultModelArr;
  268. }];
  269. [[RQ_HTTP_Service getMyScoreWithSubject:RQHomePageSubjectType_SubjectFour] subscribeNext:^(NSArray *examResultModelArr) {
  270. RQ_COMMON_MANAGER.myExamFourCount = examResultModelArr.count;
  271. RQ_COMMON_MANAGER.examResultFourListArr = examResultModelArr;
  272. }];
  273. } else {
  274. RQ_COMMON_MANAGER.myExamOneCount = 0;
  275. RQ_COMMON_MANAGER.examResultOneListArr = @[];
  276. RQ_COMMON_MANAGER.myExamFourCount = 0;
  277. RQ_COMMON_MANAGER.examResultFourListArr = @[];
  278. }
  279. });
  280. });
  281. } else {
  282. }
  283. }];
  284. [task resume];
  285. } else {
  286. [[RQFileManager fileManager] copyItemAtPath:resourcePath toPath:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.db",dbNameStr]] error:&error];
  287. switch (RQ_YDTQuestion_Module.carType) {
  288. case RQHomePageCarType_Car:
  289. [RQ_YDT_XC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  290. break;
  291. case RQHomePageCarType_Truck:
  292. [RQ_YDT_HC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  293. break;
  294. case RQHomePageCarType_Bus:
  295. [RQ_YDT_KC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  296. break;
  297. case RQHomePageCarType_Motorcycle:
  298. [RQ_YDT_MTC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  299. break;
  300. case RQHomePageCarType_ZGZ_JLY:
  301. [RQ_YDT_ZGZ_JLY_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  302. break;
  303. case RQHomePageCarType_ZGZ_KY:
  304. [RQ_YDT_ZGZ_KY_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  305. break;
  306. case RQHomePageCarType_ZGZ_HY:
  307. [RQ_YDT_ZGZ_HY_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  308. break;
  309. case RQHomePageCarType_ZGZ_WXP:
  310. [RQ_YDT_ZGZ_WXP_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  311. break;
  312. case RQHomePageCarType_ZGZ_CZC:
  313. [RQ_YDT_ZGZ_CZC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  314. break;
  315. case RQHomePageCarType_ZGZ_WYC:
  316. [RQ_YDT_ZGZ_WYC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  317. break;
  318. default:
  319. [RQ_YDT_XC_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  320. break;
  321. }
  322. }
  323. }
  324. - (void)updateJS {
  325. self.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownloading;
  326. NSString *dbNameStr = [[self.jsDownloadUrl componentsSeparatedByString:@"/"].lastObject componentsSeparatedByString:@"."].firstObject;
  327. @weakify(self)
  328. NSError *error;
  329. /// 题库沙盒路径
  330. NSString *dbPath = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.db",dbNameStr]];
  331. /// 题库存储路径
  332. NSString *resourcePath = [[NSBundle mainBundle] pathForResource:dbNameStr ofType:@"db"];
  333. if ([RQFileManager isPathExist:dbPath]) {
  334. NSLog(@"数据库path-----%@",dbPath);
  335. NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration];
  336. AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:configuration];
  337. NSURL *url = [NSURL URLWithString:self.jsDownloadUrl];
  338. NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
  339. NSURLSessionDownloadTask *task = [manager downloadTaskWithRequest:request progress:^(NSProgress * _Nonnull downloadProgress) {
  340. @strongify(self)
  341. dispatch_sync(dispatch_get_main_queue(), ^{
  342. @strongify(self)
  343. self.progress = downloadProgress.fractionCompleted;
  344. self.progressLabel.text = [NSString stringWithFormat:@"%.f%%",self.progress * 100];
  345. [self.myProgress setProgress:self.progress];
  346. });
  347. } destination:^NSURL * _Nonnull(NSURL * _Nonnull targetPath, NSURLResponse * _Nonnull response) {
  348. NSURL *pathURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:YES error:nil];
  349. return [pathURL URLByAppendingPathComponent:[NSString stringWithFormat:@"new%@",[response suggestedFilename]]];
  350. } completionHandler:^(NSURLResponse * _Nonnull response, NSURL * _Nullable filePath, NSError * _Nullable error) {
  351. @strongify(self)
  352. if (!error) {
  353. /// 下载完成的存储路径
  354. NSString *resourcePath1 = filePath.path;
  355. if([resourcePath1 containsString:@"kt_jq"]){
  356. [YN_YDT_JQ_Question_Module
  357. initDatabaseQueueWithResourcePath:resourcePath1];
  358. }else {
  359. [RQ_YDT_JS_Question_Module initDatabaseQueueWithResourcePath:resourcePath1];
  360. }
  361. self.questionUpdateViewType = RQQuestionUpdateViewType_ExplainDownloaded;
  362. } else {
  363. }
  364. }];
  365. [task resume];
  366. } else {
  367. [[RQFileManager fileManager] copyItemAtPath:resourcePath toPath:[[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.db",dbNameStr]] error:&error];
  368. [RQ_YDT_JS_Question_Module initDatabaseQueueWithResourcePath:resourcePath];
  369. }
  370. }
  371. - (void)closeAction {
  372. @weakify(self)
  373. [self.modalViewController hideWithAnimated:YES completion:^(BOOL finished) {
  374. @strongify(self)
  375. if (finished) {
  376. self.modalViewController.delegate = nil;
  377. }
  378. }];
  379. }
  380. - (void)updateApp {
  381. @weakify(self)
  382. NSURL *url = [NSURL URLWithString:@"itms-apps://itunes.apple.com/cn/app/ji-su-jia-pei-kua-jia-xiao-ban/id1214200225?l=en&mt=8"];
  383. [[UIApplication sharedApplication] openURL:url options:@{} completionHandler:^(BOOL success) {
  384. @strongify(self)
  385. if (success) {
  386. [self closeAction];
  387. }
  388. }];
  389. }
  390. - (IBAction)closeBtnAction:(id)sender {
  391. [self closeAction];
  392. }
  393. @end