FBFrictionlessRecipientCache.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * Copyright 2010-present Facebook.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FBCacheDescriptor.h"
  18. #import "FBRequest.h"
  19. #import "FBWebDialogs.h"
  20. /*!
  21. @class FBFrictionlessRecipientCache
  22. @abstract
  23. Maintains a cache of friends that can recieve application requests from the user in
  24. using the frictionless feature of the requests web dialog.
  25. This class follows the `FBCacheDescriptor` pattern used elsewhere in the SDK, and applications may call
  26. one of the prefetchAndCacheForSession methods to fetch a friend list prior to the
  27. point where a dialog is presented. The cache is also updated with each presentation of the request
  28. dialog using the cache instance.
  29. */
  30. @interface FBFrictionlessRecipientCache : FBCacheDescriptor<FBWebDialogsDelegate>
  31. /*! @abstract An array containing the list of known FBIDs for recipients enabled for frictionless requests */
  32. @property (nonatomic, readwrite, copy) NSArray *recipientIDs;
  33. /*!
  34. @abstract
  35. Checks to see if a given user or FBID for a user is known to be enabled for
  36. frictionless requestests
  37. @param user An NSString, NSNumber of `FBGraphUser` representing a user to check
  38. */
  39. - (BOOL)isFrictionlessRecipient:(id)user;
  40. /*!
  41. @abstract
  42. Checks to see if a collection of users or FBIDs for users are known to be enabled for
  43. frictionless requestests
  44. @param users An NSArray of NSString, NSNumber of `FBGraphUser` objects
  45. representing users to check
  46. */
  47. - (BOOL)areFrictionlessRecipients:(NSArray *)users;
  48. /*!
  49. @abstract
  50. Issues a request and fills the cache with a list of users to use for frictionless requests
  51. @param session The session to use for the request; nil indicates that the Active Session should
  52. be used
  53. */
  54. - (void)prefetchAndCacheForSession:(FBSession *)session;
  55. /*!
  56. @abstract
  57. Issues a request and fills the cache with a list of users to use for frictionless requests
  58. @param session The session to use for the request; nil indicates that the Active Session should
  59. be used
  60. @param handler An optional completion handler, called when the request for cached users has
  61. completed. It can be useful to use the handler to enable UI or perform other request-related
  62. operations, after the cache is populated.
  63. */
  64. - (void)prefetchAndCacheForSession:(FBSession *)session
  65. completionHandler:(FBRequestHandler)handler;
  66. @end