/*
* 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.
*
* Portions Copyright 2013 Nathaniel McCallum, Red Hat
*/
#import <AVFoundation/AVFoundation.h>
#import "AppDelegate.h"
#import "FRAApplicationAssembly.h"
#import "FRABlockAlertView.h"
#import "FRAError.h"
#import "FRAIdentity.h"
#import "FRAIdentityDatabase.h"
#import "FRAIdentityModel.h"
#import "FRAMechanismReaderAction.h"
#import "FRANotification.h"
#import "FRANotificationGateway.h"
#import "FRAPushMechanism.h"
#import "FRASplashEvents.h"
#import "FRAUriMechanismReader.h"
- (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
return YES;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleSplashScreenDidFinish:) name:FRASplashScreenDidFinish object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleIdentityDatabaseChanged:) name:FRAIdentityDatabaseChangedNotification object:nil];
return YES;
}
NSLog(@"applicationWillTerminate:");
}
- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
NSLog(@"application:didRegisterForRemoteNotificationsWithDeviceToken:");
[[[self assembly] notificationGateway] application:application didRegisterForRemoteNotificationsWithDeviceToken:deviceToken];
}
- (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error {
NSLog(@"application:didFailToRegisterForRemoteNotificationsWithError:");
[[[self assembly] notificationGateway] application:application didFailToRegisterForRemoteNotificationsWithError:error];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
NSLog(@"application:didReceiveRemoteNotification:");
[[[self assembly] notificationGateway] application:application didReceiveRemoteNotification:userInfo];
}
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler {
NSLog(@"application:didReceiveRemoteNotification:fetchCompletionHandler:");
[[[self assembly] notificationGateway] application:application didReceiveRemoteNotification:userInfo fetchCompletionHandler:completionHandler];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSLog(@"application:openURL:sourceApplication:annotation:");
// Create mechanism from URL
if (result) {
// Reload the view
}
return result;
}
- (id)initialFactory {
TyphoonComponentFactory *factory = [[TyphoonBlockComponentFactory alloc] initWithAssembly:[FRAApplicationAssembly assembly]];
return factory;
}
- (FRAApplicationAssembly *)assembly {
}
- (void)checkDependenciesAreInitialized {
FRABlockAlertView *alertView = [[FRABlockAlertView alloc] initWithTitle:NSLocalizedString(@"app_title", nil)
}
}
}
- (void)updateNotificationsCount {
[UIApplication sharedApplication].applicationIconBadgeNumber = [[[self assembly] identityModel] pendingNotificationsCount];
}
}
/*!
* If this is the first run, prompt user for access to the camera now - As doing it when attempting to
* scan a QR code interferes with presentation of the camera view
*/
- (void)ensureUserHasSetCameraAccessPermissions {
}
@end