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
|
template: template
|
||||||
plain: true
|
plain: true
|
||||||
|
|
||||||
products: [
|
originalProducts: [
|
||||||
{ price: '$4.99', gems: 5000, id: 'gems_5', i18n: 'buy_gems.few_gems' }
|
{ 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: '$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' }
|
{ 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
|
if application.isIPadApp
|
||||||
@products = []
|
@products = []
|
||||||
Backbone.Mediator.publish 'buy-gems-modal:update-products'
|
Backbone.Mediator.publish 'buy-gems-modal:update-products'
|
||||||
|
else
|
||||||
|
@products = @originalProducts
|
||||||
|
|
||||||
getRenderData: ->
|
getRenderData: ->
|
||||||
c = super()
|
c = super()
|
||||||
|
@ -33,11 +35,11 @@ module.exports = class BuyGemsModal extends ModalView
|
||||||
onIPadProducts: (e) ->
|
onIPadProducts: (e) ->
|
||||||
newProducts = []
|
newProducts = []
|
||||||
for iapProduct in e.products
|
for iapProduct in e.products
|
||||||
localProduct = _.find @products, { id: iapProduct.id }
|
localProduct = _.find @originalProducts, { id: iapProduct.id }
|
||||||
continue unless localProduct
|
continue unless localProduct
|
||||||
localProduct.price = iapProduct.price
|
localProduct.price = iapProduct.price
|
||||||
newProducts.push localProduct
|
newProducts.push localProduct
|
||||||
@products = newProducts
|
@products = _.sortBy newProducts, 'gems'
|
||||||
@render()
|
@render()
|
||||||
|
|
||||||
onClickProductButton: (e) ->
|
onClickProductButton: (e) ->
|
||||||
|
|
Reference in a new issue