Skip to content

Commit

Permalink
remove invalidSubscriptionOfferError + lint
Browse files Browse the repository at this point in the history
  • Loading branch information
fire-at-will committed Oct 31, 2024
1 parent 20ebb1a commit 08ebe4f
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 26 deletions.
5 changes: 0 additions & 5 deletions Sources/Error Handling/ErrorCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import Foundation
@objc(RCFeatureNotAvailableInCustomEntitlementsComputationMode)
case featureNotAvailableInCustomEntitlementsComputationMode = 36
@objc(RCSignatureVerificationFailed) case signatureVerificationFailed = 37
@objc(RCInvalidSubscriptionOffer) case invalidSubscriptionOfferError = 38

// swiftlint:enable missing_docs

Expand Down Expand Up @@ -181,8 +180,6 @@ extension ErrorCode: DescribableError {
return "This feature is not available when utilizing the customEntitlementsComputation dangerousSetting."
case .signatureVerificationFailed:
return "Request failed signature verification. See https://rev.cat/trusted-entitlements for more info."
case .invalidSubscriptionOfferError:
return "Invalid subscription offer type used."

@unknown default:
return "Something went wrong."
Expand Down Expand Up @@ -284,8 +281,6 @@ extension ErrorCode {
return "FEATURE_NOT_AVAILABLE_IN_CUSTOM_ENTITLEMENTS_COMPUTATION_MODE_ERROR"
case .signatureVerificationFailed:
return "SIGNATURE_VERIFICATION_FAILED"
case .invalidSubscriptionOfferError:
return "INVALID_SUBSCRIPTION_OFFER"
@unknown default:
return "UNRECOGNIZED_ERROR"
}
Expand Down
16 changes: 1 addition & 15 deletions Sources/Error Handling/ErrorUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,19 +544,6 @@ enum ErrorUtils {
fileName: fileName, functionName: functionName, line: line)
}

/**
* Constructs an Error with the ``ErrorCode/invalidSubscriptionOffer`` code.
*/
static func invalidSubscriptionOfferError(
error: Error? = nil,
message: String? = nil,
fileName: String = #fileID, functionName: String = #function, line: UInt = #line
) -> PurchasesError {
return ErrorUtils.error(with: .invalidSubscriptionOfferError,
message: message,
underlyingError: error)
}

}

extension ErrorUtils {
Expand Down Expand Up @@ -678,8 +665,7 @@ private extension ErrorUtils {
.invalidPromotionalOfferError,
.offlineConnectionError,
.featureNotAvailableInCustomEntitlementsComputationMode,
.signatureVerificationFailed,
.invalidSubscriptionOfferError:
.signatureVerificationFailed:
Logger.error(
localizedDescription,
fileName: fileName,
Expand Down
1 change: 1 addition & 0 deletions Sources/Purchasing/Purchases/PurchasesOrchestrator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,7 @@ extension PurchasesOrchestrator: StoreKit2TransactionListenerDelegate {
@available(visionOS, unavailable)
extension PurchasesOrchestrator: StoreKit2PurchaseIntentListenerDelegate {

// swiftlint:disable:next function_body_length
func storeKit2PurchaseIntentListener(
_ listener: any StoreKit2PurchaseIntentListenerType,
purchaseIntent: StorePurchaseIntent
Expand Down
7 changes: 1 addition & 6 deletions Tests/UnitTests/Purchasing/ErrorCodeTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,13 +178,8 @@ class ErrorCodeTests: TestCase {
expectedRawValue: 37)
}

func testInvalidSubscriptionOfferError() {
ensureEnumCaseMatchesExpectedRawValue(errorCode: .invalidSubscriptionOfferError,
expectedRawValue: 38)
}

func testErrorCodeEnumCasesAreCoveredInTests() {
expect(ErrorCode.allCases).to(haveCount(38))
expect(ErrorCode.allCases).to(haveCount(37))
}

func ensureEnumCaseMatchesExpectedRawValue(errorCode: ErrorCode, expectedRawValue: Int) {
Expand Down

0 comments on commit 08ebe4f

Please sign in to comment.