CCManageAccount.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439
  1. //
  2. // CCManageAccount.m
  3. // Nextcloud iOS
  4. //
  5. // Created by Marino Faggiana on 12/03/15.
  6. // Copyright (c) 2017 Marino Faggiana. All rights reserved.
  7. //
  8. // Author Marino Faggiana <m.faggiana@twsweb.it>
  9. //
  10. // This program is free software: you can redistribute it and/or modify
  11. // it under the terms of the GNU General Public License as published by
  12. // the Free Software Foundation, either version 3 of the License, or
  13. // (at your option) any later version.
  14. //
  15. // This program is distributed in the hope that it will be useful,
  16. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. // GNU General Public License for more details.
  19. //
  20. // You should have received a copy of the GNU General Public License
  21. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. //
  23. #import <JDStatusBarNotification/JDStatusBarNotification.h>
  24. #import "CCManageAccount.h"
  25. #import "AppDelegate.h"
  26. #import "CCLogin.h"
  27. #import "NCAutoUpload.h"
  28. #import "NCBridgeSwift.h"
  29. #define actionSheetCancellaAccount 1
  30. @interface CCManageAccount () <CCLoginDelegate, CCLoginDelegateWeb>
  31. {
  32. AppDelegate *appDelegate;
  33. tableAccount *_tableAccount;
  34. }
  35. @end
  36. @implementation CCManageAccount
  37. -(id)init
  38. {
  39. XLFormDescriptor *form = [XLFormDescriptor formDescriptorWithTitle:NSLocalizedString(@"_credentials_", nil)];
  40. XLFormSectionDescriptor *section;
  41. XLFormRowDescriptor *row;
  42. appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  43. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeTheming) name:@"changeTheming" object:nil];
  44. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  45. // Section : CLOUD ACCOUNT -------------------------------------------
  46. section = [XLFormSectionDescriptor formSectionWithTitle:@"cloud account"];
  47. [form addFormSection:section];
  48. form.rowNavigationOptions = XLFormRowNavigationOptionNone;
  49. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"pickerAccount" rowType:XLFormRowDescriptorTypePicker];
  50. row.height = 100;
  51. if (listAccount.count > 0) {
  52. row.selectorOptions = listAccount;
  53. row.value = appDelegate.activeAccount;
  54. } else {
  55. row.selectorOptions = [[NSArray alloc] initWithObjects:@"", nil];
  56. }
  57. [section addFormRow:row];
  58. // Section : USER INFORMATION -------------------------------------------
  59. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_personal_information_", nil)];
  60. [form addFormSection:section];
  61. // Full Name
  62. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userfullname" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_full_name_", nil)];
  63. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  64. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  65. [section addFormRow:row];
  66. // Address
  67. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useraddress" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_address_", nil)];
  68. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  69. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  70. [section addFormRow:row];
  71. // Phone
  72. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userphone" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_phone_", nil)];
  73. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  74. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  75. [section addFormRow:row];
  76. // Email
  77. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useremail" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_email_", nil)];
  78. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  79. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  80. [section addFormRow:row];
  81. // Web
  82. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userweb" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_web_", nil)];
  83. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  84. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  85. [section addFormRow:row];
  86. // Twitter
  87. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usertwitter" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_twitter_", nil)];
  88. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  89. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  90. [section addFormRow:row];
  91. // Section : MANAGE ACCOUNT -------------------------------------------
  92. if ([NCBrandOptions sharedInstance].disable_manage_account == NO) {
  93. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_manage_account_", nil)];
  94. [form addFormSection:section];
  95. // Modify Account
  96. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"changePassword" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_change_password_", nil)];
  97. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  98. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"rename"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
  99. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  100. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  101. row.action.formSelector = @selector(changePassword:);
  102. if (listAccount.count == 0) row.disabled = @YES;
  103. [section addFormRow:row];
  104. // Brand
  105. if ([NCBrandOptions sharedInstance].disable_multiaccount == NO) {
  106. // New Account nextcloud
  107. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"addAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_add_account_", nil)];
  108. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  109. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"add"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
  110. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  111. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  112. row.action.formSelector = @selector(addAccount:);
  113. [section addFormRow:row];
  114. }
  115. // delete Account
  116. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"delAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_delete_account_", nil)];
  117. [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
  118. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  119. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"delete"] multiplier:2 color:[UIColor redColor]] forKey:@"imageView.image"];
  120. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  121. row.action.formSelector = @selector(answerDelAccount:);
  122. if (listAccount.count == 0) row.disabled = @YES;
  123. [section addFormRow:row];
  124. }
  125. return [super initWithForm:form];
  126. }
  127. // Apparirà
  128. - (void)viewWillAppear:(BOOL)animated
  129. {
  130. [super viewWillAppear:animated];
  131. self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
  132. self.tableView.showsVerticalScrollIndicator = NO;
  133. // Color
  134. [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
  135. [appDelegate aspectTabBar:self.tabBarController.tabBar hidden:NO];
  136. [self UpdateForm];
  137. }
  138. - (void)changeTheming
  139. {
  140. [appDelegate changeTheming:self];
  141. }
  142. #pragma --------------------------------------------------------------------------------------------
  143. #pragma mark === Delegate ===
  144. #pragma --------------------------------------------------------------------------------------------
  145. -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  146. {
  147. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  148. if ([rowDescriptor.tag isEqualToString:@"pickerAccount"] && oldValue && newValue) {
  149. if (![newValue isEqualToString:oldValue] && ![newValue isEqualToString:@""] && ![newValue isEqualToString:appDelegate.activeAccount])
  150. [self ChangeDefaultAccount:newValue];
  151. if ([newValue isEqualToString:@""]) {
  152. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  153. if ([listAccount count] > 0)
  154. [self ChangeDefaultAccount:listAccount[0]];
  155. }
  156. }
  157. }
  158. #pragma --------------------------------------------------------------------------------------------
  159. #pragma mark === Delegate Login ===
  160. #pragma --------------------------------------------------------------------------------------------
  161. - (void)loginSuccess:(NSInteger)loginType
  162. {
  163. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
  164. [appDelegate subscribingNextcloudServerPushNotification];
  165. }
  166. #pragma --------------------------------------------------------------------------------------------
  167. #pragma mark === Add Account ===
  168. #pragma --------------------------------------------------------------------------------------------
  169. - (void)addAccount:(XLFormRowDescriptor *)sender
  170. {
  171. [self deselectFormRow:sender];
  172. NSInteger transferInprogress = [[[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d OR status == %d OR status == %d)", appDelegate.activeAccount, k_metadataStatusInDownload, k_metadataStatusDownloading, k_metadataStatusInUpload, k_metadataStatusUploading] sorted:@"fileName" ascending:true] count];
  173. if (transferInprogress > 0) {
  174. [JDStatusBarNotification showWithStatus:NSLocalizedString(@"_transfers_in_queue_", nil) dismissAfter:k_dismissAfterSecond styleName:JDStatusBarStyleDefault];
  175. return;
  176. }
  177. [appDelegate.netQueue cancelAllOperations];
  178. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
  179. [appDelegate openLoginView:self loginType:k_login_Add selector:k_intro_login];
  180. });
  181. }
  182. #pragma --------------------------------------------------------------------------------------------
  183. #pragma mark === Modify Account ===
  184. #pragma --------------------------------------------------------------------------------------------
  185. - (void)changePassword:(XLFormRowDescriptor *)sender
  186. {
  187. [self deselectFormRow:sender];
  188. NSInteger transferInprogress = [[[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d OR status == %d OR status == %d)", appDelegate.activeAccount, k_metadataStatusInDownload, k_metadataStatusDownloading, k_metadataStatusInUpload, k_metadataStatusUploading] sorted:@"fileName" ascending:true] count];
  189. if (transferInprogress > 0) {
  190. [JDStatusBarNotification showWithStatus:NSLocalizedString(@"_transfers_in_queue_", nil) dismissAfter:k_dismissAfterSecond styleName:JDStatusBarStyleDefault];
  191. return;
  192. }
  193. [appDelegate.netQueue cancelAllOperations];
  194. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
  195. [appDelegate openLoginView:self loginType:k_login_Modify_Password selector:k_intro_login];
  196. });
  197. }
  198. #pragma --------------------------------------------------------------------------------------------
  199. #pragma mark === Delete Account ===
  200. #pragma --------------------------------------------------------------------------------------------
  201. - (void)deleteAccount:(NSString *)account
  202. {
  203. NSInteger transferInprogress = [[[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d OR status == %d OR status == %d)", appDelegate.activeAccount, k_metadataStatusInDownload, k_metadataStatusDownloading, k_metadataStatusInUpload, k_metadataStatusUploading] sorted:@"fileName" ascending:true] count];
  204. if (transferInprogress > 0) {
  205. [JDStatusBarNotification showWithStatus:NSLocalizedString(@"_transfers_in_queue_", nil) dismissAfter:k_dismissAfterSecond styleName:JDStatusBarStyleDefault];
  206. return;
  207. }
  208. [appDelegate unsubscribingNextcloudServerPushNotification];
  209. [appDelegate.netQueue cancelAllOperations];
  210. [[NCManageDatabase sharedInstance] clearTable:[tableAccount class] account:account];
  211. [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:account];
  212. [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:account];
  213. [[NCManageDatabase sharedInstance] clearTable:[tableDirectory class] account:account];
  214. [[NCManageDatabase sharedInstance] clearTable:[tableE2eEncryption class] account:account];
  215. [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:account];
  216. [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:account];
  217. [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:account];
  218. [[NCManageDatabase sharedInstance] clearTable:[tablePhotos class] account:account];
  219. [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:account];
  220. [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:account];
  221. // Clear active user
  222. [appDelegate settingActiveAccount:nil activeUrl:nil activeUser:nil activeUserID:nil activePassword:nil];
  223. }
  224. - (void)answerDelAccount:(XLFormRowDescriptor *)sender
  225. {
  226. [self deselectFormRow:sender];
  227. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_want_delete_",nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  228. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  229. XLFormPickerCell *pickerAccount = (XLFormPickerCell *)[[self.form formRowWithTag:@"pickerAccount"] cellForFormController:self];
  230. NSString *accountNow = pickerAccount.rowDescriptor.value;
  231. [self deleteAccount:accountNow];
  232. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  233. if ([listAccount count] > 0)
  234. [self ChangeDefaultAccount:listAccount[0]];
  235. else {
  236. [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
  237. }
  238. }]];
  239. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  240. [alertController dismissViewControllerAnimated:YES completion:nil];
  241. }]];
  242. alertController.popoverPresentationController.sourceView = self.view;
  243. NSIndexPath *indexPath = [self.form indexPathOfFormRow:sender];
  244. alertController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];
  245. [self presentViewController:alertController animated:YES completion:nil];
  246. }
  247. #pragma --------------------------------------------------------------------------------------------
  248. #pragma mark === Change Default Account ===
  249. #pragma --------------------------------------------------------------------------------------------
  250. - (void)ChangeDefaultAccount:(NSString *)account
  251. {
  252. NSInteger transferInprogress = [[[NCManageDatabase sharedInstance] getMetadatasWithPredicate:[NSPredicate predicateWithFormat:@"account == %@ AND (status == %d OR status == %d OR status == %d OR status == %d)", appDelegate.activeAccount, k_metadataStatusInDownload, k_metadataStatusDownloading, k_metadataStatusInUpload, k_metadataStatusUploading] sorted:@"fileName" ascending:true] count];
  253. if (transferInprogress > 0) {
  254. [JDStatusBarNotification showWithStatus:NSLocalizedString(@"_transfers_in_queue_", nil) dismissAfter:k_dismissAfterSecond styleName:JDStatusBarStyleDefault];
  255. return;
  256. }
  257. [appDelegate.netQueue cancelAllOperations];
  258. dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.3 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
  259. tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:account];
  260. if (tableAccount) {
  261. [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:tableAccount.password];
  262. // Init home
  263. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
  264. [self UpdateForm];
  265. [appDelegate subscribingNextcloudServerPushNotification];
  266. }
  267. });
  268. }
  269. #pragma --------------------------------------------------------------------------------------------
  270. #pragma mark === Update Form ===
  271. #pragma --------------------------------------------------------------------------------------------
  272. - (void)UpdateForm
  273. {
  274. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  275. if (listAccount.count == 0) {
  276. [appDelegate openLoginView:self loginType:k_login_Add_Forced selector:k_intro_login];
  277. return;
  278. }
  279. XLFormPickerCell *pickerAccount = (XLFormPickerCell *)[[self.form formRowWithTag:@"pickerAccount"] cellForFormController:self];
  280. pickerAccount.rowDescriptor.selectorOptions = listAccount;
  281. pickerAccount.rowDescriptor.value = appDelegate.activeAccount;
  282. NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@-avatar.png", [CCUtility getDirectoryUserData], [CCUtility getStringUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl]];
  283. UIImage *avatar = [UIImage imageWithContentsOfFile:fileNamePath];
  284. if (avatar) {
  285. avatar = [CCGraphics scaleImage:avatar toSize:CGSizeMake(40, 40) isAspectRation:YES];
  286. CCAvatar *avatarImageView = [[CCAvatar alloc] initWithImage:avatar borderColor:[UIColor lightGrayColor] borderWidth:0.5];
  287. CGSize imageSize = avatarImageView.bounds.size;
  288. UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
  289. CGContextRef context = UIGraphicsGetCurrentContext();
  290. [avatarImageView.layer renderInContext:context];
  291. avatar = UIGraphicsGetImageFromCurrentImageContext();
  292. UIGraphicsEndImageContext();
  293. } else {
  294. avatar = [UIImage imageNamed:@"avatarBN"];
  295. }
  296. [pickerAccount.rowDescriptor.cellConfig setObject:avatar forKey:@"imageView.image"];
  297. // --
  298. _tableAccount = [[NCManageDatabase sharedInstance] getAccountActive];
  299. XLFormRowDescriptor *rowUserFullName = [self.form formRowWithTag:@"userfullname"];
  300. XLFormRowDescriptor *rowUserAddress = [self.form formRowWithTag:@"useraddress"];
  301. XLFormRowDescriptor *rowUserPhone = [self.form formRowWithTag:@"userphone"];
  302. XLFormRowDescriptor *rowUserEmail = [self.form formRowWithTag:@"useremail"];
  303. XLFormRowDescriptor *rowUserWeb = [self.form formRowWithTag:@"userweb"];
  304. XLFormRowDescriptor *rowUserTwitter = [self.form formRowWithTag:@"usertwitter"];
  305. rowUserFullName.value = _tableAccount.displayName;
  306. if ([_tableAccount.displayName isEqualToString:@""] || _tableAccount.displayName == nil) rowUserFullName.hidden = @YES;
  307. else rowUserFullName.hidden = @NO;
  308. rowUserAddress.value = _tableAccount.address;
  309. if ([_tableAccount.address isEqualToString:@""] || _tableAccount.address == nil) rowUserAddress.hidden = @YES;
  310. else rowUserAddress.hidden = @NO;
  311. rowUserPhone.value = _tableAccount.phone;
  312. if ([_tableAccount.phone isEqualToString:@""] || _tableAccount.phone == nil) rowUserPhone.hidden = @YES;
  313. else rowUserPhone.hidden = @NO;
  314. rowUserEmail.value = _tableAccount.email;
  315. if ([_tableAccount.email isEqualToString:@""] || _tableAccount.email == nil) rowUserEmail.hidden = @YES;
  316. else rowUserEmail.hidden = @NO;
  317. rowUserWeb.value = _tableAccount.webpage;
  318. if ([_tableAccount.webpage isEqualToString:@""] || _tableAccount.webpage == nil) rowUserWeb.hidden = @YES;
  319. else rowUserWeb.hidden = @NO;
  320. rowUserTwitter.value = _tableAccount.twitter;
  321. if ([_tableAccount.twitter isEqualToString:@""] || _tableAccount.twitter == nil) rowUserTwitter.hidden = @YES;
  322. else rowUserTwitter.hidden = @NO;
  323. [self.tableView reloadData];
  324. [self performSelector:@selector(reloadData) withObject:nil afterDelay:1];
  325. }
  326. - (void)reloadData
  327. {
  328. [self.tableView reloadData];
  329. }
  330. @end