CCManageAccount.m 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  1. //
  2. // CCManageAccount.m
  3. // Nextcloud
  4. //
  5. // Created by Marino Faggiana on 12/03/15.
  6. // Copyright (c) 2015 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 "CCManageAccount.h"
  24. #import "NSNotificationCenter+MainThread.h"
  25. #import "NCBridgeSwift.h"
  26. #import "CCUtility.h"
  27. #define actionSheetCancellaAccount 1
  28. @interface CCManageAccount ()
  29. {
  30. AppDelegate *appDelegate;
  31. }
  32. @end
  33. @implementation CCManageAccount
  34. - (void)initializeForm
  35. {
  36. XLFormDescriptor *form = [XLFormDescriptor formDescriptor];
  37. XLFormSectionDescriptor *section;
  38. XLFormRowDescriptor *row;
  39. NSArray *accounts = [[NCManageDatabase shared] getAllAccount];
  40. tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount];
  41. // Section : ACCOUNTS -------------------------------------------
  42. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_accounts_", nil) sectionOptions:XLFormSectionOptionCanDelete];
  43. [form addFormSection:section];
  44. for (tableAccount *account in accounts) {
  45. NSString *title = [NSString stringWithFormat:@"%@ %@", account.user, [NSURL URLWithString:account.urlBase].host];
  46. row = [XLFormRowDescriptor formRowDescriptorWithTag:account.account rowType:XLFormRowDescriptorTypeBooleanCheck title:title];
  47. // Avatar
  48. UIImage *avatar = [[[NCUtility alloc] init] loadUserImageFor:account.user displayName:account.displayName userBaseUrl:account];
  49. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  50. [row.cellConfig setObject:[UIFont systemFontOfSize:13.0] forKey:@"textLabel.font"];
  51. [row.cellConfig setObject:avatar forKey:@"imageView.image"];
  52. if (account.active) {
  53. row.value = @"YES";
  54. }
  55. [section addFormRow:row];
  56. }
  57. // Section : ALIAS --------------------------------------------------
  58. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_alias_", nil)];
  59. section.footerTitle = NSLocalizedString(@"_alias_footer_", nil);
  60. [form addFormSection:section];
  61. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"alias" rowType:XLFormRowDescriptorTypeText];
  62. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  63. [row.cellConfig setObject:[[UIImage imageNamed:@"form-textbox"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  64. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textField.font"];
  65. [row.cellConfig setObject:UIColor.labelColor forKey:@"textField.textColor"];
  66. row.value = activeAccount.alias;
  67. [section addFormRow:row];
  68. // Section : MANAGE ACCOUNT -------------------------------------------
  69. if ([NCBrandOptions shared].disable_manage_account == NO) {
  70. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_manage_account_", nil)];
  71. [form addFormSection:section];
  72. if ([NCBrandOptions shared].disable_multiaccount == NO) {
  73. // New Account nextcloud
  74. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"addAccount" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_add_account_", nil)];
  75. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  76. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  77. [row.cellConfig setObject:[[UIImage systemImageNamed:@"plus"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  78. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  79. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  80. row.action.formSelector = @selector(addAccount:);
  81. [section addFormRow:row];
  82. }
  83. // Set user status
  84. BOOL userStatus = [[NCGlobal shared] capabilityUserStatusEnabled];
  85. if (userStatus) {
  86. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"setUserStatus" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_set_user_status_", nil)];
  87. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  88. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  89. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  90. [row.cellConfig setObject:[[UIImage imageNamed:@"userStatusAway"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  91. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  92. row.action.formSelector = @selector(setUserStatus:);
  93. if (accounts.count == 0) row.disabled = @YES;
  94. [section addFormRow:row];
  95. }
  96. if ([NCBrandOptions shared].disable_multiaccount == NO) {
  97. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"accountRequest" rowType:XLFormRowDescriptorTypeBooleanSwitch title:NSLocalizedString(@"_settings_account_request_", nil)];
  98. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  99. [row.cellConfig setObject:[[UIImage imageNamed:@"users"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  100. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  101. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  102. if ([[NCKeychain alloc] init].accountRequest) row.value = @1;
  103. else row.value = @0;
  104. [section addFormRow:row];
  105. }
  106. }
  107. // Section : CERIFICATES -------------------------------------------
  108. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_certificates_", nil)];
  109. [form addFormSection:section];
  110. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"certificateDetails" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_certificate_details_", nil)];
  111. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  112. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  113. [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  114. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  115. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  116. row.action.formSelector = @selector(certificateDetails:);
  117. [section addFormRow:row];
  118. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"certificatePNDetails" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_certificate_pn_details_", nil)];
  119. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  120. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  121. [row.cellConfig setObject:[[UIImage imageNamed:@"lock"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  122. [row.cellConfig setObject:@(NSTextAlignmentLeft) forKey:@"textLabel.textAlignment"];
  123. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  124. row.action.formSelector = @selector(certificatePNDetails:);
  125. [section addFormRow:row];
  126. // Section : USER INFORMATION -------------------------------------------
  127. section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_personal_information_", nil)];
  128. [form addFormSection:section];
  129. // Full Name
  130. if ([activeAccount.displayName length] > 0) {
  131. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userfullname" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_full_name_", nil)];
  132. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  133. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  134. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  135. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  136. [row.cellConfig setObject:[[UIImage imageNamed:@"user"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  137. row.value = activeAccount.displayName;
  138. [section addFormRow:row];
  139. }
  140. // Address
  141. if ([activeAccount.address length] > 0) {
  142. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useraddress" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_address_", nil)];
  143. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  144. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  145. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  146. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  147. [row.cellConfig setObject:[[UIImage imageNamed:@"address"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  148. row.value = activeAccount.address;
  149. [section addFormRow:row];
  150. }
  151. // City + zip
  152. if ([activeAccount.city length] > 0) {
  153. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercity" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_city_", nil)];
  154. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  155. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  156. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  157. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  158. [row.cellConfig setObject:[[UIImage imageNamed:@"city"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  159. row.value = activeAccount.city;
  160. if ([activeAccount.zip length] > 0) {
  161. row.value = [NSString stringWithFormat:@"%@ %@", row.value, activeAccount.zip];
  162. }
  163. [section addFormRow:row];
  164. }
  165. // Country
  166. if ([activeAccount.country length] > 0) {
  167. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usercountry" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_country_", nil)];
  168. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  169. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  170. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  171. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  172. [row.cellConfig setObject:[[UIImage imageNamed:@"country"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  173. row.value = [[NSLocale systemLocale] displayNameForKey:NSLocaleCountryCode value:activeAccount.country];
  174. [section addFormRow:row];
  175. }
  176. // Phone
  177. if ([activeAccount.phone length] > 0) {
  178. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userphone" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_phone_", nil)];
  179. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  180. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  181. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  182. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  183. [row.cellConfig setObject:[[UIImage imageNamed:@"phone"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  184. row.value = activeAccount.phone;
  185. [section addFormRow:row];
  186. }
  187. // Email
  188. if ([activeAccount.email length] > 0) {
  189. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"useremail" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_email_", nil)];
  190. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  191. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  192. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  193. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  194. [row.cellConfig setObject:[[UIImage imageNamed:@"email"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  195. row.value = activeAccount.email;
  196. [section addFormRow:row];
  197. }
  198. // Web
  199. if ([activeAccount.website length] > 0) {
  200. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userweb" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_web_", nil)];
  201. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  202. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  203. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  204. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  205. [row.cellConfig setObject:[[UIImage imageNamed:@"network"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  206. row.value = activeAccount.website;
  207. [section addFormRow:row];
  208. }
  209. // Twitter
  210. if ([activeAccount.twitter length] > 0) {
  211. row = [XLFormRowDescriptor formRowDescriptorWithTag:@"usertwitter" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_twitter_", nil)];
  212. row.cellConfigAtConfigure[@"backgroundColor"] = UIColor.secondarySystemGroupedBackgroundColor;
  213. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"textLabel.font"];
  214. [row.cellConfig setObject:[UIFont systemFontOfSize:15.0] forKey:@"detailTextLabel.font"];
  215. [row.cellConfig setObject:UIColor.labelColor forKey:@"textLabel.textColor"];
  216. [row.cellConfig setObject:[[UIImage imageNamed:@"twitter"] imageWithColor:UIColor.systemGrayColor size:25] forKey:@"imageView.image"];
  217. row.value = activeAccount.twitter;
  218. [section addFormRow:row];
  219. }
  220. self.tableView.showsVerticalScrollIndicator = NO;
  221. self.form = form;
  222. // Open Login
  223. if (accounts.count == 0) {
  224. [appDelegate openLoginWithViewController:self selector:NCGlobal.shared.introLogin openLoginWeb:false];
  225. }
  226. }
  227. // MARK: - View Life Cycle
  228. - (void)viewDidLoad
  229. {
  230. [super viewDidLoad];
  231. self.title = NSLocalizedString(@"_credentials_", nil);
  232. appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
  233. self.view.backgroundColor = UIColor.systemGroupedBackgroundColor;
  234. self.tableView.backgroundColor = UIColor.systemGroupedBackgroundColor;
  235. [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changeUser) name:NCGlobal.shared.notificationCenterChangeUser object:nil];
  236. [self initializeForm];
  237. }
  238. - (void)viewWillAppear:(BOOL)animated
  239. {
  240. [super viewWillAppear:animated];
  241. appDelegate.activeViewController = self;
  242. }
  243. #pragma mark - NotificationCenter
  244. - (void)changeUser
  245. {
  246. [self initializeForm];
  247. }
  248. #pragma mark -
  249. -(void)formRowDescriptorValueHasChanged:(XLFormRowDescriptor *)rowDescriptor oldValue:(id)oldValue newValue:(id)newValue
  250. {
  251. [super formRowDescriptorValueHasChanged:rowDescriptor oldValue:oldValue newValue:newValue];
  252. if ([rowDescriptor.tag isEqualToString:@"accountRequest"]) {
  253. if ([[rowDescriptor.value valueData] boolValue] == YES) {
  254. [[NCKeychain alloc] init].accountRequest = true;
  255. } else {
  256. [[NCKeychain alloc] init].accountRequest = false;
  257. }
  258. }
  259. else if ([rowDescriptor.tag isEqualToString:@"alias"]) {
  260. if ([newValue isEqual:[NSNull null]]) {
  261. [[NCManageDatabase shared] setAccountAlias:@""];
  262. } else {
  263. [[NCManageDatabase shared] setAccountAlias:newValue];
  264. }
  265. }
  266. else {
  267. NSArray *accounts = [[NCManageDatabase shared] getAllAccount];
  268. tableAccount *activeAccount = [[NCManageDatabase shared] getActiveAccount];
  269. for (tableAccount *account in accounts) {
  270. if ([rowDescriptor.tag isEqualToString:account.account]) {
  271. if (![account.account isEqualToString:activeAccount.account]) {
  272. [appDelegate changeAccount:account.account userProfile:nil];
  273. }
  274. }
  275. }
  276. [self initializeForm];
  277. }
  278. }
  279. -(NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath
  280. {
  281. return NSLocalizedString(@"_remove_local_account_", nil);
  282. }
  283. -(void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
  284. [super tableView:tableView commitEditingStyle:editingStyle forRowAtIndexPath:indexPath];
  285. if (editingStyle == UITableViewCellEditingStyleDelete) {
  286. [self initializeForm];
  287. NSArray *accounts = [[NCManageDatabase shared] getAllAccount];
  288. tableAccount *tableAccountForDelete = accounts[indexPath.row];
  289. tableAccount *tableActiveAccount = [[NCManageDatabase shared] getActiveAccount];
  290. NSString *accountForDelete = tableAccountForDelete.account;
  291. NSString *activeAccount = tableActiveAccount.account;
  292. NSString *title = [NSString stringWithFormat:NSLocalizedString(@"_want_delete_account_",nil), accountForDelete];
  293. UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:nil preferredStyle:UIAlertControllerStyleActionSheet];
  294. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_remove_local_account_", nil) style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
  295. if (accountForDelete) {
  296. [appDelegate deleteAccount:accountForDelete wipe:false];
  297. }
  298. NSArray *listAccount = [[NCManageDatabase shared] getAccounts];
  299. if ([listAccount count] > 0) {
  300. if ([accountForDelete isEqualToString:activeAccount]) {
  301. [appDelegate changeAccount:listAccount[0] userProfile:nil];
  302. }
  303. }
  304. [self initializeForm];
  305. }]];
  306. [alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"_cancel_", nil) style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { }]];
  307. alertController.popoverPresentationController.sourceView = self.view;
  308. alertController.popoverPresentationController.sourceRect = [self.tableView rectForRowAtIndexPath:indexPath];
  309. [self presentViewController:alertController animated:YES completion:nil];
  310. }
  311. }
  312. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
  313. if (indexPath.section == 0) {
  314. return 60;
  315. } else {
  316. return NCGlobal.shared.heightCellSettings;
  317. }
  318. }
  319. #pragma mark -
  320. - (void)addAccount:(XLFormRowDescriptor *)sender
  321. {
  322. [self deselectFormRow:sender];
  323. [appDelegate openLoginWithViewController:self selector:NCGlobal.shared.introLogin openLoginWeb:false];
  324. }
  325. #pragma mark -
  326. - (void)setUserStatus:(XLFormRowDescriptor *)sender
  327. {
  328. [self deselectFormRow:sender];
  329. UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCUserStatus" bundle:nil] instantiateInitialViewController];
  330. [self presentViewController:navigationController animated:YES completion:nil];
  331. }
  332. #pragma mark -
  333. - (void)certificateDetails:(XLFormRowDescriptor *)sender
  334. {
  335. [self deselectFormRow:sender];
  336. UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCViewCertificateDetails" bundle:nil] instantiateInitialViewController];
  337. NCViewCertificateDetails *viewController = (NCViewCertificateDetails *)navigationController.topViewController;
  338. NSURL *url = [NSURL URLWithString:appDelegate.urlBase];
  339. viewController.host = [url host];
  340. [self presentViewController:navigationController animated:YES completion:nil];
  341. }
  342. - (void)certificatePNDetails:(XLFormRowDescriptor *)sender
  343. {
  344. [self deselectFormRow:sender];
  345. UINavigationController *navigationController = [[UIStoryboard storyboardWithName:@"NCViewCertificateDetails" bundle:nil] instantiateInitialViewController];
  346. NCViewCertificateDetails *viewController = (NCViewCertificateDetails *)navigationController.topViewController;
  347. NSURL *url = [NSURL URLWithString: NCBrandOptions.shared.pushNotificationServerProxy];
  348. viewController.host = [url host];
  349. viewController.certificateTitle = NSLocalizedString(@"_certificate_pn_view_", nil);
  350. [self presentViewController:navigationController animated:YES completion:nil];
  351. }
  352. @end