/*
* 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 <AVFoundation/AVFoundation.h>
#import "FRAAccountsTableViewController.h"
#import "FRAAccountTableViewCell.h"
#import "FRAAccountTableViewController.h"
#import "FRABlockAlertView.h"
#import "FRAHotpOathMechanism.h"
#import "FRAIdentity.h"
#import "FRAIdentityDatabase.h"
#import "FRAIdentityModel.h"
#import "FRAPushMechanism.h"
#import "FRATotpOathMechanism.h"
#import "FRAUIUtils.h"
NSString * const FRAAccountsTableViewControllerStoryboardIdentifer = @"AccountsTableViewController";
- (void)viewDidLoad {
[super viewDidLoad];
}
[super viewWillAppear:animated];
[[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];
}
}
}
if ([self hasPermissionToAccessCamera]) {
return YES;
} else {
});
}
}
return YES;
}
FRAAccountTableViewController* controller = (FRAAccountTableViewController*)segue.destinationViewController;
}
}
}
// Present accounts as a flat list not broken down into sections
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
FRAAccountTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
FRAHotpOathMechanism *hotpOathMechanism = (FRAHotpOathMechanism *)[identity mechanismOfClass:[FRAHotpOathMechanism class]];
FRATotpOathMechanism *totpOathMechanism = (FRATotpOathMechanism *)[identity mechanismOfClass:[FRATotpOathMechanism class]];
FRAPushMechanism *pushMechanism = (FRAPushMechanism *)[identity mechanismOfClass:[FRAPushMechanism class]];
cell.notificationsBadge.text = [NSString stringWithFormat:@"%lu", (unsigned long)[pushMechanism pendingNotificationsCount]];
} else if (pushMechanism) {
cell.notificationsBadge.text = [NSString stringWithFormat:@"%lu", (unsigned long)[pushMechanism pendingNotificationsCount]];
} else if (hotpOathMechanism || totpOathMechanism) {
} else {
}
return cell;
}
return YES;
}
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"account_delete_confirmation_title", nil), identity.issuer]
message:[NSString stringWithFormat:NSLocalizedString(@"account_delete_confirmation_message", nil), identity.issuer]
if (offset == deleteButton) {
}
}];
}
}
- (UITableViewCellEditingStyle)tableView:(UITableView *)aTableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath {
// Only offer delete option when in edit mode (disables swipe to delete)
} else {
return UITableViewCellEditingStyleNone;
}
}
-(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)
}
}
}
NSArray *sortedIdentities = [[self.identityModel identities] sortedArrayUsingComparator:^NSComparisonResult(FRAIdentity* first, FRAIdentity* second) {
if (comparisonResult == NSOrderedSame) {
}
return comparisonResult;
}];
}
}
}
}
FRABlockAlertView *alertView = [[FRABlockAlertView alloc] initWithTitle:[NSString stringWithFormat:NSLocalizedString(@"account_delete_error_title", nil), identity.issuer]
};
}
- (void)layoutUI {
} else {
}
}
- (void)addLabelToTableViewBackground {
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, self.tableView.bounds.size.width, self.tableView.bounds.size.height)];
}
- (void)clearTableViewBackground {
}
- (void)showHideEditButton {
} else {
}
}
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
if (authStatus == AVAuthorizationStatusAuthorized) {
return YES;
} else if (authStatus == AVAuthorizationStatusDenied || authStatus == AVAuthorizationStatusRestricted) {
return NO;
} else if (authStatus == AVAuthorizationStatusNotDetermined) {
reason:@"Camera permission should be established when app starts"
} else {
return NO;
}
}
- (void)askUserToAllowCameraAccess {
FRABlockAlertView* alertView = [[FRABlockAlertView alloc] initWithTitle:NSLocalizedString(@"qr_code_scan_camera_access_title", nil)
if (selection == settingsButton) {
}
}];
}
- (void)openAppSettings {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
@end