Lua

Other Lua files

extlib/iap_badger.lua and extlib/spinner.lua are used. If you want to change the spinner animation during downloading, please edit the spinner.lua.

model.lua - tmplt/components/store/

if model.URL = nil

local M = {}
--
local IAP             = require("components.store.IAP")
--
local YourHost  = "http://localhost:8080"
M.URL           = YourHost.."/bookShelf/"
M.backgroundImg = "bg.png"
M.bookShelfType  = {{bookShelfType}} --{pages = 0, embedded = 1, tmplt=2}

How it works

Shelf.psd is internnaly handled as page01. Let's show some codes that creates purchase buttons for Episode2 and Episode3 automatically.

table of pages

1 Shelf.psd table of contents, user to read an episode or to purchase an episode
2 ep01.psd Episode1
3 ep02_info.psd Episode2 Purchase Information
4 ep02_1 Episode2-1
5 ep02_2 Episode2-2
6 ep03 Episode3

page_IAP.lua - componens/page01/

this UI creation also works for page03 of ep02_info.psd that has “Episode02Icon” layer.

CMD.init

Inside CMD.init calls IAP.init to set up the product table from model.lua. For external codes, you may call the following function to check whether a product has been purchased or not.