Skip to content

Commit

Permalink
[plugin] More work on ADS and IAB
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed Dec 11, 2016
1 parent 70234ae commit c6919f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
12 changes: 12 additions & 0 deletions plugins/ads/ads.gplugin
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@
<set key="local.adsfwd" value="app/src/main/java/com/giderosmobile/android/plugins/ads/frameworks"/>
<set key="local.adsfws" value="[[[sys.pluginDir]]]/bin/Android/src/com/giderosmobile/android/plugins/ads/frameworks"/>
<mkdir>[[[local.adsfwd]]]</mkdir>
<set key="local.adsReqGms" value="0"/>
<if condition="[[[plugin.adsFwApplovin]]]">
<set key="local.adsReqGms" value="1"/>
</if>
<if condition="[[[plugin.adsFwChartboost]]]">
<set key="local.adsReqGms" value="1"/>
</if>
<if condition="[[[plugin.adsFwAdmob]]]">
<set key="local.adsReqGms" value="1"/>
</if>
<if condition="[[[local.adsReqGms]]]">
<template name="GMS" path="[[[sys.pluginDir]]]/bin/Android/res" dest="app/src/main/res/">
<replacelist wildcards="ids.xml">
<replace orig="561448401579" by="[[[plugin.gmsAppId]]]"/>
Expand All @@ -59,6 +70,7 @@
</append>
</replacelist>
</template>
</if>
<if condition="[[[plugin.adsFwUnity]]]">
<template name="Unity Ads" path="[[[local.adsfws]]]" dest="[[[local.adsfwd]]]" include="AdsUnity.java" />
<set key="local.adsAarVer" value="2.0.5" />
Expand Down
7 changes: 5 additions & 2 deletions plugins/iab/source/Android/jni/iabbinder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#define abs_index(L, i) ((i) > 0 || (i) <= LUA_REGISTRYINDEX ? (i) : lua_gettop(L) + (i) + 1)
#endif

static lua_State *L = NULL;

static void luaL_newweaktable(lua_State *L, const char *mode)
{
lua_newtable(L); // create table for instance list
Expand Down Expand Up @@ -89,7 +91,7 @@ static char keyWeak = ' ';
class IAB : public GEventDispatcherProxy
{
public:
IAB(lua_State *L, const char *iab) : L(L)
IAB(lua_State *L, const char *iab)
{
iab_ = strdup(iab);
giab_initialize(iab);
Expand Down Expand Up @@ -278,7 +280,6 @@ class IAB : public GEventDispatcherProxy
}

private:
lua_State *L;
const char* iab_;
};

Expand Down Expand Up @@ -479,6 +480,7 @@ static int loader(lua_State *L)

static void g_initializePlugin(lua_State *L)
{
::L = L;
lua_getglobal(L, "package");
lua_getfield(L, -1, "preload");

Expand All @@ -491,6 +493,7 @@ static void g_initializePlugin(lua_State *L)

static void g_deinitializePlugin(lua_State *L)
{
::L = NULL;
giab_cleanup();
}

Expand Down

0 comments on commit c6919f3

Please sign in to comment.