Rename Async to AsyncData
This commit is contained in:
parent
3b2882ce2f
commit
7b2341aec7
139 changed files with 745 additions and 745 deletions
|
|
@ -30,7 +30,7 @@ import io.element.android.features.rageshake.api.reporter.BugReporter
|
|||
import io.element.android.features.rageshake.api.reporter.BugReporterListener
|
||||
import io.element.android.features.rageshake.api.screenshot.ScreenshotHolder
|
||||
import io.element.android.features.rageshake.impl.logs.VectorFileLogger
|
||||
import io.element.android.libraries.architecture.Async
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.architecture.Presenter
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
|
|
@ -45,27 +45,27 @@ class BugReportPresenter @Inject constructor(
|
|||
|
||||
private class BugReporterUploadListener(
|
||||
private val sendingProgress: MutableFloatState,
|
||||
private val sendingAction: MutableState<Async<Unit>>
|
||||
private val sendingAction: MutableState<AsyncData<Unit>>
|
||||
) : BugReporterListener {
|
||||
|
||||
override fun onUploadCancelled() {
|
||||
sendingProgress.floatValue = 0f
|
||||
sendingAction.value = Async.Uninitialized
|
||||
sendingAction.value = AsyncData.Uninitialized
|
||||
}
|
||||
|
||||
override fun onUploadFailed(reason: String?) {
|
||||
sendingProgress.floatValue = 0f
|
||||
sendingAction.value = Async.Failure(Exception(reason))
|
||||
sendingAction.value = AsyncData.Failure(Exception(reason))
|
||||
}
|
||||
|
||||
override fun onProgress(progress: Int) {
|
||||
sendingProgress.floatValue = progress.toFloat() / 100
|
||||
sendingAction.value = Async.Loading()
|
||||
sendingAction.value = AsyncData.Loading()
|
||||
}
|
||||
|
||||
override fun onUploadSucceed() {
|
||||
sendingProgress.floatValue = 0f
|
||||
sendingAction.value = Async.Success(Unit)
|
||||
sendingAction.value = AsyncData.Success(Unit)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,8 +83,8 @@ class BugReportPresenter @Inject constructor(
|
|||
val sendingProgress = remember {
|
||||
mutableFloatStateOf(0f)
|
||||
}
|
||||
val sendingAction: MutableState<Async<Unit>> = remember {
|
||||
mutableStateOf(Async.Uninitialized)
|
||||
val sendingAction: MutableState<AsyncData<Unit>> = remember {
|
||||
mutableStateOf(AsyncData.Uninitialized)
|
||||
}
|
||||
val formState: MutableState<BugReportFormState> = remember {
|
||||
mutableStateOf(BugReportFormState.Default)
|
||||
|
|
@ -109,7 +109,7 @@ class BugReportPresenter @Inject constructor(
|
|||
}
|
||||
BugReportEvents.ClearError -> {
|
||||
sendingProgress.floatValue = 0f
|
||||
sendingAction.value = Async.Uninitialized
|
||||
sendingAction.value = AsyncData.Uninitialized
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package io.element.android.features.rageshake.impl.bugreport
|
||||
|
||||
import android.os.Parcelable
|
||||
import io.element.android.libraries.architecture.Async
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
data class BugReportState(
|
||||
|
|
@ -25,11 +25,11 @@ data class BugReportState(
|
|||
val hasCrashLogs: Boolean,
|
||||
val screenshotUri: String?,
|
||||
val sendingProgress: Float,
|
||||
val sending: Async<Unit>,
|
||||
val sending: AsyncData<Unit>,
|
||||
val eventSink: (BugReportEvents) -> Unit
|
||||
) {
|
||||
val submitEnabled =
|
||||
formState.description.length > 10 && sending !is Async.Loading
|
||||
formState.description.length > 10 && sending !is AsyncData.Loading
|
||||
}
|
||||
|
||||
@Parcelize
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
package io.element.android.features.rageshake.impl.bugreport
|
||||
|
||||
import androidx.compose.ui.tooling.preview.PreviewParameterProvider
|
||||
import io.element.android.libraries.architecture.Async
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
|
||||
open class BugReportStateProvider : PreviewParameterProvider<BugReportState> {
|
||||
override val values: Sequence<BugReportState>
|
||||
|
|
@ -31,8 +31,8 @@ open class BugReportStateProvider : PreviewParameterProvider<BugReportState> {
|
|||
hasCrashLogs = true,
|
||||
screenshotUri = "aUri"
|
||||
),
|
||||
aBugReportState().copy(sending = Async.Loading()),
|
||||
aBugReportState().copy(sending = Async.Success(Unit)),
|
||||
aBugReportState().copy(sending = AsyncData.Loading()),
|
||||
aBugReportState().copy(sending = AsyncData.Success(Unit)),
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -41,6 +41,6 @@ fun aBugReportState() = BugReportState(
|
|||
hasCrashLogs = false,
|
||||
screenshotUri = null,
|
||||
sendingProgress = 0F,
|
||||
sending = Async.Uninitialized,
|
||||
sending = AsyncData.Uninitialized,
|
||||
eventSink = {}
|
||||
)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import androidx.compose.ui.unit.dp
|
|||
import coil.compose.AsyncImage
|
||||
import coil.request.ImageRequest
|
||||
import io.element.android.features.rageshake.impl.R
|
||||
import io.element.android.libraries.architecture.Async
|
||||
import io.element.android.libraries.architecture.AsyncData
|
||||
import io.element.android.libraries.designsystem.components.async.AsyncView
|
||||
import io.element.android.libraries.designsystem.components.form.textFieldState
|
||||
import io.element.android.libraries.designsystem.components.preferences.PreferencePage
|
||||
|
|
@ -67,7 +67,7 @@ fun BugReportView(
|
|||
title = stringResource(id = CommonStrings.common_report_a_problem),
|
||||
onBackPressed = onBackPressed
|
||||
) {
|
||||
val isFormEnabled = state.sending !is Async.Loading
|
||||
val isFormEnabled = state.sending !is AsyncData.Loading
|
||||
var descriptionFieldState by textFieldState(
|
||||
stateValue = state.formState.description
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue