Commit 2332162ce292d9555a413ccc2301f042754070f8
1 parent
c80ffd587b
Exists in
master
修改UIWebView为WKWebview
Showing 11 changed files with 74 additions and 15 deletions Inline Diff
- .gitignore
- GameLoginSDK.framework/GameLoginSDK
- GameLoginSDK.framework/Info.plist
- GameSDK.framework/Versions/A/GameSDK
- GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
- GameSDKResources.bundle/PayJs2.txt
- GameSDKResources.bundle/loginJs.txt
- NNewGumpSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/kingzh.xcuserdatad/UserInterfaceState.xcuserstate
- NNewGumpSDKDemo.xcodeproj/xcuserdata/kingzh.xcuserdatad/xcschemes/xcschememanagement.plist
- NNewGumpSDKDemo.xcworkspace/xcuserdata/kingzh.xcuserdatad/UserInterfaceState.xcuserstate
- Podfile
.gitignore
| 1 | Pods/ | 1 | Pods/ |
| 2 | Podfile.lock | 2 | Podfile.lock |
| 3 | .DS_Store | ||
| 3 | 4 |
GameLoginSDK.framework/GameLoginSDK
No preview for this file type
GameLoginSDK.framework/Info.plist
No preview for this file type
GameSDK.framework/Versions/A/GameSDK
No preview for this file type
GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
| 1 | 1 | ||
| 2 | #import <Foundation/Foundation.h> | 2 | #import <Foundation/Foundation.h> |
| 3 | 3 | ||
| 4 | //默认横屏 | 4 | //默认横屏 |
| 5 | static BOOL DeviceOrientationIsHorizontal = YES; | 5 | static BOOL DeviceOrientationIsHorizontal = YES; |
| 6 | 6 | ||
| 7 | static NSString *pVersion = @"4.0.6"; | 7 | static NSString *pVersion = @"4.0.8"; |
| 8 | 8 | ||
| 9 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> | 9 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> |
| 10 | 10 | ||
| 11 | @property (nonatomic, strong) NSString *appId; | 11 | @property (nonatomic, strong) NSString *appId; |
| 12 | @property(nonatomic, strong) NSString *channelId; | 12 | @property(nonatomic, strong) NSString *channelId; |
| 13 | @property (nonatomic, assign) int isDebug; | 13 | @property (nonatomic, assign) int isDebug; |
| 14 | @property (nonatomic, assign) int decideWebTo; | 14 | @property (nonatomic, assign) int decideWebTo; |
| 15 | 15 | ||
| 16 | 16 | ||
| 17 | + (instancetype)instance; | 17 | + (instancetype)instance; |
| 18 | 18 | ||
| 19 | -(NSString*)version; | 19 | -(NSString*)version; |
| 20 | 20 | ||
| 21 | +(void)DeviceOrientationIsHorizontal:(BOOL)isDisable; | 21 | +(void)DeviceOrientationIsHorizontal:(BOOL)isDisable; |
| 22 | +(BOOL)DeviceOrientationIsHorizontal; | 22 | +(BOOL)DeviceOrientationIsHorizontal; |
| 23 | 23 | ||
| 24 | - (void)hide; | 24 | - (void)hide; |
| 25 | 25 | ||
| 26 | - (BOOL)handleOpenURL:(NSURL *)url | 26 | - (BOOL)handleOpenURL:(NSURL *)url |
| 27 | sourceApplication:(NSString *)sourceApplication; | 27 | sourceApplication:(NSString *)sourceApplication; |
| 28 | 28 | ||
| 29 | -(void)pWeb:(NSDictionary*) pWebInfo handleCallBack:(void (^)()) pWebAccomplistCallback; | 29 | -(void)pWeb:(NSDictionary*) pWebInfo handleCallBack:(void (^)()) pWebAccomplistCallback; |
| 30 | 30 | ||
| 31 | -(void)iap:(NSDictionary*) payInfo succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback; | 31 | -(void)iap:(NSDictionary*) payInfo succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback; |
| 32 | 32 | ||
| 33 | -(void)registeIapObserver; | 33 | -(void)registeIapObserver; |
| 34 | 34 | ||
| 35 | -(void)decideIsDebug:(int)isDebug; | 35 | -(void)decideIsDebug:(int)isDebug; |
| 36 | 36 | ||
| 37 | -(void)decideWebToVersion:(int)decideWebTo; | 37 | -(void)decideWebToVersion:(int)decideWebTo; |
| 38 | @end | 38 | @end |
| 39 | 39 |
GameSDKResources.bundle/PayJs2.txt
| File was created | 1 | ;(function() { | |
| 2 | |||
| 3 | var bridge = 'sdk'; | ||
| 4 | |||
| 5 | if (window[bridge]) { return } | ||
| 6 | |||
| 7 | |||
| 8 | window[bridge] = {}; | ||
| 9 | |||
| 10 | window[bridge]['webVer'] = function webVer(webVer){ | ||
| 11 | |||
| 12 | window.webkit.messageHandlers.sdk.postMessage({'m':'webVer','p':JSON.stringify(arguments)}); | ||
| 13 | }; | ||
| 14 | |||
| 15 | |||
| 16 | |||
| 17 | window[bridge]['payWithBlue'] = function payWithBlue(payGateId,price,cardNO,roleId){ | ||
| 18 | window.webkit.messageHandlers.sdk.postMessage({'m':'payWithBlue','p':JSON.stringify(arguments)}); | ||
| 19 | }; | ||
| 20 | |||
| 21 | |||
| 22 | window[bridge]['closeWin'] = function closeWin(oid,status,extraInfo){ | ||
| 23 | window.webkit.messageHandlers.sdk.postMessage({'m':'closeWin','p':JSON.stringify(arguments)}); | ||
| 24 | }; | ||
| 25 | |||
| 26 | window[bridge]['newWindow'] = function newWindow(url){ | ||
| 27 | window.webkit.messageHandlers.sdk.postMessage({'m':'newWindow','p':JSON.stringify(arguments)}); | ||
| 28 | } | ||
| 29 | |||
| 30 | //var methods = ["closeWin(uid,nick,sessionKey)"]; | ||
| 31 | //var methodsWithoutParam =["closeWin"]; | ||
| 32 | //for (var i=0;i<methods.length;i++){ | ||
| 33 | // var method = methods[i]; | ||
| 34 | // 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);}"; | ||
| 36 | // eval(code); | ||
| 37 | //} | ||
| 38 | |||
| 39 | |||
| 40 | //通知js开始初始化 | ||
| 41 | if(typeof(onInjectJsOver)=='function') | ||
| 42 | onInjectJsOver(); | ||
| 43 | |||
| 44 | })(); | ||
| 45 |
GameSDKResources.bundle/loginJs.txt
| 1 | ;(function() { | 1 | ;(function() { |
| 2 | var messagingIframe, | 2 | |
| 3 | bridge = 'sdk', | 3 | var bridge = 'sdk'; |
| 4 | CUSTOM_PROTOCOL_SCHEME = 'jscall'; | 4 | |
| 5 | 5 | ||
| 6 | if (window[bridge]) { return } | 6 | if (window[bridge]) { return } |
| 7 | 7 | ||
| 8 | // 创建隐藏的iframe | 8 | |
| 9 | function _createQueueReadyIframe(doc) { | ||
| 10 | messagingIframe = doc.createElement('iframe'); | ||
| 11 | messagingIframe.style.display = 'none'; | ||
| 12 | doc.documentElement.appendChild(messagingIframe); | ||
| 13 | } | ||
| 14 | 9 | ||
| 15 | window[bridge] = {}; | 10 | window[bridge] = {}; |
| 16 | 11 | ||
| 17 | window[bridge]['onResult'] = function onResult(result){ | 12 | window[bridge]['onResult'] = function onResult(result){ |
| 18 | document.location=CUSTOM_PROTOCOL_SCHEME + ':' + arguments.callee.name + ':' + encodeURIComponent(JSON.stringify(arguments)); | 13 | window.webkit.messageHandlers.sdk.postMessage({'m':'onResult','p':JSON.stringify(arguments)}); |
| 19 | } | 14 | |
| 15 | }; | ||
| 16 | |||
| 17 | window[bridge]['closeWin'] = function closeWin(oid,status,extraInfo){ | ||
| 18 | window.webkit.messageHandlers.sdk.postMessage({'m':'closeWin','p':JSON.stringify(arguments)}); | ||
| 19 | }; | ||
| 20 | |||
| 20 | 21 | ||
| 21 | //创建iframe,必须在创建app之后,否则会出现死循环 | ||
| 22 | _createQueueReadyIframe(document); | ||
| 23 | //通知js开始初始化 | 22 | //通知js开始初始化 |
| 24 | //alert('onInjectJsOver='+typeof(onInjectJsOver)); | 23 |
NNewGumpSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/kingzh.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
NNewGumpSDKDemo.xcodeproj/xcuserdata/kingzh.xcuserdatad/xcschemes/xcschememanagement.plist
| File was created | 1 | <?xml version="1.0" encoding="UTF-8"?> | |
| 2 | <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
| 3 | <plist version="1.0"> | ||
| 4 | <dict> | ||
| 5 | <key>SchemeUserState</key> | ||
| 6 | <dict> | ||
| 7 | <key>NNewGumpSDKDemo.xcscheme_^#shared#^_</key> | ||
| 8 | <dict> | ||
| 9 | <key>orderHint</key> | ||
| 10 | <integer>2</integer> | ||
| 11 | </dict> | ||
| 12 | </dict> | ||
| 13 | </dict> | ||
| 14 | </plist> | ||
| 15 |
NNewGumpSDKDemo.xcworkspace/xcuserdata/kingzh.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
Podfile
| 1 | source 'https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git' | ||
| 1 | # Uncomment the next line to define a global platform for your project | 2 | # Uncomment the next line to define a global platform for your project |
| 2 | platform :ios, '9.0' | 3 | platform :ios, '9.0' |
| 3 | 4 | ||
| 4 | target 'NNewGumpSDKDemo' do | 5 | target 'NNewGumpSDKDemo' do |
| 5 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks | 6 | # Uncomment the next line if you're using Swift or would like to use dynamic frameworks |
| 6 | # use_frameworks! | 7 | # use_frameworks! |
| 7 | pod 'AFNetworking','~>3.1.0' | 8 | pod 'AFNetworking','~>3.1.0' |
| 8 | 9 | ||
| 9 | end | 10 | end |
| 10 | 11 |