AppDelegate.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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 Stripe;
  15. @interface AppDelegate ()
  16. //@property (nonatomic, strong, readonly) UIWindow *window;
  17. @end
  18. @implementation AppDelegate
  19. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  20. // Override point for customization after application launch.
  21. if (@available(iOS 15.0, *)) {
  22. UITableView.appearance.sectionHeaderTopPadding = 0;
  23. } else {
  24. // Fallback on earlier versions
  25. }
  26. [ASCurrencyManager.shared getAllCurrencyData];
  27. [ASNetTools reqNet_getAdvCoupons];
  28. // [self xxx_ytkNetConfig];
  29. [PPNetworkHelper openLog];
  30. self.window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
  31. AS_TabBarViewController *tab = [[AS_TabBarViewController alloc] init];
  32. tab.selectedIndex = 0;
  33. self.window.rootViewController = tab;
  34. [self.window makeKeyAndVisible];
  35. //StripeAPI
  36. [StripeAPI setDefaultPublishableKey:StripePublishableKey];
  37. // 为了使用 Facebook SDK 应该调用如下方法
  38. [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  39. // 注册 FacebookAppID
  40. [[FBSDKSettings sharedSettings] setAppID:Facebook_AppID];
  41. [FIRApp configure];
  42. //推送相关配置
  43. if (ASUserInfoManager.shared.isLogin ) {
  44. [ASUserInfoManager.shared getInfo:^{
  45. [self initPushNotificationConfig:launchOptions];
  46. }];
  47. } else {
  48. [self initPushNotificationConfig:launchOptions];
  49. }
  50. return YES;
  51. }
  52. -(void)xxx_ytkNetConfig{
  53. YTKNetworkAgent *agent = [YTKNetworkAgent sharedAgent];
  54. [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"];
  55. YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
  56. config.securityPolicy.allowInvalidCertificates = YES;
  57. config.securityPolicy.validatesDomainName = NO;
  58. config.baseUrl = [NSString stringWithFormat:@"%@",AS_Server];
  59. NSLog(@"baseUrl-----%@",config.baseUrl)
  60. }
  61. #pragma mark - **************** applicationDelegate ****************
  62. - (BOOL)application:(UIApplication *)app
  63. openURL:(NSURL *)url
  64. options:(NSDictionary *)options {
  65. [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options];
  66. // nzk Google Signin
  67. BOOL stripeHandled = [StripeAPI handleStripeURLCallbackWithURL:url];
  68. if(stripeHandled){
  69. return YES;
  70. }
  71. // nzk Google Signin end
  72. return YES;
  73. }
  74. @end