com.taptap.sdk.cloudsave 4.10.4 → 4.10.5

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.
@@ -4,12 +4,12 @@
4
4
  <repositories>
5
5
  <repository>https://repo.maven.apache.org/maven2</repository>
6
6
  </repositories>
7
- <androidPackage spec="com.taptap.sdk:tap-cloudsave-unity:4.10.4" />
7
+ <androidPackage spec="com.taptap.sdk:tap-cloudsave-unity:4.10.5" />
8
8
  </androidPackages>
9
9
  <iosPods>
10
10
  <sources>
11
11
  <source>https://github.com/CocoaPods/Specs.git</source>
12
12
  </sources>
13
- <iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/CloudSave" version="4.10.4" />
13
+ <iosPod addToAllTargets="false" bitcodeEnabled="false" name="TapTapSDK/CloudSave" version="4.10.5" />
14
14
  </iosPods>
15
15
  </dependencies>
@@ -7,7 +7,7 @@ namespace TapSDK.CloudSave
7
7
  {
8
8
  public class TapTapCloudSave
9
9
  {
10
- public static readonly string Version = "4.10.4";
10
+ public static readonly string Version = "4.10.5-alpha.5";
11
11
 
12
12
  public static void RegisterCloudSaveCallback(ITapCloudSaveCallback callback)
13
13
  {
@@ -0,0 +1,80 @@
1
+ fileFormatVersion: 2
2
+ guid: 3f8a2c1d7e4b9f05a6d3e8c2b1f74a90
3
+ PluginImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ iconMap: {}
7
+ executionOrder: {}
8
+ defineConstraints: []
9
+ isPreloaded: 0
10
+ isOverridable: 0
11
+ isExplicitlyReferenced: 0
12
+ validateReferences: 1
13
+ platformData:
14
+ - first:
15
+ : Any
16
+ second:
17
+ enabled: 0
18
+ settings:
19
+ Exclude Android: 1
20
+ Exclude Editor: 0
21
+ Exclude Linux64: 1
22
+ Exclude OSXUniversal: 0
23
+ Exclude Win: 1
24
+ Exclude Win64: 1
25
+ Exclude iOS: 1
26
+ - first:
27
+ Android: Android
28
+ second:
29
+ enabled: 0
30
+ settings:
31
+ CPU: ARMv7
32
+ - first:
33
+ Any:
34
+ second:
35
+ enabled: 0
36
+ settings: {}
37
+ - first:
38
+ Editor: Editor
39
+ second:
40
+ enabled: 1
41
+ settings:
42
+ CPU: AnyCPU
43
+ DefaultValueInitialized: true
44
+ OS: OSX
45
+ - first:
46
+ Standalone: Linux64
47
+ second:
48
+ enabled: 0
49
+ settings:
50
+ CPU: AnyCPU
51
+ - first:
52
+ Standalone: OSXUniversal
53
+ second:
54
+ enabled: 1
55
+ settings:
56
+ CPU: AnyCPU
57
+ - first:
58
+ Standalone: Win
59
+ second:
60
+ enabled: 0
61
+ settings:
62
+ CPU: x86
63
+ - first:
64
+ Standalone: Win64
65
+ second:
66
+ enabled: 0
67
+ settings:
68
+ CPU: x86_64
69
+ - first:
70
+ iPhone: iOS
71
+ second:
72
+ enabled: 0
73
+ settings:
74
+ AddToEmbeddedBinaries: false
75
+ CPU: AnyCPU
76
+ CompileFlags:
77
+ FrameworkDependencies:
78
+ userData:
79
+ assetBundleName:
80
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: f7f2e379ae100ce46a26e8f67d2db8d9
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -18,8 +18,8 @@ PluginImporter:
18
18
  settings:
19
19
  Exclude Android: 1
20
20
  Exclude Editor: 0
21
- Exclude Linux64: 0
22
- Exclude OSXUniversal: 0
21
+ Exclude Linux64: 1
22
+ Exclude OSXUniversal: 1
23
23
  Exclude Win: 0
24
24
  Exclude Win64: 0
25
25
  Exclude iOS: 1
@@ -45,15 +45,15 @@ PluginImporter:
45
45
  - first:
46
46
  Standalone: Linux64
47
47
  second:
48
- enabled: 1
48
+ enabled: 0
49
49
  settings:
50
- CPU: AnyCPU
50
+ CPU: None
51
51
  - first:
52
52
  Standalone: OSXUniversal
53
53
  second:
54
- enabled: 1
54
+ enabled: 0
55
55
  settings:
56
- CPU: x86_64
56
+ CPU: None
57
57
  - first:
58
58
  Standalone: Win
59
59
  second:
@@ -51,6 +51,17 @@ namespace TapSDK.CloudSave.Standalone
51
51
  { "key", loginKey },
52
52
  };
53
53
  int region = isRND ? 2 : 0;
54
+ try
55
+ {
56
+ Directory.CreateDirectory(cacheDir);
57
+ }
58
+ catch (Exception e)
59
+ {
60
+ Log($"TapCloudSave create cache directory failed, path = {cacheDir}, error = {e.Message}", true);
61
+ NotifyInitFail();
62
+ return;
63
+ }
64
+
54
65
  try
55
66
  {
56
67
  Dictionary<string, object> initConfig = new Dictionary<string, object>()
@@ -78,16 +89,7 @@ namespace TapSDK.CloudSave.Standalone
78
89
  Log("TapSdkCloudSaveInitialize result = " + initResult);
79
90
  if (initResult < 0)
80
91
  {
81
- RunOnMainThread(() =>
82
- {
83
- if (currentSaveCallback != null && currentSaveCallback.Count > 0)
84
- {
85
- foreach (var callback in currentSaveCallback)
86
- {
87
- callback?.OnResult(TapCloudSaveResultCode.INIT_FAIL);
88
- }
89
- }
90
- });
92
+ NotifyInitFail();
91
93
  }
92
94
  else
93
95
  {
@@ -99,7 +101,8 @@ namespace TapSDK.CloudSave.Standalone
99
101
  }
100
102
  catch (Exception e)
101
103
  {
102
- Log("TapSdkCloudSaveInitialize error " + e.Message);
104
+ Log("TapSdkCloudSaveInitialize error " + e.Message, true);
105
+ NotifyInitFail();
103
106
  }
104
107
  });
105
108
 
@@ -469,24 +472,27 @@ namespace TapSDK.CloudSave.Standalone
469
472
  string seesionId = Guid.NewGuid().ToString();
470
473
  const string method = "registerCloudSaveCallback";
471
474
  TapCloudSaveTracker.Instance.TrackStart(method, seesionId);
472
- if (currentSaveCallback == null)
473
- {
474
- currentSaveCallback = new List<ITapCloudSaveCallback>();
475
- }
476
- if (!currentSaveCallback.Contains(callback))
477
- {
478
- TapCloudSaveTracker.Instance.TrackSuccess(method, seesionId);
479
- currentSaveCallback.Add(callback);
480
- Log($"RegisterCloudSaveCallback: Added callback. Total callbacks: {currentSaveCallback.Count}");
481
- }
482
- else
475
+ lock (_lockObj)
483
476
  {
484
- TapCloudSaveTracker.Instance.TrackFailure(
485
- method,
486
- seesionId,
487
- errorMessage: "callback has already registered"
488
- );
489
- Log("RegisterCloudSaveCallback: Callback already registered");
477
+ if (currentSaveCallback == null)
478
+ {
479
+ currentSaveCallback = new List<ITapCloudSaveCallback>();
480
+ }
481
+ if (!currentSaveCallback.Contains(callback))
482
+ {
483
+ TapCloudSaveTracker.Instance.TrackSuccess(method, seesionId);
484
+ currentSaveCallback.Add(callback);
485
+ Log($"RegisterCloudSaveCallback: Added callback. Total callbacks: {currentSaveCallback.Count}");
486
+ }
487
+ else
488
+ {
489
+ TapCloudSaveTracker.Instance.TrackFailure(
490
+ method,
491
+ seesionId,
492
+ errorMessage: "callback has already registered"
493
+ );
494
+ Log("RegisterCloudSaveCallback: Callback already registered");
495
+ }
490
496
  }
491
497
  }
492
498
 
@@ -495,7 +501,8 @@ namespace TapSDK.CloudSave.Standalone
495
501
  string seesionId = Guid.NewGuid().ToString();
496
502
  const string method = "unregisterCloudSaveCallback";
497
503
  TapCloudSaveTracker.Instance.TrackStart(method, seesionId);
498
-
504
+ lock (_lockObj)
505
+ {
499
506
  if (currentSaveCallback != null && callback != null)
500
507
  {
501
508
  if (currentSaveCallback.Contains(callback))
@@ -523,6 +530,7 @@ namespace TapSDK.CloudSave.Standalone
523
530
  );
524
531
  Log("UnregisterCloudSaveCallback: Callback or callback list is null");
525
532
  }
533
+ } // end lock
526
534
  }
527
535
 
528
536
  public Task<ArchiveData> UpdateArchive(
@@ -629,10 +637,7 @@ namespace TapSDK.CloudSave.Standalone
629
637
  {
630
638
  if (currentSaveCallback != null && currentSaveCallback.Count > 0)
631
639
  {
632
- foreach (var callback in currentSaveCallback)
633
- {
634
- callback?.OnResult(TapCloudSaveResultCode.NEED_LOGIN);
635
- }
640
+ RunOnMainThread(() => NotifyCloudSaveResult(TapCloudSaveResultCode.NEED_LOGIN));
636
641
  }
637
642
  TapCloudSaveTracker.Instance.TrackFailure(method, sessionId, -1, "not login");
638
643
  return false;
@@ -690,6 +695,25 @@ namespace TapSDK.CloudSave.Standalone
690
695
  TapLoom.QueueOnMainThread(action);
691
696
  }
692
697
 
698
+ private void NotifyInitFail()
699
+ {
700
+ RunOnMainThread(() => NotifyCloudSaveResult(TapCloudSaveResultCode.INIT_FAIL));
701
+ }
702
+
703
+ private void NotifyCloudSaveResult(int resultCode)
704
+ {
705
+ ITapCloudSaveCallback[] snapshot;
706
+ lock (_lockObj)
707
+ {
708
+ if (currentSaveCallback == null || currentSaveCallback.Count == 0) return;
709
+ snapshot = currentSaveCallback.ToArray();
710
+ }
711
+ foreach (var callback in snapshot)
712
+ {
713
+ callback?.OnResult(resultCode);
714
+ }
715
+ }
716
+
693
717
  private void Log(string msg, bool isError = false)
694
718
  {
695
719
  if (cloudSaveLog == null)
@@ -9,7 +9,8 @@
9
9
  ],
10
10
  "includePlatforms": [
11
11
  "Editor",
12
- "WindowsStandalone64"
12
+ "WindowsStandalone64",
13
+ "macOSStandalone"
13
14
  ],
14
15
  "excludePlatforms": [],
15
16
  "allowUnsafeCode": false,
package/package.json CHANGED
@@ -2,11 +2,11 @@
2
2
  "name": "com.taptap.sdk.cloudsave",
3
3
  "displayName": "TapTapSDK CloudSave",
4
4
  "description": "TapTapSDK CloudSave",
5
- "version": "4.10.4",
5
+ "version": "4.10.5",
6
6
  "unity": "2019.4",
7
7
  "license": "MIT",
8
8
  "dependencies": {
9
- "com.taptap.sdk.core": "4.10.4",
10
- "com.taptap.sdk.login": "4.10.4"
9
+ "com.taptap.sdk.core": "4.10.5",
10
+ "com.taptap.sdk.login": "4.10.5"
11
11
  }
12
12
  }