Skip to content

Commit

Permalink
Update inheritance, visibility, objc compatibility
Browse files Browse the repository at this point in the history
Also fix file headers.
resolves #763
  • Loading branch information
taquitos committed Aug 24, 2021
1 parent 6219958 commit 4707ac3
Show file tree
Hide file tree
Showing 85 changed files with 759 additions and 294 deletions.
12 changes: 9 additions & 3 deletions PublicSDKAPITester/RCOfferingAPI.m
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// RCOfferingAPI.m
// APITester
//
// Created by Joshua Liebowitz on 7/9/21.
// Copyright © 2021 Purchases. All rights reserved.
//

@import PurchasesCoreSwift;
Expand All @@ -12,7 +18,7 @@
@implementation RCOfferingAPI

+ (void)checkAPI {
RCOffering *o = [[RCOffering alloc] initWithIdentifier:@"" serverDescription:@"" availablePackages:@[]];
RCOffering *o = nil; // No public initializer.
NSString *i = o.identifier;
NSString *sd = o.serverDescription;
NSArray<RCPackage *> *a = o.availablePackages;
Expand Down
2 changes: 1 addition & 1 deletion Purchases.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@
F5E4383626B852D700841CC8 /* StoreKitExtensions */,
354895D0267AE32D001DC5B1 /* SubscriberAttributes */,
B39E811B268E885900D31189 /* SubscriberAttributes */,
37E355CBB3F3A31A32687B14 /* Transaction.swift */,
);
path = PurchasesCoreSwift;
sourceTree = "<group>";
Expand Down Expand Up @@ -1284,6 +1283,7 @@
A56F9AB026990E9200AFC48F /* PurchaserInfo.swift */,
B35042C326CDB79A00905B95 /* Purchases.swift */,
B35042C526CDD3B100905B95 /* PurchasesDelegate.swift */,
37E355CBB3F3A31A32687B14 /* Transaction.swift */,
);
path = Public;
sourceTree = "<group>";
Expand Down
10 changes: 8 additions & 2 deletions PurchasesCoreSwift/Attribution/ASIdentifierManagerProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@
//
// https://opensource.org/licenses/MIT
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// ASIdentifierManagerProxy.swift
// PurchasesCoreSwift
//
// Created by Juanpe Catalán on 14/7/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions PurchasesCoreSwift/Attribution/AdClientProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
// https://opensource.org/licenses/MIT
//
// AdClientProxy.swift
// PurchasesCoreSwift
//
// Created by Juanpe Catalán on 14/7/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
10 changes: 8 additions & 2 deletions PurchasesCoreSwift/Attribution/AttributionData.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// AttributionData.swift
// PurchasesCoreSwift
//
// Created by Madeline Beyl on 7/7/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
4 changes: 2 additions & 2 deletions PurchasesCoreSwift/Attribution/AttributionFetcher.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//
// AttributionFetcher.swift
//
// Created by Andrés Boedo on 4/8/21.
// Created by Andrés Boedo on 4/8/21.
//

import Foundation
Expand All @@ -26,7 +26,7 @@ enum AttributionFetcherError: Error {

}

class AttributionFetcher: NSObject {
class AttributionFetcher {

private let attributionFactory: AttributionTypeFactory
private let systemInfo: SystemInfo
Expand Down
3 changes: 2 additions & 1 deletion PurchasesCoreSwift/Attribution/AttributionPoster.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import Foundation

class AttributionPoster: NSObject {
class AttributionPoster {

let deviceCache: DeviceCache
let identityManager: IdentityManager
Expand All @@ -34,6 +34,7 @@ class AttributionPoster: NSObject {
self.attributionFetcher = attributionFetcher
self.subscriberAttributesManager = subscriberAttributesManager
}

func post(attributionData data: [String: Any],
fromNetwork network: AttributionNetwork,
forNetworkUserId networkUserId: String?) {
Expand Down
2 changes: 0 additions & 2 deletions PurchasesCoreSwift/Attribution/AttributionTypeFactory.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
// https://opensource.org/licenses/MIT
//
// AttributionTypeFactory.swift
// PurchasesCoreSwift
//
// Created by Juanpe Catalán on 9/7/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
2 changes: 0 additions & 2 deletions PurchasesCoreSwift/Attribution/TrackingManagerProxy.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@
// https://opensource.org/licenses/MIT
//
// TrackingManagerProxy.swift
// PurchasesCoreSwift
//
// Created by Juanpe Catalán on 14/7/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
10 changes: 8 additions & 2 deletions PurchasesCoreSwift/Caching/DeviceCache.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// DeviceCache.swift
// PurchasesCoreSwift
//
// Created by Joshua Liebowitz on 7/13/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
10 changes: 8 additions & 2 deletions PurchasesCoreSwift/Caching/InMemoryCachedObject.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// InMemoryCachedObject.swift
// PurchasesCoreSwift
//
// Created by Joshua Liebowitz on 7/13/21.
// Copyright © 2021 Purchases. All rights reserved.
//

class InMemoryCachedObject<T> {
Expand Down
14 changes: 12 additions & 2 deletions PurchasesCoreSwift/FoundationExtensions/Date+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,21 +1,31 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Date+Extensions.swift
// PurchasesCoreSwift
//
// Created by Josh Holtz on 6/28/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation

extension NSDate {

func rc_millisecondsSince1970AsUInt64() -> UInt64 {
return UInt64(self.timeIntervalSince1970 * 1000.0)
}

}

extension Date {

func rc_millisecondsSince1970AsUInt64() -> UInt64 {
return UInt64(self.timeIntervalSince1970 * 1000.0)
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
//
// Created by Andrés Boedo on 7/29/20.
// Copyright (c) 2020 Purchases. All rights reserved.
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// DateFormatter+Extensions.swift
//
// Created by Andrés Boedo on 7/29/20.
//

import Foundation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Dictionary+Extensions.swift
// PurchasesCoreSwift
//
// Created by César de la Vega on 7/21/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down Expand Up @@ -62,4 +68,5 @@ extension Dictionary {
static func + (lhs: [Key: Value], rhs: [Key: Value]) -> [Key: Value] {
lhs.merging(rhs)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import Foundation

@objc public extension NSError {
extension NSError {

var rc_successfullySynced: Bool {
if code == ErrorCode.networkError.rawValue {
Expand Down
10 changes: 8 additions & 2 deletions PurchasesCoreSwift/FoundationExtensions/Locale+Extensions.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// Locale+Extensions.swift
// PurchasesCoreSwift
//
// Created by Josh Holtz on 6/28/21.
// Copyright © 2021 Purchases. All rights reserved.
//

import Foundation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
// https://opensource.org/licenses/MIT
//
// String+Extensions.swift
// PurchasesCoreSwift
//
// Created by Juanpe Catalán on 9/7/21.
//
Expand Down
4 changes: 0 additions & 4 deletions PurchasesCoreSwift/Identity/IdentityManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,7 @@ class IdentityManager {
"$RCAnonymousID:\(UUID().uuidString.replacingOccurrences(of: "-", with: "").lowercased())"
}

}

// MARK: Deprecated
// TODO: Migrate off these so we can mark them deprecated.
extension IdentityManager {

func identify(appUserID: String, completion: @escaping (Error?) -> Void) {
if currentUserIsAnonymous {
Expand Down
6 changes: 3 additions & 3 deletions PurchasesCoreSwift/Identity/PurchaserInfoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

import Foundation

@objc protocol PurchaserInfoManagerDelegate: NSObjectProtocol {
protocol PurchaserInfoManagerDelegate: AnyObject {

func purchaserInfoManagerDidReceiveUpdated(purchaserInfo: PurchaserInfo)

}

class PurchaserInfoManager: NSObject {
class PurchaserInfoManager {

@objc weak var delegate: PurchaserInfoManagerDelegate?
weak var delegate: PurchaserInfoManagerDelegate?

private(set) var lastSentPurchaserInfo: PurchaserInfo?
private let operationDispatcher: OperationDispatcher
Expand Down
26 changes: 15 additions & 11 deletions PurchasesCoreSwift/IntroEligibilityCalculator.swift
Original file line number Diff line number Diff line change
@@ -1,31 +1,32 @@
//
// Copyright RevenueCat Inc. All Rights Reserved.
//
// Licensed under the MIT License (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://opensource.org/licenses/MIT
//
// IntroEligibilityCalculator.swift
// Purchases
//
// Created by Andrés Boedo on 7/14/20.
// Copyright © 2020 Purchases. All rights reserved.
//

import Foundation
import StoreKit

@objc(RCIntroEligibilityCalculator) public class IntroEligibilityCalculator: NSObject {
class IntroEligibilityCalculator {

private let productsManager: ProductsManager
private let receiptParser: ReceiptParser

@objc public override init() {
self.productsManager = ProductsManager()
self.receiptParser = ReceiptParser()
}

internal init(productsManager: ProductsManager,
receiptParser: ReceiptParser) {
init(productsManager: ProductsManager = ProductsManager(), receiptParser: ReceiptParser = ReceiptParser()) {
self.productsManager = productsManager
self.receiptParser = receiptParser
}

@available(iOS 12.0, macOS 10.14, macCatalyst 13.0, tvOS 12.0, watchOS 6.2, *)
@objc public func checkTrialOrIntroductoryPriceEligibility(
func checkTrialOrIntroductoryPriceEligibility(
with receiptData: Data,
productIdentifiers candidateProductIdentifiers: Set<String>,
completion: @escaping ([String: NSNumber], Error?) -> Void) {
Expand Down Expand Up @@ -93,10 +94,13 @@ private extension IntroEligibilityCalculator {
}
return result
}

}

extension IntroEligibilityStatus {

func toNSNumber() -> NSNumber {
return self.rawValue as NSNumber
}

}
Loading

0 comments on commit 4707ac3

Please sign in to comment.