Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

CDVAppDelegate.m 3.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. #import "CDVAppDelegate.h"
  18. @implementation CDVAppDelegate
  19. @synthesize window, viewController;
  20. - (id)init
  21. {
  22. self = [super init];
  23. return self;
  24. }
  25. #pragma mark UIApplicationDelegate implementation
  26. /**
  27. * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
  28. */
  29. - (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions
  30. {
  31. CGRect screenBounds = [[UIScreen mainScreen] bounds];
  32. self.window = [[UIWindow alloc] initWithFrame:screenBounds];
  33. self.window.autoresizesSubviews = YES;
  34. // only set if not already set in subclass
  35. if (self.viewController == nil) {
  36. self.viewController = [[CDVViewController alloc] init];
  37. }
  38. // Set your app's start page by setting the <content src='foo.html' /> tag in config.xml.
  39. // If necessary, uncomment the line below to override it.
  40. // self.viewController.startPage = @"index.html";
  41. // NOTE: To customize the view's frame size (which defaults to full screen), override
  42. // [self.viewController viewWillAppear:] in your view controller.
  43. self.window.rootViewController = self.viewController;
  44. [self.window makeKeyAndVisible];
  45. return YES;
  46. }
  47. // this happens while we are running ( in the background, or from within our own app )
  48. // only valid if 40x-Info.plist specifies a protocol to handle
  49. - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options
  50. {
  51. if (!url) {
  52. return NO;
  53. }
  54. NSMutableDictionary * openURLData = [[NSMutableDictionary alloc] init];
  55. [openURLData setValue:url forKey:@"url"];
  56. if (options[UIApplicationOpenURLOptionsSourceApplicationKey]) {
  57. [openURLData setValue:options[UIApplicationOpenURLOptionsSourceApplicationKey] forKey:@"sourceApplication"];
  58. }
  59. if (options[UIApplicationOpenURLOptionsAnnotationKey]) {
  60. [openURLData setValue:options[UIApplicationOpenURLOptionsAnnotationKey] forKey:@"annotation"];
  61. }
  62. // all plugins will get the notification, and their handlers will be called
  63. [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]];
  64. [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLWithAppSourceAndAnnotationNotification object:openURLData]];
  65. return YES;
  66. }
  67. - (UIInterfaceOrientationMask)application:(UIApplication*)application supportedInterfaceOrientationsForWindow:(UIWindow*)window
  68. {
  69. // iPhone doesn't support upside down by default, while the iPad does. Override to allow all orientations always, and let the root view controller decide what's allowed (the supported orientations mask gets intersected).
  70. NSUInteger supportedInterfaceOrientations = (1 << UIInterfaceOrientationPortrait) | (1 << UIInterfaceOrientationLandscapeLeft) | (1 << UIInterfaceOrientationLandscapeRight) | (1 << UIInterfaceOrientationPortraitUpsideDown);
  71. return supportedInterfaceOrientations;
  72. }
  73. @end