public class VendorsViewModel
extends androidx.lifecycle.ViewModel
| Modifier and Type | Field and Description |
|---|---|
protected ConfigurationRepository |
configurationRepository |
protected io.didomi.sdk.resources.LanguagesHelper |
languagesHelper |
protected androidx.lifecycle.MutableLiveData<Vendor> |
selectedVendor |
protected VendorRepository |
vendorRepository |
protected io.didomi.sdk.vendors.VendorsInfoProvider |
vendorsInfoProvider |
| Constructor and Description |
|---|
VendorsViewModel(ConfigurationRepository configurationRepository,
EventsRepository eventsRepository,
VendorRepository vendorRepository,
io.didomi.sdk.resources.LanguagesHelper languagesHelper,
io.didomi.sdk.resources.ResourcesHelper resourcesHelper) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
allVendorsDisabled()
Method used to check if all vendors are disabled.
|
boolean |
allVendorsEnabled()
Method used to check if all vendors are enabled.
|
void |
disableVendor(Vendor vendor)
Method used to remove a vendor from the enabled vendors array.
|
void |
disableVendorLegInt(Vendor vendor) |
void |
enableVendor(Vendor vendor)
Method used to add a vendor to the enable vendors.
|
void |
enableVendorLegInt(Vendor vendor) |
java.lang.String |
getAdditionalDataProcessingText(Vendor vendor)
Get additional data processing description text for a vendor
|
java.lang.String |
getAdditionalDataProcessingTitle()
Get the title of the Additional data processing section
|
java.util.List<Vendor> |
getAllRequiredVendors()
Getter method for requiredVendors.
|
java.lang.String |
getAllVendorsText()
Method used to get the translated "All vendors/partners...
|
java.lang.String |
getAppTitle()
Generate the text to display as app title.
|
boolean |
getCanCloseWhenConsentIsMissing()
Get the canCloseWhenConsentIsMissing flag.
|
java.lang.String[] |
getConsentDataProcessingDescription(Vendor vendor)
Get the description of the consent based data processing for a specific vendor
|
java.lang.String |
getConsentDataProcessingTitle() |
protected java.util.List<Purpose> |
getConsentPurposes(Vendor vendor) |
java.lang.String |
getCookieDisclaimer(Vendor vendor) |
java.lang.String |
getCookieSectionTitle() |
java.util.Set<Vendor> |
getDisabledVendorsConsent()
Getter method for enabledVendors.
|
java.util.Set<Vendor> |
getDisabledVendorsLegInt() |
java.util.Set<Vendor> |
getEnabledVendorsConsent()
Getter method for enabledVendors.
|
java.util.Set<Vendor> |
getEnabledVendorsLegInt() |
java.lang.String |
getEssentialPurposesListText(Vendor vendor)
Method used to get the essential purposes list formatted with bullets.
|
java.lang.String |
getEssentialPurposesTitle()
Get the title of the essential purposes section (Required data processing)
|
android.graphics.drawable.GradientDrawable |
getHighlightBackground() |
int |
getHighlightTextColor() |
boolean |
getIsLinkColorSet() |
protected java.util.List<Purpose> |
getLegIntPurposes(Vendor vendor) |
java.lang.String[] |
getLegitimateInterestDataProcessingDescription(Vendor vendor)
Get the description of the legitimate interest based data processing for a specific vendor
|
java.lang.String |
getLegitimateInterestDataProcessingTitle() |
int |
getLinkColor() |
java.lang.String |
getPrivacyPolicyDisclaimer(Vendor vendor)
Get the translated label for the vendor's privacy policy disclaimer
|
protected Purpose |
getPurpose(java.lang.String purposeId)
Method used to get a purpose based on its id.
|
java.lang.String |
getSaveButtonLabel()
Method used to get the translated label for the save button.
|
androidx.lifecycle.MutableLiveData<Vendor> |
getSelectedVendor() |
androidx.lifecycle.MutableLiveData<java.lang.Integer> |
getSelectedVendorConsentState() |
androidx.lifecycle.MutableLiveData<java.lang.Boolean> |
getSelectedVendorDeviceStorageDisclosuresLoaded()
Get MutableLiveData describing if device storage disclosures list is loaded
|
androidx.lifecycle.MutableLiveData<java.lang.Integer> |
getSelectedVendorLegIntState() |
android.text.Spanned |
getSubText()
Method used to get the HTML text for the vendors view sub text.
|
android.text.Spanned |
getText()
Method used to get the HTML text for the vendors view top text.
|
AppConfiguration.Theme |
getTheme()
Method used to get the theme.
|
int |
getThemeColor() |
java.lang.String |
getTitle()
Get the title of the vendors screen.
|
java.lang.CharSequence |
getVendorNameWithTag(android.content.Context context,
Vendor vendor,
android.graphics.Bitmap iabTagMargin,
android.graphics.Bitmap iabTagBitmap)
Get the vendor name with the "IAB TCF" tag if needed
|
int |
getVendorSwitchStatus(Vendor vendor)
Get the status of a vendor
|
void |
handleVendorConsentSwitchChanged(Vendor vendor,
int consentStatus) |
void |
handleVendorLegIntSwitchChanged(Vendor vendor,
int legIntState) |
void |
handleVendorSwitchChanged(Vendor vendor,
int state)
Method used to change the status of a vendor
|
boolean |
hasLoadedVendorDeviceStorageDisclosures()
Whether device storage disclosures list is currently loaded
|
void |
initializeSelectedVendorStates(Vendor selectedVendor) |
void |
initVendorsIfNeeded(java.util.Set<Vendor> enabledVendors,
java.util.Set<Vendor> disabledVendors,
java.util.Set<Vendor> enabledLegIntVendors,
java.util.Set<Vendor> disabledLegIntVendors)
This method must be called after creating the VendorViewModel.
|
boolean |
isInitializingVendorData() |
void |
loadVendorDeviceStorageDisclosures(Vendor vendor)
Starts loading asynchronously device storage disclosures list for the specified vendor.
|
void |
onBulkVendorSwitchWasToggled(int state) |
void |
onGlobalVendorSwitchChanged(Vendor vendor,
int state) |
void |
onVendorSwitchWasToggled() |
void |
setDisabledVendorsConsent(java.util.Set<Vendor> disabledVendors)
Setter method for disabledVendors, removing the vendor from enabledVendors if it was there.
|
void |
setDisabledVendorsLegInt(java.util.Set<Vendor> disabledLegIntVendors) |
void |
setEnabledVendorsConsent(java.util.Set<Vendor> enabledVendors)
Setter method for enabledVendors, removing the vendor from disabledVendors if it was there.
|
void |
setEnabledVendorsLegInt(java.util.Set<Vendor> enabledLegIntVendors) |
void |
setSelectedVendor(Vendor vendor) |
void |
setSelectedVendorConsentState(java.lang.Integer selectedVendorConsentState) |
void |
setSelectedVendorLegIntState(java.lang.Integer selectedVendorLegIntState) |
boolean |
shouldDisplayCookieSection(Vendor vendor) |
boolean |
shouldDisplayDeviceStorageDisclosuresList(Vendor vendor)
Whether the specified vendor should have a Device storage section
|
boolean |
shouldHandleAllVendorsState()
Verify if any vendor state can be changed by the user
|
boolean |
shouldHandleConsentState(Vendor vendor)
Verify if consent state can be changed by the user
|
boolean |
shouldHandleLegitimateInterestState(Vendor vendor)
Verify if vendor legitimate interest state can be changed by the user
|
boolean |
shouldHandleState(Vendor vendor)
Verify if vendor state can be changed by the user
|
boolean |
shouldHideDidomiLogo()
Method used to return the shouldHideDidomiLogo flag from the app object.
|
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
|
boolean |
shouldShowDismissButton(boolean isUserConsentStatusNotPartial)
Method used to check if the close button should be shown to the user.
|
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
|
boolean |
shouldUseV2()
Verify if we are using tcf v2
|
void |
triggerEvent(Event event)
Method used to trigger an event through the eventsRepository.
|
void |
unsetVendor(Vendor vendor)
Method used to unset a vendor to the enable vendors.
|
void |
updateAllVendors(int status)
Method used to handle the case when the user select or unselect all vendors.
|
boolean |
vendorIsEnabled(Vendor vendor)
Method used to check if a vendor is enabled.
|
protected ConfigurationRepository configurationRepository
protected VendorRepository vendorRepository
protected io.didomi.sdk.resources.LanguagesHelper languagesHelper
protected io.didomi.sdk.vendors.VendorsInfoProvider vendorsInfoProvider
protected androidx.lifecycle.MutableLiveData<Vendor> selectedVendor
public VendorsViewModel(ConfigurationRepository configurationRepository, EventsRepository eventsRepository, VendorRepository vendorRepository, io.didomi.sdk.resources.LanguagesHelper languagesHelper, io.didomi.sdk.resources.ResourcesHelper resourcesHelper)
public androidx.lifecycle.MutableLiveData<java.lang.Integer> getSelectedVendorConsentState()
public void setSelectedVendorConsentState(java.lang.Integer selectedVendorConsentState)
public void initializeSelectedVendorStates(Vendor selectedVendor)
public boolean isInitializingVendorData()
public androidx.lifecycle.MutableLiveData<java.lang.Integer> getSelectedVendorLegIntState()
public void setSelectedVendorLegIntState(java.lang.Integer selectedVendorLegIntState)
public androidx.lifecycle.MutableLiveData<Vendor> getSelectedVendor()
public void setSelectedVendor(Vendor vendor)
public boolean shouldDisplayDeviceStorageDisclosuresList(Vendor vendor)
vendor - vendor to checkpublic androidx.lifecycle.MutableLiveData<java.lang.Boolean> getSelectedVendorDeviceStorageDisclosuresLoaded()
public boolean hasLoadedVendorDeviceStorageDisclosures()
public void loadVendorDeviceStorageDisclosures(Vendor vendor)
getSelectedVendorDeviceStorageDisclosuresLoaded() to be notified when loading is complete.vendor - public void initVendorsIfNeeded(java.util.Set<Vendor> enabledVendors, java.util.Set<Vendor> disabledVendors, java.util.Set<Vendor> enabledLegIntVendors, java.util.Set<Vendor> disabledLegIntVendors)
enabledVendors - contains a list of vendors to enable if VendorsViewModel hasn't been already init.disabledVendors - contains a list of vendors to disable if VendorsViewModel hasn't been already init.enabledLegIntVendors - contains a list of vendors for which Legitimate interest should be enableddisabledLegIntVendors - contains a list of vendors for which Legitimate interest should be disabledpublic android.graphics.drawable.GradientDrawable getHighlightBackground()
public int getHighlightTextColor()
public int getThemeColor()
public int getLinkColor()
public boolean getIsLinkColorSet()
public android.text.Spanned getText()
public android.text.Spanned getSubText()
public AppConfiguration.Theme getTheme()
public void triggerEvent(Event event)
event - event to be triggered.protected Purpose getPurpose(java.lang.String purposeId)
purposeId - purpose id to find the purpose.public java.lang.String getAllVendorsText()
public java.lang.CharSequence getVendorNameWithTag(android.content.Context context,
Vendor vendor,
android.graphics.Bitmap iabTagMargin,
android.graphics.Bitmap iabTagBitmap)
context - activity or application contextvendor - the speciifed vendoriabTagMargin - bitmap representing the margin between text and IAB TCF tagiabTagBitmap - bitmap of the IAB TCF tag@Nullable public java.lang.String[] getConsentDataProcessingDescription(Vendor vendor)
vendor - vendor from which we want to get the description.public java.lang.String getConsentDataProcessingTitle()
public boolean shouldShowAdditionalDataProcessing(Vendor vendor)
public java.lang.String getAdditionalDataProcessingText(Vendor vendor)
vendor - public java.lang.String getAdditionalDataProcessingTitle()
public boolean shouldShowEssentialPurposes(Vendor vendor)
public java.lang.String getEssentialPurposesTitle()
public java.lang.String getEssentialPurposesListText(Vendor vendor)
vendor - the vendor to display@Nullable public java.lang.String[] getLegitimateInterestDataProcessingDescription(Vendor vendor)
vendor - vendor from which we want to get the description.public java.lang.String getLegitimateInterestDataProcessingTitle()
public java.lang.String getPrivacyPolicyDisclaimer(Vendor vendor)
vendor - public boolean shouldDisplayCookieSection(Vendor vendor)
public java.lang.String getCookieSectionTitle()
public java.lang.String getCookieDisclaimer(Vendor vendor)
public java.lang.String getAppTitle()
public java.lang.String getTitle()
public java.lang.String getSaveButtonLabel()
public void setEnabledVendorsConsent(java.util.Set<Vendor> enabledVendors)
enabledVendors - public java.util.Set<Vendor> getEnabledVendorsConsent()
public void setDisabledVendorsConsent(java.util.Set<Vendor> disabledVendors)
disabledVendors - public void setEnabledVendorsLegInt(java.util.Set<Vendor> enabledLegIntVendors)
public void setDisabledVendorsLegInt(java.util.Set<Vendor> disabledLegIntVendors)
public java.util.Set<Vendor> getDisabledVendorsConsent()
public java.util.Set<Vendor> getEnabledVendorsLegInt()
public java.util.Set<Vendor> getDisabledVendorsLegInt()
public void updateAllVendors(int status)
status - public void disableVendor(Vendor vendor)
vendor - public boolean allVendorsEnabled()
public boolean allVendorsDisabled()
public boolean vendorIsEnabled(Vendor vendor)
vendor - used to check if it's enabled.public void enableVendor(Vendor vendor)
vendor - public void enableVendorLegInt(Vendor vendor)
public void disableVendorLegInt(Vendor vendor)
public void unsetVendor(Vendor vendor)
vendor - public java.util.List<Vendor> getAllRequiredVendors()
public boolean shouldHideDidomiLogo()
public void handleVendorSwitchChanged(Vendor vendor, int state)
vendor - affected vendorstate - new status, option available at RMAbstractSwitch.public boolean shouldHandleState(Vendor vendor)
vendor - public boolean shouldHandleAllVendorsState()
public int getVendorSwitchStatus(Vendor vendor)
vendor - affected vendorpublic boolean shouldHandleLegitimateInterestState(Vendor vendor)
vendor - public boolean shouldHandleConsentState(Vendor vendor)
vendor - public boolean getCanCloseWhenConsentIsMissing()
public boolean shouldShowDismissButton(boolean isUserConsentStatusNotPartial)
public boolean shouldUseV2()
public void onBulkVendorSwitchWasToggled(int state)
public void onVendorSwitchWasToggled()
public void onGlobalVendorSwitchChanged(Vendor vendor, int state)
public void handleVendorConsentSwitchChanged(Vendor vendor, int consentStatus)
public void handleVendorLegIntSwitchChanged(Vendor vendor, int legIntState)