-
- All Implemented Interfaces:
@Singleton() public class VendorsViewModel extends ViewModel
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final classVendorsViewModel.VendorsTranslationsDelegate
-
Field Summary
Fields Modifier and Type Field Description private BooleanignoreVendorDataChangesprivate VendorsViewModel.VendorsTranslationsDelegatetranslationsprivate final List<Vendor>allRequiredVendorsprivate final BooleanshouldHandleAllVendorsStateprivate final MutableLiveData<Vendor>selectedVendorprivate final MutableLiveData<DidomiToggle.State>selectedVendorConsentStateprivate final MutableLiveData<DidomiToggle.State>selectedVendorLegIntStateprivate final MutableLiveData<Boolean>selectedVendorDeviceStorageDisclosuresLoadedprivate final BooleanshouldHideDidomiLogoprivate final AccessibilitycloseButtonAccessibilityprivate final AccessibilitycloseDetailsButtonAccessibilityprivate final VendorItem.BulkvendorItemBulkprivate final LogoProviderlogoProvider
-
Constructor Summary
Constructors Constructor Description VendorsViewModel(ApiEventsRepository apiEventsRepository, ConfigurationRepository configurationRepository, EventsRepository eventsRepository, LanguagesHelper languagesHelper, ThemeProvider themeProvider, UserChoicesInfoProvider userChoicesInfoProvider, VendorRepository vendorRepository, LogoProvider logoProvider)
-
Method Summary
Modifier and Type Method Description final BooleangetIgnoreVendorDataChanges()final UnitsetIgnoreVendorDataChanges(Boolean ignoreVendorDataChanges)final VendorsViewModel.VendorsTranslationsDelegategetTranslations()final UnitsetTranslations(VendorsViewModel.VendorsTranslationsDelegate translations)final List<Vendor>getAllRequiredVendors()final BooleangetShouldHandleAllVendorsState()final MutableLiveData<Vendor>getSelectedVendor()final MutableLiveData<DidomiToggle.State>getSelectedVendorConsentState()final MutableLiveData<DidomiToggle.State>getSelectedVendorLegIntState()final MutableLiveData<Boolean>getSelectedVendorDeviceStorageDisclosuresLoaded()final BooleangetShouldHideDidomiLogo()Return the shouldHideDidomiLogo flag from the app object. final AccessibilitygetCloseButtonAccessibility()final AccessibilitygetCloseDetailsButtonAccessibility()final VendorItem.BulkgetVendorItemBulk()final LogoProvidergetLogoProvider()final UnitupdateTranslations()Update model translations if needed final UnitsetSelectedVendorConsentState(DidomiToggle.State selectedVendorConsentState)final UnitinitializeSelectedVendorStates(Vendor selectedVendor)final UnitsetSelectedVendorLegIntState(DidomiToggle.State selectedVendorLegIntState)final UnitsetSelectedVendor(Vendor vendor)final BooleanhasLoadedVendorDeviceStorageDisclosures()Whether device storage disclosures list is currently loaded final UnitloadVendorDeviceStorageDisclosures(Vendor vendor)Starts loading asynchronously device storage disclosures list for the specified vendor. final UnittriggerEvent(Event event)Method used to trigger an event through the eventsRepository. final CharSequencegetVendorNameWithTag(Context context, Vendor vendor)Get the vendor name with the "IAB TCF" tag, with styled Spans, if needed final Array<String>getConsentDataProcessingDescription(Vendor vendor)Get the description of the consent based data processing for a specific vendor final BooleanshouldShowAdditionalDataProcessing(Vendor vendor)Whether the Additional data processing section should be shown or not We show it if the TCF version is 2 and we have at least one required special purpose or feature final BooleanshouldDisplayDeviceStorageDisclosuresList(Vendor vendor)Whether the specified vendor should have a Device storage disclosures section final BooleanshouldDisplayDeviceStorageDisclosuresLink(Vendor vendor)Whether the specified vendor should have a Device storage disclosures link final SpannedgetDeviceStorageDisclosuresLink(Vendor vendor)Compute device storage link for selected vendor final BooleanshouldShowEssentialPurposes(Vendor vendor)Whether the Required data processing section should be shown or not We show it if we have at least one essential purpose final StringgetAdditionalDataProcessingText(Vendor vendor)Get additional data processing description text for a vendor final StringgetEssentialPurposesListText(Vendor vendor)Method used to get the essential purposes list formatted with bullets. final Array<String>getLegitimateInterestDataProcessingDescription(Vendor vendor)Get the description of the legitimate interest based data processing for a specific vendor final UnitupdateAllVendors(DidomiToggle.State status)Method used to handle the case when the user select or unselect all vendors. final BooleanallVendorsEnabled()Method used to check if all vendors are enabled. final BooleanallVendorsDisabled()Method used to check if all vendors are disabled. final DidomiToggle.StategetVendorSwitchStatus(Vendor vendor)Get the status of a vendor final BooleanshouldHandleLegitimateInterestState(Vendor vendor)Verify if vendor legitimate interest state can be changed by the user final BooleanshouldHandleConsentState(Vendor vendor)Verify if consent state can be changed by the user final BooleanshouldHandleState(Vendor vendor)Verify if vendor state can be changed by the user final AccessibilitygetSelectedVendorConsentAccessibility()Accessibility information for vendor details Consent switch final AccessibilitygetSelectedVendorLegIntAccessibility()Accessibility information for vendor details Legitimate Interest switch final UnitonBulkVendorSwitchWasToggled(DidomiToggle.State state)final UnitonVendorSwitchWasToggled()Trigger Vendor changed event final UnitonVendorsWasShown()Trigger Vendor shown event final UnitonGlobalVendorSwitchChanged(Vendor vendor, DidomiToggle.State state)final UnithandleVendorConsentSwitchChanged(Vendor vendor, DidomiToggle.State consentStatus)final UnithandleVendorLegIntSwitchChanged(Vendor vendor, DidomiToggle.State legIntState)final VendorItem.VendorgetVendorItem(Context context, Vendor vendor)Get Vendor item final List<VendorItem>getVendorItemList(Context context)Get Vendor list item -
-
Constructor Detail
-
VendorsViewModel
VendorsViewModel(ApiEventsRepository apiEventsRepository, ConfigurationRepository configurationRepository, EventsRepository eventsRepository, LanguagesHelper languagesHelper, ThemeProvider themeProvider, UserChoicesInfoProvider userChoicesInfoProvider, VendorRepository vendorRepository, LogoProvider logoProvider)
-
-
Method Detail
-
getIgnoreVendorDataChanges
final Boolean getIgnoreVendorDataChanges()
-
setIgnoreVendorDataChanges
final Unit setIgnoreVendorDataChanges(Boolean ignoreVendorDataChanges)
-
getTranslations
final VendorsViewModel.VendorsTranslationsDelegate getTranslations()
-
setTranslations
final Unit setTranslations(VendorsViewModel.VendorsTranslationsDelegate translations)
-
getAllRequiredVendors
final List<Vendor> getAllRequiredVendors()
-
getShouldHandleAllVendorsState
final Boolean getShouldHandleAllVendorsState()
-
getSelectedVendor
final MutableLiveData<Vendor> getSelectedVendor()
-
getSelectedVendorConsentState
final MutableLiveData<DidomiToggle.State> getSelectedVendorConsentState()
-
getSelectedVendorLegIntState
final MutableLiveData<DidomiToggle.State> getSelectedVendorLegIntState()
-
getSelectedVendorDeviceStorageDisclosuresLoaded
final MutableLiveData<Boolean> getSelectedVendorDeviceStorageDisclosuresLoaded()
-
getShouldHideDidomiLogo
final Boolean getShouldHideDidomiLogo()
Return the shouldHideDidomiLogo flag from the app object.
-
getCloseButtonAccessibility
final Accessibility getCloseButtonAccessibility()
-
getCloseDetailsButtonAccessibility
final Accessibility getCloseDetailsButtonAccessibility()
-
getVendorItemBulk
final VendorItem.Bulk getVendorItemBulk()
-
getLogoProvider
final LogoProvider getLogoProvider()
-
updateTranslations
final Unit updateTranslations()
Update model translations if needed
-
setSelectedVendorConsentState
final Unit setSelectedVendorConsentState(DidomiToggle.State selectedVendorConsentState)
-
initializeSelectedVendorStates
final Unit initializeSelectedVendorStates(Vendor selectedVendor)
-
setSelectedVendorLegIntState
final Unit setSelectedVendorLegIntState(DidomiToggle.State selectedVendorLegIntState)
-
setSelectedVendor
final Unit setSelectedVendor(Vendor vendor)
-
hasLoadedVendorDeviceStorageDisclosures
final Boolean hasLoadedVendorDeviceStorageDisclosures()
Whether device storage disclosures list is currently loaded
-
loadVendorDeviceStorageDisclosures
final Unit loadVendorDeviceStorageDisclosures(Vendor vendor)
Starts loading asynchronously device storage disclosures list for the specified vendor. Use hasLoadedVendorDeviceStorageDisclosures to be notified when loading is complete.
-
triggerEvent
final Unit triggerEvent(Event event)
Method used to trigger an event through the eventsRepository.
- Parameters:
event- event to be triggered.
-
getVendorNameWithTag
final CharSequence getVendorNameWithTag(Context context, Vendor vendor)
Get the vendor name with the "IAB TCF" tag, with styled Spans, if needed
- Parameters:
context- activity or application contextvendor- the specified vendor
-
getConsentDataProcessingDescription
final Array<String> getConsentDataProcessingDescription(Vendor vendor)
Get the description of the consent based data processing for a specific vendor
- Parameters:
vendor- vendor from which we want to get the description.
-
shouldShowAdditionalDataProcessing
final Boolean shouldShowAdditionalDataProcessing(Vendor vendor)
Whether the Additional data processing section should be shown or not We show it if the TCF version is 2 and we have at least one required special purpose or feature
-
shouldDisplayDeviceStorageDisclosuresList
final Boolean shouldDisplayDeviceStorageDisclosuresList(Vendor vendor)
Whether the specified vendor should have a Device storage disclosures section
- Parameters:
vendor- as Vendor
-
shouldDisplayDeviceStorageDisclosuresLink
final Boolean shouldDisplayDeviceStorageDisclosuresLink(Vendor vendor)
Whether the specified vendor should have a Device storage disclosures link
- Parameters:
vendor- as Vendor
-
getDeviceStorageDisclosuresLink
final Spanned getDeviceStorageDisclosuresLink(Vendor vendor)
Compute device storage link for selected vendor
- Parameters:
vendor- as Vendor
-
shouldShowEssentialPurposes
final Boolean shouldShowEssentialPurposes(Vendor vendor)
Whether the Required data processing section should be shown or not We show it if we have at least one essential purpose
- Parameters:
vendor- as Vendor
-
getAdditionalDataProcessingText
final String getAdditionalDataProcessingText(Vendor vendor)
Get additional data processing description text for a vendor
- Parameters:
vendor- as Vendor
-
getEssentialPurposesListText
final String getEssentialPurposesListText(Vendor vendor)
Method used to get the essential purposes list formatted with bullets.
- Parameters:
vendor- the vendor to display
-
getLegitimateInterestDataProcessingDescription
final Array<String> getLegitimateInterestDataProcessingDescription(Vendor vendor)
Get the description of the legitimate interest based data processing for a specific vendor
- Parameters:
vendor- vendor from which we want to get the description.
-
updateAllVendors
final Unit updateAllVendors(DidomiToggle.State status)
Method used to handle the case when the user select or unselect all vendors.
-
allVendorsEnabled
final Boolean allVendorsEnabled()
Method used to check if all vendors are enabled.
-
allVendorsDisabled
final Boolean allVendorsDisabled()
Method used to check if all vendors are disabled.
-
getVendorSwitchStatus
final DidomiToggle.State getVendorSwitchStatus(Vendor vendor)
Get the status of a vendor
- Parameters:
vendor- affected vendor
-
shouldHandleLegitimateInterestState
final Boolean shouldHandleLegitimateInterestState(Vendor vendor)
Verify if vendor legitimate interest state can be changed by the user
-
shouldHandleConsentState
final Boolean shouldHandleConsentState(Vendor vendor)
Verify if consent state can be changed by the user
-
shouldHandleState
final Boolean shouldHandleState(Vendor vendor)
Verify if vendor state can be changed by the user
-
getSelectedVendorConsentAccessibility
final Accessibility getSelectedVendorConsentAccessibility()
Accessibility information for vendor details Consent switch
-
getSelectedVendorLegIntAccessibility
final Accessibility getSelectedVendorLegIntAccessibility()
Accessibility information for vendor details Legitimate Interest switch
-
onBulkVendorSwitchWasToggled
final Unit onBulkVendorSwitchWasToggled(DidomiToggle.State state)
-
onVendorSwitchWasToggled
final Unit onVendorSwitchWasToggled()
Trigger Vendor changed event
-
onVendorsWasShown
final Unit onVendorsWasShown()
Trigger Vendor shown event
-
onGlobalVendorSwitchChanged
final Unit onGlobalVendorSwitchChanged(Vendor vendor, DidomiToggle.State state)
-
handleVendorConsentSwitchChanged
final Unit handleVendorConsentSwitchChanged(Vendor vendor, DidomiToggle.State consentStatus)
-
handleVendorLegIntSwitchChanged
final Unit handleVendorLegIntSwitchChanged(Vendor vendor, DidomiToggle.State legIntState)
-
getVendorItem
final VendorItem.Vendor getVendorItem(Context context, Vendor vendor)
Get Vendor item
- Parameters:
context- as Contextvendor- as Vendor
-
getVendorItemList
final List<VendorItem> getVendorItemList(Context context)
Get Vendor list item
-
-
-
-