SceneDelegate.swift 3.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // SceneDelegate.swift
  3. // QuickSearchLocation
  4. //
  5. // Created by mac on 2024/4/10.
  6. //
  7. import UIKit
  8. class SceneDelegate: UIResponder, UIWindowSceneDelegate {
  9. var window: UIWindow?
  10. var isShowTipView : Bool = true
  11. func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
  12. // 检查是否通过捷径启动 未启动状态
  13. if connectionOptions.shortcutItem != nil {
  14. dealWithShortcutItem(connectionOptions.shortcutItem?.type ?? "")
  15. }
  16. guard let _ = (scene as? UIWindowScene) else { return }
  17. }
  18. func windowScene(_ windowScene: UIWindowScene, performActionFor shortcutItem: UIApplicationShortcutItem, completionHandler: @escaping (Bool) -> Void) {
  19. dealWithShortcutItem(shortcutItem.type)
  20. completionHandler(true)
  21. }
  22. func dealWithShortcutItem(_ type: String){
  23. var scheme = ""
  24. if type == "com.manbu.shouji.feedback"{
  25. scheme = "location://page/QSLFeedbackVC"
  26. }else if type == "com.manbu.shouji.trial"{
  27. scheme = "location://page/QSLVipTrialVC"
  28. QSEventHandle.eventPush(eventName: QSLGravityConst.unpaid_click_uninstall_popup)
  29. }else if type == "com.manbu.shouji.member"{
  30. scheme = "location://page/QSLVipController"
  31. }else{
  32. scheme = "location://shortcut/" + type
  33. }
  34. if(QSLTools.shared.isOpen){
  35. //处理urlScheme
  36. QSLTools.shared.urlScheme = ""
  37. QSLTools.shared.dealwithScheme(scheme)
  38. return
  39. }
  40. QSLTools.shared.urlScheme = scheme
  41. }
  42. func sceneDidDisconnect(_ scene: UIScene) {
  43. // Called as the scene is being released by the system.
  44. // This occurs shortly after the scene enters the background, or when its session is discarded.
  45. // Release any resources associated with this scene that can be re-created the next time the scene connects.
  46. // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  47. }
  48. func sceneDidBecomeActive(_ scene: UIScene) {
  49. // Called when the scene has moved from an inactive state to an active state.
  50. // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  51. if self.isShowTipView {
  52. ///判断要不要弹引导用户去评价
  53. //QSLGuideusersToCommentManager.commentShare.manageWhetherTriggerPopUpWindow(QSLGuideusersToCommentType.nonMember)
  54. }
  55. self.isShowTipView = false
  56. }
  57. func sceneWillResignActive(_ scene: UIScene) {
  58. // Called when the scene will move from an active state to an inactive state.
  59. // This may occur due to temporary interruptions (ex. an incoming phone call).
  60. }
  61. func sceneWillEnterForeground(_ scene: UIScene) {
  62. // Called as the scene transitions from the background to the foreground.
  63. // Use this method to undo the changes made on entering the background.
  64. }
  65. func sceneDidEnterBackground(_ scene: UIScene) {
  66. self.isShowTipView = true
  67. // Called as the scene transitions from the foreground to the background.
  68. // Use this method to save data, release shared resources, and store enough scene-specific state information
  69. // to restore the scene back to its current state.
  70. }
  71. }