Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ plugins {

android {
defaultConfig {
val buildVersion = 246
val buildVersion = 247
applicationId = "com.crisiscleanup"
versionCode = buildVersion
versionName = "0.9.${buildVersion - 168}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ class NetworkErrorsTest {
errors,
)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class CreateEditCaseViewModel @Inject constructor(
) : EditCaseBaseViewModel(editableWorksiteProvider, translator, logger), CaseCameraMediaManager {
private val caseEditorArgs = CaseEditorArgs(savedStateHandle)
private var worksiteIdArg = caseEditorArgs.worksiteId
private val isCreateWorksite: Boolean
val isCreateWorksite: Boolean
get() = worksiteIdArg == null

private val hasNewWorksitePhotosImages: Boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,23 +377,12 @@ private fun ColumnScope.FullEditView(
BusyIndicatorFloatingTopCenter(isLoadingWorksite)

if (incidentCreation.isOldIncident && !hasConfirmedDormantIncident) {
val t = LocalAppTranslator.current
CrisisCleanupAlertDialog(
title = t("~~Old Incident"),
confirmButton = {
CrisisCleanupTextButton(text = t("actions.yes")) {
hasConfirmedDormantIncident = true
}
},
dismissButton = {
CrisisCleanupTextButton(
text = t("actions.no"),
onClick = onBack,
)
},
text = t("~~{incident_name} was created {relative_time}. Continue creating a Case for {incident_name}?")
.replace("{incident_name}", caseData.incident.shortName)
.replace("{relative_time}", incidentCreation.relativeTime),
ConfirmOldIncidentDialog(
isCreateWorksite = viewModel.isCreateWorksite,
incidentName = caseData.incident.shortName,
incidentCreateRelativeTime = incidentCreation.relativeTime,
onConfirm = { hasConfirmedDormantIncident = true },
onAbort = onBack,
)
}
}
Expand Down Expand Up @@ -441,6 +430,40 @@ private fun ColumnScope.FullEditView(
}
}

@Composable
private fun ConfirmOldIncidentDialog(
isCreateWorksite: Boolean,
incidentName: String,
incidentCreateRelativeTime: String,
onConfirm: () -> Unit,
onAbort: () -> Unit,
) {
val t = LocalAppTranslator.current
val confirmContinueKey = if (isCreateWorksite) {
"~~{incident_name} was created {relative_time}. Continue creating a Case for {incident_name}?"
} else {
"~~{incident_name} was created {relative_time}. Continue editing this Case for {incident_name}?"
}
CrisisCleanupAlertDialog(
title = t("~~Old Incident"),
confirmButton = {
CrisisCleanupTextButton(
text = t("actions.yes"),
onClick = onConfirm,
)
},
dismissButton = {
CrisisCleanupTextButton(
text = t("actions.no"),
onClick = onAbort,
)
},
text = t(confirmContinueKey)
.replace("{incident_name}", incidentName)
.replace("{relative_time}", incidentCreateRelativeTime),
)
}

private fun LazyListScope.sectionSeparator(key: String) {
item(
key,
Expand Down
Loading