Steps

  • the sample project in Bookshelf zip

    http://kwiksher.com/tutorials/Kwik4/BookShelf.zip

    • BookShelfPages project
    • copy the project to ~/Documents/Kwik
    • edit tmplt/components/store/model.lua for Host URL of yours

      local YourHost  = "http://localhost:4000/daily"
      M.URL           = YourHost.."/LibraryParent/"
      M.backgroundImg = "bg.png"
      
  • Book Shelf Tmplt project
    • Project Properties
      • Advanced > Book Shelf Type. Set it as pages
      • Monetization to set epsode{Num}
    • TOC page
      • Epsode{Num}Icon
      • downloadBtn
      • saveBtn
      • savingTxt
      • purchaseBtn
      • restoreBtn
      • infoTxt
      • Buy Product Action
    • Epsode{Num} INFO page
      • Epsode{Num}Icon
        • downloadBtn
        • saveBtn
        • savingTxt
        • purchaseBtn
        • infoTxt
        • hideOverlayBtn
        • Buy Product Action
    • Epsode{Num} pages
      • page properties
        • prelaoding off
        • In-App Unlock to associate the product ID of epssode{Num} of Monetizatin Tab
  • BookServer

    • copyright.txt
    • copy_pages.bat(Mac) or copy_pages.command
  • copy each assets.zip to book{Num} folder of the http server

  • corona simulator > show sand box folder, you need to clean the followig folders if you want to recover the inital state.

    • Application Support
    • Documents
    • TemporaryFiles
  • Before device build, set the valid product IDs from apple, google or amazon.

Kwik pubishes it to build4/components/store/model.lua

M.debug     = false

M.epsodes = {
            Epsode02  ={name = "Epsode02", startPage = 4, dir = "assets/images/p4", numOfPages = 2, info = "3"},
            Epsode03  ={name = "Epsode03", startPage = 6, dir = "assets/images/p6", numOfPages = 1, info = ""},
    }
--
M.catalogue = {
    products = {
            Epsode02 = {
            productNames = { apple="com.kwiksher.bookshelf.epsode02", google="com.kwiksher.bookshelf.epsode02", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Epsode02") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Epsode02") end,
        },
            Epsode03 = {
            productNames = { apple="com.kwiksher.bookshelf.epsode03", google="com.kwiksher.bookshelf.epsode03", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Epsode03") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Epsode03") end,
        },
    },

Debug mode

When you test it with debug as true for IAP on corona simulator. You need to set the epsode names as dummies for the productNames. Don't use the official produtnames from apple, google or amaon. With offcial IDs, debug mode fails to return an epsode name and IAP not work correctly.

fo instance, Epsode02 and Epsode03 are set

M.debug     = true
...
...
M.catalogue = {
    products = {
            Epsode02 = {
            productNames = { apple="Epsode02", google="", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Epsode02") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Epsode02") end,
        },
            Epsode03 = {
            productNames = { apple="Epsode03", google="", amazon=""},
            productType  = "non-consumable",
            onPurchase   = function() IAP.setInventoryValue("unlock_Epsode03") end,
            onRefund     = function() IAP.removeFromInventory("unlock_Epsode03") end,
        },
    },

build.settings

iOS

if you use http server instead of https, please set your domain in build.settings

NSExceptionDomains

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

Android

  • config.lua needs google license key
  • build.settings needs the permissions

To do so, please enable expansion file and set the license key from goggle. Then config.lua and build.settings will be configured when publishing with Kwik

project properties > Advanced Settings.

results matching ""

    No results matching ""