react-native-iap 15.5.1 → 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.
- package/android/src/main/java/com/margelo/nitro/iap/HybridRnIap.kt +19 -0
- package/ios/HybridRnIap.swift +16 -0
- package/lib/module/hooks/useIAP.js +6 -2
- package/lib/module/hooks/useIAP.js.map +1 -1
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.kepler.js.map +1 -1
- package/lib/module/kit-api.js +27 -0
- package/lib/module/kit-api.js.map +1 -1
- package/lib/module/types.js +7 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/vega-adapter.js +10 -6
- package/lib/module/vega-adapter.js.map +1 -1
- package/lib/typescript/src/hooks/useIAP.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/index.kepler.d.ts +1 -0
- package/lib/typescript/src/index.kepler.d.ts.map +1 -1
- package/lib/typescript/src/kit-api.d.ts +60 -0
- package/lib/typescript/src/kit-api.d.ts.map +1 -1
- package/lib/typescript/src/specs/RnIap.nitro.d.ts +16 -0
- package/lib/typescript/src/specs/RnIap.nitro.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +36 -1
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/vega-adapter.d.ts.map +1 -1
- package/nitrogen/generated/android/NitroIap+autolinking.cmake +1 -0
- package/nitrogen/generated/android/c++/JHybridRnIapSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JIapkitClientPayloadFormat.hpp +61 -0
- package/nitrogen/generated/android/c++/JNitroIapkitProductClientPayload.hpp +71 -0
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitProps.hpp +7 -3
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithIapkitResult.hpp +20 -1
- package/nitrogen/generated/android/c++/JNitroVerifyPurchaseWithProviderResult.hpp +5 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.cpp +26 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroIapkitProductClientPayload.hpp +74 -0
- package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitResult.hpp +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/IapkitClientPayloadFormat.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapkitProductClientPayload.kt +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitProps.kt +9 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroVerifyPurchaseWithIapkitResult.kt +14 -4
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/Variant_NullType_NitroIapkitProductClientPayload.kt +62 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Bridge.hpp +50 -0
- package/nitrogen/generated/ios/NitroIap-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridRnIapSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/swift/IapkitClientPayloadFormat.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroIapkitProductClientPayload.swift +44 -0
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitProps.swift +38 -1
- package/nitrogen/generated/ios/swift/NitroVerifyPurchaseWithIapkitResult.swift +76 -2
- package/nitrogen/generated/ios/swift/Variant_NullType_NitroIapkitProductClientPayload.swift +30 -0
- package/nitrogen/generated/shared/c++/IapkitClientPayloadFormat.hpp +80 -0
- package/nitrogen/generated/shared/c++/NitroIapkitProductClientPayload.hpp +97 -0
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitProps.hpp +6 -2
- package/nitrogen/generated/shared/c++/NitroVerifyPurchaseWithIapkitResult.hpp +16 -1
- package/openiap-versions.json +3 -3
- package/package.json +1 -1
- package/src/hooks/useIAP.ts +6 -2
- package/src/index.kepler.ts +13 -0
- package/src/index.ts +13 -0
- package/src/kit-api.ts +107 -0
- package/src/specs/RnIap.nitro.ts +18 -0
- package/src/types.ts +38 -1
- package/src/vega-adapter.ts +14 -11
|
@@ -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
|
package/nitrogen/generated/android/c++/JVariant_NullType_NitroVerifyPurchaseWithIapkitResult.hpp
CHANGED
|
@@ -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
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/iap/NitroIapkitProductClientPayload.kt
ADDED
|
@@ -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.
|
|
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>`.
|
|
@@ -60,6 +60,8 @@ namespace margelo::nitro::iap { class HybridRnIapSpec; }
|
|
|
60
60
|
namespace margelo::nitro::iap { enum class IapPlatform; }
|
|
61
61
|
// Forward declaration of `IapStore` to properly resolve imports.
|
|
62
62
|
namespace margelo::nitro::iap { enum class IapStore; }
|
|
63
|
+
// Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
|
|
64
|
+
namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
|
|
63
65
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
64
66
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
65
67
|
// Forward declaration of `InAppMessageCategoryAndroid` to properly resolve imports.
|
|
@@ -102,6 +104,8 @@ namespace margelo::nitro::iap { struct NitroFinishTransactionIosParams; }
|
|
|
102
104
|
namespace margelo::nitro::iap { struct NitroFinishTransactionParams; }
|
|
103
105
|
// Forward declaration of `NitroGetBillingChoiceInfoParamsAndroid` to properly resolve imports.
|
|
104
106
|
namespace margelo::nitro::iap { struct NitroGetBillingChoiceInfoParamsAndroid; }
|
|
107
|
+
// Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
|
|
108
|
+
namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
|
|
105
109
|
// Forward declaration of `NitroInAppMessageParamsAndroid` to properly resolve imports.
|
|
106
110
|
namespace margelo::nitro::iap { struct NitroInAppMessageParamsAndroid; }
|
|
107
111
|
// Forward declaration of `NitroInAppMessageResultAndroid` to properly resolve imports.
|
|
@@ -228,6 +232,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
|
|
|
228
232
|
#include "HybridRnIapSpec.hpp"
|
|
229
233
|
#include "IapPlatform.hpp"
|
|
230
234
|
#include "IapStore.hpp"
|
|
235
|
+
#include "IapkitClientPayloadFormat.hpp"
|
|
231
236
|
#include "IapkitPurchaseState.hpp"
|
|
232
237
|
#include "InAppMessageCategoryAndroid.hpp"
|
|
233
238
|
#include "InAppMessageResponseCodeAndroid.hpp"
|
|
@@ -249,6 +254,7 @@ namespace margelo::nitro::iap { struct WinBackOfferInputIOS; }
|
|
|
249
254
|
#include "NitroFinishTransactionIosParams.hpp"
|
|
250
255
|
#include "NitroFinishTransactionParams.hpp"
|
|
251
256
|
#include "NitroGetBillingChoiceInfoParamsAndroid.hpp"
|
|
257
|
+
#include "NitroIapkitProductClientPayload.hpp"
|
|
252
258
|
#include "NitroInAppMessageParamsAndroid.hpp"
|
|
253
259
|
#include "NitroInAppMessageResultAndroid.hpp"
|
|
254
260
|
#include "NitroLaunchExternalLinkParamsAndroid.hpp"
|
|
@@ -132,6 +132,10 @@ namespace margelo::nitro::iap { struct NitroReceiptValidationHorizonOptions; }
|
|
|
132
132
|
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithProviderResult; }
|
|
133
133
|
// Forward declaration of `NitroVerifyPurchaseWithIapkitResult` to properly resolve imports.
|
|
134
134
|
namespace margelo::nitro::iap { struct NitroVerifyPurchaseWithIapkitResult; }
|
|
135
|
+
// Forward declaration of `NitroIapkitProductClientPayload` to properly resolve imports.
|
|
136
|
+
namespace margelo::nitro::iap { struct NitroIapkitProductClientPayload; }
|
|
137
|
+
// Forward declaration of `IapkitClientPayloadFormat` to properly resolve imports.
|
|
138
|
+
namespace margelo::nitro::iap { enum class IapkitClientPayloadFormat; }
|
|
135
139
|
// Forward declaration of `IapkitPurchaseState` to properly resolve imports.
|
|
136
140
|
namespace margelo::nitro::iap { enum class IapkitPurchaseState; }
|
|
137
141
|
// Forward declaration of `NitroVerifyPurchaseWithProviderError` to properly resolve imports.
|
|
@@ -271,6 +275,8 @@ namespace margelo::nitro::iap { enum class ExternalPurchaseCustomLinkNoticeTypeI
|
|
|
271
275
|
#include "NitroReceiptValidationHorizonOptions.hpp"
|
|
272
276
|
#include "NitroVerifyPurchaseWithProviderResult.hpp"
|
|
273
277
|
#include "NitroVerifyPurchaseWithIapkitResult.hpp"
|
|
278
|
+
#include "NitroIapkitProductClientPayload.hpp"
|
|
279
|
+
#include "IapkitClientPayloadFormat.hpp"
|
|
274
280
|
#include "IapkitPurchaseState.hpp"
|
|
275
281
|
#include "NitroVerifyPurchaseWithProviderError.hpp"
|
|
276
282
|
#include "PurchaseVerificationProvider.hpp"
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// IapkitClientPayloadFormat.swift
|
|
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
|
+
/**
|
|
9
|
+
* Represents the JS union `IapkitClientPayloadFormat`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias IapkitClientPayloadFormat = margelo.nitro.iap.IapkitClientPayloadFormat
|
|
12
|
+
|
|
13
|
+
public extension IapkitClientPayloadFormat {
|
|
14
|
+
/**
|
|
15
|
+
* Get a IapkitClientPayloadFormat for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "toml":
|
|
21
|
+
self = .toml
|
|
22
|
+
case "json":
|
|
23
|
+
self = .json
|
|
24
|
+
case "text":
|
|
25
|
+
self = .text
|
|
26
|
+
default:
|
|
27
|
+
return nil
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Get the String value this IapkitClientPayloadFormat represents.
|
|
33
|
+
*/
|
|
34
|
+
var stringValue: String {
|
|
35
|
+
switch self {
|
|
36
|
+
case .toml:
|
|
37
|
+
return "toml"
|
|
38
|
+
case .json:
|
|
39
|
+
return "json"
|
|
40
|
+
case .text:
|
|
41
|
+
return "text"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// NitroIapkitProductClientPayload.swift
|
|
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
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Represents an instance of `NitroIapkitProductClientPayload`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias NitroIapkitProductClientPayload = margelo.nitro.iap.NitroIapkitProductClientPayload
|
|
14
|
+
|
|
15
|
+
public extension NitroIapkitProductClientPayload {
|
|
16
|
+
private typealias bridge = margelo.nitro.iap.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `NitroIapkitProductClientPayload`.
|
|
20
|
+
*/
|
|
21
|
+
init(body: String, format: IapkitClientPayloadFormat, updatedAt: Double, version: Double) {
|
|
22
|
+
self.init(std.string(body), format, updatedAt, version)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@inline(__always)
|
|
26
|
+
var body: String {
|
|
27
|
+
return String(self.__body)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@inline(__always)
|
|
31
|
+
var format: IapkitClientPayloadFormat {
|
|
32
|
+
return self.__format
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@inline(__always)
|
|
36
|
+
var updatedAt: Double {
|
|
37
|
+
return self.__updatedAt
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@inline(__always)
|
|
41
|
+
var version: Double {
|
|
42
|
+
return self.__version
|
|
43
|
+
}
|
|
44
|
+
}
|