1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- //
- // 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 {
- let account = LocalManager.userInfo.userAccount!
- let password = LocalManager.userInfo.password!
- let city = LocalManager.userInfo.city!
- 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)
- }
-
- }
-
- }
|