| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- package com.adealink.weparty.module.message
- import android.app.Application
- import androidx.lifecycle.ViewModelStoreOwner
- import com.adealink.frame.aab.BaseDynamicModule
- import com.adealink.frame.aab.constant.AABModuleNotInitError
- import com.adealink.frame.base.Rlt
- import com.adealink.frame.imkit.manager.UnReadMessageManager
- import com.adealink.weparty.R
- import com.adealink.weparty.commonui.widget.floatview.data.IBaseFloatData
- import com.adealink.weparty.commonui.widget.floatview.view.BaseFloatView
- import com.adealink.weparty.module.message.data.CustomerInfo
- import com.adealink.weparty.module.message.viewmodel.IMessageViewModel
- import io.rong.imlib.IRongCoreCallback
- import io.rong.imlib.model.Conversation
- object MessageModule : BaseDynamicModule<IMessageService>(IMessageService::class), IMessageService {
- override val featureName: String
- get() = "message"
- override val moduleNameResId: Int
- get() = R.string.module_message
- override fun init(application: Application) {
- getService().init(application)
- }
- override fun getMessageViewModel(owner: ViewModelStoreOwner): IMessageViewModel? {
- return getService().getMessageViewModel(owner)
- }
- override suspend fun batchQuerySayHiState(uidSet: Set<Long>): Rlt<Map<Long, Boolean>> {
- return getService().batchQuerySayHiState(uidSet)
- }
- override fun getSayHiState(uid: Long): Boolean {
- return getService().getSayHiState(uid)
- }
- override fun getNotificationMessageFloatView(data: IBaseFloatData): BaseFloatView? {
- return getService().getNotificationMessageFloatView(data)
- }
- override fun addUnReadMessageCountChangedObserver(
- observer: UnReadMessageManager.IUnReadMessageObserver,
- conversationTypes: Array<Conversation.ConversationType>
- ) {
- getService().addUnReadMessageCountChangedObserver(observer, conversationTypes)
- }
- override fun addUnReadMessageCountChangedObserver(
- observer: UnReadMessageManager.IUnReadMessageObserver,
- conversationType: Conversation.ConversationType,
- targetId: String
- ) {
- getService().addUnReadMessageCountChangedObserver(observer, conversationType, targetId)
- }
- override fun logout() {
- getService().logout()
- }
- override fun getUnreadConversationList(callback: IRongCoreCallback.ResultCallback<List<Conversation>?>, vararg conversationTypes: Conversation.ConversationType) {
- getService().getUnreadConversationList(callback, *conversationTypes)
- }
- override suspend fun getCustomerList(cache: Boolean): List<CustomerInfo>? {
- return getService().getCustomerList(cache)
- }
- override suspend fun checkIsCustomerService(targetId: Long, cache: Boolean): Boolean {
- return getService().checkIsCustomerService(targetId, cache)
- }
- override fun emptyService(): IMessageService {
- return object : IMessageService {
- override fun init(application: Application) {
- }
- override fun getMessageViewModel(owner: ViewModelStoreOwner): IMessageViewModel? {
- return null
- }
- override suspend fun batchQuerySayHiState(uidSet: Set<Long>): Rlt<Map<Long, Boolean>> {
- return Rlt.Failed(AABModuleNotInitError())
- }
- override fun getSayHiState(uid: Long): Boolean {
- return false
- }
- override fun getNotificationMessageFloatView(data: IBaseFloatData): BaseFloatView? {
- return null
- }
- override fun addUnReadMessageCountChangedObserver(
- observer: UnReadMessageManager.IUnReadMessageObserver,
- conversationTypes: Array<Conversation.ConversationType>
- ) {
- }
- override fun addUnReadMessageCountChangedObserver(
- observer: UnReadMessageManager.IUnReadMessageObserver,
- conversationType: Conversation.ConversationType,
- targetId: String
- ) {
- }
- override fun logout() {
- }
- override fun getUnreadConversationList(callback: IRongCoreCallback.ResultCallback<List<Conversation>?>, vararg conversationTypes: Conversation.ConversationType) {
- }
- override suspend fun getCustomerList(cache: Boolean): List<CustomerInfo>? {
- return null
- }
- override suspend fun checkIsCustomerService(targetId: Long, cache: Boolean): Boolean {
- return false
- }
- override fun getService(): IMessageService? {
- return null
- }
- }
- }
- }
|