Created
May 9, 2022 08:29
-
-
Save laurentyhuel/dc173f06394fc1bcdf831ac91fcb58ba 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