闲聊sdk接入说明 1Word文档下载推荐.docx
《闲聊sdk接入说明 1Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《闲聊sdk接入说明 1Word文档下载推荐.docx(17页珍藏版)》请在冰豆网上搜索。
![闲聊sdk接入说明 1Word文档下载推荐.docx](https://file1.bdocx.com/fileroot1/2023-1/12/2f0c61c5-2a9b-48f6-8369-bfd89f558e2f/2f0c61c5-2a9b-48f6-8369-bfd89f558e2f1.gif)
}
try{
"
hasxianliao"
}catch(IOExceptione){
......
3).添加函数RunJS_obj
etjs(name,param));
5)..添加函数xianLiaoInit
publicvoidxianLiaoInit(){
6)改微信登录函数wxLogin
7)把req=new();
改为req=new添加函数xianLiaoLogin
publicvoidxianLiaoLogin(){
if(isXLInstall()){
req=new="
none"
;
(req);
}
8).添加函数isXLInstall
9)加函数doWithoutXLApp
10)加函数xlShareText
publicvoidxlShareText(Stringtext){
11)加函数xlShareInviteGame
publicvoidxlShareInviteGame(StringroomId,StringroomToken,Stringtitle,Stringdescription){
Bitmapbitmap=(getResources(),
12)加函数xlShareTexture
publicvoidxlShareTexture(Stringpath){
if(isXLInstall()){
Bitmapbitmap=(path);
13)加函数GetXLInviteGameInfo
publicvoidGetXLInviteGameInfo(){
Stringrtn_msg=xlInviteGameInfo;
if(rtn_msg!
="
){
RunJS_obj("
rtn_msg);
xlInviteGameInfo="
14).添加函数StartXianLiaoLogin
publicstaticvoidStartXianLiaoLogin(){
if(ccActivity!
=null){
();
15).添加函数StartShareTextToXL
publicstaticvoidStartShareTextToXL(Stringpath){
(path);
16).添加函数StartShareInviteGameToXL
publicstaticvoidStartShareInviteGameToXL(StringroomId,
StringroomToken,Stringtitle,Stringdescription){
(roomId,roomToken,title,description);
17).添加函数StartShareTextureToXL
publicstaticvoidStartShareTextureToXL(Stringpath){
18).添加函数xlGetInviteGameInfo
publicstaticvoidxlGetInviteGameInfo(){
19).在中添加
<
!
--xianliao-->
activityandroid:
name="
android:
screenOrientation="
sensorLandscape"
configChanges="
orientation"
theme="
@android:
style/"
>
intent-filter>
actionandroid:
/>
categoryandroid:
/>
dataandroid:
scheme="
paraches"
android:
host="
xianliao*******闲聊审核获得的APPID*****"
/intent-filter>
/activity>
activity
exported="
true"
二、JS篇
1.在中修改函数,在函数中添加以下内容
=function(){
if{
"
WX_USER_LOGIN"
XL_USER_LOGIN"
LoginType"
loginData"
sendEvent("
logout"
else{
();
{},
function(){
"
sendEvent("
();
});
};
2.在中添加函数getWXunionid
varunionid="
varWX_USER_LOGIN="
if(WX_USER_LOGIN){
WX_USER_LOGIN=(WX_USER_LOGIN);
unionid=;
returnunionid;
3.在中添加函数operateFirstLoginType
=function(type){
if(!
type){
varloginType="
if(loginType){
returnloginType;
if(type){
"
type);
returntype;
else
returnnull;
4.在中添加函数doInviteGameInfo
=function(para){
if(!
para){
return;
if<
=-2){
......
}],
5.在中的JSScene的jsBind中的loginOK消息中添加xlGetInviteGameInfo的函数调用
loginOK:
function(rtn){
if>
0){
},
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){
"
"
StartShareInviteGameToXL"
(Ljava/lang/String;
Ljava/lang/String;
)V"
roomId,roomToken,title,description
);
xlShareInvite:
AndID:
AndTitle:
AndText:
roomToken,
roomId,
title,
description
XLInviteGamethrow:
9.在中的中添加xlShareImage函数
xlShareImage:
function(){
varwritePath=vartextrueName="
StartShareTextureToXL"
writePath+textrueName
varwritePath=vartextrueName="
xlShareImage:
XLShareImagethrow:
10.在中的中添加xlShareText函数
xlShareText:
function(text){
StartShareTextToXL"
text
xlShareText:
【四方河南麻将】"
xlShareTextthrow:
11.在中的中添加xlGetInviteGameInfo函数
xlGetInviteGameInfo:
xlGetInviteGameInfo"
xlGetInviteGameInfothrow:
12.在中添加变量xlLoginPara={};
13.在中的f_login函数中添加:
if{
=;
14.在中修改函数autoLogin
vartype=();
varbeginLogin=false;
mylog("
判断是否可以进行闲聊或者微信的自动登录type:
+type);
if(type=="
wx"
){
mylog("
开始进行微信自动登录..."
varWX_USER_LOGIN="
if(WX_USER_LOGIN){
mylog("
微信自动登录..."
WX_USER_LOGIN=(WX_USER_LOGIN);
LoginAsWeChat(WX_USER_LOGIN);
beginLogin=true;
elseif(type=="
xl"
开始进行闲聊自动登录..."
varXL_USER_LOGIN="
if(XL_USER_LOGIN){
闲聊自动登录..."
XL_USER_LOGIN=(XL_USER_LOGIN);
."
loginData="
if(loginData){
loginData自动登录..."
loginData=(loginData);
f_login,;
."
+"
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:
17.在中添加:
varXianLiaoType={
text:
1,....
();
18.在的ShareWXLayer中的_event添加XL_USER_LOGIN
XL_USER_LOGIN:
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){
ERR_CANCEL\"
elseif(callBackType==SugramLoginErrorType){
ERR_FAIL\"
elseif(callBackType==SugramLoginUnkonwType){
ERR_UNKNOW\"
dispatch_async(dispatch_get_main_queue(),^{
stringevent="
XL_LOGIN_MSG"
stringfunName="
stringrStr=funName+"
(\"
+event+"
+result_c_str+"
NSString*printStr=[NSStringstringWithCString:
()encoding:
[NSStringdefaultCStringEncoding]];
NSLog(@"
printStr:
%@"
printStr);
ScriptingCore:
getInstance()->
evalString());
});
闲聊登录结果结束..."
2.在中添加函数xlErrorAfterGetCode
+(void)xlErrorAfterGetCode{
闲聊在获取code之后的其他操作失败..."
stringresult_c_str="
ERR_AFTERGETCODE\"
3.在中添加函数xlShareMSG
+(void)xlShareMSG:
(SugramShareCallBackType)callBackType{
闲聊分享结果..."
if(callBackType==SugramShareSuccesslType){
elseif(callBackType==SugramShareCancelType){
elseif(callBackType==SugramShareErrorType){
elseif(callBackType==SugramShareUnkonwType){
XL_SHARE_MSG"
闲聊分享结果结束..."
4.在中添加函数xlGetInviteGameInfo
+(void)xlGetInviteGameInfo
查询闲聊查询游戏邀请信息..."
NSString*inviateMsgStr1=[NSStringstringWithCString:
inviateMsgStr:
%@len=%lu"
inviateMsgStr1,());
if()>
0){
dispatch_async(dispatch_get