|
@@ -34,11 +34,14 @@ import com.xhly.manageapp.databinding.ActivityLoginBinding
|
34
|
34
|
import com.xhly.manageapp.service.websocket.AppSocket
|
35
|
35
|
import com.xhly.manageapp.ui.login.viewmodel.LoginViewModel
|
36
|
36
|
import com.xhly.manageapp.ui.main.activity.MainActivity
|
|
37
|
+import com.xhly.manageapp.utils.CurrentAppSharedPreferencesUtils
|
37
|
38
|
import com.xhly.manageapp.utils.StrategyUtils
|
38
|
39
|
import com.xhly.manageapp.workmanager.TimingWorker
|
39
|
40
|
import java.util.concurrent.TimeUnit
|
40
|
41
|
|
41
|
42
|
class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
|
|
43
|
+ //单独创建sharedpreference用来存储初始化的应用
|
|
44
|
+ private val currentSpUtils by lazy { CurrentAppSharedPreferencesUtils.getInstance(this) }
|
42
|
45
|
private var regioncode = ""
|
43
|
46
|
override fun getBinding() = ActivityLoginBinding.inflate(layoutInflater)
|
44
|
47
|
|
|
@@ -58,6 +61,7 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
|
58
|
61
|
@SuppressLint("CheckResult")
|
59
|
62
|
override fun initView() {
|
60
|
63
|
setSoftInput(mBinding.root)
|
|
64
|
+
|
61
|
65
|
mBinding.loginBtn.setOnClickListener {
|
62
|
66
|
val rxPermissions = RxPermissions(this)
|
63
|
67
|
val request = rxPermissions.request(Manifest.permission.READ_PHONE_STATE)
|
|
@@ -100,6 +104,13 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
|
100
|
104
|
}
|
101
|
105
|
|
102
|
106
|
private fun loginSucess(userBean: UserBean){
|
|
107
|
+ //提交登录事件
|
|
108
|
+ val data = LogdOperateBean()
|
|
109
|
+ ManageApplication.getDeviceInfo()?.let {
|
|
110
|
+ data.sn = it
|
|
111
|
+ }
|
|
112
|
+ data.doEvent = EventLog.ACCOUNTLOGINEVENT
|
|
113
|
+ viewModel.eventLog(data)
|
103
|
114
|
spUtils.saveJson(Const.USERINFO,userBean)
|
104
|
115
|
val parseClassToJson = GsonUtils.parseClassToJson(userBean)
|
105
|
116
|
ZSpProvider.save(this,Const.USERINFO,parseClassToJson)
|
|
@@ -174,12 +185,6 @@ class LoginActivity : BaseActivity<LoginViewModel, ActivityLoginBinding>() {
|
174
|
185
|
|
175
|
186
|
}
|
176
|
187
|
|
177
|
|
-
|
178
|
|
- Const.LOGAPPSTART -> {
|
179
|
|
-
|
180
|
|
- }
|
181
|
|
-
|
182
|
|
-
|
183
|
188
|
Const.SDINSTALL -> {
|
184
|
189
|
val data = LogdOperateBean()
|
185
|
190
|
ManageApplication.getDeviceInfo()?.let {
|