Merge branch 'ForReflection'

Conflicts:
	plugin/protocols/platform/ios/PluginUtilsIOS.mm
This commit is contained in:
zhangbin 2013-05-30 15:44:11 +08:00
commit ba6e952668
331 changed files with 3245 additions and 5076 deletions

View File

@ -1,96 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCX_ADS_ADMOB_H__
#define __CCX_ADS_ADMOB_H__
#include "ProtocolAds.h"
#include <map>
#include <string>
namespace cocos2d { namespace plugin {
class AdsAdmob : public ProtocolAds
{
PLUGIN_REGISTER_DECL(AdsAdmob)
public:
typedef enum {
kSizeBanner = 0,
kSizeIABMRect,
kSizeIABBanner,
kSizeIABLeaderboard,
} AdmobBannerSize;
/**
@brief plugin initialization
*/
virtual bool init();
/**
@brief config the application info
@param devInfo This parameter is the info of application, must contains:
AdmobID The publisher ID of admob.
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
virtual void configDeveloperInfo(TAdsDeveloperInfo devInfo);
/**
@brief show adview
@param type The adview type need to show.
@param sizeEnum The size of the banner view.
(only used when type is kBannerAd)
Use the enum number in AdmobBannerSize.
@param pos The position where the adview be shown.
(only used when type is kBannerAd)
*/
virtual void showAds(AdsType type, int sizeEnum = 0, AdsPos pos = kPosCenter);
/**
@brief Hide the adview
@param type The adview type need to hide.
*/
virtual void hideAds(AdsType type);
/**
@brief Set whether needs to output logs to console.
@param debug if true debug mode enabled, or debug mode disabled.
*/
virtual void setDebugMode(bool debug);
/**
@brief Add the test device ID
@param deviceID The device ID
*/
void addTestDevice(const char* deviceID);
virtual const char* getPluginVersion() { return "v0.1.01"; };
virtual const char* getSDKVersion();
virtual ~AdsAdmob();
};
}} // namespace cocos2d { namespace plugin {
#endif /* __CCX_ADS_ADMOB_H__ */

View File

@ -1,60 +0,0 @@
[admob]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = pluginx_admob
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = plugin
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include
clang_flags = -nostdinc -x c++
cocos_headers = -I%(pluginxdir)s/protocols/include -I%(pluginxdir)s/plugins/admob/include
cocos_flags = -DANDROID
cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to parse
headers = %(pluginxdir)s/plugins/admob/include/AdsAdmob.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = AdsAdmob
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[createPlugin]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = AdsAdmob
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes

View File

@ -1,81 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "AdsAdmob.h"
#include "PluginUtils.h"
namespace cocos2d { namespace plugin {
PLUGIN_REGISTER_IMPL(AdsAdmob)
AdsAdmob::~AdsAdmob()
{
}
bool AdsAdmob::init()
{
return PluginUtils::initJavaPlugin(this, "org.cocos2dx.plugin.AdsAdmob");
}
void AdsAdmob::configDeveloperInfo(TAdsDeveloperInfo appInfo)
{
ProtocolAds::configDeveloperInfo(appInfo);
}
void AdsAdmob::showAds(AdsType type, int sizeEnum, AdsPos pos)
{
ProtocolAds::showAds(type, sizeEnum, pos);
}
void AdsAdmob::hideAds(AdsType type)
{
ProtocolAds::hideAds(type);
}
const char* AdsAdmob::getSDKVersion()
{
return ProtocolAds::getSDKVersion();
}
void AdsAdmob::setDebugMode(bool debug)
{
ProtocolAds::setDebugMode(debug);
}
void AdsAdmob::addTestDevice(const char* deviceID)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "addTestDevice"
, "(Ljava/lang/String;)V"))
{
jstring strDeviceID = t.env->NewStringUTF(deviceID);
t.env->CallVoidMethod(pData->jobj, t.methodID, strDeviceID);
t.env->DeleteLocalRef(strDeviceID);
t.env->DeleteLocalRef(t.classID);
}
}
}} // namespace cocos2d { namespace plugin {

View File

@ -30,16 +30,4 @@
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>android</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/android</locationURI>
</link>
<link>
<name>include</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/include</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,20 +0,0 @@
# set params
PLUGIN_ANDROID_ROOT=$(cd "$(dirname "$0")"; pwd)
if [ ! "${PLUGIN_ROOT}" ]; then
PLUGIN_ROOT="$PLUGIN_ANDROID_ROOT"/../..
fi
# build
"$ANDROID_NDK_ROOT"/ndk-build -C "$PLUGIN_ANDROID_ROOT" \
NDK_MODULE_PATH="$PLUGIN_ROOT"
echo
if [ "0" != "$?" ]; then
echo "Build error occoured!!!"
exit 1
fi
echo
echo "Native build action success."
exit 0

View File

@ -1,29 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := PluginAdmobStatic
LOCAL_MODULE_FILENAME := libPluginAdmobStatic
LOCAL_SRC_FILES := \
$(addprefix ../../platform/android/, \
AdsAdmob.cpp \
) \
LOCAL_CFLAGS :=
LOCAL_EXPORT_CFLAGS :=
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_WHOLE_STATIC_LIBRARIES := PluginProtocolStatic
LOCAL_LDLIBS := -landroid
LOCAL_LDLIBS += -llog
include $(BUILD_STATIC_LIBRARY)
$(call import-module, protocols/proj.android/jni)

View File

@ -1,7 +0,0 @@
# it is needed for ndk-r5
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_MODULES := PluginAdmobStatic
APP_ABI :=armeabi
#APP_ABI :=x86
#APP_ABI :=mips mips-r2 mips-r2-sf armeabi

View File

@ -28,8 +28,6 @@ import java.util.Hashtable;
import java.util.Iterator;
import java.util.Set;
import org.cocos2dx.plugin.InterfaceAds.AdsAdapter;
import com.google.ads.*;
import com.google.ads.AdRequest.ErrorCode;
@ -38,7 +36,7 @@ import android.content.Context;
import android.util.Log;
import android.view.WindowManager;
public class AdsAdmob implements AdsAdapter {
public class AdsAdmob implements InterfaceAds {
private static final String LOG_TAG = "AdsAdmob";
private static Activity mContext = null;
@ -94,10 +92,10 @@ public class AdsAdmob implements AdsAdapter {
@Override
public void showAds(int adsType, int sizeEnum, int pos) {
switch (adsType) {
case InterfaceAds.ADS_TYPE_BANNER:
case AdsWrapper.ADS_TYPE_BANNER:
showBannerAd(sizeEnum, pos);
break;
case InterfaceAds.ADS_TYPE_FULL_SCREEN:
case AdsWrapper.ADS_TYPE_FULL_SCREEN:
LogD("Now not support full screen view in Admob");
break;
default:
@ -113,10 +111,10 @@ public class AdsAdmob implements AdsAdapter {
@Override
public void hideAds(int adsType) {
switch (adsType) {
case InterfaceAds.ADS_TYPE_BANNER:
case AdsWrapper.ADS_TYPE_BANNER:
hideBannerAd();
break;
case InterfaceAds.ADS_TYPE_FULL_SCREEN:
case AdsWrapper.ADS_TYPE_FULL_SCREEN:
break;
default:
break;
@ -178,7 +176,7 @@ public class AdsAdmob implements AdsAdapter {
if (null == mWm) {
mWm = (WindowManager) mContext.getSystemService("window");
}
InterfaceAds.addAdView(mWm, adView, curPos);
AdsWrapper.addAdView(mWm, adView, curPos);
}
});
}
@ -211,20 +209,20 @@ public class AdsAdmob implements AdsAdapter {
@Override
public void onDismissScreen(Ad arg0) {
LogD("onDismissScreen invoked");
InterfaceAds.onAdsResult(mAdapter, InterfaceAds.RESULT_CODE_FullScreenViewDismissed, "Full screen ads view dismissed!");
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewDismissed, "Full screen ads view dismissed!");
}
@Override
public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
int errorNo = InterfaceAds.RESULT_CODE_UnknownError;
int errorNo = AdsWrapper.RESULT_CODE_UnknownError;
String errorMsg = "Unknow error";
switch (arg1) {
case NETWORK_ERROR:
errorNo = InterfaceAds.RESULT_CODE_NetworkError;
errorNo = AdsWrapper.RESULT_CODE_NetworkError;
errorMsg = "Network error";
break;
case INVALID_REQUEST:
errorNo = InterfaceAds.RESULT_CODE_NetworkError;
errorNo = AdsWrapper.RESULT_CODE_NetworkError;
errorMsg = "The ad request is invalid";
break;
case NO_FILL:
@ -234,7 +232,7 @@ public class AdsAdmob implements AdsAdapter {
break;
}
LogD("failed to receive ad : " + errorNo + " , " + errorMsg);
InterfaceAds.onAdsResult(mAdapter, errorNo, errorMsg);
AdsWrapper.onAdsResult(mAdapter, errorNo, errorMsg);
}
@Override
@ -245,13 +243,18 @@ public class AdsAdmob implements AdsAdapter {
@Override
public void onPresentScreen(Ad arg0) {
LogD("onPresentScreen invoked");
InterfaceAds.onAdsResult(mAdapter, InterfaceAds.RESULT_CODE_FullScreenViewShown, "Full screen ads view shown!");
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_FullScreenViewShown, "Full screen ads view shown!");
}
@Override
public void onReceiveAd(Ad arg0) {
LogD("onReceiveAd invoked");
InterfaceAds.onAdsResult(mAdapter, InterfaceAds.RESULT_CODE_AdsReceived, "Ads request received success!");
AdsWrapper.onAdsResult(mAdapter, AdsWrapper.RESULT_CODE_AdsReceived, "Ads request received success!");
}
}
@Override
public String getPluginVersion() {
return "0.2.0";
}
}

View File

@ -1,81 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCX_IAP_ALIPAY_H__
#define __CCX_IAP_ALIPAY_H__
#include "ProtocolIAP.h"
#include <map>
#include <string>
namespace cocos2d { namespace plugin {
class IAPAlipay : public ProtocolIAP
{
PLUGIN_REGISTER_DECL(IAPAlipay)
public:
/**
@brief plugin initialization
*/
virtual bool init();
/**
@brief config the developer info
@param devInfo This parameter is the info of developer, must contains key:
AlipayPartner The partner id of alipay account
AlipaySeller The seller id of alipay account
AlipayRsaPrivate The RSA private key of alipay account
AlipayPublic The public key of alipay account
AlipayNotifyUrl The notify url of developer (must not be empty)
AlipayPluginName The apk file name of Alipay (must not be empty)
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
virtual void configDeveloperInfo(TIAPDeveloperInfo devInfo);
/**
@brief pay for product
@param info The info of product, must contains key:
productName The name of product
productPrice The price of product(must can be parse to float)
productDesc The description of product
@warning For different plugin, the parameter should have other keys to pay.
Look at the manual of plugins.
*/
virtual void payForProduct(TProductInfo info);
/**
@brief Set whether needs to output logs to console.
@param debug if true debug mode enabled, or debug mode disabled.
*/
virtual void setDebugMode(bool debug);
virtual const char* getPluginVersion() { return "v0.1.01"; };
virtual const char* getSDKVersion();
virtual ~IAPAlipay();
};
}} // namespace cocos2d { namespace plugin {
#endif /* __CCX_IAP_ALIPAY_H__ */

View File

@ -1,60 +0,0 @@
[alipay]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = pluginx_alipay
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = plugin
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include
clang_flags = -nostdinc -x c++
cocos_headers = -I%(pluginxdir)s/protocols/include -I%(pluginxdir)s/plugins/alipay/include
cocos_flags = -DANDROID
cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to parse
headers = %(pluginxdir)s/plugins/alipay/include/IAPAlipay.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = IAPAlipay
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[createPlugin]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = IAPAlipay
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes

View File

@ -1,84 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "IAPAlipay.h"
#include "PluginUtils.h"
namespace cocos2d { namespace plugin {
PLUGIN_REGISTER_IMPL(IAPAlipay)
IAPAlipay::~IAPAlipay()
{
}
/**
@brief plugin initialization
*/
bool IAPAlipay::init()
{
return PluginUtils::initJavaPlugin(this, "org.cocos2dx.plugin.IAPAlipay");
}
/**
@brief config the developer info
@param devInfo This parameter is the info of developer, must contains key:
AlipayPartner The partner id of alipay account
AlipaySeller The seller id of alipay account
AlipayRsaPrivate The RSA private key of alipay account
AlipayPublic The public key of alipay account
AlipayNotifyUrl The notify url of developer (must not be empty)
AlipayPluginName The apk file name of Alipay (must not be empty)
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
void IAPAlipay::configDeveloperInfo(TIAPDeveloperInfo devInfo)
{
ProtocolIAP::configDeveloperInfo(devInfo);
}
/**
@brief pay for product
@param info The info of product, must contains key:
productName The name of product
productPrice The price of product(must can be parse to float)
productDesc The description of product
@warning For different plugin, the parameter should have other keys to pay.
Look at the manual of plugins.
*/
void IAPAlipay::payForProduct(TProductInfo info)
{
ProtocolIAP::payForProduct(info);
}
const char* IAPAlipay::getSDKVersion()
{
return ProtocolIAP::getSDKVersion();
}
void IAPAlipay::setDebugMode(bool debug)
{
ProtocolIAP::setDebugMode(debug);
}
}} // namespace cocos2d { namespace plugin {

View File

@ -30,16 +30,4 @@
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>android</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/android</locationURI>
</link>
<link>
<name>include</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/include</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,20 +0,0 @@
# set params
PLUGIN_ANDROID_ROOT=$(cd "$(dirname "$0")"; pwd)
if [ ! "${PLUGIN_ROOT}" ]; then
PLUGIN_ROOT="$PLUGIN_ANDROID_ROOT"/../..
fi
# build
"$ANDROID_NDK_ROOT"/ndk-build -C "$PLUGIN_ANDROID_ROOT" \
NDK_MODULE_PATH="$PLUGIN_ROOT"
echo
if [ "0" != "$?" ]; then
echo "Build error occoured!!!"
exit 1
fi
echo
echo "Native build action success."
exit 0

View File

@ -1,29 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := PluginAlipayStatic
LOCAL_MODULE_FILENAME := libPluginAlipayStatic
LOCAL_SRC_FILES := \
$(addprefix ../../platform/android/, \
IAPAlipay.cpp \
) \
LOCAL_CFLAGS :=
LOCAL_EXPORT_CFLAGS :=
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_WHOLE_STATIC_LIBRARIES := PluginProtocolStatic
LOCAL_LDLIBS := -landroid
LOCAL_LDLIBS += -llog
include $(BUILD_STATIC_LIBRARY)
$(call import-module, protocols/proj.android/jni)

View File

@ -1,7 +0,0 @@
# it is needed for ndk-r5
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_MODULES := PluginAlipayStatic
APP_ABI :=armeabi
#APP_ABI :=x86
#APP_ABI :=mips mips-r2 mips-r2-sf armeabi

View File

@ -28,8 +28,6 @@ import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Hashtable;
import org.cocos2dx.plugin.InterfaceIAP.IAPAdapter;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Context;
@ -41,7 +39,7 @@ import android.os.Message;
import android.util.Log;
import android.view.KeyEvent;
public class IAPAlipay implements IAPAdapter {
public class IAPAlipay implements InterfaceIAP {
private static final String LOG_TAG = "IAPAlipay";
private static Activity mContext = null;
@ -97,7 +95,7 @@ public class IAPAlipay implements IAPAdapter {
public void payForProduct(Hashtable<String, String> info) {
LogD("payForProduct invoked " + info.toString());
if (! networkReachable()) {
payResult(InterfaceIAP.PAYRESULT_FAIL, "网络不可用");
payResult(IAPWrapper.PAYRESULT_FAIL, "网络不可用");
return;
}
@ -108,7 +106,7 @@ public class IAPAlipay implements IAPAdapter {
MobileSecurePayHelper mspHelper = new MobileSecurePayHelper(mContext);
boolean bInstalled = mspHelper.detectMobile_sp();
if (! bInstalled) {
payResult(InterfaceIAP.PAYRESULT_FAIL, "未安装支付宝插件");
payResult(IAPWrapper.PAYRESULT_FAIL, "未安装支付宝插件");
return;
}
@ -138,12 +136,12 @@ public class IAPAlipay implements IAPAdapter {
closeProgress();
mProgress = BaseHelper.showProgress(mContext, null, "正在支付", false, true);
} else {
payResult(InterfaceIAP.PAYRESULT_FAIL, "支付失败");
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
return;
}
} catch (Exception ex) {
LogE("Remote call failed", ex);
payResult(InterfaceIAP.PAYRESULT_FAIL, "remote call failed");
payResult(IAPWrapper.PAYRESULT_FAIL, "remote call failed");
return;
}
}
@ -200,21 +198,21 @@ public class IAPAlipay implements IAPAdapter {
int retVal = resultChecker.checkSign();
// 返回验签结果以及交易状态
if (retVal == ResultChecker.RESULT_CHECK_SIGN_FAILED) {
payResult(InterfaceIAP.PAYRESULT_FAIL, "签名验证失败");
payResult(IAPWrapper.PAYRESULT_FAIL, "签名验证失败");
} else if (retVal == ResultChecker.RESULT_CHECK_SIGN_SUCCEED && resultChecker.isPayOk()) {
payResult(InterfaceIAP.PAYRESULT_SUCCESS, "支付成功");
payResult(IAPWrapper.PAYRESULT_SUCCESS, "支付成功");
} else {
payResult(InterfaceIAP.PAYRESULT_FAIL, "支付失败");
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
}
} catch (Exception e) {
e.printStackTrace();
payResult(InterfaceIAP.PAYRESULT_FAIL, "结果解析失败");
payResult(IAPWrapper.PAYRESULT_FAIL, "结果解析失败");
}
}
break;
default:
mAdapter.closeProgress();
payResult(InterfaceIAP.PAYRESULT_FAIL, "支付失败");
payResult(IAPWrapper.PAYRESULT_FAIL, "支付失败");
break;
}
@ -335,7 +333,12 @@ public class IAPAlipay implements IAPAdapter {
}
private static void payResult(int ret, String msg) {
InterfaceIAP.onPayResult(mAdapter, ret, msg);
IAPWrapper.onPayResult(mAdapter, ret, msg);
LogD("Alipay result : " + ret + " msg : " + msg);
}
@Override
public String getPluginVersion() {
return "0.2.0";
}
}

View File

@ -1,170 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCX_ANALYTICS_FLURRY_H__
#define __CCX_ANALYTICS_FLURRY_H__
#include "ProtocolAnalytics.h"
namespace cocos2d { namespace plugin {
class AnalyticsFlurry : public ProtocolAnalytics
{
PLUGIN_REGISTER_DECL(AnalyticsFlurry)
public:
enum Gender{
FEMALE = 0,
MALE = 1
};
virtual ~AnalyticsFlurry();
/**
@par override interface of base class
*/
/**
@brief plugin initialization
*/
virtual bool init();
/**
@brief Start a new session.
@param appKey The identity of the application.
*/
virtual void startSession(const char* appKey);
/**
@brief Stop a session.
@warning This interface only worked on android
*/
virtual void stopSession();
/**
@brief Set whether needs to output logs to console.
@param debug if true debug mode enabled, or debug mode disabled.
@note It must be invoked before calling startSession.
*/
virtual void setDebugMode(bool debug);
/**
@brief Set the timeout for expiring a session.
@param millis In milliseconds as the unit of time.
@note It must be invoked before calling startSession.
*/
virtual void setSessionContinueMillis(long millis);
/**
@brief log an error
@param errorId The identity of error
@param message Extern message for the error
*/
virtual void logError(const char* errorId, const char* message);
/**
@brief log an event.
@param eventId The identity of event
@param paramMap Extern parameters of the event, use NULL if not needed.
*/
virtual void logEvent(const char* eventId, LogEventParamMap* paramMap = NULL);
/**
@brief Track an event begin.
@param eventId The identity of event
*/
virtual void logTimedEventBegin(const char* eventId);
/**
@brief Track an event end.
@param eventId The identity of event
*/
virtual void logTimedEventEnd(const char* eventId);
/**
@brief Whether to catch uncaught exceptions to server.
@warning This interface only worked on android.
*/
virtual void setCaptureUncaughtException(bool enabled);
virtual const char* getPluginVersion() { return "v0.1.01"; };
virtual const char* getSDKVersion();
/**
@par Unique interface of Flurry
*/
/**
@brief Sets the age of the user at the time of this session.
*/
void setAge(int age);
/**
@brief Sets the gender of the user.
*/
void setGender(Gender gender);
/**
@brief Sets the userId for this session.
*/
void setUserId(const char* userId);
/**
@brief Log a page view.
*/
void logPageView();
/**
@brief Set the version name of the app.
@note It must be invoked before calling startSession.
*/
void setVersionName(const char* versionName);
/**
@par interface for android
*/
/**
@brief Enable the use of HTTPS communications.
@warning This interface only worked on android
*/
void setUseHttps(bool useHttps);
/** @brief Enable or disable detailed location reporting.
* @note It must be invoked before calling startSession.
* @warning This interface only worked on android
*/
void setReportLocation(bool enabled);
/**
@par interface for ios
*/
/**
@brief Log a timed event with parameters.
@warning The paramMap is only worked on ios.
On android, paramMap is ignored.
*/
void logTimedEventBegin(const char* eventId, LogEventParamMap* paramMap);
void logTimedEventEnd(const char* eventId, LogEventParamMap* paramMap);
};
}} // namespace cocos2d { namespace plugin {
#endif /* __CCX_ANALYTICS_FLURRY_H__ */

View File

@ -1,59 +0,0 @@
[flurry]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = pluginx_flurry
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = plugin
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include
clang_flags = -nostdinc -x c++
cocos_headers = -I%(pluginxdir)s/protocols/include -I%(pluginxdir)s/plugins/flurry/include
cocos_flags = -DANDROID
cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to parse
headers = %(pluginxdir)s/plugins/flurry/include/AnalyticsFlurry.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = AnalyticsFlurry
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[createPlugin]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = AnalyticsFlurry
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes

View File

@ -1,246 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "AnalyticsFlurry.h"
#include "PluginJniHelper.h"
#include <android/log.h>
#include "PluginUtils.h"
#include "PluginJavaData.h"
#if 1
#define LOG_TAG "AnalyticsFlurry"
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
#else
#define LOGD(...)
#endif
namespace cocos2d { namespace plugin {
PLUGIN_REGISTER_IMPL(AnalyticsFlurry)
AnalyticsFlurry::~AnalyticsFlurry()
{
LOGD("AnalyticsFlurry destructor");
}
bool AnalyticsFlurry::init()
{
return PluginUtils::initJavaPlugin(this, "org.cocos2dx.plugin.AnalyticsFlurry");
}
void AnalyticsFlurry::setReportLocation(bool enabled)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setReportLocation"
, "(Z)V"))
{
t.env->CallVoidMethod(pData->jobj, t.methodID, enabled);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::logPageView()
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "logPageView"
, "()V"))
{
t.env->CallVoidMethod(pData->jobj, t.methodID);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::setVersionName(const char* versionName)
{
return_if_fails(versionName != NULL && strlen(versionName) > 0);
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setVersionName"
, "(Ljava/lang/String;)V"))
{
jstring jversionName = t.env->NewStringUTF(versionName);
t.env->CallVoidMethod(pData->jobj, t.methodID, jversionName);
t.env->DeleteLocalRef(jversionName);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::setAge(int age)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setAge"
, "(I)V"))
{
t.env->CallVoidMethod(pData->jobj, t.methodID, age);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::setGender(Gender gender)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setGender"
, "(B)V"))
{
t.env->CallVoidMethod(pData->jobj, t.methodID, (jbyte)gender);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::setUserId(const char* userId)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
return_if_fails(userId != NULL && strlen(userId) > 0);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setUserId"
, "(Ljava/lang/String;)V"))
{
jstring juserId = t.env->NewStringUTF(userId);
t.env->CallVoidMethod(pData->jobj, t.methodID, juserId);
t.env->DeleteLocalRef(juserId);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::setUseHttps(bool useHttps)
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "setUseHttps"
, "(Z)V"))
{
t.env->CallVoidMethod(pData->jobj, t.methodID, useHttps);
t.env->DeleteLocalRef(t.classID);
}
}
void AnalyticsFlurry::logTimedEventBegin(const char* eventId)
{
ProtocolAnalytics::logTimedEventBegin(eventId);
}
void AnalyticsFlurry::logTimedEventBegin(const char* eventId, LogEventParamMap* paramMap)
{
return_if_fails(eventId != NULL && strlen(eventId) > 0);
if (paramMap == NULL)
{
ProtocolAnalytics::logTimedEventBegin(eventId);
}
else
{
PluginJavaData* pData = PluginUtils::getPluginJavaData(this);
PluginJniMethodInfo t;
if (PluginJniHelper::getMethodInfo(t
, pData->jclassName.c_str()
, "logTimedEventBegin"
, "(Ljava/lang/String;Ljava/util/Hashtable;)V"))
{
jstring jeventId = t.env->NewStringUTF(eventId);
jobject jparamMap= PluginUtils::createJavaMapObject(t, paramMap);
t.env->CallVoidMethod(pData->jobj, t.methodID, jeventId, jparamMap);
t.env->DeleteLocalRef(jeventId);
t.env->DeleteLocalRef(jparamMap);
t.env->DeleteLocalRef(t.classID);
}
}
}
/** override methods of base class */
/** Start a new session. */
void AnalyticsFlurry::startSession(const char* appKey)
{
ProtocolAnalytics::startSession(appKey);
}
/** Stop a session. */
void AnalyticsFlurry::stopSession()
{
ProtocolAnalytics::stopSession();
}
/** Set the timeout for expiring a session. */
void AnalyticsFlurry::setSessionContinueMillis(long millis)
{
ProtocolAnalytics::setSessionContinueMillis(millis);
}
/** Whether to catch uncaught exceptions to server.*/
void AnalyticsFlurry::setCaptureUncaughtException(bool enabled)
{
ProtocolAnalytics::setCaptureUncaughtException(enabled);
}
const char* AnalyticsFlurry::getSDKVersion()
{
return ProtocolAnalytics::getSDKVersion();
}
/** Set whether needs to output logs to console.*/
void AnalyticsFlurry::setDebugMode(bool debug)
{
ProtocolAnalytics::setDebugMode(debug);
}
/** log an error */
void AnalyticsFlurry::logError(const char* errorId, const char* message)
{
ProtocolAnalytics::logError(errorId, message);
}
/** log an event. */
void AnalyticsFlurry::logEvent(const char* eventId, LogEventParamMap* paramMap)
{
ProtocolAnalytics::logEvent(eventId, paramMap);
}
/** end a timed event */
void AnalyticsFlurry::logTimedEventEnd(const char* eventId)
{
ProtocolAnalytics::logTimedEventEnd(eventId);
}
void AnalyticsFlurry::logTimedEventEnd(const char* eventId, LogEventParamMap* paramMap)
{
ProtocolAnalytics::logTimedEventEnd(eventId);
}
}} // namespace cocos2d { namespace plugin {

View File

@ -1,221 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "AnalyticsFlurry.h"
#include "Flurry.h"
#include "PluginUtilsIOS.h"
namespace cocos2d { namespace plugin {
PLUGIN_REGISTER_IMPL(AnalyticsFlurry)
#define LOG_MAX_LENGTH (16 * 1024)
static bool s_bDebugable = false;
void FlurryLogD(const char * pszFormat, ...)
{
if (s_bDebugable) {
printf("AnalyticsFlurry : ");
char szBuf[LOG_MAX_LENGTH];
va_list ap;
va_start(ap, pszFormat);
vsnprintf(szBuf, LOG_MAX_LENGTH, pszFormat, ap);
va_end(ap);
printf("%s", szBuf);
printf("\n");
}
}
AnalyticsFlurry::~AnalyticsFlurry()
{
}
bool AnalyticsFlurry::init()
{
return PluginUtilsIOS::initOCPlugin(this, "FlurryWrapper");
}
/** override methods of base class */
/** Start a new session. */
void AnalyticsFlurry::startSession(const char* appKey)
{
ProtocolAnalytics::startSession(appKey);
}
/** Stop a session.
only worked on android
*/
void AnalyticsFlurry::stopSession()
{
ProtocolAnalytics::stopSession();
}
/** Set whether needs to output logs to console.*/
void AnalyticsFlurry::setDebugMode(bool debug)
{
s_bDebugable = debug;
ProtocolAnalytics::setDebugMode(debug);
}
/** Set the timeout for expiring a session. */
void AnalyticsFlurry::setSessionContinueMillis(long millis)
{
ProtocolAnalytics::setSessionContinueMillis(millis);
}
/** log an error */
void AnalyticsFlurry::logError(const char* errorId, const char* message)
{
ProtocolAnalytics::logError(errorId, message);
}
/** log an event. */
void AnalyticsFlurry::logEvent(const char* eventId, LogEventParamMap* paramMap)
{
ProtocolAnalytics::logEvent(eventId, paramMap);
}
void AnalyticsFlurry::logTimedEventBegin(const char* eventId)
{
ProtocolAnalytics::logTimedEventBegin(eventId);
}
/** end a timed event */
void AnalyticsFlurry::logTimedEventEnd(const char* eventId)
{
ProtocolAnalytics::logTimedEventEnd(eventId);
}
/** Whether to catch uncaught exceptions to server.
only worked on android
*/
void AnalyticsFlurry::setCaptureUncaughtException(bool enabled)
{
ProtocolAnalytics::setCaptureUncaughtException(enabled);
}
const char* AnalyticsFlurry::getSDKVersion()
{
return ProtocolAnalytics::getSDKVersion();
}
void AnalyticsFlurry::setAge(int age)
{
NSNumber* numAge = [NSNumber numberWithInt:age];
PluginUtilsIOS::callOCFunctionWithName_Object(this, "setAge:", numAge);
}
void AnalyticsFlurry::setGender(Gender gender)
{
NSString* ret = @"m";
if (gender == FEMALE) {
ret = @"f";
}
PluginUtilsIOS::callOCFunctionWithName_Object(this, "setGender:", ret);
}
void AnalyticsFlurry::setUserId(const char* userId)
{
if (NULL == userId || strlen(userId) == 0) {
FlurryLogD("userId is invalid");
return;
}
NSString* pUserID = [NSString stringWithUTF8String:userId];
PluginUtilsIOS::callOCFunctionWithName_Object(this, "setUserId:", pUserID);
}
void AnalyticsFlurry::logPageView()
{
PluginUtilsIOS::callOCFunctionWithName(this, "logPageView");
}
void AnalyticsFlurry::setVersionName(const char* versionName)
{
NSString* pVer = [NSString stringWithUTF8String:versionName];
PluginUtilsIOS::callOCFunctionWithName_Object(this, "setVersionName:", pVer);
}
/**
@warning only worked on android
*/
void AnalyticsFlurry::setUseHttps(bool useHttps)
{
FlurryLogD("setUseHttps in flurry not available on iOS");
}
/**
@warning only worked on android
*/
void AnalyticsFlurry::setReportLocation(bool enabled)
{
FlurryLogD("setReportLocation in flurry not available on iOS");
}
void AnalyticsFlurry::logTimedEventBegin(const char* eventId, LogEventParamMap* paramMap)
{
if (NULL == eventId || strlen(eventId) == 0) {
FlurryLogD("eventId is invalid!");
return;
}
NSString* pId = [NSString stringWithUTF8String:eventId];
if (NULL == paramMap) {
this->logTimedEventBegin(eventId);
} else {
NSMutableDictionary* dict = PluginUtilsIOS::createDictFromMap(paramMap);
PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this);
if (pData) {
id pOCObj = pData->obj;
SEL selector = NSSelectorFromString(@"logTimedEventBegin:withParam:");
if ([pOCObj respondsToSelector:selector]) {
[pOCObj performSelector:selector withObject:pId withObject:dict];
}
}
}
}
void AnalyticsFlurry::logTimedEventEnd(const char* eventId, LogEventParamMap* paramMap)
{
if (NULL == eventId || strlen(eventId) == 0) {
FlurryLogD("eventId is invalid!");
return;
}
NSString* pId = [NSString stringWithUTF8String:eventId];
if (NULL == paramMap) {
this->logTimedEventEnd(eventId);
} else {
NSMutableDictionary* dict = PluginUtilsIOS::createDictFromMap(paramMap);
PluginOCData* pData = PluginUtilsIOS::getPluginOCData(this);
if (pData) {
id pOCObj = pData->obj;
SEL selector = NSSelectorFromString(@"logTimedEventEnd:withParam:");
if ([pOCObj respondsToSelector:selector]) {
[pOCObj performSelector:selector withObject:pId withObject:dict];
}
}
}
}
}} // namespace cocos2d { namespace plugin {

View File

@ -1,129 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "FlurryWrapper.h"
#import "Flurry.h"
@implementation FlurryWrapper
- (void) startSession: (NSString*) appKey
{
[Flurry startSession:appKey];
}
- (void) stopSession
{
NSLog(@"stopSession in flurry not available on iOS");
}
- (void) setSessionContinueMillis: (NSNumber*) millis
{
long lMillis = [millis longValue];
int seconds = (int)(lMillis / 1000);
[Flurry setSessionContinueSeconds:seconds];
}
- (void) setCaptureUncaughtException: (NSNumber*) isEnabled
{
NSLog(@"setCaptureUncaughtException in flurry not available on iOS");
}
- (void) setDebugMode: (NSNumber*) isDebugMode
{
BOOL bDebug = [isDebugMode boolValue];
[Flurry setDebugLogEnabled:bDebug];
}
- (void) logError: (NSString*) errorId withMsg:(NSString*) message
{
NSString* msg = nil;
if (nil == message) {
msg = @"";
} else {
msg = message;
}
[Flurry logError:errorId message:msg exception:nil];
}
- (void) logEvent: (NSString*) eventId
{
[Flurry logEvent:eventId];
}
- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap
{
[Flurry logEvent:eventId withParameters:paramMap];
}
- (void) logTimedEventBegin: (NSString*) eventId
{
[Flurry logEvent:eventId timed:YES];
}
- (void) logTimedEventEnd: (NSString*) eventId
{
[Flurry endTimedEvent:eventId withParameters:nil];
}
- (NSString*) getSDKVersion
{
return [Flurry getFlurryAgentVersion];
}
- (void) setAge: (NSNumber*) age
{
int nAge = [age integerValue];
[Flurry setAge:nAge];
}
- (void) setGender: (NSString*) gender
{
[Flurry setGender:gender];
}
- (void) setUserId: (NSString*) userId
{
[Flurry setUserID:userId];
}
- (void) logPageView
{
[Flurry logPageView];
}
- (void) setVersionName: (NSString*) versionName
{
[Flurry setAppVersion:versionName];
}
- (void) logTimedEventBegin: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap
{
[Flurry logEvent:eventId withParameters:paramMap timed:YES];
}
- (void) logTimedEventEnd: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap
{
[Flurry endTimedEvent:eventId withParameters:paramMap];
}
@end

View File

@ -30,16 +30,4 @@
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>android</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/android</locationURI>
</link>
<link>
<name>include</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/include</locationURI>
</link>
</linkedResources>
</projectDescription>

View File

@ -1,20 +0,0 @@
# set params
PLUGIN_ANDROID_ROOT=$(cd "$(dirname "$0")"; pwd)
if [ ! "${PLUGIN_ROOT}" ]; then
PLUGIN_ROOT="$PLUGIN_ANDROID_ROOT"/../..
fi
# build
"$ANDROID_NDK_ROOT"/ndk-build -C "$PLUGIN_ANDROID_ROOT" \
NDK_MODULE_PATH="$PLUGIN_ROOT"
echo
if [ "0" != "$?" ]; then
echo "Build error occoured!!!"
exit 1
fi
echo
echo "Native build action success."
exit 0

View File

@ -1,29 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := PluginFlurryStatic
LOCAL_MODULE_FILENAME := libPluginFlurryStatic
LOCAL_SRC_FILES := \
$(addprefix ../../platform/android/, \
AnalyticsFlurry.cpp \
) \
LOCAL_CFLAGS :=
LOCAL_EXPORT_CFLAGS :=
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../../include
LOCAL_WHOLE_STATIC_LIBRARIES := PluginProtocolStatic
LOCAL_LDLIBS := -landroid
LOCAL_LDLIBS += -llog
include $(BUILD_STATIC_LIBRARY)
$(call import-module, protocols/proj.android/jni)

View File

@ -1,7 +0,0 @@
# it is needed for ndk-r5
APP_STL := gnustl_static
APP_CPPFLAGS += -frtti
APP_MODULES := PluginFlurryStatic
APP_ABI :=armeabi
#APP_ABI :=x86
#APP_ABI :=mips mips-r2 mips-r2-sf armeabi

View File

@ -24,6 +24,9 @@ THE SOFTWARE.
package org.cocos2dx.plugin;
import java.util.Hashtable;
import java.util.Iterator;
import org.json.JSONObject;
import android.content.Context;
import android.util.Log;
@ -32,170 +35,191 @@ import com.flurry.android.FlurryAgent;
public class AnalyticsFlurry implements InterfaceAnalytics {
private Context mContext = null;
protected static String TAG = "AnalyticsFlurry";
protected static void LogE(String msg, Exception e) {
Log.e(TAG, msg, e);
e.printStackTrace();
}
private Context mContext = null;
protected static String TAG = "AnalyticsFlurry";
private static boolean isDebug = false;
protected static void LogD(String msg) {
if (isDebug) {
Log.d(TAG, msg);
}
}
protected static void LogE(String msg, Exception e) {
Log.e(TAG, msg, e);
e.printStackTrace();
}
public AnalyticsFlurry(Context context) {
mContext = context;
}
@Override
public void startSession(String appKey) {
LogD("startSession invoked!");
FlurryAgent.onStartSession(mContext, appKey);
}
private static boolean isDebug = false;
protected static void LogD(String msg) {
if (isDebug) {
Log.d(TAG, msg);
}
}
@Override
public void stopSession() {
LogD("stopSession invoked!");
FlurryAgent.onEndSession(mContext);
}
public AnalyticsFlurry(Context context) {
mContext = context;
}
@Override
public void startSession(String appKey) {
LogD("startSession invoked!");
FlurryAgent.onStartSession(mContext, appKey);
}
@Override
public void setSessionContinueMillis(int millis) {
LogD("setSessionContinueMillis invoked!");
FlurryAgent.setContinueSessionMillis(millis);
}
@Override
public void stopSession() {
LogD("stopSession invoked!");
FlurryAgent.onEndSession(mContext);
}
@Override
public void setCaptureUncaughtException(boolean isEnabled) {
LogD("setCaptureUncaughtException invoked!");
FlurryAgent.setCaptureUncaughtExceptions(isEnabled);
}
@Override
public void setSessionContinueMillis(int millis) {
LogD("setSessionContinueMillis invoked!");
FlurryAgent.setContinueSessionMillis(millis);
}
@Override
public void setDebugMode(boolean isDebugMode) {
isDebug = isDebugMode;
FlurryAgent.setLogEnabled(isDebug);
if (isDebugMode) {
FlurryAgent.setLogLevel(Log.DEBUG);
}
}
@Override
public void setCaptureUncaughtException(boolean isEnabled) {
LogD("setCaptureUncaughtException invoked!");
FlurryAgent.setCaptureUncaughtExceptions(isEnabled);
}
@Override
public void logError(String errorId, String message) {
LogD("logError invoked!");
FlurryAgent.onError(errorId, message, "");
}
@Override
public void setDebugMode(boolean isDebugMode) {
isDebug = isDebugMode;
FlurryAgent.setLogEnabled(isDebug);
if (isDebugMode) {
FlurryAgent.setLogLevel(Log.DEBUG);
}
}
@Override
public void logEvent(String eventId) {
LogD("logEvent(eventId) invoked!");
FlurryAgent.logEvent(eventId);
}
@Override
public void logError(String errorId, String message) {
LogD("logError invoked!");
FlurryAgent.onError(errorId, message, "");
}
@Override
public void logEvent(String eventId, Hashtable<String, String> paramMap) {
LogD("logEvent(eventId, paramMap) invoked!");
FlurryAgent.logEvent(eventId, paramMap);
}
@Override
public void logEvent(String eventId) {
LogD("logEvent(eventId) invoked!");
FlurryAgent.logEvent(eventId);
}
@Override
public void logTimedEventBegin(String eventId) {
LogD("logTimedEventBegin invoked!");
FlurryAgent.logEvent(eventId, true);
}
@Override
public void logEvent(String eventId, Hashtable<String, String> paramMap) {
LogD("logEvent(eventId, paramMap) invoked!");
FlurryAgent.logEvent(eventId, paramMap);
}
@Override
public void logTimedEventEnd(String eventId) {
LogD("logTimedEventEnd invoked!");
FlurryAgent.endTimedEvent(eventId);
}
@Override
public void logTimedEventBegin(String eventId) {
LogD("logTimedEventBegin invoked!");
FlurryAgent.logEvent(eventId, true);
}
@Override
public String getSDKVersion() {
LogD("getSDKVersion invoked!");
String ret = "";
try {
int nRet = FlurryAgent.getAgentVersion();
ret = "Flurry android ver " + nRet;
} catch(Exception e){
LogE("Exception in getSDKVersion", e);
}
return ret;
}
@Override
public void logTimedEventEnd(String eventId) {
LogD("logTimedEventEnd invoked!");
FlurryAgent.endTimedEvent(eventId);
}
protected void logTimedEventBegin(String eventId, Hashtable<String, String> paramMap) {
LogD("logTimedEventBegin invoked!");
try{
FlurryAgent.logEvent(eventId, paramMap, true);
} catch(Exception e){
LogE("Exception in logTimedEventBegin", e);
}
}
protected void setReportLocation(boolean enabled) {
LogD("setReportLocation invoked!");
try{
FlurryAgent.setReportLocation(enabled);
} catch(Exception e){
LogE("Exception in setReportLocation", e);
}
}
protected void logPageView() {
LogD("logPageView invoked!");
try{
FlurryAgent.onPageView();
} catch(Exception e){
LogE("Exception in logPageView", e);
}
}
@Override
public String getSDKVersion() {
LogD("getSDKVersion invoked!");
String ret = "";
try {
int nRet = FlurryAgent.getAgentVersion();
ret = "Flurry android ver " + nRet;
} catch(Exception e){
LogE("Exception in getSDKVersion", e);
}
return ret;
}
protected void setVersionName(String versionName) {
LogD("setVersionName invoked!");
try {
FlurryAgent.setVersionName(versionName);
} catch(Exception e){
LogE("Exception in setVersionName", e);
}
}
protected void setAge(int age) {
LogD("setAge invoked!");
try {
FlurryAgent.setAge(age);
} catch(Exception e){
LogE("Exception in setAge", e);
}
}
protected void setGender(byte gender) {
LogD("setGender invoked!");
try {
FlurryAgent.setGender(gender);
} catch(Exception e){
LogE("Exception in setGender", e);
}
}
protected void setUserId(String userId) {
LogD("setUserId invoked!");
try {
FlurryAgent.setUserId(userId);
} catch(Exception e){
LogE("Exception in setUserId", e);
}
}
protected void setUseHttps(boolean useHttps) {
LogD("setUseHttps invoked!");
try {
FlurryAgent.setUseHttps(useHttps);
} catch(Exception e){
LogE("Exception in setUseHttps", e);
}
}
protected void logTimedEventBeginWithParams(JSONObject eventInfo) {
LogD("logTimedEventBegin invoked!");
try{
String eventId = eventInfo.getString("Param1");
if (eventInfo.has("Param2"))
{
JSONObject params = eventInfo.getJSONObject("Param2");
@SuppressWarnings("rawtypes")
Iterator it = params.keys();
Hashtable<String, String> paramMap = new Hashtable<String, String>();
while (it.hasNext()) {
String key = (String) it.next();
String value = params.getString(key);
paramMap.put(key, value);
}
FlurryAgent.logEvent(eventId, paramMap, true);
} else {
FlurryAgent.logEvent(eventId, true);
}
} catch(Exception e){
LogE("Exception in logTimedEventBegin", e);
}
}
protected void setReportLocation(boolean enabled) {
LogD("setReportLocation invoked!");
try{
FlurryAgent.setReportLocation(enabled);
} catch(Exception e){
LogE("Exception in setReportLocation", e);
}
}
protected void logPageView() {
LogD("logPageView invoked!");
try{
FlurryAgent.onPageView();
} catch(Exception e){
LogE("Exception in logPageView", e);
}
}
protected void setVersionName(String versionName) {
LogD("setVersionName invoked!");
try {
FlurryAgent.setVersionName(versionName);
} catch(Exception e){
LogE("Exception in setVersionName", e);
}
}
protected void setAge(int age) {
LogD("setAge invoked!");
try {
FlurryAgent.setAge(age);
} catch(Exception e){
LogE("Exception in setAge", e);
}
}
protected void setGender(byte gender) {
LogD("setGender invoked!");
try {
FlurryAgent.setGender(gender);
} catch(Exception e){
LogE("Exception in setGender", e);
}
}
protected void setUserId(String userId) {
LogD("setUserId invoked!");
try {
FlurryAgent.setUserId(userId);
} catch(Exception e){
LogE("Exception in setUserId", e);
}
}
protected void setUseHttps(boolean useHttps) {
LogD("setUseHttps invoked!");
try {
FlurryAgent.setUseHttps(useHttps);
} catch(Exception e){
LogE("Exception in setUseHttps", e);
}
}
@Override
public String getPluginVersion() {
return "0.2.0";
}
}

View File

@ -23,25 +23,28 @@ THE SOFTWARE.
****************************************************************************/
#import "InterfaceAnalytics.h"
@interface FlurryWrapper : NSObject <InterfaceAnalytics>
@interface AnalyticsFlurry : NSObject <InterfaceAnalytics>
{
}
@property BOOL debug;
/**
interfaces of protocol : InterfaceAnalytics
*/
- (void) startSession: (NSString*) appKey;
- (void) stopSession;
- (void) setSessionContinueMillis: (NSNumber*) millis;
- (void) setCaptureUncaughtException: (NSNumber*) isEnabled;
- (void) setDebugMode: (NSNumber*) isDebugMode;
- (void) setSessionContinueMillis: (long) millis;
- (void) setCaptureUncaughtException: (BOOL) isEnabled;
- (void) setDebugMode: (BOOL) isDebugMode;
- (void) logError: (NSString*) errorId withMsg:(NSString*) message;
- (void) logEvent: (NSString*) eventId;
- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap;
- (void) logTimedEventBegin: (NSString*) eventId;
- (void) logTimedEventEnd: (NSString*) eventId;
- (NSString*) getSDKVersion;
- (NSString*) getPluginVersion;
/**
interfaces of flurry SDK
@ -49,9 +52,10 @@ THE SOFTWARE.
- (void) setAge: (NSNumber*) age;
- (void) setGender: (NSString*) gender;
- (void) setUserId: (NSString*) userId;
- (void) setUseHttps: (NSNumber*) enabled;
- (void) logPageView;
- (void) setVersionName: (NSString*) versionName;
- (void) logTimedEventBegin: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap;
- (void) logTimedEventEnd: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap;
- (void) logTimedEventBeginWithParams: (NSMutableDictionary*) params;
- (void) logTimedEventEndWithParams: (NSMutableDictionary*) params;
@end

View File

@ -0,0 +1,166 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#import "AnalyticsFlurry.h"
#import "Flurry.h"
#define OUTPUT_LOG(...) if (self.debug) NSLog(__VA_ARGS__);
@implementation AnalyticsFlurry
@synthesize debug = __debug;
- (void) startSession: (NSString*) appKey
{
[Flurry startSession:appKey];
}
- (void) stopSession
{
OUTPUT_LOG(@"Flurry stopSession in flurry not available on iOS");
}
- (void) setSessionContinueMillis: (long) millis
{
OUTPUT_LOG(@"Flurry setSessionContinueMillis invoked(%ld)", millis);
int seconds = (int)(millis / 1000);
[Flurry setSessionContinueSeconds:seconds];
}
- (void) setCaptureUncaughtException: (BOOL) isEnabled
{
OUTPUT_LOG(@"Flurry setCaptureUncaughtException in flurry not available on iOS");
}
- (void) setDebugMode: (BOOL) isDebugMode
{
OUTPUT_LOG(@"Flurry setDebugMode invoked(%d)", isDebugMode);
self.debug = isDebugMode;
[Flurry setDebugLogEnabled:isDebugMode];
}
- (void) logError: (NSString*) errorId withMsg:(NSString*) message
{
OUTPUT_LOG(@"Flurry logError invoked(%@, %@)", errorId, message);
NSString* msg = nil;
if (nil == message) {
msg = @"";
} else {
msg = message;
}
[Flurry logError:errorId message:msg exception:nil];
}
- (void) logEvent: (NSString*) eventId
{
OUTPUT_LOG(@"Flurry logEvent invoked(%@)", eventId);
[Flurry logEvent:eventId];
}
- (void) logEvent: (NSString*) eventId withParam:(NSMutableDictionary*) paramMap
{
OUTPUT_LOG(@"Flurry logEventWithParams invoked (%@, %@)", eventId, [paramMap debugDescription]);
[Flurry logEvent:eventId withParameters:paramMap];
}
- (void) logTimedEventBegin: (NSString*) eventId
{
OUTPUT_LOG(@"Flurry logTimedEventBegin invoked (%@)", eventId);
[Flurry logEvent:eventId timed:YES];
}
- (void) logTimedEventEnd: (NSString*) eventId
{
OUTPUT_LOG(@"Flurry logTimedEventEnd invoked (%@)", eventId);
[Flurry endTimedEvent:eventId withParameters:nil];
}
- (NSString*) getSDKVersion
{
return [Flurry getFlurryAgentVersion];
}
- (NSString*) getPluginVersion
{
return @"0.2.0";
}
- (void) setAge: (NSNumber*) age
{
int nAge = [age integerValue];
OUTPUT_LOG(@"Flurry setAge invoked (%d)", nAge);
[Flurry setAge:nAge];
}
- (void) setGender: (NSString*) gender
{
OUTPUT_LOG(@"Flurry setGender invoked (%@)", gender);
[Flurry setGender:gender];
}
- (void) setUserId: (NSString*) userId
{
OUTPUT_LOG(@"Flurry setUserId invoked (%@)", userId);
[Flurry setUserID:userId];
}
- (void) setUseHttps: (NSNumber*) enabled
{
BOOL bEnabled = [enabled boolValue];
OUTPUT_LOG(@"Flurry setUseHttps invoked (%@)", enabled);
[Flurry setSecureTransportEnabled:bEnabled];
}
- (void) logPageView
{
OUTPUT_LOG(@"Flurry logPageView invoked");
[Flurry logPageView];
}
- (void) setVersionName: (NSString*) versionName
{
OUTPUT_LOG(@"Flurry setVersionName invoked (%@)", versionName);
[Flurry setAppVersion:versionName];
}
- (void) logTimedEventBeginWithParams: (NSMutableDictionary*) paramMap
{
OUTPUT_LOG(@"Flurry logTimedEventBeginWithParams invoked (%@)", [paramMap debugDescription]);
NSString* eventId = (NSString*) [paramMap objectForKey:@"Param1"];
NSMutableDictionary* params = (NSMutableDictionary*) [paramMap objectForKey:@"Param2"];
if (params) {
[Flurry logEvent:eventId withParameters:paramMap timed:YES];
} else {
[Flurry logEvent:eventId timed:YES];
}
}
- (void) logTimedEventEndWithParams: (NSMutableDictionary*) paramMap
{
OUTPUT_LOG(@"Flurry logTimedEventEndWithParams invoked (%@)", [paramMap debugDescription]);
NSString* eventId = (NSString*) [paramMap objectForKey:@"Param1"];
NSMutableDictionary* params = (NSMutableDictionary*) [paramMap objectForKey:@"Param2"];
[Flurry endTimedEvent:eventId withParameters:params];
}
@end

View File

@ -8,9 +8,8 @@
/* Begin PBXBuildFile section */
FA09A376168AFD41008C1C7B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA09A375168AFD41008C1C7B /* Foundation.framework */; };
FA09A394168B00D4008C1C7B /* AnalyticsFlurry.mm in Sources */ = {isa = PBXBuildFile; fileRef = FA09A393168B00D4008C1C7B /* AnalyticsFlurry.mm */; };
FA866509168BE0980073E055 /* libFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FA866508168BE0980073E055 /* libFlurry.a */; };
FA8CC2241739EFF200464206 /* FlurryWrapper.m in Sources */ = {isa = PBXBuildFile; fileRef = FA8CC2231739EFF200464206 /* FlurryWrapper.m */; };
FAB6DFDD1756F22200C90D89 /* libFlurry.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAB6DFDB1756F22200C90D89 /* libFlurry.a */; };
FAB6DFE01756F29800C90D89 /* AnalyticsFlurry.m in Sources */ = {isa = PBXBuildFile; fileRef = FAB6DFDF1756F29800C90D89 /* AnalyticsFlurry.m */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@ -28,13 +27,11 @@
/* Begin PBXFileReference section */
FA09A372168AFD41008C1C7B /* libPluginFlurry.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPluginFlurry.a; sourceTree = BUILT_PRODUCTS_DIR; };
FA09A375168AFD41008C1C7B /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
FA09A391168AFD79008C1C7B /* AnalyticsFlurry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnalyticsFlurry.h; sourceTree = "<group>"; };
FA09A393168B00D4008C1C7B /* AnalyticsFlurry.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AnalyticsFlurry.mm; sourceTree = "<group>"; };
FA866507168BE0980073E055 /* Flurry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flurry.h; sourceTree = "<group>"; };
FA866508168BE0980073E055 /* libFlurry.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry.a; sourceTree = "<group>"; };
FA86650E168BE22D0073E055 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
FA8CC2221739EFF200464206 /* FlurryWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FlurryWrapper.h; sourceTree = "<group>"; };
FA8CC2231739EFF200464206 /* FlurryWrapper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FlurryWrapper.m; sourceTree = "<group>"; };
FAB6DFD81756F22200C90D89 /* Flurry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Flurry.h; sourceTree = "<group>"; };
FAB6DFDB1756F22200C90D89 /* libFlurry.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libFlurry.a; sourceTree = "<group>"; };
FAB6DFDE1756F29800C90D89 /* AnalyticsFlurry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnalyticsFlurry.h; sourceTree = "<group>"; };
FAB6DFDF1756F29800C90D89 /* AnalyticsFlurry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnalyticsFlurry.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -43,7 +40,7 @@
buildActionMask = 2147483647;
files = (
FA09A376168AFD41008C1C7B /* Foundation.framework in Frameworks */,
FA866509168BE0980073E055 /* libFlurry.a in Frameworks */,
FAB6DFDD1756F22200C90D89 /* libFlurry.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -53,9 +50,11 @@
FA09A367168AFD41008C1C7B = {
isa = PBXGroup;
children = (
FAB6DFDE1756F29800C90D89 /* AnalyticsFlurry.h */,
FAB6DFDF1756F29800C90D89 /* AnalyticsFlurry.m */,
FAB6DFD81756F22200C90D89 /* Flurry.h */,
FAB6DFDB1756F22200C90D89 /* libFlurry.a */,
FA86650E168BE22D0073E055 /* SystemConfiguration.framework */,
FA09A392168AFD96008C1C7B /* ios */,
FA09A390168AFD79008C1C7B /* include */,
FA09A374168AFD41008C1C7B /* Frameworks */,
FA09A373168AFD41008C1C7B /* Products */,
);
@ -77,28 +76,6 @@
name = Frameworks;
sourceTree = "<group>";
};
FA09A390168AFD79008C1C7B /* include */ = {
isa = PBXGroup;
children = (
FA09A391168AFD79008C1C7B /* AnalyticsFlurry.h */,
);
name = include;
path = ../include;
sourceTree = "<group>";
};
FA09A392168AFD96008C1C7B /* ios */ = {
isa = PBXGroup;
children = (
FA8CC2221739EFF200464206 /* FlurryWrapper.h */,
FA8CC2231739EFF200464206 /* FlurryWrapper.m */,
FA866507168BE0980073E055 /* Flurry.h */,
FA866508168BE0980073E055 /* libFlurry.a */,
FA09A393168B00D4008C1C7B /* AnalyticsFlurry.mm */,
);
name = ios;
path = ../platform/ios;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@ -150,8 +127,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FA09A394168B00D4008C1C7B /* AnalyticsFlurry.mm in Sources */,
FA8CC2241739EFF200464206 /* FlurryWrapper.m in Sources */,
FAB6DFE01756F29800C90D89 /* AnalyticsFlurry.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -215,6 +191,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../platform/ios\"",
"\"$(SRCROOT)\"",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = PluginFlurry;
@ -235,6 +212,7 @@
LIBRARY_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../platform/ios\"",
"\"$(SRCROOT)\"",
);
OTHER_LDFLAGS = "-ObjC";
PRODUCT_NAME = PluginFlurry;

View File

@ -1,82 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCX_IAP_ND91_H__
#define __CCX_IAP_ND91_H__
#include "ProtocolIAP.h"
#include <map>
#include <string>
namespace cocos2d { namespace plugin {
class IAPNd91 : public ProtocolIAP
{
PLUGIN_REGISTER_DECL(IAPNd91)
public:
/**
@brief plugin initialization
*/
virtual bool init();
/**
@brief config the developer info
@param devInfo This parameter is the info of developer, must contains key:
Nd91AppId The app id of nd91
Nd91AppKey The app key of nd91
Nd91Orientation The orientation of your app(use value : portrait, landscape, auto)
default value is portrait
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
virtual void configDeveloperInfo(TIAPDeveloperInfo devInfo);
/**
@brief pay for product
@param info The info of product, must contains key:
productName The name of product
productPrice The price of product(must can be parse to float)
productDesc The description of product
Nd91ProductId The product id of product for nd91
Nd91ProductCount The product number will buy(1--10000, default value 1)
Nd91OriginalPrice The original price of product(default value is same with productPrice)
@warning For different plugin, the parameter should have other keys to pay.
Look at the manual of plugins.
*/
virtual void payForProduct(TProductInfo info);
/**
@brief Set whether needs to output logs to console.
@param debug if true debug mode enabled, or debug mode disabled.
*/
virtual void setDebugMode(bool debug);
virtual const char* getPluginVersion() { return "v0.1.01"; };
virtual const char* getSDKVersion();
virtual ~IAPNd91();
};
}} // namespace cocos2d { namespace plugin {
#endif /* __CCX_IAP_ND91_H__ */

View File

@ -1,59 +0,0 @@
[nd91]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = pluginx_nd91
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = plugin
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include/linux -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.6/include -I%(androidndkdir)s/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/lib/gcc/arm-linux-androideabi/4.6/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.1/include
clang_flags = -nostdinc -x c++
cocos_headers = -I%(pluginxdir)s/protocols/include -I%(pluginxdir)s/plugins/nd91/include
cocos_flags = -DANDROID
cxxgenerator_headers = -I%(cxxgeneratordir)s/targets/spidermonkey/common
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s
# what headers to parse
headers = %(pluginxdir)s/plugins/nd91/include/IAPNd91.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^CCMenu*$".
classes = IAPNd91
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = *::[createPlugin]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# CCSet is special and we will use a hand-written constructor
abstract_classes = IAPNd91
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = yes

View File

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View File

@ -1,85 +0,0 @@
/****************************************************************************
Copyright (c) 2012-2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "IAPNd91.h"
#include "PluginUtils.h"
namespace cocos2d { namespace plugin {
PLUGIN_REGISTER_IMPL(IAPNd91)
IAPNd91::~IAPNd91()
{
}
/**
@brief plugin initialization
*/
bool IAPNd91::init()
{
return PluginUtils::initJavaPlugin(this, "org.cocos2dx.plugin.IAPNd91");
}
/**
@brief config the developer info
@param devInfo This parameter is the info of developer, must contains key:
Nd91AppId The app id of nd91
Nd91AppKey The app key of nd91
Nd91Orientation The orientation of your app(use value : portrait, landscape, auto)
default value is portrait
@warning Must invoke this interface before other interfaces.
And invoked only once.
*/
void IAPNd91::configDeveloperInfo(TIAPDeveloperInfo devInfo)
{
ProtocolIAP::configDeveloperInfo(devInfo);
}
/**
@brief pay for product
@param info The info of product, must contains key:
productName The name of product
productPrice The price of product(must can be parse to float)
productDesc The description of product
Nd91ProductId The product id of product for nd91
Nd91ProductCount The product number will buy(1--10000)
Nd91OriginalPrice The original price of product
@warning For different plugin, the parameter should have other keys to pay.
Look at the manual of plugins.
*/
void IAPNd91::payForProduct(TProductInfo info)
{
ProtocolIAP::payForProduct(info);
}
const char* IAPNd91::getSDKVersion()
{
return ProtocolIAP::getSDKVersion();
}
void IAPNd91::setDebugMode(bool debug)
{
ProtocolIAP::setDebugMode(debug);
}
}} // namespace cocos2d { namespace plugin {

View File

@ -30,16 +30,4 @@
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
<linkedResources>
<link>
<name>android</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/platform/android</locationURI>
</link>
<link>
<name>include</name>
<type>2</type>
<locationURI>PARENT-1-PROJECT_LOC/include</locationURI>
</link>
</linkedResources>
</projectDescription>

Some files were not shown because too many files have changed in this diff Show More