use of com.soomla.store.events.GoodUpgradeEvent in project android-store by soomla.
the class VirtualGoodsStorage method removeUpgrades.
/**
* Removes any upgrade associated with the given VirtualGood.
*
* @param goodItemId the virtual good to remove the upgrade from
* @param notify if true post event to bus
*/
public void removeUpgrades(String goodItemId, boolean notify) {
SoomlaUtils.LogDebug(mTag, "Removing upgrade information from virtual good: " + goodItemId);
String key = keyGoodUpgrade(goodItemId);
KeyValueStorage.deleteKeyValue(key);
if (notify) {
BusProvider.getInstance().post(new GoodUpgradeEvent(goodItemId, null));
}
}
use of com.soomla.store.events.GoodUpgradeEvent in project android-store by soomla.
the class VirtualGoodsStorage method assignCurrentUpgrade.
/**
* Assigns a specific upgrade to the given virtual good.
*
* @param goodItemId the VirtualGood to upgrade
* @param upgradeVGItemId the upgrade to assign
* @param notify if true post event to bus
*/
public void assignCurrentUpgrade(String goodItemId, String upgradeVGItemId, boolean notify) {
String upgradeItemId = getCurrentUpgrade(goodItemId);
if (!TextUtils.isEmpty(upgradeItemId)) {
try {
UpgradeVG upgrade = (UpgradeVG) StoreInfo.getVirtualItem(upgradeItemId);
if (upgrade != null && upgrade.getItemId().equals(upgradeVGItemId)) {
return;
}
} catch (VirtualItemNotFoundException ignored) {
}
}
SoomlaUtils.LogDebug(mTag, "Assigning upgrade " + upgradeVGItemId + " to virtual good: " + goodItemId);
String key = keyGoodUpgrade(goodItemId);
KeyValueStorage.setValue(key, upgradeVGItemId);
if (notify) {
BusProvider.getInstance().post(new GoodUpgradeEvent(goodItemId, upgradeVGItemId));
}
}
Aggregations