diff --git a/Bolts.framework/Bolts b/Bolts.framework/Bolts new file mode 100644 index 0000000..5527a84 Binary files /dev/null and b/Bolts.framework/Bolts differ diff --git a/Bolts.framework/Headers/BFAppLink.h b/Bolts.framework/Headers/BFAppLink.h new file mode 100644 index 0000000..aa89efc --- /dev/null +++ b/Bolts.framework/Headers/BFAppLink.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +/*! The version of the App Link protocol that this library supports */ +FOUNDATION_EXPORT NSString *const BFAppLinkVersion; + +/*! + Contains App Link metadata relevant for navigation on this device + derived from the HTML at a given URL. + */ +@interface BFAppLink : NSObject + +/*! + Creates a BFAppLink with the given list of BFAppLinkTargets and target URL. + + Generally, this will only be used by implementers of the BFAppLinkResolving protocol, + as these implementers will produce App Link metadata for a given URL. + + @param sourceURL the URL from which this App Link is derived + @param targets an ordered list of BFAppLinkTargets for this platform derived + from App Link metadata. + @param webURL the fallback web URL, if any, for the app link. + */ ++ (instancetype)appLinkWithSourceURL:(NSURL *)sourceURL + targets:(NSArray *)targets + webURL:(NSURL *)webURL; + +/*! The URL from which this BFAppLink was derived */ +@property (nonatomic, strong, readonly) NSURL *sourceURL; + +/*! + The ordered list of targets applicable to this platform that will be used + for navigation. + */ +@property (nonatomic, copy, readonly) NSArray *targets; + +/*! The fallback web URL to use if no targets are installed on this device. */ +@property (nonatomic, strong, readonly) NSURL *webURL; + +@end diff --git a/Bolts.framework/Headers/BFAppLinkNavigation.h b/Bolts.framework/Headers/BFAppLinkNavigation.h new file mode 100644 index 0000000..d459f72 --- /dev/null +++ b/Bolts.framework/Headers/BFAppLinkNavigation.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import + +/*! + The result of calling navigate on a BFAppLinkNavigation + */ +typedef NS_ENUM(NSInteger, BFAppLinkNavigationType) { + /*! Indicates that the navigation failed and no app was opened */ + BFAppLinkNavigationTypeFailure, + /*! Indicates that the navigation succeeded by opening the URL in the browser */ + BFAppLinkNavigationTypeBrowser, + /*! Indicates that the navigation succeeded by opening the URL in an app on the device */ + BFAppLinkNavigationTypeApp +}; + +@protocol BFAppLinkResolving; +@class BFTask; + +/*! + Represents a pending request to navigate to an App Link. Most developers will + simply use navigateToURLInBackground: to open a URL, but developers can build + custom requests with additional navigation and app data attached to them by + creating BFAppLinkNavigations themselves. + */ +@interface BFAppLinkNavigation : NSObject + +/*! + The extras for the AppLinkNavigation. This will generally contain application-specific + data that should be passed along with the request, such as advertiser or affiliate IDs or + other such metadata relevant on this device. + */ +@property (nonatomic, copy, readonly) NSDictionary *extras; + +/*! + The al_applink_data for the AppLinkNavigation. This will generally contain data common to + navigation attempts such as back-links, user agents, and other information that may be used + in routing and handling an App Link request. + */ +@property (nonatomic, copy, readonly) NSDictionary *appLinkData; + +/*! The AppLink to navigate to */ +@property (nonatomic, strong, readonly) BFAppLink *appLink; + +/*! Creates an AppLinkNavigation with the given link, extras, and App Link data */ ++ (instancetype)navigationWithAppLink:(BFAppLink *)appLink + extras:(NSDictionary *)extras + appLinkData:(NSDictionary *)appLinkData; + +/*! Performs the navigation */ +- (BFAppLinkNavigationType)navigate:(NSError **)error; + +/*! Returns a BFAppLink for the given URL */ ++ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination; + +/*! Returns a BFAppLink for the given URL using the given App Link resolution strategy */ ++ (BFTask *)resolveAppLinkInBackground:(NSURL *)destination resolver:(id)resolver; + +/*! Navigates to a BFAppLink and returns whether it opened in-app or in-browser */ ++ (BFAppLinkNavigationType)navigateToAppLink:(BFAppLink *)link error:(NSError **)error; + +/*! Navigates to a URL (an asynchronous action) and returns a BFNavigationType */ ++ (BFTask *)navigateToURLInBackground:(NSURL *)destination; + +/*! + Navigates to a URL (an asynchronous action) using the given App Link resolution + strategy and returns a BFNavigationType + */ ++ (BFTask *)navigateToURLInBackground:(NSURL *)destination resolver:(id)resolver; + +/*! + Gets the default resolver to be used for App Link resolution. If the developer has not set one explicitly, + a basic, built-in resolver will be used. + */ ++ (id)defaultResolver; + +/*! + Sets the default resolver to be used for App Link resolution. Setting this to nil will revert the + default resolver to the basic, built-in resolver provided by Bolts. + */ ++ (void)setDefaultResolver:(id)resolver; + +@end diff --git a/Bolts.framework/Headers/BFAppLinkResolving.h b/Bolts.framework/Headers/BFAppLinkResolving.h new file mode 100644 index 0000000..b67bdba --- /dev/null +++ b/Bolts.framework/Headers/BFAppLinkResolving.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +@class BFTask; + +/*! + Implement this protocol to provide an alternate strategy for resolving + App Links that may include pre-fetching, caching, or querying for App Link + data from an index provided by a service provider. + */ +@protocol BFAppLinkResolving + +/*! + Asynchronously resolves App Link data for a given URL. + + @param url The URL to resolve into an App Link. + @returns A BFTask that will return a BFAppLink for the given URL. + */ +- (BFTask *)appLinkFromURLInBackground:(NSURL *)url; + +@end diff --git a/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h b/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h new file mode 100644 index 0000000..d19465e --- /dev/null +++ b/Bolts.framework/Headers/BFAppLinkReturnToRefererController.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import +#import + +#import + +@class BFAppLink; +@class BFAppLinkReturnToRefererController; + +/*! + Protocol that a class can implement in order to be notified when the user has navigated back + to the referer of an App Link. + */ +@protocol BFAppLinkReturnToRefererControllerDelegate + +@optional + +/*! Called when the user has tapped to navigate, but before the navigation has been performed. */ +- (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller + willNavigateToAppLink:(BFAppLink *)appLink; + +/*! Called after the navigation has been attempted, with an indication of whether the referer + app link was successfully opened. */ +- (void)returnToRefererController:(BFAppLinkReturnToRefererController *)controller + didNavigateToAppLink:(BFAppLink *)url + type:(BFAppLinkNavigationType)type; + +@end + +/*! + A controller class that implements default behavior for a BFAppLinkReturnToRefererView, including + the ability to display the view above the navigation bar for navigation-based apps. + */ +@interface BFAppLinkReturnToRefererController : NSObject + +/*! + The delegate that will be notified when the user navigates back to the referer. + */ +@property (nonatomic, weak) id delegate; + +/*! + The BFAppLinkReturnToRefererView this controller is controlling. + */ +@property (nonatomic, strong) BFAppLinkReturnToRefererView *view; + +/*! + Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed + contained within another UIView (i.e., not displayed above the navigation bar). + */ +- (instancetype)init; + +/*! + Initializes a controller suitable for controlling a BFAppLinkReturnToRefererView that is to be displayed + displayed above the navigation bar. + */ +- (instancetype)initForDisplayAboveNavController:(UINavigationController *)navController; + +/*! + Removes the view entirely from the navigation controller it is currently displayed in. + */ +- (void)removeFromNavController; + +/*! + Shows the BFAppLinkReturnToRefererView with the specified referer information. If nil or missing data, + the view will not be displayed. */ +- (void)showViewForRefererAppLink:(BFAppLink *)refererAppLink; + +/*! + Shows the BFAppLinkReturnToRefererView with referer information extracted from the specified URL. + If nil or missing referer App Link data, the view will not be displayed. */ +- (void)showViewForRefererURL:(NSURL *)url; + +/*! + Closes the view, possibly animating it. + */ +- (void)closeViewAnimated:(BOOL)animated; + +@end diff --git a/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h b/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h new file mode 100644 index 0000000..d20f73a --- /dev/null +++ b/Bolts.framework/Headers/BFAppLinkReturnToRefererView.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import +#import + +#import + +@class BFAppLinkReturnToRefererView; +@class BFURL; + +typedef NS_ENUM(NSUInteger, BFIncludeStatusBarInSize) { + BFIncludeStatusBarInSizeNever, + BFIncludeStatusBarInSizeIOS7AndLater, + BFIncludeStatusBarInSizeAlways, +}; + +/*! + Protocol that a class can implement in order to be notified when the user has navigated back + to the referer of an App Link. + */ +@protocol BFAppLinkReturnToRefererViewDelegate + +/*! + Called when the user has tapped inside the close button. + */ +- (void)returnToRefererViewDidTapInsideCloseButton:(BFAppLinkReturnToRefererView *)view; + +/*! + Called when the user has tapped inside the App Link portion of the view. + */ +- (void)returnToRefererViewDidTapInsideLink:(BFAppLinkReturnToRefererView *)view + link:(BFAppLink *)link; + +@end + +/*! + Provides a UIView that displays a button allowing users to navigate back to the + application that launched the App Link currently being handled, if the App Link + contained referer data. The user can also close the view by clicking a close button + rather than navigating away. If the view is provided an App Link that does not contain + referer data, it will have zero size and no UI will be displayed. + */ +@interface BFAppLinkReturnToRefererView : UIView + +/*! + The delegate that will be notified when the user navigates back to the referer. + */ +@property (nonatomic, weak) id delegate; + +/*! + The color of the text label and close button. + */ +@property (nonatomic, strong) UIColor *textColor; + +@property (nonatomic, strong) BFAppLink *refererAppLink; + +/*! + Indicates whether to extend the size of the view to include the current status bar + size, for use in scenarios where the view might extend under the status bar on iOS 7 and + above; this property has no effect on earlier versions of iOS. + */ +@property (nonatomic, assign) BFIncludeStatusBarInSize includeStatusBarInSize; + +/*! + Indicates whether the user has closed the view by clicking the close button. + */ +@property (nonatomic, assign) BOOL closed; + +@end diff --git a/Bolts.framework/Headers/BFAppLinkTarget.h b/Bolts.framework/Headers/BFAppLinkTarget.h new file mode 100644 index 0000000..6172126 --- /dev/null +++ b/Bolts.framework/Headers/BFAppLinkTarget.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +/*! + Represents a target defined in App Link metadata, consisting of at least + a URL, and optionally an App Store ID and name. + */ +@interface BFAppLinkTarget : NSObject + +/*! Creates a BFAppLinkTarget with the given app site and target URL. */ ++ (instancetype)appLinkTargetWithURL:(NSURL *)url + appStoreId:(NSString *)appStoreId + appName:(NSString *)appName; + +/*! The URL prefix for this app link target */ +@property (nonatomic, strong, readonly) NSURL *URL; + +/*! The app ID for the app store */ +@property (nonatomic, copy, readonly) NSString *appStoreId; + +/*! The name of the app */ +@property (nonatomic, copy, readonly) NSString *appName; + +@end diff --git a/Bolts.framework/Headers/BFCancellationToken.h b/Bolts.framework/Headers/BFCancellationToken.h new file mode 100644 index 0000000..4d7dec0 --- /dev/null +++ b/Bolts.framework/Headers/BFCancellationToken.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + A block that will be called when a token is cancelled. + */ +typedef void(^BFCancellationBlock)(); + +/*! + The consumer view of a CancellationToken. + Propagates notification that operations should be canceled. + A BFCancellationToken has methods to inspect whether the token has been cancelled. + */ +@interface BFCancellationToken : NSObject + +/*! + Whether cancellation has been requested for this token source. + */ +@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; + +/*! + Register a block to be notified when the token is cancelled. + If the token is already cancelled the delegate will be notified immediately. + */ +- (BFCancellationTokenRegistration *)registerCancellationObserverWithBlock:(BFCancellationBlock)block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFCancellationTokenRegistration.h b/Bolts.framework/Headers/BFCancellationTokenRegistration.h new file mode 100644 index 0000000..fa6090f --- /dev/null +++ b/Bolts.framework/Headers/BFCancellationTokenRegistration.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + Represents the registration of a cancellation observer with a cancellation token. + Can be used to unregister the observer at a later time. + */ +@interface BFCancellationTokenRegistration : NSObject + +/*! + Removes the cancellation observer registered with the token + and releases all resources associated with this registration. + */ +- (void)dispose; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFCancellationTokenSource.h b/Bolts.framework/Headers/BFCancellationTokenSource.h new file mode 100644 index 0000000..4627e99 --- /dev/null +++ b/Bolts.framework/Headers/BFCancellationTokenSource.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class BFCancellationToken; + +/*! + BFCancellationTokenSource represents the producer side of a CancellationToken. + Signals to a CancellationToken that it should be canceled. + It is a cancellation token that also has methods + for changing the state of a token by cancelling it. + */ +@interface BFCancellationTokenSource : NSObject + +/*! + Creates a new cancellation token source. + */ ++ (instancetype)cancellationTokenSource; + +/*! + The cancellation token associated with this CancellationTokenSource. + */ +@property (nonatomic, strong, readonly) BFCancellationToken *token; + +/*! + Whether cancellation has been requested for this token source. + */ +@property (nonatomic, assign, readonly, getter=isCancellationRequested) BOOL cancellationRequested; + +/*! + Cancels the token if it has not already been cancelled. + */ +- (void)cancel; + +/*! + Schedules a cancel operation on this CancellationTokenSource after the specified number of milliseconds. + @param millis The number of milliseconds to wait before completing the returned task. + If delay is `0` the cancel is executed immediately. If delay is `-1` any scheduled cancellation is stopped. + */ +- (void)cancelAfterDelay:(int)millis; + +/*! + Releases all resources associated with this token source, + including disposing of all registrations. + */ +- (void)dispose; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFDefines.h b/Bolts.framework/Headers/BFDefines.h new file mode 100644 index 0000000..cf7dcdf --- /dev/null +++ b/Bolts.framework/Headers/BFDefines.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#if __has_feature(objc_generics) || __has_extension(objc_generics) +# define BF_GENERIC(type) +#else +# define BF_GENERIC(type) +# define BFGenericType id +#endif diff --git a/Bolts.framework/Headers/BFExecutor.h b/Bolts.framework/Headers/BFExecutor.h new file mode 100644 index 0000000..afa4f3d --- /dev/null +++ b/Bolts.framework/Headers/BFExecutor.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + An object that can run a given block. + */ +@interface BFExecutor : NSObject + +/*! + Returns a default executor, which runs continuations immediately until the call stack gets too + deep, then dispatches to a new GCD queue. + */ ++ (instancetype)defaultExecutor; + +/*! + Returns an executor that runs continuations on the thread where the previous task was completed. + */ ++ (instancetype)immediateExecutor; + +/*! + Returns an executor that runs continuations on the main thread. + */ ++ (instancetype)mainThreadExecutor; + +/*! + Returns a new executor that uses the given block to execute continuations. + @param block The block to use. + */ ++ (instancetype)executorWithBlock:(void(^)(void(^block)()))block; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `dispatch_queue_t` to dispatch all continuations onto. + */ ++ (instancetype)executorWithDispatchQueue:(dispatch_queue_t)queue; + +/*! + Returns a new executor that runs continuations on the given queue. + @param queue The instance of `NSOperationQueue` to run all continuations on. + */ ++ (instancetype)executorWithOperationQueue:(NSOperationQueue *)queue; + +/*! + Runs the given block using this executor's particular strategy. + @param block The block to execute. + */ +- (void)execute:(void(^)())block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFMeasurementEvent.h b/Bolts.framework/Headers/BFMeasurementEvent.h new file mode 100644 index 0000000..b3173fc --- /dev/null +++ b/Bolts.framework/Headers/BFMeasurementEvent.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +/*! The name of the notification posted by BFMeasurementEvent */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventNotificationName; + +/*! Defines keys in the userInfo object for the notification named BFMeasurementEventNotificationName */ +/*! The string field for the name of the event */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventNameKey; +/*! The dictionary field for the arguments of the event */ +FOUNDATION_EXPORT NSString *const BFMeasurementEventArgsKey; + +/*! Bolts Events raised by BFMeasurementEvent for Applink */ +/*! + The name of the event posted when [BFURL URLWithURL:] is called successfully. This represents the successful parsing of an app link URL. + */ +FOUNDATION_EXPORT NSString *const BFAppLinkParseEventName; + +/*! + The name of the event posted when [BFURL URLWithInboundURL:] is called successfully. + This represents parsing an inbound app link URL from a different application + */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateInEventName; + +/*! The event raised when the user navigates from your app to other apps */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateOutEventName; + +/*! + The event raised when the user navigates out from your app and back to the referrer app. + e.g when the user leaves your app after tapping the back-to-referrer navigation bar + */ +FOUNDATION_EXPORT NSString *const BFAppLinkNavigateBackToReferrerEventName; + +@interface BFMeasurementEvent : NSObject + +@end diff --git a/Bolts.framework/Headers/BFTask.h b/Bolts.framework/Headers/BFTask.h new file mode 100644 index 0000000..a900696 --- /dev/null +++ b/Bolts.framework/Headers/BFTask.h @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/*! + Error domain used if there was multiple errors on . + */ +extern NSString *const BFTaskErrorDomain; + +/*! + An exception that is thrown if there was multiple exceptions on . + */ +extern NSString *const BFTaskMultipleExceptionsException; + +@class BFExecutor; +@class BFTask; + +/*! + The consumer view of a Task. A BFTask has methods to + inspect the state of the task, and to add continuations to + be run once the task is complete. + */ +@interface BFTask BF_GENERIC(__covariant BFGenericType) : NSObject + +/*! + A block that can act as a continuation for a task. + */ +typedef __nullable id(^BFContinuationBlock)(BFTask BF_GENERIC(BFGenericType) *task); + +/*! + Creates a task that is already completed with the given result. + @param result The result for the task. + */ ++ (instancetype)taskWithResult:(nullable BFGenericType)result; + +/*! + Creates a task that is already completed with the given error. + @param error The error for the task. + */ ++ (instancetype)taskWithError:(NSError *)error; + +/*! + Creates a task that is already completed with the given exception. + @param exception The exception for the task. + */ ++ (instancetype)taskWithException:(NSException *)exception; + +/*! + Creates a task that is already cancelled. + */ ++ (instancetype)cancelledTask; + +/*! + Returns a task that will be completed (with result == nil) once + all of the input tasks have completed. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAllTasks:(nullable NSArray *)tasks; + +/*! + Returns a task that will be completed once all of the input tasks have completed. + If all tasks complete successfully without being faulted or cancelled the result will be + an `NSArray` of all task results in the order they were provided. + @param tasks An `NSArray` of the tasks to use as an input. + */ ++ (instancetype)taskForCompletionOfAllTasksWithResults:(nullable NSArray *)tasks; + +/*! + Returns a task that will be completed a certain amount of time in the future. + @param millis The approximate number of milliseconds to wait before the + task will be finished (with result == nil). + */ ++ (instancetype)taskWithDelay:(int)millis; + +/*! + Returns a task that will be completed a certain amount of time in the future. + @param millis The approximate number of milliseconds to wait before the + task will be finished (with result == nil). + @param token The cancellation token (optional). + */ ++ (instancetype)taskWithDelay:(int)millis cancellationToken:(nullable BFCancellationToken *)token; + +/*! + Returns a task that will be completed after the given block completes with + the specified executor. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to immediately schedule to run with the given executor. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ ++ (instancetype)taskFromExecutor:(BFExecutor *)executor withBlock:(id (^)())block; + +// Properties that will be set on the task once it is completed. + +/*! + The result of a successful task. + */ +@property (nullable, nonatomic, strong, readonly) BFGenericType result; + +/*! + The error of a failed task. + */ +@property (nullable, nonatomic, strong, readonly) NSError *error; + +/*! + The exception of a failed task. + */ +@property (nullable, nonatomic, strong, readonly) NSException *exception; + +/*! + Whether this task has been cancelled. + */ +@property (nonatomic, assign, readonly, getter=isCancelled) BOOL cancelled; + +/*! + Whether this task has completed due to an error or exception. + */ +@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted; + +/*! + Whether this task has completed. + */ +@property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed; + +/*! + Enqueues the given block to be run once this task is complete. + This method uses a default execution strategy. The block will be + run on the thread where the previous task completes, unless the + the stack depth is too deep, in which case it will be run on a + dispatch queue with default priority. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithBlock:(BFContinuationBlock)block; + +/*! + Enqueues the given block to be run once this task is complete. + This method uses a default execution strategy. The block will be + run on the thread where the previous task completes, unless the + the stack depth is too deep, in which case it will be run on a + dispatch queue with default priority. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken; + +/*! + Enqueues the given block to be run once this task is complete. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithExecutor:(BFExecutor *)executor withBlock:(BFContinuationBlock)block; +/*! + Enqueues the given block to be run once this task is complete. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + his method will not be completed until that task is completed. + */ +- (BFTask *)continueWithExecutor:(BFExecutor *)executor + block:(BFContinuationBlock)block + cancellationToken:(nullable BFCancellationToken *)cancellationToken; + +/*! + Identical to continueWithBlock:, except that the block is only run + if this task did not produce a cancellation, error, or exception. + If it did, then the failure will be propagated to the returned + task. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block; + +/*! + Identical to continueWithBlock:, except that the block is only run + if this task did not produce a cancellation, error, or exception. + If it did, then the failure will be propagated to the returned + task. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithSuccessBlock:(BFContinuationBlock)block cancellationToken:(nullable BFCancellationToken *)cancellationToken; + +/*! + Identical to continueWithExecutor:withBlock:, except that the block + is only run if this task did not produce a cancellation, error, or + exception. If it did, then the failure will be propagated to the + returned task. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithExecutor:(BFExecutor *)executor withSuccessBlock:(BFContinuationBlock)block; + +/*! + Identical to continueWithExecutor:withBlock:, except that the block + is only run if this task did not produce a cancellation, error, or + exception. If it did, then the failure will be propagated to the + returned task. + @param executor A BFExecutor responsible for determining how the + continuation block will be run. + @param block The block to be run once this task is complete. + @param cancellationToken The cancellation token (optional). + @returns A task that will be completed after block has run. + If block returns a BFTask, then the task returned from + this method will not be completed until that task is completed. + */ +- (BFTask *)continueWithExecutor:(BFExecutor *)executor + successBlock:(BFContinuationBlock)block + cancellationToken:(nullable BFCancellationToken *)cancellationToken; + +/*! + Waits until this operation is completed. + This method is inefficient and consumes a thread resource while + it's running. It should be avoided. This method logs a warning + message if it is used on the main thread. + */ +- (void)waitUntilFinished; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFTaskCompletionSource.h b/Bolts.framework/Headers/BFTaskCompletionSource.h new file mode 100644 index 0000000..4807a5a --- /dev/null +++ b/Bolts.framework/Headers/BFTaskCompletionSource.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class BFTask BF_GENERIC(BFGenericType); + +/*! + A BFTaskCompletionSource represents the producer side of tasks. + It is a task that also has methods for changing the state of the + task by settings its completion values. + */ +@interface BFTaskCompletionSource BF_GENERIC(__covariant BFGenericType) : NSObject + +/*! + Creates a new unfinished task. + */ ++ (instancetype)taskCompletionSource; + +/*! + The task associated with this TaskCompletionSource. + */ +@property (nonatomic, strong, readonly) BFTask BF_GENERIC(BFGenericType) *task; + +/*! + Completes the task by setting the result. + Attempting to set this for a completed task will raise an exception. + @param result The result of the task. + */ +- (void)setResult:(nullable BFGenericType)result; + +/*! + Completes the task by setting the error. + Attempting to set this for a completed task will raise an exception. + @param error The error for the task. + */ +- (void)setError:(NSError *)error; + +/*! + Completes the task by setting an exception. + Attempting to set this for a completed task will raise an exception. + @param exception The exception for the task. + */ +- (void)setException:(NSException *)exception; + +/*! + Completes the task by marking it as cancelled. + Attempting to set this for a completed task will raise an exception. + */ +- (void)cancel; + +/*! + Sets the result of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetResult:(nullable BFGenericType)result; + +/*! + Sets the error of the task if it wasn't already completed. + @param error The error for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetError:(NSError *)error; + +/*! + Sets the exception of the task if it wasn't already completed. + @param exception The exception for the task. + @returns whether the new value was set. + */ +- (BOOL)trySetException:(NSException *)exception; + +/*! + Sets the cancellation state of the task if it wasn't already completed. + @returns whether the new value was set. + */ +- (BOOL)trySetCancelled; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BFURL.h b/Bolts.framework/Headers/BFURL.h new file mode 100644 index 0000000..924c91d --- /dev/null +++ b/Bolts.framework/Headers/BFURL.h @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +@class BFAppLink; + +/*! + Provides a set of utilities for working with NSURLs, such as parsing of query parameters + and handling for App Link requests. + */ +@interface BFURL : NSObject + +/*! + Creates a link target from a raw URL. + On success, this posts the BFAppLinkParseEventName measurement event. If you are constructing the BFURL within your application delegate's + application:openURL:sourceApplication:annotation:, you should instead use URLWithInboundURL:sourceApplication: + to support better BFMeasurementEvent notifications + @param url The instance of `NSURL` to create BFURL from. + */ ++ (BFURL *)URLWithURL:(NSURL *)url; + +/*! + Creates a link target from a raw URL received from an external application. This is typically called from the app delegate's + application:openURL:sourceApplication:annotation: and will post the BFAppLinkNavigateInEventName measurement event. + @param url The instance of `NSURL` to create BFURL from. + @param sourceApplication the bundle ID of the app that is requesting your app to open the URL. The same sourceApplication in application:openURL:sourceApplication:annotation: + */ ++ (BFURL *)URLWithInboundURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication; + +/*! + Gets the target URL. If the link is an App Link, this is the target of the App Link. + Otherwise, it is the url that created the target. + */ +@property (nonatomic, strong, readonly) NSURL *targetURL; + +/*! + Gets the query parameters for the target, parsed into an NSDictionary. + */ +@property (nonatomic, strong, readonly) NSDictionary *targetQueryParameters; + +/*! + If this link target is an App Link, this is the data found in al_applink_data. + Otherwise, it is nil. + */ +@property (nonatomic, strong, readonly) NSDictionary *appLinkData; + +/*! + If this link target is an App Link, this is the data found in extras. + */ +@property (nonatomic, strong, readonly) NSDictionary *appLinkExtras; + +/*! + The App Link indicating how to navigate back to the referer app, if any. + */ +@property (nonatomic, strong, readonly) BFAppLink *appLinkReferer; + +/*! + The URL that was used to create this BFURL. + */ +@property (nonatomic, strong, readonly) NSURL *inputURL; + +/*! + The query parameters of the inputURL, parsed into an NSDictionary. + */ +@property (nonatomic, strong, readonly) NSDictionary *inputQueryParameters; + +@end diff --git a/Bolts.framework/Headers/BFWebViewAppLinkResolver.h b/Bolts.framework/Headers/BFWebViewAppLinkResolver.h new file mode 100644 index 0000000..3782ae2 --- /dev/null +++ b/Bolts.framework/Headers/BFWebViewAppLinkResolver.h @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import + +#import + +/*! + A reference implementation for an App Link resolver that uses a hidden UIWebView + to parse the HTML containing App Link metadata. + */ +@interface BFWebViewAppLinkResolver : NSObject + +/*! + Gets the instance of a BFWebViewAppLinkResolver. + */ ++ (instancetype)sharedInstance; + +@end diff --git a/Bolts.framework/Headers/Bolts.h b/Bolts.framework/Headers/Bolts.h new file mode 100644 index 0000000..89c7c3e --- /dev/null +++ b/Bolts.framework/Headers/Bolts.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#import +#import +#import +#import +#import +#import +#import +#import + +#if __has_include() && TARGET_OS_IPHONE && !TARGET_OS_WATCH && !TARGET_OS_TV +#import +#import +#import +#import +#import +#import +#import +#import +#import +#endif + +NS_ASSUME_NONNULL_BEGIN + +/*! @abstract 80175001: There were multiple errors. */ +extern NSInteger const kBFMultipleErrorsError; + +@interface Bolts : NSObject + +/*! + Returns the version of the Bolts Framework as an NSString. + @returns The NSString representation of the current version. + */ ++ (NSString *)version; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Bolts.framework/Headers/BoltsVersion.h b/Bolts.framework/Headers/BoltsVersion.h new file mode 100644 index 0000000..4a12412 --- /dev/null +++ b/Bolts.framework/Headers/BoltsVersion.h @@ -0,0 +1 @@ +#define BOLTS_VERSION @"1.5.0" diff --git a/Bolts.framework/Info.plist b/Bolts.framework/Info.plist new file mode 100644 index 0000000..1be5166 Binary files /dev/null and b/Bolts.framework/Info.plist differ diff --git a/Bolts.framework/Modules/module.modulemap b/Bolts.framework/Modules/module.modulemap new file mode 100644 index 0000000..3c92a17 --- /dev/null +++ b/Bolts.framework/Modules/module.modulemap @@ -0,0 +1,15 @@ +framework module Bolts { + umbrella header "Bolts.h" + + export * + module * { export * } + + explicit module BFAppLinkResolving { + header "BFAppLinkResolving.h" + export * + } + explicit module BFWebViewAppLinkResolver { + header "BFWebViewAppLinkResolver.h" + export * + } +} diff --git a/FBSDKCoreKit.framework/FBSDKCoreKit b/FBSDKCoreKit.framework/FBSDKCoreKit new file mode 100644 index 0000000..ea8835e Binary files /dev/null and b/FBSDKCoreKit.framework/FBSDKCoreKit differ diff --git a/FBSDKCoreKit.framework/Headers/FBSDKAccessToken.h b/FBSDKCoreKit.framework/Headers/FBSDKAccessToken.h new file mode 100644 index 0000000..ab9f9b9 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKAccessToken.h @@ -0,0 +1,163 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import +#import +#import + +/*! + @abstract Notification indicating that the `currentAccessToken` has changed. + @discussion the userInfo dictionary of the notification will contain keys + `FBSDKAccessTokenChangeOldKey` and + `FBSDKAccessTokenChangeNewKey`. + */ +FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeNotification; + +/*! + @abstract A key in the notification's userInfo that will be set + if and only if the user ID changed between the old and new tokens. + @discussion Token refreshes can occur automatically with the SDK + which do not change the user. If you're only interested in user + changes (such as logging out), you should check for the existence + of this key. The value is a NSNumber with a boolValue. + + On a fresh start of the app where the SDK reads in the cached value + of an access token, this key will also exist since the access token + is moving from a null state (no user) to a non-null state (user). + */ +FBSDK_EXTERN NSString *const FBSDKAccessTokenDidChangeUserID; + +/* + @abstract key in notification's userInfo object for getting the old token. + @discussion If there was no old token, the key will not be present. + */ +FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeOldKey; + +/* + @abstract key in notification's userInfo object for getting the new token. + @discussion If there is no new token, the key will not be present. + */ +FBSDK_EXTERN NSString *const FBSDKAccessTokenChangeNewKey; + + +/*! + @class FBSDKAccessToken + @abstract Represents an immutable access token for using Facebook services. + */ +@interface FBSDKAccessToken : NSObject + +/*! + @abstract Returns the app ID. + */ +@property (readonly, copy, nonatomic) NSString *appID; + +/*! + @abstract Returns the known declined permissions. + */ +@property (readonly, copy, nonatomic) NSSet *declinedPermissions; + +/*! + @abstract Returns the expiration date. + */ +@property (readonly, copy, nonatomic) NSDate *expirationDate; + +/*! + @abstract Returns the known granted permissions. + */ +@property (readonly, copy, nonatomic) NSSet *permissions; + +/*! + @abstract Returns the date the token was last refreshed. +*/ +@property (readonly, copy, nonatomic) NSDate *refreshDate; + +/*! + @abstract Returns the opaque token string. + */ +@property (readonly, copy, nonatomic) NSString *tokenString; + +/*! + @abstract Returns the user ID. + */ +@property (readonly, copy, nonatomic) NSString *userID; + +/*! + @abstract Initializes a new instance. + @param tokenString the opaque token string. + @param permissions the granted permissions. Note this is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + @param declinedPermissions the declined permissions. Note this is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + @param appID the app ID. + @param userID the user ID. + @param expirationDate the optional expiration date (defaults to distantFuture). + @param refreshDate the optional date the token was last refreshed (defaults to today). + @discussion This initializer should only be used for advanced apps that + manage tokens explicitly. Typical login flows only need to use `FBSDKLoginManager` + along with `+currentAccessToken`. + */ +- (instancetype)initWithTokenString:(NSString *)tokenString + permissions:(NSArray *)permissions + declinedPermissions:(NSArray *)declinedPermissions + appID:(NSString *)appID + userID:(NSString *)userID + expirationDate:(NSDate *)expirationDate + refreshDate:(NSDate *)refreshDate +NS_DESIGNATED_INITIALIZER; + +/*! + @abstract Convenience getter to determine if a permission has been granted + @param permission The permission to check. + */ +- (BOOL)hasGranted:(NSString *)permission; + +/*! + @abstract Compares the receiver to another FBSDKAccessToken + @param token The other token + @return YES if the receiver's values are equal to the other token's values; otherwise NO + */ +- (BOOL)isEqualToAccessToken:(FBSDKAccessToken *)token; + +/*! + @abstract Returns the "global" access token that represents the currently logged in user. + @discussion The `currentAccessToken` is a convenient representation of the token of the + current user and is used by other SDK components (like `FBSDKLoginManager`). + */ ++ (FBSDKAccessToken *)currentAccessToken; + +/*! + @abstract Sets the "global" access token that represents the currently logged in user. + @param token The access token to set. + @discussion This will broadcast a notification and save the token to the app keychain. + */ ++ (void)setCurrentAccessToken:(FBSDKAccessToken *)token; + +/*! + @abstract Refresh the current access token's permission state and extend the token's expiration date, + if possible. + @param completionHandler an optional callback handler that can surface any errors related to permission refreshing. + @discussion On a successful refresh, the currentAccessToken will be updated so you typically only need to + observe the `FBSDKAccessTokenDidChangeNotification` notification. + + If a token is already expired, it cannot be refreshed. + */ ++ (void)refreshCurrentAccessToken:(FBSDKGraphRequestHandler)completionHandler; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKAppEvents.h b/FBSDKCoreKit.framework/Headers/FBSDKAppEvents.h new file mode 100644 index 0000000..ecfe0c3 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKAppEvents.h @@ -0,0 +1,462 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import "FBSDKMacros.h" + +@class FBSDKAccessToken; +@class FBSDKGraphRequest; + +/*! @abstract NSNotificationCenter name indicating a result of a failed log flush attempt. The posted object will be an NSError instance. */ +FBSDK_EXTERN NSString *const FBSDKAppEventsLoggingResultNotification; + +/*! @abstract optional plist key ("FacebookLoggingOverrideAppID") for setting `loggingOverrideAppID` */ +FBSDK_EXTERN NSString *const FBSDKAppEventsOverrideAppIDBundleKey; + +/*! + + @typedef NS_ENUM (NSUInteger, FBSDKAppEventsFlushBehavior) + + @abstract Specifies when `FBSDKAppEvents` sends log events to the server. + + */ +typedef NS_ENUM(NSUInteger, FBSDKAppEventsFlushBehavior) +{ + + /*! Flush automatically: periodically (once a minute or every 100 logged events) and always at app reactivation. */ + FBSDKAppEventsFlushBehaviorAuto = 0, + + /*! Only flush when the `flush` method is called. When an app is moved to background/terminated, the + events are persisted and re-established at activation, but they will only be written with an + explicit call to `flush`. */ + FBSDKAppEventsFlushBehaviorExplicitOnly, + +}; + +/*! + @methodgroup Predefined event names for logging events common to many apps. Logging occurs through the `logEvent` family of methods on `FBSDKAppEvents`. + Common event parameters are provided in the `FBSDKAppEventsParameterNames*` constants. + */ + +/*! Log this event when the user has achieved a level in the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameAchievedLevel; + +/*! Log this event when the user has entered their payment info. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedPaymentInfo; + +/*! Log this event when the user has added an item to their cart. The valueToSum passed to logEvent should be the item's price. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToCart; + +/*! Log this event when the user has added an item to their wishlist. The valueToSum passed to logEvent should be the item's price. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameAddedToWishlist; + +/*! Log this event when a user has completed registration with the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedRegistration; + +/*! Log this event when the user has completed a tutorial in the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameCompletedTutorial; + +/*! Log this event when the user has entered the checkout process. The valueToSum passed to logEvent should be the total price in the cart. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameInitiatedCheckout; + +/*! Log this event when the user has rated an item in the app. The valueToSum passed to logEvent should be the numeric rating. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameRated; + +/*! Log this event when a user has performed a search within the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameSearched; + +/*! Log this event when the user has spent app credits. The valueToSum passed to logEvent should be the number of credits spent. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameSpentCredits; + +/*! Log this event when the user has unlocked an achievement in the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameUnlockedAchievement; + +/*! Log this event when a user has viewed a form of content in the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventNameViewedContent; + +/*! + @methodgroup Predefined event name parameters for common additional information to accompany events logged through the `logEvent` family + of methods on `FBSDKAppEvents`. Common event names are provided in the `FBAppEventName*` constants. + */ + +/*! Parameter key used to specify an ID for the specific piece of content being logged about. Could be an EAN, article identifier, etc., depending on the nature of the app. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentID; + +/*! Parameter key used to specify a generic content type/family for the logged event, e.g. "music", "photo", "video". Options to use will vary based upon what the app is all about. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameContentType; + +/*! Parameter key used to specify currency used with logged event. E.g. "USD", "EUR", "GBP". See ISO-4217 for specific values. One reference for these is . */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameCurrency; + +/*! Parameter key used to specify a description appropriate to the event being logged. E.g., the name of the achievement unlocked in the `FBAppEventNameAchievementUnlocked` event. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameDescription; + +/*! Parameter key used to specify the level achieved in a `FBAppEventNameAchieved` event. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameLevel; + +/*! Parameter key used to specify the maximum rating available for the `FBAppEventNameRate` event. E.g., "5" or "10". */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameMaxRatingValue; + +/*! Parameter key used to specify how many items are being processed for an `FBAppEventNameInitiatedCheckout` or `FBAppEventNamePurchased` event. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameNumItems; + +/*! Parameter key used to specify whether payment info is available for the `FBAppEventNameInitiatedCheckout` event. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNamePaymentInfoAvailable; + +/*! Parameter key used to specify method user has used to register for the app, e.g., "Facebook", "email", "Twitter", etc */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameRegistrationMethod; + +/*! Parameter key used to specify the string provided by the user for a search operation. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSearchString; + +/*! Parameter key used to specify whether the activity being logged about was successful or not. `FBSDKAppEventParameterValueYes` and `FBSDKAppEventParameterValueNo` are good canonical values to use for this parameter. */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterNameSuccess; + +/* + @methodgroup Predefined values to assign to event parameters that accompany events logged through the `logEvent` family + of methods on `FBSDKAppEvents`. Common event parameters are provided in the `FBSDKAppEventParameterName*` constants. + */ + +/*! Yes-valued parameter value to be used with parameter keys that need a Yes/No value */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueYes; + +/*! No-valued parameter value to be used with parameter keys that need a Yes/No value */ +FBSDK_EXTERN NSString *const FBSDKAppEventParameterValueNo; + + +/*! + + @class FBSDKAppEvents + + @abstract + Client-side event logging for specialized application analytics available through Facebook App Insights + and for use with Facebook Ads conversion tracking and optimization. + + @discussion + The `FBSDKAppEvents` static class has a few related roles: + + + Logging predefined and application-defined events to Facebook App Insights with a + numeric value to sum across a large number of events, and an optional set of key/value + parameters that define "segments" for this event (e.g., 'purchaserStatus' : 'frequent', or + 'gamerLevel' : 'intermediate') + + + Logging events to later be used for ads optimization around lifetime value. + + + Methods that control the way in which events are flushed out to the Facebook servers. + + Here are some important characteristics of the logging mechanism provided by `FBSDKAppEvents`: + + + Events are not sent immediately when logged. They're cached and flushed out to the Facebook servers + in a number of situations: + - when an event count threshold is passed (currently 100 logged events). + - when a time threshold is passed (currently 15 seconds). + - when an app has gone to background and is then brought back to the foreground. + + + Events will be accumulated when the app is in a disconnected state, and sent when the connection is + restored and one of the above 'flush' conditions are met. + + + The `FBSDKAppEvents` class in thread-safe in that events may be logged from any of the app's threads. + + + The developer can set the `flushBehavior` on `FBSDKAppEvents` to force the flushing of events to only + occur on an explicit call to the `flush` method. + + + The developer can turn on console debug output for event logging and flushing to the server by using + the `FBSDKLoggingBehaviorAppEvents` value in `[FBSettings setLoggingBehavior:]`. + + Some things to note when logging events: + + + There is a limit on the number of unique event names an app can use, on the order of 300. + + There is a limit to the number of unique parameter names in the provided parameters that can + be used per event, on the order of 25. This is not just for an individual call, but for all + invocations for that eventName. + + Event names and parameter names (the keys in the NSDictionary) must be between 2 and 40 characters, and + must consist of alphanumeric characters, _, -, or spaces. + + The length of each parameter value can be no more than on the order of 100 characters. + + */ +@interface FBSDKAppEvents : NSObject + +/* + * Basic event logging + */ + +/*! + + @abstract + Log an event with just an eventName. + + @param eventName The name of the event to record. Limitations on number of events and name length + are given in the `FBSDKAppEvents` documentation. + + */ ++ (void)logEvent:(NSString *)eventName; + +/*! + + @abstract + Log an event with an eventName and a numeric value to be aggregated with other events of this name. + + @param eventName The name of the event to record. Limitations on number of events and name length + are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. + + @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report + the cumulative and average value of this amount. + */ ++ (void)logEvent:(NSString *)eventName + valueToSum:(double)valueToSum; + + +/*! + + @abstract + Log an event with an eventName and a set of key/value pairs in the parameters dictionary. + Parameter limitations are described above. + + @param eventName The name of the event to record. Limitations on number of events and name construction + are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. + + @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must + be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of + parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names + are provided in `FBSDKAppEventParameterName*` constants. + */ ++ (void)logEvent:(NSString *)eventName + parameters:(NSDictionary *)parameters; + +/*! + + @abstract + Log an event with an eventName, a numeric value to be aggregated with other events of this name, + and a set of key/value pairs in the parameters dictionary. + + @param eventName The name of the event to record. Limitations on number of events and name construction + are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. + + @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report + the cumulative and average value of this amount. + + @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must + be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of + parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names + are provided in `FBSDKAppEventParameterName*` constants. + + */ ++ (void)logEvent:(NSString *)eventName + valueToSum:(double)valueToSum + parameters:(NSDictionary *)parameters; + + +/*! + + @abstract + Log an event with an eventName, a numeric value to be aggregated with other events of this name, + and a set of key/value pairs in the parameters dictionary. Providing session lets the developer + target a particular . If nil is provided, then `[FBSession activeSession]` will be used. + + @param eventName The name of the event to record. Limitations on number of events and name construction + are given in the `FBSDKAppEvents` documentation. Common event names are provided in `FBAppEventName*` constants. + + @param valueToSum Amount to be aggregated into all events of this eventName, and App Insights will report + the cumulative and average value of this amount. Note that this is an NSNumber, and a value of `nil` denotes + that this event doesn't have a value associated with it for summation. + + @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must + be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of + parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names + are provided in `FBSDKAppEventParameterName*` constants. + + @param accessToken The optional access token to log the event as. + */ ++ (void)logEvent:(NSString *)eventName + valueToSum:(NSNumber *)valueToSum + parameters:(NSDictionary *)parameters + accessToken:(FBSDKAccessToken *)accessToken; + +/* + * Purchase logging + */ + +/*! + + @abstract + Log a purchase of the specified amount, in the specified currency. + + @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency. This value + will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). + + @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for + specific values. One reference for these is . + + @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set + to `FBSDKAppEventsFlushBehaviorExplicitOnly`. + + */ ++ (void)logPurchase:(double)purchaseAmount + currency:(NSString *)currency; + +/*! + + @abstract + Log a purchase of the specified amount, in the specified currency, also providing a set of + additional characteristics describing the purchase. + + @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value + will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). + + @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for + specific values. One reference for these is . + + @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must + be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of + parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names + are provided in `FBSDKAppEventParameterName*` constants. + + @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set + to `FBSDKAppEventsFlushBehaviorExplicitOnly`. + + */ ++ (void)logPurchase:(double)purchaseAmount + currency:(NSString *)currency + parameters:(NSDictionary *)parameters; + +/*! + + @abstract + Log a purchase of the specified amount, in the specified currency, also providing a set of + additional characteristics describing the purchase, as well as an to log to. + + @param purchaseAmount Purchase amount to be logged, as expressed in the specified currency.This value + will be rounded to the thousandths place (e.g., 12.34567 becomes 12.346). + + @param currency Currency, is denoted as, e.g. "USD", "EUR", "GBP". See ISO-4217 for + specific values. One reference for these is . + + @param parameters Arbitrary parameter dictionary of characteristics. The keys to this dictionary must + be NSString's, and the values are expected to be NSString or NSNumber. Limitations on the number of + parameters and name construction are given in the `FBSDKAppEvents` documentation. Commonly used parameter names + are provided in `FBSDKAppEventParameterName*` constants. + + @param accessToken The optional access token to log the event as. + + @discussion This event immediately triggers a flush of the `FBSDKAppEvents` event queue, unless the `flushBehavior` is set + to `FBSDKAppEventsFlushBehaviorExplicitOnly`. + + */ ++ (void)logPurchase:(double)purchaseAmount + currency:(NSString *)currency + parameters:(NSDictionary *)parameters + accessToken:(FBSDKAccessToken *)accessToken; + +/*! + + @abstract + Notifies the events system that the app has launched and, when appropriate, logs an "activated app" event. Should typically be placed in the + app delegates' `applicationDidBecomeActive:` method. + + This method also takes care of logging the event indicating the first time this app has been launched, which, among other things, is used to + track user acquisition and app install ads conversions. + + @discussion + `activateApp` will not log an event on every app launch, since launches happen every time the app is backgrounded and then foregrounded. + "activated app" events will be logged when the app has not been active for more than 60 seconds. This method also causes a "deactivated app" + event to be logged when sessions are "completed", and these events are logged with the session length, with an indication of how much + time has elapsed between sessions, and with the number of background/foreground interruptions that session had. This data + is all visible in your app's App Events Insights. + */ ++ (void)activateApp; + +/* + * Control over event batching/flushing + */ + +/*! + + @abstract + Get the current event flushing behavior specifying when events are sent back to Facebook servers. + */ ++ (FBSDKAppEventsFlushBehavior)flushBehavior; + +/*! + + @abstract + Set the current event flushing behavior specifying when events are sent back to Facebook servers. + + @param flushBehavior The desired `FBSDKAppEventsFlushBehavior` to be used. + */ ++ (void)setFlushBehavior:(FBSDKAppEventsFlushBehavior)flushBehavior; + +/*! + @abstract + Set the 'override' App ID for App Event logging. + + @discussion + In some cases, apps want to use one Facebook App ID for login and social presence and another + for App Event logging. (An example is if multiple apps from the same company share an app ID for login, but + want distinct logging.) By default, this value is `nil`, and defers to the `FBSDKAppEventsOverrideAppIDBundleKey` + plist value. If that's not set, it defaults to `[FBSDKSettigns appID]`. + + This should be set before any other calls are made to `FBSDKAppEvents`. Thus, you should set it in your application + delegate's `application:didFinishLaunchingWithOptions:` delegate. + + @param appID The Facebook App ID to be used for App Event logging. + */ ++ (void)setLoggingOverrideAppID:(NSString *)appID; + +/*! + @abstract + Get the 'override' App ID for App Event logging. + + @see setLoggingOverrideAppID: + + */ ++ (NSString *)loggingOverrideAppID; + + +/*! + @abstract + Explicitly kick off flushing of events to Facebook. This is an asynchronous method, but it does initiate an immediate + kick off. Server failures will be reported through the NotificationCenter with notification ID `FBSDKAppEventsLoggingResultNotification`. + */ ++ (void)flush; + +/*! + @abstract + Creates a request representing the Graph API call to retrieve a Custom Audience "third party ID" for the app's Facebook user. + Callers will send this ID back to their own servers, collect up a set to create a Facebook Custom Audience with, + and then use the resultant Custom Audience to target ads. + + @param accessToken The access token to use to establish the user's identity for users logged into Facebook through this app. + If `nil`, then the `[FBSDKAccessToken currentAccessToken]` is used. + + @discussion + The JSON in the request's response will include an "custom_audience_third_party_id" key/value pair, with the value being the ID retrieved. + This ID is an encrypted encoding of the Facebook user's ID and the invoking Facebook app ID. + Multiple calls with the same user will return different IDs, thus these IDs cannot be used to correlate behavior + across devices or applications, and are only meaningful when sent back to Facebook for creating Custom Audiences. + + The ID retrieved represents the Facebook user identified in the following way: if the specified access token is valid, + the ID will represent the user associated with that token; otherwise the ID will represent the user logged into the + native Facebook app on the device. If there is no native Facebook app, no one is logged into it, or the user has opted out + at the iOS level from ad tracking, then a `nil` ID will be returned. + + This method returns `nil` if either the user has opted-out (via iOS) from Ad Tracking, the app itself has limited event usage + via the `[FBSDKSettings limitEventAndDataUsage]` flag, or a specific Facebook user cannot be identified. + */ ++ (FBSDKGraphRequest *)requestForCustomAudienceThirdPartyIDWithAccessToken:(FBSDKAccessToken *)accessToken; +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h b/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h new file mode 100644 index 0000000..8e65e5b --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKAppLinkResolver.h @@ -0,0 +1,82 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@class BFTask; + +// Check if Bolts.framework is available for import +#if __has_include() +// Import it if it's available +# import +#else +// Otherwise - redeclare BFAppLinkResolving protocol to resolve the problem of missing symbols +// Please note: Bolts.framework is still required for AppLink resolving to work, +// but this allows FBSDKCoreKit to weakly link Bolts.framework as well as this enables clang modulemaps to work. + +/*! + Implement this protocol to provide an alternate strategy for resolving + App Links that may include pre-fetching, caching, or querying for App Link + data from an index provided by a service provider. + */ +@protocol BFAppLinkResolving + +/*! + Asynchronously resolves App Link data for a given URL. + + @param url The URL to resolve into an App Link. + @returns A BFTask that will return a BFAppLink for the given URL. + */ +- (BFTask *)appLinkFromURLInBackground:(NSURL *)url; + +@end + +#endif + +/*! + @class FBSDKAppLinkResolver + + @abstract + Provides an implementation of the BFAppLinkResolving protocol that uses the Facebook App Link + Index API to resolve App Links given a URL. It also provides an additional helper method that can resolve + multiple App Links in a single call. + + @discussion + Usage of this type requires a client token. See `[FBSDKSettings setClientToken:]` and linking + Bolts.framework + */ +@interface FBSDKAppLinkResolver : NSObject + +/*! + @abstract Asynchronously resolves App Link data for multiple URLs. + + @param urls An array of NSURLs to resolve into App Links. + @returns A BFTask that will return dictionary mapping input NSURLs to their + corresponding BFAppLink. + + @discussion + You should set the client token before making this call. See `[FBSDKSettings setClientToken:]` + */ +- (BFTask *)appLinksFromURLsInBackground:(NSArray *)urls; + +/*! + @abstract Allocates and initializes a new instance of FBSDKAppLinkResolver. + */ ++ (instancetype)resolver; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKAppLinkUtility.h b/FBSDKCoreKit.framework/Headers/FBSDKAppLinkUtility.h new file mode 100644 index 0000000..216b71d --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKAppLinkUtility.h @@ -0,0 +1,55 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @abstract Describes the callback for fetchDeferredAppLink. + @param url the url representing the deferred App Link + @param error the error during the request, if any + + @discussion The url may also have a fb_click_time_utc query parameter that + represents when the click occurred that caused the deferred App Link to be created. + */ +typedef void (^FBSDKDeferredAppLinkHandler)(NSURL *url, NSError *error); + +/*! + @abstract Class containing App Links related utility methods. + */ +@interface FBSDKAppLinkUtility : NSObject + +/*! + @abstract + Call this method from the main thread to fetch deferred applink data if you use Mobile App + Engagement Ads (https://developers.facebook.com/docs/ads-for-apps/mobile-app-ads-engagement). + This may require a network round trip. If successful, the handler is invoked with the link + data (this will only return a valid URL once, and future calls will result in a nil URL + value in the callback). + + @param handler the handler to be invoked if there is deferred App Link data + + @discussion The handler may contain an NSError instance to capture any errors. In the + common case where there simply was no app link data, the NSError instance will be nil. + + This method should only be called from a location that occurs after any launching URL has + been processed (e.g., you should call this method from your application delegate's + applicationDidBecomeActive:). + */ ++ (void)fetchDeferredAppLink:(FBSDKDeferredAppLinkHandler)handler; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKApplicationDelegate.h b/FBSDKCoreKit.framework/Headers/FBSDKApplicationDelegate.h new file mode 100644 index 0000000..857acd0 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKApplicationDelegate.h @@ -0,0 +1,74 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @class FBSDKApplicationDelegate + + @abstract + The FBSDKApplicationDelegate is designed to post process the results from Facebook Login + or Facebook Dialogs (or any action that requires switching over to the native Facebook + app or Safari). + + @discussion + The methods in this class are designed to mirror those in UIApplicationDelegate, and you + should call them in the respective methods in your AppDelegate implementation. + */ +@interface FBSDKApplicationDelegate : NSObject + +/*! + @abstract Gets the singleton instance. + */ ++ (instancetype)sharedInstance; + +/*! + @abstract + Call this method from the [UIApplicationDelegate application:openURL:sourceApplication:annotation:] method + of the AppDelegate for your app. It should be invoked for the proper processing of responses during interaction + with the native Facebook app or Safari as part of SSO authorization flow or Facebook dialogs. + + @param application The application as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. + + @param url The URL as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. + + @param sourceApplication The sourceApplication as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. + + @param annotation The annotation as passed to [UIApplicationDelegate application:openURL:sourceApplication:annotation:]. + + @return YES if the url was intended for the Facebook SDK, NO if not. + */ +- (BOOL)application:(UIApplication *)application + openURL:(NSURL *)url + sourceApplication:(NSString *)sourceApplication + annotation:(id)annotation; + +/*! + @abstract + Call this method from the [UIApplicationDelegate application:didFinishLaunchingWithOptions:] method + of the AppDelegate for your app. It should be invoked for the proper use of the Facebook SDK. + + @param application The application as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. + + @param launchOptions The launchOptions as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. + + @return YES if the url was intended for the Facebook SDK, NO if not. + */ +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKButton.h b/FBSDKCoreKit.framework/Headers/FBSDKButton.h new file mode 100644 index 0000000..8132998 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKButton.h @@ -0,0 +1,26 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @abstract A base class for common SDK buttons. + */ +@interface FBSDKButton : UIButton + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKConstants.h b/FBSDKCoreKit.framework/Headers/FBSDKConstants.h new file mode 100644 index 0000000..5f53161 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKConstants.h @@ -0,0 +1,210 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +/*! + @abstract The error domain for all errors from FBSDKCoreKit. + @discussion Error codes from the SDK in the range 0-99 are reserved for this domain. + */ +FBSDK_EXTERN NSString *const FBSDKErrorDomain; + +/*! + @typedef NS_ENUM(NSInteger, FBSDKErrorCode) + @abstract Error codes for FBSDKErrorDomain. + */ +typedef NS_ENUM(NSInteger, FBSDKErrorCode) +{ + /*! + @abstract Reserved. + */ + FBSDKReservedErrorCode = 0, + + /*! + @abstract The error code for errors from invalid encryption on incoming encryption URLs. + */ + FBSDKEncryptionErrorCode, + + /*! + @abstract The error code for errors from invalid arguments to SDK methods. + */ + FBSDKInvalidArgumentErrorCode, + + /*! + @abstract The error code for unknown errors. + */ + FBSDKUnknownErrorCode, + + /*! + @abstract A request failed due to a network error. Use NSUnderlyingErrorKey to retrieve + the error object from the NSURLConnection for more information. + */ + FBSDKNetworkErrorCode, + + /*! + @abstract The error code for errors encounted during an App Events flush. + */ + FBSDKAppEventsFlushErrorCode, + + /*! + @abstract An endpoint that returns a binary response was used with FBSDKGraphRequestConnection. + @discussion Endpoints that return image/jpg, etc. should be accessed using NSURLRequest + */ + FBSDKGraphRequestNonTextMimeTypeReturnedErrorCode, + + /*! + @abstract The operation failed because the server returned an unexpected response. + @discussion You can get this error if you are not using the most recent SDK, or you are accessing a version of the + Graph API incompatible with the current SDK. + */ + FBSDKGraphRequestProtocolMismatchErrorCode, + + /*! + @abstract The Graph API returned an error. + @discussion See below for useful userInfo keys (beginning with FBSDKGraphRequestError*) + */ + FBSDKGraphRequestGraphAPIErrorCode, + + /*! + @abstract The specified dialog configuration is not available. + @discussion This error may signify that the configuration for the dialogs has not yet been downloaded from the server + or that the dialog is unavailable. Subsequent attempts to use the dialog may succeed as the configuration is loaded. + */ + FBSDKDialogUnavailableErrorCode, + + /*! + @abstract Indicates an operation failed because a required access token was not found. + */ + FBSDKAccessTokenRequiredErrorCode, + + /*! + @abstract Indicates an app switch (typically for a dialog) failed because the destination app is out of date. + */ + FBSDKAppVersionUnsupportedErrorCode, + + /*! + @abstract Indicates an app switch to the browser (typically for a dialog) failed. + */ + FBSDKBrowswerUnavailableErrorCode, +}; + +/*! + @typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) + @abstract Describes the category of Facebook error. See `FBSDKGraphRequestErrorCategoryKey`. + */ +typedef NS_ENUM(NSUInteger, FBSDKGraphRequestErrorCategory) +{ + /*! The default error category that is not known to be recoverable. Check `FBSDKLocalizedErrorDescriptionKey` for a user facing message. */ + FBSDKGraphRequestErrorCategoryOther = 0, + /*! Indicates the error is temporary (such as server throttling). While a recoveryAttempter will be provided with the error instance, the attempt is guaranteed to succeed so you can simply retry the operation if you do not want to present an alert. */ + FBSDKGraphRequestErrorCategoryTransient = 1, + /*! Indicates the error can be recovered (such as requiring a login). A recoveryAttempter will be provided with the error instance that can take UI action. */ + FBSDKGraphRequestErrorCategoryRecoverable = 2 +}; + +/* + @methodgroup error userInfo keys + */ + +/*! + @abstract The userInfo key for the invalid collection for errors with FBSDKInvalidArgumentErrorCode. + @discussion If the invalid argument is a collection, the collection can be found with this key and the individual + invalid item can be found with FBSDKErrorArgumentValueKey. + */ +FBSDK_EXTERN NSString *const FBSDKErrorArgumentCollectionKey; + +/*! + @abstract The userInfo key for the invalid argument name for errors with FBSDKInvalidArgumentErrorCode. + */ +FBSDK_EXTERN NSString *const FBSDKErrorArgumentNameKey; + +/*! + @abstract The userInfo key for the invalid argument value for errors with FBSDKInvalidArgumentErrorCode. + */ +FBSDK_EXTERN NSString *const FBSDKErrorArgumentValueKey; + +/*! + @abstract The userInfo key for the message for developers in NSErrors that originate from the SDK. + @discussion The developer message will not be localized and is not intended to be presented within the app. + */ +FBSDK_EXTERN NSString *const FBSDKErrorDeveloperMessageKey; + +/*! + @abstract The userInfo key describing a localized description that can be presented to the user. + */ +FBSDK_EXTERN NSString *const FBSDKErrorLocalizedDescriptionKey; + +/*! + @abstract The userInfo key describing a localized title that can be presented to the user, used with `FBSDKLocalizedErrorDescriptionKey`. + */ +FBSDK_EXTERN NSString *const FBSDKErrorLocalizedTitleKey; + +/* + @methodgroup FBSDKGraphRequest error userInfo keys + */ + +/*! + @abstract The userInfo key describing the error category, for error recovery purposes. + @discussion See `FBSDKGraphErrorRecoveryProcessor` and `[FBSDKGraphRequest disableErrorRecovery]`. + */ +FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorCategoryKey; + +/* + @abstract The userInfo key for the Graph API error code. + */ +FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorCode; + +/* + @abstract The userInfo key for the Graph API error subcode. + */ +FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorGraphErrorSubcode; + +/* + @abstract The userInfo key for the HTTP status code. + */ +FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorHTTPStatusCodeKey; + +/* + @abstract The userInfo key for the raw JSON response. + */ +FBSDK_EXTERN NSString *const FBSDKGraphRequestErrorParsedJSONResponseKey; + +/*! + @abstract a formal protocol very similar to the informal protocol NSErrorRecoveryAttempting + */ +@protocol FBSDKErrorRecoveryAttempting + +/*! + @abstract attempt the recovery + @param error the error + @param recoveryOptionIndex the selected option index + @param delegate the delegate + @param didRecoverSelector the callback selector, see discussion. + @param contextInfo context info to pass back to callback selector, see discussion. + @discussion + Given that an error alert has been presented document-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and send the selected message to the specified delegate. The option index is an index into the error's array of localized recovery options. The method selected by didRecoverSelector must have the same signature as: + + - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; + + The value passed for didRecover must be YES if error recovery was completely successful, NO otherwise. + */ +- (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKCopying.h b/FBSDKCoreKit.framework/Headers/FBSDKCopying.h new file mode 100644 index 0000000..f4ad767 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKCopying.h @@ -0,0 +1,33 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @abstract Extension protocol for NSCopying that adds the copy method, which is implemented on NSObject. + @discussion NSObject implicitly conforms to this protocol. + */ +@protocol FBSDKCopying + +/*! + @abstract Implemented by NSObject as a convenience to copyWithZone:. + @return A copy of the receiver. + */ +- (id)copy; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKCoreKit.h b/FBSDKCoreKit.framework/Headers/FBSDKCoreKit.h new file mode 100644 index 0000000..27ef6c0 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKCoreKit.h @@ -0,0 +1,38 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#define FBSDK_VERSION_STRING @"4.5.1" +#define FBSDK_TARGET_PLATFORM_VERSION @"v2.4" diff --git a/FBSDKCoreKit.framework/Headers/FBSDKGraphErrorRecoveryProcessor.h b/FBSDKCoreKit.framework/Headers/FBSDKGraphErrorRecoveryProcessor.h new file mode 100644 index 0000000..d2b0313 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKGraphErrorRecoveryProcessor.h @@ -0,0 +1,97 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import "FBSDKConstants.h" + +@class FBSDKGraphErrorRecoveryProcessor; +@class FBSDKGraphRequest; + +/*! + @abstract Defines a delegate for `FBSDKGraphErrorRecoveryProcessor`. + */ +@protocol FBSDKGraphErrorRecoveryProcessorDelegate + +/*! + @abstract Indicates the error recovery has been attempted. + @param processor the processor instance. + @param didRecover YES if the recovery was successful. + @param error the error that that was attempted to be recovered from. + */ +- (void)processorDidAttemptRecovery:(FBSDKGraphErrorRecoveryProcessor *)processor didRecover:(BOOL)didRecover error:(NSError *)error; + +@optional +/*! + @abstract Indicates the processor is about to process the error. + @param processor the processor instance. + @param error the error is about to be processed. + @discussion return NO if the processor should not process the error. For example, + if you want to prevent alerts of localized messages but otherwise perform retries and recoveries, + you could return NO for errors where userInfo[FBSDKGraphRequestErrorCategoryKey] equal to FBSDKGraphRequestErrorCategoryOther + */ +- (BOOL)processorWillProcessError:(FBSDKGraphErrorRecoveryProcessor *)processor error:(NSError *)error; + +@end + +/*! + @abstract Defines a type that can process Facebook NSErrors with best practices. + @discussion Facebook NSErrors can contain FBSDKErrorRecoveryAttempting instances to recover from errors, or + localized messages to present to the user. This class will process the instances as follows: + + 1. If the error is temporary as indicated by FBSDKGraphRequestErrorCategoryKey, assume the recovery succeeded and + notify the delegate. + 2. If a FBSDKErrorRecoveryAttempting instance is available, display an alert (dispatched to main thread) + with the recovery options and call the instance's [ attemptRecoveryFromError:optionIndex:...]. + 3. If a FBSDKErrorRecoveryAttempting is not available, check the userInfo for FBSDKLocalizedErrorDescriptionKey + and present that in an alert (dispatched to main thread). + + By default, FBSDKGraphRequests use this type to process errors and retry the request upon a successful + recovery. + + Note that Facebook recovery attempters can present UI or even cause app switches (such as to login). Any such + work is dispatched to the main thread (therefore your request handlers may then run on the main thread). + + Login recovery requires FBSDKLoginKit. Login will use FBSDKLoginBehaviorNative and will prompt the user + for all permissions last granted. If any are declined on the new request, the recovery is not successful but + the `[FBSDKAccessToken currentAccessToken]` might still have been updated. + . + */ +@interface FBSDKGraphErrorRecoveryProcessor : NSObject + +/*! + @abstract Gets the delegate. Note this is a strong reference, and is nil'ed out after recovery is complete. + */ +@property (nonatomic, strong, readonly) iddelegate; + +/*! + @abstract Attempts to process the error, return YES if the error can be processed. + @param error the error to process. + @param request the relateed request that may be reissued. + @param delegate the delegate that will be retained until recovery is complete. + */ +- (BOOL)processError:(NSError *)error request:(FBSDKGraphRequest *)request delegate:(id) delegate; + +/*! + @abstract The callback for FBSDKErrorRecoveryAttempting + @param didRecover if the recovery succeeded + @param contextInfo unused + */ +- (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKGraphRequest.h b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequest.h new file mode 100644 index 0000000..5ae03e2 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequest.h @@ -0,0 +1,120 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +@class FBSDKAccessToken; + +/*! + @abstract Represents a request to the Facebook Graph API. + + @discussion `FBSDKGraphRequest` encapsulates the components of a request (the + Graph API path, the parameters, error recovery behavior) and should be + used in conjunction with `FBSDKGraphRequestConnection` to issue the request. + + Nearly all Graph APIs require an access token. Unless specified, the + `[FBSDKAccessToken currentAccessToken]` is used. Therefore, most requests + will require login first (see `FBSDKLoginManager` in FBSDKLoginKit.framework). + + A `- start` method is provided for convenience for single requests. + + By default, FBSDKGraphRequest will attempt to recover any errors returned from + Facebook. You can disable this via `disableErrorRecovery:`. + @see FBSDKGraphErrorRecoveryProcessor + */ +@interface FBSDKGraphRequest : NSObject + +/*! + @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. + @param graphPath the graph path (e.g., @"me"). + @param parameters the optional parameters dictionary. + */ +- (instancetype)initWithGraphPath:(NSString *)graphPath + parameters:(NSDictionary *)parameters; + +/*! + @abstract Initializes a new instance that use use `[FBSDKAccessToken currentAccessToken]`. + @param graphPath the graph path (e.g., @"me"). + @param parameters the optional parameters dictionary. + @param HTTPMethod the optional HTTP method. nil defaults to @"GET". + */ +- (instancetype)initWithGraphPath:(NSString *)graphPath + parameters:(NSDictionary *)parameters + HTTPMethod:(NSString *)HTTPMethod; + +/*! + @abstract Initializes a new instance. + @param graphPath the graph path (e.g., @"me"). + @param parameters the optional parameters dictionary. + @param tokenString the token string to use. Specifying nil will cause no token to be used. + @param version the optional Graph API version (e.g., @"v2.0"). nil defaults to FBSDK_TARGET_PLATFORM_VERSION. + @param HTTPMethod the optional HTTP method (e.g., @"POST"). nil defaults to @"GET". + */ +- (instancetype)initWithGraphPath:(NSString *)graphPath + parameters:(NSDictionary *)parameters + tokenString:(NSString *)tokenString + version:(NSString *)version + HTTPMethod:(NSString *)HTTPMethod +NS_DESIGNATED_INITIALIZER; + +/*! + @abstract The request parameters. + */ +@property (nonatomic, strong, readonly) NSMutableDictionary *parameters; + +/*! + @abstract The access token string used by the request. + */ +@property (nonatomic, copy, readonly) NSString *tokenString; + +/*! + @abstract The Graph API endpoint to use for the request, for example "me". + */ +@property (nonatomic, copy, readonly) NSString *graphPath; + +/*! + @abstract The HTTPMethod to use for the request, for example "GET" or "POST". + */ +@property (nonatomic, copy, readonly) NSString *HTTPMethod; + +/*! + @abstract The Graph API version to use (e.g., "v2.0") + */ +@property (nonatomic, copy, readonly) NSString *version; + +/*! + @abstract If set, disables the automatic error recovery mechanism. + @param disable whether to disable the automatic error recovery mechanism + @discussion By default, non-batched FBSDKGraphRequest instances will automatically try to recover + from errors by constructing a `FBSDKGraphErrorRecoveryProcessor` instance that + re-issues the request on successful recoveries. The re-issued request will call the same + handler as the receiver but may occur with a different `FBSDKGraphRequestConnection` instance. + + This will override [FBSDKSettings setGraphErrorRecoveryDisabled:]. + */ +- (void)setGraphErrorRecoveryDisabled:(BOOL)disable; + +/*! + @abstract Starts a connection to the Graph API. + @param handler The handler block to call when the request completes. + */ +- (FBSDKGraphRequestConnection *)startWithCompletionHandler:(FBSDKGraphRequestHandler)handler; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestConnection.h b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestConnection.h new file mode 100644 index 0000000..441f8dc --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestConnection.h @@ -0,0 +1,311 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +@class FBSDKGraphRequest; +@class FBSDKGraphRequestConnection; + +/*! + @typedef FBSDKGraphRequestHandler + + @abstract + A block that is passed to addRequest to register for a callback with the results of that + request once the connection completes. + + @discussion + Pass a block of this type when calling addRequest. This will be called once + the request completes. The call occurs on the UI thread. + + @param connection The `FBSDKGraphRequestConnection` that sent the request. + + @param result The result of the request. This is a translation of + JSON data to `NSDictionary` and `NSArray` objects. This + is nil if there was an error. + + @param error The `NSError` representing any error that occurred. + + */ +typedef void (^FBSDKGraphRequestHandler)(FBSDKGraphRequestConnection *connection, + id result, + NSError *error); + +/*! + @protocol + + @abstract + The `FBSDKGraphRequestConnectionDelegate` protocol defines the methods used to receive network + activity progress information from a . + */ +@protocol FBSDKGraphRequestConnectionDelegate + +@optional + +/*! + @method + + @abstract + Tells the delegate the request connection will begin loading + + @discussion + If the is created using one of the convenience factory methods prefixed with + start, the object returned from the convenience method has already begun loading and this method + will not be called when the delegate is set. + + @param connection The request connection that is starting a network request + */ +- (void)requestConnectionWillBeginLoading:(FBSDKGraphRequestConnection *)connection; + +/*! + @method + + @abstract + Tells the delegate the request connection finished loading + + @discussion + If the request connection completes without a network error occuring then this method is called. + Invocation of this method does not indicate success of every made, only that the + request connection has no further activity. Use the error argument passed to the FBSDKGraphRequestHandler + block to determine success or failure of each . + + This method is invoked after the completion handler for each . + + @param connection The request connection that successfully completed a network request + */ +- (void)requestConnectionDidFinishLoading:(FBSDKGraphRequestConnection *)connection; + +/*! + @method + + @abstract + Tells the delegate the request connection failed with an error + + @discussion + If the request connection fails with a network error then this method is called. The `error` + argument specifies why the network connection failed. The `NSError` object passed to the + FBSDKGraphRequestHandler block may contain additional information. + + @param connection The request connection that successfully completed a network request + @param error The `NSError` representing the network error that occurred, if any. May be nil + in some circumstances. Consult the `NSError` for the for reliable + failure information. + */ +- (void)requestConnection:(FBSDKGraphRequestConnection *)connection + didFailWithError:(NSError *)error; + +/*! + @method + + @abstract + Tells the delegate how much data has been sent and is planned to send to the remote host + + @discussion + The byte count arguments refer to the aggregated objects, not a particular . + + Like `NSURLConnection`, the values may change in unexpected ways if data needs to be resent. + + @param connection The request connection transmitting data to a remote host + @param bytesWritten The number of bytes sent in the last transmission + @param totalBytesWritten The total number of bytes sent to the remote host + @param totalBytesExpectedToWrite The total number of bytes expected to send to the remote host + */ +- (void)requestConnection:(FBSDKGraphRequestConnection *)connection + didSendBodyData:(NSInteger)bytesWritten + totalBytesWritten:(NSInteger)totalBytesWritten +totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; + +@end + +/*! + @class FBSDKGraphRequestConnection + + @abstract + The `FBSDKGraphRequestConnection` represents a single connection to Facebook to service a request. + + @discussion + The request settings are encapsulated in a reusable object. The + `FBSDKGraphRequestConnection` object encapsulates the concerns of a single communication + e.g. starting a connection, canceling a connection, or batching requests. + + */ +@interface FBSDKGraphRequestConnection : NSObject + +/*! + @abstract + The delegate object that receives updates. + */ +@property (nonatomic, assign) id delegate; + +/*! + @abstract Gets or sets the timeout interval to wait for a response before giving up. + */ +@property (nonatomic) NSTimeInterval timeout; + +/*! + @abstract + The raw response that was returned from the server. (readonly) + + @discussion + This property can be used to inspect HTTP headers that were returned from + the server. + + The property is nil until the request completes. If there was a response + then this property will be non-nil during the FBSDKGraphRequestHandler callback. + */ +@property (nonatomic, retain, readonly) NSHTTPURLResponse *URLResponse; + +/*! + @methodgroup Adding requests + */ + +/*! + @method + + @abstract + This method adds an object to this connection. + + @param request A request to be included in the round-trip when start is called. + @param handler A handler to call back when the round-trip completes or times out. + + @discussion + The completion handler is retained until the block is called upon the + completion or cancellation of the connection. + */ +- (void)addRequest:(FBSDKGraphRequest *)request + completionHandler:(FBSDKGraphRequestHandler)handler; + +/*! + @method + + @abstract + This method adds an object to this connection. + + @param request A request to be included in the round-trip when start is called. + + @param handler A handler to call back when the round-trip completes or times out. + The handler will be invoked on the main thread. + + @param name An optional name for this request. This can be used to feed + the results of one request to the input of another in the same + `FBSDKGraphRequestConnection` as described in + [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). + + @discussion + The completion handler is retained until the block is called upon the + completion or cancellation of the connection. This request can be named + to allow for using the request's response in a subsequent request. + */ +- (void)addRequest:(FBSDKGraphRequest *)request + completionHandler:(FBSDKGraphRequestHandler)handler + batchEntryName:(NSString *)name; + +/*! + @method + + @abstract + This method adds an object to this connection. + + @param request A request to be included in the round-trip when start is called. + + @param handler A handler to call back when the round-trip completes or times out. + + @param batchParameters The optional dictionary of parameters to include for this request + as described in [Graph API Batch Requests]( https://developers.facebook.com/docs/reference/api/batch/ ). + Examples include "depends_on", "name", or "omit_response_on_success". + + @discussion + The completion handler is retained until the block is called upon the + completion or cancellation of the connection. This request can be named + to allow for using the request's response in a subsequent request. + */ +- (void)addRequest:(FBSDKGraphRequest *)request + completionHandler:(FBSDKGraphRequestHandler)handler + batchParameters:(NSDictionary *)batchParameters; + +/*! + @methodgroup Instance methods + */ + +/*! + @method + + @abstract + Signals that a connection should be logically terminated as the + application is no longer interested in a response. + + @discussion + Synchronously calls any handlers indicating the request was cancelled. Cancel + does not guarantee that the request-related processing will cease. It + does promise that all handlers will complete before the cancel returns. A call to + cancel prior to a start implies a cancellation of all requests associated + with the connection. + */ +- (void)cancel; + +/*! + @method + + @abstract + This method starts a connection with the server and is capable of handling all of the + requests that were added to the connection. + + @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. + See `setDelegateQueue:` for other options. + + This method cannot be called twice for an `FBSDKGraphRequestConnection` instance. + */ +- (void)start; + +/*! + @abstract Determines the operation queue that is used to call methods on the connection's delegate. + @param queue The operation queue to use when calling delegate methods. + @discussion By default, a connection is scheduled on the current thread in the default mode when it is created. + You cannot reschedule a connection after it has started. + + This is very similar to `[NSURLConnection setDelegateQueue:]`. + */ +- (void)setDelegateQueue:(NSOperationQueue *)queue; + +/*! + @method + + @abstract + Overrides the default version for a batch request + + @discussion + The SDK automatically prepends a version part, such as "v2.0" to API paths in order to simplify API versioning + for applications. If you want to override the version part while using batch requests on the connection, call + this method to set the version for the batch request. + + @param version This is a string in the form @"v2.0" which will be used for the version part of an API path + */ +- (void)overrideVersionPartWith:(NSString *)version; + +@end + +/*! + @abstract The key in the result dictionary for requests to old versions of the Graph API + whose response is not a JSON object. + + @discussion When a request returns a non-JSON response (such as a "true" literal), that response + will be wrapped into a dictionary using this const as the key. This only applies for very few Graph API + prior to v2.1. + */ +FBSDK_EXTERN NSString *const FBSDKNonJSONResponseProperty; diff --git a/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestDataAttachment.h b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestDataAttachment.h new file mode 100644 index 0000000..c179e29 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKGraphRequestDataAttachment.h @@ -0,0 +1,52 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @abstract A container class for data attachments so that additional metadata can be provided about the attachment. + */ +@interface FBSDKGraphRequestDataAttachment : NSObject + +/*! + @abstract Initializes the receiver with the attachment data and metadata. + @param data The attachment data (retained, not copied) + @param filename The filename for the attachment + @param contentType The content type for the attachment + */ +- (instancetype)initWithData:(NSData *)data + filename:(NSString *)filename + contentType:(NSString *)contentType +NS_DESIGNATED_INITIALIZER; + +/*! + @abstract The content type for the attachment. + */ +@property (nonatomic, copy, readonly) NSString *contentType; + +/*! + @abstract The attachment data. + */ +@property (nonatomic, strong, readonly) NSData *data; + +/*! + @abstract The filename for the attachment. + */ +@property (nonatomic, copy, readonly) NSString *filename; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKMacros.h b/FBSDKCoreKit.framework/Headers/FBSDKMacros.h new file mode 100644 index 0000000..fd2e2ff --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKMacros.h @@ -0,0 +1,39 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#ifdef __cplusplus +#define FBSDK_EXTERN extern "C" __attribute__((visibility ("default"))) +#else +#define FBSDK_EXTERN extern __attribute__((visibility ("default"))) +#endif + +#define FBSDK_STATIC_INLINE static inline + +#define FBSDK_NO_DESIGNATED_INITIALIZER() \ +@throw [NSException exceptionWithName:NSInvalidArgumentException \ + reason:[NSString stringWithFormat:@"unrecognized selector sent to instance %p", self] \ + userInfo:nil] + +#define FBSDK_NOT_DESIGNATED_INITIALIZER(DESIGNATED_INITIALIZER) \ +@throw [NSException exceptionWithName:NSInvalidArgumentException \ + reason:[NSString stringWithFormat:@"Please use the designated initializer [%p %@]", \ + self, \ + NSStringFromSelector(@selector(DESIGNATED_INITIALIZER))] \ + userInfo:nil] diff --git a/FBSDKCoreKit.framework/Headers/FBSDKMutableCopying.h b/FBSDKCoreKit.framework/Headers/FBSDKMutableCopying.h new file mode 100644 index 0000000..621fac9 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKMutableCopying.h @@ -0,0 +1,35 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +/*! + @abstract Extension protocol for NSMutableCopying that adds the mutableCopy method, which is implemented on NSObject. + @discussion NSObject implicitly conforms to this protocol. + */ +@protocol FBSDKMutableCopying + +/*! + @abstract Implemented by NSObject as a convenience to mutableCopyWithZone:. + @return A mutable copy of the receiver. + */ +- (id)mutableCopy; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKProfile.h b/FBSDKCoreKit.framework/Headers/FBSDKProfile.h new file mode 100644 index 0000000..c206a2b --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKProfile.h @@ -0,0 +1,139 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import "FBSDKMacros.h" +#import "FBSDKProfilePictureView.h" + +/*! + @abstract Notification indicating that the `currentProfile` has changed. + @discussion the userInfo dictionary of the notification will contain keys + `FBSDKProfileChangeOldKey` and + `FBSDKProfileChangeNewKey`. + */ +FBSDK_EXTERN NSString *const FBSDKProfileDidChangeNotification; + +/* @abstract key in notification's userInfo object for getting the old profile. + @discussion If there was no old profile, the key will not be present. + */ +FBSDK_EXTERN NSString *const FBSDKProfileChangeOldKey; + +/* @abstract key in notification's userInfo object for getting the new profile. + @discussion If there is no new profile, the key will not be present. + */ +FBSDK_EXTERN NSString *const FBSDKProfileChangeNewKey; + +/*! + @abstract Represents an immutable Facebook profile + @discussion This class provides a global "currentProfile" instance to more easily + add social context to your application. When the profile changes, a notification is + posted so that you can update relevant parts of your UI and is persisted to NSUserDefaults. + + Typically, you will want to call `enableUpdatesOnAccessTokenChange:YES` so that + it automatically observes changes to the `[FBSDKAccessToken currentAccessToken]`. + + You can use this class to build your own `FBSDKProfilePictureView` or in place of typical requests to "/me". + */ +@interface FBSDKProfile : NSObject + +/*! + @abstract initializes a new instance. + @param userID the user ID + @param firstName the user's first name + @param middleName the user's middle name + @param lastName the user's last name + @param name the user's complete name + @param linkURL the link for this profile + @param refreshDate the optional date this profile was fetched. Defaults to [NSDate date]. + */ +- (instancetype)initWithUserID:(NSString *)userID + firstName:(NSString *)firstName + middleName:(NSString *)middleName + lastName:(NSString *)lastName + name:(NSString *)name + linkURL:(NSURL *)linkURL + refreshDate:(NSDate *)refreshDate NS_DESIGNATED_INITIALIZER; +/*! + @abstract The user id + */ +@property (nonatomic, readonly) NSString *userID; +/*! + @abstract The user's first name + */ +@property (nonatomic, readonly) NSString *firstName; +/*! + @abstract The user's middle name + */ +@property (nonatomic, readonly) NSString *middleName; +/*! + @abstract The user's last name + */ +@property (nonatomic, readonly) NSString *lastName; +/*! + @abstract The user's complete name + */ +@property (nonatomic, readonly) NSString *name; +/*! + @abstract A URL to the user's profile. + @discussion Consider using Bolts and `FBSDKAppLinkResolver` to resolve this + to an app link to link directly to the user's profile in the Facebook app. + */ +@property (nonatomic, readonly) NSURL *linkURL; + +/*! + @abstract The last time the profile data was fetched. + */ +@property (nonatomic, readonly) NSDate *refreshDate; + +/*! + @abstract Gets the current FBSDKProfile instance. + */ ++ (FBSDKProfile *)currentProfile; + +/*! + @abstract Sets the current instance and posts the appropriate notification if the profile parameter is different + than the receiver. + @param profile the profile to set + @discussion This persists the profile to NSUserDefaults. + */ ++ (void)setCurrentProfile:(FBSDKProfile *)profile; + +/*! + @abstract Indicates if `currentProfile` will automatically observe `FBSDKAccessTokenDidChangeNotification` notifications + @param enable YES is observing + @discussion If observing, this class will issue a graph request for public profile data when the current token's userID + differs from the current profile. You can observe `FBSDKProfileDidChangeNotification` for when the profile is updated. + + Note that if `[FBSDKAccessToken currentAccessToken]` is unset, the `currentProfile` instance remains. It's also possible + for `currentProfile` to return nil until the data is fetched. + */ ++ (void)enableUpdatesOnAccessTokenChange:(BOOL)enable; + +/*! + @abstract A convenience method for returning a Graph API path for retrieving the user's profile image. + @discussion You can pass this to a `FBSDKGraphRequest` instance to download the image. + @param mode The picture mode + @param size The height and width. This will be rounded to integer precision. + */ +- (NSString *)imagePathForPictureMode:(FBSDKProfilePictureMode)mode size:(CGSize)size; + +/*! + @abstract Returns YES if the profile is equivalent to the receiver. + @param profile the profile to compare to. + */ +- (BOOL)isEqualToProfile:(FBSDKProfile *)profile; +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKProfilePictureView.h b/FBSDKCoreKit.framework/Headers/FBSDKProfilePictureView.h new file mode 100644 index 0000000..f1f64cb --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKProfilePictureView.h @@ -0,0 +1,59 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @typedef FBSDKProfilePictureMode enum + @abstract Defines the aspect ratio mode for the source image of the profile picture. + */ +typedef NS_ENUM(NSUInteger, FBSDKProfilePictureMode) +{ + /*! + @abstract A square cropped version of the image will be included in the view. + */ + FBSDKProfilePictureModeSquare, + /*! + @abstract The original picture's aspect ratio will be used for the source image in the view. + */ + FBSDKProfilePictureModeNormal, +}; + +/*! + @abstract A view to display a profile picture. + */ +@interface FBSDKProfilePictureView : UIView + +/*! + @abstract The mode for the receiver to determine the aspect ratio of the source image. + */ +@property (nonatomic, assign) FBSDKProfilePictureMode pictureMode; + +/*! + @abstract The profile ID to show the picture for. + */ +@property (nonatomic, copy) NSString *profileID; + +/*! + @abstract Explicitly marks the receiver as needing to update the image. + @discussion This method is called whenever any properties that affect the source image are modified, but this can also + be used to trigger a manual update of the image if it needs to be re-downloaded. + */ +- (void)setNeedsImageUpdate; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKSettings.h b/FBSDKCoreKit.framework/Headers/FBSDKSettings.h new file mode 100644 index 0000000..edc0040 --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKSettings.h @@ -0,0 +1,209 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +/* + * Constants defining logging behavior. Use with <[FBSDKSettings setLoggingBehavior]>. + */ + +/*! Include access token in logging. */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAccessTokens; + +/*! Log performance characteristics */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorPerformanceCharacteristics; + +/*! Log FBSDKAppEvents interactions */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorAppEvents; + +/*! Log Informational occurrences */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorInformational; + +/*! Log cache errors. */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorCacheErrors; + +/*! Log errors from SDK UI controls */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorUIControlErrors; + +/*! Log debug warnings from API response, i.e. when friends fields requested, but user_friends permission isn't granted. */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugWarning; + +/*! Log warnings from API response, i.e. when requested feature will be deprecated in next version of API. + Info is the lowest level of severity, using it will result in logging all previously mentioned levels. + */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorGraphAPIDebugInfo; + +/*! Log errors from SDK network requests */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorNetworkRequests; + +/*! Log errors likely to be preventable by the developer. This is in the default set of enabled logging behaviors. */ +FBSDK_EXTERN NSString *const FBSDKLoggingBehaviorDeveloperErrors; + +@interface FBSDKSettings : NSObject + +/*! + @abstract Get the Facebook App ID used by the SDK. + @discussion If not explicitly set, the default will be read from the application's plist (FacebookAppID). + */ ++ (NSString *)appID; + +/*! + @abstract Set the Facebook App ID to be used by the SDK. + @param appID The Facebook App ID to be used by the SDK. + */ ++ (void)setAppID:(NSString *)appID; + +/*! + @abstract Get the default url scheme suffix used for sessions. + @discussion If not explicitly set, the default will be read from the application's plist (FacebookUrlSchemeSuffix). + */ ++ (NSString *)appURLSchemeSuffix; + +/*! + @abstract Set the app url scheme suffix used by the SDK. + @param appURLSchemeSuffix The url scheme suffix to be used by the SDK. + */ ++ (void)setAppURLSchemeSuffix:(NSString *)appURLSchemeSuffix; + +/*! + @abstract Retrieve the Client Token that has been set via [FBSDKSettings setClientToken]. + @discussion If not explicitly set, the default will be read from the application's plist (FacebookClientToken). + */ ++ (NSString *)clientToken; + +/*! + @abstract Sets the Client Token for the Facebook App. + @discussion This is needed for certain API calls when made anonymously, without a user-based access token. + @param clientToken The Facebook App's "client token", which, for a given appid can be found in the Security + section of the Advanced tab of the Facebook App settings found at + */ ++ (void)setClientToken:(NSString *)clientToken; + +/*! + @abstract A convenient way to toggle error recovery for all FBSDKGraphRequest instances created after this is set. + @param disableGraphErrorRecovery YES or NO. + */ ++ (void)setGraphErrorRecoveryDisabled:(BOOL)disableGraphErrorRecovery; + +/*! + @abstract Get the Facebook Display Name used by the SDK. + @discussion If not explicitly set, the default will be read from the application's plist (FacebookDisplayName). + */ ++ (NSString *)displayName; + +/*! + @abstract Set the default Facebook Display Name to be used by the SDK. + @discussion This should match the Display Name that has been set for the app with the corresponding Facebook App ID, + in the Facebook App Dashboard. + @param displayName The Facebook Display Name to be used by the SDK. + */ ++ (void)setDisplayName:(NSString *)displayName; + +/*! + @abstract Get the Facebook domain part. + @discussion If not explicitly set, the default will be read from the application's plist (FacebookDomainPart). + */ ++ (NSString *)facebookDomainPart; + +/*! + @abstract Set the subpart of the Facebook domain. + @discussion This can be used to change the Facebook domain (e.g. @"beta") so that requests will be sent to + graph.beta.facebook.com + @param facebookDomainPart The domain part to be inserted into facebook.com. + */ ++ (void)setFacebookDomainPart:(NSString *)facebookDomainPart; + +/*! + @abstract The quality of JPEG images sent to Facebook from the SDK. + @discussion If not explicitly set, the default is 0.9. + @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ ++ (CGFloat)JPEGCompressionQuality; + +/*! + @abstract Set the quality of JPEG images sent to Facebook from the SDK. + @param JPEGCompressionQuality The quality for JPEG images, expressed as a value from 0.0 to 1.0. + @see [UIImageJPEGRepresentation](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIKitFunctionReference/#//apple_ref/c/func/UIImageJPEGRepresentation) */ ++ (void)setJPEGCompressionQuality:(CGFloat)JPEGCompressionQuality; + +/*! + @abstract + Gets whether data such as that generated through FBSDKAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches. + */ ++ (BOOL)limitEventAndDataUsage; + +/*! + @abstract + Sets whether data such as that generated through FBSDKAppEvents and sent to Facebook should be restricted from being used for other than analytics and conversions. Defaults to NO. This value is stored on the device and persists across app launches. + + @param limitEventAndDataUsage The desired value. + */ ++ (void)setLimitEventAndDataUsage:(BOOL)limitEventAndDataUsage; + +/*! + @abstract Retrieve the current iOS SDK version. + */ ++ (NSString *)sdkVersion; + +/*! + @abstract Retrieve the current Facebook SDK logging behavior. + */ ++ (NSSet *)loggingBehavior; + +/*! + @abstract Set the current Facebook SDK logging behavior. This should consist of strings defined as + constants with FBSDKLoggingBehavior*. + + @param loggingBehavior A set of strings indicating what information should be logged. If nil is provided, the logging + behavior is reset to the default set of enabled behaviors. Set to an empty set in order to disable all logging. + + @discussion You can also define this via an array in your app plist with key "FacebookLoggingBehavior" or add and remove individual values via enableLoggingBehavior: or disableLogginBehavior: + */ ++ (void)setLoggingBehavior:(NSSet *)loggingBehavior; + +/*! + @abstract Enable a particular Facebook SDK logging behavior. + + @param loggingBehavior The LoggingBehavior to enable. This should be a string defined as a constant with FBSDKLoggingBehavior*. + */ ++ (void)enableLoggingBehavior:(NSString *)loggingBehavior; + +/*! + @abstract Disable a particular Facebook SDK logging behavior. + + @param loggingBehavior The LoggingBehavior to disable. This should be a string defined as a constant with FBSDKLoggingBehavior*. + */ ++ (void)disableLoggingBehavior:(NSString *)loggingBehavior; + +/*! + @abstract Set the user defaults key used by legacy token caches. + + @param tokenInformationKeyName the key used by legacy token caches. + + @discussion Use this only if you customized FBSessionTokenCachingStrategy in v3.x of + the Facebook SDK for iOS. +*/ ++ (void)setLegacyUserDefaultTokenInformationKeyName:(NSString *)tokenInformationKeyName; + +/*! + @abstract Get the user defaults key used by legacy token caches. +*/ ++ (NSString *)legacyUserDefaultTokenInformationKeyName; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKTestUsersManager.h b/FBSDKCoreKit.framework/Headers/FBSDKTestUsersManager.h new file mode 100644 index 0000000..7d2e0ac --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKTestUsersManager.h @@ -0,0 +1,102 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@class FBSDKAccessToken; + +/*! + @typedef + + @abstract Callback block for returning an array of FBSDKAccessToken instances (and possibly `NSNull` instances); or an error. + */ +typedef void (^FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)(NSArray *tokens, NSError *error) ; + +/*! + @typedef + + @abstract Callback block for removing a test user. + */ +typedef void (^FBSDKTestUsersManagerRemoveTestAccountHandler)(NSError *error) ; + + +/*! + @class FBSDKTestUsersManager + @abstract Provides methods for managing test accounts for testing Facebook integration. + + @discussion Facebook allows developers to create test accounts for testing their applications' + Facebook integration (see https://developers.facebook.com/docs/test_users/). This class + simplifies use of these accounts for writing tests. It is not designed for use in + production application code. + + This class will make Graph API calls on behalf of your app to manage test accounts and requires + an app id and app secret. You will typically use this class to write unit or integration tests. + Make sure you NEVER include your app secret in your production app. + */ +@interface FBSDKTestUsersManager : NSObject + +/*! + @abstract construct or return the shared instance + @param appID the Facebook app id + @param appSecret the Facebook app secret + */ ++ (instancetype)sharedInstanceForAppID:(NSString *)appID appSecret:(NSString *)appSecret; + +/*! + @abstract retrieve FBSDKAccessToken instances for test accounts with the specific permissions. + @param arraysOfPermissions an array of permissions sets, such as @[ [NSSet setWithObject:@"email"], [NSSet setWithObject:@"user_birthday"]] + if you needed two test accounts with email and birthday permissions, respectively. You can pass in empty nested sets + if you need two arbitrary test accounts. For convenience, passing nil is treated as @[ [NSSet set] ] + for fetching a single test user. + @param createIfNotFound if YES, new test accounts are created if no test accounts existed that fit the permissions + requirement + @param handler the callback to invoke which will return an array of `FBAccessTokenData` instances or an `NSError`. + If param `createIfNotFound` is NO, the array may contain `[NSNull null]` instances. + + @discussion If you are requesting test accounts with differing number of permissions, try to order + `arrayOfPermissionsArrays` so that the most number of permissions come first to minimize creation of new + test accounts. + */ +- (void)requestTestAccountTokensWithArraysOfPermissions:(NSArray *)arraysOfPermissions + createIfNotFound:(BOOL)createIfNotFound + completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; + +/*! + @abstract add a test account with the specified permissions + @param permissions the set of permissions, e.g., [NSSet setWithObjects:@"email", @"user_friends"] + @param handler the callback handler + */ +- (void)addTestAccountWithPermissions:(NSSet *)permissions + completionHandler:(FBSDKTestUsersManagerRetrieveTestAccountTokensHandler)handler; + +/*! + @abstract remove a test account for the given user id + @param userId the user id + @param handler the callback handler + */ +- (void)removeTestAccount:(NSString *)userId completionHandler:(FBSDKTestUsersManagerRemoveTestAccountHandler)handler; + +/*! + @abstract Make two test users friends with each other. + @param first the token of the first user + @param second the token of the second user + @param callback the callback handler + */ +- (void)makeFriendsWithFirst:(FBSDKAccessToken *)first second:(FBSDKAccessToken *)second callback:(void (^)(NSError *))callback; + +@end diff --git a/FBSDKCoreKit.framework/Headers/FBSDKUtility.h b/FBSDKCoreKit.framework/Headers/FBSDKUtility.h new file mode 100644 index 0000000..46c490b --- /dev/null +++ b/FBSDKCoreKit.framework/Headers/FBSDKUtility.h @@ -0,0 +1,55 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @abstract Class to contain common utility methods. + */ +@interface FBSDKUtility : NSObject + +/*! + @abstract Parses a query string into a dictionary. + @param queryString The query string value. + @return A dictionary with the key/value pairs. + */ ++ (NSDictionary *)dictionaryWithQueryString:(NSString *)queryString; + +/*! + @abstract Constructs a query string from a dictionary. + @param dictionary The dictionary with key/value pairs for the query string. + @param errorRef If an error occurs, upon return contains an NSError object that describes the problem. + @result Query string representation of the parameters. + */ ++ (NSString *)queryStringWithDictionary:(NSDictionary *)dictionary error:(NSError *__autoreleasing *)errorRef; + +/*! + @abstract Decodes a value from an URL. + @param value The value to decode. + @result The decoded value. + */ ++ (NSString *)URLDecode:(NSString *)value; + +/*! + @abstract Encodes a value for an URL. + @param value The value to encode. + @result The encoded value. + */ ++ (NSString *)URLEncode:(NSString *)value; + +@end diff --git a/FBSDKCoreKit.framework/Info.plist b/FBSDKCoreKit.framework/Info.plist new file mode 100644 index 0000000..6a826c4 Binary files /dev/null and b/FBSDKCoreKit.framework/Info.plist differ diff --git a/FBSDKCoreKit.framework/Modules/module.modulemap b/FBSDKCoreKit.framework/Modules/module.modulemap new file mode 100644 index 0000000..3c3e6e6 --- /dev/null +++ b/FBSDKCoreKit.framework/Modules/module.modulemap @@ -0,0 +1,31 @@ +framework module FBSDKCoreKit { + umbrella header "FBSDKCoreKit.h" + + export * + module * { export * } + + explicit module FBSDKButton { + header "FBSDKButton.h" + export * + } + + explicit module FBSDKAppLinkResolver { + header "FBSDKAppLinkResolver.h" + export * + } + + explicit module FBSDKGraphErrorRecoveryProcessor { + header "FBSDKGraphErrorRecoveryProcessor.h" + export * + } + + explicit module FBSDKGraphRequestDataAttachment { + header "FBSDKGraphRequestDataAttachment.h" + export * + } + + explicit module FBSDKTestUsersManager { + header "FBSDKTestUsersManager.h" + export * + } +} diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKAccessTokenCacheV4.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKAccessTokenCacheV4.h new file mode 100644 index 0000000..7fa7d7f --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKAccessTokenCacheV4.h @@ -0,0 +1,26 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import "FBSDKAccessToken.h" +#import "FBSDKAccessTokenCaching.h" + +@interface FBSDKAccessTokenCacheV4 : NSObject + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPICrypto.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPICrypto.h new file mode 100644 index 0000000..7d488e7 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPICrypto.h @@ -0,0 +1,31 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import "FBSDKBridgeAPIRequest.h" + +@interface FBSDKBridgeAPICrypto : NSObject + ++ (void)addCipherKeyToQueryParameters:(NSMutableDictionary *)queryParameters; ++ (NSDictionary *)decryptResponseForRequest:(FBSDKBridgeAPIRequest *)request + queryParameters:(NSDictionary *)queryParameters + error:(NSError *__autoreleasing *)errorRef; ++ (void)reset; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocol.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocol.h new file mode 100644 index 0000000..679577c --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocol.h @@ -0,0 +1,44 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +#import "FBSDKBridgeAPIProtocolType.h" + +@class FBSDKBridgeAPIRequest; + +FBSDK_EXTERN NSString *const FBSDKBridgeAPIAppIDKey; +FBSDK_EXTERN NSString *const FBSDKBridgeAPISchemeSuffixKey; +FBSDK_EXTERN NSString *const FBSDKBridgeAPIVersionKey; + +@protocol FBSDKBridgeAPIProtocol + +- (NSURL *)requestURLWithActionID:(NSString *)actionID + scheme:(NSString *)scheme + methodName:(NSString *)methodName + methodVersion:(NSString *)methodVersion + parameters:(NSDictionary *)parameters + error:(NSError *__autoreleasing *)errorRef; +- (NSDictionary *)responseParametersForActionID:(NSString *)actionID + queryParameters:(NSDictionary *)queryParameters + cancelled:(BOOL *)cancelledRef + error:(NSError *__autoreleasing *)errorRef; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolNativeV1.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolNativeV1.h new file mode 100644 index 0000000..8fd34bd --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolNativeV1.h @@ -0,0 +1,70 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +#import "FBSDKBridgeAPIProtocol.h" + +typedef struct +{ + __unsafe_unretained NSString *bridgeArgs; + __unsafe_unretained NSString *methodArgs; + __unsafe_unretained NSString *methodVersion; +} FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct; +FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1OutputKeysStruct FBSDKBridgeAPIProtocolNativeV1OutputKeys; + +typedef struct +{ + __unsafe_unretained NSString *actionID; + __unsafe_unretained NSString *appIcon; + __unsafe_unretained NSString *appName; + __unsafe_unretained NSString *sdkVersion; +} FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct; +FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterOutputKeys; + +typedef struct +{ + __unsafe_unretained NSString *bridgeArgs; + __unsafe_unretained NSString *methodResults; +} FBSDKBridgeAPIProtocolNativeV1InputKeysStruct; +FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1InputKeysStruct FBSDKBridgeAPIProtocolNativeV1InputKeys; + +typedef struct +{ + __unsafe_unretained NSString *actionID; + __unsafe_unretained NSString *error; +} FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct; +FBSDK_EXTERN const FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeysStruct FBSDKBridgeAPIProtocolNativeV1BridgeParameterInputKeys; + +@interface FBSDKBridgeAPIProtocolNativeV1 : NSObject + +- (instancetype)initWithAppScheme:(NSString *)appScheme; +- (instancetype)initWithAppScheme:(NSString *)appScheme + pasteboard:(UIPasteboard *)pasteboard + dataLengthThreshold:(NSUInteger)dataLengthThreshold + includeAppIcon:(BOOL)includeAppIcon +NS_DESIGNATED_INITIALIZER; + +@property (nonatomic, copy, readonly) NSString *appScheme; +@property (nonatomic, assign, readonly) NSUInteger dataLengthThreshold; +@property (nonatomic, assign, readonly) BOOL includeAppIcon; +@property (nonatomic, strong, readonly) UIPasteboard *pasteboard; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolWebV1.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolWebV1.h new file mode 100644 index 0000000..c7b28f4 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKBridgeAPIProtocolWebV1.h @@ -0,0 +1,25 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import "FBSDKBridgeAPIProtocol.h" + +@interface FBSDKBridgeAPIProtocolWebV1 : NSObject + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKError.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKError.h new file mode 100644 index 0000000..f37bd86 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKError.h @@ -0,0 +1,56 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@interface FBSDKError : NSObject + ++ (NSString *)errorDomain; + ++ (BOOL)errorIsNetworkError:(NSError *)error; + ++ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message; ++ (NSError *)errorWithCode:(NSInteger)code message:(NSString *)message underlyingError:(NSError *)underlyingError; ++ (NSError *)errorWithCode:(NSInteger)code + userInfo:(NSDictionary *)userInfo + message:(NSString *)message + underlyingError:(NSError *)underlyingError; + ++ (NSError *)invalidArgumentErrorWithName:(NSString *)name value:(id)value message:(NSString *)message; ++ (NSError *)invalidArgumentErrorWithName:(NSString *)name + value:(id)value + message:(NSString *)message + underlyingError:(NSError *)underlyingError; ++ (NSError *)invalidCollectionErrorWithName:(NSString *)name + collection:(id)collection + item:(id)item + message:(NSString *)message; ++ (NSError *)invalidCollectionErrorWithName:(NSString *)name + collection:(id)collection + item:(id)item + message:(NSString *)message + underlyingError:(NSError *)underlyingError; + ++ (NSError *)requiredArgumentErrorWithName:(NSString *)name message:(NSString *)message; ++ (NSError *)requiredArgumentErrorWithName:(NSString *)name + message:(NSString *)message + underlyingError:(NSError *)underlyingError; + ++ (NSError *)unknownErrorWithMessage:(NSString *)message; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestBody.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestBody.h new file mode 100644 index 0000000..b61c782 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestBody.h @@ -0,0 +1,47 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import +#import + +@class FBSDKGraphRequestDataAttachment; +@class FBSDKLogger; + +@interface FBSDKGraphRequestBody : NSObject + +@property (nonatomic, retain, readonly) NSData *data; + +- (void)appendWithKey:(NSString *)key + formValue:(NSString *)value + logger:(FBSDKLogger *)logger; + +- (void)appendWithKey:(NSString *)key + imageValue:(UIImage *)image + logger:(FBSDKLogger *)logger; + +- (void)appendWithKey:(NSString *)key + dataValue:(NSData *)data + logger:(FBSDKLogger *)logger; + +- (void)appendWithKey:(NSString *)key + dataAttachmentValue:(FBSDKGraphRequestDataAttachment *)dataAttachment + logger:(FBSDKLogger *)logger; + ++ (NSString *)mimeContentType; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestMetadata.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestMetadata.h new file mode 100644 index 0000000..cd218c4 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKGraphRequestMetadata.h @@ -0,0 +1,40 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +// Internal only class to facilitate FBSDKGraphRequest processing, specifically +// associating FBSDKGraphRequest and FBSDKGraphRequestHandler instances and necessary +// data for retry processing. +@interface FBSDKGraphRequestMetadata : NSObject + +@property (nonatomic, retain) FBSDKGraphRequest *request; +@property (nonatomic, copy) FBSDKGraphRequestHandler completionHandler; +@property (nonatomic, copy) NSDictionary *batchParameters; + +- (instancetype)initWithRequest:(FBSDKGraphRequest *)request + completionHandler:(FBSDKGraphRequestHandler)handler + batchParameters:(NSDictionary *)batchParameters +NS_DESIGNATED_INITIALIZER; + +- (void)invokeCompletionHandlerForConnection:(FBSDKGraphRequestConnection *)connection + withResults:(id)results + error:(NSError *)error; +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKURLConnection.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKURLConnection.h new file mode 100644 index 0000000..cbe80a0 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKURLConnection.h @@ -0,0 +1,51 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@class FBSDKURLConnection; + +typedef void (^FBSDKURLConnectionHandler)(FBSDKURLConnection *connection, + NSError *error, + NSURLResponse *response, + NSData *responseData); + +@protocol FBSDKURLConnectionDelegate + +@optional + +- (void)facebookURLConnection:(FBSDKURLConnection *)connection + didSendBodyData:(NSInteger)bytesWritten + totalBytesWritten:(NSInteger)totalBytesWritten + totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; + +@end + +@interface FBSDKURLConnection : NSObject + +- (FBSDKURLConnection *)initWithRequest:(NSURLRequest *)request + completionHandler:(FBSDKURLConnectionHandler)handler +NS_DESIGNATED_INITIALIZER; + +@property (nonatomic, assign) id delegate; + +- (void)cancel; +- (void)start; +- (void)setDelegateQueue:(NSOperationQueue *)queue; + +@end diff --git a/FBSDKCoreKit.framework/PrivateHeaders/FBSDKWebDialogView.h b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKWebDialogView.h new file mode 100644 index 0000000..9ad7427 --- /dev/null +++ b/FBSDKCoreKit.framework/PrivateHeaders/FBSDKWebDialogView.h @@ -0,0 +1,39 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@protocol FBSDKWebDialogViewDelegate; + +@interface FBSDKWebDialogView : UIView + +@property (nonatomic, assign) id delegate; + +- (void)loadURL:(NSURL *)URL; +- (void)stopLoading; + +@end + +@protocol FBSDKWebDialogViewDelegate + +- (void)webDialogView:(FBSDKWebDialogView *)webDialogView didCompleteWithResults:(NSDictionary *)results; +- (void)webDialogView:(FBSDKWebDialogView *)webDialogView didFailWithError:(NSError *)error; +- (void)webDialogViewDidCancel:(FBSDKWebDialogView *)webDialogView; +- (void)webDialogViewDidFinishLoad:(FBSDKWebDialogView *)webDialogView; + +@end diff --git a/FBSDKLoginKit.framework/FBSDKLoginKit b/FBSDKLoginKit.framework/FBSDKLoginKit new file mode 100644 index 0000000..1585a57 Binary files /dev/null and b/FBSDKLoginKit.framework/FBSDKLoginKit differ diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h new file mode 100644 index 0000000..1cbd262 --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginButton.h @@ -0,0 +1,119 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +#import + +#import "FBSDKTooltipView.h" + +@protocol FBSDKLoginButtonDelegate; + +/*! + @typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) + @abstract Indicates the desired login tooltip behavior. + */ +typedef NS_ENUM(NSUInteger, FBSDKLoginButtonTooltipBehavior) +{ + /*! The default behavior. The tooltip will only be displayed if + the app is eligible (determined by possible server round trip) */ + FBSDKLoginButtonTooltipBehaviorAutomatic = 0, + /*! Force display of the tooltip (typically for UI testing) */ + FBSDKLoginButtonTooltipBehaviorForceDisplay = 1, + /*! Force disable. In this case you can still exert more refined + control by manually constructing a `FBSDKLoginTooltipView` instance. */ + FBSDKLoginButtonTooltipBehaviorDisable = 2 +}; + +/*! + @abstract A button that initiates a log in or log out flow upon tapping. + @discussion `FBSDKLoginButton` works with `[FBSDKAccessToken currentAccessToken]` to + determine what to display, and automatically starts authentication when tapped (i.e., + you do not need to manually subscribe action targets). + + Like `FBSDKLoginManager`, you should make sure your app delegate is connected to + `FBSDKApplicationDelegate` in order for the button's delegate to receive messages. + + `FBSDKLoginButton` has a fixed height, but you may change the width. `initWithFrame:CGRectZero` + will size the button to its minimum frame. +*/ +@interface FBSDKLoginButton : FBSDKButton + +/*! + @abstract The default audience to use, if publish permissions are requested at login time. + */ +@property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; +/*! + @abstract Gets or sets the delegate. + */ +@property (weak, nonatomic) IBOutlet id delegate; +/*! + @abstract Gets or sets the login behavior to use + */ +@property (assign, nonatomic) FBSDKLoginBehavior loginBehavior; +/*! + @abstract The publish permissions to request. + + @discussion Use `defaultAudience` to specify the default audience to publish to. + Note this is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + */ +@property (copy, nonatomic) NSArray *publishPermissions; +/*! + @abstract The read permissions to request. + + @discussion Note, that if read permissions are specified, then publish permissions should not be specified. This is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + */ +@property (copy, nonatomic) NSArray *readPermissions; +/*! + @abstract Gets or sets the desired tooltip behavior. + */ +@property (assign, nonatomic) FBSDKLoginButtonTooltipBehavior tooltipBehavior; +/*! + @abstract Gets or sets the desired tooltip color style. + */ +@property (assign, nonatomic) FBSDKTooltipColorStyle tooltipColorStyle; + +@end + +/*! + @protocol + @abstract A delegate for `FBSDKLoginButton` + */ +@protocol FBSDKLoginButtonDelegate + +/*! + @abstract Sent to the delegate when the button was used to login. + @param loginButton the sender + @param result The results of the login + @param error The error (if any) from the login + */ +- (void) loginButton:(FBSDKLoginButton *)loginButton +didCompleteWithResult:(FBSDKLoginManagerLoginResult *)result + error:(NSError *)error; + +/*! + @abstract Sent to the delegate when the button was used to logout. + @param loginButton The button that was clicked. +*/ +- (void)loginButtonDidLogOut:(FBSDKLoginButton *)loginButton; + +@end diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginConstants.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginConstants.h new file mode 100644 index 0000000..100c09a --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginConstants.h @@ -0,0 +1,75 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +/*! + @abstract The error domain for all errors from FBSDKLoginKit + @discussion Error codes from the SDK in the range 300-399 are reserved for this domain. + */ +FBSDK_EXTERN NSString *const FBSDKLoginErrorDomain; + +/*! + @typedef NS_ENUM(NSInteger, FBSDKLoginErrorCode) + @abstract Error codes for FBSDKLoginErrorDomain. + */ +typedef NS_ENUM(NSInteger, FBSDKLoginErrorCode) +{ + /*! + @abstract Reserved. + */ + FBSDKLoginReservedErrorCode = 300, + /*! + @abstract The error code for unknown errors. + */ + FBSDKLoginUnknownErrorCode, + + /*! + @abstract The user's password has changed and must log in again + */ + FBSDKLoginPasswordChangedErrorCode, + /*! + @abstract The user must log in to their account on www.facebook.com to restore access + */ + FBSDKLoginUserCheckpointedErrorCode, + /*! + @abstract Indicates a failure to request new permissions because the user has changed. + */ + FBSDKLoginUserMismatchErrorCode, + /*! + @abstract The user must confirm their account with Facebook before logging in + */ + FBSDKLoginUnconfirmedUserErrorCode, + + /*! + @abstract The Accounts framework failed without returning an error, indicating the + app's slider in the iOS Facebook Settings (device Settings -> Facebook -> App Name) has + been disabled. + */ + FBSDKLoginSystemAccountAppDisabledErrorCode, + /*! + @abstract An error occurred related to Facebook system Account store + */ + FBSDKLoginSystemAccountUnavailableErrorCode, + /*! + @abstract The login response was missing a valid challenge string. + */ + FBSDKLoginBadChallengeString, +}; diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginKit.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginKit.h new file mode 100644 index 0000000..4723940 --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginKit.h @@ -0,0 +1,25 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import +#import +#import +#import +#import diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginManager.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginManager.h new file mode 100644 index 0000000..2a6ec8f --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginManager.h @@ -0,0 +1,186 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import +#import + +@class FBSDKLoginManagerLoginResult; + +/*! + @abstract Describes the call back to the FBSDKLoginManager + @param result the result of the authorization + @param error the authorization error, if any. + */ +typedef void (^FBSDKLoginManagerRequestTokenHandler)(FBSDKLoginManagerLoginResult *result, NSError *error); + + +/*! + @typedef FBSDKDefaultAudience enum + + @abstract + Passed to open to indicate which default audience to use for sessions that post data to Facebook. + + @discussion + Certain operations such as publishing a status or publishing a photo require an audience. When the user + grants an application permission to perform a publish operation, a default audience is selected as the + publication ceiling for the application. This enumerated value allows the application to select which + audience to ask the user to grant publish permission for. + */ +typedef NS_ENUM(NSUInteger, FBSDKDefaultAudience) +{ + /*! Indicates that the user's friends are able to see posts made by the application */ + FBSDKDefaultAudienceFriends = 0, + /*! Indicates that only the user is able to see posts made by the application */ + FBSDKDefaultAudienceOnlyMe, + /*! Indicates that all Facebook users are able to see posts made by the application */ + FBSDKDefaultAudienceEveryone, +}; + +/*! + @typedef FBSDKLoginBehavior enum + + @abstract + Passed to the \c FBSDKLoginManager to indicate how Facebook Login should be attempted. + + @discussion + Facebook Login authorizes the application to act on behalf of the user, using the user's + Facebook account. Usually a Facebook Login will rely on an account maintained outside of + the application, by the native Facebook application, the browser, or perhaps the device + itself. This avoids the need for a user to enter their username and password directly, and + provides the most secure and lowest friction way for a user to authorize the application to + interact with Facebook. + + The \c FBSDKLoginBehavior enum specifies which log in method should be attempted. Most + applications will use the default, which attempts a login through the Facebook app and falls + back to the browser if needed. + + If log in cannot be completed using the specificed behavior, the completion handler will + be invoked with an error in the \c FBSDKErrorDomain and a code of \c FBSDKLoginUnknownErrorCode. + */ +typedef NS_ENUM(NSUInteger, FBSDKLoginBehavior) +{ + /*! + @abstract Attempts log in through the native Facebook app. If the Facebook app is + not installed on the device, falls back to \c FBSDKLoginBehaviorBrowser. This is the + default behavior. + */ + FBSDKLoginBehaviorNative = 0, + /*! + @abstract Attempts log in through the Safari browser + */ + FBSDKLoginBehaviorBrowser, + /*! + @abstract Attempts log in through the Facebook account currently signed in through Settings. + If no Facebook account is signed in, falls back to \c FBSDKLoginBehaviorNative. + */ + FBSDKLoginBehaviorSystemAccount, + /*! + @abstract Attemps log in through a modal \c UIWebView pop up + + @note This behavior is only available to certain types of apps. Please check the Facebook + Platform Policy to verify your app meets the restrictions. + */ + FBSDKLoginBehaviorWeb, +}; + +/*! + @abstract `FBSDKLoginManager` provides methods for logging the user in and out. + @discussion `FBSDKLoginManager` works directly with `[FBSDKAccessToken currentAccessToken]` and + sets the "currentAccessToken" upon successful authorizations (or sets `nil` in case of `logOut`). + + You should check `[FBSDKAccessToken currentAccessToken]` before calling logIn* to see if there is + a cached token available (typically in your viewDidLoad). + + If you are managing your own token instances outside of "currentAccessToken", you will need to set + "currentAccessToken" before calling logIn* to authorize futher permissions on your tokens. + */ +@interface FBSDKLoginManager : NSObject + +/*! + @abstract the default audience. + @discussion you should set this if you intend to ask for publish permissions. + */ +@property (assign, nonatomic) FBSDKDefaultAudience defaultAudience; + +/*! + @abstract the login behavior + @discussion you should only set this if you want an explicit login flow; otherwise, the SDK + will automatically determine the best flow available. + */ +@property (assign, nonatomic) FBSDKLoginBehavior loginBehavior; + +/*! + @abstract Logs the user in or authorizes additional permissions. + @param permissions the optional array of permissions. Note this is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + @param handler the callback. + @discussion Use this method when asking for read permissions. You should only ask for permissions when they + are needed and explain the value to the user. You can inspect the result.declinedPermissions to also + provide more information to the user if they decline permissions. + + If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user + and will pass the "rerequest" flag to the login dialog. + + This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]` + already contains the permissions you need before asking to reduce unnecessary app switching. For example, + you could make that check at viewDidLoad. + */ +- (void)logInWithReadPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; + +/*! + @abstract Logs the user in or authorizes additional permissions. + @param permissions the optional array of permissions. Note this is converted to NSSet and is only + an NSArray for the convenience of literal syntax. + @param handler the callback. + @discussion Use this method when asking for publish permissions. You should only ask for permissions when they + are needed and explain the value to the user. You can inspect the result.declinedPermissions to also + provide more information to the user if they decline permissions. + + If `[FBSDKAccessToken currentAccessToken]` is not nil, it will be treated as a reauthorization for that user + and will pass the "rerequest" flag to the login dialog. + + This method will present UI the user. You typically should check if `[FBSDKAccessToken currentAccessToken]` + already contains the permissions you need before asking to reduce unnecessary app switching. For example, + you could make that check at viewDidLoad. + */ +- (void)logInWithPublishPermissions:(NSArray *)permissions handler:(FBSDKLoginManagerRequestTokenHandler)handler; + +/*! + @abstract Logs the user out + @discussion This calls [FBSDKAccessToken setCurrentAccessToken:nil] and [FBSDKProfile setCurrentProfile:nil]. + */ +- (void)logOut; + +/*! + @method + + @abstract Issues an asychronous renewCredentialsForAccount call to the device's Facebook account store. + + @param handler The completion handler to call when the renewal is completed. This can be invoked on an arbitrary thread. + + @discussion This can be used to explicitly renew account credentials and is provided as a convenience wrapper around + `[ACAccountStore renewCredentialsForAccount:completion]`. Note the method will not issue the renewal call if the the + Facebook account has not been set on the device, or if access had not been granted to the account (though the handler + wil receive an error). + + If the `[FBSDKAccessToken currentAccessToken]` was from the account store, a succesful renewal will also set + a new "currentAccessToken". + */ ++ (void)renewSystemCredentials:(void (^)(ACAccountCredentialRenewResult result, NSError *error))handler; + +@end diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginManagerLoginResult.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginManagerLoginResult.h new file mode 100644 index 0000000..36a1af6 --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginManagerLoginResult.h @@ -0,0 +1,62 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +@class FBSDKAccessToken; + +/*! + @abstract Describes the result of a login attempt. + */ +@interface FBSDKLoginManagerLoginResult : NSObject + +/*! + @abstract the access token. + */ +@property (copy, nonatomic) FBSDKAccessToken *token; + +/*! + @abstract whether the login was cancelled by the user. + */ +@property (readonly, nonatomic) BOOL isCancelled; + +/*! + @abstract the set of permissions granted by the user in the associated request. + @discussion inspect the token's permissions set for a complete list. + */ +@property (copy, nonatomic) NSSet *grantedPermissions; + +/*! + @abstract the set of permissions declined by the user in the associated request. + @discussion inspect the token's permissions set for a complete list. + */ +@property (copy, nonatomic) NSSet *declinedPermissions; + +/*! + @abstract Initializes a new instance. + @param token the access token + @param isCancelled whether the login was cancelled by the user + @param grantedPermissions the set of granted permissions + @param declinedPermissions the set of declined permissions + */ +- (instancetype)initWithToken:(FBSDKAccessToken *)token + isCancelled:(BOOL)isCancelled + grantedPermissions:(NSSet *)grantedPermissions + declinedPermissions:(NSSet *)declinedPermissions +NS_DESIGNATED_INITIALIZER; +@end diff --git a/FBSDKLoginKit.framework/Headers/FBSDKLoginTooltipView.h b/FBSDKLoginKit.framework/Headers/FBSDKLoginTooltipView.h new file mode 100644 index 0000000..e6a9411 --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKLoginTooltipView.h @@ -0,0 +1,93 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +#import + +@protocol FBSDKLoginTooltipViewDelegate; + +/*! + @class FBSDKLoginTooltipView + + @abstract Represents a tooltip to be displayed next to a Facebook login button + to highlight features for new users. + + @discussion The `FBSDKLoginButton` may display this view automatically. If you do + not use the `FBSDKLoginButton`, you can manually call one of the `present*` methods + as appropriate and customize behavior via `FBSDKLoginTooltipViewDelegate` delegate. + + By default, the `FBSDKLoginTooltipView` is not added to the superview until it is + determined the app has migrated to the new login experience. You can override this + (e.g., to test the UI layout) by implementing the delegate or setting `forceDisplay` to YES. + + */ +@interface FBSDKLoginTooltipView : FBSDKTooltipView + +/*! @abstract the delegate */ +@property (nonatomic, assign) id delegate; + +/*! @abstract if set to YES, the view will always be displayed and the delegate's + `loginTooltipView:shouldAppear:` will NOT be called. */ +@property (nonatomic, assign) BOOL forceDisplay; + +@end + +/*! + @protocol + + @abstract + The `FBSDKLoginTooltipViewDelegate` protocol defines the methods used to receive event + notifications from `FBSDKLoginTooltipView` objects. + */ +@protocol FBSDKLoginTooltipViewDelegate + +@optional + +/*! + @abstract + Asks the delegate if the tooltip view should appear + + @param view The tooltip view. + @param appIsEligible The value fetched from the server identifying if the app + is eligible for the new login experience. + + @discussion Use this method to customize display behavior. + */ +- (BOOL)loginTooltipView:(FBSDKLoginTooltipView *)view shouldAppear:(BOOL)appIsEligible; + +/*! + @abstract + Tells the delegate the tooltip view will appear, specifically after it's been + added to the super view but before the fade in animation. + + @param view The tooltip view. + */ +- (void)loginTooltipViewWillAppear:(FBSDKLoginTooltipView *)view; + +/*! + @abstract + Tells the delegate the tooltip view will not appear (i.e., was not + added to the super view). + + @param view The tooltip view. + */ +- (void)loginTooltipViewWillNotAppear:(FBSDKLoginTooltipView *)view; + + +@end diff --git a/FBSDKLoginKit.framework/Headers/FBSDKTooltipView.h b/FBSDKLoginKit.framework/Headers/FBSDKTooltipView.h new file mode 100644 index 0000000..aff1067 --- /dev/null +++ b/FBSDKLoginKit.framework/Headers/FBSDKTooltipView.h @@ -0,0 +1,141 @@ +// Copyright (c) 2014-present, Facebook, Inc. All rights reserved. +// +// You are hereby granted a non-exclusive, worldwide, royalty-free license to use, +// copy, modify, and distribute this software in source code or binary form for use +// in connection with the web services and APIs provided by Facebook. +// +// As with any software that integrates with the Facebook platform, your use of +// this software is subject to the Facebook Developer Principles and Policies +// [http://developers.facebook.com/policy/]. This copyright notice shall be +// included in all copies or substantial portions of the software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +#import + +/*! + @typedef FBSDKTooltipViewArrowDirection enum + + @abstract + Passed on construction to determine arrow orientation. + */ +typedef NS_ENUM(NSUInteger, FBSDKTooltipViewArrowDirection) +{ + /*! View is located above given point, arrow is pointing down. */ + FBSDKTooltipViewArrowDirectionDown = 0, + /*! View is located below given point, arrow is pointing up. */ + FBSDKTooltipViewArrowDirectionUp = 1, +}; + +/*! + @typedef FBSDKTooltipColorStyle enum + + @abstract + Passed on construction to determine color styling. + */ +typedef NS_ENUM(NSUInteger, FBSDKTooltipColorStyle) +{ + /*! Light blue background, white text, faded blue close button. */ + FBSDKTooltipColorStyleFriendlyBlue = 0, + /*! Dark gray background, white text, light gray close button. */ + FBSDKTooltipColorStyleNeutralGray = 1, +}; + +/*! + @class FBSDKTooltipView + + @abstract + Tooltip bubble with text in it used to display tips for UI elements, + with a pointed arrow (to refer to the UI element). + + @discussion + The tooltip fades in and will automatically fade out. See `displayDuration`. + */ +@interface FBSDKTooltipView : UIView + +/*! + @abstract Gets or sets the amount of time in seconds the tooltip should be displayed. + + @discussion Set this to zero to make the display permanent until explicitly dismissed. + Defaults to six seconds. + */ +@property (nonatomic, assign) CFTimeInterval displayDuration; + +/*! + @abstract Gets or sets the color style after initialization. + + @discussion Defaults to value passed to -initWithTagline:message:colorStyle:. + */ +@property (nonatomic, assign) FBSDKTooltipColorStyle colorStyle; + +/*! + @abstract Gets or sets the message. + */ +@property (nonatomic, copy) NSString *message; + +/*! + @abstract Gets or sets the optional phrase that comprises the first part of the label (and is highlighted differently). + */ +@property (nonatomic, copy) NSString *tagline; + +/*! + @abstract + Designated initializer. + + @param tagline First part of the label, that will be highlighted with different color. Can be nil. + + @param message Main message to display. + + @param colorStyle Color style to use for tooltip. + + @discussion + If you need to show a tooltip for login, consider using the `FBSDKLoginTooltipView` view. + + @see FBSDKLoginTooltipView + */ +- (instancetype)initWithTagline:(NSString *)tagline message:(NSString *)message colorStyle:(FBSDKTooltipColorStyle)colorStyle; + +/*! + @abstract + Show tooltip at the top or at the bottom of given view. + Tooltip will be added to anchorView.window.rootViewController.view + + @param anchorView view to show at, must be already added to window view hierarchy, in order to decide + where tooltip will be shown. (If there's not enough space at the top of the anchorView in window bounds - + tooltip will be shown at the bottom of it) + + @discussion + Use this method to present the tooltip with automatic positioning or + use -presentInView:withArrowPosition:direction: for manual positioning + If anchorView is nil or has no window - this method does nothing. + */ +- (void)presentFromView:(UIView *)anchorView; + +/*! + @abstract + Adds tooltip to given view, with given position and arrow direction. + + @param view View to be used as superview. + + @param arrowPosition Point in view's cordinates, where arrow will be pointing + + @param arrowDirection whenever arrow should be pointing up (message bubble is below the arrow) or + down (message bubble is above the arrow). + */ +- (void)presentInView:(UIView *)view withArrowPosition:(CGPoint)arrowPosition direction:(FBSDKTooltipViewArrowDirection)arrowDirection; + +/*! + @abstract + Remove tooltip manually. + + @discussion + Calling this method isn't necessary - tooltip will dismiss itself automatically after the `displayDuration`. + */ +- (void)dismiss; + +@end diff --git a/FBSDKLoginKit.framework/Info.plist b/FBSDKLoginKit.framework/Info.plist new file mode 100644 index 0000000..d87f045 Binary files /dev/null and b/FBSDKLoginKit.framework/Info.plist differ diff --git a/FBSDKLoginKit.framework/Modules/module.modulemap b/FBSDKLoginKit.framework/Modules/module.modulemap new file mode 100644 index 0000000..4b1d57b --- /dev/null +++ b/FBSDKLoginKit.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module FBSDKLoginKit { + umbrella header "FBSDKLoginKit.h" + + export * + module * { export * } +} diff --git a/GetHip.xcodeproj/project.pbxproj b/GetHip.xcodeproj/project.pbxproj index ae023dc..5655350 100644 --- a/GetHip.xcodeproj/project.pbxproj +++ b/GetHip.xcodeproj/project.pbxproj @@ -57,10 +57,14 @@ 3E438AE81C5738EF0055C97A /* Settings@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE31C5738EF0055C97A /* Settings@2x.png */; }; 3E438AE91C5738EF0055C97A /* Star@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE41C5738EF0055C97A /* Star@2x.png */; }; 3E438AEA1C5738EF0055C97A /* Turntable@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E438AE51C5738EF0055C97A /* Turntable@2x.png */; }; - 3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */; }; - 3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */; }; 3E43B8CF1C376F9F002F97A7 /* Logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E43B8CE1C376F9F002F97A7 /* Logo.png */; }; 3E4AA5211C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E4AA5201C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */; }; + 3E4B86B31C95DAE700ECDFFA /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86B21C95DAE700ECDFFA /* Bolts.framework */; }; + 3E4B86B51C95DE3300ECDFFA /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86B41C95DE3300ECDFFA /* Parse.framework */; }; + 3E4B86B71C95DE6300ECDFFA /* ParseFacebookUtilsV4.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86B61C95DE6300ECDFFA /* ParseFacebookUtilsV4.framework */; }; + 3E4B86B91C95DF3D00ECDFFA /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86B81C95DF3D00ECDFFA /* ParseUI.framework */; }; + 3E4B86BB1C95E01B00ECDFFA /* FBSDKLoginKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86BA1C95E01B00ECDFFA /* FBSDKLoginKit.framework */; }; + 3E4B86BD1C95E06400ECDFFA /* FBSDKCoreKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E4B86BC1C95E06400ECDFFA /* FBSDKCoreKit.framework */; }; 3E50E0401C74B97300EB9EA9 /* BackToHomeScreenViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */; }; 3E5485B31C69A7DA00E7D5AB /* LoadingPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */; }; 3E5485B51C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */; }; @@ -113,10 +117,6 @@ 3E6D43891C7831B100CA805F /* InvitedToPartyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6D43881C7831B100CA805F /* InvitedToPartyViewController.swift */; }; 3E6D438B1C78968C00CA805F /* Joining@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E6D438A1C78968C00CA805F /* Joining@2x.png */; }; 3E6D438D1C78969A00CA805F /* CancelInvited@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E6D438C1C78969A00CA805F /* CancelInvited@2x.png */; }; - 3E76CF261C38258600193B58 /* Parse.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E76CF231C38258600193B58 /* Parse.framework */; }; - 3E76CF271C38258600193B58 /* ParseFacebookUtilsV4.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E76CF241C38258600193B58 /* ParseFacebookUtilsV4.framework */; }; - 3E76CF281C38258600193B58 /* ParseUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E76CF251C38258600193B58 /* ParseUI.framework */; }; - 3E76CF2A1C38318200193B58 /* Bolts.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E76CF291C38318200193B58 /* Bolts.framework */; }; 3E76CF2C1C38349D00193B58 /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 3E76CF2B1C38349D00193B58 /* libsqlite3.dylib */; }; 3E7BB8E21C5B4A350005B834 /* Change Song@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7BB8E11C5B4A350005B834 /* Change Song@2x.png */; }; 3E7D37D51C75D7EF002E682F /* Raise@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3E7D37D41C75D7EF002E682F /* Raise@2x.png */; }; @@ -167,7 +167,6 @@ 3E1BDA641C37111D00EE3B84 /* GetHipTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = GetHipTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 3E1BDA691C37111D00EE3B84 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 3E1BDA6A1C37111D00EE3B84 /* GetHipTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GetHipTests.swift; sourceTree = ""; }; - 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKCoreKit.framework; path = ../../FacebookSDK/FBSDKCoreKit.framework; sourceTree = ""; }; 3E1DE9A51C38373700CA6CD4 /* libstdc++.6.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = "libstdc++.6.dylib"; path = "usr/lib/libstdc++.6.dylib"; sourceTree = SDKROOT; }; 3E1DE9A71C3837E800CA6CD4 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; 3E1DE9AB1C3838A800CA6CD4 /* libsystem_network.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsystem_network.dylib; path = usr/lib/system/libsystem_network.dylib; sourceTree = SDKROOT; }; @@ -207,10 +206,14 @@ 3E438AE41C5738EF0055C97A /* Star@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Star@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Star@2x.png"; sourceTree = ""; }; 3E438AE51C5738EF0055C97A /* Turntable@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Turntable@2x.png"; path = "../../../Dropbox/Gethip/Screens/iPhone 5 Home/Icon Assets/Turntable@2x.png"; sourceTree = ""; }; 3E43B8C31C375ADE002F97A7 /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; }; - 3E43B8C41C375E73002F97A7 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = ../../FacebookSDK/Bolts.framework; sourceTree = ""; }; - 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FBSDKLoginKit.framework; path = ../../FacebookSDK/FBSDKLoginKit.framework; sourceTree = ""; }; 3E43B8CE1C376F9F002F97A7 /* Logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = Logo.png; path = "../../../Dropbox/gethip/Screens/6 Login/Assets/Logo.png"; sourceTree = ""; }; 3E4AA5201C853E1A00746839 /* Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; path = "../../../Dropbox/gethip/Screens/6 Back to Party/6 Back to Party/Asset/Rectangle 10 + Change Photo + voice_presentation copy + voice_presentation copy 2 + voice_presentation + Music 2 + Music 2@2x.png"; sourceTree = ""; }; + 3E4B86B21C95DAE700ECDFFA /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Bolts.framework; sourceTree = ""; }; + 3E4B86B41C95DE3300ECDFFA /* Parse.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Parse.framework; sourceTree = ""; }; + 3E4B86B61C95DE6300ECDFFA /* ParseFacebookUtilsV4.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ParseFacebookUtilsV4.framework; sourceTree = ""; }; + 3E4B86B81C95DF3D00ECDFFA /* ParseUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = ParseUI.framework; sourceTree = ""; }; + 3E4B86BA1C95E01B00ECDFFA /* FBSDKLoginKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FBSDKLoginKit.framework; sourceTree = ""; }; + 3E4B86BC1C95E06400ECDFFA /* FBSDKCoreKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = FBSDKCoreKit.framework; sourceTree = ""; }; 3E50E03F1C74B97300EB9EA9 /* BackToHomeScreenViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BackToHomeScreenViewController.swift; sourceTree = ""; }; 3E5485B21C69A7DA00E7D5AB /* LoadingPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoadingPartyViewController.swift; sourceTree = ""; }; 3E5485B41C69CE2F00E7D5AB /* InvitedCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedCollectionViewCell.swift; sourceTree = ""; }; @@ -277,10 +280,6 @@ 3E6D43881C7831B100CA805F /* InvitedToPartyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InvitedToPartyViewController.swift; sourceTree = ""; }; 3E6D438A1C78968C00CA805F /* Joining@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "Joining@2x.png"; path = "../../../Dropbox/gethip/Screens/Invited To Join Party/5 When Invited/When Invited/Joining/Assets/Joining@2x.png"; sourceTree = ""; }; 3E6D438C1C78969A00CA805F /* CancelInvited@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "CancelInvited@2x.png"; path = "../../../Dropbox/gethip/Screens/Invited To Join Party/5 When Invited/When Invited/Joining/Assets/CancelInvited@2x.png"; sourceTree = ""; }; - 3E76CF231C38258600193B58 /* Parse.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Parse.framework; path = "../../Parse-iOS/Parse.framework"; sourceTree = ""; }; - 3E76CF241C38258600193B58 /* ParseFacebookUtilsV4.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ParseFacebookUtilsV4.framework; path = "../../Parse-iOS/ParseFacebookUtilsV4.framework"; sourceTree = ""; }; - 3E76CF251C38258600193B58 /* ParseUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ParseUI.framework; path = "../../Parse-iOS/ParseUI.framework"; sourceTree = ""; }; - 3E76CF291C38318200193B58 /* Bolts.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Bolts.framework; path = "../../Parse-iOS/Bolts.framework"; sourceTree = ""; }; 3E76CF2B1C38349D00193B58 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; 3E76CF2D1C3835C500193B58 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; 3E76CF2F1C3835E300193B58 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; }; @@ -309,24 +308,24 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( + 3E4B86B91C95DF3D00ECDFFA /* ParseUI.framework in Frameworks */, 3E34125D1C54CF1B006226E0 /* MediaPlayer.framework in Frameworks */, + 3E4B86BB1C95E01B00ECDFFA /* FBSDKLoginKit.framework in Frameworks */, 3E101F061C52E5FD00C895CA /* MultipeerConnectivity.framework in Frameworks */, 3E379EFE1C3F794500F7BCCD /* CoreGraphics.framework in Frameworks */, 3E379EFF1C3F794500F7BCCD /* CoreLocation.framework in Frameworks */, 3E379F001C3F794500F7BCCD /* MobileCoreServices.framework in Frameworks */, + 3E4B86BD1C95E06400ECDFFA /* FBSDKCoreKit.framework in Frameworks */, 3E379F011C3F794500F7BCCD /* QuartzCore.framework in Frameworks */, 3E379F021C3F794500F7BCCD /* Security.framework in Frameworks */, 3E379F031C3F794500F7BCCD /* StoreKit.framework in Frameworks */, 3E379EF71C3F794500F7BCCD /* CFNetwork.framework in Frameworks */, 3E1DE9AE1C38395F00CA6CD4 /* SystemConfiguration.framework in Frameworks */, + 3E4B86B51C95DE3300ECDFFA /* Parse.framework in Frameworks */, 3E1DE9A81C3837E800CA6CD4 /* AudioToolbox.framework in Frameworks */, 3E76CF2C1C38349D00193B58 /* libsqlite3.dylib in Frameworks */, - 3E76CF2A1C38318200193B58 /* Bolts.framework in Frameworks */, - 3E76CF261C38258600193B58 /* Parse.framework in Frameworks */, - 3E76CF271C38258600193B58 /* ParseFacebookUtilsV4.framework in Frameworks */, - 3E76CF281C38258600193B58 /* ParseUI.framework in Frameworks */, - 3E43B8C91C37639C002F97A7 /* FBSDKCoreKit.framework in Frameworks */, - 3E43B8CA1C37639C002F97A7 /* FBSDKLoginKit.framework in Frameworks */, + 3E4B86B71C95DE6300ECDFFA /* ParseFacebookUtilsV4.framework in Frameworks */, + 3E4B86B31C95DAE700ECDFFA /* Bolts.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -465,13 +464,12 @@ 3E76CF2F1C3835E300193B58 /* NetworkExtension.framework */, 3E76CF2D1C3835C500193B58 /* CFNetwork.framework */, 3E76CF2B1C38349D00193B58 /* libsqlite3.dylib */, - 3E76CF291C38318200193B58 /* Bolts.framework */, - 3E76CF231C38258600193B58 /* Parse.framework */, - 3E76CF241C38258600193B58 /* ParseFacebookUtilsV4.framework */, - 3E76CF251C38258600193B58 /* ParseUI.framework */, - 3E43B8C41C375E73002F97A7 /* Bolts.framework */, - 3E43B8C51C375E73002F97A7 /* FBSDKLoginKit.framework */, - 3E1BDA751C3713F900EE3B84 /* FBSDKCoreKit.framework */, + 3E4B86BC1C95E06400ECDFFA /* FBSDKCoreKit.framework */, + 3E4B86BA1C95E01B00ECDFFA /* FBSDKLoginKit.framework */, + 3E4B86B81C95DF3D00ECDFFA /* ParseUI.framework */, + 3E4B86B61C95DE6300ECDFFA /* ParseFacebookUtilsV4.framework */, + 3E4B86B41C95DE3300ECDFFA /* Parse.framework */, + 3E4B86B21C95DAE700ECDFFA /* Bolts.framework */, ); name = Frameworks; sourceTree = ""; @@ -1070,6 +1068,7 @@ "$(inherited)", /Users/okechi/Documents/FacebookSDK, "/Users/okechi/Documents/Parse-iOS", + "$(PROJECT_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = NO; INFOPLIST_FILE = GetHip/Info.plist; @@ -1096,6 +1095,7 @@ "$(inherited)", /Users/okechi/Documents/FacebookSDK, "/Users/okechi/Documents/Parse-iOS", + "$(PROJECT_DIR)", ); GCC_PRECOMPILE_PREFIX_HEADER = NO; INFOPLIST_FILE = GetHip/Info.plist; diff --git a/GetHip/CurrentlyPlayingViewController.swift b/GetHip/CurrentlyPlayingViewController.swift index 14d9bab..5c836d9 100644 --- a/GetHip/CurrentlyPlayingViewController.swift +++ b/GetHip/CurrentlyPlayingViewController.swift @@ -20,6 +20,7 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg var audioPlayer: AVPlayer! var playing = true var timer = NSTimer() + var nextHost: String! //controller data @IBOutlet var songImg: UIImageView! @@ -39,22 +40,23 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg @IBAction func playPauseFav(sender: UIButton){ if (self.party.role == PeerType.Host_Creator){ if(playing == true){ - self.audioPlayer.pause() for peer in self.party.session.connectedPeers { var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "pause_stream"] self.party.sendInstruction(dictionary, toPeer: peer as! MCPeerID) } + self.audioPlayer.pause() self.playing = false self.ppfButton.setBackgroundImage(UIImage(named: "Play-52.png"), forState: UIControlState.Normal) }else{ - self.audioPlayer.play() - self.playing = true - self.ppfButton.setBackgroundImage(UIImage(named: "Pause-52.png"), forState: UIControlState.Normal) for peer in self.party.session.connectedPeers { var dictionary: [String: String] = ["sender": self.party.myPeerID.displayName, "instruction": "resume_stream"] self.party.sendInstruction(dictionary, toPeer: peer as! MCPeerID) } + self.audioPlayer.play() + self.playing = true + self.ppfButton.setBackgroundImage(UIImage(named: "Pause-52.png"), forState: UIControlState.Normal) + } } @@ -72,6 +74,7 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg // Do any additional setup after loading the view. + self.progressBar.setProgress(0, animated: true) if(self.party.role == PeerType.Host_Creator){ self.audioPlayer = AVPlayer(URL: self.party.currentSong.valueForProperty(MPMediaItemPropertyAssetURL) as! NSURL) @@ -96,24 +99,56 @@ class CurrentlyPlayingViewController: UIViewController, PartyServiceManagerDeleg self.artistAndAlbumLabel.text = (self.party.currentSongArtistAlbum) self.party.delegate = self self.ppfButton.hidden = true - - - } + //sets the next host of the party once the party starts + if(self.party.role == PeerType.Guest_Creator || self.party.role == PeerType.Host_Creator){ + + self.party.chooseNextHost() + print(self.party.currentHost) + + } + } + func timeFormat(value: Float) -> String{ + var minutes: Float = floor(roundf((value)/60)) + println(minutes) + var seconds: Float = roundf(((minutes * 60))) + var roundSeconds: Int = Int(roundf(seconds)) + var roundMinutes: Int = Int(roundf(minutes)) + var time: String = String(format: "%d:%02d", roundMinutes, roundSeconds) + return time + + } + func updateLabels(){ if (self.playing == true){ - var timeLeft = self.audioPlayer.currentItem.duration.value - self.audioPlayer.currentTime().value - var interval = timeLeft - var seconds = interval%60 - println(seconds) - var minutes = (interval/60)%60 - println(minutes) + // var timeLeft = self.audioPlayer.currentItem.duration.value - self.audioPlayer.currentTime().value + //var interval = timeLeft + //var seconds = interval%60 + //println(seconds) + //var minutes = (interval/60)%60 + //println(minutes) + self.minLabel.text = self.timeFormat(Float(CMTimeGetSeconds(self.audioPlayer.currentTime()))) + + println("Time Elapsed:" + self.timeFormat(Float(CMTimeGetSeconds(self.audioPlayer.currentTime())))) + + + self.maxLabel.text = self.timeFormat((Float(CMTimeGetSeconds(self.audioPlayer.currentItem.duration)) - Float(CMTimeGetSeconds(self.audioPlayer.currentTime())))) + + println("Time Left:" + self.timeFormat((Float(CMTimeGetSeconds(self.audioPlayer.currentItem.duration)) - Float(CMTimeGetSeconds(self.audioPlayer.currentTime()))))) + + //updates progressBar + var normalizedTime = Float((Float(CMTimeGetSeconds(self.audioPlayer.currentTime())) * 100.0)/Float(CMTimeGetSeconds(self.audioPlayer.currentItem.duration))) + self.progressBar.setProgress(normalizedTime, animated: true) + + + + //self.maxLabel.text //self.minLabel.text } diff --git a/GetHip/FriendData.swift b/GetHip/FriendData.swift index 4d4a6d2..faf4b77 100644 --- a/GetHip/FriendData.swift +++ b/GetHip/FriendData.swift @@ -12,11 +12,13 @@ class FriendData: NSObject, NSCoding { var displayName: String! var profileImg: UIImageView! var status: String! + var username: String! - init(display: String, status: String){ + init(display: String, status: String, username: String){ self.displayName = display self.profileImg = nil self.status = status + self.username = username super.init() } @@ -27,7 +29,7 @@ class FriendData: NSObject, NSCoding { self.displayName = aDecoder.decodeObjectForKey("displayName") as! String self.profileImg = aDecoder.decodeObjectForKey("profileImg") as! UIImageView! self.status = aDecoder.decodeObjectForKey("status") as! String - + self.username = aDecoder.decodeObjectForKey("username") as! String super.init() } @@ -35,6 +37,7 @@ class FriendData: NSObject, NSCoding { aCoder.encodeObject(self.displayName, forKey: "displayName") aCoder.encodeObject(self.profileImg, forKey: "profileImg") aCoder.encodeObject(self.status, forKey: "status") + aCoder.encodeObject(self.username, forKey: "username") } //Mark: NSObject @@ -44,6 +47,7 @@ class FriendData: NSObject, NSCoding { return self.displayName == object.displayName && self.profileImg == object.profileImg && self.status == object.status + && self.username == object.username }else { return false } diff --git a/GetHip/FriendDataSource.swift b/GetHip/FriendDataSource.swift index 26eab22..9c1862b 100644 --- a/GetHip/FriendDataSource.swift +++ b/GetHip/FriendDataSource.swift @@ -31,10 +31,11 @@ class FriendDataSource{ //var image:UIImage = UIImage() let userName = object.objectForKey("OtherUser")!.objectForKey("username") as! String + let displayName = object.objectForKey("OtherUser")!.objectForKey("displayName") as! String let requestStatus = object.objectForKey("RequestStatus")! as! String - var newFriend: FriendData = FriendData(display: userName, status: requestStatus) + var newFriend: FriendData = FriendData(display: displayName, status: requestStatus, username: userName ) var img = object.objectForKey("OtherUser")!.objectForKey("profilePicture")! as? PFFile @@ -65,8 +66,9 @@ class FriendDataSource{ for object in objects! { let userName = object.objectForKey("OtherUser")!.objectForKey("username") as! String + let displayName = object.objectForKey("OtherUser")!.objectForKey("displayName") as! String let requestStatus = object.objectForKey("RequestStatus")! as! String - var newFriend: FriendData = FriendData(display: userName, status: requestStatus) + var newFriend: FriendData = FriendData(display: displayName, status: requestStatus, username: userName) var img = object.objectForKey("OtherUser")!.objectForKey("profilePicture")! as? PFFile diff --git a/GetHip/HomeScreenViewController.swift b/GetHip/HomeScreenViewController.swift index f2743b9..a771bd9 100644 --- a/GetHip/HomeScreenViewController.swift +++ b/GetHip/HomeScreenViewController.swift @@ -56,7 +56,6 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate { self.partyData.setAdvertiser() self.partyData.startListening() - self.frndDataManager = FriendDataSource() //start browsing for peers //self.partyData.setBrowser() //self.partyData.startBrowser() @@ -65,6 +64,7 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate { //self.firstTime = false } + self.frndDataManager = FriendDataSource() } func loadID(notification: NSNotification){ @@ -97,6 +97,8 @@ class HomeScreenViewController: UIViewController, PartyServiceManagerDelegate { self.friendData = [] dispatch_async(dispatch_get_main_queue(), { self.usrDataManager = UserParseDataSource() + //self.frndDataManager = FriendDataSource() + }) } diff --git a/GetHip/InPartyViewController.swift b/GetHip/InPartyViewController.swift index 1d02dab..a9ec867 100644 --- a/GetHip/InPartyViewController.swift +++ b/GetHip/InPartyViewController.swift @@ -40,6 +40,13 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol self.friendsInParty.dataSource = self self.friendsInParty.delegate = self } + + override func viewDidAppear(animated: Bool) { + if(self.party.role == PeerType.Guest_Creator || self.party.role == PeerType.Guest_Invited){ + + self.AddMore.hidden = true + } + } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() @@ -51,23 +58,21 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol var cell: InvitedCollectionViewCell! - if(self.party.role == PeerType.Host_Creator){ - let friend = self.party.invitedFriends[indexPath.row] - cell = self.friendsInParty.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: indexPath) as! InvitedCollectionViewCell + + let friend = self.party.invitedFriends[indexPath.row] + cell = self.friendsInParty.dequeueReusableCellWithReuseIdentifier("InvitedCollectionCell", forIndexPath: indexPath) as! InvitedCollectionViewCell - if friend.profileImg == nil { - cell.friendImage.backgroundColor = UIColor.grayColor() - } - else{ - cell.friendImage.image = friend.profileImg.image! - } - - //rounds uiimage and configures UIImageView - cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2 - cell.friendImage.clipsToBounds = true - }else{ - cell = InvitedCollectionViewCell() + if friend.profileImg == nil { + cell.friendImage.backgroundColor = UIColor.grayColor() } + else{ + cell.friendImage.image = friend.profileImg.image! + } + + //rounds uiimage and configures UIImageView + cell.friendImage.layer.cornerRadius = cell.friendImage.frame.size.width/2 + cell.friendImage.clipsToBounds = true + return cell @@ -75,7 +80,10 @@ class InPartyViewController: UIViewController, UICollectionViewDataSource, UICol } func collectionView(collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { - return self.party.invitedFriends.count + + return self.party.invitedFriends.count + + } /* // MARK: - Navigation diff --git a/GetHip/LoadingPartyViewController.swift b/GetHip/LoadingPartyViewController.swift index 952dac2..9e5ed77 100644 --- a/GetHip/LoadingPartyViewController.swift +++ b/GetHip/LoadingPartyViewController.swift @@ -144,7 +144,7 @@ class LoadingPartyViewController: UIViewController, UICollectionViewDataSource, } } } - var userDat = FriendData(display: self.usr[0].displayName, status: "") + var userDat = FriendData(display: self.usr[0].displayName, status: "", username: self.usr[0].username) userDat.profileImg = UIImageView(image: self.usr[0].profileImg.image) currentlyConnected.append(userDat) diff --git a/GetHip/PartyServiceManager.swift b/GetHip/PartyServiceManager.swift index dcb00d3..5b9f4b8 100644 --- a/GetHip/PartyServiceManager.swift +++ b/GetHip/PartyServiceManager.swift @@ -87,8 +87,9 @@ class PartyServiceManager: NSObject, AnyObject { func chooseNextHost(){ var numPeers = self.connectedPeers().count var nextHostIndex: Int = Int(arc4random_uniform(UInt32(numPeers))) - - if (self.connectedPeers()[nextHostIndex].displayName == self.currentHost){ + println(nextHostIndex) + println(self.connectedPeers().count) + if (self.currentHost != nil && self.connectedPeers()[nextHostIndex].displayName == self.currentHost){ chooseNextHost() }else{ self.currentHost = self.connectedPeers()[nextHostIndex].displayName @@ -149,7 +150,10 @@ class PartyServiceManager: NSObject, AnyObject { } for peer in dataDictionary["friendData"] as! [FriendData] { - println(peer) + if(peer.username != self.myPeerID.displayName){ + println(peer.username) + self.invitedFriends.append(peer) + } } } diff --git a/Parse.framework/Headers/PFACL.h b/Parse.framework/Headers/PFACL.h new file mode 100644 index 0000000..abcf031 --- /dev/null +++ b/Parse.framework/Headers/PFACL.h @@ -0,0 +1,244 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PFRole; +@class PFUser; + +/** + The `PFACL` class is used to control which users can access or modify a particular object. + Each `PFObject` can have its own `PFACL`. You can grant read and write permissions separately to specific users, + to groups of users that belong to roles, or you can grant permissions to "the public" so that, + for example, any user could read a particular object but only a particular set of users could write to that object. + */ +@interface PFACL : NSObject + +///-------------------------------------- +/// @name Creating an ACL +///-------------------------------------- + +/** + Creates an ACL with no permissions granted. + + @return Returns a new `PFACL`. + */ ++ (instancetype)ACL; + +/** + Creates an ACL where only the provided user has access. + + @param user The user to assign access. + */ ++ (instancetype)ACLWithUser:(PFUser *)user; + +///-------------------------------------- +/// @name Controlling Public Access +///-------------------------------------- + +/** + Controls whether the public is allowed to read this object. + */ +@property (nonatomic, assign, getter=getPublicReadAccess) BOOL publicReadAccess; + +/** + Controls whether the public is allowed to write this object. + */ +@property (nonatomic, assign, getter=getPublicWriteAccess) BOOL publicWriteAccess; + +///-------------------------------------- +/// @name Controlling Access Per-User +///-------------------------------------- + +/** + Set whether the given user id is allowed to read this object. + + @param allowed Whether the given user can write this object. + @param userId The `PFObject.objectId` of the user to assign access. + */ +- (void)setReadAccess:(BOOL)allowed forUserId:(NSString *)userId; + +/** + Gets whether the given user id is *explicitly* allowed to read this object. + Even if this returns `NO`, the user may still be able to access it if `publicReadAccess` returns `YES` + or if the user belongs to a role that has access. + + @param userId The `PFObject.objectId` of the user for which to retrive access. + + @return `YES` if the user with this `objectId` has *explicit* read access, otherwise `NO`. + */ +- (BOOL)getReadAccessForUserId:(NSString *)userId; + +/** + Set whether the given user id is allowed to write this object. + + @param allowed Whether the given user can read this object. + @param userId The `PFObject.objectId` of the user to assign access. + */ +- (void)setWriteAccess:(BOOL)allowed forUserId:(NSString *)userId; + +/** + Gets whether the given user id is *explicitly* allowed to write this object. + Even if this returns NO, the user may still be able to write it if `publicWriteAccess` returns `YES` + or if the user belongs to a role that has access. + + @param userId The `PFObject.objectId` of the user for which to retrive access. + + @return `YES` if the user with this `PFObject.objectId` has *explicit* write access, otherwise `NO`. + */ +- (BOOL)getWriteAccessForUserId:(NSString *)userId; + +/** + Set whether the given user is allowed to read this object. + + @param allowed Whether the given user can read this object. + @param user The user to assign access. + */ +- (void)setReadAccess:(BOOL)allowed forUser:(PFUser *)user; + +/** + Gets whether the given user is *explicitly* allowed to read this object. + Even if this returns `NO`, the user may still be able to access it if `publicReadAccess` returns `YES` + or if the user belongs to a role that has access. + + @param user The user for which to retrive access. + + @return `YES` if the user has *explicit* read access, otherwise `NO`. + */ +- (BOOL)getReadAccessForUser:(PFUser *)user; + +/** + Set whether the given user is allowed to write this object. + + @param allowed Whether the given user can write this object. + @param user The user to assign access. + */ +- (void)setWriteAccess:(BOOL)allowed forUser:(PFUser *)user; + +/** + Gets whether the given user is *explicitly* allowed to write this object. + Even if this returns `NO`, the user may still be able to write it if `publicWriteAccess` returns `YES` + or if the user belongs to a role that has access. + + @param user The user for which to retrive access. + + @return `YES` if the user has *explicit* write access, otherwise `NO`. + */ +- (BOOL)getWriteAccessForUser:(PFUser *)user; + +///-------------------------------------- +/// @name Controlling Access Per-Role +///-------------------------------------- + +/** + Get whether users belonging to the role with the given name are allowed to read this object. + Even if this returns `NO`, the role may still be able to read it if a parent role has read access. + + @param name The name of the role. + + @return `YES` if the role has read access, otherwise `NO`. + */ +- (BOOL)getReadAccessForRoleWithName:(NSString *)name; + +/** + Set whether users belonging to the role with the given name are allowed to read this object. + + @param allowed Whether the given role can read this object. + @param name The name of the role. + */ +- (void)setReadAccess:(BOOL)allowed forRoleWithName:(NSString *)name; + +/** + Get whether users belonging to the role with the given name are allowed to write this object. + Even if this returns `NO`, the role may still be able to write it if a parent role has write access. + + @param name The name of the role. + + @return `YES` if the role has read access, otherwise `NO`. + */ +- (BOOL)getWriteAccessForRoleWithName:(NSString *)name; + +/** + Set whether users belonging to the role with the given name are allowed to write this object. + + @param allowed Whether the given role can write this object. + @param name The name of the role. + */ +- (void)setWriteAccess:(BOOL)allowed forRoleWithName:(NSString *)name; + +/** + Get whether users belonging to the given role are allowed to read this object. + Even if this returns `NO`, the role may still be able to read it if a parent role has read access. + + The role must already be saved on the server and + it's data must have been fetched in order to use this method. + + @param role The name of the role. + + @return `YES` if the role has read access, otherwise `NO`. + */ +- (BOOL)getReadAccessForRole:(PFRole *)role; + +/** + Set whether users belonging to the given role are allowed to read this object. + + The role must already be saved on the server and + it's data must have been fetched in order to use this method. + + @param allowed Whether the given role can read this object. + @param role The role to assign access. + */ +- (void)setReadAccess:(BOOL)allowed forRole:(PFRole *)role; + +/** + Get whether users belonging to the given role are allowed to write this object. + Even if this returns `NO`, the role may still be able to write it if a parent role has write access. + + The role must already be saved on the server and + it's data must have been fetched in order to use this method. + + @param role The name of the role. + + @return `YES` if the role has write access, otherwise `NO`. + */ +- (BOOL)getWriteAccessForRole:(PFRole *)role; + +/** + Set whether users belonging to the given role are allowed to write this object. + + The role must already be saved on the server and + it's data must have been fetched in order to use this method. + + @param allowed Whether the given role can write this object. + @param role The role to assign access. + */ +- (void)setWriteAccess:(BOOL)allowed forRole:(PFRole *)role; + +///-------------------------------------- +/// @name Setting Access Defaults +///-------------------------------------- + +/** + Sets a default ACL that will be applied to all instances of `PFObject` when they are created. + + @param acl The ACL to use as a template for all instance of `PFObject` created after this method has been called. + This value will be copied and used as a template for the creation of new ACLs, so changes to the + instance after this method has been called will not be reflected in new instance of `PFObject`. + @param currentUserAccess - If `YES`, the `PFACL` that is applied to newly-created instance of `PFObject` will + provide read and write access to the `PFUser.+currentUser` at the time of creation. + - If `NO`, the provided `acl` will be used without modification. + - If `acl` is `nil`, this value is ignored. + */ ++ (void)setDefaultACL:(nullable PFACL *)acl withAccessForCurrentUser:(BOOL)currentUserAccess; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFAnalytics.h b/Parse.framework/Headers/PFAnalytics.h new file mode 100644 index 0000000..958d8e4 --- /dev/null +++ b/Parse.framework/Headers/PFAnalytics.h @@ -0,0 +1,167 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `PFAnalytics` provides an interface to Parse's logging and analytics backend. + + Methods will return immediately and cache the request (+ timestamp) to be + handled "eventually." That is, the request will be sent immediately if possible + or the next time a network connection is available. + */ +@interface PFAnalytics : NSObject + +///-------------------------------------- +/// @name App-Open / Push Analytics +///-------------------------------------- + +/** + Tracks this application being launched. If this happened as the result of the + user opening a push notification, this method sends along information to + correlate this open with that push. + + Pass in `nil` to track a standard "application opened" event. + + @param launchOptions The `NSDictionary` indicating the reason the application was + launched, if any. This value can be found as a parameter to various + `UIApplicationDelegate` methods, and can be empty or `nil`. + + @return Returns the task encapsulating the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)trackAppOpenedWithLaunchOptions:(nullable NSDictionary *)launchOptions; + +/** + Tracks this application being launched. + If this happened as the result of the user opening a push notification, + this method sends along information to correlate this open with that push. + + Pass in `nil` to track a standard "application opened" event. + + @param launchOptions The dictionary indicating the reason the application was + launched, if any. This value can be found as a parameter to various + `UIApplicationDelegate` methods, and can be empty or `nil`. + @param block The block to execute on server response. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)trackAppOpenedWithLaunchOptionsInBackground:(nullable NSDictionary *)launchOptions + block:(nullable PFBooleanResultBlock)block; + +/** + Tracks this application being launched. If this happened as the result of the + user opening a push notification, this method sends along information to + correlate this open with that push. + + @param userInfo The Remote Notification payload, if any. This value can be + found either under `UIApplicationLaunchOptionsRemoteNotificationKey` on `launchOptions`, + or as a parameter to `application:didReceiveRemoteNotification:`. + This can be empty or `nil`. + + @return Returns the task encapsulating the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)trackAppOpenedWithRemoteNotificationPayload:(nullable NSDictionary *)userInfo; + +/** + Tracks this application being launched. If this happened as the result of the + user opening a push notification, this method sends along information to + correlate this open with that push. + + @param userInfo The Remote Notification payload, if any. This value can be + found either under `UIApplicationLaunchOptionsRemoteNotificationKey` on `launchOptions`, + or as a parameter to `application:didReceiveRemoteNotification:`. This can be empty or `nil`. + @param block The block to execute on server response. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)trackAppOpenedWithRemoteNotificationPayloadInBackground:(nullable NSDictionary *)userInfo + block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Custom Analytics +///-------------------------------------- + +/** + Tracks the occurrence of a custom event. + + Parse will store a data point at the time of invocation with the given event name. + + @param name The name of the custom event to report to Parse as having happened. + + @return Returns the task encapsulating the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)trackEvent:(NSString *)name; + +/** + Tracks the occurrence of a custom event. Parse will store a data point at the + time of invocation with the given event name. The event will be sent at some + unspecified time in the future, even if Parse is currently inaccessible. + + @param name The name of the custom event to report to Parse as having happened. + @param block The block to execute on server response. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)trackEventInBackground:(NSString *)name block:(nullable PFBooleanResultBlock)block; + +/** + Tracks the occurrence of a custom event with additional dimensions. Parse will + store a data point at the time of invocation with the given event name. + + Dimensions will allow segmentation of the occurrences of this custom event. + Keys and values should be NSStrings, and will throw otherwise. + + To track a user signup along with additional metadata, consider the following: + + NSDictionary *dimensions = @{ @"gender": @"m", + @"source": @"web", + @"dayType": @"weekend" }; + [PFAnalytics trackEvent:@"signup" dimensions:dimensions]; + + @warning There is a default limit of 8 dimensions per event tracked. + + @param name The name of the custom event to report to Parse as having happened. + @param dimensions The `NSDictionary` of information by which to segment this event. + + @return Returns the task encapsulating the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)trackEvent:(NSString *)name + dimensions:(nullable NSDictionary PF_GENERIC(NSString *, NSString *)*)dimensions; + +/** + Tracks the occurrence of a custom event with additional dimensions. Parse will + store a data point at the time of invocation with the given event name. The + event will be sent at some unspecified time in the future, even if Parse is currently inaccessible. + + @discussionDimensions will allow segmentation of the occurrences of this custom event. + Keys and values should be NSStrings, and will throw otherwise. + + To track a user signup along with additional metadata, consider the following: + NSDictionary *dimensions = @{ @"gender": @"m", + @"source": @"web", + @"dayType": @"weekend" }; + [PFAnalytics trackEvent:@"signup" dimensions:dimensions]; + + There is a default limit of 8 dimensions per event tracked. + + @param name The name of the custom event to report to Parse as having happened. + @param dimensions The `NSDictionary` of information by which to segment this event. + @param block The block to execute on server response. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)trackEventInBackground:(NSString *)name + dimensions:(nullable NSDictionary PF_GENERIC(NSString *, NSString *)*)dimensions + block:(nullable PFBooleanResultBlock)block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFAnonymousUtils.h b/Parse.framework/Headers/PFAnonymousUtils.h new file mode 100644 index 0000000..b111eaa --- /dev/null +++ b/Parse.framework/Headers/PFAnonymousUtils.h @@ -0,0 +1,82 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + Provides utility functions for working with Anonymously logged-in users. + Anonymous users have some unique characteristics: + + - Anonymous users don't need a user name or password. + - Once logged out, an anonymous user cannot be recovered. + - When the current user is anonymous, the following methods can be used to switch + to a different user or convert the anonymous user into a regular one: + - signUp converts an anonymous user to a standard user with the given username and password. + Data associated with the anonymous user is retained. + - logIn switches users without converting the anonymous user. + Data associated with the anonymous user will be lost. + - Service logIn (e.g. Facebook, Twitter) will attempt to convert + the anonymous user into a standard user by linking it to the service. + If a user already exists that is linked to the service, it will instead switch to the existing user. + - Service linking (e.g. Facebook, Twitter) will convert the anonymous user + into a standard user by linking it to the service. + */ +@interface PFAnonymousUtils : NSObject + +///-------------------------------------- +/// @name Creating an Anonymous User +///-------------------------------------- + +/** + Creates an anonymous user asynchronously and sets as a result to `BFTask`. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(PFUser *)*)logInInBackground; + +/** + Creates an anonymous user. + + @param block The block to execute when anonymous user creation is complete. + It should have the following argument signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)logInWithBlock:(nullable PFUserResultBlock)block; + +/* + Creates an anonymous user. + + @param target Target object for the selector. + @param selector The selector that will be called when the asynchronous request is complete. + It should have the following signature: `(void)callbackWithUser:(PFUser *)user error:(NSError *)error`. + */ ++ (void)logInWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Determining Whether a User is Anonymous +///-------------------------------------- + +/** + Whether the `PFUser` object is logged in anonymously. + + @param user `PFUser` object to check for anonymity. The user must be logged in on this device. + + @return `YES` if the user is anonymous. `NO` if the user is not the current user or is not anonymous. + */ ++ (BOOL)isLinkedWithUser:(nullable PFUser *)user; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFCloud.h b/Parse.framework/Headers/PFCloud.h new file mode 100644 index 0000000..c0bd9ee --- /dev/null +++ b/Parse.framework/Headers/PFCloud.h @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFCloud` class provides methods for interacting with Parse Cloud Functions. + */ +@interface PFCloud : NSObject + +/** + Calls the given cloud function *synchronously* with the parameters provided. + + @param function The function name to call. + @param parameters The parameters to send to the function. + + @return The response from the cloud function. + */ ++ (nullable id)callFunction:(NSString *)function withParameters:(nullable NSDictionary *)parameters PF_SWIFT_UNAVAILABLE; + +/** + Calls the given cloud function *synchronously* with the parameters provided and + sets the error if there is one. + + @param function The function name to call. + @param parameters The parameters to send to the function. + @param error Pointer to an `NSError` that will be set if necessary. + + @return The response from the cloud function. + This result could be a `NSDictionary`, an `NSArray`, `NSNumber` or `NSString`. + */ ++ (nullable id)callFunction:(NSString *)function + withParameters:(nullable NSDictionary *)parameters + error:(NSError **)error; + +/** + Calls the given cloud function *asynchronously* with the parameters provided. + + @param function The function name to call. + @param parameters The parameters to send to the function. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(id) *)callFunctionInBackground:(NSString *)function + withParameters:(nullable NSDictionary *)parameters; + +/** + Calls the given cloud function *asynchronously* with the parameters provided + and executes the given block when it is done. + + @param function The function name to call. + @param parameters The parameters to send to the function. + @param block The block to execute when the function call finished. + It should have the following argument signature: `^(id result, NSError *error)`. + */ ++ (void)callFunctionInBackground:(NSString *)function + withParameters:(nullable NSDictionary *)parameters + block:(nullable PFIdResultBlock)block; + +/* + Calls the given cloud function *asynchronously* with the parameters provided + and then executes the given selector when it is done. + + @param function The function name to call. + @param parameters The parameters to send to the function. + @param target The object to call the selector on. + @param selector The selector to call when the function call finished. + It should have the following signature: `(void)callbackWithResult:(id)result error:(NSError *)error`. + Result will be `nil` if error is set and vice versa. + */ ++ (void)callFunctionInBackground:(NSString *)function + withParameters:(nullable NSDictionary *)parameters + target:(nullable id)target + selector:(nullable SEL)selector; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFConfig.h b/Parse.framework/Headers/PFConfig.h new file mode 100644 index 0000000..c542a9f --- /dev/null +++ b/Parse.framework/Headers/PFConfig.h @@ -0,0 +1,105 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PFConfig; + +typedef void(^PFConfigResultBlock)(PFConfig *__nullable config, NSError *__nullable error); + +/** + `PFConfig` is a representation of the remote configuration object. + It enables you to add things like feature gating, a/b testing or simple "Message of the day". + */ +@interface PFConfig : NSObject + +///-------------------------------------- +/// @name Current Config +///-------------------------------------- + +/** + Returns the most recently fetched config. + + If there was no config fetched - this method will return an empty instance of `PFConfig`. + + @return Current, last fetched instance of PFConfig. + */ ++ (PFConfig *)currentConfig; + +///-------------------------------------- +/// @name Retrieving Config +///-------------------------------------- + +/** + Gets the `PFConfig` object *synchronously* from the server. + + @return Instance of `PFConfig` if the operation succeeded, otherwise `nil`. + */ ++ (nullable PFConfig *)getConfig PF_SWIFT_UNAVAILABLE; + +/** + Gets the `PFConfig` object *synchronously* from the server and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Instance of PFConfig if the operation succeeded, otherwise `nil`. + */ ++ (nullable PFConfig *)getConfig:(NSError **)error; + +/** + Gets the `PFConfig` *asynchronously* and sets it as a result of a task. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(PFConfig *)*)getConfigInBackground; + +/** + Gets the `PFConfig` *asynchronously* and executes the given callback block. + + @param block The block to execute. + It should have the following argument signature: `^(PFConfig *config, NSError *error)`. + */ ++ (void)getConfigInBackgroundWithBlock:(nullable PFConfigResultBlock)block; + +///-------------------------------------- +/// @name Parameters +///-------------------------------------- + +/** + Returns the object associated with a given key. + + @param key The key for which to return the corresponding configuration value. + + @return The value associated with `key`, or `nil` if there is no such value. + */ +- (nullable id)objectForKey:(NSString *)key; + +/** + Returns the object associated with a given key. + + This method enables usage of literal syntax on `PFConfig`. + E.g. `NSString *value = config[@"key"];` + + @see objectForKey: + + @param keyedSubscript The keyed subscript for which to return the corresponding configuration value. + + @return The value associated with `key`, or `nil` if there is no such value. + */ +- (nullable id)objectForKeyedSubscript:(NSString *)keyedSubscript; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFConstants.h b/Parse.framework/Headers/PFConstants.h new file mode 100644 index 0000000..ed2c7b0 --- /dev/null +++ b/Parse.framework/Headers/PFConstants.h @@ -0,0 +1,557 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +@class PFObject; +@class PFUser; + +///-------------------------------------- +/// @name Version +///-------------------------------------- + +#define PARSE_VERSION @"1.11.0" + +extern NSInteger const PARSE_API_VERSION; + +///-------------------------------------- +/// @name Platform +///-------------------------------------- + +#define PARSE_IOS_ONLY (TARGET_OS_IPHONE) +#define PARSE_OSX_ONLY (TARGET_OS_MAC && !(TARGET_OS_IPHONE)) + +extern NSString *const __nonnull kPFDeviceType; + +///-------------------------------------- +/// @name Server +///-------------------------------------- + +extern NSString *const __nonnull kPFParseServer; + +///-------------------------------------- +/// @name Cache Policies +///-------------------------------------- + +/** + `PFCachePolicy` specifies different caching policies that could be used with `PFQuery`. + + This lets you show data when the user's device is offline, + or when the app has just started and network requests have not yet had time to complete. + Parse takes care of automatically flushing the cache when it takes up too much space. + + @warning Cache policy could only be set when Local Datastore is not enabled. + + @see PFQuery + */ +typedef NS_ENUM(uint8_t, PFCachePolicy) { + /** + The query does not load from the cache or save results to the cache. + This is the default cache policy. + */ + kPFCachePolicyIgnoreCache = 0, + /** + The query only loads from the cache, ignoring the network. + If there are no cached results, this causes a `NSError` with `kPFErrorCacheMiss` code. + */ + kPFCachePolicyCacheOnly, + /** + The query does not load from the cache, but it will save results to the cache. + */ + kPFCachePolicyNetworkOnly, + /** + The query first tries to load from the cache, but if that fails, it loads results from the network. + If there are no cached results, this causes a `NSError` with `kPFErrorCacheMiss` code. + */ + kPFCachePolicyCacheElseNetwork, + /** + The query first tries to load from the network, but if that fails, it loads results from the cache. + If there are no cached results, this causes a `NSError` with `kPFErrorCacheMiss` code. + */ + kPFCachePolicyNetworkElseCache, + /** + The query first loads from the cache, then loads from the network. + The callback will be called twice - first with the cached results, then with the network results. + Since it returns two results at different times, this cache policy cannot be used with synchronous or task methods. + */ + kPFCachePolicyCacheThenNetwork +}; + +///-------------------------------------- +/// @name Logging Levels +///-------------------------------------- + +/** + `PFLogLevel` enum specifies different levels of logging that could be used to limit or display more messages in logs. + + @see `Parse.+setLogLevel:` + @see `Parse.+logLevel` + */ +typedef NS_ENUM(uint8_t, PFLogLevel) { + /** + Log level that disables all logging. + */ + PFLogLevelNone = 0, + /** + Log level that if set is going to output error messages to the log. + */ + PFLogLevelError = 1, + /** + Log level that if set is going to output the following messages to log: + - Errors + - Warnings + */ + PFLogLevelWarning = 2, + /** + Log level that if set is going to output the following messages to log: + - Errors + - Warnings + - Informational messages + */ + PFLogLevelInfo = 3, + /** + Log level that if set is going to output the following messages to log: + - Errors + - Warnings + - Informational messages + - Debug messages + */ + PFLogLevelDebug = 4 +}; + +///-------------------------------------- +/// @name Errors +///-------------------------------------- + +extern NSString *const __nonnull PFParseErrorDomain; + +/** + `PFErrorCode` enum contains all custom error codes that are used as `code` for `NSError` for callbacks on all classes. + + These codes are used when `domain` of `NSError` that you receive is set to `PFParseErrorDomain`. + */ +typedef NS_ENUM(NSInteger, PFErrorCode) { + /** + Internal server error. No information available. + */ + kPFErrorInternalServer = 1, + /** + The connection to the Parse servers failed. + */ + kPFErrorConnectionFailed = 100, + /** + Object doesn't exist, or has an incorrect password. + */ + kPFErrorObjectNotFound = 101, + /** + You tried to find values matching a datatype that doesn't + support exact database matching, like an array or a dictionary. + */ + kPFErrorInvalidQuery = 102, + /** + Missing or invalid classname. Classnames are case-sensitive. + They must start with a letter, and `a-zA-Z0-9_` are the only valid characters. + */ + kPFErrorInvalidClassName = 103, + /** + Missing object id. + */ + kPFErrorMissingObjectId = 104, + /** + Invalid key name. Keys are case-sensitive. + They must start with a letter, and `a-zA-Z0-9_` are the only valid characters. + */ + kPFErrorInvalidKeyName = 105, + /** + Malformed pointer. Pointers must be arrays of a classname and an object id. + */ + kPFErrorInvalidPointer = 106, + /** + Malformed json object. A json dictionary is expected. + */ + kPFErrorInvalidJSON = 107, + /** + Tried to access a feature only available internally. + */ + kPFErrorCommandUnavailable = 108, + /** + Field set to incorrect type. + */ + kPFErrorIncorrectType = 111, + /** + Invalid channel name. A channel name is either an empty string (the broadcast channel) + or contains only `a-zA-Z0-9_` characters and starts with a letter. + */ + kPFErrorInvalidChannelName = 112, + /** + Invalid device token. + */ + kPFErrorInvalidDeviceToken = 114, + /** + Push is misconfigured. See details to find out how. + */ + kPFErrorPushMisconfigured = 115, + /** + The object is too large. + */ + kPFErrorObjectTooLarge = 116, + /** + That operation isn't allowed for clients. + */ + kPFErrorOperationForbidden = 119, + /** + The results were not found in the cache. + */ + kPFErrorCacheMiss = 120, + /** + Keys in `NSDictionary` values may not include `$` or `.`. + */ + kPFErrorInvalidNestedKey = 121, + /** + Invalid file name. + A file name can contain only `a-zA-Z0-9_.` characters and should be between 1 and 36 characters. + */ + kPFErrorInvalidFileName = 122, + /** + Invalid ACL. An ACL with an invalid format was saved. This should not happen if you use `PFACL`. + */ + kPFErrorInvalidACL = 123, + /** + The request timed out on the server. Typically this indicates the request is too expensive. + */ + kPFErrorTimeout = 124, + /** + The email address was invalid. + */ + kPFErrorInvalidEmailAddress = 125, + /** + A unique field was given a value that is already taken. + */ + kPFErrorDuplicateValue = 137, + /** + Role's name is invalid. + */ + kPFErrorInvalidRoleName = 139, + /** + Exceeded an application quota. Upgrade to resolve. + */ + kPFErrorExceededQuota = 140, + /** + Cloud Code script had an error. + */ + kPFScriptError = 141, + /** + Cloud Code validation failed. + */ + kPFValidationError = 142, + /** + Product purchase receipt is missing. + */ + kPFErrorReceiptMissing = 143, + /** + Product purchase receipt is invalid. + */ + kPFErrorInvalidPurchaseReceipt = 144, + /** + Payment is disabled on this device. + */ + kPFErrorPaymentDisabled = 145, + /** + The product identifier is invalid. + */ + kPFErrorInvalidProductIdentifier = 146, + /** + The product is not found in the App Store. + */ + kPFErrorProductNotFoundInAppStore = 147, + /** + The Apple server response is not valid. + */ + kPFErrorInvalidServerResponse = 148, + /** + Product fails to download due to file system error. + */ + kPFErrorProductDownloadFileSystemFailure = 149, + /** + Fail to convert data to image. + */ + kPFErrorInvalidImageData = 150, + /** + Unsaved file. + */ + kPFErrorUnsavedFile = 151, + /** + Fail to delete file. + */ + kPFErrorFileDeleteFailure = 153, + /** + Application has exceeded its request limit. + */ + kPFErrorRequestLimitExceeded = 155, + /** + Invalid event name. + */ + kPFErrorInvalidEventName = 160, + /** + Username is missing or empty. + */ + kPFErrorUsernameMissing = 200, + /** + Password is missing or empty. + */ + kPFErrorUserPasswordMissing = 201, + /** + Username has already been taken. + */ + kPFErrorUsernameTaken = 202, + /** + Email has already been taken. + */ + kPFErrorUserEmailTaken = 203, + /** + The email is missing, and must be specified. + */ + kPFErrorUserEmailMissing = 204, + /** + A user with the specified email was not found. + */ + kPFErrorUserWithEmailNotFound = 205, + /** + The user cannot be altered by a client without the session. + */ + kPFErrorUserCannotBeAlteredWithoutSession = 206, + /** + Users can only be created through sign up. + */ + kPFErrorUserCanOnlyBeCreatedThroughSignUp = 207, + /** + An existing Facebook account already linked to another user. + */ + kPFErrorFacebookAccountAlreadyLinked = 208, + /** + An existing account already linked to another user. + */ + kPFErrorAccountAlreadyLinked = 208, + /** + Error code indicating that the current session token is invalid. + */ + kPFErrorInvalidSessionToken = 209, + kPFErrorUserIdMismatch = 209, + /** + Facebook id missing from request. + */ + kPFErrorFacebookIdMissing = 250, + /** + Linked id missing from request. + */ + kPFErrorLinkedIdMissing = 250, + /** + Invalid Facebook session. + */ + kPFErrorFacebookInvalidSession = 251, + /** + Invalid linked session. + */ + kPFErrorInvalidLinkedSession = 251, +}; + +///-------------------------------------- +/// @name Blocks +///-------------------------------------- + +typedef void (^PFBooleanResultBlock)(BOOL succeeded, NSError *__nullable error); +typedef void (^PFIntegerResultBlock)(int number, NSError *__nullable error); +typedef void (^PFArrayResultBlock)(NSArray *__nullable objects, NSError *__nullable error); +typedef void (^PFObjectResultBlock)(PFObject *__nullable object, NSError *__nullable error); +typedef void (^PFSetResultBlock)(NSSet *__nullable channels, NSError *__nullable error); +typedef void (^PFUserResultBlock)(PFUser *__nullable user, NSError *__nullable error); +typedef void (^PFDataResultBlock)(NSData *__nullable data, NSError *__nullable error); +typedef void (^PFDataStreamResultBlock)(NSInputStream *__nullable stream, NSError *__nullable error); +typedef void (^PFFilePathResultBlock)(NSString *__nullable filePath, NSError *__nullable error); +typedef void (^PFStringResultBlock)(NSString *__nullable string, NSError *__nullable error); +typedef void (^PFIdResultBlock)(__nullable id object, NSError *__nullable error); +typedef void (^PFProgressBlock)(int percentDone); + +///-------------------------------------- +/// @name Network Notifications +///-------------------------------------- + +/** + The name of the notification that is going to be sent before any URL request is sent. + */ +extern NSString *const __nonnull PFNetworkWillSendURLRequestNotification; + +/** + The name of the notification that is going to be sent after any URL response is received. + */ +extern NSString *const __nonnull PFNetworkDidReceiveURLResponseNotification; + +/** + The key of request(NSURLRequest) in the userInfo dictionary of a notification. + @note This key is populated in userInfo, only if `PFLogLevel` on `Parse` is set to `PFLogLevelDebug`. + */ +extern NSString *const __nonnull PFNetworkNotificationURLRequestUserInfoKey; + +/** + The key of response(NSHTTPURLResponse) in the userInfo dictionary of a notification. + @note This key is populated in userInfo, only if `PFLogLevel` on `Parse` is set to `PFLogLevelDebug`. + */ +extern NSString *const __nonnull PFNetworkNotificationURLResponseUserInfoKey; + +/** + The key of repsonse body (usually `NSString` with JSON) in the userInfo dictionary of a notification. + @note This key is populated in userInfo, only if `PFLogLevel` on `Parse` is set to `PFLogLevelDebug`. + */ +extern NSString *const __nonnull PFNetworkNotificationURLResponseBodyUserInfoKey; + + +///-------------------------------------- +/// @name Deprecated Macros +///-------------------------------------- + +#ifndef PARSE_DEPRECATED +# ifdef __deprecated_msg +# define PARSE_DEPRECATED(_MSG) __deprecated_msg(_MSG) +# else +# ifdef __deprecated +# define PARSE_DEPRECATED(_MSG) __attribute__((deprecated)) +# else +# define PARSE_DEPRECATED(_MSG) +# endif +# endif +#endif + +///-------------------------------------- +/// @name Extensions Macros +///-------------------------------------- + +#ifndef PF_EXTENSION_UNAVAILABLE +# if PARSE_IOS_ONLY +# ifdef NS_EXTENSION_UNAVAILABLE_IOS +# define PF_EXTENSION_UNAVAILABLE(_msg) NS_EXTENSION_UNAVAILABLE_IOS(_msg) +# else +# define PF_EXTENSION_UNAVAILABLE(_msg) +# endif +# else +# ifdef NS_EXTENSION_UNAVAILABLE_MAC +# define PF_EXTENSION_UNAVAILABLE(_msg) NS_EXTENSION_UNAVAILABLE_MAC(_msg) +# else +# define PF_EXTENSION_UNAVAILABLE(_msg) +# endif +# endif +#endif + +///-------------------------------------- +/// @name Swift Macros +///-------------------------------------- + +#ifndef PF_SWIFT_UNAVAILABLE +# ifdef NS_SWIFT_UNAVAILABLE +# define PF_SWIFT_UNAVAILABLE NS_SWIFT_UNAVAILABLE("") +# else +# define PF_SWIFT_UNAVAILABLE +# endif +#endif + +///-------------------------------------- +/// @name Obj-C Generics Macros +///-------------------------------------- + +#if __has_feature(objc_generics) || __has_extension(objc_generics) +# define PF_GENERIC(...) <__VA_ARGS__> +#else +# define PF_GENERIC(...) +# define PFGenericObject PFObject * +#endif + +///-------------------------------------- +/// @name Platform Availability Defines +///-------------------------------------- + +#ifndef TARGET_OS_IOS +# define TARGET_OS_IOS TARGET_OS_IPHONE +#endif +#ifndef TARGET_OS_WATCH +# define TARGET_OS_WATCH 0 +#endif +#ifndef TARGET_OS_TV +# define TARGET_OS_TV 0 +#endif + +#ifndef PF_TARGET_OS_OSX +# define PF_TARGET_OS_OSX TARGET_OS_MAC && !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV +#endif + +///-------------------------------------- +/// @name Avaiability Macros +///-------------------------------------- + +#ifndef PF_IOS_UNAVAILABLE +# ifdef __IOS_UNAVILABLE +# define PF_IOS_UNAVAILABLE __IOS_UNAVAILABLE +# else +# define PF_IOS_UNAVAILABLE +# endif +#endif + +#ifndef PF_IOS_UNAVAILABLE_WARNING +# if TARGET_OS_IOS +# define PF_IOS_UNAVAILABLE_WARNING _Pragma("GCC warning \"This file is unavailable on iOS.\"") +# else +# define PF_IOS_UNAVAILABLE_WARNING +# endif +#endif + +#ifndef PF_OSX_UNAVAILABLE +# if PF_TARGET_OS_OSX +# define PF_OSX_UNAVAILABLE __OSX_UNAVAILABLE +# else +# define PF_OSX_UNAVAILABLE +# endif +#endif + +#ifndef PF_OSX_UNAVAILABLE_WARNING +# if PF_TARGET_OS_OSX +# define PF_OSX_UNAVAILABLE_WARNING _Pragma("GCC warning \"This file is unavailable on OS X.\"") +# else +# define PF_OSX_UNAVAILABLE_WARNING +# endif +#endif + +#ifndef PF_WATCH_UNAVAILABLE +# ifdef __WATCHOS_UNAVAILABLE +# define PF_WATCH_UNAVAILABLE __WATCHOS_UNAVAILABLE +# else +# define PF_WATCH_UNAVAILABLE +# endif +#endif + +#ifndef PF_WATCH_UNAVAILABLE_WARNING +# if TARGET_OS_WATCH +# define PF_WATCH_UNAVAILABLE_WARNING _Pragma("GCC warning \"This file is unavailable on watchOS.\"") +# else +# define PF_WATCH_UNAVAILABLE_WARNING +# endif +#endif + +#ifndef PF_TV_UNAVAILABLE +# ifdef __TVOS_PROHIBITED +# define PF_TV_UNAVAILABLE __TVOS_PROHIBITED +# else +# define PF_TV_UNAVAILABLE +# endif +#endif + +#ifndef PF_TV_UNAVAILABLE_WARNING +# if TARGET_OS_TV +# define PF_TV_UNAVAILABLE_WARNING _Pragma("GCC warning \"This file is unavailable on tvOS.\"") +# else +# define PF_TV_UNAVAILABLE_WARNING +# endif +#endif diff --git a/Parse.framework/Headers/PFFile.h b/Parse.framework/Headers/PFFile.h new file mode 100644 index 0000000..0c99491 --- /dev/null +++ b/Parse.framework/Headers/PFFile.h @@ -0,0 +1,444 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `PFFile` representes a file of binary data stored on the Parse servers. + This can be a image, video, or anything else that an application needs to reference in a non-relational way. + */ +@interface PFFile : NSObject + +///-------------------------------------- +/// @name Creating a PFFile +///-------------------------------------- + +- (instancetype)init NS_UNAVAILABLE; ++ (instancetype)new NS_UNAVAILABLE; + +/** + Creates a file with given data. A name will be assigned to it by the server. + + @param data The contents of the new `PFFile`. + + @return A new `PFFile`. + */ ++ (nullable instancetype)fileWithData:(NSData *)data; + +/** + Creates a file with given data and name. + + @param name The name of the new PFFile. The file name must begin with and + alphanumeric character, and consist of alphanumeric characters, periods, + spaces, underscores, or dashes. + @param data The contents of the new `PFFile`. + + @return A new `PFFile` object. + */ ++ (nullable instancetype)fileWithName:(nullable NSString *)name data:(NSData *)data; + +/** + Creates a file with the contents of another file. + + @warning This method raises an exception if the file at path is not accessible + or if there is not enough disk space left. + + @param name The name of the new `PFFile`. The file name must begin with and alphanumeric character, + and consist of alphanumeric characters, periods, spaces, underscores, or dashes. + @param path The path to the file that will be uploaded to Parse. + + @return A new `PFFile` instance. + */ ++ (nullable instancetype)fileWithName:(nullable NSString *)name + contentsAtPath:(NSString *)path PF_SWIFT_UNAVAILABLE; + +/** + Creates a file with the contents of another file. + + @param name The name of the new `PFFile`. The file name must begin with and alphanumeric character, + and consist of alphanumeric characters, periods, spaces, underscores, or dashes. + @param path The path to the file that will be uploaded to Parse. + @param error On input, a pointer to an error object. + If an error occurs, this pointer is set to an actual error object containing the error information. + You may specify `nil` for this parameter if you do not want the error information. + + @return A new `PFFile` instance or `nil` if the error occured. + */ ++ (nullable instancetype)fileWithName:(nullable NSString *)name + contentsAtPath:(NSString *)path + error:(NSError **)error; + +/** + Creates a file with given data, name and content type. + + @warning This method raises an exception if the data supplied is not accessible or could not be saved. + + @param name The name of the new `PFFile`. The file name must begin with and alphanumeric character, + and consist of alphanumeric characters, periods, spaces, underscores, or dashes. + @param data The contents of the new `PFFile`. + @param contentType Represents MIME type of the data. + + @return A new `PFFile` instance. + */ ++ (nullable instancetype)fileWithName:(nullable NSString *)name + data:(NSData *)data + contentType:(nullable NSString *)contentType PF_SWIFT_UNAVAILABLE; + +/** + Creates a file with given data, name and content type. + + @param name The name of the new `PFFile`. The file name must begin with and alphanumeric character, + and consist of alphanumeric characters, periods, spaces, underscores, or dashes. + @param data The contents of the new `PFFile`. + @param contentType Represents MIME type of the data. + @param error On input, a pointer to an error object. + If an error occurs, this pointer is set to an actual error object containing the error information. + You may specify `nil` for this parameter if you do not want the error information. + + @return A new `PFFile` instance or `nil` if the error occured. + */ ++ (nullable instancetype)fileWithName:(nullable NSString *)name + data:(NSData *)data + contentType:(nullable NSString *)contentType + error:(NSError **)error; + +/** + Creates a file with given data and content type. + + @param data The contents of the new `PFFile`. + @param contentType Represents MIME type of the data. + + @return A new `PFFile` object. + */ ++ (instancetype)fileWithData:(NSData *)data contentType:(nullable NSString *)contentType; + +///-------------------------------------- +/// @name File Properties +///-------------------------------------- + +/** + The name of the file. + + Before the file is saved, this is the filename given by + the user. After the file is saved, that name gets prefixed with a unique + identifier. + */ +@property (nonatomic, copy, readonly) NSString *name; + +/** + The url of the file. + */ +@property (nullable, nonatomic, copy, readonly) NSString *url; + +/** + Whether the file has been uploaded for the first time. + */ +@property (nonatomic, assign, readonly, getter=isDirty) BOOL dirty; + +///-------------------------------------- +/// @name Storing Data with Parse +///-------------------------------------- + +/** + Saves the file *synchronously*. + + @return Returns whether the save succeeded. + */ +- (BOOL)save PF_SWIFT_UNAVAILABLE; + +/** + Saves the file *synchronously* and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the save succeeded. + */ +- (BOOL)save:(NSError **)error; + +/** + Saves the file *asynchronously*. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)saveInBackground; + +/** + Saves the file *asynchronously* + + @param progressBlock The block should have the following argument signature: `^(int percentDone)` + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)saveInBackgroundWithProgressBlock:(nullable PFProgressBlock)progressBlock; + +/** + Saves the file *asynchronously* and executes the given block. + + @param block The block should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)saveInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/** + Saves the file *asynchronously* and executes the given block. + + This method will execute the progressBlock periodically with the percent progress. + `progressBlock` will get called with `100` before `resultBlock` is called. + + @param block The block should have the following argument signature: `^(BOOL succeeded, NSError *error)` + @param progressBlock The block should have the following argument signature: `^(int percentDone)` + */ +- (void)saveInBackgroundWithBlock:(nullable PFBooleanResultBlock)block + progressBlock:(nullable PFProgressBlock)progressBlock; + +/* + Saves the file *asynchronously* and calls the given callback. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ +- (void)saveInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Getting Data from Parse +///-------------------------------------- + +/** + Whether the data is available in memory or needs to be downloaded. + */ +@property (nonatomic, assign, readonly, getter=isDataAvailable) BOOL dataAvailable; + +/** + *Synchronously* gets the data from cache if available or fetches its contents from the network. + + @return The `NSData` object containing file data. Returns `nil` if there was an error in fetching. + */ +- (nullable NSData *)getData PF_SWIFT_UNAVAILABLE; + +/** + This method is like `-getData` but avoids ever holding the entire `PFFile` contents in memory at once. + + This can help applications with many large files avoid memory warnings. + + @return A stream containing the data. Returns `nil` if there was an error in fetching. + */ +- (nullable NSInputStream *)getDataStream PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* gets the data from cache if available or fetches its contents from the network. + Sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return The `NSData` object containing file data. Returns `nil` if there was an error in fetching. + */ +- (nullable NSData *)getData:(NSError **)error; + +/** + This method is like `-getData` but avoids ever holding the entire `PFFile` contents in memory at once. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return A stream containing the data. Returns nil if there was an error in + fetching. + */ +- (nullable NSInputStream *)getDataStream:(NSError **)error; + +/** + This method is like `-getData` but it fetches asynchronously to avoid blocking the current thread. + + @see getData + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSData *)*)getDataInBackground; + +/** + This method is like `-getData` but it fetches asynchronously to avoid blocking the current thread. + + This can help applications with many large files avoid memory warnings. + + @see getData + + @param progressBlock The block should have the following argument signature: ^(int percentDone) + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSData *)*)getDataInBackgroundWithProgressBlock:(nullable PFProgressBlock)progressBlock; + +/** + This method is like `-getDataInBackground` but avoids ever holding the entire `PFFile` contents in memory at once. + + This can help applications with many large files avoid memory warnings. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSInputStream *)*)getDataStreamInBackground; + +/** + This method is like `-getDataStreamInBackground`, but yields a live-updating stream. + + Instead of `-getDataStream`, which yields a stream that can be read from only after the request has + completed, this method gives you a stream directly written to by the HTTP session. As this stream is not pre-buffered, + it is strongly advised to use the `NSStreamDelegate` methods, in combination with a run loop, to consume the data in + the stream, to do proper async file downloading. + + @note You MUST open this stream before reading from it. + @note Do NOT call `waitUntilFinished` on this task from the main thread. It may result in a deadlock. + + @return A task that produces a *live* stream that is being written to with the data from the server. + */ +- (BFTask PF_GENERIC(NSInputStream *)*)getDataDownloadStreamInBackground; + +/** + This method is like `-getDataInBackground` but avoids + ever holding the entire `PFFile` contents in memory at once. + + This can help applications with many large files avoid memory warnings. + @param progressBlock The block should have the following argument signature: ^(int percentDone) + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSInputStream *)*)getDataStreamInBackgroundWithProgressBlock:(nullable PFProgressBlock)progressBlock; + +/** + This method is like `-getDataStreamInBackgroundWithProgressBlock:`, but yields a live-updating stream. + + Instead of `-getDataStream`, which yields a stream that can be read from only after the request has + completed, this method gives you a stream directly written to by the HTTP session. As this stream is not pre-buffered, + it is strongly advised to use the `NSStreamDelegate` methods, in combination with a run loop, to consume the data in + the stream, to do proper async file downloading. + + @note You MUST open this stream before reading from it. + @note Do NOT call `waitUntilFinished` on this task from the main thread. It may result in a deadlock. + + @param progressBlock The block should have the following argument signature: `^(int percentDone)` + + @return A task that produces a *live* stream that is being written to with the data from the server. + */ +- (BFTask PF_GENERIC(NSInputStream *)*)getDataDownloadStreamInBackgroundWithProgressBlock:(nullable PFProgressBlock)progressBlock; + +/** + *Asynchronously* gets the data from cache if available or fetches its contents from the network. + + @param block The block should have the following argument signature: `^(NSData *result, NSError *error)` + */ +- (void)getDataInBackgroundWithBlock:(nullable PFDataResultBlock)block; + +/** + This method is like `-getDataInBackgroundWithBlock:` but avoids ever holding the entire `PFFile` contents in memory at once. + + This can help applications with many large files avoid memory warnings. + + @param block The block should have the following argument signature: `(NSInputStream *result, NSError *error)` + */ +- (void)getDataStreamInBackgroundWithBlock:(nullable PFDataStreamResultBlock)block; + +/** + *Asynchronously* gets the data from cache if available or fetches its contents from the network. + + This method will execute the progressBlock periodically with the percent progress. + `progressBlock` will get called with `100` before `resultBlock` is called. + + @param resultBlock The block should have the following argument signature: ^(NSData *result, NSError *error) + @param progressBlock The block should have the following argument signature: ^(int percentDone) + */ +- (void)getDataInBackgroundWithBlock:(nullable PFDataResultBlock)resultBlock + progressBlock:(nullable PFProgressBlock)progressBlock; + +/** + This method is like `-getDataInBackgroundWithBlock:progressBlock:` but avoids + ever holding the entire `PFFile` contents in memory at once. + + This can help applications with many large files avoid memory warnings. + + @param resultBlock The block should have the following argument signature: `^(NSInputStream *result, NSError *error)`. + @param progressBlock The block should have the following argument signature: `^(int percentDone)`. + */ +- (void)getDataStreamInBackgroundWithBlock:(nullable PFDataStreamResultBlock)resultBlock + progressBlock:(nullable PFProgressBlock)progressBlock; + +/* + *Asynchronously* gets the data from cache if available or fetches its contents from the network. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSData *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + */ +- (void)getDataInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +/** + *Asynchronously* gets the file path for file from cache if available or fetches its contents from the network. + + @note The file path may change between versions of SDK. + @note If you overwrite the contents of the file at returned path it will persist those change + until the file cache is cleared. + + @return The task, with the result set to `NSString` representation of a file path. + */ +- (BFTask PF_GENERIC(NSString *)*)getFilePathInBackground; + +/** + *Asynchronously* gets the file path for file from cache if available or fetches its contents from the network. + + @note The file path may change between versions of SDK. + @note If you overwrite the contents of the file at returned path it will persist those change + until the file cache is cleared. + + @param progressBlock The block should have the following argument signature: `^(int percentDone)`. + + @return The task, with the result set to `NSString` representation of a file path. + */ +- (BFTask PF_GENERIC(NSString *)*)getFilePathInBackgroundWithProgressBlock:(nullable PFProgressBlock)progressBlock; + +/** + *Asynchronously* gets the file path for file from cache if available or fetches its contents from the network. + + @note The file path may change between versions of SDK. + @note If you overwrite the contents of the file at returned path it will persist those change + until the file cache is cleared. + + @param block The block should have the following argument signature: `^(NSString *filePath, NSError *error)`. + */ +- (void)getFilePathInBackgroundWithBlock:(nullable PFFilePathResultBlock)block; + +/** + *Asynchronously* gets the file path for file from cache if available or fetches its contents from the network. + + @note The file path may change between versions of SDK. + @note If you overwrite the contents of the file at returned path it will persist those change + until the file cache is cleared. + + @param block The block should have the following argument signature: `^(NSString *filePath, NSError *error)`. + @param progressBlock The block should have the following argument signature: `^(int percentDone)`. + */ +- (void)getFilePathInBackgroundWithBlock:(nullable PFFilePathResultBlock)block + progressBlock:(nullable PFProgressBlock)progressBlock; + +///-------------------------------------- +/// @name Interrupting a Transfer +///-------------------------------------- + +/** + Cancels the current request (upload or download of file). + */ +- (void)cancel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFGeoPoint.h b/Parse.framework/Headers/PFGeoPoint.h new file mode 100644 index 0000000..a3b9663 --- /dev/null +++ b/Parse.framework/Headers/PFGeoPoint.h @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PFGeoPoint; + +typedef void(^PFGeoPointResultBlock)(PFGeoPoint *__nullable geoPoint, NSError *__nullable error); + +/** + `PFGeoPoint` may be used to embed a latitude / longitude point as the value for a key in a `PFObject`. + It could be used to perform queries in a geospatial manner using `PFQuery.-whereKey:nearGeoPoint:`. + + Currently, instances of `PFObject` may only have one key associated with a `PFGeoPoint` type. + */ +@interface PFGeoPoint : NSObject + +///-------------------------------------- +/// @name Creating a Geo Point +///-------------------------------------- + +/** + Create a PFGeoPoint object. Latitude and longitude are set to `0.0`. + + @return Returns a new `PFGeoPoint`. + */ ++ (instancetype)geoPoint; + +/** + Creates a new `PFGeoPoint` object for the given `CLLocation`, set to the location's coordinates. + + @param location Instace of `CLLocation`, with set latitude and longitude. + + @return Returns a new PFGeoPoint at specified location. + */ ++ (instancetype)geoPointWithLocation:(nullable CLLocation *)location; + +/** + Create a new `PFGeoPoint` object with the specified latitude and longitude. + + @param latitude Latitude of point in degrees. + @param longitude Longitude of point in degrees. + + @return New point object with specified latitude and longitude. + */ ++ (instancetype)geoPointWithLatitude:(double)latitude longitude:(double)longitude; + +/** + Fetches the current device location and executes a block with a new `PFGeoPoint` object. + + @param resultBlock A block which takes the newly created `PFGeoPoint` as an argument. + It should have the following argument signature: `^(PFGeoPoint *geoPoint, NSError *error)` + */ ++ (void)geoPointForCurrentLocationInBackground:(nullable PFGeoPointResultBlock)resultBlock; + +///-------------------------------------- +/// @name Controlling Position +///-------------------------------------- + +/** + Latitude of point in degrees. Valid range is from `-90.0` to `90.0`. + */ +@property (nonatomic, assign) double latitude; + +/** + Longitude of point in degrees. Valid range is from `-180.0` to `180.0`. + */ +@property (nonatomic, assign) double longitude; + +///-------------------------------------- +/// @name Calculating Distance +///-------------------------------------- + +/** + Get distance in radians from this point to specified point. + + @param point `PFGeoPoint` that represents the location of other point. + + @return Distance in radians between the receiver and `point`. + */ +- (double)distanceInRadiansTo:(nullable PFGeoPoint *)point; + +/** + Get distance in miles from this point to specified point. + + @param point `PFGeoPoint` that represents the location of other point. + + @return Distance in miles between the receiver and `point`. + */ +- (double)distanceInMilesTo:(nullable PFGeoPoint *)point; + +/** + Get distance in kilometers from this point to specified point. + + @param point `PFGeoPoint` that represents the location of other point. + + @return Distance in kilometers between the receiver and `point`. + */ +- (double)distanceInKilometersTo:(nullable PFGeoPoint *)point; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFInstallation.h b/Parse.framework/Headers/PFInstallation.h new file mode 100644 index 0000000..7a8e9f7 --- /dev/null +++ b/Parse.framework/Headers/PFInstallation.h @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import +#import + +PF_TV_UNAVAILABLE_WARNING +PF_WATCH_UNAVAILABLE_WARNING + +NS_ASSUME_NONNULL_BEGIN + +/** + A Parse Framework Installation Object that is a local representation of an + installation persisted to the Parse cloud. This class is a subclass of a + `PFObject`, and retains the same functionality of a PFObject, but also extends + it with installation-specific fields and related immutability and validity + checks. + + A valid `PFInstallation` can only be instantiated via + `+currentInstallation` because the required identifier fields + are readonly. The `timeZone` and `badge` fields are also readonly properties which + are automatically updated to match the device's time zone and application badge + when the `PFInstallation` is saved, thus these fields might not reflect the + latest device state if the installation has not recently been saved. + + `PFInstallation` objects which have a valid `deviceToken` and are saved to + the Parse cloud can be used to target push notifications. + */ + +PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFInstallation : PFObject + +///-------------------------------------- +/// @name Accessing the Current Installation +///-------------------------------------- + +/** + Gets the currently-running installation from disk and returns an instance of it. + + If this installation is not stored on disk, returns a `PFInstallation` + with `deviceType` and `installationId` fields set to those of the + current installation. + + @result Returns a `PFInstallation` that represents the currently-running installation. + */ ++ (instancetype)currentInstallation; + +///-------------------------------------- +/// @name Installation Properties +///-------------------------------------- + +/** + The device type for the `PFInstallation`. + */ +@property (nonatomic, copy, readonly) NSString *deviceType; + +/** + The installationId for the `PFInstallation`. + */ +@property (nonatomic, copy, readonly) NSString *installationId; + +/** + The device token for the `PFInstallation`. + */ +@property (nullable, nonatomic, copy) NSString *deviceToken; + +/** + The badge for the `PFInstallation`. + */ +@property (nonatomic, assign) NSInteger badge; + +/** + The name of the time zone for the `PFInstallation`. + */ +@property (nullable, nonatomic, copy, readonly) NSString *timeZone; + +/** + The channels for the `PFInstallation`. + */ +@property (nullable, nonatomic, copy) NSArray PF_GENERIC(NSString *)*channels; + +/** + Sets the device token string property from an `NSData`-encoded token. + + @param deviceTokenData A token that identifies the device. + */ +- (void)setDeviceTokenFromData:(nullable NSData *)deviceTokenData; + +///-------------------------------------- +/// @name Querying for Installations +///-------------------------------------- + +/** + Creates a `PFQuery` for `PFInstallation` objects. + + Only the following types of queries are allowed for installations: + + - `[query getObjectWithId:]` + - `[query whereKey:@"installationId" equalTo:]` + - `[query whereKey:@"installationId" matchesKey: inQuery:]` + + You can add additional query conditions, but one of the above must appear as a top-level `AND` clause in the query. + */ ++ (nullable PFQuery *)query; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFNetworkActivityIndicatorManager.h b/Parse.framework/Headers/PFNetworkActivityIndicatorManager.h new file mode 100644 index 0000000..24afd3b --- /dev/null +++ b/Parse.framework/Headers/PFNetworkActivityIndicatorManager.h @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +#import + +#import + +PF_OSX_UNAVAILABLE_WARNING +PF_TV_UNAVAILABLE_WARNING +PF_WATCH_UNAVAILABLE_WARNING + +NS_ASSUME_NONNULL_BEGIN + +/** + `PFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. + When enabled, it will start managing the network activity indicator in the status bar, + according to the network operations that are performed by Parse SDK. + + The number of active requests is incremented or decremented like a stack or a semaphore, + the activity indicator will animate, as long as the number is greater than zero. + */ +PF_OSX_UNAVAILABLE PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFNetworkActivityIndicatorManager : NSObject + +/** + A Boolean value indicating whether the manager is enabled. + If `YES` - the manager will start managing the status bar network activity indicator, + according to the network operations that are performed by Parse SDK. + The default value is `YES`. + */ +@property (nonatomic, assign, getter = isEnabled) BOOL enabled; + +/** + A Boolean value indicating whether the network activity indicator is currently displayed in the status bar. + */ +@property (nonatomic, assign, readonly, getter = isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; + +/** + The value that indicates current network activities count. + */ +@property (nonatomic, assign, readonly) NSUInteger networkActivityCount; + +/** + Returns the shared network activity indicator manager object for the system. + + @return The systemwide network activity indicator manager. + */ ++ (PFNetworkActivityIndicatorManager *)sharedManager; + +/** + Increments the number of active network requests. + + If this number was zero before incrementing, + this will start animating network activity indicator in the status bar. + */ +- (void)incrementActivityCount; + +/** + Decrements the number of active network requests. + + If this number becomes zero after decrementing, + this will stop animating network activity indicator in the status bar. + */ +- (void)decrementActivityCount; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFObject+Subclass.h b/Parse.framework/Headers/PFObject+Subclass.h new file mode 100644 index 0000000..a5106e5 --- /dev/null +++ b/Parse.framework/Headers/PFObject+Subclass.h @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +@class PFQuery PF_GENERIC(PFGenericObject : PFObject *); + +NS_ASSUME_NONNULL_BEGIN + +/** + ### Subclassing Notes + + Developers can subclass `PFObject` for a more native object-oriented class structure. + Strongly-typed subclasses of `PFObject` must conform to the `PFSubclassing` protocol + and must call `PFSubclassing.+registerSubclass` before `Parse.+setApplicationId:clientKey:` is called. + After this it will be returned by `PFQuery` and other `PFObject` factories. + + All methods in `PFSubclassing` except for `PFSubclassing.+parseClassName` + are already implemented in the `PFObject(Subclass)` category. + + Including `PFObject+Subclass.h` in your implementation file provides these implementations automatically. + + Subclasses support simpler initializers, query syntax, and dynamic synthesizers. + The following shows an example subclass: + + \@interface MYGame : PFObject + + // Accessing this property is the same as objectForKey:@"title" + @property (nonatomic, copy) NSString *title; + + + (NSString *)parseClassName; + + @end + + + @implementation MYGame + + @dynamic title; + + + (NSString *)parseClassName { + return @"Game"; + } + + @end + + + MYGame *game = [[MYGame alloc] init]; + game.title = @"Bughouse"; + [game saveInBackground]; + */ +@interface PFObject (Subclass) + +///-------------------------------------- +/// @name Methods for Subclasses +///-------------------------------------- + +/** + Creates an instance of the registered subclass with this class's `PFSubclassing.+parseClassName`. + + This helps a subclass ensure that it can be subclassed itself. + For example, `[PFUser object]` will return a `MyUser` object if `MyUser` is a registered subclass of `PFUser`. + For this reason, `[MyClass object]` is preferred to `[[MyClass alloc] init]`. + This method can only be called on subclasses which conform to `PFSubclassing`. + A default implementation is provided by `PFObject` which should always be sufficient. + */ ++ (instancetype)object; + +/** + Creates a reference to an existing `PFObject` for use in creating associations between `PFObjects`. + + Calling `dataAvailable` on this object will return `NO` until `-fetchIfNeeded` or `-fetch` has been called. + This method can only be called on subclasses which conform to `PFSubclassing`. + A default implementation is provided by `PFObject` which should always be sufficient. + No network request will be made. + + @param objectId The object id for the referenced object. + + @return An instance of `PFObject` without data. + */ ++ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId; + +/** + Registers an Objective-C class for Parse to use for representing a given Parse class. + + Once this is called on a `PFObject` subclass, any `PFObject` Parse creates with a class name + that matches `[self parseClassName]` will be an instance of subclass. + This method can only be called on subclasses which conform to `PFSubclassing`. + A default implementation is provided by `PFObject` which should always be sufficient. + */ ++ (void)registerSubclass; + +/** + Returns a query for objects of type `PFSubclassing.+parseClassName`. + + This method can only be called on subclasses which conform to `PFSubclassing`. + A default implementation is provided by `PFObject` which should always be sufficient. + + @see `PFQuery` + */ ++ (nullable PFQuery *)query; + +/** + Returns a query for objects of type `PFSubclassing.+parseClassName` with a given predicate. + + A default implementation is provided by `PFObject` which should always be sufficient. + @warning This method can only be called on subclasses which conform to `PFSubclassing`. + + @param predicate The predicate to create conditions from. + + @return An instance of `PFQuery`. + + @see `PFQuery.+queryWithClassName:predicate:` + */ ++ (nullable PFQuery *)queryWithPredicate:(nullable NSPredicate *)predicate; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFObject.h b/Parse.framework/Headers/PFObject.h new file mode 100644 index 0000000..532cfe4 --- /dev/null +++ b/Parse.framework/Headers/PFObject.h @@ -0,0 +1,1420 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol PFSubclassing; +@class PFRelation; + +/** + The name of the default pin that for PFObject local data store. + */ +extern NSString *const PFObjectDefaultPin; + +/** + The `PFObject` class is a local representation of data persisted to the Parse cloud. + This is the main class that is used to interact with objects in your app. + */ +NS_REQUIRES_PROPERTY_DEFINITIONS +@interface PFObject : NSObject + +///-------------------------------------- +/// @name Creating a PFObject +///-------------------------------------- + +/** + Initializes a new empty `PFObject` instance with a class name. + + @param newClassName A class name can be any alphanumeric string that begins with a letter. + It represents an object in your app, like a 'User' or a 'Document'. + + @return Returns the object that is instantiated with the given class name. + */ +- (instancetype)initWithClassName:(NSString *)newClassName; + +/** + Creates a new PFObject with a class name. + + @param className A class name can be any alphanumeric string that begins with a letter. + It represents an object in your app, like a 'User' or a 'Document'. + + @return Returns the object that is instantiated with the given class name. + */ ++ (instancetype)objectWithClassName:(NSString *)className; + +/** + Creates a new `PFObject` with a class name, initialized with data + constructed from the specified set of objects and keys. + + @param className The object's class. + @param dictionary An `NSDictionary` of keys and objects to set on the new `PFObject`. + + @return A PFObject with the given class name and set with the given data. + */ ++ (instancetype)objectWithClassName:(NSString *)className dictionary:(nullable NSDictionary PF_GENERIC(NSString *, id)*)dictionary; + +/** + Creates a reference to an existing PFObject for use in creating associations between PFObjects. + + Calling `dataAvailable` on this object will return `NO` until `-fetchIfNeeded` has been called. + No network request will be made. + + @param className The object's class. + @param objectId The object id for the referenced object. + + @return A `PFObject` instance without data. + */ ++ (instancetype)objectWithoutDataWithClassName:(NSString *)className objectId:(nullable NSString *)objectId; + +///-------------------------------------- +/// @name Managing Object Properties +///-------------------------------------- + +/** + The class name of the object. + */ +@property (nonatomic, strong, readonly) NSString *parseClassName; + +/** + The id of the object. + */ +@property (nullable, nonatomic, strong) NSString *objectId; + +/** + When the object was last updated. + */ +@property (nullable, nonatomic, strong, readonly) NSDate *updatedAt; + +/** + When the object was created. + */ +@property (nullable, nonatomic, strong, readonly) NSDate *createdAt; + +/** + The ACL for this object. + */ +@property (nullable, nonatomic, strong) PFACL *ACL; + +/** + Returns an array of the keys contained in this object. + + This does not include `createdAt`, `updatedAt`, `authData`, or `objectId`. + It does include things like username and ACL. + */ +@property (nonatomic, copy, readonly) NSArray PF_GENERIC(NSString *)*allKeys; + +///-------------------------------------- +/// @name Accessors +///-------------------------------------- + +/** + Returns the value associated with a given key. + + @param key The key for which to return the corresponding value. + + @see -objectForKeyedSubscript: + */ +- (nullable id)objectForKey:(NSString *)key; + +/** + Sets the object associated with a given key. + + @param object The object for `key`. A strong reference to the object is maintained by PFObject. + Raises an `NSInvalidArgumentException` if `object` is `nil`. + If you need to represent a `nil` value - use `NSNull`. + @param key The key for `object`. + Raises an `NSInvalidArgumentException` if `key` is `nil`. + + @see -setObject:forKeyedSubscript: + */ +- (void)setObject:(id)object forKey:(NSString *)key; + +/** + Unsets a key on the object. + + @param key The key. + */ +- (void)removeObjectForKey:(NSString *)key; + +/** + Returns the value associated with a given key. + + This method enables usage of literal syntax on `PFObject`. + E.g. `NSString *value = object[@"key"];` + + @param key The key for which to return the corresponding value. + + @see -objectForKey: + */ +- (nullable id)objectForKeyedSubscript:(NSString *)key; + +/** + Returns the value associated with a given key. + + This method enables usage of literal syntax on `PFObject`. + E.g. `object[@"key"] = @"value";` + + @param object The object for `key`. A strong reference to the object is maintained by PFObject. + Raises an `NSInvalidArgumentException` if `object` is `nil`. + If you need to represent a `nil` value - use `NSNull`. + @param key The key for `object`. + Raises an `NSInvalidArgumentException` if `key` is `nil`. + + @see -setObject:forKey: + */ +- (void)setObject:(id)object forKeyedSubscript:(NSString *)key; + +/** + Returns the instance of `PFRelation` class associated with the given key. + + @param key The key that the relation is associated with. + */ +- (PFRelation *)relationForKey:(NSString *)key; + +/** + Returns the instance of `PFRelation` class associated with the given key. + + @param key The key that the relation is associated with. + + @deprecated Please use `PFObject.-relationForKey:` instead. + */ +- (PFRelation *)relationforKey:(NSString *)key PARSE_DEPRECATED("Please use -relationForKey: instead."); + +/** + Clears any changes to this object made since the last call to save and sets it back to the server state. + */ +- (void)revert; + +/** + Clears any changes to this object's key that were done after last successful save and sets it back to the + server state. + + @param key The key to revert changes for. + */ +- (void)revertObjectForKey:(NSString *)key; + +///-------------------------------------- +/// @name Array Accessors +///-------------------------------------- + +/** + Adds an object to the end of the array associated with a given key. + + @param object The object to add. + @param key The key. + */ +- (void)addObject:(id)object forKey:(NSString *)key; + +/** + Adds the objects contained in another array to the end of the array associated with a given key. + + @param objects The array of objects to add. + @param key The key. + */ +- (void)addObjectsFromArray:(NSArray *)objects forKey:(NSString *)key; + +/** + Adds an object to the array associated with a given key, only if it is not already present in the array. + + The position of the insert is not guaranteed. + + @param object The object to add. + @param key The key. + */ +- (void)addUniqueObject:(id)object forKey:(NSString *)key; + +/** + Adds the objects contained in another array to the array associated with a given key, + only adding elements which are not already present in the array. + + @dicsussion The position of the insert is not guaranteed. + + @param objects The array of objects to add. + @param key The key. + */ +- (void)addUniqueObjectsFromArray:(NSArray *)objects forKey:(NSString *)key; + +/** + Removes all occurrences of an object from the array associated with a given key. + + @param object The object to remove. + @param key The key. + */ +- (void)removeObject:(id)object forKey:(NSString *)key; + +/** + Removes all occurrences of the objects contained in another array from the array associated with a given key. + + @param objects The array of objects to remove. + @param key The key. + */ +- (void)removeObjectsInArray:(NSArray *)objects forKey:(NSString *)key; + +///-------------------------------------- +/// @name Increment +///-------------------------------------- + +/** + Increments the given key by `1`. + + @param key The key. + */ +- (void)incrementKey:(NSString *)key; + +/** + Increments the given key by a number. + + @param key The key. + @param amount The amount to increment. + */ +- (void)incrementKey:(NSString *)key byAmount:(NSNumber *)amount; + +///-------------------------------------- +/// @name Saving Objects +///-------------------------------------- + +/** + *Synchronously* saves the `PFObject`. + + @return Returns whether the save succeeded. + */ +- (BOOL)save PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* saves the `PFObject` and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the save succeeded. + */ +- (BOOL)save:(NSError **)error; + +/** + Saves the `PFObject` *asynchronously*. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)saveInBackground; + +/** + Saves the `PFObject` *asynchronously* and executes the given callback block. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)saveInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/* + Saves the `PFObject` asynchronously and calls the given callback. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ +- (void)saveInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +/** + Saves this object to the server at some unspecified time in the future, + even if Parse is currently inaccessible. + + Use this when you may not have a solid network connection, and don't need to know when the save completes. + If there is some problem with the object such that it can't be saved, it will be silently discarded. If the save + completes successfully while the object is still in memory, then callback will be called. + + Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse. + They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is + available. Objects saved this way will persist even after the app is closed, in which case they will be sent the + next time the app is opened. If more than 10MB of data is waiting to be sent, subsequent calls to `-saveEventually` + will cause old saves to be silently discarded until the connection can be re-established, and the queued objects + can be saved. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)saveEventually PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE; + +/** + Saves this object to the server at some unspecified time in the future, + even if Parse is currently inaccessible. + + Use this when you may not have a solid network connection, and don't need to know when the save completes. + If there is some problem with the object such that it can't be saved, it will be silently discarded. If the save + completes successfully while the object is still in memory, then callback will be called. + + Objects saved with this method will be stored locally in an on-disk cache until they can be delivered to Parse. + They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection is + available. Objects saved this way will persist even after the app is closed, in which case they will be sent the + next time the app is opened. If more than 10MB of data is waiting to be sent, subsequent calls to `-saveEventually:` + will cause old saves to be silently discarded until the connection can be re-established, and the queued objects + can be saved. + + @param callback The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)saveEventually:(nullable PFBooleanResultBlock)callback PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE; + +///-------------------------------------- +/// @name Saving Many Objects +///-------------------------------------- + +/** + Saves a collection of objects *synchronously all at once. + + @param objects The array of objects to save. + + @return Returns whether the save succeeded. + */ ++ (BOOL)saveAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + Saves a collection of objects *synchronously* all at once and sets an error if necessary. + + @param objects The array of objects to save. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the save succeeded. + */ ++ (BOOL)saveAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error; + +/** + Saves a collection of objects all at once *asynchronously*. + + @param objects The array of objects to save. + + @return The task that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)saveAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + Saves a collection of objects all at once `asynchronously` and executes the block when done. + + @param objects The array of objects to save. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)saveAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + block:(nullable PFBooleanResultBlock)block; + +/* + Saves a collection of objects all at once *asynchronously* and calls a callback when done. + + @param objects The array of objects to save. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)number error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)saveAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + target:(nullable id)target + selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Deleting Many Objects +///-------------------------------------- + +/** + *Synchronously* deletes a collection of objects all at once. + + @param objects The array of objects to delete. + + @return Returns whether the delete succeeded. + */ ++ (BOOL)deleteAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* deletes a collection of objects all at once and sets an error if necessary. + + @param objects The array of objects to delete. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the delete succeeded. + */ ++ (BOOL)deleteAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error; + +/** + Deletes a collection of objects all at once asynchronously. + @param objects The array of objects to delete. + @return The task that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)deleteAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + Deletes a collection of objects all at once *asynchronously* and executes the block when done. + + @param objects The array of objects to delete. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)deleteAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + block:(nullable PFBooleanResultBlock)block; + +/* + Deletes a collection of objects all at once *asynchronously* and calls a callback when done. + + @param objects The array of objects to delete. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)number error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)deleteAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + target:(nullable id)target + selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Getting an Object +///-------------------------------------- + +/** + Gets whether the `PFObject` has been fetched. + + @return `YES` if the PFObject is new or has been fetched or refreshed, otherwise `NO`. + */ +@property (nonatomic, assign, readonly, getter=isDataAvailable) BOOL dataAvailable; + +#if PARSE_IOS_ONLY + +/** + Refreshes the PFObject with the current data from the server. + + @deprecated Please use `-fetch` instead. + */ +- (nullable instancetype)refresh PF_SWIFT_UNAVAILABLE PARSE_DEPRECATED("Please use `-fetch` instead."); + +/** + *Synchronously* refreshes the `PFObject` with the current data from the server and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @deprecated Please use `-fetch:` instead. + */ +- (nullable instancetype)refresh:(NSError **)error PARSE_DEPRECATED("Please use `-fetch:` instead."); + +/** + *Asynchronously* refreshes the `PFObject` and executes the given callback block. + + @param block The block to execute. + The block should have the following argument signature: `^(PFObject *object, NSError *error)` + + @deprecated Please use `-fetchInBackgroundWithBlock:` instead. + */ +- (void)refreshInBackgroundWithBlock:(nullable PFObjectResultBlock)block PARSE_DEPRECATED("Please use `-fetchInBackgroundWithBlock:` instead."); + +/* + *Asynchronously* refreshes the `PFObject` and calls the given callback. + + @param target The target on which the selector will be called. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(PFObject *)refreshedObject error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `refreshedObject` will be the `PFObject` with the refreshed data. + + @deprecated Please use `fetchInBackgroundWithTarget:selector:` instead. + */ +- (void)refreshInBackgroundWithTarget:(nullable id)target + selector:(nullable SEL)selector PARSE_DEPRECATED("Please use `fetchInBackgroundWithTarget:selector:` instead."); + +#endif + +/** + *Synchronously* fetches the PFObject with the current data from the server. + */ +- (nullable instancetype)fetch PF_SWIFT_UNAVAILABLE; +/** + *Synchronously* fetches the PFObject with the current data from the server and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + */ +- (nullable instancetype)fetch:(NSError **)error; + +/** + *Synchronously* fetches the `PFObject` data from the server if `dataAvailable` is `NO`. + */ +- (nullable instancetype)fetchIfNeeded PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* fetches the `PFObject` data from the server if `dataAvailable` is `NO`. + + @param error Pointer to an `NSError` that will be set if necessary. + */ +- (nullable instancetype)fetchIfNeeded:(NSError **)error; + +/** + Fetches the `PFObject` *asynchronously* and sets it as a result for the task. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(__kindof PFObject *)*)fetchInBackground; + +/** + Fetches the `PFObject` *asynchronously* and executes the given callback block. + + @param block The block to execute. + It should have the following argument signature: `^(PFObject *object, NSError *error)`. + */ +- (void)fetchInBackgroundWithBlock:(nullable PFObjectResultBlock)block; + +/* + Fetches the `PFObject *asynchronously* and calls the given callback. + + @param target The target on which the selector will be called. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(PFObject *)refreshedObject error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `refreshedObject` will be the `PFObject` with the refreshed data. + */ +- (void)fetchInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +/** + Fetches the `PFObject` data *asynchronously* if `dataAvailable` is `NO`, + then sets it as a result for the task. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(__kindof PFObject *)*)fetchIfNeededInBackground; + +/** + Fetches the `PFObject` data *asynchronously* if `dataAvailable` is `NO`, then calls the callback block. + + @param block The block to execute. + It should have the following argument signature: `^(PFObject *object, NSError *error)`. + */ +- (void)fetchIfNeededInBackgroundWithBlock:(nullable PFObjectResultBlock)block; + +/* + Fetches the PFObject's data asynchronously if `dataAvailable` is `NO`, then calls the callback. + + @param target The target on which the selector will be called. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(PFObject *)fetchedObject error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `refreshedObject` will be the `PFObject` with the refreshed data. + */ +- (void)fetchIfNeededInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Getting Many Objects +///-------------------------------------- + +/** + *Synchronously* fetches all of the `PFObject` objects with the current data from the server. + + @param objects The list of objects to fetch. + */ ++ (nullable NSArray PF_GENERIC(__kindof PFObject *)*)fetchAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* fetches all of the `PFObject` objects with the current data from the server + and sets an error if it occurs. + + @param objects The list of objects to fetch. + @param error Pointer to an `NSError` that will be set if necessary. + */ ++ (nullable NSArray PF_GENERIC(__kindof PFObject *)*)fetchAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects + error:(NSError **)error; + +/** + *Synchronously* fetches all of the `PFObject` objects with the current data from the server. + @param objects The list of objects to fetch. + */ ++ (nullable NSArray PF_GENERIC(__kindof PFObject *)*)fetchAllIfNeeded:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* fetches all of the `PFObject` objects with the current data from the server + and sets an error if it occurs. + + @param objects The list of objects to fetch. + @param error Pointer to an `NSError` that will be set if necessary. + */ ++ (nullable NSArray PF_GENERIC(__kindof PFObject *)*)fetchAllIfNeeded:(nullable NSArray PF_GENERIC(PFObject *)*)objects + error:(NSError **)error; + +/** + Fetches all of the `PFObject` objects with the current data from the server *asynchronously*. + + @param objects The list of objects to fetch. + + @return The task that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSArray<__kindof PFObject *> *)*)fetchAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + Fetches all of the `PFObject` objects with the current data from the server *asynchronously* + and calls the given block. + + @param objects The list of objects to fetch. + @param block The block to execute. + It should have the following argument signature: `^(NSArray *objects, NSError *error)`. + */ ++ (void)fetchAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + block:(nullable PFArrayResultBlock)block; + +/* + Fetches all of the `PFObject` objects with the current data from the server *asynchronously* + and calls the given callback. + + @param objects The list of objects to fetch. + @param target The target on which the selector will be called. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `fetchedObjects` will the array of `PFObject` objects that were fetched. + */ ++ (void)fetchAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + target:(nullable id)target + selector:(nullable SEL)selector; + +/** + Fetches all of the `PFObject` objects with the current data from the server *asynchronously*. + + @param objects The list of objects to fetch. + + @return The task that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSArray<__kindof PFObject *> *)*)fetchAllIfNeededInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + Fetches all of the PFObjects with the current data from the server *asynchronously* + and calls the given block. + + @param objects The list of objects to fetch. + @param block The block to execute. + It should have the following argument signature: `^(NSArray *objects, NSError *error)`. + */ ++ (void)fetchAllIfNeededInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + block:(nullable PFArrayResultBlock)block; + +/* + Fetches all of the PFObjects with the current data from the server *asynchronously* + and calls the given callback. + + @param objects The list of objects to fetch. + @param target The target on which the selector will be called. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSArray *)fetchedObjects error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `fetchedObjects` will the array of `PFObject` objects that were fetched. + */ ++ (void)fetchAllIfNeededInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + target:(nullable id)target + selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Fetching From Local Datastore +///-------------------------------------- + +/** + *Synchronously* loads data from the local datastore into this object, + if it has not been fetched from the server already. + */ +- (nullable instancetype)fetchFromLocalDatastore PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* loads data from the local datastore into this object, if it has not been fetched + from the server already. + + If the object is not stored in the local datastore, this `error` will be set to + return `kPFErrorCacheMiss`. + + @param error Pointer to an `NSError` that will be set if necessary. + */ +- (nullable instancetype)fetchFromLocalDatastore:(NSError **)error; + +/** + *Asynchronously* loads data from the local datastore into this object, + if it has not been fetched from the server already. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(__kindof PFObject *)*)fetchFromLocalDatastoreInBackground; + +/** + *Asynchronously* loads data from the local datastore into this object, + if it has not been fetched from the server already. + + @param block The block to execute. + It should have the following argument signature: `^(PFObject *object, NSError *error)`. + */ +- (void)fetchFromLocalDatastoreInBackgroundWithBlock:(nullable PFObjectResultBlock)block; + +///-------------------------------------- +/// @name Deleting an Object +///-------------------------------------- + +/** + *Synchronously* deletes the `PFObject`. + + @return Returns whether the delete succeeded. + */ +- (BOOL)delete PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* deletes the `PFObject` and sets an error if it occurs. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the delete succeeded. + */ +- (BOOL)delete:(NSError **)error; + +/** + Deletes the `PFObject` *asynchronously*. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)deleteInBackground; + +/** + Deletes the `PFObject` *asynchronously* and executes the given callback block. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)deleteInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/* + Deletes the `PFObject` *asynchronously* and calls the given callback. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ +- (void)deleteInBackgroundWithTarget:(nullable id)target + selector:(nullable SEL)selector; + +/** + Deletes this object from the server at some unspecified time in the future, + even if Parse is currently inaccessible. + + Use this when you may not have a solid network connection, + and don't need to know when the delete completes. If there is some problem with the object + such that it can't be deleted, the request will be silently discarded. + + Delete instructions made with this method will be stored locally in an on-disk cache until they can be transmitted + to Parse. They will be sent immediately if possible. Otherwise, they will be sent the next time a network connection + is available. Delete requests will persist even after the app is closed, in which case they will be sent the + next time the app is opened. If more than 10MB of `-saveEventually` or `-deleteEventually` commands are waiting + to be sent, subsequent calls to `-saveEventually` or `-deleteEventually` will cause old requests to be silently discarded + until the connection can be re-established, and the queued requests can go through. + + @return The task that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)deleteEventually PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE; + +///-------------------------------------- +/// @name Dirtiness +///-------------------------------------- + +/** + Gets whether any key-value pair in this object (or its children) + has been added/updated/removed and not saved yet. + + @return Returns whether this object has been altered and not saved yet. + */ +@property (nonatomic, assign, readonly, getter=isDirty) BOOL dirty; + +/** + Get whether a value associated with a key has been added/updated/removed and not saved yet. + + @param key The key to check for + + @return Returns whether this key has been altered and not saved yet. + */ +- (BOOL)isDirtyForKey:(NSString *)key; + +///-------------------------------------- +/// @name Pinning +///-------------------------------------- + +/** + *Synchronously* stores the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @return Returns whether the pin succeeded. + + @see `-unpin:` + @see `PFObjectDefaultPin` + */ +- (BOOL)pin PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* stores the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the pin succeeded. + + @see `-unpin:` + @see `PFObjectDefaultPin` + */ +- (BOOL)pin:(NSError **)error; + +/** + *Synchronously* stores the object and every object it points to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @param name The name of the pin. + + @return Returns whether the pin succeeded. + + @see `-unpinWithName:` + */ +- (BOOL)pinWithName:(NSString *)name PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* stores the object and every object it points to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @param name The name of the pin. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the pin succeeded. + + @see `-unpinWithName:` + */ +- (BOOL)pinWithName:(NSString *)name + error:(NSError **)error; + +/** + *Asynchronously* stores the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @return The task that encapsulates the work being done. + + @see `-unpinInBackground` + @see `PFObjectDefaultPin` + */ +- (BFTask PF_GENERIC(NSNumber *)*)pinInBackground; + +/** + *Asynchronously* stores the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see `-unpinInBackgroundWithBlock:` + @see `PFObjectDefaultPin` + */ +- (void)pinInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* stores the object and every object it points to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore on it. + + @param name The name of the pin. + + @return The task that encapsulates the work being done. + + @see unpinInBackgroundWithName: + */ +- (BFTask PF_GENERIC(NSNumber *)*)pinInBackgroundWithName:(NSString *)name; + +/** + *Asynchronously* stores the object and every object it points to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `-fetchFromLocalDatastore` on it. + + @param name The name of the pin. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see unpinInBackgroundWithName:block: + */ +- (void)pinInBackgroundWithName:(NSString *)name block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Pinning Many Objects +///-------------------------------------- + +/** + *Synchronously* stores the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + + @return Returns whether the pin succeeded. + + @see unpinAll: + @see PFObjectDefaultPin + */ ++ (BOOL)pinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* stores the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the pin succeeded. + + @see unpinAll:error: + @see PFObjectDefaultPin + */ ++ (BOOL)pinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error; + +/** + *Synchronously* stores the objects and every object they point to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param name The name of the pin. + + @return Returns whether the pin succeeded. + + @see unpinAll:withName: + */ ++ (BOOL)pinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* stores the objects and every object they point to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param name The name of the pin. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the pin succeeded. + + @see unpinAll:withName:error: + */ ++ (BOOL)pinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects + withName:(NSString *)name + error:(NSError **)error; + +/** + *Asynchronously* stores the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + + @return The task that encapsulates the work being done. + + @see unpinAllInBackground: + @see PFObjectDefaultPin + */ ++ (BFTask PF_GENERIC(NSNumber *)*)pinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + *Asynchronously* stores the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see unpinAllInBackground:block: + @see PFObjectDefaultPin + */ ++ (void)pinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects block:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* stores the objects and every object they point to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param name The name of the pin. + + @return The task that encapsulates the work being done. + + @see unpinAllInBackground:withName: + */ ++ (BFTask PF_GENERIC(NSNumber *)*)pinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name; + +/** + *Asynchronously* stores the objects and every object they point to in the local datastore, recursively. + + If those other objects have not been fetched from Parse, they will not be stored. However, + if they have changed data, all the changes will be retained. To get the objects back later, you can + use a `PFQuery` that uses `PFQuery.-fromLocalDatastore`, or you can create an unfetched pointer with + `+objectWithoutDataWithClassName:objectId:` and then call `fetchFromLocalDatastore:` on it. + + @param objects The objects to be pinned. + @param name The name of the pin. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see unpinAllInBackground:withName:block: + */ ++ (void)pinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + withName:(NSString *)name + block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Unpinning +///-------------------------------------- + +/** + *Synchronously* removes the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @return Returns whether the unpin succeeded. + + @see pin: + @see PFObjectDefaultPin + */ +- (BOOL)unpin PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + + @see pin: + @see PFObjectDefaultPin + */ +- (BOOL)unpin:(NSError **)error; + +/** + *Synchronously* removes the object and every object it points to in the local datastore, recursively. + + @param name The name of the pin. + + @return Returns whether the unpin succeeded. + + @see pinWithName: + */ +- (BOOL)unpinWithName:(NSString *)name PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes the object and every object it points to in the local datastore, recursively. + + @param name The name of the pin. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + + @see pinWithName:error: + */ +- (BOOL)unpinWithName:(NSString *)name + error:(NSError **)error; + +/** + *Asynchronously* removes the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @return The task that encapsulates the work being done. + + @see pinInBackground + @see PFObjectDefaultPin + */ +- (BFTask PF_GENERIC(NSNumber *)*)unpinInBackground; + +/** + *Asynchronously* removes the object and every object it points to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see pinInBackgroundWithBlock: + @see PFObjectDefaultPin + */ +- (void)unpinInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* removes the object and every object it points to in the local datastore, recursively. + + @param name The name of the pin. + + @return The task that encapsulates the work being done. + + @see pinInBackgroundWithName: + */ +- (BFTask PF_GENERIC(NSNumber *)*)unpinInBackgroundWithName:(NSString *)name; + +/** + *Asynchronously* removes the object and every object it points to in the local datastore, recursively. + + @param name The name of the pin. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see pinInBackgroundWithName:block: + */ +- (void)unpinInBackgroundWithName:(NSString *)name block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Unpinning Many Objects +///-------------------------------------- + +/** + *Synchronously* removes all objects in the local datastore + using a default pin name: `PFObjectDefaultPin`. + + @return Returns whether the unpin succeeded. + + @see PFObjectDefaultPin + */ ++ (BOOL)unpinAllObjects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes all objects in the local datastore + using a default pin name: `PFObjectDefaultPin`. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + + @see PFObjectDefaultPin + */ ++ (BOOL)unpinAllObjects:(NSError **)error; + +/** + *Synchronously* removes all objects with the specified pin name. + + @param name The name of the pin. + + @return Returns whether the unpin succeeded. + */ ++ (BOOL)unpinAllObjectsWithName:(NSString *)name PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes all objects with the specified pin name. + + @param name The name of the pin. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + */ ++ (BOOL)unpinAllObjectsWithName:(NSString *)name + error:(NSError **)error; + +/** + *Asynchronously* removes all objects in the local datastore + using a default pin name: `PFObjectDefaultPin`. + + @return The task that encapsulates the work being done. + + @see PFObjectDefaultPin + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unpinAllObjectsInBackground; + +/** + *Asynchronously* removes all objects in the local datastore + using a default pin name: `PFObjectDefaultPin`. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see PFObjectDefaultPin + */ ++ (void)unpinAllObjectsInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* removes all objects with the specified pin name. + + @param name The name of the pin. + + @return The task that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unpinAllObjectsInBackgroundWithName:(NSString *)name; + +/** + *Asynchronously* removes all objects with the specified pin name. + + @param name The name of the pin. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)unpinAllObjectsInBackgroundWithName:(NSString *)name block:(nullable PFBooleanResultBlock)block; + +/** + *Synchronously* removes the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param objects The objects. + + @return Returns whether the unpin succeeded. + + @see pinAll: + @see PFObjectDefaultPin + */ ++ (BOOL)unpinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param objects The objects. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + + @see pinAll:error: + @see PFObjectDefaultPin + */ ++ (BOOL)unpinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects error:(NSError **)error; + +/** + *Synchronously* removes the objects and every object they point to in the local datastore, recursively. + + @param objects The objects. + @param name The name of the pin. + + @return Returns whether the unpin succeeded. + + @see pinAll:withName: + */ ++ (BOOL)unpinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* removes the objects and every object they point to in the local datastore, recursively. + + @param objects The objects. + @param name The name of the pin. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unpin succeeded. + + @see pinAll:withName:error: + */ ++ (BOOL)unpinAll:(nullable NSArray PF_GENERIC(PFObject *)*)objects + withName:(NSString *)name + error:(NSError **)error; + +/** + *Asynchronously* removes the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param objects The objects. + + @return The task that encapsulates the work being done. + + @see pinAllInBackground: + @see PFObjectDefaultPin + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects; + +/** + *Asynchronously* removes the objects and every object they point to in the local datastore, recursively, + using a default pin name: `PFObjectDefaultPin`. + + @param objects The objects. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see pinAllInBackground:block: + @see PFObjectDefaultPin + */ ++ (void)unpinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects block:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* removes the objects and every object they point to in the local datastore, recursively. + + @param objects The objects. + @param name The name of the pin. + + @return The task that encapsulates the work being done. + + @see pinAllInBackground:withName: + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unpinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects withName:(NSString *)name; + +/** + *Asynchronously* removes the objects and every object they point to in the local datastore, recursively. + + @param objects The objects. + @param name The name of the pin. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + + @see pinAllInBackground:withName:block: + */ ++ (void)unpinAllInBackground:(nullable NSArray PF_GENERIC(PFObject *)*)objects + withName:(NSString *)name + block:(nullable PFBooleanResultBlock)block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFProduct.h b/Parse.framework/Headers/PFProduct.h new file mode 100644 index 0000000..95107db --- /dev/null +++ b/Parse.framework/Headers/PFProduct.h @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import +#import +#import + +PF_OSX_UNAVAILABLE_WARNING +PF_WATCH_UNAVAILABLE_WARNING + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFProduct` class represents an in-app purchase product on the Parse server. + By default, products can only be created via the Data Browser. Saving a `PFProduct` will result in error. + However, the products' metadata information can be queried and viewed. + + This class is currently for iOS only. + */ +PF_OSX_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFProduct : PFObject + +///-------------------------------------- +/// @name Product-specific Properties +///-------------------------------------- + +/** + The product identifier of the product. + + This should match the product identifier in iTunes Connect exactly. + */ +@property (nullable, nonatomic, strong) NSString *productIdentifier; + +/** + The icon of the product. + */ +@property (nullable, nonatomic, strong) PFFile *icon; + +/** + The title of the product. + */ +@property (nullable, nonatomic, strong) NSString *title; + +/** + The subtitle of the product. + */ +@property (nullable, nonatomic, strong) NSString *subtitle; + +/** + The order in which the product information is displayed in `PFProductTableViewController`. + + The product with a smaller order is displayed earlier in the `PFProductTableViewController`. + */ +@property (nullable, nonatomic, strong) NSNumber *order; + +/** + The name of the associated download. + + If there is no downloadable asset, it should be `nil`. + */ +@property (nullable, nonatomic, strong, readonly) NSString *downloadName; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFPurchase.h b/Parse.framework/Headers/PFPurchase.h new file mode 100644 index 0000000..3952f37 --- /dev/null +++ b/Parse.framework/Headers/PFPurchase.h @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import +#import + +#import + +PF_OSX_UNAVAILABLE_WARNING +PF_WATCH_UNAVAILABLE_WARNING + +@class PFProduct; + +NS_ASSUME_NONNULL_BEGIN + +typedef void (^PFPurchaseProductObservationBlock)(SKPaymentTransaction *transaction); +typedef void (^PFPurchaseBuyProductResultBlock)(NSError *__nullable error); +typedef void (^PFPurchaseDownloadAssetResultBlock)(NSString *__nullable filePath, NSError *__nullable error); + +/** + `PFPurchase` provides a set of APIs for working with in-app purchases. + + This class is currently for iOS only. + */ +PF_OSX_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFPurchase : NSObject + +/** + Add application logic block which is run when buying a product. + + This method should be called once for each product, and should be called before + calling `+buyProduct:block:`. All invocations to `+addObserverForProduct:block:` should happen within + the same method, and on the main thread. It is recommended to place all invocations of this method + in `application:didFinishLaunchingWithOptions:`. + + @param productIdentifier the product identifier + @param block The block to be run when buying a product. + */ ++ (void)addObserverForProduct:(NSString *)productIdentifier block:(PFPurchaseProductObservationBlock)block; + +/** + *Asynchronously* initiates the purchase for the product. + + @param productIdentifier the product identifier + @param block the completion block. + */ ++ (void)buyProduct:(NSString *)productIdentifier block:(nullable PFPurchaseBuyProductResultBlock)block; + +/** + *Asynchronously* download the purchased asset, which is stored on Parse's server. + + Parse verifies the receipt with Apple and delivers the content only if the receipt is valid. + + @param transaction the transaction, which contains the receipt. + @param completion the completion block. + */ ++ (void)downloadAssetForTransaction:(SKPaymentTransaction *)transaction + completion:(PFPurchaseDownloadAssetResultBlock)completion; + +/** + *Asynchronously* download the purchased asset, which is stored on Parse's server. + + Parse verifies the receipt with Apple and delivers the content only if the receipt is valid. + + @param transaction the transaction, which contains the receipt. + @param completion the completion block. + @param progress the progress block, which is called multiple times to reveal progress of the download. + */ ++ (void)downloadAssetForTransaction:(SKPaymentTransaction *)transaction + completion:(PFPurchaseDownloadAssetResultBlock)completion + progress:(nullable PFProgressBlock)progress; + +/** + *Asynchronously* restore completed transactions for the current user. + + Only nonconsumable purchases are restored. If observers for the products have been added before + calling this method, invoking the method reruns the application logic associated with the purchase. + + @warning This method is only important to developers who want to preserve purchase states across + different installations of the same app. + */ ++ (void)restore; + +/** + Returns a content path of the asset of a product, if it was purchased and downloaded. + + To download and verify purchases use `+downloadAssetForTransaction:completion:`. + + @warning This method will return `nil`, if the purchase wasn't verified or if the asset was not downloaded. + */ ++ (nullable NSString *)assetContentPathForProduct:(PFProduct *)product; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFPush.h b/Parse.framework/Headers/PFPush.h new file mode 100644 index 0000000..38fd308 --- /dev/null +++ b/Parse.framework/Headers/PFPush.h @@ -0,0 +1,543 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import + +PF_TV_UNAVAILABLE_WARNING +PF_WATCH_UNAVAILABLE_WARNING + +@class PFQuery PF_GENERIC(PFGenericObject : PFObject *); + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFPush` class defines a push notification that can be sent from a client device. + + The preferred way of modifying or retrieving channel subscriptions is to use + the `PFInstallation` class, instead of the class methods in `PFPush`. + */ +PF_TV_UNAVAILABLE PF_WATCH_UNAVAILABLE @interface PFPush : NSObject + +///-------------------------------------- +/// @name Creating a Push Notification +///-------------------------------------- + ++ (instancetype)push; + +///-------------------------------------- +/// @name Configuring a Push Notification +///-------------------------------------- + +/** + Sets the channel on which this push notification will be sent. + + @param channel The channel to set for this push. + The channel name must start with a letter and contain only letters, numbers, dashes, and underscores. + */ +- (void)setChannel:(nullable NSString *)channel; + +/** + Sets the array of channels on which this push notification will be sent. + + @param channels The array of channels to set for this push. + Each channel name must start with a letter and contain only letters, numbers, dashes, and underscores. + */ +- (void)setChannels:(nullable NSArray PF_GENERIC(NSString *)*)channels; + +/** + Sets an installation query to which this push notification will be sent. + + The query should be created via `PFInstallation.+query` and should not specify a skip, limit, or order. + + @param query The installation query to set for this push. + */ +- (void)setQuery:(nullable PFQuery PF_GENERIC(PFInstallation *)*)query; + +/** + Sets an alert message for this push notification. + + @warning This will overwrite any data specified in setData. + + @param message The message to send in this push. + */ +- (void)setMessage:(nullable NSString *)message; + +/** + Sets an arbitrary data payload for this push notification. + + See the guide for information about the dictionary structure. + + @warning This will overwrite any data specified in setMessage. + + @param data The data to send in this push. + */ +- (void)setData:(nullable NSDictionary *)data; + +/** + Sets whether this push will go to Android devices. + + @param pushToAndroid Whether this push will go to Android devices. + + @deprecated Please use a `PFInstallation.+query` with a constraint on deviceType instead. + */ +- (void)setPushToAndroid:(BOOL)pushToAndroid PARSE_DEPRECATED("Please use a [PFInstallation query] with a constraint on deviceType. This method is deprecated and won't do anything."); + +/** + Sets whether this push will go to iOS devices. + + @param pushToIOS Whether this push will go to iOS devices. + + @deprecated Please use a `PFInstallation.+query` with a constraint on deviceType instead. + */ +- (void)setPushToIOS:(BOOL)pushToIOS PARSE_DEPRECATED("Please use a [PFInstallation query] with a constraint on deviceType. This method is deprecated and won't do anything."); + +/** + Sets the expiration time for this notification. + + The notification will be sent to devices which are either online + at the time the notification is sent, or which come online before the expiration time is reached. + Because device clocks are not guaranteed to be accurate, + most applications should instead use `-expireAfterTimeInterval:`. + + @see expireAfterTimeInterval: + + @param date The time at which the notification should expire. + */ +- (void)expireAtDate:(nullable NSDate *)date; + +/** + Sets the time interval after which this notification should expire. + + This notification will be sent to devices which are either online at + the time the notification is sent, or which come online within the given + time interval of the notification being received by Parse's server. + An interval which is less than or equal to zero indicates that the + message should only be sent to devices which are currently online. + + @param timeInterval The interval after which the notification should expire. + */ +- (void)expireAfterTimeInterval:(NSTimeInterval)timeInterval; + +/** + Clears both expiration values, indicating that the notification should never expire. + */ +- (void)clearExpiration; + +/** + Date at which to send this push notification. + + Push notificaitons with this date will be delivered at the local time matching the `PFInstallation.timeZone`. + + @warning The date cannot be in the past, and can be up to two weeks in the future. + */ +@property (nullable, nonatomic, strong) NSDate *pushDate; + +///-------------------------------------- +/// @name Sending Push Notifications +///-------------------------------------- + +/** + *Synchronously* send a push message to a channel. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param message The message to send. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the send succeeded. + */ ++ (BOOL)sendPushMessageToChannel:(NSString *)channel + withMessage:(NSString *)message + error:(NSError **)error; + +/** + *Asynchronously* send a push message to a channel. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param message The message to send. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)sendPushMessageToChannelInBackground:(NSString *)channel + withMessage:(NSString *)message; + +/** + *Asynchronously* sends a push message to a channel and calls the given block. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param message The message to send. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)sendPushMessageToChannelInBackground:(NSString *)channel + withMessage:(NSString *)message + block:(nullable PFBooleanResultBlock)block; + +/* + *Asynchronously* send a push message to a channel. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param message The message to send. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)sendPushMessageToChannelInBackground:(NSString *)channel + withMessage:(NSString *)message + target:(__nullable id)target + selector:(__nullable SEL)selector; + +/** + Send a push message to a query. + + @param query The query to send to. The query must be a `PFInstallation` query created with `PFInstallation.+query`. + @param message The message to send. + @param error Pointer to an NSError that will be set if necessary. + + @return Returns whether the send succeeded. + */ ++ (BOOL)sendPushMessageToQuery:(PFQuery PF_GENERIC(PFInstallation *)*)query + withMessage:(NSString *)message + error:(NSError **)error; + +/** + *Asynchronously* send a push message to a query. + + @param query The query to send to. The query must be a `PFInstallation` query created with `PFInstallation.+query`. + @param message The message to send. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)sendPushMessageToQueryInBackground:(PFQuery PF_GENERIC(PFInstallation *)*)query + withMessage:(NSString *)message; + +/** + *Asynchronously* sends a push message to a query and calls the given block. + + @param query The query to send to. The query must be a PFInstallation query + created with [PFInstallation query]. + @param message The message to send. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)sendPushMessageToQueryInBackground:(PFQuery PF_GENERIC(PFInstallation *)*)query + withMessage:(NSString *)message + block:(nullable PFBooleanResultBlock)block; + +/** + *Synchronously* send this push message. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the send succeeded. + */ +- (BOOL)sendPush:(NSError **)error; + +/** + *Asynchronously* send this push message. + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)sendPushInBackground; + +/** + *Asynchronously* send this push message and executes the given callback block. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)sendPushInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/* + *Asynchronously* send this push message and calls the given callback. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ +- (void)sendPushInBackgroundWithTarget:(__nullable id)target selector:(__nullable SEL)selector; + +/** + *Synchronously* send a push message with arbitrary data to a channel. + + See the guide for information about the dictionary structure. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param data The data to send. + @param error Pointer to an NSError that will be set if necessary. + + @return Returns whether the send succeeded. + */ ++ (BOOL)sendPushDataToChannel:(NSString *)channel + withData:(NSDictionary *)data + error:(NSError **)error; + +/** + *Asynchronously* send a push message with arbitrary data to a channel. + + See the guide for information about the dictionary structure. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param data The data to send. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)sendPushDataToChannelInBackground:(NSString *)channel + withData:(NSDictionary *)data; + +/** + Asynchronously sends a push message with arbitrary data to a channel and calls the given block. + + See the guide for information about the dictionary structure. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param data The data to send. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)sendPushDataToChannelInBackground:(NSString *)channel + withData:(NSDictionary *)data + block:(nullable PFBooleanResultBlock)block; + +/* + *Asynchronously* send a push message with arbitrary data to a channel. + + See the guide for information about the dictionary structure. + + @param channel The channel to send to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param data The data to send. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)sendPushDataToChannelInBackground:(NSString *)channel + withData:(NSDictionary *)data + target:(__nullable id)target + selector:(__nullable SEL)selector; + +/** + *Synchronously* send a push message with arbitrary data to a query. + + See the guide for information about the dictionary structure. + + @param query The query to send to. The query must be a `PFInstallation` query + created with `PFInstallation.+query`. + @param data The data to send. + @param error Pointer to an NSError that will be set if necessary. + + @return Returns whether the send succeeded. + */ ++ (BOOL)sendPushDataToQuery:(PFQuery PF_GENERIC(PFInstallation *)*)query + withData:(NSDictionary *)data + error:(NSError **)error; + +/** + Asynchronously send a push message with arbitrary data to a query. + + See the guide for information about the dictionary structure. + + @param query The query to send to. The query must be a `PFInstallation` query + created with `PFInstallation.+query`. + @param data The data to send. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)sendPushDataToQueryInBackground:(PFQuery PF_GENERIC(PFInstallation *)*)query + withData:(NSDictionary *)data; + +/** + *Asynchronously* sends a push message with arbitrary data to a query and calls the given block. + + See the guide for information about the dictionary structure. + + @param query The query to send to. The query must be a `PFInstallation` query + created with `PFInstallation.+query`. + @param data The data to send. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)sendPushDataToQueryInBackground:(PFQuery PF_GENERIC(PFInstallation *)*)query + withData:(NSDictionary *)data + block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Handling Notifications +///-------------------------------------- + +/** + A default handler for push notifications while the app is active that + could be used to mimic the behavior of iOS push notifications while the app is backgrounded or not running. + + Call this from `application:didReceiveRemoteNotification:`. + If push has a dictionary containing loc-key and loc-args in the alert, + we support up to 10 items in loc-args (`NSRangeException` if limit exceeded). + + @warning This method is available only on iOS. + + @param userInfo The userInfo dictionary you get in `appplication:didReceiveRemoteNotification:`. + */ ++ (void)handlePush:(nullable NSDictionary *)userInfo NS_AVAILABLE_IOS(3_0) PF_EXTENSION_UNAVAILABLE(""); + +///-------------------------------------- +/// @name Managing Channel Subscriptions +///-------------------------------------- + +/** + Store the device token locally for push notifications. + + Usually called from you main app delegate's `didRegisterForRemoteNotificationsWithDeviceToken:`. + + @param deviceToken Either as an `NSData` straight from `application:didRegisterForRemoteNotificationsWithDeviceToken:` + or as an `NSString` if you converted it yourself. + */ ++ (void)storeDeviceToken:(id)deviceToken; + +/** + *Synchronously* get all the channels that this device is subscribed to. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns an `NSSet` containing all the channel names this device is subscribed to. + */ ++ (nullable NSSet PF_GENERIC(NSString *)*)getSubscribedChannels:(NSError **)error; + +/** + *Asynchronously* get all the channels that this device is subscribed to. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSSet *)*)getSubscribedChannelsInBackground; + +/** + *Asynchronously* get all the channels that this device is subscribed to. + @param block The block to execute. + It should have the following argument signature: `^(NSSet *channels, NSError *error)`. + */ ++ (void)getSubscribedChannelsInBackgroundWithBlock:(PFSetResultBlock)block; + +/* + *Asynchronously* get all the channels that this device is subscribed to. + + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSSet *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + */ ++ (void)getSubscribedChannelsInBackgroundWithTarget:(id)target selector:(SEL)selector; + +/** + *Synchrnously* subscribes the device to a channel of push notifications. + + @param channel The channel to subscribe to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the subscribe succeeded. + */ ++ (BOOL)subscribeToChannel:(NSString *)channel error:(NSError **)error; + +/** + *Asynchronously* subscribes the device to a channel of push notifications. + + @param channel The channel to subscribe to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)subscribeToChannelInBackground:(NSString *)channel; + +/** + *Asynchronously* subscribes the device to a channel of push notifications and calls the given block. + + @param channel The channel to subscribe to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)` + */ ++ (void)subscribeToChannelInBackground:(NSString *)channel + block:(nullable PFBooleanResultBlock)block; + +/* + *Asynchronously* subscribes the device to a channel of push notifications and calls the given callback. + + @param channel The channel to subscribe to. The channel name must start with + a letter and contain only letters, numbers, dashes, and underscores. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)subscribeToChannelInBackground:(NSString *)channel + target:(nullable id)target + selector:(nullable SEL)selector; + +/** + *Synchronously* unsubscribes the device to a channel of push notifications. + + @param channel The channel to unsubscribe from. + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns whether the unsubscribe succeeded. + */ ++ (BOOL)unsubscribeFromChannel:(NSString *)channel error:(NSError **)error; + +/** + *Asynchronously* unsubscribes the device from a channel of push notifications. + + @param channel The channel to unsubscribe from. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unsubscribeFromChannelInBackground:(NSString *)channel; + +/** + *Asynchronously* unsubscribes the device from a channel of push notifications and calls the given block. + + @param channel The channel to unsubscribe from. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)unsubscribeFromChannelInBackground:(NSString *)channel + block:(nullable PFBooleanResultBlock)block; + +/* + *Asynchronously* unsubscribes the device from a channel of push notifications and calls the given callback. + + @param channel The channel to unsubscribe from. + @param target The object to call selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)unsubscribeFromChannelInBackground:(NSString *)channel + target:(nullable id)target + selector:(nullable SEL)selector; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFQuery.h b/Parse.framework/Headers/PFQuery.h new file mode 100644 index 0000000..d5304ac --- /dev/null +++ b/Parse.framework/Headers/PFQuery.h @@ -0,0 +1,892 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFQuery` class defines a query that is used to query for `PFObject`s. + */ +@interface PFQuery PF_GENERIC(PFGenericObject : PFObject *) : NSObject + +///-------------------------------------- +/// @name Blocks +///-------------------------------------- + +typedef void (^PFQueryArrayResultBlock)(NSArray PF_GENERIC(PFGenericObject) * __nullable objects, NSError * __nullable error); + +///-------------------------------------- +/// @name Creating a Query for a Class +///-------------------------------------- + +/** + Initializes the query with a class name. + + @param className The class name. + */ +- (instancetype)initWithClassName:(NSString *)className; + +/** + Returns a `PFQuery` for a given class. + + @param className The class to query on. + + @return A `PFQuery` object. + */ ++ (instancetype)queryWithClassName:(NSString *)className; + +/** + Creates a PFQuery with the constraints given by predicate. + + The following types of predicates are supported: + + - Simple comparisons such as `=`, `!=`, `<`, `>`, `<=`, `>=`, and `BETWEEN` with a key and a constant. + - Containment predicates, such as `x IN {1, 2, 3}`. + - Key-existence predicates, such as `x IN SELF`. + - BEGINSWITH expressions. + - Compound predicates with `AND`, `OR`, and `NOT`. + - SubQueries with `key IN %@`, subquery. + + The following types of predicates are NOT supported: + + - Aggregate operations, such as `ANY`, `SOME`, `ALL`, or `NONE`. + - Regular expressions, such as `LIKE`, `MATCHES`, `CONTAINS`, or `ENDSWITH`. + - Predicates comparing one key to another. + - Complex predicates with many ORed clauses. + + @param className The class to query on. + @param predicate The predicate to create conditions from. + */ ++ (instancetype)queryWithClassName:(NSString *)className predicate:(nullable NSPredicate *)predicate; + +/** + The class name to query for. + */ +@property (nonatomic, strong) NSString *parseClassName; + +///-------------------------------------- +/// @name Adding Basic Constraints +///-------------------------------------- + +/** + Make the query include PFObjects that have a reference stored at the provided key. + + This has an effect similar to a join. You can use dot notation to specify which fields in + the included object are also fetch. + + @param key The key to load child `PFObject`s for. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)includeKey:(NSString *)key; + +/** + Make the query restrict the fields of the returned `PFObject`s to include only the provided keys. + + If this is called multiple times, then all of the keys specified in each of the calls will be included. + + @param keys The keys to include in the result. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)selectKeys:(NSArray PF_GENERIC(NSString *)*)keys; + +/** + Add a constraint that requires a particular key exists. + + @param key The key that should exist. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKeyExists:(NSString *)key; + +/** + Add a constraint that requires a key not exist. + + @param key The key that should not exist. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKeyDoesNotExist:(NSString *)key; + +/** + Add a constraint to the query that requires a particular key's object to be equal to the provided object. + + @param key The key to be constrained. + @param object The object that must be equalled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key equalTo:(id)object; + +/** + Add a constraint to the query that requires a particular key's object to be less than the provided object. + + @param key The key to be constrained. + @param object The object that provides an upper bound. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key lessThan:(id)object; + +/** + Add a constraint to the query that requires a particular key's object + to be less than or equal to the provided object. + + @param key The key to be constrained. + @param object The object that must be equalled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key lessThanOrEqualTo:(id)object; + +/** + Add a constraint to the query that requires a particular key's object + to be greater than the provided object. + + @param key The key to be constrained. + @param object The object that must be equalled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key greaterThan:(id)object; + +/** + Add a constraint to the query that requires a particular key's + object to be greater than or equal to the provided object. + + @param key The key to be constrained. + @param object The object that must be equalled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key greaterThanOrEqualTo:(id)object; + +/** + Add a constraint to the query that requires a particular key's object + to be not equal to the provided object. + + @param key The key to be constrained. + @param object The object that must not be equalled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key notEqualTo:(id)object; + +/** + Add a constraint to the query that requires a particular key's object + to be contained in the provided array. + + @param key The key to be constrained. + @param array The possible values for the key's object. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key containedIn:(NSArray *)array; + +/** + Add a constraint to the query that requires a particular key's object + not be contained in the provided array. + + @param key The key to be constrained. + @param array The list of values the key's object should not be. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key notContainedIn:(NSArray *)array; + +/** + Add a constraint to the query that requires a particular key's array + contains every element of the provided array. + + @param key The key to be constrained. + @param array The array of values to search for. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key containsAllObjectsInArray:(NSArray *)array; + +///-------------------------------------- +/// @name Adding Location Constraints +///-------------------------------------- + +/** + Add a constraint to the query that requires a particular key's coordinates (specified via `PFGeoPoint`) + be near a reference point. + + Distance is calculated based on angular distance on a sphere. Results will be sorted by distance + from reference point. + + @param key The key to be constrained. + @param geopoint The reference point represented as a `PFGeoPoint`. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key nearGeoPoint:(PFGeoPoint *)geopoint; + +/** + Add a constraint to the query that requires a particular key's coordinates (specified via `PFGeoPoint`) + be near a reference point and within the maximum distance specified (in miles). + + Distance is calculated based on a spherical coordinate system. + Results will be sorted by distance (nearest to farthest) from the reference point. + + @param key The key to be constrained. + @param geopoint The reference point represented as a `PFGeoPoint`. + @param maxDistance Maximum distance in miles. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + nearGeoPoint:(PFGeoPoint *)geopoint + withinMiles:(double)maxDistance; + +/** + Add a constraint to the query that requires a particular key's coordinates (specified via `PFGeoPoint`) + be near a reference point and within the maximum distance specified (in kilometers). + + Distance is calculated based on a spherical coordinate system. + Results will be sorted by distance (nearest to farthest) from the reference point. + + @param key The key to be constrained. + @param geopoint The reference point represented as a `PFGeoPoint`. + @param maxDistance Maximum distance in kilometers. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + nearGeoPoint:(PFGeoPoint *)geopoint + withinKilometers:(double)maxDistance; + +/** + Add a constraint to the query that requires a particular key's coordinates (specified via `PFGeoPoint`) be near + a reference point and within the maximum distance specified (in radians). Distance is calculated based on + angular distance on a sphere. Results will be sorted by distance (nearest to farthest) from the reference point. + + @param key The key to be constrained. + @param geopoint The reference point as a `PFGeoPoint`. + @param maxDistance Maximum distance in radians. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + nearGeoPoint:(PFGeoPoint *)geopoint + withinRadians:(double)maxDistance; + +/** + Add a constraint to the query that requires a particular key's coordinates (specified via `PFGeoPoint`) be + contained within a given rectangular geographic bounding box. + + @param key The key to be constrained. + @param southwest The lower-left inclusive corner of the box. + @param northeast The upper-right inclusive corner of the box. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key withinGeoBoxFromSouthwest:(PFGeoPoint *)southwest toNortheast:(PFGeoPoint *)northeast; + +///-------------------------------------- +/// @name Adding String Constraints +///-------------------------------------- + +/** + Add a regular expression constraint for finding string values that match the provided regular expression. + + @warning This may be slow for large datasets. + + @param key The key that the string to match is stored in. + @param regex The regular expression pattern to match. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key matchesRegex:(NSString *)regex; + +/** + Add a regular expression constraint for finding string values that match the provided regular expression. + + @warning This may be slow for large datasets. + + @param key The key that the string to match is stored in. + @param regex The regular expression pattern to match. + @param modifiers Any of the following supported PCRE modifiers: + - `i` - Case insensitive search + - `m` - Search across multiple lines of input + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + matchesRegex:(NSString *)regex + modifiers:(nullable NSString *)modifiers; + +/** + Add a constraint for finding string values that contain a provided substring. + + @warning This will be slow for large datasets. + + @param key The key that the string to match is stored in. + @param substring The substring that the value must contain. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key containsString:(nullable NSString *)substring; + +/** + Add a constraint for finding string values that start with a provided prefix. + + This will use smart indexing, so it will be fast for large datasets. + + @param key The key that the string to match is stored in. + @param prefix The substring that the value must start with. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key hasPrefix:(nullable NSString *)prefix; + +/** + Add a constraint for finding string values that end with a provided suffix. + + @warning This will be slow for large datasets. + + @param key The key that the string to match is stored in. + @param suffix The substring that the value must end with. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key hasSuffix:(nullable NSString *)suffix; + +///-------------------------------------- +/// @name Adding Subqueries +///-------------------------------------- + +/** + Returns a `PFQuery` that is the `or` of the passed in queries. + + @param queries The list of queries to or together. + + @return An instance of `PFQuery` that is the `or` of the passed in queries. + */ ++ (instancetype)orQueryWithSubqueries:(NSArray PF_GENERIC(PFQuery *)*)queries; + +/** + Adds a constraint that requires that a key's value matches a value in another key + in objects returned by a sub query. + + @param key The key that the value is stored. + @param otherKey The key in objects in the returned by the sub query whose value should match. + @param query The query to run. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + matchesKey:(NSString *)otherKey + inQuery:(PFQuery *)query; + +/** + Adds a constraint that requires that a key's value `NOT` match a value in another key + in objects returned by a sub query. + + @param key The key that the value is stored. + @param otherKey The key in objects in the returned by the sub query whose value should match. + @param query The query to run. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key + doesNotMatchKey:(NSString *)otherKey + inQuery:(PFQuery *)query; + +/** + Add a constraint that requires that a key's value matches a `PFQuery` constraint. + + @warning This only works where the key's values are `PFObject`s or arrays of `PFObject`s. + + @param key The key that the value is stored in + @param query The query the value should match + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key matchesQuery:(PFQuery *)query; + +/** + Add a constraint that requires that a key's value to not match a `PFQuery` constraint. + + @warning This only works where the key's values are `PFObject`s or arrays of `PFObject`s. + + @param key The key that the value is stored in + @param query The query the value should not match + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)whereKey:(NSString *)key doesNotMatchQuery:(PFQuery *)query; + +///-------------------------------------- +/// @name Sorting +///-------------------------------------- + +/** + Sort the results in *ascending* order with the given key. + + @param key The key to order by. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)orderByAscending:(NSString *)key; + +/** + Additionally sort in *ascending* order by the given key. + + The previous keys provided will precedence over this key. + + @param key The key to order by. + */ +- (instancetype)addAscendingOrder:(NSString *)key; + +/** + Sort the results in *descending* order with the given key. + + @param key The key to order by. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)orderByDescending:(NSString *)key; + +/** + Additionally sort in *descending* order by the given key. + + The previous keys provided will precedence over this key. + + @param key The key to order by. + */ +- (instancetype)addDescendingOrder:(NSString *)key; + +/** + Sort the results using a given sort descriptor. + + @warning If a `sortDescriptor` has custom `selector` or `comparator` - they aren't going to be used. + + @param sortDescriptor The `NSSortDescriptor` to use to sort the results of the query. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)orderBySortDescriptor:(NSSortDescriptor *)sortDescriptor; + +/** + Sort the results using a given array of sort descriptors. + + @warning If a `sortDescriptor` has custom `selector` or `comparator` - they aren't going to be used. + + @param sortDescriptors An array of `NSSortDescriptor` objects to use to sort the results of the query. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)orderBySortDescriptors:(nullable NSArray PF_GENERIC(NSSortDescriptor *)*)sortDescriptors; + +///-------------------------------------- +/// @name Getting Objects by ID +///-------------------------------------- + +/** + Returns a `PFObject` with a given class and id. + + @param objectClass The class name for the object that is being requested. + @param objectId The id of the object that is being requested. + + @return The `PFObject` if found. Returns `nil` if the object isn't found, or if there was an error. + */ ++ (nullable PFGenericObject)getObjectOfClass:(NSString *)objectClass + objectId:(NSString *)objectId PF_SWIFT_UNAVAILABLE; + +/** + Returns a `PFObject` with a given class and id and sets an error if necessary. + + @param objectClass The class name for the object that is being requested. + @param objectId The id of the object that is being requested. + @param error Pointer to an `NSError` that will be set if necessary. + + @return The `PFObject` if found. Returns `nil` if the object isn't found, or if there was an `error`. + */ ++ (nullable PFGenericObject)getObjectOfClass:(NSString *)objectClass + objectId:(NSString *)objectId + error:(NSError **)error; + +/** + Returns a `PFObject` with the given id. + + @warning This method mutates the query. + It will reset limit to `1`, skip to `0` and remove all conditions, leaving only `objectId`. + + @param objectId The id of the object that is being requested. + + @return The `PFObject` if found. Returns nil if the object isn't found, or if there was an error. + */ +- (nullable PFGenericObject)getObjectWithId:(NSString *)objectId PF_SWIFT_UNAVAILABLE; + +/** + Returns a `PFObject` with the given id and sets an error if necessary. + + @warning This method mutates the query. + It will reset limit to `1`, skip to `0` and remove all conditions, leaving only `objectId`. + + @param objectId The id of the object that is being requested. + @param error Pointer to an `NSError` that will be set if necessary. + + @return The `PFObject` if found. Returns nil if the object isn't found, or if there was an error. + */ +- (nullable PFGenericObject)getObjectWithId:(NSString *)objectId error:(NSError **)error; + +/** + Gets a `PFObject` asynchronously and calls the given block with the result. + + @warning This method mutates the query. + It will reset limit to `1`, skip to `0` and remove all conditions, leaving only `objectId`. + + @param objectId The id of the object that is being requested. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(PFGenericObject) *)getObjectInBackgroundWithId:(NSString *)objectId; + +/** + Gets a `PFObject` asynchronously and calls the given block with the result. + + @warning This method mutates the query. + It will reset limit to `1`, skip to `0` and remove all conditions, leaving only `objectId`. + + @param objectId The id of the object that is being requested. + @param block The block to execute. + The block should have the following argument signature: `^(NSArray *object, NSError *error)` + */ +- (void)getObjectInBackgroundWithId:(NSString *)objectId + block:(nullable void (^)(PFGenericObject __nullable object, NSError *__nullable error))block; + +/* + Gets a `PFObject` asynchronously. + + This mutates the PFQuery. It will reset limit to `1`, skip to `0` and remove all conditions, leaving only `objectId`. + + @param objectId The id of the object being requested. + @param target The target for the callback selector. + @param selector The selector for the callback. + It should have the following signature: `(void)callbackWithResult:(id)result error:(NSError *)error`. + Result will be `nil` if error is set and vice versa. + */ +- (void)getObjectInBackgroundWithId:(NSString *)objectId + target:(nullable id)target + selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Getting User Objects +///-------------------------------------- + +/** + Returns a `PFUser` with a given id. + + @param objectId The id of the object that is being requested. + + @return The PFUser if found. Returns nil if the object isn't found, or if there was an error. + */ ++ (nullable PFUser *)getUserObjectWithId:(NSString *)objectId PF_SWIFT_UNAVAILABLE; + +/** + Returns a PFUser with a given class and id and sets an error if necessary. + @param objectId The id of the object that is being requested. + @param error Pointer to an NSError that will be set if necessary. + @result The PFUser if found. Returns nil if the object isn't found, or if there was an error. + */ ++ (nullable PFUser *)getUserObjectWithId:(NSString *)objectId error:(NSError **)error; + +/** + @deprecated Please use [PFUser query] instead. + */ ++ (instancetype)queryForUser PARSE_DEPRECATED("Use [PFUser query] instead."); + +///-------------------------------------- +/// @name Getting all Matches for a Query +///-------------------------------------- + +/** + Finds objects *synchronously* based on the constructed query. + + @return Returns an array of `PFObject` objects that were found. + */ +- (nullable NSArray PF_GENERIC(PFGenericObject) *)findObjects PF_SWIFT_UNAVAILABLE; + +/** + Finds objects *synchronously* based on the constructed query and sets an error if there was one. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns an array of `PFObject` objects that were found. + */ +- (nullable NSArray PF_GENERIC(PFGenericObject) *)findObjects:(NSError **)error; + +/** + Finds objects *asynchronously* and sets the `NSArray` of `PFObject` objects as a result of the task. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSArray *)*)findObjectsInBackground; + +/** + Finds objects *asynchronously* and calls the given block with the results. + + @param block The block to execute. + It should have the following argument signature: `^(NSArray *objects, NSError *error)` + */ +- (void)findObjectsInBackgroundWithBlock:(nullable PFQueryArrayResultBlock)block; + +/* + Finds objects *asynchronously* and calls the given callback with the results. + + @param target The object to call the selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(id)result error:(NSError *)error`. + Result will be `nil` if error is set and vice versa. + */ +- (void)findObjectsInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Getting the First Match in a Query +///-------------------------------------- + +/** + Gets an object *synchronously* based on the constructed query. + + @warning This method mutates the query. It will reset the limit to `1`. + + @return Returns a `PFObject`, or `nil` if none was found. + */ +- (nullable PFGenericObject)getFirstObject PF_SWIFT_UNAVAILABLE; + +/** + Gets an object *synchronously* based on the constructed query and sets an error if any occurred. + + @warning This method mutates the query. It will reset the limit to `1`. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns a `PFObject`, or `nil` if none was found. + */ +- (nullable PFGenericObject)getFirstObject:(NSError **)error; + +/** + Gets an object *asynchronously* and sets it as a result of the task. + + @warning This method mutates the query. It will reset the limit to `1`. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(PFGenericObject) *)getFirstObjectInBackground; + +/** + Gets an object *asynchronously* and calls the given block with the result. + + @warning This method mutates the query. It will reset the limit to `1`. + + @param block The block to execute. + It should have the following argument signature: `^(PFObject *object, NSError *error)`. + `result` will be `nil` if `error` is set OR no object was found matching the query. + `error` will be `nil` if `result` is set OR if the query succeeded, but found no results. + */ +- (void)getFirstObjectInBackgroundWithBlock:(nullable void (^)(PFGenericObject __nullable object, NSError *__nullable error))block; + +/* + Gets an object *asynchronously* and calls the given callback with the results. + + @warning This method mutates the query. It will reset the limit to `1`. + + @param target The object to call the selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(PFObject *)result error:(NSError *)error`. + `result` will be `nil` if `error` is set OR no object was found matching the query. + `error` will be `nil` if `result` is set OR if the query succeeded, but found no results. + */ +- (void)getFirstObjectInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Counting the Matches in a Query +///-------------------------------------- + +/** + Counts objects *synchronously* based on the constructed query. + + @return Returns the number of `PFObject` objects that match the query, or `-1` if there is an error. + */ +- (NSInteger)countObjects PF_SWIFT_UNAVAILABLE; + +/** + Counts objects *synchronously* based on the constructed query and sets an error if there was one. + + @param error Pointer to an `NSError` that will be set if necessary. + + @return Returns the number of `PFObject` objects that match the query, or `-1` if there is an error. + */ +- (NSInteger)countObjects:(NSError **)error; + +/** + Counts objects *asynchronously* and sets `NSNumber` with count as a result of the task. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)countObjectsInBackground; + +/** + Counts objects *asynchronously* and calls the given block with the counts. + + @param block The block to execute. + It should have the following argument signature: `^(int count, NSError *error)` + */ +- (void)countObjectsInBackgroundWithBlock:(nullable PFIntegerResultBlock)block; + +/* + Counts objects *asynchronously* and calls the given callback with the count. + + @param target The object to call the selector on. + @param selector The selector to call. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + */ +- (void)countObjectsInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Cancelling a Query +///-------------------------------------- + +/** + Cancels the current network request (if any). Ensures that callbacks won't be called. + */ +- (void)cancel; + +///-------------------------------------- +/// @name Paginating Results +///-------------------------------------- + +/** + A limit on the number of objects to return. The default limit is `100`, with a + maximum of 1000 results being returned at a time. + + @warning If you are calling `findObjects` with `limit = 1`, you may find it easier to use `getFirst` instead. + */ +@property (nonatomic, assign) NSInteger limit; + +/** + The number of objects to skip before returning any. + */ +@property (nonatomic, assign) NSInteger skip; + +///-------------------------------------- +/// @name Controlling Caching Behavior +///-------------------------------------- + +/** + The cache policy to use for requests. + + Not allowed when Pinning is enabled. + + @see fromLocalDatastore + @see fromPin + @see fromPinWithName: + */ +@property (nonatomic, assign) PFCachePolicy cachePolicy; + +/** + The age after which a cached value will be ignored + */ +@property (nonatomic, assign) NSTimeInterval maxCacheAge; + +/** + Returns whether there is a cached result for this query. + + @result `YES` if there is a cached result for this query, otherwise `NO`. + */ +- (BOOL)hasCachedResult; + +/** + Clears the cached result for this query. If there is no cached result, this is a noop. + */ +- (void)clearCachedResult; + +/** + Clears the cached results for all queries. + */ ++ (void)clearAllCachedResults; + +///-------------------------------------- +/// @name Query Source +///-------------------------------------- + +/** + Change the source of this query to all pinned objects. + + @warning Requires Local Datastore to be enabled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + + @see cachePolicy + */ +- (instancetype)fromLocalDatastore; + +/** + Change the source of this query to the default group of pinned objects. + + @warning Requires Local Datastore to be enabled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + + @see PFObjectDefaultPin + @see cachePolicy + */ +- (instancetype)fromPin; + +/** + Change the source of this query to a specific group of pinned objects. + + @warning Requires Local Datastore to be enabled. + + @param name The pinned group. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + + @see PFObjectDefaultPin + @see cachePolicy + */ +- (instancetype)fromPinWithName:(nullable NSString *)name; + +/** + Ignore ACLs when querying from the Local Datastore. + + This is particularly useful when querying for objects with Role based ACLs set on them. + + @warning Requires Local Datastore to be enabled. + + @return The same instance of `PFQuery` as the receiver. This allows method chaining. + */ +- (instancetype)ignoreACLs; + +///-------------------------------------- +/// @name Advanced Settings +///-------------------------------------- + +/** + Whether or not performance tracing should be done on the query. + + @warning This should not be set to `YES` in most cases. + */ +@property (nonatomic, assign) BOOL trace; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFRelation.h b/Parse.framework/Headers/PFRelation.h new file mode 100644 index 0000000..6b3c863 --- /dev/null +++ b/Parse.framework/Headers/PFRelation.h @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFRelation` class that is used to access all of the children of a many-to-many relationship. + Each instance of `PFRelation` is associated with a particular parent object and key. + */ +@interface PFRelation : NSObject + +/** + The name of the class of the target child objects. + */ +@property (nullable, nonatomic, copy) NSString *targetClass; + +///-------------------------------------- +/// @name Accessing Objects +///-------------------------------------- + +/** + Returns a `PFQuery` object that can be used to get objects in this relation. + */ +- (PFQuery *)query; + +///-------------------------------------- +/// @name Modifying Relations +///-------------------------------------- + +/** + Adds a relation to the passed in object. + + @param object A `PFObject` object to add relation to. + */ +- (void)addObject:(PFObject *)object; + +/** + Removes a relation to the passed in object. + + @param object A `PFObject` object to add relation to. + */ +- (void)removeObject:(PFObject *)object; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFRole.h b/Parse.framework/Headers/PFRole.h new file mode 100644 index 0000000..86c6981 --- /dev/null +++ b/Parse.framework/Headers/PFRole.h @@ -0,0 +1,99 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFRole` class represents a Role on the Parse server. + `PFRoles` represent groupings of `PFUser` objects for the purposes of granting permissions + (e.g. specifying a `PFACL` for a `PFObject`). + Roles are specified by their sets of child users and child roles, + all of which are granted any permissions that the parent role has. + + Roles must have a name (which cannot be changed after creation of the role), and must specify an ACL. + */ +@interface PFRole : PFObject + +///-------------------------------------- +/// @name Creating a New Role +///-------------------------------------- + +/** + Constructs a new `PFRole` with the given name. + If no default ACL has been specified, you must provide an ACL for the role. + + @param name The name of the Role to create. + */ +- (instancetype)initWithName:(NSString *)name; + +/** + Constructs a new `PFRole` with the given name. + + @param name The name of the Role to create. + @param acl The ACL for this role. Roles must have an ACL. + */ +- (instancetype)initWithName:(NSString *)name acl:(nullable PFACL *)acl; + +/** + Constructs a new `PFRole` with the given name. + + If no default ACL has been specified, you must provide an ACL for the role. + + @param name The name of the Role to create. + */ ++ (instancetype)roleWithName:(NSString *)name; + +/** + Constructs a new `PFRole` with the given name. + + @param name The name of the Role to create. + @param acl The ACL for this role. Roles must have an ACL. + */ ++ (instancetype)roleWithName:(NSString *)name acl:(nullable PFACL *)acl; + +///-------------------------------------- +/// @name Role-specific Properties +///-------------------------------------- + +/** + Gets or sets the name for a role. + + This value must be set before the role has been saved to the server, + and cannot be set once the role has been saved. + + @warning A role's name can only contain alphanumeric characters, `_`, `-`, and spaces. + */ +@property (nonatomic, copy) NSString *name; + +/** + Gets the `PFRelation` for the `PFUser` objects that are direct children of this role. + + These users are granted any privileges that this role has been granted + (e.g. read or write access through ACLs). You can add or remove users from + the role through this relation. + */ +@property (nonatomic, strong, readonly) PFRelation *users; + +/** + Gets the `PFRelation` for the `PFRole` objects that are direct children of this role. + + These roles' users are granted any privileges that this role has been granted + (e.g. read or write access through ACLs). You can add or remove child roles + from this role through this relation. + */ +@property (nonatomic, strong, readonly) PFRelation *roles; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFSession.h b/Parse.framework/Headers/PFSession.h new file mode 100644 index 0000000..ff9e271 --- /dev/null +++ b/Parse.framework/Headers/PFSession.h @@ -0,0 +1,52 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +@class PFSession; + +typedef void(^PFSessionResultBlock)(PFSession *__nullable session, NSError *__nullable error); + +/** + `PFSession` is a local representation of a session. + This class is a subclass of a `PFObject`, + and retains the same functionality as any other subclass of `PFObject`. + */ +@interface PFSession : PFObject + +/** + The session token string for this session. + */ +@property (nullable, nonatomic, copy, readonly) NSString *sessionToken; + +/** + *Asynchronously* fetches a `PFSession` object related to the current user. + + @return A task that is `completed` with an instance of `PFSession` class or is `faulted` if the operation fails. + */ ++ (BFTask PF_GENERIC(PFSession *)*)getCurrentSessionInBackground; + +/** + *Asynchronously* fetches a `PFSession` object related to the current user. + + @param block The block to execute when the operation completes. + It should have the following argument signature: `^(PFSession *session, NSError *error)`. + */ ++ (void)getCurrentSessionInBackgroundWithBlock:(nullable PFSessionResultBlock)block; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFSubclassing.h b/Parse.framework/Headers/PFSubclassing.h new file mode 100644 index 0000000..6ccc3c5 --- /dev/null +++ b/Parse.framework/Headers/PFSubclassing.h @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +@class PFQuery PF_GENERIC(PFGenericObject : PFObject *); + +NS_ASSUME_NONNULL_BEGIN + +/** + If a subclass of `PFObject` conforms to `PFSubclassing` and calls `PFObject.+registerSubclass`, + Parse framework will be able to use that class as the native class for a Parse cloud object. + + Classes conforming to this protocol should subclass `PFObject` and + include `PFObject+Subclass.h` in their implementation file. + This ensures the methods in the Subclass category of `PFObject` are exposed in its subclasses only. + */ +@protocol PFSubclassing + +@required + +/** + The name of the class as seen in the REST API. + */ ++ (NSString *)parseClassName; + +@optional + +/** + Constructs an object of the most specific class known to implement `+parseClassName`. + + This method takes care to help `PFObject` subclasses be subclassed themselves. + For example, `PFUser.+object` returns a `PFUser` by default but will return an + object of a registered subclass instead if one is known. + A default implementation is provided by `PFObject` which should always be sufficient. + + @return Returns the object that is instantiated. + */ ++ (instancetype)object; + +/** + Creates a reference to an existing PFObject for use in creating associations between PFObjects. + + Calling `PFObject.dataAvailable` on this object will return `NO` + until `PFObject.-fetchIfNeeded` has been called. No network request will be made. + A default implementation is provided by `PFObject` which should always be sufficient. + + @param objectId The object id for the referenced object. + + @return A new `PFObject` without data. + */ ++ (instancetype)objectWithoutDataWithObjectId:(nullable NSString *)objectId; + +/** + Create a query which returns objects of this type. + + A default implementation is provided by `PFObject` which should always be sufficient. + */ ++ (nullable PFQuery *)query; + +/** + Returns a query for objects of this type with a given predicate. + + A default implementation is provided by `PFObject` which should always be sufficient. + + @param predicate The predicate to create conditions from. + + @return An instance of `PFQuery`. + + @see [PFQuery queryWithClassName:predicate:] + */ ++ (nullable PFQuery *)queryWithPredicate:(nullable NSPredicate *)predicate; + +/** + Lets Parse know this class should be used to instantiate all objects with class type `parseClassName`. + + @warning This method must be called before `Parse.+setApplicationId:clientKey:`. + */ ++ (void)registerSubclass; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFUser.h b/Parse.framework/Headers/PFUser.h new file mode 100644 index 0000000..34cd890 --- /dev/null +++ b/Parse.framework/Headers/PFUser.h @@ -0,0 +1,519 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +typedef void(^PFUserSessionUpgradeResultBlock)(NSError *__nullable error); +typedef void(^PFUserLogoutResultBlock)(NSError *__nullable error); + +@class PFQuery PF_GENERIC(PFGenericObject : PFObject *); +@protocol PFUserAuthenticationDelegate; + +/** + The `PFUser` class is a local representation of a user persisted to the Parse Data. + This class is a subclass of a `PFObject`, and retains the same functionality of a `PFObject`, + but also extends it with various user specific methods, like authentication, signing up, and validation uniqueness. + + Many APIs responsible for linking a `PFUser` with Facebook or Twitter have been deprecated in favor of dedicated + utilities for each social network. See `PFFacebookUtils`, `PFTwitterUtils` and `PFAnonymousUtils` for more information. + */ + +@interface PFUser : PFObject + +///-------------------------------------- +/// @name Accessing the Current User +///-------------------------------------- + +/** + Gets the currently logged in user from disk and returns an instance of it. + + @return Returns a `PFUser` that is the currently logged in user. If there is none, returns `nil`. + */ ++ (nullable instancetype)currentUser; + +/** + The session token for the `PFUser`. + + This is set by the server upon successful authentication. + */ +@property (nullable, nonatomic, copy, readonly) NSString *sessionToken; + +/** + Whether the `PFUser` was just created from a request. + + This is only set after a Facebook or Twitter login. + */ +@property (nonatomic, assign, readonly) BOOL isNew; + +/** + Whether the user is an authenticated object for the device. + + An authenticated `PFUser` is one that is obtained via a `-signUp:` or `+logInWithUsername:password:` method. + An authenticated object is required in order to save (with altered values) or delete it. + */ +@property (nonatomic, assign, readonly, getter=isAuthenticated) BOOL authenticated; + +///-------------------------------------- +/// @name Creating a New User +///-------------------------------------- + +/** + Creates a new `PFUser` object. + + @return Returns a new `PFUser` object. + */ ++ (instancetype)user; + +/** + Enables automatic creation of anonymous users. + + After calling this method, `+currentUser` will always have a value. + The user will only be created on the server once the user has been saved, + or once an object with a relation to that user or an ACL that refers to the user has been saved. + + @warning `PFObject.-saveEventually` will not work on if an item being saved has a relation + to an automatic user that has never been saved. + */ ++ (void)enableAutomaticUser; + +/** + The username for the `PFUser`. + */ +@property (nullable, nonatomic, strong) NSString *username; + +/**! + The password for the `PFUser`. + + This will not be filled in from the server with the password. + It is only meant to be set. + */ +@property (nullable, nonatomic, strong) NSString *password; + +/** + The email for the `PFUser`. + */ +@property (nullable, nonatomic, strong) NSString *email; + +/** + Signs up the user *synchronously*. + + This will also enforce that the username isn't already taken. + + @warning Make sure that password and username are set before calling this method. + + @return Returns `YES` if the sign up was successful, otherwise `NO`. + */ +- (BOOL)signUp PF_SWIFT_UNAVAILABLE; + +/** + Signs up the user *synchronously*. + + This will also enforce that the username isn't already taken. + + @warning Make sure that password and username are set before calling this method. + + @param error Error object to set on error. + + @return Returns whether the sign up was successful. + */ +- (BOOL)signUp:(NSError **)error; + +/** + Signs up the user *asynchronously*. + + This will also enforce that the username isn't already taken. + + @warning Make sure that password and username are set before calling this method. + + @return The task, that encapsulates the work being done. + */ +- (BFTask PF_GENERIC(NSNumber *)*)signUpInBackground; + +/** + Signs up the user *asynchronously*. + + This will also enforce that the username isn't already taken. + + @warning Make sure that password and username are set before calling this method. + + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ +- (void)signUpInBackgroundWithBlock:(nullable PFBooleanResultBlock)block; + +/** + Signs up the user *asynchronously*. + + This will also enforce that the username isn't already taken. + + @warning Make sure that password and username are set before calling this method. + + @param target Target object for the selector. + @param selector The selector that will be called when the asynchrounous request is complete. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ +- (void)signUpInBackgroundWithTarget:(nullable id)target selector:(nullable SEL)selector; + +///-------------------------------------- +/// @name Logging In +///-------------------------------------- + +/** + Makes a *synchronous* request to login a user with specified credentials. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param username The username of the user. + @param password The password of the user. + + @return Returns an instance of the `PFUser` on success. + If login failed for either wrong password or wrong username, returns `nil`. + */ ++ (nullable instancetype)logInWithUsername:(NSString *)username + password:(NSString *)password PF_SWIFT_UNAVAILABLE; + +/** + Makes a *synchronous* request to login a user with specified credentials. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param username The username of the user. + @param password The password of the user. + @param error The error object to set on error. + + @return Returns an instance of the `PFUser` on success. + If login failed for either wrong password or wrong username, returns `nil`. + */ ++ (nullable instancetype)logInWithUsername:(NSString *)username + password:(NSString *)password + error:(NSError **)error; + +/** + Makes an *asynchronous* request to login a user with specified credentials. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param username The username of the user. + @param password The password of the user. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(__kindof PFUser *)*)logInWithUsernameInBackground:(NSString *)username + password:(NSString *)password; + +/** + Makes an *asynchronous* request to login a user with specified credentials. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param username The username of the user. + @param password The password of the user. + @param target Target object for the selector. + @param selector The selector that will be called when the asynchrounous request is complete. + It should have the following signature: `(void)callbackWithUser:(PFUser *)user error:(NSError *)error`. + */ ++ (void)logInWithUsernameInBackground:(NSString *)username + password:(NSString *)password + target:(nullable id)target + selector:(nullable SEL)selector; + +/** + Makes an *asynchronous* request to log in a user with specified credentials. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param username The username of the user. + @param password The password of the user. + @param block The block to execute. + It should have the following argument signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)logInWithUsernameInBackground:(NSString *)username + password:(NSString *)password + block:(nullable PFUserResultBlock)block; + +///-------------------------------------- +/// @name Becoming a User +///-------------------------------------- + +/** + Makes a *synchronous* request to become a user with the given session token. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param sessionToken The session token for the user. + + @return Returns an instance of the `PFUser` on success. + If becoming a user fails due to incorrect token, it returns `nil`. + */ ++ (nullable instancetype)become:(NSString *)sessionToken PF_SWIFT_UNAVAILABLE; + +/** + Makes a *synchronous* request to become a user with the given session token. + + Returns an instance of the successfully logged in `PFUser`. + This will also cache the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param sessionToken The session token for the user. + @param error The error object to set on error. + + @return Returns an instance of the `PFUser` on success. + If becoming a user fails due to incorrect token, it returns `nil`. + */ ++ (nullable instancetype)become:(NSString *)sessionToken error:(NSError **)error; + +/** + Makes an *asynchronous* request to become a user with the given session token. + + Returns an instance of the successfully logged in `PFUser`. + This also caches the user locally so that calls to `+currentUser` will use the latest logged in user. + + @param sessionToken The session token for the user. + + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(__kindof PFUser *)*)becomeInBackground:(NSString *)sessionToken; + +/** + Makes an *asynchronous* request to become a user with the given session token. + + Returns an instance of the successfully logged in `PFUser`. This also caches the user locally + so that calls to `+currentUser` will use the latest logged in user. + + @param sessionToken The session token for the user. + @param block The block to execute. + The block should have the following argument signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)becomeInBackground:(NSString *)sessionToken block:(nullable PFUserResultBlock)block; + +/** + Makes an *asynchronous* request to become a user with the given session token. + + Returns an instance of the successfully logged in `PFUser`. This also caches the user locally + so that calls to `+currentUser` will use the latest logged in user. + + @param sessionToken The session token for the user. + @param target Target object for the selector. + @param selector The selector that will be called when the asynchrounous request is complete. + It should have the following signature: `(void)callbackWithUser:(PFUser *)user error:(NSError *)error`. + */ ++ (void)becomeInBackground:(NSString *)sessionToken + target:(__nullable id)target + selector:(__nullable SEL)selector; + +///-------------------------------------- +/// @name Revocable Session +///-------------------------------------- + +/** + Enables revocable sessions and migrates the currentUser session token to use revocable session if needed. + + This method is required if you want to use `PFSession` APIs + and your application's 'Require Revocable Session' setting is turned off on `http://parse.com` app settings. + After returned `BFTask` completes - `PFSession` class and APIs will be available for use. + + @return An instance of `BFTask` that is completed when revocable + sessions are enabled and currentUser token is migrated. + */ ++ (BFTask *)enableRevocableSessionInBackground; + +/** + Enables revocable sessions and upgrades the currentUser session token to use revocable session if needed. + + This method is required if you want to use `PFSession` APIs + and legacy sessions are enabled in your application settings on `http://parse.com/`. + After returned `BFTask` completes - `PFSession` class and APIs will be available for use. + + @param block Block that will be called when revocable sessions are enabled and currentUser token is migrated. + */ ++ (void)enableRevocableSessionInBackgroundWithBlock:(nullable PFUserSessionUpgradeResultBlock)block; + +///-------------------------------------- +/// @name Logging Out +///-------------------------------------- + +/** + *Synchronously* logs out the currently logged in user on disk. + */ ++ (void)logOut; + +/** + *Asynchronously* logs out the currently logged in user. + + This will also remove the session from disk, log out of linked services + and all future calls to `+currentUser` will return `nil`. This is preferrable to using `-logOut`, + unless your code is already running from a background thread. + + @return An instance of `BFTask`, that is resolved with `nil` result when logging out completes. + */ ++ (BFTask *)logOutInBackground; + +/** + *Asynchronously* logs out the currently logged in user. + + This will also remove the session from disk, log out of linked services + and all future calls to `+currentUser` will return `nil`. This is preferrable to using `-logOut`, + unless your code is already running from a background thread. + + @param block A block that will be called when logging out completes or fails. + */ ++ (void)logOutInBackgroundWithBlock:(nullable PFUserLogoutResultBlock)block; + +///-------------------------------------- +/// @name Requesting a Password Reset +///-------------------------------------- + +/** + *Synchronously* Send a password reset request for a specified email. + + If a user account exists with that email, an email will be sent to that address + with instructions on how to reset their password. + + @param email Email of the account to send a reset password request. + + @return Returns `YES` if the reset email request is successful. `NO` - if no account was found for the email address. + */ ++ (BOOL)requestPasswordResetForEmail:(NSString *)email PF_SWIFT_UNAVAILABLE; + +/** + *Synchronously* send a password reset request for a specified email and sets an error object. + + If a user account exists with that email, an email will be sent to that address + with instructions on how to reset their password. + + @param email Email of the account to send a reset password request. + @param error Error object to set on error. + @return Returns `YES` if the reset email request is successful. `NO` - if no account was found for the email address. + */ ++ (BOOL)requestPasswordResetForEmail:(NSString *)email error:(NSError **)error; + +/** + Send a password reset request asynchronously for a specified email and sets an + error object. If a user account exists with that email, an email will be sent to + that address with instructions on how to reset their password. + @param email Email of the account to send a reset password request. + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)requestPasswordResetForEmailInBackground:(NSString *)email; + +/** + Send a password reset request *asynchronously* for a specified email. + + If a user account exists with that email, an email will be sent to that address + with instructions on how to reset their password. + + @param email Email of the account to send a reset password request. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)requestPasswordResetForEmailInBackground:(NSString *)email + block:(nullable PFBooleanResultBlock)block; + +/** + Send a password reset request *asynchronously* for a specified email and sets an error object. + + If a user account exists with that email, an email will be sent to that address + with instructions on how to reset their password. + + @param email Email of the account to send a reset password request. + @param target Target object for the selector. + @param selector The selector that will be called when the asynchronous request is complete. + It should have the following signature: `(void)callbackWithResult:(NSNumber *)result error:(NSError *)error`. + `error` will be `nil` on success and set if there was an error. + `[result boolValue]` will tell you whether the call succeeded or not. + */ ++ (void)requestPasswordResetForEmailInBackground:(NSString *)email + target:(__nullable id)target + selector:(__nullable SEL)selector; + +///-------------------------------------- +/// @name Third-party Authentication +///-------------------------------------- + +/** + Registers a third party authentication delegate. + + @note This method shouldn't be invoked directly unless developing a third party authentication library. + @see PFUserAuthenticationDelegate + + @param delegate The third party authenticaiton delegate to be registered. + @param authType The name of the type of third party authentication source. + */ ++ (void)registerAuthenticationDelegate:(id)delegate forAuthType:(NSString *)authType; + +/** + Logs in a user with third party authentication credentials. + + @note This method shouldn't be invoked directly unless developing a third party authentication library. + @see PFUserAuthenticationDelegate + + @param authType The name of the type of third party authentication source. + @param authData The user credentials of the third party authentication source. + + @return A `BFTask` that is resolved to `PFUser` when logging in completes. + */ ++ (BFTask PF_GENERIC(PFUser *)*)logInWithAuthTypeInBackground:(NSString *)authType + authData:(NSDictionary PF_GENERIC(NSString *, NSString *)*)authData; + +/** + Links this user to a third party authentication library. + + @note This method shouldn't be invoked directly unless developing a third party authentication library. + @see PFUserAuthenticationDelegate + + @param authType The name of the type of third party authentication source. + @param authData The user credentials of the third party authentication source. + + @return A `BFTask` that is resolved to `@YES` if linking succeeds. + */ +- (BFTask PF_GENERIC(NSNumber *)*)linkWithAuthTypeInBackground:(NSString *)authType + authData:(NSDictionary PF_GENERIC(NSString *, NSString *)*)authData; + +/** + Unlinks this user from a third party authentication library. + + @note This method shouldn't be invoked directly unless developing a third party authentication library. + @see PFUserAuthenticationDelegate + + @param authType The name of the type of third party authentication source. + + @return A `BFTask` that is resolved to `@YES` if unlinking succeeds. + */ +- (BFTask PF_GENERIC(NSNumber *)*)unlinkWithAuthTypeInBackground:(NSString *)authType; + +/** + Indicates whether this user is linked with a third party authentication library of a specific type. + + @note This method shouldn't be invoked directly unless developing a third party authentication library. + @see PFUserAuthenticationDelegate + + @param authType The name of the type of third party authentication source. + + @return `YES` if the user is linked with a provider, otherwise `NO`. + */ +- (BOOL)isLinkedWithAuthType:(NSString *)authType; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/PFUserAuthenticationDelegate.h b/Parse.framework/Headers/PFUserAuthenticationDelegate.h new file mode 100644 index 0000000..9c1eea7 --- /dev/null +++ b/Parse.framework/Headers/PFUserAuthenticationDelegate.h @@ -0,0 +1,36 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + Provides a general interface for delegation of third party authentication with `PFUser`s. + */ +@protocol PFUserAuthenticationDelegate + +/** + Called when restoring third party authentication credentials that have been serialized, + such as session keys, user id, etc. + + @note This method will be executed on a background thread. + + @param authData The auth data for the provider. This value may be `nil` when unlinking an account. + + @return `YES` - if the `authData` was succesfully synchronized, + or `NO` if user should not longer be associated because of bad `authData`. + */ +- (BOOL)restoreAuthenticationWithAuthData:(nullable NSDictionary PF_GENERIC(NSString *, NSString *)*)authData; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Headers/Parse.h b/Parse.framework/Headers/Parse.h new file mode 100644 index 0000000..8783589 --- /dev/null +++ b/Parse.framework/Headers/Parse.h @@ -0,0 +1,200 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import + +#if TARGET_OS_IOS + +#import +#import +#import +#import +#import + +#elif PF_TARGET_OS_OSX + +#import +#import + +#elif TARGET_OS_TV + +#import +#import + +#endif + +NS_ASSUME_NONNULL_BEGIN + +/** + The `Parse` class contains static functions that handle global configuration for the Parse framework. + */ +@interface Parse : NSObject + +///-------------------------------------- +/// @name Connecting to Parse +///-------------------------------------- + +/** + Sets the applicationId and clientKey of your application. + + @param applicationId The application id of your Parse application. + @param clientKey The client key of your Parse application. + */ ++ (void)setApplicationId:(NSString *)applicationId clientKey:(NSString *)clientKey; + +/** + The current application id that was used to configure Parse framework. + */ ++ (NSString *)getApplicationId; + +/** + The current client key that was used to configure Parse framework. + */ ++ (NSString *)getClientKey; + +///-------------------------------------- +/// @name Enabling Local Datastore +///-------------------------------------- + +/** + Enable pinning in your application. This must be called before your application can use + pinning. The recommended way is to call this method before `+setApplicationId:clientKey:`. + */ ++ (void)enableLocalDatastore PF_TV_UNAVAILABLE; + +/** + Flag that indicates whether Local Datastore is enabled. + + @return `YES` if Local Datastore is enabled, otherwise `NO`. + */ ++ (BOOL)isLocalDatastoreEnabled PF_TV_UNAVAILABLE; + +///-------------------------------------- +/// @name Enabling Extensions Data Sharing +///-------------------------------------- + +/** + Enables data sharing with an application group identifier. + + After enabling - Local Datastore, `PFUser.+currentUser`, `PFInstallation.+currentInstallation` and all eventually commands + are going to be available to every application/extension in a group that have the same Parse applicationId. + + @warning This method is required to be called before `+setApplicationId:clientKey:`. + + @param groupIdentifier Application Group Identifier to share data with. + */ ++ (void)enableDataSharingWithApplicationGroupIdentifier:(NSString *)groupIdentifier PF_EXTENSION_UNAVAILABLE("Use `enableDataSharingWithApplicationGroupIdentifier:containingApplication:`.") PF_WATCH_UNAVAILABLE PF_TV_UNAVAILABLE; + +/** + Enables data sharing with an application group identifier. + + After enabling - Local Datastore, `PFUser.+currentUser`, `PFInstallation.+currentInstallation` and all eventually commands + are going to be available to every application/extension in a group that have the same Parse applicationId. + + @warning This method is required to be called before `+setApplicationId:clientKey:`. + This method can only be used by application extensions. + + @param groupIdentifier Application Group Identifier to share data with. + @param bundleIdentifier Bundle identifier of the containing application. + */ ++ (void)enableDataSharingWithApplicationGroupIdentifier:(NSString *)groupIdentifier + containingApplication:(NSString *)bundleIdentifier PF_WATCH_UNAVAILABLE PF_TV_UNAVAILABLE; + +/** + Application Group Identifier for Data Sharing. + + @return `NSString` value if data sharing is enabled, otherwise `nil`. + */ ++ (NSString *)applicationGroupIdentifierForDataSharing PF_WATCH_UNAVAILABLE PF_TV_UNAVAILABLE; + +/** + Containing application bundle identifier for Data Sharing. + + @return `NSString` value if data sharing is enabled, otherwise `nil`. + */ ++ (NSString *)containingApplicationBundleIdentifierForDataSharing PF_WATCH_UNAVAILABLE PF_TV_UNAVAILABLE; + +#if PARSE_IOS_ONLY + +///-------------------------------------- +/// @name Configuring UI Settings +///-------------------------------------- + +/** + Set whether to show offline messages when using a Parse view or view controller related classes. + + @param enabled Whether a `UIAlertView` should be shown when the device is offline + and network access is required from a view or view controller. + + @deprecated This method has no effect. + */ ++ (void)offlineMessagesEnabled:(BOOL)enabled PARSE_DEPRECATED("This method is deprecated and has no effect."); + +/** + Set whether to show an error message when using a Parse view or view controller related classes + and a Parse error was generated via a query. + + @param enabled Whether a `UIAlertView` should be shown when an error occurs. + + @deprecated This method has no effect. + */ ++ (void)errorMessagesEnabled:(BOOL)enabled PARSE_DEPRECATED("This method is deprecated and has no effect."); + +#endif + +///-------------------------------------- +/// @name Logging +///-------------------------------------- + +/** + Sets the level of logging to display. + + By default: + - If running inside an app that was downloaded from iOS App Store - it is set to `PFLogLevelNone` + - All other cases - it is set to `PFLogLevelWarning` + + @param logLevel Log level to set. + @see PFLogLevel + */ ++ (void)setLogLevel:(PFLogLevel)logLevel; + +/** + Log level that will be displayed. + + By default: + + - If running inside an app that was downloaded from iOS App Store - it is set to `PFLogLevelNone` + - All other cases - it is set to `PFLogLevelWarning` + + @return A `PFLogLevel` value. + @see PFLogLevel + */ ++ (PFLogLevel)logLevel; + +@end + +NS_ASSUME_NONNULL_END diff --git a/Parse.framework/Info.plist b/Parse.framework/Info.plist new file mode 100644 index 0000000..11d33c7 Binary files /dev/null and b/Parse.framework/Info.plist differ diff --git a/Parse.framework/Modules/module.modulemap b/Parse.framework/Modules/module.modulemap new file mode 100644 index 0000000..32a75e9 --- /dev/null +++ b/Parse.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Parse { + umbrella header "Parse.h" + + export * + module * { export * } +} diff --git a/Parse.framework/Parse b/Parse.framework/Parse new file mode 100644 index 0000000..3d5b100 Binary files /dev/null and b/Parse.framework/Parse differ diff --git a/Parse.framework/en.lproj/Parse.strings b/Parse.framework/en.lproj/Parse.strings new file mode 100644 index 0000000..815195a Binary files /dev/null and b/Parse.framework/en.lproj/Parse.strings differ diff --git a/Parse.framework/third_party_licenses.txt b/Parse.framework/third_party_licenses.txt new file mode 100644 index 0000000..a49d8d1 --- /dev/null +++ b/Parse.framework/third_party_licenses.txt @@ -0,0 +1,68 @@ +THE FOLLOWING SETS FORTH ATTRIBUTION NOTICES FOR THIRD PARTY SOFTWARE THAT MAY BE CONTAINED IN PORTIONS OF THE PARSE PRODUCT. + +----- + +The following software may be included in this product: OAuthCore. This software contains the following license and notice below: + +Copyright (C) 2012 Loren Brichter + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +----- + +The following software may be included in this product: google-breakpad. This software contains the following license and notice below: + +Copyright (c) 2006, Google Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above +copyright notice, this list of conditions and the following disclaimer +in the documentation and/or other materials provided with the +distribution. +* Neither the name of Google Inc. nor the names of its +contributors may be used to endorse or promote products derived from +this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +-------------------------------------------------------------------- + +Copyright 2001-2004 Unicode, Inc. + +Disclaimer + +This source code is provided as is by Unicode, Inc. No claims are +made as to fitness for any particular purpose. No warranties of any +kind are expressed or implied. The recipient agrees to determine +applicability of information provided. If this file has been +purchased on magnetic or optical media from Unicode, Inc., the +sole remedy for any claim will be exchange of defective media +within 90 days of receipt. + +Limitations on Rights to Redistribute This Code + +Unicode, Inc. hereby grants the right to freely use the information +supplied in this file in the creation of products supporting the +Unicode Standard, and to make copies of this file in any form +for internal or external distribution as long as this notice +remains attached. diff --git a/ParseFacebookUtilsV4.framework/Headers/PFFacebookUtils.h b/ParseFacebookUtilsV4.framework/Headers/PFFacebookUtils.h new file mode 100644 index 0000000..a512468 --- /dev/null +++ b/ParseFacebookUtilsV4.framework/Headers/PFFacebookUtils.h @@ -0,0 +1,271 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import + +#import + +#import +#import + +#import + +#if TARGET_OS_IOS +#import +#endif + +NS_ASSUME_NONNULL_BEGIN + +/** + The `PFFacebookUtils` class provides utility functions for using Facebook authentication with `PFUser`s. + + @warning This class supports official Facebook iOS SDK v4.0+ and is available only on iOS. + */ +@interface PFFacebookUtils : NSObject + +///-------------------------------------- +/// @name Interacting With Facebook +///-------------------------------------- + +/** + Initializes Parse Facebook Utils. + + You must provide your Facebook application ID as the value for FacebookAppID in your bundle's plist file + as described here: https://developers.facebook.com/docs/getting-started/facebook-sdk-for-ios/ + + @warning You must invoke this in order to use the Facebook functionality in Parse. + + @param launchOptions The launchOptions as passed to [UIApplicationDelegate application:didFinishLaunchingWithOptions:]. + */ ++ (void)initializeFacebookWithApplicationLaunchOptions:(nullable NSDictionary *)launchOptions; + +#if TARGET_OS_IOS +/** + `FBSDKLoginManager` provides methods for configuring login behavior, default audience + and managing Facebook Access Token. + + @warning This method is available only on iOS. + + @return An instance of `FBSDKLoginManager` that is used by `PFFacebookUtils`. + */ ++ (FBSDKLoginManager *)facebookLoginManager; +#endif + +///-------------------------------------- +/// @name Logging In +///-------------------------------------- + +/** + *Asynchronously* logs in a user using Facebook with read permissions. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param permissions Array of read permissions to use. + + @return The task that has will a have `result` set to `PFUser` if operation succeeds. + */ ++ (BFTask PF_GENERIC(PFUser *)*)logInInBackgroundWithReadPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions; + +/** + *Asynchronously* logs in a user using Facebook with read permissions. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param permissions Array of read permissions to use. + @param block The block to execute when the log in completes. + It should have the following signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)logInInBackgroundWithReadPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions + block:(nullable PFUserResultBlock)block; + +/** + *Asynchronously* logs in a user using Facebook with publish permissions. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param permissions Array of publish permissions to use. + + @return The task that has will a have `result` set to `PFUser` if operation succeeds. + */ ++ (BFTask PF_GENERIC(PFUser *)*)logInInBackgroundWithPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions; + +/** + *Asynchronously* logs in a user using Facebook with publish permissions. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param permissions Array of publish permissions to use. + @param block The block to execute when the log in completes. + It should have the following signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)logInInBackgroundWithPublishPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions + block:(nullable PFUserResultBlock)block; + +/** + *Asynchronously* logs in a user using given Facebook Acess Token. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param accessToken An instance of `FBSDKAccessToken` to use when logging in. + + @return The task that has will a have `result` set to `PFUser` if operation succeeds. + */ ++ (BFTask PF_GENERIC(PFUser *)*)logInInBackgroundWithAccessToken:(FBSDKAccessToken *)accessToken; + +/** + *Asynchronously* logs in a user using given Facebook Acess Token. + + This method delegates to the Facebook SDK to authenticate the user, + and then automatically logs in (or creates, in the case where it is a new user) a `PFUser`. + + @param accessToken An instance of `FBSDKAccessToken` to use when logging in. + @param block The block to execute when the log in completes. + It should have the following signature: `^(PFUser *user, NSError *error)`. + */ ++ (void)logInInBackgroundWithAccessToken:(FBSDKAccessToken *)accessToken + block:(nullable PFUserResultBlock)block; + +///-------------------------------------- +/// @name Linking Users +///-------------------------------------- + +/** + *Asynchronously* links Facebook with read permissions to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param permissions Array of read permissions to use when logging in with Facebook. + + @return The task that will have a `result` set to `@YES` if operation succeeds. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user + withReadPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions; + +/** + *Asynchronously* links Facebook with read permissions to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param permissions Array of read permissions to use. + @param block The block to execute when the linking completes. + It should have the following signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)linkUserInBackground:(PFUser *)user + withReadPermissions:(nullable NSArray PF_GENERIC(NSString *)*)permissions + block:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* links Facebook with publish permissions to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param permissions Array of publish permissions to use. + + @return The task that will have a `result` set to `@YES` if operation succeeds. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user + withPublishPermissions:(NSArray PF_GENERIC(NSString *)*)permissions; + +/** + *Asynchronously* links Facebook with publish permissions to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param permissions Array of publish permissions to use. + @param block The block to execute when the linking completes. + It should have the following signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)linkUserInBackground:(PFUser *)user + withPublishPermissions:(NSArray PF_GENERIC(NSString *)*)permissions + block:(nullable PFBooleanResultBlock)block; + +/** + *Asynchronously* links Facebook Access Token to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param accessToken An instance of `FBSDKAccessToken` to use. + + @return The task that will have a `result` set to `@YES` if operation succeeds. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)linkUserInBackground:(PFUser *)user withAccessToken:(FBSDKAccessToken *)accessToken; + +/** + *Asynchronously* links Facebook Access Token to an existing `PFUser`. + + This method delegates to the Facebook SDK to authenticate + the user, and then automatically links the account to the `PFUser`. + It will also save any unsaved changes that were made to the `user`. + + @param user User to link to Facebook. + @param accessToken An instance of `FBSDKAccessToken` to use. + @param block The block to execute when the linking completes. + It should have the following signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)linkUserInBackground:(PFUser *)user + withAccessToken:(FBSDKAccessToken *)accessToken + block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Unlinking Users +///-------------------------------------- + +/** + Unlinks the `PFUser` from a Facebook account *asynchronously*. + + @param user User to unlink from Facebook. + @return The task, that encapsulates the work being done. + */ ++ (BFTask PF_GENERIC(NSNumber *)*)unlinkUserInBackground:(PFUser *)user; + +/** + Unlinks the `PFUser` from a Facebook account *asynchronously*. + + @param user User to unlink from Facebook. + @param block The block to execute. + It should have the following argument signature: `^(BOOL succeeded, NSError *error)`. + */ ++ (void)unlinkUserInBackground:(PFUser *)user block:(nullable PFBooleanResultBlock)block; + +///-------------------------------------- +/// @name Getting Linked State +///-------------------------------------- + +/** + Whether the user has their account linked to Facebook. + + @param user User to check for a facebook link. The user must be logged in on this device. + + @return `YES` if the user has their account linked to Facebook, otherwise `NO`. + */ ++ (BOOL)isLinkedWithUser:(PFUser *)user; + +@end + +NS_ASSUME_NONNULL_END diff --git a/ParseFacebookUtilsV4.framework/Headers/ParseFacebookUtilsV4.h b/ParseFacebookUtilsV4.framework/Headers/ParseFacebookUtilsV4.h new file mode 100644 index 0000000..367bb44 --- /dev/null +++ b/ParseFacebookUtilsV4.framework/Headers/ParseFacebookUtilsV4.h @@ -0,0 +1,10 @@ +/** + * Copyright (c) 2015-present, Parse, LLC. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + */ + +#import diff --git a/ParseFacebookUtilsV4.framework/Info.plist b/ParseFacebookUtilsV4.framework/Info.plist new file mode 100644 index 0000000..7492b3a Binary files /dev/null and b/ParseFacebookUtilsV4.framework/Info.plist differ diff --git a/ParseFacebookUtilsV4.framework/Localizable.strings b/ParseFacebookUtilsV4.framework/Localizable.strings new file mode 100644 index 0000000..3967e06 Binary files /dev/null and b/ParseFacebookUtilsV4.framework/Localizable.strings differ diff --git a/ParseFacebookUtilsV4.framework/Modules/module.modulemap b/ParseFacebookUtilsV4.framework/Modules/module.modulemap new file mode 100644 index 0000000..778d3f8 --- /dev/null +++ b/ParseFacebookUtilsV4.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module ParseFacebookUtilsV4 { + umbrella header "ParseFacebookUtilsV4.h" + + export * + module * { export * } +} diff --git a/ParseFacebookUtilsV4.framework/ParseFacebookUtilsV4 b/ParseFacebookUtilsV4.framework/ParseFacebookUtilsV4 new file mode 100644 index 0000000..73fda95 Binary files /dev/null and b/ParseFacebookUtilsV4.framework/ParseFacebookUtilsV4 differ