mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
refactor (start chat) : use invite people module in room details screen
This commit is contained in:
+4
@@ -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)
|
||||
|
||||
}
|
||||
|
||||
+11
-1
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user