Commit 947ebdf6b22f224390c72014f6c08f11b4520eb7
1 parent
51261096dc
Exists in
master
and in
1 other branch
sessionKey字段返回添加有效期,以及登录时新版本bug修改
Showing 8 changed files with 20 additions and 18 deletions Inline Diff
- ios/GameSDK.framework/Versions/A/GameSDK
- ios/GameSDK.framework/Versions/A/Headers/LSGAccount.h
- ios/GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
- ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
- ios/GameSDKDemo/GameSDKDemo.xcodeproj/xcuserdata/yanglele.xcuserdatad/xcschemes/GameSDKDemo.xcscheme
- ios/GameSDKDemo/letsgameDemo/LSGAppDelegate.m
- ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
- ios/GameSDKResources.bundle/Js.txt
ios/GameSDK.framework/Versions/A/GameSDK
No preview for this file type
ios/GameSDK.framework/Versions/A/Headers/LSGAccount.h
1 | #import <Foundation/Foundation.h> | 1 | #import <Foundation/Foundation.h> |
2 | 2 | ||
3 | typedef NS_ENUM(NSInteger, LSGAccountType) { | 3 | typedef NS_ENUM(NSInteger, LSGAccountType) { |
4 | LSGAccountTypeRegist = 1, | 4 | LSGAccountTypeRegist = 1, |
5 | LSGAccountTypeFBRegist = 2, | 5 | LSGAccountTypeFBRegist = 2, |
6 | LSGAccountTypeQuickRegist = 4, | 6 | LSGAccountTypeQuickRegist = 4, |
7 | LSGAccountTypeVKRegist = 8, | 7 | LSGAccountTypeVKRegist = 8, |
8 | LSGAccountTypeGoogleRegist = 16, | 8 | LSGAccountTypeGoogleRegist = 16, |
9 | LSGAccountTypeWeChatRegist = 32, | 9 | LSGAccountTypeWeChatRegist = 32, |
10 | LSGAccountTypeLineRegist = 64, | 10 | LSGAccountTypeLineRegist = 64, |
11 | }; | 11 | }; |
12 | 12 | ||
13 | //判断是不是自动登录情况 | 13 | //判断是不是自动登录情况 |
14 | #define LSGAccountTypeBaseLogin 128 | 14 | #define LSGAccountTypeBaseLogin 128 |
15 | 15 | ||
16 | @interface LSGAccount : NSObject | 16 | @interface LSGAccount : NSObject |
17 | 17 | ||
18 | @property(nonatomic, assign) LSGAccountType type; | 18 | @property(nonatomic, assign) LSGAccountType type; |
19 | @property(nonatomic, strong) NSString *username; | 19 | @property(nonatomic, copy) NSString *username; |
20 | @property(nonatomic, strong) NSString *nickName; | 20 | @property(nonatomic, copy) NSString *nickName; |
21 | @property(nonatomic, strong) NSString *password; | 21 | @property(nonatomic, copy) NSString *password; |
22 | @property(nonatomic, strong) NSString *userId; | 22 | @property(nonatomic, copy) NSString *userId; |
23 | @property(nonatomic, strong) NSString *sessionKey; | 23 | @property(nonatomic, copy) NSString *sessionKey; |
24 | @property(nonatomic, strong) NSString *deviceId; | 24 | @property(nonatomic, copy) NSString *deviceId; |
25 | @property(nonatomic, copy) NSString *sessionInvalidT; | ||
25 | 26 | ||
26 | + (void)saveAccount:(NSString *)service account:(LSGAccount *)account; | 27 | + (void)saveAccount:(NSString *)service account:(LSGAccount *)account; |
27 | 28 | ||
28 | + (LSGAccount *)loadAccount:(NSString *)service; | 29 | + (LSGAccount *)loadAccount:(NSString *)service; |
29 | 30 | ||
30 | + (void)deleteAccount:(NSString *)service; | 31 | + (void)deleteAccount:(NSString *)service; |
31 | 32 | ||
32 | @end | 33 | @end |
33 | 34 |
ios/GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
1 | 1 | ||
2 | #import <Foundation/Foundation.h> | 2 | #import <Foundation/Foundation.h> |
3 | #import "LSGAccount.h" | 3 | #import "LSGAccount.h" |
4 | #import "VKBridgeProtocol.h" | 4 | #import "VKBridgeProtocol.h" |
5 | 5 | ||
6 | 6 | ||
7 | typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type); | 7 | typedef void (^LSGLoginSuccBlock)(NSString *userId, NSString *sessionKey, LSGAccountType type); |
8 | typedef void (^LSGDismissBlock)(void); | 8 | typedef void (^LSGDismissBlock)(void); |
9 | 9 | ||
10 | static BOOL isDisableFB = NO; | 10 | static BOOL isDisableFB = NO; |
11 | 11 | ||
12 | static BOOL isEnableVK = NO; | 12 | static BOOL isEnableVK = NO; |
13 | 13 | ||
14 | static BOOL isDisableLine = NO; | 14 | static BOOL isDisableLine = NO; |
15 | 15 | ||
16 | static BOOL isDisableWeChat = NO; | 16 | static BOOL isDisableWeChat = NO; |
17 | 17 | ||
18 | static BOOL isDisableGoogle = NO; | 18 | static BOOL isDisableGoogle = NO; |
19 | 19 | ||
20 | static BOOL hiddenLogo = NO; | 20 | static BOOL hiddenLogo = NO; |
21 | 21 | ||
22 | //默认横屏 | 22 | //默认横屏 |
23 | static BOOL DeviceOrientationIsHorizontal = YES; | 23 | static BOOL DeviceOrientationIsHorizontal = YES; |
24 | 24 | ||
25 | static NSString *version = @"3.4.19"; | 25 | static NSString *version = @"3.5.3"; |
26 | 26 | ||
27 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> | 27 | @interface LetsGameAPI : NSObject<UIApplicationDelegate> |
28 | 28 | ||
29 | @property (nonatomic, strong) NSString *appId; | 29 | @property (nonatomic, strong) NSString *appId; |
30 | @property (nonatomic, strong) NSString *appKey; | 30 | @property (nonatomic, strong) NSString *appKey; |
31 | @property(nonatomic, strong) NSString *channelId; | 31 | @property(nonatomic, strong) NSString *channelId; |
32 | @property (nonatomic, copy) LSGLoginSuccBlock succBlock; | 32 | @property (nonatomic, copy) LSGLoginSuccBlock succBlock; |
33 | @property (nonatomic, copy) LSGDismissBlock dismissBlock; | 33 | @property (nonatomic, copy) LSGDismissBlock dismissBlock; |
34 | @property (nonatomic, assign) int isDebug; | 34 | @property (nonatomic, assign) int isDebug; |
35 | @property (nonatomic, assign) int decideWebTo; | 35 | @property (nonatomic, assign) int decideWebTo; |
36 | @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; | 36 | @property (nonatomic,retain) id<VKBridgeProtocol> vkBridge; |
37 | //@property(nonatomic,strong) NSString *version; | 37 | //@property(nonatomic,strong) NSString *version; |
38 | 38 | ||
39 | + (instancetype)instance; | 39 | + (instancetype)instance; |
40 | 40 | ||
41 | -(NSString*)version; | 41 | -(NSString*)version; |
42 | 42 | ||
43 | - (void)showLoginView; | 43 | - (void)showLoginView; |
44 | - (void)showLoginViewInView:(UIView *)view; | 44 | - (void)showLoginViewInView:(UIView *)view; |
45 | 45 | ||
46 | +(void)disableFB:(BOOL)isDisable; | 46 | +(void)disableFB:(BOOL)isDisable; |
47 | +(void)disableGoogle:(BOOL)isDisable; | 47 | +(void)disableGoogle:(BOOL)isDisable; |
48 | +(void)disableWeChat:(BOOL)isDisable; | 48 | +(void)disableWeChat:(BOOL)isDisable; |
49 | +(void)disableLine:(BOOL)isDissable; | 49 | +(void)disableLine:(BOOL)isDissable; |
50 | +(BOOL)isFBDisable; | 50 | +(BOOL)isFBDisable; |
51 | +(BOOL)isVKEnable; | 51 | +(BOOL)isVKEnable; |
52 | +(BOOL)isWeChatDisable; | 52 | +(BOOL)isWeChatDisable; |
53 | +(BOOL)isGoogleDisable; | 53 | +(BOOL)isGoogleDisable; |
54 | +(BOOL)isLineDisable; | 54 | +(BOOL)isLineDisable; |
55 | +(void)hiddenLogo:(BOOL)isHidden; | 55 | +(void)hiddenLogo:(BOOL)isHidden; |
56 | +(BOOL)isHiddenLogo; | 56 | +(BOOL)isHiddenLogo; |
57 | +(void)DeviceOrientationIsHorizontal:(BOOL)isDisable; | 57 | +(void)DeviceOrientationIsHorizontal:(BOOL)isDisable; |
58 | +(BOOL)DeviceOrientationIsHorizontal; | 58 | +(BOOL)DeviceOrientationIsHorizontal; |
59 | 59 | ||
60 | - (void)logout; | 60 | - (void)logout; |
61 | 61 | ||
62 | - (void)hide; | 62 | - (void)hide; |
63 | //是否安装微信 | 63 | //是否安装微信 |
64 | -(BOOL)isWeChatInstall; | 64 | -(BOOL)isWeChatInstall; |
65 | //向微信注册应用 | 65 | //向微信注册应用 |
66 | -(void)registerAppWeChatWithAppId:(NSString *)appId | 66 | -(void)registerAppWeChatWithAppId:(NSString *)appId |
67 | appKey:(NSString *)appKey | 67 | appKey:(NSString *)appKey |
68 | Success:(void (^)())success | 68 | Success:(void (^)())success |
69 | failure:(void (^)())failure; | 69 | failure:(void (^)())failure; |
70 | 70 | ||
71 | - (BOOL)handleOpenURL:(NSURL *)url | 71 | - (BOOL)handleOpenURL:(NSURL *)url |
72 | sourceApplication:(NSString *)sourceApplication; | 72 | sourceApplication:(NSString *)sourceApplication; |
73 | 73 | ||
74 | -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback; | 74 | -(void)pay:(NSDictionary*) payInfo handleCallBack:(void (^)()) payAccomplistCallback; |
75 | 75 | ||
76 | //-(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; | 76 | //-(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid handleCallback:(void (^)(NSString* orderId)) callback; |
77 | 77 | ||
78 | -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback; | 78 | -(void)iap:(NSDictionary*) payInfo forUser:(NSString*) uid succCallback:(void (^)(NSString* orderId)) succCallback failCallback:(void (^)(NSString* orderId)) failCallback; |
79 | 79 | ||
80 | -(void)registeIapObserver; | 80 | -(void)registeIapObserver; |
81 | 81 | ||
82 | -(void)decideIsDebug:(int)isDebug; | 82 | -(void)decideIsDebug:(int)isDebug; |
83 | 83 | ||
84 | -(void)decideWebToVersion:(int)decideWebTo; | 84 | -(void)decideWebToVersion:(int)decideWebTo; |
85 | 85 | ||
86 | -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success | 86 | -(void)obtainAccessTokenSuccess:(void (^)(NSString *tokenString, NSString *refreshTime, NSString *expirationTime))success |
87 | failure:(void (^)(NSString *errorString))failure; | 87 | failure:(void (^)(NSString *errorString))failure; |
88 | 88 | ||
89 | //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面 | 89 | //获取是否展示安全页面,YES展示侵权页面,NO展示非侵权页面 |
90 | -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId | 90 | -(void)gameObtainSafeSetInfoWithAppId:(NSString *)appId |
91 | ChannelId:(NSString *)channelId | 91 | ChannelId:(NSString *)channelId |
92 | handleCallBack:(void (^)(BOOL resultStatus))callBack; | 92 | handleCallBack:(void (^)(BOOL resultStatus))callBack; |
93 | @end | 93 | @end |
94 | 94 |
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/xcuserdata/yanglele.xcuserdatad/xcschemes/GameSDKDemo.xcscheme
1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
2 | <Scheme | 2 | <Scheme |
3 | LastUpgradeVersion = "0730" | 3 | LastUpgradeVersion = "0730" |
4 | version = "1.3"> | 4 | version = "1.3"> |
5 | <BuildAction | 5 | <BuildAction |
6 | parallelizeBuildables = "YES" | 6 | parallelizeBuildables = "YES" |
7 | buildImplicitDependencies = "YES"> | 7 | buildImplicitDependencies = "YES"> |
8 | <BuildActionEntries> | 8 | <BuildActionEntries> |
9 | <BuildActionEntry | 9 | <BuildActionEntry |
10 | buildForTesting = "YES" | 10 | buildForTesting = "YES" |
11 | buildForRunning = "YES" | 11 | buildForRunning = "YES" |
12 | buildForProfiling = "YES" | 12 | buildForProfiling = "YES" |
13 | buildForArchiving = "YES" | 13 | buildForArchiving = "YES" |
14 | buildForAnalyzing = "YES"> | 14 | buildForAnalyzing = "YES"> |
15 | <BuildableReference | 15 | <BuildableReference |
16 | BuildableIdentifier = "primary" | 16 | BuildableIdentifier = "primary" |
17 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" | 17 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" |
18 | BuildableName = "GameSDKDemo.app" | 18 | BuildableName = "GameSDKDemo.app" |
19 | BlueprintName = "GameSDKDemo" | 19 | BlueprintName = "GameSDKDemo" |
20 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> | 20 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> |
21 | </BuildableReference> | 21 | </BuildableReference> |
22 | </BuildActionEntry> | 22 | </BuildActionEntry> |
23 | </BuildActionEntries> | 23 | </BuildActionEntries> |
24 | </BuildAction> | 24 | </BuildAction> |
25 | <TestAction | 25 | <TestAction |
26 | buildConfiguration = "Debug" | 26 | buildConfiguration = "Debug" |
27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | 27 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | 28 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
29 | language = "" | 29 | language = "" |
30 | shouldUseLaunchSchemeArgsEnv = "YES"> | 30 | shouldUseLaunchSchemeArgsEnv = "YES"> |
31 | <Testables> | 31 | <Testables> |
32 | </Testables> | 32 | </Testables> |
33 | <MacroExpansion> | 33 | <MacroExpansion> |
34 | <BuildableReference | 34 | <BuildableReference |
35 | BuildableIdentifier = "primary" | 35 | BuildableIdentifier = "primary" |
36 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" | 36 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" |
37 | BuildableName = "GameSDKDemo.app" | 37 | BuildableName = "GameSDKDemo.app" |
38 | BlueprintName = "GameSDKDemo" | 38 | BlueprintName = "GameSDKDemo" |
39 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> | 39 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> |
40 | </BuildableReference> | 40 | </BuildableReference> |
41 | </MacroExpansion> | 41 | </MacroExpansion> |
42 | <AdditionalOptions> | 42 | <AdditionalOptions> |
43 | </AdditionalOptions> | 43 | </AdditionalOptions> |
44 | </TestAction> | 44 | </TestAction> |
45 | <LaunchAction | 45 | <LaunchAction |
46 | buildConfiguration = "Debug" | 46 | buildConfiguration = "Debug" |
47 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" | 47 | selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
48 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" | 48 | selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
49 | disableMainThreadChecker = "YES" | ||
49 | language = "" | 50 | language = "" |
50 | launchStyle = "0" | 51 | launchStyle = "0" |
51 | useCustomWorkingDirectory = "NO" | 52 | useCustomWorkingDirectory = "NO" |
52 | ignoresPersistentStateOnLaunch = "NO" | 53 | ignoresPersistentStateOnLaunch = "NO" |
53 | debugDocumentVersioning = "YES" | 54 | debugDocumentVersioning = "YES" |
54 | debugServiceExtension = "internal" | 55 | debugServiceExtension = "internal" |
55 | allowLocationSimulation = "YES"> | 56 | allowLocationSimulation = "YES"> |
56 | <BuildableProductRunnable | 57 | <BuildableProductRunnable |
57 | runnableDebuggingMode = "0"> | 58 | runnableDebuggingMode = "0"> |
58 | <BuildableReference | 59 | <BuildableReference |
59 | BuildableIdentifier = "primary" | 60 | BuildableIdentifier = "primary" |
60 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" | 61 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" |
61 | BuildableName = "GameSDKDemo.app" | 62 | BuildableName = "GameSDKDemo.app" |
62 | BlueprintName = "GameSDKDemo" | 63 | BlueprintName = "GameSDKDemo" |
63 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> | 64 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> |
64 | </BuildableReference> | 65 | </BuildableReference> |
65 | </BuildableProductRunnable> | 66 | </BuildableProductRunnable> |
66 | <EnvironmentVariables> | 67 | <EnvironmentVariables> |
67 | <EnvironmentVariable | 68 | <EnvironmentVariable |
68 | key = "OS_ACTIVITY_MODE" | 69 | key = "OS_ACTIVITY_MODE" |
69 | value = "disable" | 70 | value = "disable" |
70 | isEnabled = "YES"> | 71 | isEnabled = "YES"> |
71 | </EnvironmentVariable> | 72 | </EnvironmentVariable> |
72 | </EnvironmentVariables> | 73 | </EnvironmentVariables> |
73 | <AdditionalOptions> | 74 | <AdditionalOptions> |
74 | </AdditionalOptions> | 75 | </AdditionalOptions> |
75 | </LaunchAction> | 76 | </LaunchAction> |
76 | <ProfileAction | 77 | <ProfileAction |
77 | buildConfiguration = "Release" | 78 | buildConfiguration = "Release" |
78 | shouldUseLaunchSchemeArgsEnv = "YES" | 79 | shouldUseLaunchSchemeArgsEnv = "YES" |
79 | savedToolIdentifier = "" | 80 | savedToolIdentifier = "" |
80 | useCustomWorkingDirectory = "NO" | 81 | useCustomWorkingDirectory = "NO" |
81 | debugDocumentVersioning = "YES"> | 82 | debugDocumentVersioning = "YES"> |
82 | <BuildableProductRunnable | 83 | <BuildableProductRunnable |
83 | runnableDebuggingMode = "0"> | 84 | runnableDebuggingMode = "0"> |
84 | <BuildableReference | 85 | <BuildableReference |
85 | BuildableIdentifier = "primary" | 86 | BuildableIdentifier = "primary" |
86 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" | 87 | BlueprintIdentifier = "9934F1AD19303DC6005EF4AB" |
87 | BuildableName = "GameSDKDemo.app" | 88 | BuildableName = "GameSDKDemo.app" |
88 | BlueprintName = "GameSDKDemo" | 89 | BlueprintName = "GameSDKDemo" |
89 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> | 90 | ReferencedContainer = "container:GameSDKDemo.xcodeproj"> |
90 | </BuildableReference> | 91 | </BuildableReference> |
91 | </BuildableProductRunnable> | 92 | </BuildableProductRunnable> |
92 | </ProfileAction> | 93 | </ProfileAction> |
93 | <AnalyzeAction | 94 | <AnalyzeAction |
94 | buildConfiguration = "Debug"> | 95 | buildConfiguration = "Debug"> |
95 | </AnalyzeAction> | 96 | </AnalyzeAction> |
96 | <ArchiveAction | 97 | <ArchiveAction |
97 | buildConfiguration = "Release" | 98 | buildConfiguration = "Release" |
98 | revealArchiveInOrganizer = "YES"> | 99 | revealArchiveInOrganizer = "YES"> |
99 | </ArchiveAction> | 100 | </ArchiveAction> |
100 | </Scheme> | 101 | </Scheme> |
101 | 102 |
ios/GameSDKDemo/letsgameDemo/LSGAppDelegate.m
1 | // | 1 | // |
2 | // LSGAppDelegate.m | 2 | // LSGAppDelegate.m |
3 | // letsgameDemo | 3 | // letsgameDemo |
4 | // | 4 | // |
5 | // Created by zhy on 14-5-24. | 5 | // Created by zhy on 14-5-24. |
6 | // | 6 | // |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "LSGAppDelegate.h" | 9 | #import "LSGAppDelegate.h" |
10 | #import "LSGMainViewController.h" | 10 | #import "LSGMainViewController.h" |
11 | #import "LetsGameAPI.h" | 11 | #import "LetsGameAPI.h" |
12 | 12 | ||
13 | @implementation LSGAppDelegate | 13 | @implementation LSGAppDelegate |
14 | 14 | ||
15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions |
16 | { | 16 | { |
17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; | 17 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; |
18 | // [LetsGameAPI DeviceOrientationIsHorizontal:NO]; | 18 | // [LetsGameAPI DeviceOrientationIsHorizontal:NO]; |
19 | 19 | ||
20 | LSGMainViewController *viewController = [[LSGMainViewController alloc] init]; | 20 | LSGMainViewController *viewController = [[LSGMainViewController alloc] init]; |
21 | self.window.rootViewController = viewController; | 21 | self.window.rootViewController = viewController; |
22 | [self.window addSubview:viewController.view]; | 22 | [self.window addSubview:viewController.view]; |
23 | 23 | ||
24 | self.window.backgroundColor = [UIColor whiteColor]; | 24 | self.window.backgroundColor = [UIColor whiteColor]; |
25 | [self.window makeKeyAndVisible]; | 25 | [self.window makeKeyAndVisible]; |
26 | 26 | ||
27 | // [[LetsGameAPI instance] decideIsDebug:1]; | 27 | // [[LetsGameAPI instance] decideIsDebug:1]; |
28 | 28 | ||
29 | //显示是否侵权的接口 | 29 | //显示是否侵权的接口 |
30 | // [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { | 30 | [[LetsGameAPI instance] gameObtainSafeSetInfoWithAppId:@"10056" ChannelId:@"1000" handleCallBack:^(BOOL resultStatus) { |
31 | // if (resultStatus) { | 31 | if (resultStatus) { |
32 | // NSLog(@"YES 侵权"); | 32 | NSLog(@"YES 侵权"); |
33 | // }else{ | 33 | }else{ |
34 | // NSLog(@"NO 不侵权"); | 34 | NSLog(@"NO 不侵权"); |
35 | // } | 35 | } |
36 | // }]; | 36 | }]; |
37 | 37 | ||
38 | //微信登陆 | 38 | //微信登陆 |
39 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"100" appKey:@"f899139df5e1059396431415e770c6dd" Success:^{ | 39 | [[LetsGameAPI instance] registerAppWeChatWithAppId:@"100" appKey:@"f899139df5e1059396431415e770c6dd" Success:^{ |
40 | NSLog(@"注册成功"); | 40 | NSLog(@"注册成功"); |
41 | } failure:^{ | 41 | } failure:^{ |
42 | NSLog(@"注册失败"); | 42 | NSLog(@"注册失败"); |
43 | }]; | 43 | }]; |
44 | 44 | ||
45 | [[UIApplication sharedApplication] setStatusBarHidden:YES]; | 45 | [[UIApplication sharedApplication] setStatusBarHidden:YES]; |
46 | [[LetsGameAPI instance] registeIapObserver]; | 46 | [[LetsGameAPI instance] registeIapObserver]; |
47 | 47 | ||
48 | return YES; | 48 | return YES; |
49 | } | 49 | } |
50 | 50 | ||
51 | - (void)applicationWillResignActive:(UIApplication *)application | 51 | - (void)applicationWillResignActive:(UIApplication *)application |
52 | { | 52 | { |
53 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | 53 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. |
54 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | 54 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. |
55 | } | 55 | } |
56 | 56 | ||
57 | - (void)applicationDidEnterBackground:(UIApplication *)application | 57 | - (void)applicationDidEnterBackground:(UIApplication *)application |
58 | { | 58 | { |
59 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. | 59 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. |
60 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. | 60 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. |
61 | } | 61 | } |
62 | 62 | ||
63 | - (void)applicationWillEnterForeground:(UIApplication *)application | 63 | - (void)applicationWillEnterForeground:(UIApplication *)application |
64 | { | 64 | { |
65 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. | 65 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. |
66 | } | 66 | } |
67 | 67 | ||
68 | -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ | 68 | -(BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation{ |
69 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; | 69 | return [[LetsGameAPI instance] handleOpenURL:url sourceApplication:sourceApplication]; |
70 | //return [[LetsGameAPI instance].vkBridge processOpenURL:url fromApplication:sourceApplication]; | 70 | //return [[LetsGameAPI instance].vkBridge processOpenURL:url fromApplication:sourceApplication]; |
71 | } | 71 | } |
72 | 72 | ||
73 | 73 | ||
74 | @end | 74 | @end |
75 | 75 |
ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
1 | // | 1 | // |
2 | // LSGMainViewController.m | 2 | // LSGMainViewController.m |
3 | // letsgameDemo | 3 | // letsgameDemo |
4 | // | 4 | // |
5 | // Created by zhy on 14-5-24. | 5 | // Created by zhy on 14-5-24. |
6 | // | 6 | // |
7 | // | 7 | // |
8 | 8 | ||
9 | #import "LSGMainViewController.h" | 9 | #import "LSGMainViewController.h" |
10 | #import "LetsGameAPI.h" | 10 | #import "LetsGameAPI.h" |
11 | #import "VKBridge.h" | 11 | #import "VKBridge.h" |
12 | 12 | ||
13 | 13 | ||
14 | @interface LSGMainViewController () | 14 | @interface LSGMainViewController () |
15 | 15 | ||
16 | @property (nonatomic, strong) UILabel *resultLabel; | 16 | @property (nonatomic, strong) UILabel *resultLabel; |
17 | 17 | ||
18 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; | 18 | @property(nonatomic,strong) UIButton *vkActivityShareBtn; |
19 | 19 | ||
20 | @property(nonatomic,copy) NSString *sessionKey; | 20 | @property(nonatomic,copy) NSString *sessionKey; |
21 | @end | 21 | @end |
22 | 22 | ||
23 | @implementation LSGMainViewController | 23 | @implementation LSGMainViewController |
24 | 24 | ||
25 | - (void)loadView { | 25 | - (void)loadView { |
26 | [super loadView]; | 26 | [super loadView]; |
27 | NSLog(@"i come in"); | 27 | NSLog(@"i come in"); |
28 | self.view.backgroundColor = [UIColor whiteColor]; | 28 | self.view.backgroundColor = [UIColor whiteColor]; |
29 | // self.view.backgroundColor = [UIColor blackColor]; | 29 | // self.view.backgroundColor = [UIColor blackColor]; |
30 | 30 | ||
31 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; | 31 | UIButton *btn = [[UIButton alloc] initWithFrame:CGRectMake(110, 40, 100, 30)]; |
32 | btn.backgroundColor = [UIColor orangeColor]; | 32 | btn.backgroundColor = [UIColor orangeColor]; |
33 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; | 33 | [btn setTitle:@"测试入口" forState:UIControlStateNormal]; |
34 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 34 | [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
35 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; | 35 | btn.titleLabel.font = [UIFont systemFontOfSize:15]; |
36 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; | 36 | [btn addTarget:self action:@selector(onClickTest) forControlEvents:UIControlEventTouchUpInside]; |
37 | [self.view addSubview:btn]; | 37 | [self.view addSubview:btn]; |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; | 41 | UIButton *bindtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 100, 100, 30)]; |
42 | bindtn.backgroundColor = [UIColor orangeColor]; | 42 | bindtn.backgroundColor = [UIColor orangeColor]; |
43 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; | 43 | [bindtn setTitle:@"退出账号" forState:UIControlStateNormal]; |
44 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 44 | [bindtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
45 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 45 | bindtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
46 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; | 46 | [bindtn addTarget:self action:@selector(onLogoutTest) forControlEvents:UIControlEventTouchUpInside]; |
47 | [self.view addSubview:bindtn]; | 47 | [self.view addSubview:bindtn]; |
48 | 48 | ||
49 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; | 49 | UIButton *payBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 160, 100, 30)]; |
50 | payBtn.backgroundColor = [UIColor orangeColor]; | 50 | payBtn.backgroundColor = [UIColor orangeColor]; |
51 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; | 51 | [payBtn setTitle:@"支付" forState:UIControlStateNormal]; |
52 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 52 | [payBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
53 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 53 | payBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
54 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; | 54 | [payBtn addTarget:self action:@selector(onPayTest) forControlEvents:UIControlEventTouchUpInside]; |
55 | [self.view addSubview:payBtn]; | 55 | [self.view addSubview:payBtn]; |
56 | 56 | ||
57 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; | 57 | UIButton *iapBtn = [[UIButton alloc] initWithFrame:CGRectMake(110, 220, 100, 30)]; |
58 | iapBtn.backgroundColor = [UIColor orangeColor]; | 58 | iapBtn.backgroundColor = [UIColor orangeColor]; |
59 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; | 59 | [iapBtn setTitle:@"IAP" forState:UIControlStateNormal]; |
60 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; | 60 | [iapBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; |
61 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; | 61 | iapBtn.titleLabel.font = [UIFont systemFontOfSize:15]; |
62 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; | 62 | [iapBtn addTarget:self action:@selector(onIapTest) forControlEvents:UIControlEventTouchUpInside]; |
63 | [self.view addSubview:iapBtn]; | 63 | [self.view addSubview:iapBtn]; |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | - (UILabel *)resultLabel { | 67 | - (UILabel *)resultLabel { |
68 | if (!_resultLabel) { | 68 | if (!_resultLabel) { |
69 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; | 69 | _resultLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.view.frame) - 90, self.view.frame.size.width, 60)]; |
70 | _resultLabel.backgroundColor = [UIColor clearColor]; | 70 | _resultLabel.backgroundColor = [UIColor clearColor]; |
71 | _resultLabel.textAlignment = NSTextAlignmentCenter; | 71 | _resultLabel.textAlignment = NSTextAlignmentCenter; |
72 | _resultLabel.textColor = [UIColor redColor]; | 72 | _resultLabel.textColor = [UIColor redColor]; |
73 | _resultLabel.font = [UIFont systemFontOfSize:15]; | 73 | _resultLabel.font = [UIFont systemFontOfSize:15]; |
74 | _resultLabel.numberOfLines = 4; | 74 | _resultLabel.numberOfLines = 4; |
75 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; | 75 | _resultLabel.lineBreakMode = NSLineBreakByWordWrapping; |
76 | [self.view addSubview:_resultLabel]; | 76 | [self.view addSubview:_resultLabel]; |
77 | } | 77 | } |
78 | 78 | ||
79 | return _resultLabel; | 79 | return _resultLabel; |
80 | } | 80 | } |
81 | 81 | ||
82 | 82 | ||
83 | - (void)onClickTest { | 83 | - (void)onClickTest { |
84 | 84 | ||
85 | [LetsGameAPI instance].appId = @"100";//@"100";//10047 | 85 | [LetsGameAPI instance].appId = @"100";//10047 |
86 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";//@"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf | 86 | [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf |
87 | [LetsGameAPI instance].channelId = @"10010"; | 87 | [LetsGameAPI instance].channelId = @"10010"; |
88 | [LetsGameAPI hiddenLogo:YES]; | 88 | [LetsGameAPI hiddenLogo:YES]; |
89 | // [LetsGameAPI disableFB:YES]; | 89 | // [LetsGameAPI disableFB:YES]; |
90 | // [LetsGameAPI disableGoogle:YES]; | 90 | // [LetsGameAPI disableGoogle:YES]; |
91 | // [LetsGameAPI disableLine:YES]; | 91 | // [LetsGameAPI disableLine:YES]; |
92 | // [LetsGameAPI disableWeChat:YES]; | 92 | // [LetsGameAPI disableWeChat:YES]; |
93 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); | 93 | NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]); |
94 | //启用vk登录 | 94 | //启用vk登录 |
95 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; | 95 | VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"]; |
96 | [LetsGameAPI instance].vkBridge = vkBridge; | 96 | [LetsGameAPI instance].vkBridge = vkBridge; |
97 | 97 | ||
98 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { | 98 | [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) { |
99 | self.sessionKey = sessionKey; | 99 | self.sessionKey = sessionKey; |
100 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; | 100 | self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type]; |
101 | }; | 101 | }; |
102 | [LetsGameAPI instance].dismissBlock = ^() { | 102 | [LetsGameAPI instance].dismissBlock = ^() { |
103 | self.resultLabel.text = @"dismiss without login"; | 103 | self.resultLabel.text = @"dismiss without login"; |
104 | }; | 104 | }; |
105 | 105 | ||
106 | [[LetsGameAPI instance] showLoginView]; | 106 | [[LetsGameAPI instance] showLoginView]; |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | - (void)onLogoutTest { | 110 | - (void)onLogoutTest { |
111 | [LetsGameAPI instance].appId = @"10056"; | 111 | [LetsGameAPI instance].appId = @"10056"; |
112 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; | 112 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; |
113 | [[LetsGameAPI instance] logout]; | 113 | [[LetsGameAPI instance] logout]; |
114 | 114 | ||
115 | } | 115 | } |
116 | 116 | ||
117 | -(void)onPayTest{ | 117 | -(void)onPayTest{ |
118 | [LetsGameAPI instance].appId = @"10022";//@"10056";//10022 | 118 | [LetsGameAPI instance].appId = @"10022";//@"10056";//10022 |
119 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";//@"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab | 119 | [LetsGameAPI instance].appKey = @"93a27b0bd99bac3e68a440b48aa421ab";//@"b59c21a078fde074a6750e91ed19fb21";//93a27b0bd99bac3e68a440b48aa421ab |
120 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 120 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
121 | [payInfo setValue:@"100" forKey:@"serverId"]; | 121 | [payInfo setValue:@"100" forKey:@"serverId"]; |
122 | [payInfo setValue:@"10010" forKey:@"roleId"]; | 122 | [payInfo setValue:@"10010" forKey:@"roleId"]; |
123 | [payInfo setValue:@"1000" forKey:@"channelId"]; | 123 | [payInfo setValue:@"1000" forKey:@"channelId"]; |
124 | [payInfo setValue:@"10" forKey:@"amount"]; | 124 | [payInfo setValue:@"10" forKey:@"amount"]; |
125 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 125 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
126 | [payInfo setValue:@"test" forKey:@"product"]; | 126 | [payInfo setValue:@"test" forKey:@"product"]; |
127 | [payInfo setValue:@"76c17cc68ff9f7f40bd3d096ccc5600a" forKey:@"sessionKey"]; //self.sessionKey | 127 | [payInfo setValue:@"76c17cc68ff9f7f40bd3d096ccc5600a" forKey:@"sessionKey"]; //self.sessionKey |
128 | [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ | 128 | [[LetsGameAPI instance] pay:payInfo handleCallBack:^{ |
129 | NSLog(@"第三方支付完成"); | 129 | NSLog(@"第三方支付完成"); |
130 | }]; | 130 | }]; |
131 | } | 131 | } |
132 | 132 | ||
133 | -(void)onIapTest{ | 133 | -(void)onIapTest{ |
134 | [LetsGameAPI instance].appId = @"10056"; | 134 | [LetsGameAPI instance].appId = @"10056"; |
135 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; | 135 | [LetsGameAPI instance].appKey = @"b59c21a078fde074a6750e91ed19fb21"; |
136 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; | 136 | NSMutableDictionary *payInfo = [NSMutableDictionary dictionary]; |
137 | [payInfo setValue:@"5001" forKey:@"serverId"]; | 137 | [payInfo setValue:@"5001" forKey:@"serverId"]; |
138 | [payInfo setValue:@"10010" forKey:@"roleId"]; | 138 | [payInfo setValue:@"10010" forKey:@"roleId"]; |
139 | [payInfo setValue:@"1000" forKey:@"channelId"]; | 139 | [payInfo setValue:@"1000" forKey:@"channelId"]; |
140 | [payInfo setValue:@"10" forKey:@"amount"]; | 140 | [payInfo setValue:@"10" forKey:@"amount"]; |
141 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; | 141 | [payInfo setValue:@"ios demo" forKey:@"extraInfo"]; |
142 | [payInfo setValue:@"test.product.1" forKey:@"product"]; | 142 | [payInfo setValue:@"test.product.1" forKey:@"product"]; |
143 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { | 143 | [[LetsGameAPI instance] iap:payInfo forUser:@"" succCallback:^(NSString *orderId) { |
144 | //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准 | 144 | //注意测试仅仅是通知客户端成功,但是还需要向服务器请求验证是否成功,以服务端验证为准 |
145 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); | 145 | NSLog(@"IAP completed orderId of Gumptech:%@",orderId); |
146 | } failCallback:^(NSString *orderId) { | 146 | } failCallback:^(NSString *orderId) { |
147 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); | 147 | NSLog(@"IAP file orderId of Gumptech:%@",orderId); |
148 | }]; | 148 | }]; |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | - (BOOL)shouldAutorotate { | 152 | - (BOOL)shouldAutorotate { |
153 | return YES; | 153 | return YES; |
154 | } | 154 | } |
155 | 155 | ||
156 | -(UIInterfaceOrientationMask)supportedInterfaceOrientations{ | 156 | -(UIInterfaceOrientationMask)supportedInterfaceOrientations{ |
157 | return UIInterfaceOrientationMaskAll; | 157 | return UIInterfaceOrientationMaskAll; |
158 | } | 158 | } |
159 | 159 | ||
160 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { | 160 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { |
161 | return YES; | 161 | return YES; |
162 | } | 162 | } |
163 | 163 | ||
164 | @end | 164 | @end |
165 | 165 |
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='%@' ,channelId='%@'; | 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(){ | 26 | window[bridge]['getChannelId']=function getChannelId(){ |
27 | return channelId; | 27 | return channelId; |
28 | }; | 28 | }; |
29 | 29 | ||
30 | window[bridge]['closeWin'] = function closeWin(uid,nick,sessionKey){ | 30 | window[bridge]['closeWin'] = function closeWin(uid,nick,sessionKey){ |
31 | 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)); |
32 | }; | 32 | }; |
33 | //var methods = ["closeWin(uid,nick,sessionKey)"]; | 33 | //var methods = ["closeWin(uid,nick,sessionKey)"]; |
34 | //var methodsWithoutParam =["closeWin"]; | 34 | //var methodsWithoutParam =["closeWin"]; |
35 | //for (var i=0;i<methods.length;i++){ | 35 | //for (var i=0;i<methods.length;i++){ |
36 | // var method = methods[i]; | 36 | // var method = methods[i]; |
37 | // var methodWithoutParam = methodsWithoutParam[i]; | 37 | // var methodWithoutParam = methodsWithoutParam[i]; |
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);}"; | 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);}"; |
39 | // eval(code); | 39 | // eval(code); |
40 | //} | 40 | //} |
41 | 41 | ||
42 | //创建iframe,必须在创建app之后,否则会出现死循环 | 42 | //创建iframe,必须在创建app之后,否则会出现死循环 |
43 | _createQueueReadyIframe(document); | 43 | _createQueueReadyIframe(document); |
44 | //通知js开始初始化 | 44 | //通知js开始初始化 |
45 | //alert('onInjectJsOver='+typeof(onInjectJsOver)); | 45 | //alert('onInjectJsOver='+typeof(onInjectJsOver)); |
46 | if(typeof(onInjectJsOver)=='function') | 46 | if(typeof(onInjectJsOver)=='function') |
47 | onInjectJsOver(); | 47 | onInjectJsOver(); |
48 | 48 | ||
49 | })(); | 49 | })(); |
50 |