mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-30 19:06:59 -05:00
Some fixes for loading iPad gem products.
This commit is contained in:
parent
ed8285248f
commit
4fe6fd3020
1 changed files with 14 additions and 12 deletions
|
@ -6,7 +6,7 @@ module.exports = class BuyGemsModal extends ModalView
|
|||
template: template
|
||||
plain: true
|
||||
|
||||
products: [
|
||||
originalProducts: [
|
||||
{ price: '$4.99', gems: 5000, id: 'gems_5', i18n: 'buy_gems.few_gems' }
|
||||
{ price: '$9.99', gems: 11000, id: 'gems_10', i18n: 'buy_gems.pile_gems' }
|
||||
{ price: '$19.99', gems: 25000, id: 'gems_20', i18n: 'buy_gems.chest_gems' }
|
||||
|
@ -24,6 +24,8 @@ module.exports = class BuyGemsModal extends ModalView
|
|||
if application.isIPadApp
|
||||
@products = []
|
||||
Backbone.Mediator.publish 'buy-gems-modal:update-products'
|
||||
else
|
||||
@products = @originalProducts
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
@ -33,11 +35,11 @@ module.exports = class BuyGemsModal extends ModalView
|
|||
onIPadProducts: (e) ->
|
||||
newProducts = []
|
||||
for iapProduct in e.products
|
||||
localProduct = _.find @products, { id: iapProduct.id }
|
||||
localProduct = _.find @originalProducts, { id: iapProduct.id }
|
||||
continue unless localProduct
|
||||
localProduct.price = iapProduct.price
|
||||
newProducts.push localProduct
|
||||
@products = newProducts
|
||||
@products = _.sortBy newProducts, 'gems'
|
||||
@render()
|
||||
|
||||
onClickProductButton: (e) ->
|
||||
|
|
Loading…
Reference in a new issue