AppDelegate.m 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. //
  2. // AppDelegate.m
  3. // Asteria
  4. //
  5. // Created by iOS on 2023/4/22.
  6. //
  7. #import "AppDelegate.h"
  8. #import "AS_TabBarViewController.h"
  9. #import <YTKNetwork/YTKNetwork.h>
  10. #import <FBSDKLoginKit/FBSDKLoginKit.h>
  11. #import <StripeCore/StripeCore-Swift.h>
  12. #import "AppDelegate+PushNotification.h"
  13. #import <FirebaseCore/FirebaseCore.h>
  14. #import <Bugly/Bugly.h>
  15. @import Stripe;
  16. @interface AppDelegate ()
  17. //@property (nonatomic, strong, readonly) UIWindow *window;
  18. @end
  19. @implementation AppDelegate
  20. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  21. // Override point for customization after application launch.
  22. if (@available(iOS 15.0, *)) {
  23. UITableView.appearance.sectionHeaderTopPadding = 0;
  24. } else {
  25. // Fallback on earlier versions
  26. }
  27. [ASCurrencyManager.shared getAllCurrencyData];
  28. [ASNetTools reqNet_getAdvCoupons];
  29. // [self xxx_ytkNetConfig];
  30. [PPNetworkHelper openLog];
  31. self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  32. AS_TabBarViewController *tab = [[AS_TabBarViewController alloc] init];
  33. tab.selectedIndex = 0;
  34. self.window.rootViewController = tab;
  35. [self.window makeKeyAndVisible];
  36. //StripeAPI
  37. [StripeAPI setDefaultPublishableKey:StripePublishableKey];
  38. // 为了使用 Facebook SDK 应该调用如下方法
  39. [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  40. // 注册 FacebookAppID
  41. [[FBSDKSettings sharedSettings] setAppID:Facebook_AppID];
  42. [FIRApp configure];
  43. #if DEBUG
  44. [Bugly startWithAppId:Bugly_appId developmentDevice:true config:nil];
  45. #else
  46. [Bugly startWithAppId:Bugly_appId];
  47. #endif
  48. //获取用户信息
  49. if (ASUserInfoManager.shared.isLogin ) {
  50. [ASUserInfoManager.shared getInfo:^{
  51. //推送相关配置
  52. [self initPushNotificationConfig:launchOptions];
  53. }];
  54. } else {
  55. [self initPushNotificationConfig:launchOptions];
  56. }
  57. return YES;
  58. }
  59. -(void)xxx_ytkNetConfig{
  60. YTKNetworkAgent *agent = [YTKNetworkAgent sharedAgent];
  61. [agent setValue:[NSSet setWithObjects:@"application/json", @"text/html", @"text/json", @"text/plain", @"text/javascript", @"text/xml", @"image/*",@"image/jpeg",@"image/jpg",@"image/png",@"application/x-javascript",nil] forKeyPath:@"_manager.responseSerializer.acceptableContentTypes"];
  62. YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
  63. config.securityPolicy.allowInvalidCertificates = YES;
  64. config.securityPolicy.validatesDomainName = NO;
  65. config.baseUrl = [NSString stringWithFormat:@"%@",AS_Server];
  66. NSLog(@"baseUrl-----%@",config.baseUrl)
  67. }
  68. #pragma mark - **************** applicationDelegate ****************
  69. - (BOOL)application:(UIApplication *)app
  70. openURL:(NSURL *)url
  71. options:(NSDictionary *)options {
  72. [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options];
  73. // nzk Google Signin
  74. BOOL stripeHandled = [StripeAPI handleStripeURLCallbackWithURL:url];
  75. if(stripeHandled){
  76. return YES;
  77. }
  78. // nzk Google Signin end
  79. return YES;
  80. }
  81. @end