Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 30 additions & 15 deletions Assets/Huawei/Demos/CloudDB/CloudDBDemo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using HmsPlugin;

using HuaweiMobileServices.AuthService;
using HuaweiMobileServices.Base;
using HuaweiMobileServices.CloudDB;
using HuaweiMobileServices.Common;
using HuaweiMobileServices.Id;
Expand Down Expand Up @@ -107,50 +108,50 @@ private void OnAuthSericeSignInSuccess(SignInResult signInResult)

public void CreateObjectType()
{
Debug.Log(TAG + " CreateObjectType");
Debug.Log($"{TAG} CreateObjectType");

cloudDBManager.CreateObjectType(ObjectTypeInfoHelper);
}

public void GetCloudDBZoneConfigs()
{
Debug.Log(TAG + " GetCloudDBZoneConfigs");
Debug.Log($"{TAG} GetCloudDBZoneConfigs");

IList<CloudDBZoneConfig> CloudDBZoneConfigs = cloudDBManager.GetCloudDBZoneConfigs();
Debug.Log($"{TAG} " + CloudDBZoneConfigs.Count);
}

public void OpenCloudDBZone()
{
Debug.Log(TAG + " OpenCloudDBZone");
Debug.Log($"{TAG} OpenCloudDBZone");

cloudDBManager.OpenCloudDBZone(cloudDBZoneName, CloudDBZoneConfig.CloudDBZoneSyncProperty.CLOUDDBZONE_CLOUD_CACHE, CloudDBZoneConfig.CloudDBZoneAccessProperty.CLOUDDBZONE_PUBLIC);
}

public void OpenCloudDBZone2()
{
Debug.Log(TAG + " OpenCloudDBZone2");
Debug.Log($"{TAG} OpenCloudDBZone2");

cloudDBManager.OpenCloudDBZone2(cloudDBZoneName, CloudDBZoneConfig.CloudDBZoneSyncProperty.CLOUDDBZONE_CLOUD_CACHE, CloudDBZoneConfig.CloudDBZoneAccessProperty.CLOUDDBZONE_PUBLIC);
}

public void EnableNetwork()
{
Debug.Log(TAG + " EnableNetwork");
Debug.Log($"{TAG} EnableNetwork");

cloudDBManager.EnableNetwork(cloudDBZoneName);
}

public void DisableNetwork()
{
Debug.Log(TAG + " DisableNetwork");
Debug.Log($"{TAG} DisableNetwork");

cloudDBManager.DisableNetwork(cloudDBZoneName);
}

public void AddBookInfo()
{
Debug.Log(TAG + " AddBookInfo");
Debug.Log($"{TAG} AddBookInfo");

var bookInfo = new BookInfo
{
Expand All @@ -164,7 +165,7 @@ public void AddBookInfo()

public void AddBookInfoList()
{
Debug.Log(TAG + " AddBookInfoList");
Debug.Log($"{TAG} AddBookInfoList");

var bookInfoList = new List<AndroidJavaObject>
{
Expand All @@ -177,7 +178,7 @@ public void AddBookInfoList()

public void UpdateBookInfo()
{
Debug.Log(TAG + " UpdateBookInfo");
Debug.Log($"{TAG} UpdateBookInfo");

var bookInfo = new BookInfo
{
Expand All @@ -192,7 +193,7 @@ public void UpdateBookInfo()

public void DeleteBookInfo()
{
Debug.Log(TAG + " DeleteBookInfo");
Debug.Log($"{TAG} DeleteBookInfo");

var bookInfo = new BookInfo { Id = 1 };

Expand All @@ -201,7 +202,7 @@ public void DeleteBookInfo()

public void DeleteBookInfoList()
{
Debug.Log(TAG + " DeleteBookInfoList");
Debug.Log($"{TAG} DeleteBookInfoList");

var bookInfoList = new List<AndroidJavaObject>
{
Expand All @@ -214,7 +215,7 @@ public void DeleteBookInfoList()

public void GetBookInfo()
{
Debug.Log(TAG + " GetBookInfo");
Debug.Log($"{TAG} GetBookInfo");

CloudDBZoneQuery mCloudQuery = CloudDBZoneQuery.Where(new AndroidJavaClass(BookInfoClass));
var cloudDBZoneQueryPolicy = CloudDBZoneQuery.CloudDBZoneQueryPolicy.CLOUDDBZONE_LOCAL_ONLY;
Expand All @@ -239,7 +240,7 @@ public void GetBookInfo()

public void GetBookInfo2()
{
Debug.Log(TAG + " GetBookInfo2");
Debug.Log($"{TAG} GetBookInfo2");

CloudDBZoneQuery mCloudQuery = CloudDBZoneQuery.Where(new AndroidJavaClass(BookInfoClass));
var cloudDBZoneQueryPolicy = CloudDBZoneQuery.CloudDBZoneQueryPolicy.CLOUDDBZONE_LOCAL_ONLY;
Expand Down Expand Up @@ -295,15 +296,15 @@ private void ProcessQueryResult(CloudDBZoneSnapshot<BookInfo> snapshot)

public void ExecuteSumQuery()
{
Debug.Log(TAG + " ExecuteSumQuery");
Debug.Log($"{TAG} ExecuteSumQuery");

CloudDBZoneQuery mCloudQuery = CloudDBZoneQuery.Where(new AndroidJavaClass(BookInfoClass));
cloudDBManager.ExecuteSumQuery(mCloudQuery, "price", CloudDBZoneQuery.CloudDBZoneQueryPolicy.CLOUDDBZONE_LOCAL_ONLY);
}

public void ExecuteCountQuery()
{
Debug.Log(TAG + " ExecuteCountQuery");
Debug.Log($"{TAG} ExecuteCountQuery");

CloudDBZoneQuery mCloudQuery = CloudDBZoneQuery.Where(new AndroidJavaClass(BookInfoClass));
cloudDBManager.ExecuteCountQuery(mCloudQuery, "price", CloudDBZoneQuery.CloudDBZoneQueryPolicy.CLOUDDBZONE_LOCAL_ONLY);
Expand All @@ -330,4 +331,18 @@ void OnOnCloudDBZoneSnapshotException(AGConnectCloudDBException exception)
HMSCloudDBManager.Instance.MRegister = HMSCloudDBManager.Instance.MCloudDBZone.SubscribeSnapshot(cloudDBZoneQuery, cloudDBZoneQueryPolicy, OnCloudDBZoneSnapshot, OnCloudDBZoneSnapshotException);
}

public void ExecuteServerStatusQuery()
{
Debug.Log($"{TAG} ExecuteServerStatusQuery");
ITask<ServerStatus> serverStatusTask = HMSCloudDBManager.Instance.MCloudDBZone.ExecuteServerStatusQuery();

serverStatusTask.AddOnSuccessListener(serverStatus =>
{
Debug.Log($"{TAG} ExecuteServerStatusQuery ServerStatus ServerTimestamp:{serverStatus.ServerTimestamp}");
});
serverStatusTask.AddOnFailureListener(error =>
{
Debug.LogError($"{TAG} ExecuteServerStatusQuery AddOnFailureListener:{error}");
});
}
}
Binary file modified Assets/Huawei/Dlls/HuaweiMobileServices.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion Assets/Huawei/Editor/Utils/HMSGradleWorker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public HMSGradleWorker()
{ IAPToggleEditor.IAPKitEnabled, new [] { "com.huawei.hms:iap:6.13.0.300" } },
{ PushToggleEditor.PushKitEnabled, new [] { "com.huawei.hms:push:6.11.0.300" } },
{ RemoteConfigToggleEditor.RemoteConfigEnabled, new [] { "com.huawei.agconnect:agconnect-remoteconfig:1.6.3.300" } },
{ CloudDBToggleEditor.CloudDBEnabled, new [] { "com.huawei.agconnect:agconnect-cloud-database:1.5.5.300" } },
{ CloudDBToggleEditor.CloudDBEnabled, new [] { "com.huawei.agconnect:agconnect-cloud-database:1.9.1.301" } },
{ AuthToggleEditor.AuthEnabled, new [] { "com.huawei.agconnect:agconnect-auth:1.9.1.301" } },
{ NearbyServiceToggleEditor.NearbyServiceEnabled, new [] { "com.huawei.hms:nearby:6.2.0.301" } },
{ AppMessagingToggleEditor.AppMessagingEnabled, new [] { "com.huawei.agconnect:agconnect-appmessaging:1.6.3.300" } },
Expand Down