Files
yingmeng-ios-switf/yinmeng-ios/AppDelegate.swift

49 lines
1.4 KiB
Swift
Raw Normal View History

2024-02-21 21:30:13 +08:00
//
// AppDelegate.swift
// yinmeng-ios
//
// Created by MaiMang on 2024/1/30.
//
import UIKit
2024-02-24 13:49:51 +08:00
import DeviceKit
2024-02-25 12:53:56 +08:00
import NSObject_Rx
2024-02-21 21:30:13 +08:00
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
UIApplication.shared.applicationIconBadgeNumber = 0
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
2024-02-22 19:59:38 +08:00
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLoginVC())
2024-02-25 12:53:56 +08:00
loginStateListener()
2024-02-21 21:30:13 +08:00
return true
}
2024-02-24 13:49:51 +08:00
2024-02-25 12:53:56 +08:00
private func loginStateListener() {
AuthViewModel.authVM.loginSuccess.subscribe(onNext: { result in
print("是否登录成功\(result)")
if result == true {
///tabbar
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = BaeTabBarViewController()
} else {
///
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLoginVC())
}
}).disposed(by: rx.disposeBag)
///
AuthViewModel.authVM.checkUserIsLogin()
}
2024-02-21 21:30:13 +08:00
}
2024-02-24 13:49:51 +08:00