// // LocalManager.swift // SwiftBilibili // // Created by 罗文 on 2021/3/23. // Copyright © 2021年 罗文. All rights reserved. // import UIKit import SwiftyUserDefaults import RxSwift class LocalManager { static var disposeBag = DisposeBag() static let loginService: LoginServiceType = LoginService(networking: LoginNetworking()) static var userInfo: UserInfo = UserInfo() class func clearUserInfo() { } //自动登录 static func autoLogin(){ if LocalManager.userInfo.isLogin { var account = LocalManager.userInfo.userAccount! var password = LocalManager.userInfo.password! var city = "3501" LocalManager.loginService.loginRequest(user_name: account, user_password: password,city: city) .subscribe(onSuccess: { userinfo in NYTips.hide() LocalManager.userInfo = userinfo }, onError: { error in }) .disposed(by: LocalManager.disposeBag) } } }