FRAOathMechanismTableViewCellController.m revision caa9e77dc369fea8df9ae2c598d3c83b7214c1cf
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * The contents of this file are subject to the terms of the Common Development and
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * Distribution License (the License). You may not use this file except in compliance with the
c58f1213e628a545081c70e26c6b67a841cff880vboxsync * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * specific language governing permission and limitations under the License.
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * When distributing Covered Software, include this CDDL Header Notice in each file and include
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * Header, with the fields enclosed by brackets [] replaced by your own identifying
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * information: "Portions copyright [year] [name of copyright owner]".
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync * Copyright 2016 ForgeRock AS.
bf087c7685846bdb0786c2214110615aa862a56fvboxsync#import "FRAHotpOathMechanism.h"
bf087c7685846bdb0786c2214110615aa862a56fvboxsync#import "FRATotpOathMechanism.h"
bf087c7685846bdb0786c2214110615aa862a56fvboxsync#import "FRAOathMechanismTableViewCellController.h"
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync#import "FRABlockActionSheet.h"
bf087c7685846bdb0786c2214110615aa862a56fvboxsync#import "FRAOathMechanismTableViewCell.h"
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync#import "FRAIdentityModel.h"
bf087c7685846bdb0786c2214110615aa862a56fvboxsync#import "FRAOathCode.h"
b39c3fa81cadaec00ebb2e7170a8db96998b7032vboxsync * Private interface.
b39c3fa81cadaec00ebb2e7170a8db96998b7032vboxsync@interface FRAOathMechanismTableViewCellController ()
bf087c7685846bdb0786c2214110615aa862a56fvboxsync * Timer for updating TOTP progress indicator and generating next code in sequence.
bf087c7685846bdb0786c2214110615aa862a56fvboxsync@property (strong, nonatomic) NSTimer *progressAnimationTimer;
74959ba85f2898a152aed46b41cfe908638f2420vboxsync@implementation FRAOathMechanismTableViewCellController
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync+ (instancetype)controllerWithView:(FRAOathMechanismTableViewCell*)view mechanism:(FRAMechanism *)mechanism {
bf087c7685846bdb0786c2214110615aa862a56fvboxsync return [[FRAOathMechanismTableViewCellController alloc] initWithView:view mechanism:mechanism];
90848209baf53a74f547fcf4254dc56d9b167ecavboxsync- (instancetype)initWithView:(FRAOathMechanismTableViewCell*)view mechanism:(FRAMechanism *)mechanism {
return self;
- (void)showHideElements {
- (void)didTouchUpInside {
// if no code has been generated, allow the first to be created by touching anywhere within the cell;
if (codeValue) {
return (FRAHotpOathMechanism *)self.mechanism ? ((FRAHotpOathMechanism *)self.mechanism).code : ((FRATotpOathMechanism *)self.mechanism).code;
return (FRAHotpOathMechanism *)self.mechanism ? ((FRAHotpOathMechanism *)self.mechanism).codeLength : ((FRATotpOathMechanism *)self.mechanism).codeLength;
- (void)generateNextCode {
- (void)reloadData {
UIColor *dashboardRed = [UIColor colorWithRed:169.0/255.0 green:68.0/255.0 blue:66.0/255.0 alpha:1.0];
NSString* codeValue = [@"" stringByPaddingToLength:[self mechanismCodeLength] withString:@"●" startingAtIndex:0];
- (void)startProgressAnimationTimer {
self.progressAnimationTimer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(timerCallback:) userInfo:nil repeats:YES];
- (void)stopProgressAnimationTimer {
@end