CCManageAccount.m 22 KB

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