引入eventbus
This commit is contained in:
parent
e7bdcef024
commit
1c7d709832
|
|
@ -0,0 +1,11 @@
|
||||||
|
package com.gamedog.vididin.beans
|
||||||
|
|
||||||
|
data class OnLoginStateEvent(val status: Int) {
|
||||||
|
|
||||||
|
fun isLogin(): Boolean = status == LOGIN
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val LOGIN = 1
|
||||||
|
const val LOGOUT = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.gamedog.vididin.events
|
||||||
|
|
||||||
|
import com.gamedog.vididin.beans.OnLoginStateEvent
|
||||||
|
import com.pengxr.modular.eventbus.facade.annotation.EventGroup
|
||||||
|
|
||||||
|
|
||||||
|
@EventGroup(moduleName = "user", autoClear = true)
|
||||||
|
interface UserEvents {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录状态变更
|
||||||
|
*/
|
||||||
|
fun onLoginStatusChanged(): OnLoginStateEvent
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户信息发生改变
|
||||||
|
*/
|
||||||
|
fun onUserInfoChanged()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户未读消息数改变
|
||||||
|
*/
|
||||||
|
fun onUserUnReadChanged()
|
||||||
|
}
|
||||||
|
|
@ -31,5 +31,7 @@ dependencies {
|
||||||
|
|
||||||
implementation(libs.startup)
|
implementation(libs.startup)
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22'
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib:1.8.22'
|
||||||
|
api 'io.github.pengxurui:modular-eventbus-api:1.0.5'
|
||||||
|
api 'io.github.pengxurui:modular-eventbus-compiler:1.0.5'
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue