scheme="paraches"
android:
host="xianliao*******闲聊审核获得的APPID*****"/>
android:
name=""
android:
exported="true">
二、JS篇
1.在中修改函数,在函数中添加以下内容
=function(){
if{
"WX_USER_LOGIN");
"XL_USER_LOGIN");
"LoginType");
"loginData");
sendEvent("logout");
}
else{
();
"",{},
function(){
"WX_USER_LOGIN");
"XL_USER_LOGIN");
"LoginType");
"loginData");
sendEvent("logout");
();
});
}
};
2.在中添加函数getWXunionid
=function(){
varunionid="";
varWX_USER_LOGIN="WX_USER_LOGIN");
if(WX_USER_LOGIN){
WX_USER_LOGIN=(WX_USER_LOGIN);
unionid=;
}
returnunionid;
};
3.在中添加函数operateFirstLoginType
=function(type){
if(!
type){
varloginType="LoginType");
if(loginType){
returnloginType;
}
}
else{
if(type){
"LoginType",type);
returntype;
}
else
returnnull;
}
};
4.在中添加函数doInviteGameInfo
=function(para){
if(!
para){
return;
}
....
if<=-2){
......
}
else{
......
}
}],
5.在中的JSScene的jsBind中的loginOK消息中添加xlGetInviteGameInfo的函数调用
loginOK:
function(rtn){
......
if>0){
......
}
else{
......
}
},
6.在中的JSScene的jsBind中添加XL_InviteGameInfo消息
XL_InviteGameInfo:
function(para){
(para);
},
7.在中的中添加xlLogin函数
xlLogin:
function(){
try{
if=={
"","StartXianLiaoLogin","()V");
}
elseif=={
"AppController","sendXLRequest");
}
}catch(e){
"xianLiaoLoginthrow:
"+(e));
}
},
8.在中的中添加xlInviteGame函数
xlInviteGame:
function(roomId,roomToken,title,description){
try{
if=={
"",
"StartShareInviteGameToXL",
"(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V",
roomId,roomToken,title,description
);
}
elseif=={
"AppController",
"xlShareInvite:
AndID:
AndTitle:
AndText:
",
roomToken,
roomId,
title,
description
);
}
}catch(e){
"XLInviteGamethrow:
"+(e));
}
},
9.在中的中添加xlShareImage函数
xlShareImage:
function(){
try{
varwritePath=vartextrueName="";
if=={
"",
"StartShareTextureToXL",
"(Ljava/lang/String;)V",
writePath+textrueName
);
}
elseif=={
varwritePath=vartextrueName="";
"AppController",
"xlShareImage:
",
writePath+textrueName
);
}
}catch(e){
"XLShareImagethrow:
"+(e));
}
},
10.在中的中添加xlShareText函数
xlShareText:
function(text){
try{
if=={
"",
"StartShareTextToXL",
"(Ljava/lang/String;)V",
text
);
}
elseif=={
"AppController",
"xlShareText:
AndText:
",
"【四方河南麻将】",
text
);
}
}catch(e){
"xlShareTextthrow:
"+(e));
}
},
11.在中的中添加xlGetInviteGameInfo函数
xlGetInviteGameInfo:
function(){
......
try{
if=={
"","xlGetInviteGameInfo","()V");
}
elseif=={
"AppController","xlGetInviteGameInfo");
}
}catch(e){
"xlGetInviteGameInfothrow:
"+(e));
}
},
12.在中添加变量xlLoginPara={};
13.在中的f_login函数中添加:
if{
=;
=;
=;
=;
}
14.在中修改函数autoLogin
=function(){
();
vartype=();
varbeginLogin=false;
mylog("判断是否可以进行闲聊或者微信的自动登录type:
"+type);
if(type=="wx"){
mylog("开始进行微信自动登录...");
varWX_USER_LOGIN="WX_USER_LOGIN");
if(WX_USER_LOGIN){
mylog("微信自动登录...");
WX_USER_LOGIN=(WX_USER_LOGIN);
LoginAsWeChat(WX_USER_LOGIN);
beginLogin=true;
}
}
elseif(type=="xl"){
mylog("开始进行闲聊自动登录...");
varXL_USER_LOGIN="XL_USER_LOGIN");
if(XL_USER_LOGIN){
mylog("闲聊自动登录...");
XL_USER_LOGIN=(XL_USER_LOGIN);
.");
loginData="loginData");
if(loginData){
mylog("loginData自动登录...");
loginData=(loginData);
f_login,;
beginLogin=true;
}
}
.");
+"",
function(er,txt){
if(txt){
.");
f_login(xlLoginPara);
}
}
);
}
},
15.在中_event内添加XL_LOGIN_MSG的事件响应
XL_LOGIN_MSG:
function(para){
if{
switch{
case"ERR_SUCCESS":
.
}
}
......
elseif=={
....
....
}
},
16.在中的邀请按钮的点击事件中添加:
wxinvite:
{
......
_click:
function(){
......
....
}
},
17.在中添加:
varXianLiaoType={
text:
1,....
},
_click:
function(){
();
}
}
18.在的ShareWXLayer中的_event添加XL_USER_LOGIN
XL_USER_LOGIN:
function(para){
();
if(para){
.");
}
}];
1.在中handleOpenURL函数中修改
-(BOOL)application:
(UIApplication*)applicationhandleOpenURL:
(NSURL*)url
{
.");
std:
:
stringresult_c_str="";
if(callBackType==SugramLoginSuccessType){
result_c_str="{\"errMsg\":
\"ERR_SUCCESS\"}";
}
elseif(callBackType==SugramLoginCancelType){
result_c_str="{\"errMsg\":
\"ERR_CANCEL\"}";
}
elseif(callBackType==SugramLoginErrorType){
result_c_str="{\"errMsg\":
\"ERR_FAIL\"}";
}
elseif(callBackType==SugramLoginUnkonwType){
result_c_str="{\"errMsg\":
\"ERR_UNKNOW\"}";
}
dispatch_async(dispatch_get_main_queue(),^{
std:
:
stringevent="XL_LOGIN_MSG";
std:
:
stringfunName="";
std:
:
stringrStr=funName+"(\""+event+"\","+result_c_str+");";
NSString*printStr=[NSStringstringWithCString:
()encoding:
[NSStringdefaultCStringEncoding]];
NSLog(@"printStr:
%@",printStr);
ScriptingCore:
:
getInstance()->evalString());
});
NSLog(@"闲聊登录结果结束...");
}
2.在中添加函数xlErrorAfterGetCode
+(void)xlErrorAfterGetCode{
NSLog(@"闲聊在获取code之后的其他操作失败...");
std:
:
stringresult_c_str="{\"errMsg\":
\"ERR_AFTERGETCODE\"}";
dispatch_async(dispatch_get_main_queue(),^{
std:
:
stringevent="XL_LOGIN_MSG";
std:
:
stringfunName="";
std:
:
stringrStr=funName+"(\""+event+"\","+result_c_str+");";
NSString*printStr=[NSStringstringWithCString:
()encoding:
[NSStringdefaultCStringEncoding]];
NSLog(@"printStr:
%@",printStr);
ScriptingCore:
:
getInstance()->evalString());
});
}
3.在中添加函数xlShareMSG
+(void)xlShareMSG:
(SugramShareCallBackType)callBackType{
NSLog(@"闲聊分享结果...");
std:
:
stringresult_c_str="";
if(callBackType==SugramShareSuccesslType){
result_c_str="{\"errMsg\":
\"ERR_SUCCESS\"}";
}
elseif(callBackType==SugramShareCancelType){
result_c_str="{\"errMsg\":
\"ERR_CANCEL\"}";
}
elseif(callBackType==SugramShareErrorType){
result_c_str="{\"errMsg\":
\"ERR_FAIL\"}";
}
elseif(callBackType==SugramShareUnkonwType){
result_c_str="{\"errMsg\":
\"ERR_UNKNOW\"}";
}
dispatch_async(dispatch_get_main_queue(),^{
std:
:
stringevent="XL_SHARE_MSG";
std:
:
stringfunName="";
std:
:
stringrStr=funName+"(\""+event+"\","+result_c_str+");";
NSString*printStr=[NSStringstringWithCString:
()encoding:
[NSStringdefaultCStringEncoding]];
NSLog(@"printStr:
%@",printStr);
ScriptingCore:
:
getInstance()->evalString());
});
NSLog(@"闲聊分享结果结束...");
}
4.在中添加函数xlGetInviteGameInfo
+(void)xlGetInviteGameInfo
{
NSLog(@"查询闲聊查询游戏邀请信息...");
NSString*inviateMsgStr1=[NSStringstringWithCString:
()encoding:
[NSStringdefaultCStringEncoding]];
NSLog(@"inviateMsgStr:
%@len=%lu",inviateMsgStr1,());
if()>0){
dispatch_async(dispatch_get