Last active
March 21, 2022 15:22
-
-
Save laurentyhuel/1f9786092b4a73dfca71da38960a8811 to your computer and use it in GitHub Desktop.
2x screen SharedViewModel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomerDisplayViewModel : ViewModel() { | |
enum class CustomerDisplayState(val flipperViewIndex: Int) { | |
DEFAULT(0), CART(1), CONFIRM_PRINT(2) | |
} | |
val stateLiveData = MutableLiveData<CustomerDisplayState>() | |
val cartLiveData = MutableLiveData<OrderCartPresentationModel>() | |
var confirmPrintReceiptListener: ConfirmPrintReceiptDialogFragment.ConfirmPrintReceiptListener? = null | |
var isCustomerDisplayAvailable = false | |
fun changeState(newState: CustomerDisplayState) { | |
if(stateLiveData.value == newState){ | |
return | |
} | |
stateLiveData.postValue(newState) | |
} | |
[...] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment