Commit 050bf633108841b85bc6a34395e304638f5dfd85

Authored by alexYang
1 parent 90eed546b9
Exists in master

1、新增sdk登录初始化接口 2、修改weChat登录初始化接口

Showing 9 changed files with 137 additions and 125 deletions Side-by-side Diff

... ... @@ -2,8 +2,8 @@
2 2  
3 3  
4 4 接入手册
5   -V 3.5.22
6   -2018年8月31日
  5 +V 3.5.23
  6 +2018年9月6日
7 7  
8 8 ## 概述
9 9 #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。
... ... @@ -44,32 +44,47 @@ Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifi
44 44 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
45 45 [LetsGameAPI instance].channelId = @"100"; //设置channelId
46 46  
47   - //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
48   - //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
49   - //[LetsGameAPI instance].vkBridge = vkBridge;
  47 + //sdk login 初始化
  48 + [[LetsGameAPI instance] SDKLoginInitofResponse:^(BOOL result) {
  49 + if (result) {
  50 + NSLog(@"初始化成功");
  51 + //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
  52 + VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
  53 + [LetsGameAPI instance].vkBridge = vkBridge;
  54 + //启用wechat的代码,需要注册,若不接入wechat,可以忽略
  55 + [[LetsGameAPI instance] registerAppWeChatOfSuccess:^{
  56 + NSLog(@"注册成功");
  57 + } failure:^{
  58 + NSLog(@"注册失败");
  59 + }];
  60 + //隐藏fb登录
  61 + [LetsGameAPI disableFB:YES];
  62 + //隐藏Google登录
  63 + [LetsGameAPI disableGoogle:YES];
  64 + //隐藏gumptech的logo
  65 + [LetsGameAPI hiddenLogo:YES];
  66 + //隐藏line登录
  67 + [LetsGameAPI disableLine:YES];
  68 + //隐藏wechat登录
  69 + [LetsGameAPI disableWeChat:YES];
  70 +
  71 + [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
  72 +
  73 + // 登录成功回调
  74 + [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
  75 + NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
  76 + };
  77 +
  78 + // 登录失败回调,需要游戏自己处理
  79 + [LetsGameAPI instance].dismissBlock = ^() {
  80 + NSLog(@"dismiss without login");
  81 + };
  82 + }else{
  83 + NSLog(@"初始化失败");
  84 + }];
50 85  
51   - //隐藏fb登录
52   - [LetsGameAPI disableFB:YES];
53   - //隐藏Google登录
54   - [LetsGameAPI disableGoogle:YES];
55   - //隐藏gumptech的logo
56   - [LetsGameAPI hiddenLogo:YES];
57   - //隐藏line登录
58   - [LetsGameAPI disableLine:YES];
59   - //隐藏wechat登录
60   - [LetsGameAPI disableWeChat:YES];
61   -
62   - [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
63   -
64   - // 登录成功回调
65   - [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
66   - NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
67   - };
68   -
69   - // 登录失败回调,需要游戏自己处理
70   - [LetsGameAPI instance].dismissBlock = ^() {
71   - NSLog(@"dismiss without login");
72   - };
  86 +
  87 +
73 88  
74 89 ### 5、登录注销
75 90 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。
... ... @@ -162,25 +177,13 @@ FB登录之后会产生token并自动登录,需要如果需要token的话,
162 177  
163 178  
164 179  
165   -
166   -### 12、微信登陆
167   -
168   - 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用
169   - //微信登陆
170   - [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{
171   - NSLog(@"注册成功");
172   - } failure:^{
173   - NSLog(@"注册失败");
174   - }];
175   -
176   -
177   -### 13、CocoaPods集成
  180 +### 12、CocoaPods集成
178 181 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。
179 182 ```
180 183 pod 'GameSDK', '~> 3.5.5'
181 184 ```
182 185  
183   -### 14、活动添加
  186 +### 13、活动添加
184 187 添加项目GameActivitySDK.framework
185 188 设置:设置xxxx.plist
186 189 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES
... ... @@ -2,8 +2,8 @@
2 2  
3 3  
4 4 接入手册
5   -V 3.5.22
6   -2018年8月31日
  5 +V 3.5.23
  6 +2018年9月6日
7 7  
8 8 ## 概述
9 9 #### 本SDK提供gump账号,fb账号,vk账号,Google帐号四种账号登录,iap支付和第三方支付两种支付功能,其中gump账号登录和fb账号登录功能为必须接入,支付可根据需要选择性接入。
... ... @@ -44,32 +44,47 @@ Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifi
44 44 [LetsGameAPI instance].appKey = @"100"; // 设置appKey
45 45 [LetsGameAPI instance].channelId = @"100"; //设置channelId
46 46  
47   - //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
48   - //VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
49   - //[LetsGameAPI instance].vkBridge = vkBridge;
  47 + //sdk login 初始化
  48 + [[LetsGameAPI instance] SDKLoginInitofResponse:^(BOOL result) {
  49 + if (result) {
  50 + NSLog(@"初始化成功");
  51 + //启用vk的代码,需要填入vk appId,若不接入vk,可以忽略
  52 + VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
  53 + [LetsGameAPI instance].vkBridge = vkBridge;
  54 + //启用wechat的代码,需要注册,若不接入wechat,可以忽略
  55 + [[LetsGameAPI instance] registerAppWeChatOfSuccess:^{
  56 + NSLog(@"注册成功");
  57 + } failure:^{
  58 + NSLog(@"注册失败");
  59 + }];
  60 + //隐藏fb登录
  61 + [LetsGameAPI disableFB:YES];
  62 + //隐藏Google登录
  63 + [LetsGameAPI disableGoogle:YES];
  64 + //隐藏gumptech的logo
  65 + [LetsGameAPI hiddenLogo:YES];
  66 + //隐藏line登录
  67 + [LetsGameAPI disableLine:YES];
  68 + //隐藏wechat登录
  69 + [LetsGameAPI disableWeChat:YES];
  70 +
  71 + [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
  72 +
  73 + // 登录成功回调
  74 + [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
  75 + NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
  76 + };
  77 +
  78 + // 登录失败回调,需要游戏自己处理
  79 + [LetsGameAPI instance].dismissBlock = ^() {
  80 + NSLog(@"dismiss without login");
  81 + };
  82 + }else{
  83 + NSLog(@"初始化失败");
  84 + }];
50 85  
51   - //隐藏fb登录
52   - [LetsGameAPI disableFB:YES];
53   - //隐藏Google登录
54   - [LetsGameAPI disableGoogle:YES];
55   - //隐藏gumptech的logo
56   - [LetsGameAPI hiddenLogo:YES];
57   - //隐藏line登录
58   - [LetsGameAPI disableLine:YES];
59   - //隐藏wechat登录
60   - [LetsGameAPI disableWeChat:YES];
61   -
62   - [[LetsGameAPI instance] showLoginView]; // 弹出登录页面
63   -
64   - // 登录成功回调
65   - [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
66   - NSLog(@"%@", [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %d", userId, sessionKey, type]);
67   - };
68   -
69   - // 登录失败回调,需要游戏自己处理
70   - [LetsGameAPI instance].dismissBlock = ^() {
71   - NSLog(@"dismiss without login");
72   - };
  86 +
  87 +
73 88  
74 89 ### 5、登录注销
75 90 注销接口只要设置过appId和appKey之后就不需要设置了,注销完成之后会回到登录界面。FB登录回到登录页面,Gump登录或者游客登录回到登录框。
... ... @@ -88,7 +103,7 @@ Xcode 4: Open your Info.plist then add a new row URL Types. Set the URL identifi
88 103 [payInfo setValue:@"1000" forKey:@"channelId"];//渠道id
89 104 [payInfo setValue:@"10" forKey:@"amount"];//金额
90 105 [payInfo setValue:@"ios demo" forKey:@"extraInfo"];//外部订单信息
91   - [payInfo setValue:@"元宝" forKey:@"product"];//物品信息
  106 + [payInfo setValue:@"元宝" forKey:@"product"];//物品ID
92 107 [payInfo setValue:self.sessionKey forKey:@"sessionKey"];//登录成功的sessionKey
93 108 [[LetsGameAPI instance] pWeb:payInfo handleCallBack:^{
94 109 //第三方支付完成时的回调(包括支付成功和支付失败,除了支付过程中取消的),取消的不会有回调
... ... @@ -162,25 +177,13 @@ FB登录之后会产生token并自动登录,需要如果需要token的话,
162 177  
163 178  
164 179  
165   -
166   -### 12、微信登陆
167   -
168   - 首先在- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;方法中向微信注册应用
169   - //微信登陆
170   - [[LetsGameAPI instance] registerAppWeChatWithAppId:@"appId" appKey:@"appKey" Success:^{
171   - NSLog(@"注册成功");
172   - } failure:^{
173   - NSLog(@"注册失败");
174   - }];
175   -
176   -
177   -### 13、CocoaPods集成
  180 +### 12、CocoaPods集成
178 181 集成项目的.framework和bundle,但是vk登录封装的VK.framework,需要自己手动添加。
179 182 ```
180 183 pod 'GameSDK', '~> 3.5.5'
181 184 ```
182 185  
183   -### 14、活动添加
  186 +### 13、活动添加
184 187 添加项目GameActivitySDK.framework
185 188 设置:设置xxxx.plist
186 189 只支持HTTP的方式,需要将相应的项目的xxx.plist添加Information Property List->App Transport Security Settings -> Allow Arbitrary Loads设置为YES
ios/GameSDK.framework/Versions/A/GameSDK
No preview for this file type
ios/GameSDK.framework/Versions/A/Headers/LetsGameAPI.h
... ... @@ -22,7 +22,7 @@ static BOOL hiddenLogo = NO;
22 22 //默认横屏
23 23 static BOOL DeviceOrientationIsHorizontal = YES;
24 24  
25   -static NSString *version = @"3.5.22";
  25 +static NSString *version = @"3.5.23";
26 26  
27 27 @interface LetsGameAPI : NSObject<UIApplicationDelegate>
28 28  
... ... @@ -39,7 +39,7 @@ static NSString *version = @&quot;3.5.22&quot;;
39 39 + (instancetype)instance;
40 40  
41 41 -(NSString*)version;
42   -
  42 +- (void)SDKLoginInitofResponse:(void (^)(BOOL result))response;
43 43 - (void)showLoginView;
44 44 - (void)showLoginViewInView:(UIView *)view;
45 45  
... ... @@ -63,9 +63,7 @@ static NSString *version = @&quot;3.5.22&quot;;
63 63 //是否安装微信
64 64 -(BOOL)isWeChatInstall;
65 65 //向微信注册应用
66   --(void)registerAppWeChatWithAppId:(NSString *)appId
67   - appKey:(NSString *)appKey
68   - Success:(void (^)())success
  66 +-(void)registerAppWeChatOfSuccess:(void (^)())success
69 67 failure:(void (^)())failure;
70 68  
71 69 - (BOOL)handleOpenURL:(NSURL *)url
No preview for this file type
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.pbxproj
... ... @@ -238,7 +238,7 @@
238 238 LastUpgradeCheck = 0710;
239 239 TargetAttributes = {
240 240 9934F1AD19303DC6005EF4AB = {
241   - DevelopmentTeam = 295DL9M69R;
  241 + DevelopmentTeam = NA5R6CY7V3;
242 242 ProvisioningStyle = Manual;
243 243 SystemCapabilities = {
244 244 com.apple.InAppPurchase = {
... ... @@ -403,7 +403,7 @@
403 403 CODE_SIGN_IDENTITY = "iPhone Developer";
404 404 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
405 405 CODE_SIGN_STYLE = Manual;
406   - DEVELOPMENT_TEAM = 295DL9M69R;
  406 + DEVELOPMENT_TEAM = NA5R6CY7V3;
407 407 ENABLE_BITCODE = NO;
408 408 FRAMEWORK_SEARCH_PATHS = (
409 409 "$(PROJECT_DIR)/../**",
... ... @@ -424,10 +424,10 @@
424 424 ONLY_ACTIVE_ARCH = YES;
425 425 OTHER_LDFLAGS = "-ObjC";
426 426 PRIVATE_HEADERS_FOLDER_PATH = "";
427   - PRODUCT_BUNDLE_IDENTIFIER = com.dgb.yc66;
  427 + PRODUCT_BUNDLE_IDENTIFIER = com.game.GumpSDK;
428 428 PRODUCT_NAME = GameSDKDemo;
429   - PROVISIONING_PROFILE = "29f6538c-7a08-4d57-b4d3-b68933206e3f";
430   - PROVISIONING_PROFILE_SPECIFIER = "iOS Development";
  429 + PROVISIONING_PROFILE = "372cbec4-6feb-49c5-9ce3-54831ae1316f";
  430 + PROVISIONING_PROFILE_SPECIFIER = comgameGumpSDKDev;
431 431 PUBLIC_HEADERS_FOLDER_PATH = "";
432 432 WRAPPER_EXTENSION = app;
433 433 };
... ... @@ -441,9 +441,9 @@
441 441 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
442 442 ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
443 443 CODE_SIGN_IDENTITY = "iPhone Developer";
444   - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution";
  444 + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
445 445 CODE_SIGN_STYLE = Manual;
446   - DEVELOPMENT_TEAM = 295DL9M69R;
  446 + DEVELOPMENT_TEAM = NA5R6CY7V3;
447 447 ENABLE_BITCODE = NO;
448 448 FRAMEWORK_SEARCH_PATHS = (
449 449 "$(PROJECT_DIR)/../**",
... ... @@ -464,10 +464,10 @@
464 464 ONLY_ACTIVE_ARCH = YES;
465 465 OTHER_LDFLAGS = "-ObjC";
466 466 PRIVATE_HEADERS_FOLDER_PATH = "";
467   - PRODUCT_BUNDLE_IDENTIFIER = com.dgb.yc66;
  467 + PRODUCT_BUNDLE_IDENTIFIER = com.game.GumpSDK;
468 468 PRODUCT_NAME = GameSDKDemo;
469   - PROVISIONING_PROFILE = "4f58b9c2-544a-46af-9746-9155e6c0c5cc";
470   - PROVISIONING_PROFILE_SPECIFIER = Distribution;
  469 + PROVISIONING_PROFILE = "372cbec4-6feb-49c5-9ce3-54831ae1316f";
  470 + PROVISIONING_PROFILE_SPECIFIER = comgameGumpSDKDev;
471 471 PUBLIC_HEADERS_FOLDER_PATH = "";
472 472 WRAPPER_EXTENSION = app;
473 473 };
ios/GameSDKDemo/GameSDKDemo.xcodeproj/project.xcworkspace/xcuserdata/yanglele.xcuserdatad/UserInterfaceState.xcuserstate
No preview for this file type
ios/GameSDKDemo/letsgameDemo/LSGAppDelegate.m
... ... @@ -36,13 +36,6 @@
36 36 NSLog(@"NO 不侵权");
37 37 }
38 38 }];
39   -
40   - //微信登陆
41   -// [[LetsGameAPI instance] registerAppWeChatWithAppId:@"100" appKey:@"f899139df5e1059396431415e770c6dd" Success:^{
42   -// NSLog(@"注册成功");
43   -// } failure:^{
44   -// NSLog(@"注册失败");
45   -// }];
46 39  
47 40 [[UIApplication sharedApplication] setStatusBarHidden:YES];
48 41 [[LetsGameAPI instance] registeIapObserver];
ios/GameSDKDemo/letsgameDemo/LSGMainViewController.m
... ... @@ -91,29 +91,44 @@
91 91  
92 92 - (void)onClickTest {
93 93  
94   - [LetsGameAPI instance].appId = @"10105";//@"100";//10047
95   - [LetsGameAPI instance].appKey = @"4c0a7bdd46ceb88d497eec5de360328e";//@"f899139df5e1059396431415e770c6dd";//eccd9f7dc92858b741132fda313130cf
  94 + [LetsGameAPI instance].appId = @"100";
  95 + [LetsGameAPI instance].appKey = @"f899139df5e1059396431415e770c6dd";
96 96 [LetsGameAPI instance].channelId = @"1000";
97 97 [LetsGameAPI hiddenLogo:YES];
98   -// [LetsGameAPI disableFB:YES];
99   -// [LetsGameAPI disableGoogle:YES];
100   -// [LetsGameAPI disableLine:YES];
101   -// [LetsGameAPI disableWeChat:YES];
102 98 NSLog(@"sdk version:%@",[[LetsGameAPI instance] version]);
103   - //启用vk登录
104   - VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
105   - [LetsGameAPI instance].vkBridge = vkBridge;
106   -
107   - [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
108   - self.sessionKey = sessionKey;
109   - self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type];
110   - };
111   - [LetsGameAPI instance].dismissBlock = ^() {
112   - //登录失败操作
113   - self.resultLabel.text = @"dismiss without login";
114   - };
115   -
116   - [[LetsGameAPI instance] showLoginView];
  99 + //sdk login 初始化
  100 + [[LetsGameAPI instance] SDKLoginInitofResponse:^(BOOL result) {
  101 + if (result) {
  102 + NSLog(@"初始化成功");
  103 + // [LetsGameAPI disableFB:YES];
  104 + // [LetsGameAPI disableGoogle:YES];
  105 + // [LetsGameAPI disableLine:YES];
  106 + // [LetsGameAPI disableWeChat:YES];
  107 + //启用vk登录
  108 + VKBridge *vkBridge = [[VKBridge alloc] initWithVKAppId:@"5029792"];
  109 + [LetsGameAPI instance].vkBridge = vkBridge;
  110 + //微信登陆
  111 + [[LetsGameAPI instance] registerAppWeChatOfSuccess:^{
  112 + NSLog(@"注册成功");
  113 + } failure:^{
  114 + NSLog(@"注册失败");
  115 + }];
  116 +
  117 + [LetsGameAPI instance].succBlock = ^(NSString *userId, NSString *sessionKey, LSGAccountType type) {
  118 + self.sessionKey = sessionKey;
  119 + self.resultLabel.text = [NSString stringWithFormat:@"login succ: userId = %@, sessionKey = %@, accountType = %ld", userId, sessionKey, type];
  120 + };
  121 + [LetsGameAPI instance].dismissBlock = ^() {
  122 + //登录失败操作
  123 + self.resultLabel.text = @"dismiss without login";
  124 + };
  125 +
  126 + [[LetsGameAPI instance] showLoginView];
  127 + }else{
  128 + NSLog(@"初始化失败");
  129 + }
  130 + }];
  131 +
117 132 }
118 133  
119 134