<commit_before>//
//  PluginChannel.m
//  sample
//
//  Created by cocos2dx on 14-11-10.
//  Copyright (c) 2014年 cocos2dx. All rights reserved.
//



#include "PluginChannel.h"
#include <stdlib.h>
#include "Analytics.h"
#include "Push.h"

#include "PartViews.h"

using namespace anysdk::framework;

#define  LOG_TAG    "PluginChannel"

void CCMessageBox(const char* content, const char* title)
{
    ////
    [PartViews addDebugView:[[NSString alloc] initWithUTF8String:title] ctx:[[NSString alloc] initWithUTF8String:content]];
}

void CCExit()
{
    ////
    exit(0);
}

void ShowTipDialog()
{
    ////
}


PluginChannel* PluginChannel::_pInstance = NULL;
static AllProductsInfo _myProducts;

PluginChannel::PluginChannel()
{
    _pluginsIAPMap = NULL;
}

PluginChannel::~PluginChannel()
{
    unloadPlugins();
}

PluginChannel* PluginChannel::getInstance()
{
    if (_pInstance == NULL) {
        _pInstance = new PluginChannel();
    }
    return _pInstance;
}

void PluginChannel::purge()
{
    if (_pInstance)
    {
        delete _pInstance;
        _pInstance = NULL;
    }
}

//使用game.com的时候注释掉这个宏就可以
//#define isQudaoInfo 1
void PluginChannel::loadPlugins()
{
    printf("Load plugins invoked\n");
    /**
     * appKey、appSecret、privateKey不能使用Sample中的值，需要从打包工具中游戏管理界面获取，替换
     * oauthLoginServer参数是游戏服务提供的用来做登陆验证转发的接口地址。
     */
#define qudao_info
#ifdef qudao_info
    std::string appKey = "<KEY>";
    std::string appSecret = "62bee0ddb86bdeccb8acd959765041cc";
    std::string privateKey = "96C273AB03E1A798BA1AD0C38004871F";
    std::string oauthLoginServer = "http://oauth.qudao.info/api/OauthLoginDemo/Login.php";
#else
    std::string appKey = "CED525C0-8D41-F514-96D8-90092EB3899A";
    std::string appSecret = "<KEY>";
    std::string privateKey = "<KEY>";
    std::string oauthLoginServer = "http://oauth.anysdk.com/api/OauthLoginDemo/Login.php";
#endif
    _pAgent = AgentManager::getInstance();
    _pAgent->init(appKey,appSecret,privateKey,oauthLoginServer);
    
    //使用框架中代理类进行插件初始化
    _pAgent->loadAllPlugins();
    
    _pUser = _pAgent->getUserPlugin();
    
    //对用户系统设置监听类
    if(_pUser)
    {
    }
    
    //对支付系统设置监听类
    _pluginsIAPMap  = _pAgent->getIAPPlugin();
    std::map<std::string , ProtocolIAP*>::iterator iter;
    for(iter = _pluginsIAPMap->begin(); iter != _pluginsIAPMap->end(); iter++)
    {
        (iter->second)->setResultListener(this);
    }
    
    Analytics::getInstance()->setCaptureUncaughtException(true);
    Analytics::getInstance()->setSessionContinueMillis(15000);
    Analytics::getInstance()->logTimedEventBegin("Load");
    Push::getInstance()->startPush();
}

void PluginChannel::unloadPlugins()
{
    printf("Unload plugins invoked\n");
    _pAgent->unloadAllPlugins();
    Analytics::getInstance()->logTimedEventEnd("Unload");
}

std::string PluginChannel::getPluginId()
{<commit_msg>添加用户系统回调监听<commit_after>//
//  PluginChannel.m
//  sample
//
//  Created by cocos2dx on 14-11-10.
//  Copyright (c) 2014年 cocos2dx. All rights reserved.
//



#include "PluginChannel.h"
#include <stdlib.h>
#include "Analytics.h"
#include "Push.h"

#include "PartViews.h"

using namespace anysdk::framework;

#define  LOG_TAG    "PluginChannel"

void CCMessageBox(const char* content, const char* title)
{
    ////
    [PartViews addDebugView:[[NSString alloc] initWithUTF8String:title] ctx:[[NSString alloc] initWithUTF8String:content]];
}

void CCExit()
{
    ////
    exit(0);
}

void ShowTipDialog()
{
    ////
}


PluginChannel* PluginChannel::_pInstance = NULL;
static AllProductsInfo _myProducts;

PluginChannel::PluginChannel()
{
    _pluginsIAPMap = NULL;
}

PluginChannel::~PluginChannel()
{
    unloadPlugins();
}

PluginChannel* PluginChannel::getInstance()
{
    if (_pInstance == NULL) {
        _pInstance = new PluginChannel();
    }
    return _pInstance;
}

void PluginChannel::purge()
{
    if (_pInstance)
    {
        delete _pInstance;
        _pInstance = NULL;
    }
}

//使用game.com的时候注释掉这个宏就可以
//#define isQudaoInfo 1
void PluginChannel::loadPlugins()
{
    printf("Load plugins invoked\n");
    /**
     * appKey、appSecret、privateKey不能使用Sample中的值，需要从打包工具中游戏管理界面获取，替换
     * oauthLoginServer参数是游戏服务提供的用来做登陆验证转发的接口地址。
     */
#define qudao_info
#ifdef qudao_info
    std::string appKey = "<KEY>";
    std::string appSecret = "62bee0ddb86bdeccb8acd959765041cc";
    std::string privateKey = "96C273AB03E1A798BA1AD0C38004871F";
    std::string oauthLoginServer = "http://oauth.qudao.info/api/OauthLoginDemo/Login.php";
#else
    std::string appKey = "CED525C0-8D41-F514-96D8-90092EB3899A";
    std::string appSecret = "<KEY>";
    std::string privateKey = "<KEY>";
    std::string oauthLoginServer = "http://oauth.anysdk.com/api/OauthLoginDemo/Login.php";
#endif
    _pAgent = AgentManager::getInstance();
    _pAgent->init(appKey,appSecret,privateKey,oauthLoginServer);
    
    //使用框架中代理类进行插件初始化
    _pAgent->loadAllPlugins();
    
    _pUser = _pAgent->getUserPlugin();
    
    //对用户系统设置监听类
    if(_pUser)
    {
        _pUser->setActionListener(this);
    }
    
    //对支付系统设置监听类
    _pluginsIAPMap  = _pAgent->getIAPPlugin();
    std::map<std::string , ProtocolIAP*>::iterator iter;
    for(iter = _pluginsIAPMap->begin(); iter != _pluginsIAPMap->end(); iter++)
    {
        (iter->second)->setResultListener(this);
    }
    
    Analytics::getInstance()->setCaptureUncaughtException(true);
    Analytics::getInstance()->setSessionContinueMillis(15000);
    Analytics::getInstance()->logTimedEventBegin("Load");
    Push::getInstance()->startPush();
}

void PluginChannel::unloadPlugins()
{
    printf("Unload plugins invoked\n");
    _pAgent->unloadAllPlugins();
    Analytics::getInstance()->logTimedEventEnd("Unload");
}

std::string PluginChannel::getPluginId()
{
{'fraction_non_alphanumeric': 0.14471855455177207, 'fraction_numerical': 0.027449617790132035, 'mean_word_length': 3.9416309012875534, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 42, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3091800', 'n_tokens_mistral': 2212, 'n_tokens_neox': 2156, 'n_words': 309}