Skip to content

Commit

Permalink
Replace object with data object
Browse files Browse the repository at this point in the history
  • Loading branch information
Siddharth Agarwal committed Jul 18, 2024
1 parent 6ec73f7 commit 76610c5
Show file tree
Hide file tree
Showing 232 changed files with 699 additions and 699 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/org/simple/clinic/ContactType.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import org.simple.clinic.util.room.SafeEnumTypeAdapter
sealed class ContactType : Parcelable {

@Parcelize
object WhatsApp : ContactType()
data object WhatsApp : ContactType()

@Parcelize
object Telegram : ContactType()
data object Telegram : ContactType()

@Parcelize
data class Unknown(val actualValue: String) : ContactType()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ sealed class AppUpdateState : Parcelable {
data class AppUpdateStateError(val exception: Throwable) : AppUpdateState()

@Parcelize
object DontShowAppUpdate : AppUpdateState()
data object DontShowAppUpdate : AppUpdateState()
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ package org.simple.clinic.appupdate.criticalupdatedialog

sealed class CriticalAppUpdateEffect

object LoadAppUpdateHelpContact : CriticalAppUpdateEffect()
data object LoadAppUpdateHelpContact : CriticalAppUpdateEffect()

sealed class CriticalAppUpdateViewEffect : CriticalAppUpdateEffect()

data class OpenHelpContactUrl(val contactUrl: String) : CriticalAppUpdateViewEffect()

object OpenSimpleInGooglePlay : CriticalAppUpdateViewEffect()
data object OpenSimpleInGooglePlay : CriticalAppUpdateViewEffect()

object LoadAppStaleness : CriticalAppUpdateEffect()
data object LoadAppStaleness : CriticalAppUpdateEffect()
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ sealed class CriticalAppUpdateEvent : UiEvent

data class AppUpdateHelpContactLoaded(val appUpdateHelpContact: Optional<AppUpdateHelpContact>) : CriticalAppUpdateEvent()

object ContactHelpClicked : CriticalAppUpdateEvent() {
data object ContactHelpClicked : CriticalAppUpdateEvent() {
override val analyticsName: String = "Critical App Update Dialog:Contact Help Clicked"
}

object UpdateAppClicked : CriticalAppUpdateEvent() {
data object UpdateAppClicked : CriticalAppUpdateEvent() {
override val analyticsName: String = "Critical App Update Dialog:Update App Clicked"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,16 @@ sealed class BloodSugarMeasurementType : Parcelable {
}

@Parcelize
object Random : BloodSugarMeasurementType()
data object Random : BloodSugarMeasurementType()

@Parcelize
object PostPrandial : BloodSugarMeasurementType()
data object PostPrandial : BloodSugarMeasurementType()

@Parcelize
object Fasting : BloodSugarMeasurementType()
data object Fasting : BloodSugarMeasurementType()

@Parcelize
object HbA1c : BloodSugarMeasurementType()
data object HbA1c : BloodSugarMeasurementType()

@Parcelize
data class Unknown(val actualValue: String) : BloodSugarMeasurementType()
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sealed class PrefillDate : BloodSugarEntryEffect() {
}
}

object PrefillCurrentDate : PrefillDate()
data object PrefillCurrentDate : PrefillDate()

data class PrefillSpecificDate(val date: Instant) : PrefillDate()
}
Expand All @@ -47,21 +47,21 @@ data class UpdateBloodSugarEntry(

data class FetchBloodSugarMeasurement(val bloodSugarMeasurementUuid: UUID) : BloodSugarEntryEffect()

object LoadBloodSugarUnitPreference : BloodSugarEntryEffect()
data object LoadBloodSugarUnitPreference : BloodSugarEntryEffect()

sealed class BloodSugarEntryViewEffect : BloodSugarEntryEffect()

data class SetBloodSugarReading(val bloodSugarReading: String) : BloodSugarEntryViewEffect()

object HideBloodSugarErrorMessage : BloodSugarEntryViewEffect()
data object HideBloodSugarErrorMessage : BloodSugarEntryViewEffect()

object HideDateErrorMessage : BloodSugarEntryViewEffect()
data object HideDateErrorMessage : BloodSugarEntryViewEffect()

object Dismiss : BloodSugarEntryViewEffect()
data object Dismiss : BloodSugarEntryViewEffect()

object ShowDateEntryScreen : BloodSugarEntryViewEffect()
data object ShowDateEntryScreen : BloodSugarEntryViewEffect()

object SetBloodSugarSavedResultAndFinish : BloodSugarEntryViewEffect()
data object SetBloodSugarSavedResultAndFinish : BloodSugarEntryViewEffect()

data class ShowConfirmRemoveBloodSugarDialog(val bloodSugarMeasurementUuid: UUID) : BloodSugarEntryViewEffect()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ data class BloodSugarSaved(val wasDateChanged: Boolean) : BloodSugarEntryEvent()

data class DatePrefilled(val prefilledDate: LocalDate) : BloodSugarEntryEvent()

object BackPressed : BloodSugarEntryEvent()
data object BackPressed : BloodSugarEntryEvent()

object ChangeDateClicked : BloodSugarEntryEvent()
data object ChangeDateClicked : BloodSugarEntryEvent()

object ShowBloodSugarEntryClicked : BloodSugarEntryEvent()
data object ShowBloodSugarEntryClicked : BloodSugarEntryEvent()

object SaveClicked : BloodSugarEntryEvent() {
data object SaveClicked : BloodSugarEntryEvent() {
override val analyticsName: String = "Blood Sugar Entry:Save Clicked"
}

data class BloodSugarMeasurementFetched(val bloodSugarMeasurement: BloodSugarMeasurement) : BloodSugarEntryEvent()

object RemoveBloodSugarClicked : BloodSugarEntryEvent() {
data object RemoveBloodSugarClicked : BloodSugarEntryEvent() {
override val analyticsName: String = "Blood Sugar Entry: Remove clicked"
}

data class BloodSugarUnitPreferenceLoaded(val bloodSugarUnitPreference: BloodSugarUnitPreference) : BloodSugarEntryEvent()

object BloodSugarReadingUnitButtonClicked : BloodSugarEntryEvent()
data object BloodSugarReadingUnitButtonClicked : BloodSugarEntryEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.simple.clinic.bloodsugar.BloodSugarMeasurementType
sealed class ValidationResult {
data class Valid(val bloodSugarReading: Float) : ValidationResult()

object ErrorBloodSugarEmpty : ValidationResult()
data object ErrorBloodSugarEmpty : ValidationResult()
data class ErrorBloodSugarTooHigh(val measurementType: BloodSugarMeasurementType) : ValidationResult()
data class ErrorBloodSugarTooLow(val measurementType: BloodSugarMeasurementType) : ValidationResult()
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ sealed class ConfirmRemoveBloodSugarEffect

data class MarkBloodSugarAsDeleted(val bloodSugarMeasurementUuid: UUID) : ConfirmRemoveBloodSugarEffect()

object CloseConfirmRemoveBloodSugarDialog : ConfirmRemoveBloodSugarEffect()
data object CloseConfirmRemoveBloodSugarDialog : ConfirmRemoveBloodSugarEffect()
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import org.simple.clinic.widgets.UiEvent

sealed class ConfirmRemoveBloodSugarEvent : UiEvent

object BloodSugarMarkedAsDeleted : ConfirmRemoveBloodSugarEvent()
data object BloodSugarMarkedAsDeleted : ConfirmRemoveBloodSugarEvent()

object RemoveBloodSugarClicked : ConfirmRemoveBloodSugarEvent()
data object RemoveBloodSugarClicked : ConfirmRemoveBloodSugarEvent()
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sealed class BloodSugarHistoryScreenEvent : UiEvent

data class PatientLoaded(val patient: Patient) : BloodSugarHistoryScreenEvent()

object AddNewBloodSugarClicked : BloodSugarHistoryScreenEvent() {
data object AddNewBloodSugarClicked : BloodSugarHistoryScreenEvent() {
override val analyticsName: String = "Blood Sugar History:Add New Blood Sugar"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import org.simple.clinic.widgets.visibleOrGone

sealed class BloodSugarHistoryListItem : PagingItemAdapter_old.Item<Event> {

object NewBloodSugarButton : BloodSugarHistoryListItem() {
data object NewBloodSugarButton : BloodSugarHistoryListItem() {
override fun layoutResId(): Int = R.layout.list_new_blood_sugar_button

override fun render(holder: BindingViewHolder, subject: Subject<Event>) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import org.simple.clinic.bloodsugar.BloodSugarMeasurement

sealed class Event

object NewBloodSugarClicked : Event()
data object NewBloodSugarClicked : Event()

data class BloodSugarHistoryItemClicked(val measurement: BloodSugarMeasurement) : Event()
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ data class SaveBloodSugarUnitSelection(val bloodSugarUnitSelection: BloodSugarUn

sealed class BloodSugarUnitSelectionViewEffect : BloodSugarUnitSelectionEffect()

object CloseDialog : BloodSugarUnitSelectionViewEffect()
data object CloseDialog : BloodSugarUnitSelectionViewEffect()

data class PreFillBloodSugarUnitSelected(val bloodSugarUnitPreference: BloodSugarUnitPreference) : BloodSugarUnitSelectionViewEffect()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import org.simple.clinic.bloodsugar.BloodSugarUnitPreference

sealed class BloodSugarUnitSelectionEvent

object BloodSugarUnitSelectionUpdated : BloodSugarUnitSelectionEvent()
data object BloodSugarUnitSelectionUpdated : BloodSugarUnitSelectionEvent()

data class DoneClicked(val bloodSugarUnitSelection: BloodSugarUnitPreference) : BloodSugarUnitSelectionEvent()

Expand Down
14 changes: 7 additions & 7 deletions app/src/main/java/org/simple/clinic/bp/ValidationResult.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package org.simple.clinic.bp
sealed class ValidationResult {
data class Valid(val reading: BloodPressureReading) : ValidationResult()

object ErrorSystolicEmpty : ValidationResult()
object ErrorDiastolicEmpty : ValidationResult()
object ErrorSystolicTooHigh : ValidationResult()
object ErrorSystolicTooLow : ValidationResult()
object ErrorDiastolicTooHigh : ValidationResult()
object ErrorDiastolicTooLow : ValidationResult()
object ErrorSystolicLessThanDiastolic : ValidationResult()
data object ErrorSystolicEmpty : ValidationResult()
data object ErrorDiastolicEmpty : ValidationResult()
data object ErrorSystolicTooHigh : ValidationResult()
data object ErrorSystolicTooLow : ValidationResult()
data object ErrorDiastolicTooHigh : ValidationResult()
data object ErrorDiastolicTooLow : ValidationResult()
data object ErrorSystolicLessThanDiastolic : ValidationResult()
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@ sealed class PrefillDate : BloodPressureEntryEffect() {
}
}

object PrefillCurrentDate : PrefillDate()
data object PrefillCurrentDate : PrefillDate()

data class PrefillSpecificDate(val date: Instant) : PrefillDate()
}

object HideBpErrorMessage : BloodPressureEntryEffect()
data object HideBpErrorMessage : BloodPressureEntryEffect()

object ChangeFocusToDiastolic : BloodPressureEntryEffect()
data object ChangeFocusToDiastolic : BloodPressureEntryEffect()

object ChangeFocusToSystolic : BloodPressureEntryEffect()
data object ChangeFocusToSystolic : BloodPressureEntryEffect()

data class SetSystolic(val systolic: String) : BloodPressureEntryEffect()

Expand All @@ -39,13 +39,13 @@ data class SetDiastolic(val diastolic: String) : BloodPressureEntryEffect()

data class ShowConfirmRemoveBloodPressureDialog(val bpUuid: UUID) : BloodPressureEntryEffect()

object Dismiss : BloodPressureEntryEffect()
data object Dismiss : BloodPressureEntryEffect()

object HideDateErrorMessage : BloodPressureEntryEffect()
data object HideDateErrorMessage : BloodPressureEntryEffect()

data class ShowBpValidationError(val result: ValidationResult) : BloodPressureEntryEffect()

object ShowDateEntryScreen : BloodPressureEntryEffect()
data object ShowDateEntryScreen : BloodPressureEntryEffect()

data class ShowBpEntryScreen(val date: LocalDate) : BloodPressureEntryEffect()

Expand All @@ -62,7 +62,7 @@ data class CreateNewBpEntry(
get() = userEnteredDate != prefilledDate
}

object SetBpSavedResultAndFinish : BloodPressureEntryEffect()
data object SetBpSavedResultAndFinish : BloodPressureEntryEffect()

data class UpdateBpEntry(
val bpUuid: UUID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ data class DiastolicChanged(val diastolic: String) : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Diastolic Text Changed"
}

object SaveClicked : BloodPressureEntryEvent() {
data object SaveClicked : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Save Clicked"
}

object RemoveBloodPressureClicked : BloodPressureEntryEvent() {
data object RemoveBloodPressureClicked : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Remove Clicked"
}

object DiastolicBackspaceClicked : BloodPressureEntryEvent()
data object DiastolicBackspaceClicked : BloodPressureEntryEvent()

data class ScreenChanged(val type: ScreenType) : BloodPressureEntryEvent()

Expand All @@ -40,15 +40,15 @@ data class BloodPressureSaved(val wasDateChanged: Boolean) : BloodPressureEntryE
}
}

object ChangeDateClicked : BloodPressureEntryEvent() {
data object ChangeDateClicked : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Next Arrow Clicked"
}

object ShowBpClicked : BloodPressureEntryEvent() {
data object ShowBpClicked : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Previous Arrow Clicked"
}

object BackPressed : BloodPressureEntryEvent() {
data object BackPressed : BloodPressureEntryEvent() {
override val analyticsName = "Blood Pressure Entry:Hardware Back Pressed"
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import java.util.UUID

sealed class ConfirmRemoveBloodPressureEffect

object CloseDialog : ConfirmRemoveBloodPressureEffect()
data object CloseDialog : ConfirmRemoveBloodPressureEffect()

data class DeleteBloodPressure(val bloodPressureMeasurementUuid: UUID) : ConfirmRemoveBloodPressureEffect()
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import org.simple.clinic.widgets.UiEvent

sealed class ConfirmRemoveBloodPressureEvent : UiEvent

object BloodPressureDeleted : ConfirmRemoveBloodPressureEvent()
data object BloodPressureDeleted : ConfirmRemoveBloodPressureEvent()

object ConfirmRemoveBloodPressureDialogRemoveClicked : ConfirmRemoveBloodPressureEvent() {
data object ConfirmRemoveBloodPressureDialogRemoveClicked : ConfirmRemoveBloodPressureEvent() {
override val analyticsName = "Confirm Remove Blood Pressure:Remove Clicked"
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ sealed class BloodPressureHistoryScreenEvent : UiEvent

data class PatientLoaded(val patient: Patient) : BloodPressureHistoryScreenEvent()

object NewBloodPressureClicked : BloodPressureHistoryScreenEvent()
data object NewBloodPressureClicked : BloodPressureHistoryScreenEvent()

data class BloodPressureClicked(val bloodPressureMeasurement: BloodPressureMeasurement) : BloodPressureHistoryScreenEvent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import org.simple.clinic.widgets.visibleOrGone

sealed class BloodPressureHistoryListItem : PagingItemAdapter_old.Item<Event> {

object NewBpButton : BloodPressureHistoryListItem() {
data object NewBpButton : BloodPressureHistoryListItem() {

override fun layoutResId(): Int = R.layout.list_new_bp_button

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ package org.simple.clinic.bp.history.adapter
import org.simple.clinic.bp.BloodPressureMeasurement

sealed class Event {
object AddNewBpClicked : Event()
data object AddNewBpClicked : Event()
data class BloodPressureHistoryItemClicked(val measurement: BloodPressureMeasurement) : Event()
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class LoadContactPatientProfile(val patientUuid: UUID) : ContactPatientEffe

data class LoadLatestOverdueAppointment(val patientUuid: UUID) : ContactPatientEffect()

object LoadCurrentFacility : ContactPatientEffect()
data object LoadCurrentFacility : ContactPatientEffect()

data class MarkPatientAsAgreedToVisit(val appointment: Appointment) : ContactPatientEffect()

Expand All @@ -37,7 +37,7 @@ data class MaskedCallWithManualDialer(
val proxyPhoneNumber: String
) : ContactPatientViewEffect()

object CloseScreen : ContactPatientViewEffect()
data object CloseScreen : ContactPatientViewEffect()

data class ShowManualDatePicker(
val preselectedDate: LocalDate,
Expand Down
Loading

0 comments on commit 76610c5

Please sign in to comment.