diff --git a/Assets/Cafebazaar/Core/Script/AuthAndStorage/AuthAndStorageBridge.cs b/Assets/Cafebazaar/Core/Script/AuthAndStorage/AuthAndStorageBridge.cs index 8ca5c38..3e34d4f 100644 --- a/Assets/Cafebazaar/Core/Script/AuthAndStorage/AuthAndStorageBridge.cs +++ b/Assets/Cafebazaar/Core/Script/AuthAndStorage/AuthAndStorageBridge.cs @@ -145,6 +145,7 @@ public void OnLoginFailed() } #endregion #region STORAGE System + private readonly Dictionary storageKeyValue = new Dictionary(); public bool StorageIsInit { get; private set; } public bool Storage_Is_Synced { get; private set; } public bool Storage_Is_Syncing { get; private set; } @@ -190,6 +191,8 @@ public void STORAGE_Init(Action OnResult) if (Application.platform == RuntimePlatform.Android) { #if UNITY_ANDROID + SavedInitData(OnResult); + CallbackHolder.Instance.RegisterCallBack("OnGetDataSucceed", (x) => { OnResult((InitStorageResult)x); }); CallbackHolder.Instance.RegisterCallBack("OnGetDataFailed", (x) => { OnResult((InitStorageResult)x); }); @@ -265,6 +268,15 @@ public void OnSaveDataFailed(string error) CallbackHolder.Instance.ExecuteCallBack("OnSaveDataFailed", setStorageResult); } + private void SavedInitData(Action OnResult) + { + CallbackHolder.Instance.RegisterCallBack("OnSaveDataSucceed", (x) => { OnResult((InitStorageResult)x); }); + CallbackHolder.Instance.RegisterCallBack("OnSaveDataFailed", (x) => { OnResult((InitStorageResult)x); }); + storageKeyValue.Add("initCafeBazaar", "true"); + string data = Storage_CalculateSaveData(); + bazaarBridgePlugin.Call("SaveData", data); + } + private IEnumerator IEOnLoginToCafebazaarSuccessfull(Action OnResult, SignInResult loginResult) { yield return true; @@ -275,7 +287,6 @@ private IEnumerator IEOnLoginToCafebazaarSuccessfull(Action OnResu OnResult(loginResult); } - private readonly Dictionary storageKeyValue = new Dictionary(); private static bool init_storageLoop; private static float lastChangeStorage;