| | |
| | | import UIKit |
| | | import JQTools |
| | | import Alamofire |
| | | import AMapFoundationKit |
| | | //import AMapFoundationKit |
| | | import SDWebImage |
| | | |
| | | @main |
| | | class AppDelegate: UIResponder, UIApplicationDelegate { |
| | | |
| | | var window: UIWindow? |
| | | var orientation:UIInterfaceOrientationMask = .portrait |
| | | var window: UIWindow? |
| | | var orientation:UIInterfaceOrientationMask = .portrait |
| | | |
| | | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| | | sleep(2) |
| | | Services.startNetworkMonitor() |
| | | YYPaymentManager.shared.configuredWeChat(appID: WeChatAPPID, universalLink: WechatUniversalLinks) |
| | | YYPaymentManager.shared.configuredAlipay(appScheme: APPScheme) |
| | | AMapServices.shared().enableHTTPS = true |
| | | AMapServices.shared().apiKey = AMapKey |
| | | func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { |
| | | sleep(2) |
| | | Services.startNetworkMonitor() |
| | | YYPaymentManager.shared.configuredWeChat(appID: WeChatAPPID, universalLink: WechatUniversalLinks) |
| | | YYPaymentManager.shared.configuredAlipay(appScheme: APPScheme) |
| | | // AMapServices.shared().enableHTTPS = true |
| | | // AMapServices.shared().apiKey = AMapKey |
| | | |
| | | Services.querySystemImg(type: .launch).subscribe(onNext: {data in |
| | | if let img = data.data{ |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: img)) { image, _, _, _ in |
| | | if let img = image{ |
| | | LaunchImageHelper.changeAllLaunchImageToLandscape(img) |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: JQ_disposeBag) |
| | | return true |
| | | } |
| | | Services.querySystemImg(type: .launch).subscribe(onNext: {data in |
| | | if let img = data.data{ |
| | | SDWebImageDownloader.shared.downloadImage(with: URL(string: img)) { image, _, _, _ in |
| | | if let img = image{ |
| | | LaunchImageHelper.changeAllLaunchImageToLandscape(img) |
| | | } |
| | | } |
| | | } |
| | | }).disposed(by: JQ_disposeBag) |
| | | return true |
| | | } |
| | | |
| | | // MARK: UISceneSession Lifecycle |
| | | // MARK: UISceneSession Lifecycle |
| | | |
| | | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { |
| | | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) |
| | | } |
| | | func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { |
| | | return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role) |
| | | } |
| | | |
| | | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { |
| | | func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) { |
| | | |
| | | } |
| | | } |
| | | |
| | | func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { |
| | | if UIDevice.current.userInterfaceIdiom == .pad{ |
| | | return .all |
| | | }else{ |
| | | return orientation |
| | | } |
| | | } |
| | | func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { |
| | | if UIDevice.current.userInterfaceIdiom == .pad{ |
| | | return .all |
| | | }else{ |
| | | return orientation |
| | | } |
| | | } |
| | | |
| | | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { |
| | | print("---->") |
| | | return YYPaymentManager.shared.handleApplication(application, open: url, sourceApplication: sourceApplication, annotation: annotation) |
| | | } |
| | | func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { |
| | | print("---->") |
| | | return YYPaymentManager.shared.handleApplication(application, open: url, sourceApplication: sourceApplication, annotation: annotation) |
| | | } |
| | | |
| | | func application(_ application: UIApplication, handleOpen url: URL) -> Bool { |
| | | print("---->1") |
| | | return YYPaymentManager.shared.handleApplication(application, handleOpen: url) |
| | | } |
| | | func application(_ application: UIApplication, handleOpen url: URL) -> Bool { |
| | | print("---->1") |
| | | return YYPaymentManager.shared.handleApplication(application, handleOpen: url) |
| | | } |
| | | |
| | | // NOTE: 9.0以后使用新API接口 |
| | | func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { |
| | | print("---->2") |
| | | return YYPaymentManager.shared.handleApplication(app, open: url, options: options) |
| | | } |
| | | // NOTE: 9.0以后使用新API接口 |
| | | func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { |
| | | print("---->2") |
| | | return YYPaymentManager.shared.handleApplication(app, open: url, options: options) |
| | | } |
| | | |
| | | func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { |
| | | print("---->3") |
| | | return YYPaymentManager.shared.handleApplication(userActivity) |
| | | } |
| | | func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { |
| | | print("---->3") |
| | | return YYPaymentManager.shared.handleApplication(userActivity) |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | extension AppDelegate{ |
| | | func registerAndLoginSuccess(){ |
| | | let snapView = sceneDelegate?.window?.snapshotView(afterScreenUpdates: true) |
| | | func registerAndLoginSuccess(){ |
| | | let snapView = sceneDelegate?.window?.snapshotView(afterScreenUpdates: true) |
| | | |
| | | let tabBar = BaseTabBarVC() |
| | | let homeNav = BaseNav(rootViewController: HomeVC()) |
| | | homeNav.tabBarItem = UITabBarItem(title: "玩湃公园", image: UIImage(named: "tabbar_home"), selectedImage: UIImage(named: "tabbar_home_s")!.withRenderingMode(.alwaysOriginal)) |
| | | let tabBar = BaseTabBarVC() |
| | | let homeNav = BaseNav(rootViewController: HomeVC()) |
| | | homeNav.tabBarItem = UITabBarItem(title: "玩湃公园", image: UIImage(named: "tabbar_home"), selectedImage: UIImage(named: "tabbar_home_s")!.withRenderingMode(.alwaysOriginal)) |
| | | |
| | | let clouseNav = BaseNav(rootViewController: CourseVC()) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "我的运动营", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal)) |
| | | let clouseNav = BaseNav(rootViewController: CourseVC()) |
| | | clouseNav.tabBarItem = UITabBarItem(title: "我的运动营", image: UIImage(named: "tabbar_course"), selectedImage: UIImage(named: "tabbar_course_s")!.withRenderingMode(.alwaysOriginal)) |
| | | |
| | | // let welfareVCNav = BaseNav(rootViewController: WelfareVC()) |
| | | // welfareVCNav.tabBarItem = UITabBarItem(title: "使用福利", image: UIImage(named: "tabbar_welfare"), selectedImage: UIImage(named: "tabbar_welfare_s")!.withRenderingMode(.alwaysOriginal)) |
| | | // let welfareVCNav = BaseNav(rootViewController: WelfareVC()) |
| | | // welfareVCNav.tabBarItem = UITabBarItem(title: "使用福利", image: UIImage(named: "tabbar_welfare"), selectedImage: UIImage(named: "tabbar_welfare_s")!.withRenderingMode(.alwaysOriginal)) |
| | | |
| | | let carderCenterVCNav = BaseNav(rootViewController: CardCenterVC()) |
| | | carderCenterVCNav.tabBarItem = UITabBarItem(title: "玩湃惠民卡", image: UIImage(named: "tabbar_welfare"), selectedImage: UIImage(named: "tabbar_welfare_s")!.withRenderingMode(.alwaysOriginal)) |
| | | |
| | | let searchVCNav = BaseNav(rootViewController: SearchVC()) |
| | | searchVCNav.tabBarItem = UITabBarItem(title: "我的玩湃", image: UIImage(named: "tabbar_search"), selectedImage: UIImage(named: "tabbar_search_s")!.withRenderingMode(.alwaysOriginal)) |
| | | tabBar.viewControllers = [homeNav,carderCenterVCNav,clouseNav,searchVCNav] |
| | | sceneDelegate?.window?.rootViewController = tabBar |
| | | sceneDelegate?.window?.rootViewController?.view.addSubview(snapView!) |
| | | sceneDelegate?.window?.makeKeyAndVisible() |
| | | let searchVCNav = BaseNav(rootViewController: SearchVC()) |
| | | searchVCNav.tabBarItem = UITabBarItem(title: "我的玩湃", image: UIImage(named: "tabbar_search"), selectedImage: UIImage(named: "tabbar_search_s")!.withRenderingMode(.alwaysOriginal)) |
| | | tabBar.viewControllers = [homeNav,carderCenterVCNav,clouseNav,searchVCNav] |
| | | sceneDelegate?.window?.rootViewController = tabBar |
| | | sceneDelegate?.window?.rootViewController?.view.addSubview(snapView!) |
| | | sceneDelegate?.window?.makeKeyAndVisible() |
| | | |
| | | UIView.animate(withDuration: 1.5) { |
| | | snapView?.alpha = 0 |
| | | snapView?.transform3D = CATransform3DMakeScale(1.5, 1.5, 1.5) |
| | | } completion: { _ in |
| | | snapView?.removeFromSuperview() |
| | | } |
| | | UIView.animate(withDuration: 1.5) { |
| | | snapView?.alpha = 0 |
| | | snapView?.transform3D = CATransform3DMakeScale(1.5, 1.5, 1.5) |
| | | } completion: { _ in |
| | | snapView?.removeFromSuperview() |
| | | } |
| | | |
| | | // YYSocketManager.instance.startSocket(host: Socket_Url, port: 8888) |
| | | } |
| | | // YYSocketManager.instance.startSocket(host: Socket_Url, port: 8888) |
| | | } |
| | | |
| | | func needLogin(){ |
| | | UserViewModel.clearToken() |
| | | UserDefaults.standard.setValue(nil, forKey: "currentStuId") |
| | | if JQ_currentViewController() is LoginVC{return} |
| | | let loginNav = LoginNav(rootViewController: LoginVC()) |
| | | loginNav.modalPresentationStyle = .fullScreen |
| | | JQ_currentViewController().present(loginNav, animated: true) |
| | | } |
| | | func needLogin(){ |
| | | UserViewModel.clearToken() |
| | | UserDefaults.standard.setValue(nil, forKey: "currentStuId") |
| | | if JQ_currentViewController() is LoginVC{return} |
| | | let loginNav = LoginNav(rootViewController: LoginVC()) |
| | | loginNav.modalPresentationStyle = .fullScreen |
| | | JQ_currentViewController().present(loginNav, animated: true) |
| | | } |
| | | } |
| | | |