AppDelegate.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. // Copyright 2020 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. // Non-google3 relative import to support building with Xcode.
  15. #import "AppDelegate.h"
  16. #import "ViewControllers/NetworkRequestsViewController.h"
  17. #import "ViewControllers/ScreenTracesViewController.h"
  18. #import "ViewControllers/TracesViewController.h"
  19. #import "FirebaseCore/FirebaseCore.h"
  20. #import "FirebasePerformance/Sources/Public/FIRPerformance.h"
  21. @interface AppDelegate ()
  22. @property(nonatomic, readwrite, strong) UITabBarController *tabBarController;
  23. @end
  24. @implementation AppDelegate
  25. - (BOOL)application:(UIApplication *)application
  26. didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  27. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FPRDelegateSwizzling"];
  28. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FPRNSURLConnection"];
  29. [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FPRDiagnosticsLocal"];
  30. [FIRApp configure];
  31. [self setupRootViewController];
  32. return YES;
  33. }
  34. - (void)setupRootViewController {
  35. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  36. self.window.backgroundColor = [UIColor whiteColor];
  37. UITabBarController *tabBarController = [[UITabBarController alloc] init];
  38. NSMutableArray *viewControllers = [[NSMutableArray alloc] init];
  39. TracesViewController *tracesViewController = [[TracesViewController alloc] initWithNibName:nil
  40. bundle:nil];
  41. tracesViewController.tabBarItem.title = @"Traces";
  42. tracesViewController.tabBarItem.accessibilityIdentifier = @"TracesTab";
  43. NetworkRequestsViewController *networkRequestsController =
  44. [[NetworkRequestsViewController alloc] initWithNibName:nil bundle:nil];
  45. networkRequestsController.tabBarItem.title = @"Requests";
  46. networkRequestsController.tabBarItem.accessibilityIdentifier = @"RequestsTab";
  47. ScreenTracesViewController *screenTracesTestViewController =
  48. [[ScreenTracesViewController alloc] initAndSetup];
  49. screenTracesTestViewController.tabBarItem.title = @"Screen Traces";
  50. screenTracesTestViewController.tabBarItem.accessibilityIdentifier = @"ScreenTracesTab";
  51. [viewControllers addObject:tracesViewController];
  52. [viewControllers addObject:networkRequestsController];
  53. [viewControllers addObject:screenTracesTestViewController];
  54. tabBarController.viewControllers = viewControllers;
  55. self.tabBarController = tabBarController;
  56. self.window.rootViewController = tabBarController;
  57. [self.window makeKeyAndVisible];
  58. }
  59. @end