com.taptap.sdk.relationlite 4.6.1-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Mobile/Editor/NativeDependencies.xml +10 -0
- package/Mobile/Editor/NativeDependencies.xml.meta +7 -0
- package/Mobile/Editor/TapRelationLiteMobileProcessBuild.cs +20 -0
- package/Mobile/Editor/TapRelationLiteMobileProcessBuild.cs.meta +11 -0
- package/Mobile/Editor/TapSDK.RelationLite.Mobile.Editor.asmdef +19 -0
- package/Mobile/Editor/TapSDK.RelationLite.Mobile.Editor.asmdef.meta +7 -0
- package/Mobile/Editor.meta +8 -0
- package/Mobile/Runtime/TapSDK.RelationLite.Mobile.Runtime.asmdef +23 -0
- package/Mobile/Runtime/TapSDK.RelationLite.Mobile.Runtime.asmdef.meta +7 -0
- package/Mobile/Runtime/TapTapRelationLiteImpl.cs +405 -0
- package/Mobile/Runtime/TapTapRelationLiteImpl.cs.meta +11 -0
- package/Mobile/Runtime.meta +8 -0
- package/Mobile.meta +8 -0
- package/Runtime/Internal/Init/RelationLiteInitTask.cs +20 -0
- package/Runtime/Internal/Init/RelationLiteInitTask.cs.meta +11 -0
- package/Runtime/Internal/Init.meta +8 -0
- package/Runtime/Internal/TapTapRelationLiteManager.cs +103 -0
- package/Runtime/Internal/TapTapRelationLiteManager.cs.meta +11 -0
- package/Runtime/Internal.meta +8 -0
- package/Runtime/Public/FollowStatus.cs +20 -0
- package/Runtime/Public/FollowStatus.cs.meta +11 -0
- package/Runtime/Public/ITapTapRelationLite.cs +32 -0
- package/Runtime/Public/ITapTapRelationLite.cs.meta +11 -0
- package/Runtime/Public/ITapTapRelationLiteCallback.cs +9 -0
- package/Runtime/Public/ITapTapRelationLiteCallback.cs.meta +11 -0
- package/Runtime/Public/ITapTapRelationLiteRequestCallback.cs +16 -0
- package/Runtime/Public/ITapTapRelationLiteRequestCallback.cs.meta +11 -0
- package/Runtime/Public/RelationLiteUserInfo.cs +20 -0
- package/Runtime/Public/RelationLiteUserInfo.cs.meta +11 -0
- package/Runtime/Public/RelationLiteUserItem.cs +18 -0
- package/Runtime/Public/RelationLiteUserItem.cs.meta +11 -0
- package/Runtime/Public/TapTapRelationLite.cs +82 -0
- package/Runtime/Public/TapTapRelationLite.cs.meta +11 -0
- package/Runtime/Public.meta +8 -0
- package/Runtime/TapSDK.RelationLite.Runtime.asmdef +15 -0
- package/Runtime/TapSDK.RelationLite.Runtime.asmdef.meta +7 -0
- package/Runtime.meta +8 -0
- package/package.json +12 -0
- package/package.json.meta +7 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<?xml version="1.0" ?>
|
|
2
|
+
<dependencies>
|
|
3
|
+
<androidPackages>
|
|
4
|
+
<repositories>
|
|
5
|
+
<repository>https://repo.maven.apache.org/maven2</repository>
|
|
6
|
+
<repository>https://nexus.xmxdev.com/repository/maven-public</repository>
|
|
7
|
+
</repositories>
|
|
8
|
+
<androidPackage spec="com.taptap.sdk:tap-relation-lite-unity:4.6.1-alpha.13"/>
|
|
9
|
+
</androidPackages>
|
|
10
|
+
</dependencies>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEditor.Build.Reporting;
|
|
3
|
+
using TapSDK.Core.Editor;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.RelationLite.Mobile.Editor {
|
|
6
|
+
public class TapRelationLiteMobileProcessBuild : SDKLinkProcessBuild {
|
|
7
|
+
public override int callbackOrder => 0;
|
|
8
|
+
|
|
9
|
+
public override string LinkPath => "TapSDK/RelationLite/link.xml";
|
|
10
|
+
|
|
11
|
+
public override LinkedAssembly[] LinkedAssemblies => new LinkedAssembly[] {
|
|
12
|
+
new LinkedAssembly { Fullname = "TapSDK.RelationLite.Runtime" },
|
|
13
|
+
new LinkedAssembly { Fullname = "TapSDK.RelationLite.Mobile.Runtime" }
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
public override Func<BuildReport, bool> IsTargetPlatform => (report) => {
|
|
17
|
+
return BuildTargetUtils.IsSupportMobile(report.summary.platform);
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.RelationLite.Mobile.Editor",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:56f3da7a178484843974054bafe77e73",
|
|
5
|
+
"GUID:8880fb2a8006d444dbd9edc4ab2647af",
|
|
6
|
+
"GUID:d276369ee184b4cb69a14a9fe493e761"
|
|
7
|
+
],
|
|
8
|
+
"includePlatforms": [
|
|
9
|
+
"Editor"
|
|
10
|
+
],
|
|
11
|
+
"excludePlatforms": [],
|
|
12
|
+
"allowUnsafeCode": false,
|
|
13
|
+
"overrideReferences": false,
|
|
14
|
+
"precompiledReferences": [],
|
|
15
|
+
"autoReferenced": true,
|
|
16
|
+
"defineConstraints": [],
|
|
17
|
+
"versionDefines": [],
|
|
18
|
+
"noEngineReferences": false
|
|
19
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.RelationLite.Mobile.Runtime",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:8880fb2a8006d444dbd9edc4ab2647af",
|
|
5
|
+
"GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7",
|
|
6
|
+
"GUID:10560023d8780423cb943c7a324b69f2",
|
|
7
|
+
"GUID:6f33d8db82c9445088544f91d41e65a2"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [
|
|
10
|
+
"Android",
|
|
11
|
+
"iOS"
|
|
12
|
+
],
|
|
13
|
+
"excludePlatforms": [],
|
|
14
|
+
"allowUnsafeCode": false,
|
|
15
|
+
"overrideReferences": true,
|
|
16
|
+
"precompiledReferences": [
|
|
17
|
+
"Newtonsoft.Json.dll"
|
|
18
|
+
],
|
|
19
|
+
"autoReferenced": true,
|
|
20
|
+
"defineConstraints": [],
|
|
21
|
+
"versionDefines": [],
|
|
22
|
+
"noEngineReferences": false
|
|
23
|
+
}
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
using UnityEngine;
|
|
5
|
+
using TapSDK.Core;
|
|
6
|
+
using TapSDK.Core.Internal;
|
|
7
|
+
using TapSDK.Core.Internal.Utils;
|
|
8
|
+
using Newtonsoft.Json;
|
|
9
|
+
using System.Runtime.InteropServices;
|
|
10
|
+
#if UNITY_IOS
|
|
11
|
+
using UnityEngine.iOS;
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
namespace TapSDK.RelationLite
|
|
15
|
+
{
|
|
16
|
+
public class TapTapRelationLiteImpl : ITapTapRelationLite
|
|
17
|
+
{
|
|
18
|
+
private const string SERVICE_NAME = "BridgeRelationLiteService";
|
|
19
|
+
private static List<ITapTapRelationLiteCallback> callbacks = new List<ITapTapRelationLiteCallback>();
|
|
20
|
+
private static bool hasRegisterCallBack = false;
|
|
21
|
+
private string _clientId;
|
|
22
|
+
private TapTapRegionType _regionType;
|
|
23
|
+
|
|
24
|
+
public TapTapRelationLiteImpl()
|
|
25
|
+
{
|
|
26
|
+
EngineBridge.GetInstance().Register(
|
|
27
|
+
"com.taptap.sdk.relation.lite.unity.BridgeRelationLiteService",
|
|
28
|
+
"com.taptap.sdk.relation.lite.unity.BridgeRelationLiteServiceImpl");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
public void Init(string clientId, TapTapRegionType regionType)
|
|
32
|
+
{
|
|
33
|
+
_clientId = clientId;
|
|
34
|
+
_regionType = regionType;
|
|
35
|
+
Debug.Log($"TapTapRelationLite Init with clientId: {clientId}, regionType: {regionType}");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
public void SetOrientation(int orientation)
|
|
39
|
+
{
|
|
40
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
41
|
+
.Service(SERVICE_NAME)
|
|
42
|
+
.Method("setOrientation")
|
|
43
|
+
.Args("orientation", orientation)
|
|
44
|
+
.Callback(false)
|
|
45
|
+
.OnceTime(true)
|
|
46
|
+
.CommandBuilder());
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public void InviteGame()
|
|
50
|
+
{
|
|
51
|
+
Debug.Log("TapTapRelationLite InviteGame");
|
|
52
|
+
|
|
53
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
54
|
+
.Service(SERVICE_NAME)
|
|
55
|
+
.Method("inviteGame")
|
|
56
|
+
.Callback(false)
|
|
57
|
+
.OnceTime(true)
|
|
58
|
+
.CommandBuilder());
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
public void InviteTeam(string teamId)
|
|
62
|
+
{
|
|
63
|
+
Debug.Log($"TapTapRelationLite InviteTeam with teamId: {teamId}");
|
|
64
|
+
|
|
65
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
66
|
+
.Service(SERVICE_NAME)
|
|
67
|
+
.Method("inviteTeam")
|
|
68
|
+
.Args("teamId", teamId)
|
|
69
|
+
.Callback(false)
|
|
70
|
+
.OnceTime(true)
|
|
71
|
+
.CommandBuilder());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public void GetFriendsList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
75
|
+
{
|
|
76
|
+
Debug.Log($"TapTapRelationLite GetFriendsList with nextPageToken: {nextPageToken}");
|
|
77
|
+
|
|
78
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
79
|
+
.Service(SERVICE_NAME)
|
|
80
|
+
.Method("getFriendsList")
|
|
81
|
+
.Args("nextPageToken", nextPageToken)
|
|
82
|
+
.Callback(true)
|
|
83
|
+
.OnceTime(true)
|
|
84
|
+
.CommandBuilder(), (result) =>
|
|
85
|
+
{
|
|
86
|
+
if (callback == null) return;
|
|
87
|
+
|
|
88
|
+
try
|
|
89
|
+
{
|
|
90
|
+
if (result.code != Result.RESULT_SUCCESS || string.IsNullOrEmpty(result.content))
|
|
91
|
+
{
|
|
92
|
+
callback.OnFriendsListResult("", new List<RelationLiteUserItem>());
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
97
|
+
if (dic != null && dic.ContainsKey("next_page_token") && dic.ContainsKey("friends_list"))
|
|
98
|
+
{
|
|
99
|
+
string nextPage = SafeDictionary.GetValue<string>(dic, "next_page_token");
|
|
100
|
+
string jsonStr = SafeDictionary.GetValue<string>(dic, "friends_list");
|
|
101
|
+
List<RelationLiteUserItem> friendsList = JsonConvert.DeserializeObject<List<RelationLiteUserItem>>(jsonStr);
|
|
102
|
+
callback.OnFriendsListResult(nextPage, friendsList);
|
|
103
|
+
}
|
|
104
|
+
else
|
|
105
|
+
{
|
|
106
|
+
callback.OnFriendsListResult("", new List<RelationLiteUserItem>());
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
catch (Exception e)
|
|
110
|
+
{
|
|
111
|
+
callback.OnFriendsListResult("", new List<RelationLiteUserItem>());
|
|
112
|
+
Debug.LogError($"GetFriendsList parse result error: {e.Message}");
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
public void GetFollowingList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
119
|
+
{
|
|
120
|
+
Debug.Log($"TapTapRelationLite GetFollowingList with nextPageToken: {nextPageToken}");
|
|
121
|
+
|
|
122
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
123
|
+
.Service(SERVICE_NAME)
|
|
124
|
+
.Method("getFollowingList")
|
|
125
|
+
.Args("nextPageToken", nextPageToken)
|
|
126
|
+
.Callback(true)
|
|
127
|
+
.OnceTime(true)
|
|
128
|
+
.CommandBuilder(), (result) =>
|
|
129
|
+
{
|
|
130
|
+
if (callback == null) return;
|
|
131
|
+
|
|
132
|
+
try
|
|
133
|
+
{
|
|
134
|
+
if (result.code != Result.RESULT_SUCCESS || string.IsNullOrEmpty(result.content))
|
|
135
|
+
{
|
|
136
|
+
callback.OnFollowingListResult("", new List<RelationLiteUserItem>());
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
141
|
+
if (dic != null && dic.ContainsKey("next_page_token") && dic.ContainsKey("following_list"))
|
|
142
|
+
{
|
|
143
|
+
string nextPage = SafeDictionary.GetValue<string>(dic, "next_page_token");
|
|
144
|
+
string jsonStr = SafeDictionary.GetValue<string>(dic, "following_list");
|
|
145
|
+
List<RelationLiteUserItem> followingList = JsonConvert.DeserializeObject<List<RelationLiteUserItem>>(jsonStr);
|
|
146
|
+
callback.OnFollowingListResult(nextPage, followingList);
|
|
147
|
+
}
|
|
148
|
+
else
|
|
149
|
+
{
|
|
150
|
+
callback.OnFollowingListResult("", new List<RelationLiteUserItem>());
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch (Exception e)
|
|
154
|
+
{
|
|
155
|
+
callback.OnFollowingListResult("", new List<RelationLiteUserItem>());
|
|
156
|
+
Debug.LogError($"GetFollowingList parse result error: {e.Message}");
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
public void GetFansList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
163
|
+
{
|
|
164
|
+
Debug.Log($"TapTapRelationLite GetFansList with nextPageToken: {nextPageToken}");
|
|
165
|
+
|
|
166
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
167
|
+
.Service(SERVICE_NAME)
|
|
168
|
+
.Method("getFansList")
|
|
169
|
+
.Args("nextPageToken", nextPageToken)
|
|
170
|
+
.Callback(true)
|
|
171
|
+
.OnceTime(true)
|
|
172
|
+
.CommandBuilder(), (result) =>
|
|
173
|
+
{
|
|
174
|
+
if (callback == null) return;
|
|
175
|
+
|
|
176
|
+
try
|
|
177
|
+
{
|
|
178
|
+
if (result.code != Result.RESULT_SUCCESS || string.IsNullOrEmpty(result.content))
|
|
179
|
+
{
|
|
180
|
+
callback.OnFansListResult("", new List<RelationLiteUserItem>());
|
|
181
|
+
return;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
185
|
+
if (dic != null && dic.ContainsKey("next_page_token") && dic.ContainsKey("fans_list"))
|
|
186
|
+
{
|
|
187
|
+
string nextPage = SafeDictionary.GetValue<string>(dic, "next_page_token");
|
|
188
|
+
string jsonStr = SafeDictionary.GetValue<string>(dic, "fans_list");
|
|
189
|
+
List<RelationLiteUserItem> fansList = JsonConvert.DeserializeObject<List<RelationLiteUserItem>>(jsonStr);
|
|
190
|
+
callback.OnFansListResult(nextPage, fansList);
|
|
191
|
+
}
|
|
192
|
+
else
|
|
193
|
+
{
|
|
194
|
+
callback.OnFansListResult("", new List<RelationLiteUserItem>());
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (Exception e)
|
|
198
|
+
{
|
|
199
|
+
callback.OnFansListResult("", new List<RelationLiteUserItem>());
|
|
200
|
+
Debug.LogError($"GetFansList parse result error: {e.Message}");
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
public void SyncRelationshipWithOpenId(int action, string nickname, string friendNickname, string friendOpenId, ITapTapRelationLiteRequestCallback callback)
|
|
207
|
+
{
|
|
208
|
+
Debug.Log($"TapTapRelationLite SyncRelationshipWithOpenId with action: {action}, nickname: {nickname}, friendNickname: {friendNickname}, friendOpenId: {friendOpenId}");
|
|
209
|
+
|
|
210
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
211
|
+
.Service(SERVICE_NAME)
|
|
212
|
+
.Method("syncRelationshipWithOpenId")
|
|
213
|
+
.Args("action", action)
|
|
214
|
+
.Args("nickname", nickname)
|
|
215
|
+
.Args("friendNickname", friendNickname)
|
|
216
|
+
.Args("friendOpenId", friendOpenId)
|
|
217
|
+
.Callback(true)
|
|
218
|
+
.OnceTime(true)
|
|
219
|
+
.CommandBuilder(), (result) =>
|
|
220
|
+
{
|
|
221
|
+
if (callback == null) return;
|
|
222
|
+
|
|
223
|
+
try
|
|
224
|
+
{
|
|
225
|
+
if (result.code != Result.RESULT_SUCCESS || string.IsNullOrEmpty(result.content))
|
|
226
|
+
{
|
|
227
|
+
callback.OnSyncRelationshipFail("", "", "");
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
232
|
+
if (dic != null && dic.ContainsKey("success") && dic.ContainsKey("open_id"))
|
|
233
|
+
{
|
|
234
|
+
string openId = SafeDictionary.GetValue<string>(dic, "open_id");
|
|
235
|
+
bool success = SafeDictionary.GetValue<bool>(dic, "success");
|
|
236
|
+
if (success)
|
|
237
|
+
{
|
|
238
|
+
callback.OnSyncRelationshipSuccess(openId, "");
|
|
239
|
+
}
|
|
240
|
+
else
|
|
241
|
+
{
|
|
242
|
+
string errorMessage = SafeDictionary.GetValue<string>(dic, "error_message");
|
|
243
|
+
callback.OnSyncRelationshipFail(errorMessage, openId, "");
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else
|
|
247
|
+
{
|
|
248
|
+
callback.OnSyncRelationshipFail("", "", "");
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
catch (Exception e)
|
|
252
|
+
{
|
|
253
|
+
callback.OnSyncRelationshipFail(e.Message, "", "");
|
|
254
|
+
Debug.LogError($"SyncRelationshipWithOpenId parse result error: {e.Message}");
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
public void SyncRelationshipWithUnionId(int action, string nickname, string friendNickname, string friendUnionId, ITapTapRelationLiteRequestCallback callback)
|
|
261
|
+
{
|
|
262
|
+
Debug.Log($"TapTapRelationLite SyncRelationshipWithUnionId with action: {action}, nickname: {nickname}, friendNickname: {friendNickname}, friendUnionId: {friendUnionId}");
|
|
263
|
+
|
|
264
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
265
|
+
.Service(SERVICE_NAME)
|
|
266
|
+
.Method("syncRelationshipWithUnionId")
|
|
267
|
+
.Args("action", action)
|
|
268
|
+
.Args("nickname", nickname)
|
|
269
|
+
.Args("friendNickname", friendNickname)
|
|
270
|
+
.Args("friendUnionId", friendUnionId)
|
|
271
|
+
.Callback(true)
|
|
272
|
+
.OnceTime(true)
|
|
273
|
+
.CommandBuilder(), (result) =>
|
|
274
|
+
{
|
|
275
|
+
if (callback == null) return;
|
|
276
|
+
|
|
277
|
+
try
|
|
278
|
+
{
|
|
279
|
+
if (result.code != Result.RESULT_SUCCESS || string.IsNullOrEmpty(result.content))
|
|
280
|
+
{
|
|
281
|
+
callback.OnSyncRelationshipFail("request error", "", "");
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
286
|
+
if (dic != null && dic.ContainsKey("success") && dic.ContainsKey("union_id"))
|
|
287
|
+
{
|
|
288
|
+
string unionId = SafeDictionary.GetValue<string>(dic, "union_id");
|
|
289
|
+
bool success = SafeDictionary.GetValue<bool>(dic, "success");
|
|
290
|
+
if (success)
|
|
291
|
+
{
|
|
292
|
+
callback.OnSyncRelationshipSuccess("", unionId);
|
|
293
|
+
}
|
|
294
|
+
else
|
|
295
|
+
{
|
|
296
|
+
string errorMessage = SafeDictionary.GetValue<string>(dic, "error_message");
|
|
297
|
+
callback.OnSyncRelationshipFail(errorMessage, "", unionId);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
else
|
|
301
|
+
{
|
|
302
|
+
callback.OnSyncRelationshipFail("json format error", "", "");
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
catch (Exception e)
|
|
306
|
+
{
|
|
307
|
+
callback.OnSyncRelationshipFail(e.Message, "", "");
|
|
308
|
+
Debug.LogError($"SyncRelationshipWithOpenId parse result error: {e.Message}");
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
public void ShowTapUserProfile(string openId, string unionId)
|
|
315
|
+
{
|
|
316
|
+
Debug.Log($"TapTapRelationLite ShowTapUserProfile with openId: {openId}, unionId: {unionId}");
|
|
317
|
+
|
|
318
|
+
EngineBridge.GetInstance().CallHandler(new Command.Builder()
|
|
319
|
+
.Service(SERVICE_NAME)
|
|
320
|
+
.Method("showTapUserProfile")
|
|
321
|
+
.Args("openId", openId)
|
|
322
|
+
.Args("unionId", unionId)
|
|
323
|
+
.Callback(false)
|
|
324
|
+
.OnceTime(true)
|
|
325
|
+
.CommandBuilder());
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
public void RegisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
329
|
+
{
|
|
330
|
+
if (callback == null) return;
|
|
331
|
+
InitRegisterCallBack();
|
|
332
|
+
if (!callbacks.Contains(callback))
|
|
333
|
+
{
|
|
334
|
+
callbacks.Add(callback);
|
|
335
|
+
Debug.Log("TapTapRelationLite RegisterRelationLiteCallback");
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
public void UnregisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
340
|
+
{
|
|
341
|
+
if (callback != null)
|
|
342
|
+
{
|
|
343
|
+
callbacks.Remove(callback);
|
|
344
|
+
var command = new Command.Builder();
|
|
345
|
+
command.Service(SERVICE_NAME);
|
|
346
|
+
command.Method("unregisterRelationLiteCallback")
|
|
347
|
+
.Callback(true)
|
|
348
|
+
.OnceTime(false);
|
|
349
|
+
EngineBridge.GetInstance().CallHandler(command.CommandBuilder(), (result) =>
|
|
350
|
+
{
|
|
351
|
+
if (result.code != Result.RESULT_SUCCESS)
|
|
352
|
+
{
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
if (string.IsNullOrEmpty(result.content))
|
|
357
|
+
{
|
|
358
|
+
return;
|
|
359
|
+
}
|
|
360
|
+
Debug.Log("TapSdk4UnityDemo -->> Bridge Callback == " + JsonConvert.SerializeObject(result));
|
|
361
|
+
|
|
362
|
+
});
|
|
363
|
+
Debug.Log("TapTapRelationLite UnregisterRelationLiteCallback");
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
private void InitRegisterCallBack()
|
|
368
|
+
{
|
|
369
|
+
if (hasRegisterCallBack)
|
|
370
|
+
{
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
hasRegisterCallBack = true;
|
|
374
|
+
|
|
375
|
+
var command = new Command.Builder();
|
|
376
|
+
command.Service(SERVICE_NAME);
|
|
377
|
+
command.Method("registerRelationLiteCallback")
|
|
378
|
+
.Callback(true)
|
|
379
|
+
.OnceTime(false);
|
|
380
|
+
EngineBridge.GetInstance().CallHandler(command.CommandBuilder(), (result) =>
|
|
381
|
+
{
|
|
382
|
+
if (result.code != Result.RESULT_SUCCESS)
|
|
383
|
+
{
|
|
384
|
+
return;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
if (string.IsNullOrEmpty(result.content))
|
|
388
|
+
{
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
Debug.Log("TapSdk4UnityDemo -->> Bridge Callback == " + JsonConvert.SerializeObject(result));
|
|
392
|
+
var dic = Json.Deserialize(result.content) as Dictionary<string, object>;
|
|
393
|
+
var code = SafeDictionary.GetValue<int>(dic, "relation_lite_result_code");
|
|
394
|
+
|
|
395
|
+
if (code != null)
|
|
396
|
+
{
|
|
397
|
+
callbacks.ForEach((x) => x.OnResult(code));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
});
|
|
401
|
+
|
|
402
|
+
Debug.Log("TapTapRelationLite InitRegisterCallBack");
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
package/Mobile.meta
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
using TapSDK.Core;
|
|
2
|
+
using TapSDK.Core.Internal.Init;
|
|
3
|
+
|
|
4
|
+
namespace TapSDK.RelationLite.Internal.Init
|
|
5
|
+
{
|
|
6
|
+
public class RelationLiteInitTask : IInitTask
|
|
7
|
+
{
|
|
8
|
+
public int Order => 105;
|
|
9
|
+
|
|
10
|
+
public void Init(TapTapSdkOptions coreOption, TapTapSdkBaseOptions[] otherOptions)
|
|
11
|
+
{
|
|
12
|
+
TapTapRelationLiteManager.Instance.Init(coreOption.clientId, coreOption.region);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
public void Init(TapTapSdkOptions coreOption)
|
|
16
|
+
{
|
|
17
|
+
TapTapRelationLiteManager.Instance.Init(coreOption.clientId, coreOption.region);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using TapSDK.Core;
|
|
4
|
+
using TapSDK.Core.Internal.Utils;
|
|
5
|
+
|
|
6
|
+
namespace TapSDK.RelationLite.Internal
|
|
7
|
+
{
|
|
8
|
+
public class TapTapRelationLiteManager
|
|
9
|
+
{
|
|
10
|
+
private ITapTapRelationLite _impl;
|
|
11
|
+
private List<ITapTapRelationLiteCallback> _relationCallbacks;
|
|
12
|
+
|
|
13
|
+
private static TapTapRelationLiteManager instance;
|
|
14
|
+
|
|
15
|
+
private TapTapRelationLiteManager()
|
|
16
|
+
{
|
|
17
|
+
_impl = BridgeUtils.CreateBridgeImplementation(typeof(ITapTapRelationLite),
|
|
18
|
+
"TapSDK.RelationLite") as ITapTapRelationLite;
|
|
19
|
+
_relationCallbacks = new List<ITapTapRelationLiteCallback>();
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
public static TapTapRelationLiteManager Instance
|
|
23
|
+
{
|
|
24
|
+
get
|
|
25
|
+
{
|
|
26
|
+
if (instance == null)
|
|
27
|
+
{
|
|
28
|
+
instance = new TapTapRelationLiteManager();
|
|
29
|
+
}
|
|
30
|
+
return instance;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
public void Init(string clientId, TapTapRegionType regionType)
|
|
35
|
+
{
|
|
36
|
+
_impl.Init(clientId, regionType);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
public void SetOrientation(int orientation)
|
|
40
|
+
{
|
|
41
|
+
_impl.SetOrientation(orientation);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
public void InviteGame()
|
|
45
|
+
{
|
|
46
|
+
_impl.InviteGame();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
public void InviteTeam(string teamId)
|
|
50
|
+
{
|
|
51
|
+
_impl.InviteTeam(teamId);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
public void GetFriendsList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
55
|
+
{
|
|
56
|
+
_impl.GetFriendsList(nextPageToken, callback);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
public void GetFollowingList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
60
|
+
{
|
|
61
|
+
_impl.GetFollowingList(nextPageToken, callback);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
public void GetFansList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
65
|
+
{
|
|
66
|
+
_impl.GetFansList(nextPageToken, callback);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
public void SyncRelationshipWithOpenId(int action, string nickname, string friendNickname, string friendOpenId, ITapTapRelationLiteRequestCallback callback)
|
|
70
|
+
{
|
|
71
|
+
_impl.SyncRelationshipWithOpenId(action, nickname, friendNickname, friendOpenId, callback);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
public void SyncRelationshipWithUnionId(int action, string nickname, string friendNickname, string friendUnionId, ITapTapRelationLiteRequestCallback callback)
|
|
75
|
+
{
|
|
76
|
+
_impl.SyncRelationshipWithUnionId(action, nickname, friendNickname, friendUnionId, callback);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
public void ShowTapUserProfile(string openId, string unionId)
|
|
80
|
+
{
|
|
81
|
+
_impl.ShowTapUserProfile(openId, unionId);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
public void RegisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
86
|
+
{
|
|
87
|
+
if (callback != null && !_relationCallbacks.Contains(callback))
|
|
88
|
+
{
|
|
89
|
+
_relationCallbacks.Add(callback);
|
|
90
|
+
_impl.RegisterRelationLiteCallback(callback);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
public void UnregisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
95
|
+
{
|
|
96
|
+
if (callback != null && _relationCallbacks.Contains(callback))
|
|
97
|
+
{
|
|
98
|
+
_relationCallbacks.Remove(callback);
|
|
99
|
+
_impl.UnregisterRelationLiteCallback(callback);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Newtonsoft.Json;
|
|
3
|
+
|
|
4
|
+
namespace TapSDK.RelationLite
|
|
5
|
+
{
|
|
6
|
+
public class FollowStatus
|
|
7
|
+
{
|
|
8
|
+
[JsonProperty("blocked_by")]
|
|
9
|
+
public bool blockedBy;
|
|
10
|
+
|
|
11
|
+
[JsonProperty("blocking")]
|
|
12
|
+
public bool blocking;
|
|
13
|
+
|
|
14
|
+
[JsonProperty("followed_by")]
|
|
15
|
+
public bool followedBy;
|
|
16
|
+
|
|
17
|
+
[JsonProperty("following")]
|
|
18
|
+
public bool following;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using TapSDK.Core;
|
|
3
|
+
|
|
4
|
+
namespace TapSDK.RelationLite
|
|
5
|
+
{
|
|
6
|
+
public interface ITapTapRelationLite
|
|
7
|
+
{
|
|
8
|
+
void Init(string clientId, TapTapRegionType regionType);
|
|
9
|
+
|
|
10
|
+
void SetOrientation(int orientation);
|
|
11
|
+
|
|
12
|
+
void InviteGame();
|
|
13
|
+
|
|
14
|
+
void InviteTeam(string teamId);
|
|
15
|
+
|
|
16
|
+
void GetFriendsList(string nextPageToken, ITapTapRelationLiteRequestCallback callback);
|
|
17
|
+
|
|
18
|
+
void GetFollowingList(string nextPageToken, ITapTapRelationLiteRequestCallback callback);
|
|
19
|
+
|
|
20
|
+
void GetFansList(string nextPageToken, ITapTapRelationLiteRequestCallback callback);
|
|
21
|
+
|
|
22
|
+
void SyncRelationshipWithOpenId(int action, string nickname,string friendNickname, string friendOpenId, ITapTapRelationLiteRequestCallback callback);
|
|
23
|
+
|
|
24
|
+
void SyncRelationshipWithUnionId(int action, string nickname,string friendNickname, string friendUnionId, ITapTapRelationLiteRequestCallback callback);
|
|
25
|
+
|
|
26
|
+
void ShowTapUserProfile(string openId, string unionId);
|
|
27
|
+
|
|
28
|
+
void RegisterRelationLiteCallback(ITapTapRelationLiteCallback callback);
|
|
29
|
+
|
|
30
|
+
void UnregisterRelationLiteCallback(ITapTapRelationLiteCallback callback);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections;
|
|
3
|
+
using System.Collections.Generic;
|
|
4
|
+
|
|
5
|
+
namespace TapSDK.RelationLite
|
|
6
|
+
{
|
|
7
|
+
public interface ITapTapRelationLiteRequestCallback
|
|
8
|
+
{
|
|
9
|
+
void OnFriendsListResult(string nextPageToken, List<RelationLiteUserItem> friendsList);
|
|
10
|
+
void OnFollowingListResult(string nextPageToken, List<RelationLiteUserItem> followingList);
|
|
11
|
+
void OnFansListResult(string nextPageToken, List<RelationLiteUserItem> fansList);
|
|
12
|
+
void OnSyncRelationshipSuccess(string openId, string unionId);
|
|
13
|
+
void OnSyncRelationshipFail(string errorMessage, string openId, string unionId);
|
|
14
|
+
void OnRequestError(string errorMessage);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Newtonsoft.Json;
|
|
3
|
+
|
|
4
|
+
namespace TapSDK.RelationLite
|
|
5
|
+
{
|
|
6
|
+
public class RelationLiteUserInfo
|
|
7
|
+
{
|
|
8
|
+
[JsonProperty("alias")]
|
|
9
|
+
public string alias;
|
|
10
|
+
|
|
11
|
+
[JsonProperty("avatar")]
|
|
12
|
+
public string avatar;
|
|
13
|
+
|
|
14
|
+
[JsonProperty("name")]
|
|
15
|
+
public string name;
|
|
16
|
+
|
|
17
|
+
[JsonProperty("open_id")]
|
|
18
|
+
public string openId;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Newtonsoft.Json;
|
|
3
|
+
|
|
4
|
+
namespace TapSDK.RelationLite
|
|
5
|
+
{
|
|
6
|
+
[Serializable]
|
|
7
|
+
public class RelationLiteUserItem
|
|
8
|
+
{
|
|
9
|
+
[JsonProperty("follow_status")]
|
|
10
|
+
public FollowStatus followStatus;
|
|
11
|
+
|
|
12
|
+
[JsonProperty("created_at")]
|
|
13
|
+
public long createdAt;
|
|
14
|
+
|
|
15
|
+
[JsonProperty("user")]
|
|
16
|
+
public RelationLiteUserInfo user;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using System.Collections.Generic;
|
|
3
|
+
using TapSDK.RelationLite.Internal;
|
|
4
|
+
using TapSDK.Core;
|
|
5
|
+
using TapSDK.Core.Internal.Utils;
|
|
6
|
+
|
|
7
|
+
namespace TapSDK.RelationLite
|
|
8
|
+
{
|
|
9
|
+
public class TapTapRelationLiteConstants
|
|
10
|
+
{
|
|
11
|
+
public static readonly int CALLBACK_CODE_ON_STOP = 500;
|
|
12
|
+
|
|
13
|
+
// Relation action constants
|
|
14
|
+
public static readonly int ACTION_FOLLOW = 1;
|
|
15
|
+
public static readonly int ACTION_UNFOLLOW = 2;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public class TapTapRelationLite
|
|
19
|
+
{
|
|
20
|
+
public static void Init(string clientId, TapTapRegionType regionType)
|
|
21
|
+
{
|
|
22
|
+
TapTapRelationLiteManager.Instance.Init(clientId, regionType);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
public static void SetOrientation(int orientation)
|
|
26
|
+
{
|
|
27
|
+
TapTapRelationLiteManager.Instance.SetOrientation(orientation);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
public static void InviteGame()
|
|
31
|
+
{
|
|
32
|
+
TapTapRelationLiteManager.Instance.InviteGame();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
public static void InviteTeam(string teamId)
|
|
36
|
+
{
|
|
37
|
+
TapTapRelationLiteManager.Instance.InviteTeam(teamId);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
public static void GetFriendsList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
41
|
+
{
|
|
42
|
+
TapTapRelationLiteManager.Instance.GetFriendsList(nextPageToken, callback);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
public static void GetFollowingList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
46
|
+
{
|
|
47
|
+
TapTapRelationLiteManager.Instance.GetFollowingList(nextPageToken, callback);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
public static void GetFansList(string nextPageToken, ITapTapRelationLiteRequestCallback callback)
|
|
51
|
+
{
|
|
52
|
+
TapTapRelationLiteManager.Instance.GetFansList(nextPageToken, callback);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
public static void SyncRelationshipWithOpenId(int action, string nickname, string friendNickname, string friendOpenId, ITapTapRelationLiteRequestCallback callback)
|
|
56
|
+
{
|
|
57
|
+
TapTapRelationLiteManager.Instance.SyncRelationshipWithOpenId(action, nickname, friendNickname, friendOpenId, callback);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
public static void SyncRelationshipWithUnionId(int action, string nickname, string friendNickname, string friendUnionId, ITapTapRelationLiteRequestCallback callback)
|
|
61
|
+
{
|
|
62
|
+
TapTapRelationLiteManager.Instance.SyncRelationshipWithUnionId(action, nickname, friendNickname, friendUnionId, callback);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
public static void ShowTapUserProfile(string openId, string unionId)
|
|
66
|
+
{
|
|
67
|
+
TapTapRelationLiteManager.Instance.ShowTapUserProfile(openId, unionId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
public static void RegisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
71
|
+
{
|
|
72
|
+
TapTapRelationLiteManager.Instance.RegisterRelationLiteCallback(callback);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
public static void UnregisterRelationLiteCallback(ITapTapRelationLiteCallback callback)
|
|
76
|
+
{
|
|
77
|
+
TapTapRelationLiteManager.Instance.UnregisterRelationLiteCallback(callback);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
public static readonly string Version = "4.6.1-alpha.13";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "TapSDK.RelationLite.Runtime",
|
|
3
|
+
"references": [
|
|
4
|
+
"GUID:7d5ef2062f3704e1ab74aac0e4d5a1a7"
|
|
5
|
+
],
|
|
6
|
+
"includePlatforms": [],
|
|
7
|
+
"excludePlatforms": [],
|
|
8
|
+
"allowUnsafeCode": false,
|
|
9
|
+
"overrideReferences": false,
|
|
10
|
+
"precompiledReferences": [],
|
|
11
|
+
"autoReferenced": true,
|
|
12
|
+
"defineConstraints": [],
|
|
13
|
+
"versionDefines": [],
|
|
14
|
+
"noEngineReferences": false
|
|
15
|
+
}
|
package/Runtime.meta
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "com.taptap.sdk.relationlite",
|
|
3
|
+
"displayName": "TapTapSDK RelationLite",
|
|
4
|
+
"description": "TapTapSDK RelationLite",
|
|
5
|
+
"version": "4.6.1-alpha.13",
|
|
6
|
+
"unity": "2019.4",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"com.taptap.sdk.core": "4.6.1-alpha.13",
|
|
10
|
+
"com.taptap.sdk.login": "4.6.1-alpha.13"
|
|
11
|
+
}
|
|
12
|
+
}
|