Skip to content

Commit

Permalink
TARGETED_DEVICE_FAMILY + inline comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jguz-pubnub committed Mar 18, 2024
1 parent e2f680d commit 6e2d99c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 33 deletions.
36 changes: 18 additions & 18 deletions PubNub.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3855,7 +3855,7 @@
SKIP_INSTALL = YES;
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -3903,7 +3903,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -3932,7 +3932,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand All @@ -3958,7 +3958,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.pubnub.swift.PubNubUserTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
Expand Down Expand Up @@ -4011,7 +4011,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -4061,7 +4061,7 @@
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -4097,7 +4097,7 @@
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down Expand Up @@ -4129,7 +4129,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
Expand Down Expand Up @@ -4181,7 +4181,7 @@
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
Expand Down Expand Up @@ -4229,7 +4229,7 @@
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
SWIFT_EMIT_LOC_STRINGS = YES;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
Expand Down Expand Up @@ -4343,7 +4343,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand All @@ -4369,7 +4369,7 @@
PRODUCT_BUNDLE_IDENTIFIER = com.pubnub.swift.PubNubUserTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
Expand Down Expand Up @@ -4403,7 +4403,7 @@
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down Expand Up @@ -4435,7 +4435,7 @@
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = NO;
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TVOS_DEPLOYMENT_TARGET = 12.0;
VALIDATE_PRODUCT = YES;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
Expand Down Expand Up @@ -4547,7 +4547,7 @@
SWIFT_OBJC_INTERFACE_HEADER_NAME = "PubNubContractTests-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGET_NAME = PubNubContractTests;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down Expand Up @@ -4588,7 +4588,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Tests/PubNubContractTest/PubNubContractTests-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "PubNubContractTests-Swift.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGET_NAME = PubNubContractTests;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down Expand Up @@ -4631,7 +4631,7 @@
SWIFT_OBJC_INTERFACE_HEADER_NAME = "PubNubContractTests-Swift.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGET_NAME = PubNubContractTestsBeta;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down Expand Up @@ -4673,7 +4673,7 @@
SWIFT_OBJC_BRIDGING_HEADER = "Tests/PubNubContractTest/PubNubContractTests-Bridging-Header.h";
SWIFT_OBJC_INTERFACE_HEADER_NAME = "PubNubContractTests-Swift.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGET_NAME = PubNubContractTestsBeta;
WATCHOS_DEPLOYMENT_TARGET = 4.0;
};
Expand Down
16 changes: 12 additions & 4 deletions Sources/PubNub/Helpers/Crypto/Cryptors/Cryptor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,37 @@ public protocol Cryptor: Hashable {
///
/// - Parameters:
/// - data: Data to encrypt
/// - Returns: A success, storing an ``EncryptedData`` value if operation succeeds. Otherwise, a failure storing `PubNubError` is returned
/// - Returns:
/// - **Success**: ``EncryptedData`` representing encrypted content
/// - **Failure**: `Error` describing the reason of failure
func encrypt(data: Data) -> Result<EncryptedData, Error>

/// Decrypts the given `Data` object
///
/// - Parameters:
/// - data: Data to encrypt
/// - Returns: A success, storing decrypted `Data` if operation succeeds. Otherwise, a failure storing `PubNubError` is returned
/// - Returns:
/// - **Success**: ``Data`` representing decrypted content
/// - **Failure**: `Error` describing the reason of failure
func decrypt(data: EncryptedData) -> Result<Data, Error>

/// Encrypts the given `InputStream` object
///
/// - Parameters:
/// - stream: Stream to encrypt
/// - contentLength: Content length of encoded stream
/// - Returns: A success, storing an ``EncryptedStreamData`` value if operation succeeds. Otherwise, a failure storing `PubNubError` is returned
/// - Returns:
/// - **Success**: ``EncryptedStreamData`` representing encrypted content
/// - **Failure**: `Error` describing the reason of failure
func encrypt(stream: InputStream, contentLength: Int) -> Result<EncryptedStreamData, Error>

/// Decrypts the given `InputStream` object
///
/// - Parameters:
/// - data: A value describing encrypted stream
/// - outputPath: URL where the stream should be decrypted to
/// - Returns: A success, storing a decrypted `InputStream` value at the given path if operation succeeds. Otherwise, a failure storing `PubNubError` is returned
/// - Returns:
/// - **Success**: ``InputStream`` representing decrypted content
/// - **Failure**: `Error` describing the reason of failure
func decrypt(data: EncryptedStreamData, outputPath: URL) -> Result<InputStream, Error>
}
19 changes: 8 additions & 11 deletions Sources/PubNub/PubNub.swift
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,14 @@ public extension PubNub {
public var customSession: SessionReplaceable?
/// The endpoint configuration used by the request
public var customConfiguration: RouterConfiguration?
/// The response queue that will
/// The queue that will be used for dispatching a response
public var responseQueue: DispatchQueue

/// Default init for all fields
/// - Parameters:
/// - customSession: The custom Network session that that will be used to make the request
/// - customConfiguration: The endpoint configuration used by the request
/// - responseQueue: The response queue that will
///
/// - responseQueue: The queue that will be used for dispatching a response
public init(
customSession: SessionReplaceable? = nil,
customConfiguration: RouterConfiguration? = nil,
Expand All @@ -141,6 +140,7 @@ public extension PubNub {
/// - Parameters:
/// - start: The value of the start of a next page
/// - end: The value of the end of a slice of paged data
/// - totalCount: Number of items to fetch
public init(start: String? = nil, end: String? = nil, totalCount: Int? = nil) {
self.start = start
self.end = end
Expand Down Expand Up @@ -292,7 +292,6 @@ public extension PubNub {
/// - Parameters:
/// - channel: The destination of the message
/// - message: The message to publish
/// - shouldCompress: Whether the message needs to be compressed before transmission
/// - custom: Custom configuration overrides for this request
/// - completion: The async `Result` of the method call
/// - **Success**: The `Timetoken` of the published Message
Expand Down Expand Up @@ -327,7 +326,6 @@ public extension PubNub {
/// - and: List of channel groups to subscribe on
/// - at: The initial timetoken to subscribe with
/// - withPresence: If true it also subscribes to presence events on the specified channels.
/// - region: The region code from a previous `SubscribeCursor`
func subscribe(
to channels: [String],
and channelGroups: [String] = [],
Expand Down Expand Up @@ -358,14 +356,12 @@ public extension PubNub {
}

/// Stops the subscriptions in progress
/// - Important: This subscription might be shared with multiple `PubNub` instances.
func disconnect() {
subscription.disconnect()
}

/// Reconnets to a stopped subscription with the previous subscribed channels and channel groups
/// - Parameter at: The timetoken value used to reconnect or nil to use the previous stored value
/// - Important: This subscription might be shared with multiple `PubNub` instances.
func reconnect(at timetoken: Timetoken? = nil) {
subscription.reconnect(at: SubscribeCursor(timetoken: timetoken))
}
Expand Down Expand Up @@ -475,6 +471,7 @@ public extension PubNub {
/// - state: The UUID for which to query the subscribed channels of
/// - on: Additional network configuration to use on the request
/// - and: The queue the completion handler should be returned on
/// - custom: Custom configuration overrides for this request
/// - completion: The async `Result` of the method call
/// - **Success**: The presence State set as a `JSONCodable`
/// - **Failure**: An `Error` describing the failure
Expand Down Expand Up @@ -511,6 +508,7 @@ public extension PubNub {
/// - for: The UUID for which to query the subscribed channels of
/// - on: Additional network configuration to use on the request
/// - and: The queue the completion handler should be returned on
/// - custom: Custom configuration overrides for this request
/// - completion: The async `Result` of the method call
/// - **Success**: A `Tuple` containing the UUID that set the State and a `Dictionary` of channels mapped to their respective State
/// - **Failure**: An `Error` describing the failure
Expand Down Expand Up @@ -637,7 +635,6 @@ public extension PubNub {
/// - completion: The async `Result` of the method call
/// - **Success**: The channel-group that was removed
/// - **Failure**: An `Error` describing the failure
/// - result: A `Result` containing either the removed channel-group **or** an `Error`
func remove(
channelGroup: String,
custom requestConfig: RequestConfiguration = RequestConfiguration(),
Expand Down Expand Up @@ -1051,7 +1048,7 @@ public extension PubNub {
/// - page: The paging object used for pagination
/// - custom: Custom configuration overrides for this request
/// - completion: The async `Result` of the method call
/// - **Success**: A `Tuple` of a `Dictionary` of channels mapped to an `Array` their respective `PubNubMessages`, and the next request `PubNubBoundedPage` (if one exists)
/// - **Success**: A `Tuple` containing a `Dictionary` mapping channels to `PubNubMessage` arrays, and an optional next `PubNubBoundedPage`.
/// - **Failure**: An `Error` describing the failure
func fetchMessageHistory(
for channels: [String],
Expand Down Expand Up @@ -1353,8 +1350,8 @@ extension PubNub {
}

/// Decrypts the given `Data` object using `CryptoModule` provided in `configuration`
/// - Parameter message: The encrypted `Data` to decrypt
/// - Returns: A `Result` containing either the decrypted plain text message or the `CryptoError`
/// - Parameter data: The encrypted `Data` to decrypt
/// - Returns: A `Result` containing either the decrypted plain text message or the `CryptoError`
public func decrypt(data: Data) -> Result<String, Error> {
guard let cryptoModule = configuration.cryptoModule else {
PubNub.log.error(ErrorDescription.missingCryptoKey)
Expand Down

0 comments on commit 6e2d99c

Please sign in to comment.