OfflineSettingViewController.m 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666
  1. //
  2. // OfflineSettingViewController.m
  3. // iSales-NPD
  4. //
  5. // Created by Ray on 5/11/16.
  6. // Copyright © 2016 United Software Applications, Inc. All rights reserved.
  7. //
  8. #import "OfflineSettingViewController.h"
  9. #import "iSalesNetwork.h"
  10. #import "MainViewController.h"
  11. #import "LoginViewController.h"
  12. #import "OLDataProvider.h"
  13. #import "OfflineUnlockViewController.h"
  14. //#import "SyncControlPanelViewController.h"
  15. @interface OfflineSettingViewController ()
  16. @end
  17. @implementation OfflineSettingViewController
  18. - (IBAction)onUnlockClicked:(id)sender {
  19. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Unlock offline" message:@"Unlock offline to sync with another account. Current user data will lost!" preferredStyle:UIAlertControllerStyleAlert];
  20. //block代码块取代了delegate
  21. UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Unlock" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  22. AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  23. sqlite3* db = [iSalesDB get_db];
  24. int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
  25. [iSalesDB close_db:db];
  26. if(offline_user_iscurrent>0)
  27. {
  28. self.bunlock=true;
  29. }
  30. else
  31. {
  32. OfflineUnlockViewController * unlockvc =[ self.storyboard instantiateViewControllerWithIdentifier:@"OfflineUnlockViewController"];
  33. unlockvc.returnValue = ^(bool blogin){
  34. self.bunlock=true;
  35. };
  36. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:unlockvc] ;
  37. // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  38. navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  39. [self presentViewController:navi animated:YES completion:^{
  40. // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  41. DebugLog(@"LoginViewController present.........");
  42. // self.btop = false;
  43. // <#code#>
  44. }];
  45. }
  46. // UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Are you sure remove all models from cart?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  47. // //block代码块取代了delegate
  48. //
  49. //
  50. //
  51. // UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  52. // UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Remove Models From Cart"];
  53. // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  54. //
  55. // NSDictionary* cart_json = [iSalesNetwork cart_remove:ids];
  56. //
  57. // dispatch_async(dispatch_get_main_queue(), ^{
  58. //
  59. // [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  60. //
  61. // if([[cart_json valueForKey:@"result"] intValue]==2)
  62. // {
  63. //
  64. // [self end_edit];
  65. // AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  66. // [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:true];
  67. // [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:true];
  68. // }
  69. // else
  70. // {
  71. // [RAUtils message_alert:[cart_json valueForKey:@"err_msg"] title:@"Delete Model" controller:self] ;
  72. // }
  73. //
  74. //
  75. //
  76. // });
  77. // });
  78. //
  79. //
  80. // }];
  81. //
  82. // UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  83. // DebugLog(@"No");
  84. // }];
  85. // [alertControl addAction:actionOne];
  86. //
  87. // [alertControl addAction:alertthree];
  88. //
  89. // //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  90. //
  91. //
  92. // [self presentViewController:alertControl animated:YES completion:nil];
  93. //
  94. // DebugLog(@"%@",self.edit_select_arr);
  95. //
  96. //
  97. }];
  98. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  99. DebugLog(@"No");
  100. }];
  101. [alertControl addAction:actionOne];
  102. [alertControl addAction:alertthree];
  103. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  104. [self presentViewController:alertControl animated:YES completion:nil];
  105. }
  106. - (void)viewDidLoad {
  107. [super viewDidLoad];
  108. self.bunlock=false;
  109. // Do any additional setup after loading the view.
  110. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  111. bool offline = [defaults boolForKey:@"EnableOfflineMode"] ;
  112. NSString* ver = [defaults stringForKey:@"OfflineVer"] ;
  113. NSString* lastsync = [defaults stringForKey:@"LastSync"] ;
  114. if(lastsync!=nil)
  115. self.label_sync.text = lastsync;
  116. if(ver==nil)
  117. self.label_ver.text=@"No offline data";
  118. else
  119. self.label_ver.text=ver;
  120. self.switch_offline.on = offline;
  121. self.edgesForExtendedLayout = UIRectEdgeNone ;
  122. UIBarButtonItem *closeButton = [[UIBarButtonItem alloc] initWithImage:[[UIImage imageNamed:@"close"] imageWithRenderingMode:UIImageRenderingModeAutomatic]
  123. style:UIBarButtonItemStylePlain
  124. target:self
  125. action:@selector( onCloseClick:)];
  126. self.navigationItem.rightBarButtonItem = closeButton;
  127. }
  128. - (IBAction)OnCheckUpdate:(id)sender {
  129. UIApplication * app = [UIApplication sharedApplication];
  130. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  131. if(appDelegate.bLogin==false)
  132. {
  133. LoginViewController * loginvc =[ [UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
  134. loginvc.returnValue = ^(bool blogin){
  135. if(blogin)
  136. {
  137. if(appDelegate.user_type==USER_ROLE_EMPLOYEE)
  138. {
  139. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  140. NSString* ver = [defaults stringForKey:@"OfflineVer"] ;
  141. if(sender==nil)
  142. {
  143. [appDelegate check_offline:ver useInternalAddress:self.switch_internal_address.isOn parentvc:self];
  144. // SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
  145. // syncVC.action_string=@"Download";
  146. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
  147. //
  148. //
  149. //
  150. //
  151. //
  152. // // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  153. //
  154. // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  155. // [self presentViewController:navi animated:YES completion:^{
  156. //
  157. // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  158. //
  159. // DebugLog(@"about present.........");
  160. //
  161. // // self.btop = false;
  162. // // <#code#>
  163. // }];
  164. }
  165. else
  166. {
  167. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Check offline update?" message:@"Please connect to WIFI network and plug charging cable, KEEP SCREEN ON AND KEEP APP RUNNING FOREGROUND, download data will take a while." preferredStyle:UIAlertControllerStyleAlert];
  168. //block代码块取代了delegate
  169. UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  170. [appDelegate check_offline:ver useInternalAddress:self.switch_internal_address.isOn parentvc:self];
  171. // SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
  172. // syncVC.action_string=@"Download";
  173. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
  174. //
  175. //
  176. //
  177. //
  178. //
  179. // // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  180. //
  181. // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  182. // [self presentViewController:navi animated:YES completion:^{
  183. //
  184. // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  185. //
  186. // DebugLog(@"about present.........");
  187. //
  188. // // self.btop = false;
  189. // // <#code#>
  190. // }];
  191. }];
  192. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  193. }];
  194. [alertControl addAction:actionTwo];
  195. [alertControl addAction:alertthree];
  196. [self presentViewController:alertControl animated:YES completion:nil];
  197. }
  198. }
  199. else
  200. {
  201. }
  202. }
  203. else
  204. {
  205. [RAUtils alert_view:@"Must login" title:@"Data sync"];
  206. }
  207. };
  208. UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:loginvc] ;
  209. // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  210. navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  211. [self presentViewController:navi animated:YES completion:^{
  212. // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  213. DebugLog(@"LoginViewController present.........");
  214. // self.btop = false;
  215. // <#code#>
  216. }];
  217. }
  218. else
  219. {
  220. // AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
  221. sqlite3* db = [iSalesDB get_db];
  222. int offline_user_iscurrent=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
  223. [iSalesDB close_db:db];
  224. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  225. NSString* ver = [defaults stringForKey:@"OfflineVer"] ;
  226. if(offline_user_iscurrent==0 && ver!=nil)
  227. {
  228. if(!self.bunlock)
  229. {
  230. [RAUtils alert_view:@"Current login account is different from the offline account, to continue with sync, all current offline data will be erased, you must unlock offline lock first. " title:@"Sync denied."];
  231. return;
  232. }
  233. else
  234. {
  235. ver=nil;
  236. }
  237. } else if (ver && self.bunlock) {
  238. ver = nil;
  239. }
  240. if(sender==nil)
  241. {
  242. [appDelegate check_offline:ver useInternalAddress:self.switch_internal_address.isOn parentvc:self];
  243. // SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
  244. // syncVC.action_string=@"Download";
  245. // UINavigationController* navi = [[UINavigationController alloc] initWithRootViewController:syncVC] ;
  246. //
  247. //
  248. //
  249. //
  250. //
  251. // // [self hackModalSheetSize:CGSizeMake(450, 200) ofVC:navi];
  252. //
  253. // navi.modalPresentationStyle = UIModalTransitionStyleCrossDissolve;//有三种状态,自己看看是哪种
  254. // [self presentViewController:navi animated:YES completion:^{
  255. //
  256. // // navi.view.superview.bounds = CGRectMake(0, 0, 480, 320);
  257. //
  258. // DebugLog(@"about present.........");
  259. //
  260. // // self.btop = false;
  261. // // <#code#>
  262. // }];
  263. }
  264. else
  265. {
  266. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Check offline update?" message:@"Please connect to WIFI network and plug charging cable, KEEP SCREEN ON AND KEEP APP RUNNING FOREGROUND, download data will take a while." preferredStyle:UIAlertControllerStyleAlert];
  267. //block代码块取代了delegate
  268. UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  269. [appDelegate check_offline:ver useInternalAddress:self.switch_internal_address.isOn parentvc:self];
  270. }];
  271. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  272. }];
  273. [alertControl addAction:actionTwo];
  274. [alertControl addAction:alertthree];
  275. [self presentViewController:alertControl animated:YES completion:nil];
  276. }
  277. }
  278. }
  279. - (void)onCloseClick:(UIButton *)sender {
  280. // if(self.onDismissVC)
  281. // self.onDismissVC();
  282. [self dismissViewControllerAnimated:true completion:nil];
  283. }
  284. - (void)didReceiveMemoryWarning {
  285. [super didReceiveMemoryWarning];
  286. // Dispose of any resources that can be recreated.
  287. }
  288. - (IBAction)onChangeOfflineSwitch:(id)sender {
  289. UIApplication * app = [UIApplication sharedApplication];
  290. AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  291. if(self.switch_offline.isOn==false)
  292. {
  293. //disable offline
  294. if(appDelegate.bLogin)
  295. {
  296. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Sign out"];
  297. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  298. NSDictionary* return_json = [iSalesNetwork logout];
  299. dispatch_async(dispatch_get_main_queue(), ^{
  300. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  301. if([[return_json valueForKey:@"result"] intValue]==2)
  302. {
  303. [appDelegate Logout];
  304. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  305. [defaults removeObjectForKey:@"EnableOfflineMode"];
  306. [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
  307. [defaults synchronize];
  308. appDelegate.offline_mode =self.switch_offline.isOn;
  309. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  310. [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
  311. [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
  312. [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
  313. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  314. [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
  315. [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
  316. [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
  317. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  318. [((MainViewController*)appDelegate.main_vc) switchToHome];
  319. }
  320. else
  321. {
  322. // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
  323. }
  324. });
  325. });
  326. }
  327. else
  328. {
  329. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  330. [defaults removeObjectForKey:@"EnableOfflineMode"];
  331. [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
  332. [defaults synchronize];
  333. appDelegate.offline_mode =self.switch_offline.isOn;
  334. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  335. [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
  336. [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
  337. [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
  338. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  339. [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
  340. [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
  341. [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
  342. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  343. [((MainViewController*)appDelegate.main_vc) switchToHome];
  344. }
  345. }
  346. else
  347. {
  348. bool haveofflineData=[OLDataProvider check_offlinedata];
  349. if(haveofflineData)
  350. {
  351. // have offline data
  352. if(appDelegate.bLogin)
  353. {
  354. UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait" title:@"Sign out"];
  355. dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  356. NSDictionary* return_json = [iSalesNetwork logout];
  357. dispatch_async(dispatch_get_main_queue(), ^{
  358. [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
  359. if([[return_json valueForKey:@"result"] intValue]==2)
  360. {
  361. [appDelegate Logout];
  362. NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
  363. [defaults removeObjectForKey:@"EnableOfflineMode"];
  364. [defaults setBool:self.switch_offline.isOn forKey:@"EnableOfflineMode"];
  365. [defaults synchronize];
  366. appDelegate.offline_mode =self.switch_offline.isOn;
  367. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  368. [((MainViewController*)appDelegate.main_vc) reloadDocuments:true immediately:false];
  369. [((MainViewController*)appDelegate.main_vc) reloadCart:true immediately:false];
  370. [((MainViewController*)appDelegate.main_vc) reloadWish:true immediately:false];
  371. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  372. [((MainViewController*)appDelegate.main_vc) reloadPortfolio:true immediately:false];
  373. [((MainViewController*)appDelegate.main_vc) reloadOrder:true immediately:false];
  374. [((MainViewController*)appDelegate.main_vc) reloadContact:true immediately:false];
  375. [((MainViewController*)appDelegate.main_vc) reloadCategory:true immediately:false];
  376. [((MainViewController*)appDelegate.main_vc) switchToHome];
  377. }
  378. else
  379. {
  380. // [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Out" controller:self] ;
  381. }
  382. });
  383. });
  384. }
  385. }
  386. else
  387. {
  388. //no offline data download form server first.
  389. // restore switch state.
  390. [self.switch_offline setOn:!self.switch_offline.isOn];
  391. UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Offline data not found, download it from server?" message:@"Please connect to WIFI network and plug charging cable, KEEP SCREEN ON AND KEEP APP RUNNING FOREGROUND, download data will take a while." preferredStyle:UIAlertControllerStyleAlert];
  392. //block代码块取代了delegate
  393. UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  394. [self OnCheckUpdate:nil];
  395. }];
  396. UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  397. // [self.switch_offline setOn:false];
  398. //[RAUtils message_alert:@"No item in the cart" title:@"Offline" controller:self] ;
  399. }];
  400. [alertControl addAction:actionTwo];
  401. [alertControl addAction:alertthree];
  402. //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  403. [self presentViewController:alertControl animated:YES completion:nil];
  404. }
  405. //
  406. // UIApplication * app = [UIApplication sharedApplication];
  407. // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
  408. //
  409. // NSString* ver = [defaults stringForKey:@"OfflineVer"] ;
  410. // //
  411. // // [appDelegate check_offline:ver];
  412. // // return;
  413. //
  414. // // if(ver.length==0)
  415. // {
  416. //
  417. // UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Check offline update?" message:nil preferredStyle:UIAlertControllerStyleAlert];
  418. // //block代码块取代了delegate
  419. //
  420. //
  421. // UIAlertAction *actionTwo = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
  422. // // UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Checking offline data"];
  423. // //init offline mode
  424. // // dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
  425. // //
  426. // //
  427. // // // [self check_offline];
  428. // // });
  429. // [appDelegate check_offline:ver];
  430. //
  431. //
  432. //
  433. // }];
  434. //
  435. // UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"No" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  436. // // [self.switch_offline setOn:false];
  437. // //[RAUtils message_alert:@"No item in the cart" title:@"Offline" controller:self] ;
  438. // }];
  439. //
  440. // [alertControl addAction:actionTwo];
  441. // [alertControl addAction:alertthree];
  442. //
  443. // //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
  444. //
  445. //
  446. // [self presentViewController:alertControl animated:YES completion:nil];
  447. //
  448. //
  449. //
  450. //
  451. //
  452. //
  453. //
  454. //
  455. // }
  456. // else
  457. // {
  458. //
  459. // }
  460. }
  461. }
  462. -(void) download_file:(NSString*)url type:(NSString*)type
  463. {
  464. }
  465. /*
  466. #pragma mark - Navigation
  467. // In a storyboard-based application, you will often want to do a little preparation before navigation
  468. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  469. // Get the new view controller using [segue destinationViewController].
  470. // Pass the selected object to the new view controller.
  471. }
  472. */
  473. @end