AppDelegate.m 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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 <OneSignal/OneSignal.h>
  13. #import "AppDelegate+PushNotification.h"
  14. @import Stripe;
  15. @interface AppDelegate ()<UNUserNotificationCenterDelegate>
  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. //推送相关配置
  42. if (ASUserInfoManager.shared.isLogin ) {
  43. [ASUserInfoManager.shared getInfo:^{
  44. [self initPushNotificationConfig:launchOptions];
  45. }];
  46. } else {
  47. [self initPushNotificationConfig:launchOptions];
  48. }
  49. return YES;
  50. }
  51. -(void)xxx_ytkNetConfig{
  52. YTKNetworkAgent *agent = [YTKNetworkAgent sharedAgent];
  53. [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"];
  54. YTKNetworkConfig *config = [YTKNetworkConfig sharedConfig];
  55. config.securityPolicy.allowInvalidCertificates = YES;
  56. config.securityPolicy.validatesDomainName = NO;
  57. config.baseUrl = [NSString stringWithFormat:@"%@",AS_Server];
  58. NSLog(@"baseUrl-----%@",config.baseUrl)
  59. }
  60. #pragma mark - **************** applicationDelegate ****************
  61. - (BOOL)application:(UIApplication *)app
  62. openURL:(NSURL *)url
  63. options:(NSDictionary *)options {
  64. [[FBSDKApplicationDelegate sharedInstance] application:app openURL:url options:options];
  65. // nzk Google Signin
  66. BOOL stripeHandled = [StripeAPI handleStripeURLCallbackWithURL:url];
  67. if(stripeHandled){
  68. return YES;
  69. }
  70. // nzk Google Signin end
  71. return YES;
  72. }
  73. @end