From fd723ccfe0bc60378ff0f87f85b8a5c9a21b26cd Mon Sep 17 00:00:00 2001 From: Kamo Spertsyan Date: Wed, 20 Aug 2025 12:01:20 +0300 Subject: [PATCH] ID and Id synchronization --- .../reactnativesdk/QonversionModule.kt | 4 +-- ios/RNQonversion.mm | 2 +- ios/RNQonversionImpl.swift | 2 +- src/QonversionApi.ts | 4 +-- src/dto/Offering.ts | 2 +- src/dto/Product.ts | 28 +++++++++---------- src/internal/QonversionInternal.ts | 12 ++++---- src/internal/specs/NativeQonversionModule.ts | 2 +- 8 files changed, 28 insertions(+), 28 deletions(-) diff --git a/android/src/main/java/com/qonversion/reactnativesdk/QonversionModule.kt b/android/src/main/java/com/qonversion/reactnativesdk/QonversionModule.kt index 83a21319..bc73b0dd 100644 --- a/android/src/main/java/com/qonversion/reactnativesdk/QonversionModule.kt +++ b/android/src/main/java/com/qonversion/reactnativesdk/QonversionModule.kt @@ -172,8 +172,8 @@ class QonversionModule(reactContext: ReactApplicationContext) : NativeQonversion } @ReactMethod - override fun identify(userID: String, promise: Promise) { - qonversionSandwich.identify(userID, getResultListener(promise)) + override fun identify(userId: String, promise: Promise) { + qonversionSandwich.identify(userId, getResultListener(promise)) } @ReactMethod diff --git a/ios/RNQonversion.mm b/ios/RNQonversion.mm index 15ce8be0..f9c8cbba 100644 --- a/ios/RNQonversion.mm +++ b/ios/RNQonversion.mm @@ -124,7 +124,7 @@ - (void)isFallbackFileAccessible:(RCTPromiseResolveBlock)resolve reject:(RCTProm } - (void)collectAdvertisingId { - [self.impl collectAdvertisingID]; + [self.impl collectAdvertisingId]; } - (void)collectAppleSearchAdsAttribution { diff --git a/ios/RNQonversionImpl.swift b/ios/RNQonversionImpl.swift index 4b947963..bdd70e49 100644 --- a/ios/RNQonversionImpl.swift +++ b/ios/RNQonversionImpl.swift @@ -217,7 +217,7 @@ public class RNQonversionImpl: NSObject { } @objc - public func collectAdvertisingID() { + public func collectAdvertisingId() { qonversionSandwich?.collectAdvertisingId() } diff --git a/src/QonversionApi.ts b/src/QonversionApi.ts index 924f1f23..7c12bbff 100644 --- a/src/QonversionApi.ts +++ b/src/QonversionApi.ts @@ -150,10 +150,10 @@ export interface QonversionApi { /** * Call this function to link a user to his unique ID in your system and share purchase data. * - * @param userID unique user ID in your system + * @param userId unique user ID in your system * @returns the promise with the information about the identified user. */ - identify(userID: string): Promise; + identify(userId: string): Promise; /** * Call this function to unlink a user from his unique ID in your system and his purchase data. diff --git a/src/dto/Offering.ts b/src/dto/Offering.ts index 8bf4565c..747d413d 100644 --- a/src/dto/Offering.ts +++ b/src/dto/Offering.ts @@ -13,7 +13,7 @@ class Offering { } productForIdentifier(identifier: string): Product | undefined { - return this.products.find((object) => object.qonversionID === identifier); + return this.products.find((object) => object.qonversionId === identifier); } } diff --git a/src/dto/Product.ts b/src/dto/Product.ts index d8bcfaeb..b7f0d802 100644 --- a/src/dto/Product.ts +++ b/src/dto/Product.ts @@ -8,18 +8,18 @@ import PurchaseUpdateModel from './PurchaseUpdateModel'; import SubscriptionPeriod from './SubscriptionPeriod'; class Product { - qonversionID: string; - storeID: string | null; + qonversionId: string; + storeId: string | null; /** * Identifier of the base plan for Google product. */ - basePlanID: string | null; + basePlanId: string | null; /** * Google Play Store details of this product. * Android only. Null for iOS, or if the product was not found. - * Doesn't take into account {@link basePlanID}. + * Doesn't take into account {@link basePlanId}. * @deprecated Consider using {@link storeDetails} instead. */ skuDetails: SkuDetails | null; @@ -39,7 +39,7 @@ class Product { offeringId?: string | null; /** - * For Android - the subscription base plan duration. If the {@link basePlanID} is not specified, + * For Android - the subscription base plan duration. If the {@link basePlanId} is not specified, * the duration is calculated using the deprecated {@link skuDetails}. * For iOS - the duration of the {@link skProduct}. * Null, if it's not a subscription product or the product was not found in the store. @@ -57,7 +57,7 @@ class Product { /** * The calculated type of this product based on the store information. * On Android uses deprecated {@link skuDetails} for the old subscription products - * where {@link basePlanID} is not specified, and {@link storeDetails} for all the other products. + * where {@link basePlanId} is not specified, and {@link storeDetails} for all the other products. * On iOS uses {@link skProduct} information. */ type: ProductType; @@ -74,9 +74,9 @@ class Product { prettyIntroductoryPrice?: string; constructor( - qonversionID: string, - storeID: string, - basePlanID: string | null, + qonversionId: string, + storeId: string, + basePlanId: string | null, skuDetails: SkuDetails | null, storeDetails: ProductStoreDetails | null, skProduct: SKProduct | null, @@ -91,9 +91,9 @@ class Product { storeDescription: string | undefined, prettyIntroductoryPrice: string | undefined, ) { - this.qonversionID = qonversionID; - this.storeID = storeID; - this.basePlanID = basePlanID; + this.qonversionId = qonversionId; + this.storeId = storeId; + this.basePlanId = basePlanId; this.skuDetails = skuDetails; this.storeDetails = storeDetails; this.skProduct = skProduct; @@ -120,7 +120,7 @@ class Product { * @returns purchase model to pass to the purchase method. */ toPurchaseModel(offerId: string | null = null): PurchaseModel { - return new PurchaseModel(this.qonversionID, offerId); + return new PurchaseModel(this.qonversionId, offerId); } /** @@ -152,7 +152,7 @@ class Product { oldProductId: string, updatePolicy: PurchaseUpdatePolicy | null = null ): PurchaseUpdateModel { - return new PurchaseUpdateModel(this.qonversionID, oldProductId, updatePolicy); + return new PurchaseUpdateModel(this.qonversionId, oldProductId, updatePolicy); } } diff --git a/src/internal/QonversionInternal.ts b/src/internal/QonversionInternal.ts index 291bdaac..a3345a3a 100644 --- a/src/internal/QonversionInternal.ts +++ b/src/internal/QonversionInternal.ts @@ -66,7 +66,7 @@ export default class QonversionInternal implements QonversionApi { if (isAndroid()) { return null; } - const promoOffer = await RNQonversion.getPromotionalOffer(product.qonversionID, discount.identifier); + const promoOffer = await RNQonversion.getPromotionalOffer(product.qonversionId, discount.identifier); const mappedPromoOffer: PromotionalOffer | null = Mapper.convertPromoOffer(promoOffer); return mappedPromoOffer; @@ -89,7 +89,7 @@ export default class QonversionInternal implements QonversionApi { if (isIos()) { purchasePromise = RNQonversion.purchase( - product.qonversionID, + product.qonversionId, options.quantity, options.contextKeys, promoOffer, @@ -100,13 +100,13 @@ export default class QonversionInternal implements QonversionApi { ); } else { purchasePromise = RNQonversion.purchase( - product.qonversionID, + product.qonversionId, 1, options.contextKeys, undefined, options.offerId, options.applyOffer, - options.oldProduct?.qonversionID, + options.oldProduct?.qonversionId, options.updatePolicy, ); } @@ -231,8 +231,8 @@ export default class QonversionInternal implements QonversionApi { RNQonversion.syncPurchases(); } - async identify(userID: string): Promise { - const userInfo = await RNQonversion.identify(userID); + async identify(userId: string): Promise { + const userInfo = await RNQonversion.identify(userId); const mappedUserInfo: User = Mapper.convertUserInfo(userInfo); return mappedUserInfo; diff --git a/src/internal/specs/NativeQonversionModule.ts b/src/internal/specs/NativeQonversionModule.ts index 0551f6b9..3d5efdfa 100644 --- a/src/internal/specs/NativeQonversionModule.ts +++ b/src/internal/specs/NativeQonversionModule.ts @@ -49,7 +49,7 @@ export interface Spec extends TurboModule { checkEntitlements(): Promise; // Record restore(): Promise; // Record syncPurchases(): void; - identify(userID: string): Promise; + identify(userId: string): Promise; logout(): void; userInfo(): Promise; addAttributionData(data: Object, provider: string): void;