react-native-iap 15.5.0 → 15.5.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.
Files changed (61) hide show
  1. package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -0
  2. package/ios/HybridRnIap.swift +16 -0
  3. package/lib/module/hooks/useIAP.js +6 -2
  4. package/lib/module/hooks/useIAP.js.map +1 -1
  5. package/lib/module/index.js +6 -0
  6. package/lib/module/index.js.map +1 -1
  7. package/lib/module/index.kepler.js.map +1 -1
  8. package/lib/module/kit-api.js +27 -0
  9. package/lib/module/kit-api.js.map +1 -1
  10. package/lib/module/types.js +7 -0
  11. package/lib/module/types.js.map +1 -1
  12. package/lib/module/vega-adapter.js +10 -6
  13. package/lib/module/vega-adapter.js.map +1 -1
  14. package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
  15. package/lib/typescript/src/index.d.ts +1 -1
  16. package/lib/typescript/src/index.d.ts.map +1 -1
  17. package/lib/typescript/src/index.kepler.d.ts +1 -0
  18. package/lib/typescript/src/index.kepler.d.ts.map +1 -1
  19. package/lib/typescript/src/kit-api.d.ts +60 -0
  20. package/lib/typescript/src/kit-api.d.ts.map +1 -1
  21. package/lib/typescript/src/specs/RnIap.nitro.d.ts +28 -12
  22. package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
  23. package/lib/typescript/src/types.d.ts +36 -1
  24. package/lib/typescript/src/types.d.ts.map +1 -1
  25. package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
  26. package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
  27. package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
  28. package/nitrogen/generated/android/c++/JIapkitClientPayloadFormat.hpp +61 -0
  29. package/nitrogen/generated/android/c++/JNitroIapkitProductClientPayload.hpp +71 -0
  30. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +7 -3
  31. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +20 -1
  32. package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +5 -0
  33. package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.cpp +26 -0
  34. package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.hpp +74 -0
  35. package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitResult.hpp +8 -0
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapkitClientPayloadFormat.kt +24 -0
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapkitProductClientPayload.kt +66 -0
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +9 -4
  39. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +14 -4
  40. package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload.kt +62 -0
  41. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +50 -0
  42. package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
  43. package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
  44. package/nitrogen/generated/ios/swift/IapkitClientPayloadFormat.swift +44 -0
  45. package/nitrogen/generated/ios/swift/NitroIapkitProductClientPayload.swift +44 -0
  46. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
  47. package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +76 -2
  48. package/nitrogen/generated/ios/swift/Variant_NullType_NitroIapkitProductClientPayload.swift +30 -0
  49. package/nitrogen/generated/shared/c++/IapkitClientPayloadFormat.hpp +80 -0
  50. package/nitrogen/generated/shared/c++/NitroIapkitProductClientPayload.hpp +97 -0
  51. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +6 -2
  52. package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +16 -1
  53. package/openiap-versions.json +3 -3
  54. package/package.json +5 -5
  55. package/src/hooks/useIAP.ts +6 -2
  56. package/src/index.kepler.ts +13 -0
  57. package/src/index.ts +13 -0
  58. package/src/kit-api.ts +107 -0
  59. package/src/specs/RnIap.nitro.ts +37 -12
  60. package/src/types.ts +38 -1
  61. package/src/vega-adapter.ts +14 -11
@@ -0,0 +1,71 @@
1
+ ///
2
+ /// JNitroIapkitProductClientPayload.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include "NitroIapkitProductClientPayload.hpp"
12
+
13
+ #include "IapkitClientPayloadFormat.hpp"
14
+ #include "JIapkitClientPayloadFormat.hpp"
15
+ #include <string>
16
+
17
+ namespace margelo::nitro::iap {
18
+
19
+ using namespace facebook;
20
+
21
+ /**
22
+ * The C++ JNI bridge between the C++ struct "NitroIapkitProductClientPayload" and the Kotlin data class "NitroIapkitProductClientPayload".
23
+ */
24
+ struct JNitroIapkitProductClientPayload final: public jni::JavaClass<JNitroIapkitProductClientPayload> {
25
+ public:
26
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/NitroIapkitProductClientPayload;";
27
+
28
+ public:
29
+ /**
30
+ * Convert this Java/Kotlin-based struct to the C++ struct NitroIapkitProductClientPayload by copying all values to C++.
31
+ */
32
+ [[maybe_unused]]
33
+ [[nodiscard]]
34
+ NitroIapkitProductClientPayload toCpp() const {
35
+ static const auto clazz = javaClassStatic();
36
+ static const auto fieldBody = clazz->getField<jni::JString>("body");
37
+ jni::local_ref<jni::JString> body = this->getFieldValue(fieldBody);
38
+ static const auto fieldFormat = clazz->getField<JIapkitClientPayloadFormat>("format");
39
+ jni::local_ref<JIapkitClientPayloadFormat> format = this->getFieldValue(fieldFormat);
40
+ static const auto fieldUpdatedAt = clazz->getField<double>("updatedAt");
41
+ double updatedAt = this->getFieldValue(fieldUpdatedAt);
42
+ static const auto fieldVersion = clazz->getField<double>("version");
43
+ double version = this->getFieldValue(fieldVersion);
44
+ return NitroIapkitProductClientPayload(
45
+ body->toStdString(),
46
+ format->toCpp(),
47
+ updatedAt,
48
+ version
49
+ );
50
+ }
51
+
52
+ public:
53
+ /**
54
+ * Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
55
+ */
56
+ [[maybe_unused]]
57
+ static jni::local_ref<JNitroIapkitProductClientPayload::javaobject> fromCpp(const NitroIapkitProductClientPayload& value) {
58
+ using JSignature = JNitroIapkitProductClientPayload(jni::alias_ref<jni::JString>, jni::alias_ref<JIapkitClientPayloadFormat>, double, double);
59
+ static const auto clazz = javaClassStatic();
60
+ static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
61
+ return create(
62
+ clazz,
63
+ jni::make_jstring(value.body),
64
+ JIapkitClientPayloadFormat::fromCpp(value.format),
65
+ value.updatedAt,
66
+ value.version
67
+ );
68
+ }
69
+ };
70
+
71
+ } // namespace margelo::nitro::iap
@@ -56,12 +56,15 @@ namespace margelo::nitro::iap {
56
56
  jni::local_ref<JVariant_NullType_String> baseUrl = this->getFieldValue(fieldBaseUrl);
57
57
  static const auto fieldGoogle = clazz->getField<JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps>("google");
58
58
  jni::local_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps> google = this->getFieldValue(fieldGoogle);
59
+ static const auto fieldIncludeClientPayload = clazz->getField<JVariant_NullType_Boolean>("includeClientPayload");
60
+ jni::local_ref<JVariant_NullType_Boolean> includeClientPayload = this->getFieldValue(fieldIncludeClientPayload);
59
61
  return NitroVerifyPurchaseWithIapkitProps(
60
62
  apiKey != nullptr ? std::make_optional(apiKey->toCpp()) : std::nullopt,
61
63
  amazon != nullptr ? std::make_optional(amazon->toCpp()) : std::nullopt,
62
64
  apple != nullptr ? std::make_optional(apple->toCpp()) : std::nullopt,
63
65
  baseUrl != nullptr ? std::make_optional(baseUrl->toCpp()) : std::nullopt,
64
- google != nullptr ? std::make_optional(google->toCpp()) : std::nullopt
66
+ google != nullptr ? std::make_optional(google->toCpp()) : std::nullopt,
67
+ includeClientPayload != nullptr ? std::make_optional(includeClientPayload->toCpp()) : std::nullopt
65
68
  );
66
69
  }
67
70
 
@@ -71,7 +74,7 @@ namespace margelo::nitro::iap {
71
74
  */
72
75
  [[maybe_unused]]
73
76
  static jni::local_ref<JNitroVerifyPurchaseWithIapkitProps::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitProps& value) {
74
- using JSignature = JNitroVerifyPurchaseWithIapkitProps(jni::alias_ref<JVariant_NullType_String>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitAppleProps>, jni::alias_ref<JVariant_NullType_String>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps>);
77
+ using JSignature = JNitroVerifyPurchaseWithIapkitProps(jni::alias_ref<JVariant_NullType_String>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitAppleProps>, jni::alias_ref<JVariant_NullType_String>, jni::alias_ref<JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps>, jni::alias_ref<JVariant_NullType_Boolean>);
75
78
  static const auto clazz = javaClassStatic();
76
79
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
77
80
  return create(
@@ -80,7 +83,8 @@ namespace margelo::nitro::iap {
80
83
  value.amazon.has_value() ? JVariant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps::fromCpp(value.amazon.value()) : nullptr,
81
84
  value.apple.has_value() ? JVariant_NullType_NitroVerifyPurchaseWithIapkitAppleProps::fromCpp(value.apple.value()) : nullptr,
82
85
  value.baseUrl.has_value() ? JVariant_NullType_String::fromCpp(value.baseUrl.value()) : nullptr,
83
- value.google.has_value() ? JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps::fromCpp(value.google.value()) : nullptr
86
+ value.google.has_value() ? JVariant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps::fromCpp(value.google.value()) : nullptr,
87
+ value.includeClientPayload.has_value() ? JVariant_NullType_Boolean::fromCpp(value.includeClientPayload.value()) : nullptr
84
88
  );
85
89
  }
86
90
  };
@@ -11,9 +11,20 @@
11
11
  #include "NitroVerifyPurchaseWithIapkitResult.hpp"
12
12
 
13
13
  #include "IapStore.hpp"
14
+ #include "IapkitClientPayloadFormat.hpp"
14
15
  #include "IapkitPurchaseState.hpp"
15
16
  #include "JIapStore.hpp"
17
+ #include "JIapkitClientPayloadFormat.hpp"
16
18
  #include "JIapkitPurchaseState.hpp"
19
+ #include "JNitroIapkitProductClientPayload.hpp"
20
+ #include "JVariant_NullType_NitroIapkitProductClientPayload.hpp"
21
+ #include "JVariant_NullType_String.hpp"
22
+ #include "NitroIapkitProductClientPayload.hpp"
23
+ #include <NitroModules/JNull.hpp>
24
+ #include <NitroModules/Null.hpp>
25
+ #include <optional>
26
+ #include <string>
27
+ #include <variant>
17
28
 
18
29
  namespace margelo::nitro::iap {
19
30
 
@@ -34,14 +45,20 @@ namespace margelo::nitro::iap {
34
45
  [[nodiscard]]
35
46
  NitroVerifyPurchaseWithIapkitResult toCpp() const {
36
47
  static const auto clazz = javaClassStatic();
48
+ static const auto fieldClientPayload = clazz->getField<JVariant_NullType_NitroIapkitProductClientPayload>("clientPayload");
49
+ jni::local_ref<JVariant_NullType_NitroIapkitProductClientPayload> clientPayload = this->getFieldValue(fieldClientPayload);
37
50
  static const auto fieldIsValid = clazz->getField<jboolean>("isValid");
38
51
  jboolean isValid = this->getFieldValue(fieldIsValid);
52
+ static const auto fieldProductId = clazz->getField<JVariant_NullType_String>("productId");
53
+ jni::local_ref<JVariant_NullType_String> productId = this->getFieldValue(fieldProductId);
39
54
  static const auto fieldState = clazz->getField<JIapkitPurchaseState>("state");
40
55
  jni::local_ref<JIapkitPurchaseState> state = this->getFieldValue(fieldState);
41
56
  static const auto fieldStore = clazz->getField<JIapStore>("store");
42
57
  jni::local_ref<JIapStore> store = this->getFieldValue(fieldStore);
43
58
  return NitroVerifyPurchaseWithIapkitResult(
59
+ clientPayload != nullptr ? std::make_optional(clientPayload->toCpp()) : std::nullopt,
44
60
  static_cast<bool>(isValid),
61
+ productId != nullptr ? std::make_optional(productId->toCpp()) : std::nullopt,
45
62
  state->toCpp(),
46
63
  store->toCpp()
47
64
  );
@@ -53,12 +70,14 @@ namespace margelo::nitro::iap {
53
70
  */
54
71
  [[maybe_unused]]
55
72
  static jni::local_ref<JNitroVerifyPurchaseWithIapkitResult::javaobject> fromCpp(const NitroVerifyPurchaseWithIapkitResult& value) {
56
- using JSignature = JNitroVerifyPurchaseWithIapkitResult(jboolean, jni::alias_ref<JIapkitPurchaseState>, jni::alias_ref<JIapStore>);
73
+ using JSignature = JNitroVerifyPurchaseWithIapkitResult(jni::alias_ref<JVariant_NullType_NitroIapkitProductClientPayload>, jboolean, jni::alias_ref<JVariant_NullType_String>, jni::alias_ref<JIapkitPurchaseState>, jni::alias_ref<JIapStore>);
57
74
  static const auto clazz = javaClassStatic();
58
75
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
59
76
  return create(
60
77
  clazz,
78
+ value.clientPayload.has_value() ? JVariant_NullType_NitroIapkitProductClientPayload::fromCpp(value.clientPayload.value()) : nullptr,
61
79
  value.isValid,
80
+ value.productId.has_value() ? JVariant_NullType_String::fromCpp(value.productId.value()) : nullptr,
62
81
  JIapkitPurchaseState::fromCpp(value.state),
63
82
  JIapStore::fromCpp(value.store)
64
83
  );
@@ -11,15 +11,20 @@
11
11
  #include "NitroVerifyPurchaseWithProviderResult.hpp"
12
12
 
13
13
  #include "IapStore.hpp"
14
+ #include "IapkitClientPayloadFormat.hpp"
14
15
  #include "IapkitPurchaseState.hpp"
15
16
  #include "JIapStore.hpp"
17
+ #include "JIapkitClientPayloadFormat.hpp"
16
18
  #include "JIapkitPurchaseState.hpp"
19
+ #include "JNitroIapkitProductClientPayload.hpp"
17
20
  #include "JNitroVerifyPurchaseWithIapkitResult.hpp"
18
21
  #include "JNitroVerifyPurchaseWithProviderError.hpp"
19
22
  #include "JPurchaseVerificationProvider.hpp"
20
23
  #include "JVariant_NullType_Array_NitroVerifyPurchaseWithProviderError_.hpp"
24
+ #include "JVariant_NullType_NitroIapkitProductClientPayload.hpp"
21
25
  #include "JVariant_NullType_NitroVerifyPurchaseWithIapkitResult.hpp"
22
26
  #include "JVariant_NullType_String.hpp"
27
+ #include "NitroIapkitProductClientPayload.hpp"
23
28
  #include "NitroVerifyPurchaseWithIapkitResult.hpp"
24
29
  #include "NitroVerifyPurchaseWithProviderError.hpp"
25
30
  #include "PurchaseVerificationProvider.hpp"
@@ -0,0 +1,26 @@
1
+ ///
2
+ /// JVariant_NullType_NitroIapkitProductClientPayload.cpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #include "JVariant_NullType_NitroIapkitProductClientPayload.hpp"
9
+
10
+ namespace margelo::nitro::iap {
11
+ /**
12
+ * Converts JVariant_NullType_NitroIapkitProductClientPayload to std::variant<nitro::NullType, NitroIapkitProductClientPayload>
13
+ */
14
+ std::variant<nitro::NullType, NitroIapkitProductClientPayload> JVariant_NullType_NitroIapkitProductClientPayload::toCpp() const {
15
+ if (isInstanceOf(JVariant_NullType_NitroIapkitProductClientPayload_impl::First::javaClassStatic())) {
16
+ // It's a `nitro::NullType`
17
+ auto jniValue = static_cast<const JVariant_NullType_NitroIapkitProductClientPayload_impl::First*>(this)->getValue();
18
+ return nitro::null;
19
+ } else if (isInstanceOf(JVariant_NullType_NitroIapkitProductClientPayload_impl::Second::javaClassStatic())) {
20
+ // It's a `NitroIapkitProductClientPayload`
21
+ auto jniValue = static_cast<const JVariant_NullType_NitroIapkitProductClientPayload_impl::Second*>(this)->getValue();
22
+ return jniValue->toCpp();
23
+ }
24
+ throw std::invalid_argument("Variant is unknown Kotlin instance!");
25
+ }
26
+ } // namespace margelo::nitro::iap
@@ -0,0 +1,74 @@
1
+ ///
2
+ /// JVariant_NullType_NitroIapkitProductClientPayload.hpp
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ #pragma once
9
+
10
+ #include <fbjni/fbjni.h>
11
+ #include <variant>
12
+
13
+ #include <NitroModules/Null.hpp>
14
+ #include "NitroIapkitProductClientPayload.hpp"
15
+ #include <variant>
16
+ #include <NitroModules/JNull.hpp>
17
+ #include "JNitroIapkitProductClientPayload.hpp"
18
+ #include <string>
19
+ #include "IapkitClientPayloadFormat.hpp"
20
+ #include "JIapkitClientPayloadFormat.hpp"
21
+
22
+ namespace margelo::nitro::iap {
23
+
24
+ using namespace facebook;
25
+
26
+ /**
27
+ * The C++ JNI bridge between the C++ std::variant and the Java class "Variant_NullType_NitroIapkitProductClientPayload".
28
+ */
29
+ class JVariant_NullType_NitroIapkitProductClientPayload: public jni::JavaClass<JVariant_NullType_NitroIapkitProductClientPayload> {
30
+ public:
31
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload;";
32
+
33
+ static jni::local_ref<JVariant_NullType_NitroIapkitProductClientPayload> create_0(jni::alias_ref<JNull> value) {
34
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_NitroIapkitProductClientPayload(jni::alias_ref<JNull>)>("create");
35
+ return method(javaClassStatic(), value);
36
+ }
37
+ static jni::local_ref<JVariant_NullType_NitroIapkitProductClientPayload> create_1(jni::alias_ref<JNitroIapkitProductClientPayload> value) {
38
+ static const auto method = javaClassStatic()->getStaticMethod<JVariant_NullType_NitroIapkitProductClientPayload(jni::alias_ref<JNitroIapkitProductClientPayload>)>("create");
39
+ return method(javaClassStatic(), value);
40
+ }
41
+
42
+ static jni::local_ref<JVariant_NullType_NitroIapkitProductClientPayload> fromCpp(const std::variant<nitro::NullType, NitroIapkitProductClientPayload>& variant) {
43
+ switch (variant.index()) {
44
+ case 0: return create_0(JNull::null());
45
+ case 1: return create_1(JNitroIapkitProductClientPayload::fromCpp(std::get<1>(variant)));
46
+ default: throw std::invalid_argument("Variant holds unknown index! (" + std::to_string(variant.index()) + ")");
47
+ }
48
+ }
49
+
50
+ [[nodiscard]] std::variant<nitro::NullType, NitroIapkitProductClientPayload> toCpp() const;
51
+ };
52
+
53
+ namespace JVariant_NullType_NitroIapkitProductClientPayload_impl {
54
+ class First final: public jni::JavaClass<First, JVariant_NullType_NitroIapkitProductClientPayload> {
55
+ public:
56
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload$First;";
57
+
58
+ [[nodiscard]] jni::local_ref<JNull> getValue() const {
59
+ static const auto field = javaClassStatic()->getField<JNull>("value");
60
+ return getFieldValue(field);
61
+ }
62
+ };
63
+
64
+ class Second final: public jni::JavaClass<Second, JVariant_NullType_NitroIapkitProductClientPayload> {
65
+ public:
66
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload$Second;";
67
+
68
+ [[nodiscard]] jni::local_ref<JNitroIapkitProductClientPayload> getValue() const {
69
+ static const auto field = javaClassStatic()->getField<JNitroIapkitProductClientPayload>("value");
70
+ return getFieldValue(field);
71
+ }
72
+ };
73
+ } // namespace JVariant_NullType_NitroIapkitProductClientPayload_impl
74
+ } // namespace margelo::nitro::iap
@@ -15,6 +15,14 @@
15
15
  #include <variant>
16
16
  #include <NitroModules/JNull.hpp>
17
17
  #include "JNitroVerifyPurchaseWithIapkitResult.hpp"
18
+ #include "NitroIapkitProductClientPayload.hpp"
19
+ #include <optional>
20
+ #include "JVariant_NullType_NitroIapkitProductClientPayload.hpp"
21
+ #include "JNitroIapkitProductClientPayload.hpp"
22
+ #include <string>
23
+ #include "IapkitClientPayloadFormat.hpp"
24
+ #include "JIapkitClientPayloadFormat.hpp"
25
+ #include "JVariant_NullType_String.hpp"
18
26
  #include "IapkitPurchaseState.hpp"
19
27
  #include "JIapkitPurchaseState.hpp"
20
28
  #include "IapStore.hpp"
@@ -0,0 +1,24 @@
1
+ ///
2
+ /// IapkitClientPayloadFormat.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.iap
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+
13
+ /**
14
+ * Represents the JavaScript enum/union "IapkitClientPayloadFormat".
15
+ */
16
+ @DoNotStrip
17
+ @Keep
18
+ enum class IapkitClientPayloadFormat(@DoNotStrip @Keep val value: Int) {
19
+ TOML(0),
20
+ JSON(1),
21
+ TEXT(2);
22
+
23
+ companion object
24
+ }
@@ -0,0 +1,66 @@
1
+ ///
2
+ /// NitroIapkitProductClientPayload.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.iap
9
+
10
+ import androidx.annotation.Keep
11
+ import com.facebook.proguard.annotations.DoNotStrip
12
+ import java.util.Objects
13
+
14
+
15
+ /**
16
+ * Represents the JavaScript object/struct "NitroIapkitProductClientPayload".
17
+ */
18
+ @DoNotStrip
19
+ @Keep
20
+ data class NitroIapkitProductClientPayload(
21
+ @DoNotStrip
22
+ @Keep
23
+ val body: String,
24
+ @DoNotStrip
25
+ @Keep
26
+ val format: IapkitClientPayloadFormat,
27
+ @DoNotStrip
28
+ @Keep
29
+ val updatedAt: Double,
30
+ @DoNotStrip
31
+ @Keep
32
+ val version: Double
33
+ ) {
34
+ /* primary constructor */
35
+
36
+ override fun equals(other: Any?): Boolean {
37
+ if (this === other) return true
38
+ if (other !is NitroIapkitProductClientPayload) return false
39
+ return Objects.deepEquals(this.body, other.body)
40
+ && Objects.deepEquals(this.format, other.format)
41
+ && Objects.deepEquals(this.updatedAt, other.updatedAt)
42
+ && Objects.deepEquals(this.version, other.version)
43
+ }
44
+
45
+ override fun hashCode(): Int {
46
+ return arrayOf<Any?>(
47
+ body,
48
+ format,
49
+ updatedAt,
50
+ version
51
+ ).contentDeepHashCode()
52
+ }
53
+
54
+ companion object {
55
+ /**
56
+ * Constructor called from C++
57
+ */
58
+ @DoNotStrip
59
+ @Keep
60
+ @Suppress("unused")
61
+ @JvmStatic
62
+ private fun fromCpp(body: String, format: IapkitClientPayloadFormat, updatedAt: Double, version: Double): NitroIapkitProductClientPayload {
63
+ return NitroIapkitProductClientPayload(body, format, updatedAt, version)
64
+ }
65
+ }
66
+ }
@@ -32,7 +32,10 @@ data class NitroVerifyPurchaseWithIapkitProps(
32
32
  val baseUrl: Variant_NullType_String?,
33
33
  @DoNotStrip
34
34
  @Keep
35
- val google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?
35
+ val google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?,
36
+ @DoNotStrip
37
+ @Keep
38
+ val includeClientPayload: Variant_NullType_Boolean?
36
39
  ) {
37
40
  /* primary constructor */
38
41
 
@@ -44,6 +47,7 @@ data class NitroVerifyPurchaseWithIapkitProps(
44
47
  && Objects.deepEquals(this.apple, other.apple)
45
48
  && Objects.deepEquals(this.baseUrl, other.baseUrl)
46
49
  && Objects.deepEquals(this.google, other.google)
50
+ && Objects.deepEquals(this.includeClientPayload, other.includeClientPayload)
47
51
  }
48
52
 
49
53
  override fun hashCode(): Int {
@@ -52,7 +56,8 @@ data class NitroVerifyPurchaseWithIapkitProps(
52
56
  amazon,
53
57
  apple,
54
58
  baseUrl,
55
- google
59
+ google,
60
+ includeClientPayload
56
61
  ).contentDeepHashCode()
57
62
  }
58
63
 
@@ -64,8 +69,8 @@ data class NitroVerifyPurchaseWithIapkitProps(
64
69
  @Keep
65
70
  @Suppress("unused")
66
71
  @JvmStatic
67
- private fun fromCpp(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?): NitroVerifyPurchaseWithIapkitProps {
68
- return NitroVerifyPurchaseWithIapkitProps(apiKey, amazon, apple, baseUrl, google)
72
+ private fun fromCpp(apiKey: Variant_NullType_String?, amazon: Variant_NullType_NitroVerifyPurchaseWithIapkitAmazonProps?, apple: Variant_NullType_NitroVerifyPurchaseWithIapkitAppleProps?, baseUrl: Variant_NullType_String?, google: Variant_NullType_NitroVerifyPurchaseWithIapkitGoogleProps?, includeClientPayload: Variant_NullType_Boolean?): NitroVerifyPurchaseWithIapkitProps {
73
+ return NitroVerifyPurchaseWithIapkitProps(apiKey, amazon, apple, baseUrl, google, includeClientPayload)
69
74
  }
70
75
  }
71
76
  }
@@ -10,7 +10,7 @@ package com.margelo.nitro.iap
10
10
  import androidx.annotation.Keep
11
11
  import com.facebook.proguard.annotations.DoNotStrip
12
12
  import java.util.Objects
13
-
13
+ import com.margelo.nitro.core.NullType
14
14
 
15
15
  /**
16
16
  * Represents the JavaScript object/struct "NitroVerifyPurchaseWithIapkitResult".
@@ -18,11 +18,17 @@ import java.util.Objects
18
18
  @DoNotStrip
19
19
  @Keep
20
20
  data class NitroVerifyPurchaseWithIapkitResult(
21
+ @DoNotStrip
22
+ @Keep
23
+ val clientPayload: Variant_NullType_NitroIapkitProductClientPayload?,
21
24
  @DoNotStrip
22
25
  @Keep
23
26
  val isValid: Boolean,
24
27
  @DoNotStrip
25
28
  @Keep
29
+ val productId: Variant_NullType_String?,
30
+ @DoNotStrip
31
+ @Keep
26
32
  val state: IapkitPurchaseState,
27
33
  @DoNotStrip
28
34
  @Keep
@@ -33,14 +39,18 @@ data class NitroVerifyPurchaseWithIapkitResult(
33
39
  override fun equals(other: Any?): Boolean {
34
40
  if (this === other) return true
35
41
  if (other !is NitroVerifyPurchaseWithIapkitResult) return false
36
- return Objects.deepEquals(this.isValid, other.isValid)
42
+ return Objects.deepEquals(this.clientPayload, other.clientPayload)
43
+ && Objects.deepEquals(this.isValid, other.isValid)
44
+ && Objects.deepEquals(this.productId, other.productId)
37
45
  && Objects.deepEquals(this.state, other.state)
38
46
  && Objects.deepEquals(this.store, other.store)
39
47
  }
40
48
 
41
49
  override fun hashCode(): Int {
42
50
  return arrayOf<Any?>(
51
+ clientPayload,
43
52
  isValid,
53
+ productId,
44
54
  state,
45
55
  store
46
56
  ).contentDeepHashCode()
@@ -54,8 +64,8 @@ data class NitroVerifyPurchaseWithIapkitResult(
54
64
  @Keep
55
65
  @Suppress("unused")
56
66
  @JvmStatic
57
- private fun fromCpp(isValid: Boolean, state: IapkitPurchaseState, store: IapStore): NitroVerifyPurchaseWithIapkitResult {
58
- return NitroVerifyPurchaseWithIapkitResult(isValid, state, store)
67
+ private fun fromCpp(clientPayload: Variant_NullType_NitroIapkitProductClientPayload?, isValid: Boolean, productId: Variant_NullType_String?, state: IapkitPurchaseState, store: IapStore): NitroVerifyPurchaseWithIapkitResult {
68
+ return NitroVerifyPurchaseWithIapkitResult(clientPayload, isValid, productId, state, store)
59
69
  }
60
70
  }
61
71
  }
@@ -0,0 +1,62 @@
1
+ ///
2
+ /// Variant_NullType_NitroIapkitProductClientPayload.kt
3
+ /// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
4
+ /// https://github.com/mrousavy/nitro
5
+ /// Copyright © Marc Rousavy @ Margelo
6
+ ///
7
+
8
+ package com.margelo.nitro.iap
9
+
10
+ import com.facebook.proguard.annotations.DoNotStrip
11
+ import com.margelo.nitro.core.NullType
12
+
13
+ /**
14
+ * Represents the TypeScript variant "NullType | NitroIapkitProductClientPayload".
15
+ */
16
+ @Suppress("ClassName")
17
+ @DoNotStrip
18
+ sealed class Variant_NullType_NitroIapkitProductClientPayload {
19
+ @DoNotStrip
20
+ data class First(@DoNotStrip val value: NullType): Variant_NullType_NitroIapkitProductClientPayload()
21
+ @DoNotStrip
22
+ data class Second(@DoNotStrip val value: NitroIapkitProductClientPayload): Variant_NullType_NitroIapkitProductClientPayload()
23
+
24
+ inline fun <reified T> asType(): T? {
25
+ return when (this) {
26
+ is First -> (value) as? T
27
+ is Second -> (value) as? T
28
+ }
29
+ }
30
+ inline fun <reified T> isType(): Boolean {
31
+ return asType<T>() != null
32
+ }
33
+ inline fun <R> match(first: (NullType) -> R, second: (NitroIapkitProductClientPayload) -> R): R {
34
+ return when (this) {
35
+ is First -> first(value)
36
+ is Second -> second(value)
37
+ }
38
+ }
39
+
40
+ val isFirst: Boolean
41
+ get() = this is First
42
+ val isSecond: Boolean
43
+ get() = this is Second
44
+
45
+ fun asFirstOrNull(): NullType? {
46
+ val value = (this as? First)?.value ?: return null
47
+ return value
48
+ }
49
+ fun asSecondOrNull(): NitroIapkitProductClientPayload? {
50
+ val value = (this as? Second)?.value ?: return null
51
+ return value
52
+ }
53
+
54
+ companion object {
55
+ @JvmStatic
56
+ @DoNotStrip
57
+ fun create(value: NullType): Variant_NullType_NitroIapkitProductClientPayload = First(value)
58
+ @JvmStatic
59
+ @DoNotStrip
60
+ fun create(value: NitroIapkitProductClientPayload): Variant_NullType_NitroIapkitProductClientPayload = Second(value)
61
+ }
62
+ }
@@ -50,6 +50,8 @@ namespace margelo::nitro::iap { class HybridRnIapSpec; }
50
50
  namespace margelo::nitro::iap { enum class IapPlatform; }
51
51
  // Forward declaration of `IapStore` to properly resolve imports.
52
52
  namespace margelo::nitro::iap { enum class IapStore; }
53
+ // Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
54
+ namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
53
55
  // Forward declaration of `IapkitPurchaseState` to properly resolve imports.
54
56
  namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
55
57
  // Forward declaration of `InAppMessageCategoryAndroid` to properly resolve imports.
@@ -84,6 +86,8 @@ namespace margelo::nitro::iap { struct NitroDiscountDisplayInfoAndroid; }
84
86
  namespace margelo::nitro::iap { struct NitroFinishTransactionAndroidParams; }
85
87
  // Forward declaration of `NitroFinishTransactionIosParams` to properly resolve imports.
86
88
  namespace margelo::nitro::iap { struct NitroFinishTransactionIosParams; }
89
+ // Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
90
+ namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
87
91
  // Forward declaration of `NitroInAppMessageParamsAndroid` to properly resolve imports.
88
92
  namespace margelo::nitro::iap { struct NitroInAppMessageParamsAndroid; }
89
93
  // Forward declaration of `NitroInAppMessageResultAndroid` to properly resolve imports.
@@ -201,6 +205,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
201
205
  #include "HybridRnIapSpec.hpp"
202
206
  #include "IapPlatform.hpp"
203
207
  #include "IapStore.hpp"
208
+ #include "IapkitClientPayloadFormat.hpp"
204
209
  #include "IapkitPurchaseState.hpp"
205
210
  #include "InAppMessageCategoryAndroid.hpp"
206
211
  #include "InAppMessageResponseCodeAndroid.hpp"
@@ -218,6 +223,7 @@ namespace NitroIap { class HybridRnIapSpec_cxx; }
218
223
  #include "NitroDiscountDisplayInfoAndroid.hpp"
219
224
  #include "NitroFinishTransactionAndroidParams.hpp"
220
225
  #include "NitroFinishTransactionIosParams.hpp"
226
+ #include "NitroIapkitProductClientPayload.hpp"
221
227
  #include "NitroInAppMessageParamsAndroid.hpp"
222
228
  #include "NitroInAppMessageResultAndroid.hpp"
223
229
  #include "NitroLimitedQuantityInfoAndroid.hpp"
@@ -2941,6 +2947,50 @@ namespace margelo::nitro::iap::bridge::swift {
2941
2947
  return optional.value();
2942
2948
  }
2943
2949
 
2950
+ // pragma MARK: std::variant<nitro::NullType, NitroIapkitProductClientPayload>
2951
+ /**
2952
+ * Wrapper struct for `std::variant<nitro::NullType, NitroIapkitProductClientPayload>`.
2953
+ * std::variant cannot be used in Swift because of a Swift bug.
2954
+ * Not even specializing it works. So we create a wrapper struct.
2955
+ */
2956
+ struct std__variant_nitro__NullType__NitroIapkitProductClientPayload_ final {
2957
+ std::variant<nitro::NullType, NitroIapkitProductClientPayload> variant;
2958
+ std__variant_nitro__NullType__NitroIapkitProductClientPayload_(std::variant<nitro::NullType, NitroIapkitProductClientPayload> variant): variant(variant) { }
2959
+ operator std::variant<nitro::NullType, NitroIapkitProductClientPayload>() const noexcept {
2960
+ return variant;
2961
+ }
2962
+ inline size_t index() const noexcept {
2963
+ return variant.index();
2964
+ }
2965
+ inline nitro::NullType get_0() const noexcept {
2966
+ return std::get<0>(variant);
2967
+ }
2968
+ inline NitroIapkitProductClientPayload get_1() const noexcept {
2969
+ return std::get<1>(variant);
2970
+ }
2971
+ };
2972
+ inline std__variant_nitro__NullType__NitroIapkitProductClientPayload_ create_std__variant_nitro__NullType__NitroIapkitProductClientPayload_(nitro::NullType value) noexcept {
2973
+ return std__variant_nitro__NullType__NitroIapkitProductClientPayload_(value);
2974
+ }
2975
+ inline std__variant_nitro__NullType__NitroIapkitProductClientPayload_ create_std__variant_nitro__NullType__NitroIapkitProductClientPayload_(const NitroIapkitProductClientPayload& value) noexcept {
2976
+ return std__variant_nitro__NullType__NitroIapkitProductClientPayload_(value);
2977
+ }
2978
+
2979
+ // pragma MARK: std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>
2980
+ /**
2981
+ * Specialized version of `std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>`.
2982
+ */
2983
+ using std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__ = std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>;
2984
+ inline std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>> create_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__(const std::variant<nitro::NullType, NitroIapkitProductClientPayload>& value) noexcept {
2985
+ return std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>(value);
2986
+ }
2987
+ inline bool has_value_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__(const std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>& optional) noexcept {
2988
+ return optional.has_value();
2989
+ }
2990
+ inline std::variant<nitro::NullType, NitroIapkitProductClientPayload> get_std__optional_std__variant_nitro__NullType__NitroIapkitProductClientPayload__(const std::optional<std::variant<nitro::NullType, NitroIapkitProductClientPayload>>& optional) noexcept {
2991
+ return optional.value();
2992
+ }
2993
+
2944
2994
  // pragma MARK: std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitResult>
2945
2995
  /**
2946
2996
  * Wrapper struct for `std::variant<nitro::NullType, NitroVerifyPurchaseWithIapkitResult>`.