优化登录页逻辑
This commit is contained in:
@@ -17,7 +17,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
UIApplication.shared.applicationIconBadgeNumber = 0
|
UIApplication.shared.applicationIconBadgeNumber = 0
|
||||||
self.window = UIWindow.init(frame: UIScreen.main.bounds)
|
self.window = UIWindow.init(frame: UIScreen.main.bounds)
|
||||||
self.window?.backgroundColor = UIColor.white
|
self.window?.backgroundColor = UIColor.white
|
||||||
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
|
||||||
|
showLoginPage()
|
||||||
|
|
||||||
loadNIMSDK()
|
loadNIMSDK()
|
||||||
loginStateListener()
|
loginStateListener()
|
||||||
@@ -31,21 +32,31 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
guard let strongSelf = self else { return }
|
guard let strongSelf = self else { return }
|
||||||
|
|
||||||
if result == true {
|
if result == true {
|
||||||
///如果登录成功显示tabbar
|
|
||||||
strongSelf.window?.rootViewController = BaseTabBarViewController()
|
|
||||||
let uid = AuthManager.userUid
|
let uid = AuthManager.userUid
|
||||||
if uid > 0 {
|
if uid > 0 {
|
||||||
UserViewModel.userVM.getUserInfo(uid: uid)
|
UserViewModel.userVM.getUserInfo(uid: uid)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
strongSelf.showTabbar()
|
||||||
|
|
||||||
|
// MARK: 目前没有使用云信的场景
|
||||||
if NIMSDK.shared().loginManager.isLogined() == false {
|
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
|
NIMSDK.shared().loginManager.login("\(uid)", token: token) { error in
|
||||||
|
guard let error else {
|
||||||
|
// strongSelf.showTabbar()
|
||||||
|
return
|
||||||
|
}
|
||||||
print("login error: \(String(describing: error))")
|
print("login error: \(String(describing: error))")
|
||||||
|
// strongSelf.showLoginPage()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strongSelf.showLoginPage()
|
// strongSelf.showLoginPage()
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// strongSelf.showTabbar()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
strongSelf.showLoginPage()
|
strongSelf.showLoginPage()
|
||||||
}
|
}
|
||||||
@@ -65,6 +76,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
|
|||||||
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
self.window?.rootViewController = BaseNavigationViewController(rootViewController:AuthLaunchVC())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private func showTabbar() {
|
||||||
|
///如果登录成功显示tabbar
|
||||||
|
self.window?.rootViewController = BaseTabBarViewController()
|
||||||
|
}
|
||||||
|
|
||||||
private func loadNIMSDK() {
|
private func loadNIMSDK() {
|
||||||
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
|
let opt = NIMSDKOption(appKey: AppKeys.nimAppid)
|
||||||
opt.apnsCername = "yinmeng_anps"
|
opt.apnsCername = "yinmeng_anps"
|
||||||
|
@@ -80,8 +80,6 @@ class AuthLaunchVC: BaseViewController, HiddenNavigationBarProtocol {
|
|||||||
make.bottom.equalTo(stackView.snp.top).offset(-56)
|
make.bottom.equalTo(stackView.snp.top).offset(-56)
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
|
|
||||||
appleView.snp.makeConstraints { make in
|
appleView.snp.makeConstraints { make in
|
||||||
make.width.equalTo(47)
|
make.width.equalTo(47)
|
||||||
make.height.equalTo(70)
|
make.height.equalTo(70)
|
||||||
|
Reference in New Issue
Block a user