CCManageAccount.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  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 <marino.faggiana@nextcloud.com>
  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. // City
  72. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercity" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_city_", 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. // Zip
  77. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userzip" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_zip_", 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. // Phone
  82. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userphone" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_phone_", 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. // Email
  87. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useremail" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_email_", 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. // Web
  92. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userweb" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_web_", nil)];
  93. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  94. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  95. [section addFormRow:row];
  96. // Twitter
  97. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usertwitter" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_twitter_", nil)];
  98. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  99. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  100. [section addFormRow:row];
  101. // Business Type
  102. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userbusinesstype" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_businesstype_", nil)];
  103. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  104. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  105. [section addFormRow:row];
  106. // Business Size
  107. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userbusinesssize" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_businesssize_", nil)];
  108. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  109. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  110. [section addFormRow:row];
  111. // Role
  112. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userrole" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_role_", nil)];
  113. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  114. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  115. [section addFormRow:row];
  116. // Company
  117. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercompany" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_company_", nil)];
  118. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  119. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
  120. [section addFormRow:row];
  121. // Section : MANAGE ACCOUNT -------------------------------------------
  122. if ([NCBrandOptions sharedInstance].disable_manage_account == NO) {
  123. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_manage_account_", nil)];
  124. [form addFormSection:section];
  125. // Modify Account
  126. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"changePassword" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_change_password_", nil)];
  127. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  128. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"rename"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
  129. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  130. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  131. row.action.formSelector = @selector(changePassword:);
  132. if (listAccount.count == 0) row.disabled = @YES;
  133. [section addFormRow:row];
  134. // Brand
  135. if ([NCBrandOptions sharedInstance].disable_multiaccount == NO) {
  136. // New Account nextcloud
  137. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"addAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_add_account_", nil)];
  138. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  139. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"add"] multiplier:2 color:[NCBrandColor sharedInstance].icon] forKey:@"imageView.image"];
  140. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  141. [row.cellConfig setObject:[UIColor blackColor] forKey:@"textLabel.textColor"];
  142. row.action.formSelector = @selector(addAccount:);
  143. [section addFormRow:row];
  144. }
  145. // delete Account
  146. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"delAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_delete_account_", nil)];
  147. [row.cellConfig setObject:[UIColor redColor] forKey:@"textLabel.textColor"];
  148. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
  149. [row.cellConfig setObject:[CCGraphics changeThemingColorImage:[UIImage imageNamed:@"trash"] width:50 height:50 color:[UIColor redColor]] forKey:@"imageView.image"];
  150. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  151. row.action.formSelector = @selector(answerDelAccount:);
  152. if (listAccount.count == 0) row.disabled = @YES;
  153. [section addFormRow:row];
  154. }
  155. return [super initWithForm:form];
  156. }
  157. // Apparirà
  158. - (void)viewWillAppear:(BOOL)animated
  159. {
  160. [super viewWillAppear:animated];
  161. self.tableView.backgroundColor = [NCBrandColor sharedInstance].backgroundView;
  162. self.tableView.showsVerticalScrollIndicator = NO;
  163. // Color
  164. [appDelegate aspectNavigationControllerBar:self.navigationController.navigationBar online:[appDelegate.reachability isReachable] hidden:NO];
  165. [appDelegate aspectTabBar:self.tabBarController.tabBar hidden:NO];
  166. [self UpdateForm];
  167. }
  168. - (void)changeTheming
  169. {
  170. [appDelegate changeTheming:self];
  171. }
  172. #pragma --------------------------------------------------------------------------------------------
  173. #pragma mark === Delegate ===
  174. #pragma --------------------------------------------------------------------------------------------
  175. -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  176. {
  177. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  178. if ([rowDescriptor.tag isEqualToString:@"pickerAccount"] && oldValue && newValue) {
  179. if (![newValue isEqualToString:oldValue] && ![newValue isEqualToString:@""] && ![newValue isEqualToString:appDelegate.activeAccount])
  180. [self ChangeDefaultAccount:newValue];
  181. if ([newValue isEqualToString:@""]) {
  182. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  183. if ([listAccount count] > 0)
  184. [self ChangeDefaultAccount:listAccount[0]];
  185. }
  186. }
  187. }
  188. #pragma --------------------------------------------------------------------------------------------
  189. #pragma mark === Delegate Login ===
  190. #pragma --------------------------------------------------------------------------------------------
  191. - (void)loginSuccess:(NSInteger)loginType
  192. {
  193. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
  194. }
  195. #pragma --------------------------------------------------------------------------------------------
  196. #pragma mark === Add Account ===
  197. #pragma --------------------------------------------------------------------------------------------
  198. - (void)addAccount:(XLFormRowDescriptor *)sender
  199. {
  200. [self deselectFormRow:sender];
  201. [appDelegate openLoginView:self delegate:self loginType:k_login_Add selector:k_intro_login];
  202. }
  203. #pragma --------------------------------------------------------------------------------------------
  204. #pragma mark === Modify Account ===
  205. #pragma --------------------------------------------------------------------------------------------
  206. - (void)changePassword:(XLFormRowDescriptor *)sender
  207. {
  208. [self deselectFormRow:sender];
  209. [appDelegate openLoginView:self delegate:self loginType:k_login_Modify_Password selector:k_intro_login];
  210. }
  211. #pragma --------------------------------------------------------------------------------------------
  212. #pragma mark === Delete Account ===
  213. #pragma --------------------------------------------------------------------------------------------
  214. - (void)deleteAccount:(NSString *)account
  215. {
  216. tableAccount *tableAccount = [[NCManageDatabase sharedInstance] getAccountWithPredicate:[NSPredicate predicateWithFormat:@"account == %@", account]];
  217. if (tableAccount) {
  218. [appDelegate unsubscribingNextcloudServerPushNotification:tableAccount.account url:tableAccount.url withSubscribing:false];
  219. }
  220. [[NCManageDatabase sharedInstance] clearTable:[tableAccount class] account:account];
  221. [[NCManageDatabase sharedInstance] clearTable:[tableActivity class] account:account];
  222. [[NCManageDatabase sharedInstance] clearTable:[tableActivitySubjectRich class] account:account];
  223. [[NCManageDatabase sharedInstance] clearTable:[tableCapabilities class] account:account];
  224. [[NCManageDatabase sharedInstance] clearTable:[tableDirectory class] account:account];
  225. [[NCManageDatabase sharedInstance] clearTable:[tableE2eEncryption class] account:account];
  226. [[NCManageDatabase sharedInstance] clearTable:[tableExternalSites class] account:account];
  227. [[NCManageDatabase sharedInstance] clearTable:[tableLocalFile class] account:account];
  228. [[NCManageDatabase sharedInstance] clearTable:[tableMetadata class] account:account];
  229. [[NCManageDatabase sharedInstance] clearTable:[tableMedia class] account:account];
  230. [[NCManageDatabase sharedInstance] clearTable:[tablePhotoLibrary class] account:account];
  231. [[NCManageDatabase sharedInstance] clearTable:[tableShare class] account:account];
  232. // Clear active user
  233. [appDelegate settingActiveAccount:nil activeUrl:nil activeUser:nil activeUserID:nil activePassword:nil];
  234. }
  235. - (void)answerDelAccount:(XLFormRowDescriptor *)sender
  236. {
  237. [self deselectFormRow:sender];
  238. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:NSLocalizedString(@"_want_delete_",nil) message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  239. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_delete_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  240. XLFormPickerCell *pickerAccount = (XLFormPickerCell *)[[self.form formRowWithTag:@"pickerAccount"] cellForFormController:self];
  241. NSString *accountNow = pickerAccount.rowDescriptor.value;
  242. [self deleteAccount:accountNow];
  243. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  244. if ([listAccount count] > 0)
  245. [self ChangeDefaultAccount:listAccount[0]];
  246. else {
  247. [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
  248. }
  249. }]];
  250. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
  251. [alertController dismissViewControllerAnimated:YES completion:nil];
  252. }]];
  253. alertController.popoverPresentationController.sourceView = self.view;
  254. NSIndexPath *indexPath = [self.form indexPathOfFormRow:sender];
  255. alertController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];
  256. [self presentViewController:alertController animated:YES completion:nil];
  257. }
  258. #pragma --------------------------------------------------------------------------------------------
  259. #pragma mark === Change Default Account ===
  260. #pragma --------------------------------------------------------------------------------------------
  261. - (void)ChangeDefaultAccount:(NSString *)account
  262. {
  263. tableAccount *tableAccount = [[NCManageDatabase sharedInstance] setAccountActive:account];
  264. if (tableAccount) {
  265. [appDelegate settingActiveAccount:tableAccount.account activeUrl:tableAccount.url activeUser:tableAccount.user activeUserID:tableAccount.userID activePassword:[CCUtility getPassword:tableAccount.account]];
  266. // Init home
  267. [[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"initializeMain" object:nil userInfo:nil];
  268. [self UpdateForm];
  269. }
  270. }
  271. #pragma --------------------------------------------------------------------------------------------
  272. #pragma mark === Update Form ===
  273. #pragma --------------------------------------------------------------------------------------------
  274. - (void)UpdateForm
  275. {
  276. NSArray *listAccount = [[NCManageDatabase sharedInstance] getAccounts];
  277. if (listAccount.count == 0) {
  278. [appDelegate openLoginView:self delegate:self loginType:k_login_Add_Forced selector:k_intro_login];
  279. return;
  280. }
  281. XLFormPickerCell *pickerAccount = (XLFormPickerCell *)[[self.form formRowWithTag:@"pickerAccount"] cellForFormController:self];
  282. pickerAccount.rowDescriptor.selectorOptions = listAccount;
  283. pickerAccount.rowDescriptor.value = appDelegate.activeAccount;
  284. NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@-%@.png", [CCUtility getDirectoryUserData], [CCUtility getStringUser:appDelegate.activeUser activeUrl:appDelegate.activeUrl], appDelegate.activeUser];
  285. UIImage *avatar = [UIImage imageWithContentsOfFile:fileNamePath];
  286. if (avatar) {
  287. avatar = [CCGraphics scaleImage:avatar toSize:CGSizeMake(40, 40) isAspectRation:YES];
  288. CCAvatar *avatarImageView = [[CCAvatar alloc] initWithImage:avatar borderColor:[UIColor lightGrayColor] borderWidth:0.5];
  289. CGSize imageSize = avatarImageView.bounds.size;
  290. UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
  291. CGContextRef context = UIGraphicsGetCurrentContext();
  292. [avatarImageView.layer renderInContext:context];
  293. avatar = UIGraphicsGetImageFromCurrentImageContext();
  294. UIGraphicsEndImageContext();
  295. } else {
  296. avatar = [UIImage imageNamed:@"avatarBN"];
  297. }
  298. [pickerAccount.rowDescriptor.cellConfig setObject:avatar forKey:@"imageView.image"];
  299. // --
  300. _tableAccount = [[NCManageDatabase sharedInstance] getAccountActive];
  301. XLFormRowDescriptor *rowUserFullName = [self.form formRowWithTag:@"userfullname"];
  302. XLFormRowDescriptor *rowUserAddress = [self.form formRowWithTag:@"useraddress"];
  303. XLFormRowDescriptor *rowUserCity = [self.form formRowWithTag:@"usercity"];
  304. XLFormRowDescriptor *rowUserZip = [self.form formRowWithTag:@"userzip"];
  305. XLFormRowDescriptor *rowUserPhone = [self.form formRowWithTag:@"userphone"];
  306. XLFormRowDescriptor *rowUserEmail = [self.form formRowWithTag:@"useremail"];
  307. XLFormRowDescriptor *rowUserWeb = [self.form formRowWithTag:@"userweb"];
  308. XLFormRowDescriptor *rowUserTwitter = [self.form formRowWithTag:@"usertwitter"];
  309. XLFormRowDescriptor *rowUserBusinessType = [self.form formRowWithTag:@"userbusinesstype"];
  310. XLFormRowDescriptor *rowUserBusinessSize = [self.form formRowWithTag:@"userbusinesssize"];
  311. XLFormRowDescriptor *rowUserRole = [self.form formRowWithTag:@"userrole"];
  312. XLFormRowDescriptor *rowUserCompany = [self.form formRowWithTag:@"usercompany"];
  313. rowUserFullName.value = _tableAccount.displayName;
  314. if ([_tableAccount.displayName isEqualToString:@""] || _tableAccount.displayName == nil) rowUserFullName.hidden = @YES;
  315. else rowUserFullName.hidden = @NO;
  316. rowUserAddress.value = _tableAccount.address;
  317. if ([_tableAccount.address isEqualToString:@""] || _tableAccount.address == nil) rowUserAddress.hidden = @YES;
  318. else rowUserAddress.hidden = @NO;
  319. rowUserCity.value = _tableAccount.city;
  320. if ([_tableAccount.city isEqualToString:@""] || _tableAccount.city == nil) rowUserCity.hidden = @YES;
  321. else rowUserCity.hidden = @NO;
  322. rowUserZip.value = _tableAccount.zip;
  323. if ([_tableAccount.zip isEqualToString:@""] || _tableAccount.zip == nil) rowUserZip.hidden = @YES;
  324. else rowUserZip.hidden = @NO;
  325. rowUserPhone.value = _tableAccount.phone;
  326. if ([_tableAccount.phone isEqualToString:@""] || _tableAccount.phone == nil) rowUserPhone.hidden = @YES;
  327. else rowUserPhone.hidden = @NO;
  328. rowUserEmail.value = _tableAccount.email;
  329. if ([_tableAccount.email isEqualToString:@""] || _tableAccount.email == nil) rowUserEmail.hidden = @YES;
  330. else rowUserEmail.hidden = @NO;
  331. rowUserWeb.value = _tableAccount.webpage;
  332. if ([_tableAccount.webpage isEqualToString:@""] || _tableAccount.webpage == nil) rowUserWeb.hidden = @YES;
  333. else rowUserWeb.hidden = @NO;
  334. rowUserTwitter.value = _tableAccount.twitter;
  335. if ([_tableAccount.twitter isEqualToString:@""] || _tableAccount.twitter == nil) rowUserTwitter.hidden = @YES;
  336. else rowUserTwitter.hidden = @NO;
  337. rowUserBusinessType.value = _tableAccount.businessType;
  338. if ([_tableAccount.businessType isEqualToString:@""] || _tableAccount.businessType == nil) rowUserBusinessType.hidden = @YES;
  339. else rowUserBusinessType.hidden = @NO;
  340. rowUserBusinessSize.value = @(_tableAccount.businessSize).stringValue;
  341. if (_tableAccount.businessSize > 0) rowUserBusinessSize.hidden = @YES;
  342. else rowUserBusinessSize.hidden = @NO;
  343. rowUserRole.value = _tableAccount.role;
  344. if ([_tableAccount.role isEqualToString:@""] || _tableAccount.role == nil) rowUserRole.hidden = @YES;
  345. else rowUserRole.hidden = @NO;
  346. rowUserCompany.value = _tableAccount.company;
  347. if ([_tableAccount.company isEqualToString:@""] || _tableAccount.company == nil) rowUserCompany.hidden = @YES;
  348. else rowUserCompany.hidden = @NO;
  349. [self.tableView reloadData];
  350. [self performSelector:@selector(reloadData) withObject:nil afterDelay:1];
  351. }
  352. - (void)reloadData
  353. {
  354. [self.tableView reloadData];
  355. }
  356. @end