com.amanotes.gdk 0.2.73-1 → 0.2.73-2

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.
@@ -14,12 +14,26 @@ namespace Amanotes.Core
14
14
  {
15
15
  public partial class IAP //Public
16
16
  {
17
- public static bool IsVIP => !string.IsNullOrEmpty(localData.activeSubscriptionId);
18
- public static string ActiveSubscriptionId => localData.activeSubscriptionId;
19
- public static string SubscriptionPeriodType => localData.subscriptionPeriodType;
20
- public static DateTime? SubscriptionLastPurchaseDate => localData.SubscriptionLastPurchaseDate;
21
- public static DateTime? SubscriptionExpiredDate => localData.SubscriptionExpiredDate;
22
- public static DateTime? UnsubscribedDate => localData.UnsubscribedDate;
17
+ public static string SubscriptionPeriodType(string entitlement = "")
18
+ {
19
+ return Adapter?.GetSubscriptionPeriodType(entitlement);
20
+ }
21
+
22
+ public static DateTime? SubscriptionLastPurchaseDate(string entitlement = "")
23
+ {
24
+ return Adapter?.GetSubscriptionLastPurchaseDate(entitlement);
25
+ }
26
+
27
+ public static DateTime? SubscriptionExpiredDate(string entitlement = "")
28
+ {
29
+ return Adapter?.GetSubscriptionExpiredDate(entitlement);
30
+ }
31
+
32
+ public static DateTime? UnsubscribedDate(string entitlement = "")
33
+ {
34
+ return Adapter?.GetUnsubscribedDate(entitlement);
35
+ }
36
+
23
37
  public static readonly Dictionary<string, ProductInfo> AllProducts = new Dictionary<string, ProductInfo>();
24
38
  private const string DATE_FORMAT = "yyyy/MM/yy HH:mm:ss";
25
39
 
@@ -150,58 +164,8 @@ namespace Amanotes.Core
150
164
  [Serializable]
151
165
  internal class IAPData : IJsonFile
152
166
  {
153
- public string activeSubscriptionId;
154
- public string subscriptionPeriodType;
155
- public string subscriptionLastPurchaseDate;
156
- public string subscriptionExpiredDate;
157
- public string unsubscribedDate;
158
167
  public List<string> purchasedProducts;
159
168
 
160
- private DateTime? _subscriptionLastPurchaseDate;
161
- public DateTime? SubscriptionLastPurchaseDate
162
- {
163
- get
164
- {
165
- if (_subscriptionLastPurchaseDate != null) return _subscriptionLastPurchaseDate;
166
- if (DateTime.TryParseExact(subscriptionLastPurchaseDate, DATE_FORMAT,
167
- CultureInfo.InvariantCulture, DateTimeStyles.None, out var pd))
168
- {
169
- _subscriptionLastPurchaseDate = pd;
170
- }
171
- return _subscriptionLastPurchaseDate;
172
- }
173
- }
174
-
175
- private DateTime? _subscriptionExpiredDate;
176
- public DateTime? SubscriptionExpiredDate
177
- {
178
- get
179
- {
180
- if (_subscriptionExpiredDate != null) return _subscriptionExpiredDate;
181
- if (DateTime.TryParseExact(subscriptionExpiredDate, DATE_FORMAT,
182
- CultureInfo.InvariantCulture, DateTimeStyles.None, out var pd))
183
- {
184
- _subscriptionExpiredDate = pd;
185
- }
186
- return _subscriptionExpiredDate;
187
- }
188
- }
189
-
190
- private DateTime? _unsubscribedDate;
191
- public DateTime? UnsubscribedDate
192
- {
193
- get
194
- {
195
- if (_unsubscribedDate != null) return _unsubscribedDate;
196
- if (DateTime.TryParseExact(unsubscribedDate, DATE_FORMAT,
197
- CultureInfo.InvariantCulture, DateTimeStyles.None, out var pd))
198
- {
199
- _unsubscribedDate = pd;
200
- }
201
- return _unsubscribedDate;
202
- }
203
- }
204
-
205
169
  public void Sync()
206
170
  {
207
171
  GDKUtils.StartCoroutine(SyncRoutine());
@@ -215,15 +179,7 @@ namespace Amanotes.Core
215
179
  yield break;
216
180
  }
217
181
  yield return new WaitUntil(() => Adapter.IsReady);
218
- activeSubscriptionId = Adapter.GetActiveSubscriptionId();
219
- subscriptionPeriodType = Adapter.GetSubscriptionPeriodType();
220
182
  purchasedProducts = Adapter.GetPurchasedProducts();
221
- _subscriptionLastPurchaseDate = Adapter.GetSubscriptionLastPurchaseDate();
222
- subscriptionLastPurchaseDate = _subscriptionLastPurchaseDate?.ToString(DATE_FORMAT);
223
- _subscriptionExpiredDate = Adapter.GetSubscriptionExpiredDate();
224
- subscriptionExpiredDate = _subscriptionExpiredDate?.ToString(DATE_FORMAT);
225
- _unsubscribedDate = Adapter.GetUnsubscribedDate();
226
- unsubscribedDate = _unsubscribedDate?.ToString(DATE_FORMAT);
227
183
  this.SaveJsonToFile();
228
184
  }
229
185
  }
@@ -566,11 +522,11 @@ namespace Amanotes.Core.Internal
566
522
  public abstract void RestorePurchase(Action<PurchaseSuccess> onSuccess = null, Action<PurchaseError> onFail = null);
567
523
  public abstract List<string> GetActiveSubscriptions();
568
524
  public abstract List<string> GetPurchasedProducts();
569
- public abstract string GetActiveSubscriptionId();
570
- public abstract string GetSubscriptionPeriodType();
571
- public abstract DateTime? GetSubscriptionLastPurchaseDate();
572
- public abstract DateTime? GetSubscriptionExpiredDate();
573
- public abstract DateTime? GetUnsubscribedDate();
525
+ public abstract string GetActiveSubscriptionId(string entitlement = "");
526
+ public abstract string GetSubscriptionPeriodType(string entitlement = "");
527
+ public abstract DateTime? GetSubscriptionLastPurchaseDate(string entitlement = "");
528
+ public abstract DateTime? GetSubscriptionExpiredDate(string entitlement = "");
529
+ public abstract DateTime? GetUnsubscribedDate(string entitlement = "");
574
530
  public abstract HashSet<PurchaseRecord> GetPurchaseHistory();
575
531
  public abstract DateTime? GetLastPurchaseDate(string productAndPlanId);
576
532
  }
package/Runtime/AmaGDK.cs CHANGED
@@ -24,7 +24,7 @@ namespace Amanotes.Core
24
24
  {
25
25
  public partial class AmaGDK : MonoBehaviour
26
26
  {
27
- public const string VERSION = "0.2.73-1";
27
+ public const string VERSION = "0.2.73-2";
28
28
 
29
29
  internal static Status _status = Status.None;
30
30
  private static ConfigAsset _config = null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "com.amanotes.gdk",
3
- "version": "0.2.73-1",
3
+ "version": "0.2.73-2",
4
4
  "displayName": "AmaGDK",
5
5
  "description": "Amanotes Game Development Kit",
6
6
  "unity": "2019.4",