Commit 51261096dc121e34c338a64e258e3ff1e3536b2d
1 parent
772f91c828
Exists in
master
and in
1 other branch
1、js 方法增加getChannelId的方法,获取参数。
2、sessionkey 失效时间接口返回相应修改。
Showing 2 changed files with 5 additions and 2 deletions Inline Diff
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKResources.bundle/Js.txt
| 1 | ;(function() { | 1 | ;(function() { |
| 2 | var messagingIframe, | 2 | var messagingIframe, |
| 3 | bridge = 'sdk', | 3 | bridge = 'sdk', |
| 4 | CUSTOM_PROTOCOL_SCHEME = 'jscall'; | 4 | CUSTOM_PROTOCOL_SCHEME = 'jscall'; |
| 5 | var appId = '%@' ,deviceId='%@'; | 5 | var appId = '%@' ,deviceId='%@' ,channelId='%@'; |
| 6 | 6 | ||
| 7 | 7 | ||
| 8 | if (window[bridge]) { return } | 8 | if (window[bridge]) { return } |
| 9 | 9 | ||
| 10 | // 创建隐藏的iframe | 10 | // 创建隐藏的iframe |
| 11 | function _createQueueReadyIframe(doc) { | 11 | function _createQueueReadyIframe(doc) { |
| 12 | messagingIframe = doc.createElement('iframe'); | 12 | messagingIframe = doc.createElement('iframe'); |
| 13 | messagingIframe.style.display = 'none'; | 13 | messagingIframe.style.display = 'none'; |
| 14 | doc.documentElement.appendChild(messagingIframe); | 14 | doc.documentElement.appendChild(messagingIframe); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | window[bridge] = {}; | 17 | window[bridge] = {}; |
| 18 | 18 | ||
| 19 | window[bridge]['getAppId']=function getAppId(){ | 19 | window[bridge]['getAppId']=function getAppId(){ |
| 20 | //alert('appid='+appId); | 20 | //alert('appid='+appId); |
| 21 | return appId; | 21 | return appId; |
| 22 | }; | 22 | }; |
| 23 | window[bridge]['getDeviceId']=function getDeviceId(){ | 23 | window[bridge]['getDeviceId']=function getDeviceId(){ |
| 24 | return deviceId; | 24 | return deviceId; |
| 25 | }; | 25 | }; |
| 26 | window[bridge]['getChannelId']=function getChannelId(){ | ||
| 27 | return channelId; | ||
| 28 | }; | ||
| 26 | 29 | ||
| 27 | window[bridge]['closeWin'] = function closeWin(uid,nick,sessionKey){ | 30 | window[bridge]['closeWin'] = function closeWin(uid,nick,sessionKey){ |
| 28 | document.location=CUSTOM_PROTOCOL_SCHEME + ':' + arguments.callee.name + ':' + encodeURIComponent(JSON.stringify(arguments)); | 31 | document.location=CUSTOM_PROTOCOL_SCHEME + ':' + arguments.callee.name + ':' + encodeURIComponent(JSON.stringify(arguments)); |
| 29 | }; | 32 | }; |
| 30 | //var methods = ["closeWin(uid,nick,sessionKey)"]; | 33 | //var methods = ["closeWin(uid,nick,sessionKey)"]; |
| 31 | //var methodsWithoutParam =["closeWin"]; | 34 | //var methodsWithoutParam =["closeWin"]; |
| 32 | //for (var i=0;i<methods.length;i++){ | 35 | //for (var i=0;i<methods.length;i++){ |
| 33 | // var method = methods[i]; | 36 | // var method = methods[i]; |
| 34 | // var methodWithoutParam = methodsWithoutParam[i]; | 37 | // var methodWithoutParam = methodsWithoutParam[i]; |
| 35 | // var code = "(window[bridge])[methodWithoutParam] = function " + method + " {var fs =CUSTOM_PROTOCOL_SCHEME + ':' + arguments.callee.name + ':' + encodeURIComponent(JSON.stringify(arguments)); messagingIframe.src = fs;alert('closeWin src:'+messagingIframe.src);}"; | 38 | // var code = "(window[bridge])[methodWithoutParam] = function " + method + " {var fs =CUSTOM_PROTOCOL_SCHEME + ':' + arguments.callee.name + ':' + encodeURIComponent(JSON.stringify(arguments)); messagingIframe.src = fs;alert('closeWin src:'+messagingIframe.src);}"; |
| 36 | // eval(code); | 39 | // eval(code); |
| 37 | //} | 40 | //} |
| 38 | 41 | ||
| 39 | //创建iframe,必须在创建app之后,否则会出现死循环 | 42 | //创建iframe,必须在创建app之后,否则会出现死循环 |
| 40 | _createQueueReadyIframe(document); | 43 | _createQueueReadyIframe(document); |
| 41 | //通知js开始初始化 | 44 | //通知js开始初始化 |
| 42 | //alert('onInjectJsOver='+typeof(onInjectJsOver)); | 45 | //alert('onInjectJsOver='+typeof(onInjectJsOver)); |
| 43 | if(typeof(onInjectJsOver)=='function') | 46 | if(typeof(onInjectJsOver)=='function') |
| 44 | onInjectJsOver(); | 47 | onInjectJsOver(); |
| 45 | 48 | ||
| 46 | })(); | ||
| 49 | })(); |