Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 0cf1974

Browse files
hyochanclaude
andcommitted
feat: add missing Objective-C bridge methods for subscription management
- Add hasActiveSubscriptionsWithCompletion - Add subscriptionStatusIOSWithSku - Add currentEntitlementIOSWithSku - Add latestTransactionIOSWithSku - Add isEligibleForIntroOfferIOSWithGroupID - Add isTransactionVerifiedIOSWithSku - Add getTransactionJwsIOSWithSku - Add getAppTransactionIOSWithCompletion (iOS 16.0+) All methods follow the existing pattern of converting Swift types to dictionaries using OpenIapSerialization.encode() for Kotlin Multiplatform compatibility. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ae77fea commit 0cf1974

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

Sources/OpenIapModule+ObjC.swift

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,111 @@ import StoreKit
318318
}
319319
}
320320

321+
@objc func hasActiveSubscriptionsWithCompletion(_ completion: @escaping (Bool, Error?) -> Void) {
322+
Task {
323+
do {
324+
let hasActive = try await hasActiveSubscriptions(nil)
325+
completion(hasActive, nil)
326+
} catch {
327+
completion(false, error)
328+
}
329+
}
330+
}
331+
332+
@objc func subscriptionStatusIOSWithSku(_ sku: String, completion: @escaping ([Any]?, Error?) -> Void) {
333+
Task {
334+
do {
335+
let statuses = try await subscriptionStatusIOS(sku: sku)
336+
let dictionaries = statuses.map { OpenIapSerialization.encode($0) }
337+
completion(dictionaries, nil)
338+
} catch {
339+
completion(nil, error)
340+
}
341+
}
342+
}
343+
344+
@objc func currentEntitlementIOSWithSku(_ sku: String, completion: @escaping (Any?, Error?) -> Void) {
345+
Task {
346+
do {
347+
let purchase = try await currentEntitlementIOS(sku: sku)
348+
if let purchaseIOS = purchase {
349+
let dictionary = OpenIapSerialization.encode(purchaseIOS)
350+
completion(dictionary, nil)
351+
} else {
352+
completion(nil, nil)
353+
}
354+
} catch {
355+
completion(nil, error)
356+
}
357+
}
358+
}
359+
360+
@objc func latestTransactionIOSWithSku(_ sku: String, completion: @escaping (Any?, Error?) -> Void) {
361+
Task {
362+
do {
363+
let purchase = try await latestTransactionIOS(sku: sku)
364+
if let purchaseIOS = purchase {
365+
let dictionary = OpenIapSerialization.encode(purchaseIOS)
366+
completion(dictionary, nil)
367+
} else {
368+
completion(nil, nil)
369+
}
370+
} catch {
371+
completion(nil, error)
372+
}
373+
}
374+
}
375+
376+
@objc func isEligibleForIntroOfferIOSWithGroupID(_ groupID: String, completion: @escaping (Bool, Error?) -> Void) {
377+
Task {
378+
do {
379+
let isEligible = try await isEligibleForIntroOfferIOS(groupID: groupID)
380+
completion(isEligible, nil)
381+
} catch {
382+
completion(false, error)
383+
}
384+
}
385+
}
386+
387+
@objc func isTransactionVerifiedIOSWithSku(_ sku: String, completion: @escaping (Bool, Error?) -> Void) {
388+
Task {
389+
do {
390+
let isVerified = try await isTransactionVerifiedIOS(sku: sku)
391+
completion(isVerified, nil)
392+
} catch {
393+
completion(false, error)
394+
}
395+
}
396+
}
397+
398+
@objc func getTransactionJwsIOSWithSku(_ sku: String, completion: @escaping (String?, Error?) -> Void) {
399+
Task {
400+
do {
401+
let jws = try await getTransactionJwsIOS(sku: sku)
402+
completion(jws, nil)
403+
} catch {
404+
completion(nil, error)
405+
}
406+
}
407+
}
408+
409+
@available(iOS 16.0, macOS 14.0, *)
410+
@objc func getAppTransactionIOSWithCompletion(_ completion: @escaping (Any?, Error?) -> Void) {
411+
Task {
412+
do {
413+
let transaction = try await getAppTransactionIOS()
414+
if let appTransaction = transaction {
415+
let dictionary = OpenIapSerialization.encode(appTransaction)
416+
completion(dictionary, nil)
417+
} else {
418+
completion(nil, nil)
419+
}
420+
} catch {
421+
completion(nil, error)
422+
}
423+
}
424+
}
425+
321426
// MARK: - UI
322427

323428
@objc func presentCodeRedemptionSheetIOSWithCompletion(_ completion: @escaping (Bool, Error?) -> Void) {

0 commit comments

Comments
 (0)