/*
* 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 "FRAActivityIndicator.h"
#import "FRABlockAlertView.h"
#import "FRAError.h"
#import "FRAIdentity.h"
#import "FRAUriMechanismReader.h"
#import "FRAMechanismReaderAction.h"
}
if (self) {
}
return self;
}
FRAMechanism *mechanism = [_mechanismReader parseFromString:code handler:[self mechanismReadCallback] error:&error];
if (mechanism) {
return YES;
}
return YES;
}
return NO;
}
/*!
* Displays the activity indicator and disables the current view.
*
* @param view The current view.
*/
if (!view) {
return;
}
activityIndicator = [[FRAActivityIndicator alloc] init:NSLocalizedString(@"qr_code_scan_contact_server", nil)];
}
/*!
* Hides the activity indicator and enables the current view.
*/
- (void)hideActivityIndicator {
}
/*!
* Handles duplicate mechanism detection.
*
* @param code The code with the mechanism details.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
*/
FRABlockAlertView *alertView = [[FRABlockAlertView alloc] initWithTitle:NSLocalizedString(@"mechanism_duplicate_title", nil)
handler:[self duplicateMechanismCallback:code identity:identity mechanism:duplicateMechanism error:error]];
}
/*!
* Generates a duplicate mechanism callback which once confirmed will remove the duplicate mechanism and re-parse the URL to add in the mechanism.
*
* @param code The code with the mechanism details.
* @param identity The identity the mechanism is added to.
* @param mechanism The duplicate mechanism.
* @param error If an error occurs, upon returns contains an NSError object that describes the problem. If you are not interested in possible errors, you may pass in NULL.
* @return The callback block.
*/
- (void(^)(NSInteger))duplicateMechanismCallback:(NSString *)code identity:(FRAIdentity *)identity mechanism:(FRAMechanism *)mechanism error:(NSError *__autoreleasing*) error {
if (successfullyRemoved) {
}
} else {
}
};
}
/*!
* Generates a callback for any asynchronous operation happening when reading a QR code.
*
* @return The callback block.
*/
if (!success) {
}
};
}
/*!
* Displays an alert message to the user.
*
* @param error The error to display to the user.
*
*/
FRABlockAlertView *alertView = [[FRABlockAlertView alloc] initWithTitle:NSLocalizedString(@"qr_code_scan_error_title", nil)
}
/*!
* Gets the localized error message to display to the user.
*
* @param error The error to display to the user.
*
*/
if (!error) {
return nil;
}
case FRANetworkFailure:
case FRAMissingDeviceId:
case FRAInvalidQRCode:
default:
return nil;
}
}
@end