126 lines
4.6 KiB
Swift
126 lines
4.6 KiB
Swift
//
|
|
// AppDelegate.swift
|
|
// SwiftProject
|
|
//
|
|
// Created by soldoros on 2024/1/10.
|
|
//
|
|
/*
|
|
com.peuid.snsdev
|
|
com.nks.vptest
|
|
|
|
蓝湖 https://moonvy.com/invite/97510620-9c5f-4af2-ab86-982a8ce4e09c
|
|
原型 https://avb2dt3u5c4.feishu.cn/docx/MRRedj0p9ocNa3x6LkycqGyqn0e
|
|
接口 https://apifox.com/apidoc/shared-088c9b06-e12a-490b-9f99-6949fb51dbbb
|
|
串流播放 https://www.finnvoorhees.com/words/reading-and-writing-spatial-video-with-avfoundation
|
|
*/
|
|
|
|
import UIKit
|
|
import SVProgressHUD
|
|
import Firebase
|
|
import FirebaseCore
|
|
import AVFoundation
|
|
import FacebookCore
|
|
import FirebaseRemoteConfig
|
|
@main
|
|
|
|
|
|
class AppDelegate: UIResponder, UIApplicationDelegate {
|
|
var remoteConfig:FirebaseRemoteConfig.RemoteConfig?
|
|
var window: UIWindow?
|
|
// var root:RootManager?
|
|
var newWindow:UIWindow?
|
|
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
|
|
|
|
configureFireBase()
|
|
|
|
// do {
|
|
// try AVAudioSession.sharedInstance().setActive(true)
|
|
// try AVAudioSession.sharedInstance().setCategory(.playback,options: .allowAirPlay)
|
|
// }
|
|
// catch {
|
|
// print("err: set audiosession:\(error)")
|
|
// }
|
|
|
|
|
|
SVProgressHUD.setDefaultStyle(.dark)
|
|
Analytics.logEvent("user_launch", parameters: ["type":"new"])
|
|
SKUPay.sharedInstance.requestProducts(productsIdentifiers: MemberShipModelItem.getProductsIDs())
|
|
SKUPay.sharedInstance.setUpUserInfo()
|
|
return true
|
|
}
|
|
|
|
|
|
func configureFireBase() {
|
|
FirebaseApp.configure()
|
|
remoteConfig = FirebaseRemoteConfig.RemoteConfig.remoteConfig()
|
|
let settings = RemoteConfigSettings()
|
|
settings.minimumFetchInterval = 0
|
|
remoteConfig!.configSettings = settings
|
|
remoteConfig!.setDefaults(fromPlist: "remote_config_defaults")
|
|
|
|
remoteConfig!.fetch {[weak self] (status, error) -> Void in
|
|
if status == .success {
|
|
// print("Config fetched!")
|
|
self?.remoteConfig?.activate { changed, error in
|
|
// print("Config fetched! e:\(error)")
|
|
}
|
|
} else {
|
|
// print("Config not fetched")
|
|
// print("Error: \(error?.localizedDescription ?? "No error available.")")
|
|
}
|
|
}
|
|
|
|
// let zh = remoteConfig?.configValue(forKey: "menuParams")
|
|
// print("zh:\(zh)")
|
|
}
|
|
|
|
|
|
|
|
|
|
//前后台切换--进入前台
|
|
func applicationWillEnterForeground(_ application: UIApplication) {
|
|
print("applicationWillEnterForeground...")
|
|
Analytics.logEvent("user_launch", parameters: ["type":"restart"])
|
|
}
|
|
|
|
func applicationWillTerminate(_ application: UIApplication) {
|
|
|
|
}
|
|
|
|
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
|
// print("configurationForConnecting....")
|
|
// let scene = UIWindowScene(session: connectingSceneSession, connectionOptions: options)
|
|
//
|
|
// // Configure a window for the screen.
|
|
// self.newWindow = UIWindow(frame: CGRect(x: 0, y: 0, width: 2000, height: 1000))
|
|
// self.newWindow!.backgroundColor = UIColor.yellow
|
|
// // Install a custom root view controller in the window.
|
|
//
|
|
// let viewController = UIViewController()
|
|
// self.newWindow!.rootViewController = viewController
|
|
// self.newWindow!.windowScene = scene
|
|
//
|
|
// // You must show the window explicitly.
|
|
// self.newWindow!.isHidden = false
|
|
// NotificationCenter.default.post(name: Notification.Name(rawValue: "NSZZHHasNewWindowExternal"), object: self, userInfo: ["newwindow":self.newWindow!])
|
|
// return UISceneConfiguration(name: "External configuration", sessionRole: connectingSceneSession.role)
|
|
// }
|
|
|
|
|
|
// func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
|
|
// print("appdelegate configurationForConnecting.....")
|
|
// let sceneConfiguration: UISceneConfiguration
|
|
//
|
|
// if connectingSceneSession.role == UISceneSession.Role.windowExternalDisplayNonInteractive {
|
|
// sceneConfiguration = UISceneConfiguration.init(name: "External", sessionRole: connectingSceneSession.role)
|
|
//
|
|
// } else {
|
|
// sceneConfiguration = UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
|
|
// }
|
|
//
|
|
// return sceneConfiguration
|
|
// }
|
|
|
|
}
|
|
|