39 lines
1.2 KiB
Kotlin
39 lines
1.2 KiB
Kotlin
package com.gh.common
|
|
|
|
import android.content.BroadcastReceiver
|
|
import android.content.Context
|
|
import android.content.Intent
|
|
import com.gh.common.im.ImManager
|
|
import com.gh.gamecenter.manager.UserManager
|
|
import com.gh.gamecenter.retrofit.RetrofitManager
|
|
import com.halo.assistant.HaloApp
|
|
import com.m7.imkfsdk.chat.ChatActivity
|
|
import io.reactivex.schedulers.Schedulers
|
|
|
|
/**
|
|
* 可使用 [LocalBroadcastManager] 来进行简单的模块间消息通知
|
|
*/
|
|
|
|
class LocalBroadcastReceiver : BroadcastReceiver() {
|
|
|
|
override fun onReceive(context: Context?, intent: Intent?) {
|
|
intent?.let {
|
|
when (intent.action) {
|
|
ChatActivity.ACTION_DISMISS_FLOATING_WINDOW -> {
|
|
ImManager.dismissFloatingWindow()
|
|
|
|
RetrofitManager.getInstance(HaloApp.getInstance().application).api.postImEnding(UserManager.getInstance().userId)
|
|
.subscribeOn(Schedulers.io())
|
|
.subscribe()
|
|
}
|
|
|
|
ChatActivity.ACTION_HIDE_UNREAD_DOT -> {
|
|
ImManager.updateShouldShowFloatingWindowDot(false)
|
|
}
|
|
|
|
else -> return
|
|
}
|
|
}
|
|
}
|
|
|
|
} |