From 804d364e5335df5135eb972e4f39804a944b0cd6 Mon Sep 17 00:00:00 2001
From: MacBuilder <MacBuilder@secondworld.com>
Date: 星期二, 21 八月 2018 22:28:00 +0800
Subject: [PATCH] Fixed IOS SDK 增加今日头条sdk; Fixed IOS SDK 接入今日头条sdk; Fixed IOS 切换账号没有回调事件;

---
 Assets/Plugins/iOS/The2thWorldSDK/UniversalSDK.mm |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/Assets/Plugins/iOS/The2thWorldSDK/UniversalSDK.mm b/Assets/Plugins/iOS/The2thWorldSDK/UniversalSDK.mm
index 62044bc..6e88c97 100644
--- a/Assets/Plugins/iOS/The2thWorldSDK/UniversalSDK.mm
+++ b/Assets/Plugins/iOS/The2thWorldSDK/UniversalSDK.mm
@@ -15,6 +15,7 @@
 #import <UserNotifications/UserNotifications.h>
 #endif
 #import "SystemConfiguration/CaptiveNetwork.h"
+#import <TTTracker/TTTracker+Game.h>
 
 @interface UniversalSDK()<JPUSHRegisterDelegate>
 @end
@@ -81,6 +82,9 @@
     
     // 鐑簯鍒濆鍖�
     [Tracking initWithAppKey:@"3c3724431309474be938e0b64d4ad74f" withChannelId:@"_default_"];
+    
+    // 浠婃棩澶存潯
+    [TTTracker startWithAppID:@"151709" channel:@"ios-snqxz" appName:@"灏戝勾濂囦緺浼�"];
     
     // 鍙戦�佸垵濮嬪寲瀹屾垚
     [_dict removeAllObjects];
@@ -184,6 +188,8 @@
     [self SendMessageToUnity:_dict];
     
     [Tracking setRegisterWithAccountID:_account.identifier];
+    
+    [TTTracker registerEventByMethod:@"freesdk" isSuccess:YES];
 }
 
 -(void) FreeSDKLoginOK
@@ -362,6 +368,12 @@
                 [FreeSDK logout];
             }
             [FreeSDK presentLoginDialog:nil];
+            
+            NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys:
+                                   [NSNumber numberWithInt:S2U_FreePlatformLogoutOk], @"code", nil];
+            
+            [self SendMessageToUnity:_dict];
+            
             break;
         }
         case U2S_FreePlatformPay:
@@ -370,9 +382,26 @@
             _order.identifier = [_dict objectForKey:@"identifier"];
             _order.title = [_dict objectForKey:@"title"];
             _order.cpInfo = [_dict objectForKey:@"cpInfo"];
-            _order.cpOrderId = [_dict objectForKey:@"cpOrderId"];
-            _order.total = [[_dict objectForKey:@"total"] floatValue];
+            _order.cpOrderId = [_dict objectForKey:@"orderId"];
+            _order.total = [[_dict objectForKey:@"mount"] floatValue];
             [FreeSDK pay:_order];
+        }
+            break;
+        case U2S_PayFinished:
+        {
+            [Tracking setRyzf:[_dict objectForKey:@"orderID"]
+                     ryzfType:@"freesdk"
+                       hbType:[_dict objectForKey:@"moneyType"]
+                     hbAmount:[[_dict objectForKey:@"money"] floatValue]];
+            
+            [TTTracker purchaseEventWithContentType:@""
+                                        contentName:@""
+                                          contentID:@""
+                                      contentNumber:1
+                                     paymentChannel:@"freesdk"
+                                           currency:[_dict objectForKey:@"moneyType"]
+                                    currency_amount:[[_dict objectForKey:@"money"] intValue]
+                                          isSuccess:YES];
         }
             break;
         case U2S_BatteryListenStart:
@@ -503,7 +532,7 @@
     while (len > 0)
     {
         int frame_opus_length = opus[0];
-        //int length = opus_decode(dec, opus + sizeof(char), frame_opus_length, pcm, s_frameSize, 0);
+        int length = opus_decode(dec, opus + sizeof(char), frame_opus_length, pcm, s_frameSize, 0);
         opus += sizeof(char) + frame_opus_length;
         pcm += s_frameSize;
         len = len - frame_opus_length - sizeof(char);

--
Gitblit v1.8.0