Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v8] Remove dependency on the Promises SDK #187

Merged
merged 7 commits into from
Jun 11, 2024
Merged
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@
| tvOS | **13.0** |
| macOS | **10.15** |
| watchOS | 7.0 |
- Remove dependency on `FBLPromises`. The following public API have
been removed:
- `- [NSURLSession gul_dataTaskPromiseWithRequest:]`
- `GULURLSessionDataResponse`
The following promise-based public API have been replaced with
completion handler-based alternatives.
- `- [GULKeychainStorage getObjectForKey:objectClass:accessGroup:]`
- `- [GULKeychainStorage setObject:forKey:accessGroup:]`
- `- [GULKeychainStorage removeObjectForKey:accessGroup:]`

# 7.13.3
- Rename parameter placeholder in `GULSecureCoding` unarchiving API to avoid
Expand Down
1 change: 0 additions & 1 deletion GoogleUtilities.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ other Google CocoaPods. They're not intended for direct public usage.
'third_party/IsAppEncrypted/**/*.[mh]'
]
es.public_header_files = 'GoogleUtilities/Environment/Public/GoogleUtilities/*.h'
es.dependency 'PromisesObjC', '>= 1.2', '< 3.0'
es.dependency 'GoogleUtilities/Privacy'
es.frameworks = [
'Security'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

#import <Foundation/Foundation.h>

@class FBLPromise<ValueType>;

NS_ASSUME_NONNULL_BEGIN

/// The class provides a convenient, multiplatform abstraction of the Keychain.
Expand All @@ -34,42 +32,49 @@ NS_ASSUME_NONNULL_BEGIN
*/
- (instancetype)initWithService:(NSString *)service;

/**
* Get an object by key.
* @param key The key.
* @param objectClass The expected object class required by `NSSecureCoding`.
* @param accessGroup The Keychain Access Group.
*
* @return Returns a promise. It is resolved with an object stored by key if exists. It is resolved
* with `nil` when the object not found. It fails on a Keychain error.
*/
- (FBLPromise<id<NSSecureCoding>> *)getObjectForKey:(NSString *)key
objectClass:(Class)objectClass
accessGroup:(nullable NSString *)accessGroup;
/// Get an object by key.
/// @param key The key.
/// @param objectClass The expected object class required by `NSSecureCoding`.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain read is complete. An error is passed to the
/// completion handler if the keychain read fails. Else, the object stored in
/// the keychain, or `nil` if it does not exist, is passed to the completion
/// handler.
- (void)getObjectForKey:(NSString *)key
objectClass:(Class)objectClass
accessGroup:(nullable NSString *)accessGroup
completionHandler:
(void (^)(id<NSSecureCoding> _Nullable obj, NSError *_Nullable error))completionHandler;

/**
* Saves the given object by the given key.
* @param object The object to store.
* @param key The key to store the object. If there is an existing object by the key, it will be
* overridden.
* @param accessGroup The Keychain Access Group.
*
* @return Returns which is resolved with `[NSNull null]` on success.
*/
- (FBLPromise<NSNull *> *)setObject:(id<NSSecureCoding>)object
forKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup;
/// Saves the given object by the given key.
/// @param object The object to store.
/// @param key The key to store the object. If there is an existing object by the key, it will be
/// overridden.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain write is complete. An error is passed to the
/// completion handler if the keychain read fails. Else, the object written to
/// the keychain is passed to the completion handler.
- (void)setObject:(id<NSSecureCoding>)object
forKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup
completionHandler:
(void (^)(id<NSSecureCoding> _Nullable obj, NSError *_Nullable error))completionHandler;

/**
* Removes the object by the given key.
* @param key The key to store the object. If there is an existing object by the key, it will be
* overridden.
* @param accessGroup The Keychain Access Group.
*
* @return Returns which is resolved with `[NSNull null]` on success.
*/
- (FBLPromise<NSNull *> *)removeObjectForKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup;
/// Removes the object by the given key.
/// @param key The key to store the object. If there is an existing object by
/// the key, it will be overridden.
/// @param accessGroup The Keychain Access Group.
/// @param completionHandler The completion handler to call when the
/// synchronized keychain removal is complete. An error is passed to the
/// completion handler if the keychain removal fails. Else, `YES` if the item
/// was removed successfully or doesn’t exist, `NO` otherwise.
/// @note In the event an error occurs, the completion handler will return an
/// error and a boolean to indicate the removal failed (`NO`).
- (void)removeObjectForKey:(NSString *)key
accessGroup:(nullable NSString *)accessGroup
completionHandler:(void (^)(BOOL success, NSError *_Nullable error))completionHandler;
ncooke3 marked this conversation as resolved.
Show resolved Hide resolved

#if TARGET_OS_OSX
/// If not `nil`, then only this keychain will be used to save and read data (see
Expand Down

This file was deleted.

This file was deleted.

Loading
Loading