优化登录页逻辑
This commit is contained in:
@@ -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,20 +32,30 @@ 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"
|
||||
|
@@ -80,8 +80,6 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
|
||||
make.bottom.equalTo(stackView.snp.top).offset(-56)
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
appleView.snp.makeConstraints { make in
|
||||
make.width.equalTo(47)
|
||||
make.height.equalTo(70)
|
||||
|
Reference in New Issue
Block a user