Skip to content

Commit 8b25eb9

Browse files
committed
Revert "fix(apple): add watchOS compatibility"
This reverts commit 1af5222.
1 parent 1af5222 commit 8b25eb9

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

packages/apple/Sources/OpenIapModule+ObjC.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ import StoreKit
603603
}
604604
}
605605

606-
@available(iOS 16.0, macOS 14.0, tvOS 16.0, watchOS 9.0, *)
606+
@available(iOS 16.0, macOS 14.0, *)
607607
@objc func getAppTransactionIOSWithCompletion(_ completion: @escaping (Any?, Error?) -> Void) {
608608
Task {
609609
do {

packages/apple/Sources/OpenIapModule.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -341,8 +341,8 @@ public final class OpenIapModule: NSObject, OpenIapModuleProtocol {
341341
do {
342342
// iOS 17.0+, tvOS 17.0+, macOS 15.2+: Use purchase(confirmIn:options:) for better purchase confirmation UI
343343
// Reference: https://developer.apple.com/documentation/storekit/product/purchase(confirmin:options:)-6dj6y
344-
#if os(iOS) || os(tvOS)
345-
// iOS/tvOS: Use UIWindowScene (not available on watchOS)
344+
#if canImport(UIKit)
345+
// iOS/tvOS: Use UIWindowScene
346346
if #available(iOS 17.0, tvOS 17.0, *) {
347347
let scene: UIWindowScene? = await MainActor.run {
348348
UIApplication.shared.connectedScenes.first as? UIWindowScene
@@ -356,7 +356,7 @@ public final class OpenIapModule: NSObject, OpenIapModuleProtocol {
356356
} else {
357357
result = try await product.purchase(options: options)
358358
}
359-
#elseif os(macOS)
359+
#elseif canImport(AppKit)
360360
// macOS: Use NSWindow (macOS 15.2+)
361361
if #available(macOS 15.2, *) {
362362
let window: NSWindow? = await MainActor.run {
@@ -1066,15 +1066,15 @@ public final class OpenIapModule: NSObject, OpenIapModuleProtocol {
10661066
/// - SeeAlso: https://developer.apple.com/documentation/storekit/skpaymentqueue/3566726-presentcoderedemptionsheet
10671067
public func presentCodeRedemptionSheetIOS() async throws -> Bool {
10681068
try await ensureConnection()
1069-
// presentCodeRedemptionSheet is only available on iOS, not tvOS/watchOS/macOS
1070-
#if os(iOS)
1069+
// tvOS: SKPaymentQueue.presentCodeRedemptionSheet explicitly unavailable on tvOS
1070+
#if canImport(UIKit) && !os(tvOS)
10711071
await MainActor.run {
10721072
SKPaymentQueue.default().presentCodeRedemptionSheet()
10731073
}
10741074
return true
10751075
#else
10761076
throw makePurchaseError(code: .featureNotSupported)
1077-
#endif // os(iOS)
1077+
#endif // canImport(UIKit) && !os(tvOS)
10781078
}
10791079

10801080
public func showManageSubscriptionsIOS() async throws -> [PurchaseIOS] {
@@ -1159,9 +1159,9 @@ public final class OpenIapModule: NSObject, OpenIapModuleProtocol {
11591159

11601160
public func presentExternalPurchaseLinkIOS(_ url: String) async throws -> ExternalPurchaseLinkResultIOS {
11611161
try await ensureConnection()
1162-
// UIApplication.open is available on iOS/tvOS/visionOS but not watchOS/macOS
1162+
// UIKit platforms: Open external link using UIApplication.open
11631163
// Reference: https://developer.apple.com/documentation/uikit/uiapplication/1648685-open
1164-
#if os(iOS) || os(tvOS) || os(visionOS)
1164+
#if canImport(UIKit)
11651165
guard let customLink = URL(string: url) else {
11661166
return ExternalPurchaseLinkResultIOS(
11671167
error: "Invalid URL",
@@ -1184,7 +1184,7 @@ public final class OpenIapModule: NSObject, OpenIapModuleProtocol {
11841184
}
11851185
#else
11861186
throw makePurchaseError(code: .featureNotSupported)
1187-
#endif // os(iOS) || os(tvOS) || os(visionOS)
1187+
#endif // canImport(UIKit)
11881188
}
11891189

11901190
// MARK: - ExternalPurchaseCustomLink (iOS 18.1+)

packages/apple/Sources/OpenIapProtocol.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public protocol OpenIapModuleProtocol {
6969

7070
// Store Information
7171
func getStorefrontIOS() async throws -> String
72-
@available(iOS 16.0, macOS 14.0, tvOS 16.0, watchOS 9.0, *)
72+
@available(iOS 16.0, macOS 14.0, *)
7373
func getAppTransactionIOS() async throws -> AppTransaction?
7474

7575
// Subscription Management

0 commit comments

Comments
 (0)