refactor (start chat) : use invite people module in room details screen
This commit is contained in:
parent
bfd1182baf
commit
74f6a83219
20 changed files with 207 additions and 543 deletions
|
|
@ -7,10 +7,14 @@
|
|||
|
||||
package io.element.android.services.apperror.api
|
||||
|
||||
import androidx.annotation.StringRes
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
|
||||
interface AppErrorStateService {
|
||||
val appErrorStateFlow: StateFlow<AppErrorState>
|
||||
|
||||
fun showError(title: String, body: String)
|
||||
|
||||
fun showError(@StringRes titleRes: Int, @StringRes bodyRes: Int)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,10 @@
|
|||
|
||||
package io.element.android.services.apperror.impl
|
||||
|
||||
import android.content.Context
|
||||
import com.squareup.anvil.annotations.ContributesBinding
|
||||
import io.element.android.libraries.di.AppScope
|
||||
import io.element.android.libraries.di.ApplicationContext
|
||||
import io.element.android.libraries.di.SingleIn
|
||||
import io.element.android.services.apperror.api.AppErrorState
|
||||
import io.element.android.services.apperror.api.AppErrorStateService
|
||||
|
|
@ -18,7 +20,9 @@ import javax.inject.Inject
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
@SingleIn(AppScope::class)
|
||||
class DefaultAppErrorStateService @Inject constructor() : AppErrorStateService {
|
||||
class DefaultAppErrorStateService @Inject constructor(
|
||||
@ApplicationContext private val context: Context,
|
||||
) : AppErrorStateService {
|
||||
private val currentAppErrorState = MutableStateFlow<AppErrorState>(AppErrorState.NoError)
|
||||
override val appErrorStateFlow: StateFlow<AppErrorState> = currentAppErrorState
|
||||
|
||||
|
|
@ -31,4 +35,10 @@ class DefaultAppErrorStateService @Inject constructor() : AppErrorStateService {
|
|||
},
|
||||
)
|
||||
}
|
||||
|
||||
override fun showError(titleRes: Int, bodyRes: Int) {
|
||||
val title = context.getString(titleRes)
|
||||
val body = context.getString(bodyRes)
|
||||
showError(title, body)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue