FRAAccountTableViewController.m revision 2250b453beee63acbe65426ed5f4aaa90e360435
/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2016 ForgeRock AS.
*/
#import "FRAAccountTableViewController.h"
#import "FRABlockAlertView.h"
#import "FRAIdentityDatabase.h"
#import "FRANotificationsTableViewController.h"
#import "FRAOathMechanism.h"
#import "FRAOathMechanismTableViewCell.h"
#import "FRAOathMechanismTableViewCellController.h"
#import "FRAPushMechanism.h"
/*! row index of static cell defining UI for OATH mechanism (cell is hidden if no such mechanism is registered) */
/*! row index of static cell defining UI for push mechanism (cell is hidden if no such mechanism is registered) */
- (void)viewDidLoad {
[super viewDidLoad];
// Show issuer logo in circle
// Bind identity model to UI
// _image = ... // TODO: Use UIImageView+AFNetworking category provided by AFNetworking
if ([self identityHasOathMechanism]) {
}
if ([self identityHasPushMechanism]) {
}
[self reloadData];
}
[super viewWillAppear:animated];
[self reloadData];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIdentityDatabaseChanged:) name:FRAIdentityDatabaseChangedNotification object:nil];
self.timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(timerCallback:) userInfo:nil repeats:YES];
}
}
[super viewWillDisappear:animated];
}
-(void)viewDidLayoutSubviews {
// make table cell separator lines full width (normally, they leave a ~10% gap at the left edge)
}
}
}
FRANotificationsTableViewController *controller = (FRANotificationsTableViewController *)segue.destinationViewController;
}
}
- (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath {
// only indent mechanisms when in edit mode as only mechanisms can be deleted
}
-(void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
// make table cell separator lines full width (normally, they leave a ~10% gap at the left edge)
}
}
}
- (void)tableView:(UITableView*)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
// Only offer delete option on mechanism rows when in edit mode (disables swipe to delete)
} else {
return UITableViewCellEditingStyleNone;
}
}
return 0; // hide the cell if OATH mechanism not registered
return 0; // hide the cell if push mechanism not registered
} else {
}
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
return;
}
if (mechanism) {
initWithTitle:@"Removing this will NOT turn off 2-step verification"
message:[NSString stringWithFormat:@"This may prevent you from logging into your %@ account.", self.identity.issuer]
cancelButtonTitle:@"Cancel"
if (offset == deleteButton) {
}
};
}
}
}
}
}
- (FRAOathMechanism *)oathMechanism {
}
- (FRAPushMechanism *)pushMechanism {
}
}
return mechanism;
}
// If this is the only mechanism registered to the identity, then remove the identity itself
// (after navigating back to the accounts screen so that it's removal can be animated)
// TODO: Handle error?
}
} else {
// If the parent identity has other mechanisms registered to it, then just remove this mechanism
// and leave the UI updates to be triggered in response to the database change event handler
// TODO: Handle error?
}
}
}
[self reloadData];
}
- (void)reloadData {
if ([self identityHasOathMechanism]) {
[FRAOathMechanismTableViewCellController controllerWithView:self.oathTableViewCell mechanism:[self oathMechanism]];
}
} else {
}
if ([self identityHasPushMechanism]) {
[FRAPushMechanismTableViewCellController controllerWithView:self.pushTableViewCell mechanism:[self pushMechanism]];
}
} else {
}
}
[self reloadData];
}
}
@end