优化登录页逻辑

This commit is contained in:
eggmanQQQ
2024-07-18 11:18:00 +08:00
parent 0855b81097
commit 5055bf244d
2 changed files with 22 additions and 8 deletions

View File

@@ -17,7 +17,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
UIApplication.shared.applicationIconBadgeNumber = 0
self.window = UIWindow.init(frame: UIScreen.main.bounds)
self.window?.backgroundColor = UIColor.white
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
showLoginPage()
loadNIMSDK()
loginStateListener()
@@ -31,21 +32,31 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
guard let strongSelf = self else { return }
if result == true {
///tabbar
strongSelf.window?.rootViewController = BaseTabBarViewController()
let uid = AuthManager.userUid
if uid > 0 {
UserViewModel.userVM.getUserInfo(uid: uid)
}
strongSelf.showTabbar()
// MARK: 使
if NIMSDK.shared().loginManager.isLogined() == false {
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid, let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
if let uid = LoginTokenConfig.config.getAccountInfo()?.uid,
let token = LoginTokenConfig.config.getAccountInfo()?.netEaseToken {
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
guard let error else {
// strongSelf.showTabbar()
return
}
print("login error: \(String(describing: error))")
// strongSelf.showLoginPage()
}
} else {
strongSelf.showLoginPage()
// strongSelf.showLoginPage()
}
}
} else {
// strongSelf.showTabbar()
}
} else {
strongSelf.showLoginPage()
}
@@ -65,6 +76,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
}
private func showTabbar() {
///tabbar
self.window?.rootViewController = BaseTabBarViewController()
}
private func loadNIMSDK() {
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
opt.apnsCername = "yinmeng_anps"