18034727885
2026-04-27 3a4c1bbb2cf4fb1cdda8a5061b0674f30e7456b4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package com.example.smart.ui.splash
 
 
import android.util.Log
import android.view.View
import androidx.activity.viewModels
import androidx.lifecycle.lifecycleScope
import com.example.basecore.BaseActivity
import com.example.basecore.util.SchemeUtils
import com.example.basecore.util.sysbar.StatusBarUtils
import com.example.smart.R
import com.example.smart.oss.OssService
import com.example.smart.util.StatusProvider
import com.example.smart.util.loginScheme
import com.example.smart.util.mainScheme
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
 
class SplashActivity : BaseActivity() {
 
 
    private lateinit var logoContainer: View
    override fun getLayoutId() = R.layout.activity_splash
 
    private val viewModel: SplashViewModel by viewModels()
 
 
    override fun initData() {
//        viewModel.requestOssKey()
//        viewModel.bean.observe(this) {
//            Log.e(
//                "dh", "id = ${it.accessId}, secret = ${it.accessSecret}, " +
//                        "token = ${it.token}"
//            )
//            OssService.create(it.accessId, it.accessSecret, it.token, application)
//        }
    }
 
    override fun initView() {
        StatusBarUtils.transparentMode(this, true, isFullScreen = true)
 
        lifecycleScope.launch {
            logoContainer = findViewById(R.id.logo_container)
 
            viewModel.callLoginStatus {
                if (it == "未登录") {
                    StatusProvider.loginOut()
                }
            }
 
            delay(2000)
//            logoContainer.visibility = View.GONE
//            delay(3000)
 
 
 
            val router = if (StatusProvider.hasLogin()) {
                mainScheme
            } else {
                loginScheme
            }
 
 
            SchemeUtils.openScheme(this@SplashActivity, router)
            finish()
        }
    }
 
 
}