use of com.soomla.store.domain.virtualGoods.UpgradeVG 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