diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 13:27:17 +0100 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2017-01-09 17:46:26 +0100 |
commit | 9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38 (patch) | |
tree | 408cbbb72315089db1b8efe58bce322f8734bb1b /platform/ios/Classes/MuAppDelegate.m | |
parent | 50b39c939345c36eb5e95c8a71ccdb8cd24c9aad (diff) | |
download | mupdf-9d96d035d3b7af53256ee64b5ddb0ad8bcf8df38.tar.xz |
Remove platform/ios directory.
The iOS viewer has been moved to its own git repository.
Diffstat (limited to 'platform/ios/Classes/MuAppDelegate.m')
-rw-r--r-- | platform/ios/Classes/MuAppDelegate.m | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/platform/ios/Classes/MuAppDelegate.m b/platform/ios/Classes/MuAppDelegate.m deleted file mode 100644 index 12f9978f..00000000 --- a/platform/ios/Classes/MuAppDelegate.m +++ /dev/null @@ -1,115 +0,0 @@ -#include "common.h" -#include "mupdf/fitz.h" - -#import "MuAppDelegate.h" - -#ifdef CRASHLYTICS_ENABLE -#import <Fabric/Fabric.h> -#import <Crashlytics/Crashlytics.h> -#endif - -@interface MuAppDelegate () <UINavigationControllerDelegate> -@end - -@implementation MuAppDelegate -{ - UIWindow *window; - UINavigationController *navigator; - MuLibraryController *library; - BOOL _isInBackground; -} - -- (BOOL) application: (UIApplication*)application didFinishLaunchingWithOptions: (NSDictionary*)launchOptions -{ - NSString *filename; - - queue = dispatch_queue_create("com.artifex.mupdf.queue", NULL); - - ctx = fz_new_context(NULL, NULL, ResourceCacheMaxSize); - fz_register_document_handlers(ctx); - -#ifdef CRASHLYTICS_ENABLE - NSLog(@"Starting Crashlytics"); - [Fabric with:@[[Crashlytics class]]]; -#endif - - screenScale = [UIScreen mainScreen].scale; - - library = [[MuLibraryController alloc] initWithStyle: UITableViewStylePlain]; - - navigator = [[UINavigationController alloc] initWithRootViewController: library]; - [navigator.navigationBar setTranslucent: YES]; - [navigator.toolbar setTranslucent: YES]; - navigator.delegate = self; - - window = [[UIWindow alloc] initWithFrame: [UIScreen mainScreen].bounds]; - window.backgroundColor = [UIColor grayColor]; - window.rootViewController = navigator; - [window makeKeyAndVisible]; - - filename = [[NSUserDefaults standardUserDefaults] objectForKey: @"OpenDocumentKey"]; - if (filename) - [library openDocument: filename]; - - filename = launchOptions[UIApplicationLaunchOptionsURLKey]; - NSLog(@"urlkey = %@\n", filename); - - return YES; -} - -- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation -{ - NSLog(@"openURL: %@\n", url); - if (url.fileURL) { - NSString *path = url.path; - NSString *dir = [NSString stringWithFormat: @"%@/Documents/", NSHomeDirectory()]; - path = [path stringByReplacingOccurrencesOfString:@"/private" withString:@""]; - path = [path stringByReplacingOccurrencesOfString:dir withString:@""]; - NSLog(@"file relative path: %@\n", path); - [library openDocument:path]; - return YES; - } - return NO; -} - -- (void)applicationDidEnterBackground:(UIApplication *)application -{ - printf("applicationDidEnterBackground!\n"); - [[NSUserDefaults standardUserDefaults] synchronize]; - _isInBackground = YES; -} - -- (void)applicationWillEnterForeground:(UIApplication *)application -{ - printf("applicationWillEnterForeground!\n"); - _isInBackground = NO; -} - -- (void)applicationDidBecomeActive:(UIApplication *)application -{ - printf("applicationDidBecomeActive!\n"); -} - -- (void)applicationWillTerminate:(UIApplication *)application -{ - printf("applicationWillTerminate!\n"); - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application -{ - NSLog(@"applicationDidReceiveMemoryWarning"); - int success = fz_shrink_store(ctx, _isInBackground ? 0 : 50); - NSLog(@"fz_shrink_store: success = %d", success); -} - -- (void) dealloc -{ - dispatch_release(queue); - [library release]; - [navigator release]; - [window release]; - [super dealloc]; -} - -@end |