HBLibOpener.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /**
  2. * The HBLibOpener class provides the ability to manually register a handler with libopener from a
  3. * tweak, as well as the ability to check if a handler has been disabled by the user.
  4. */
  5. #import "HBLOHandler.h"
  6. /**
  7. * Callback block
  8. */
  9. typedef NSURL * (^HBLOHandlerCallbackBlock)(NSURL *url);
  10. @interface HBLibOpener : NSObject
  11. /**
  12. * Returns the shared instance of the HBLibOpener class.
  13. *
  14. * @returns The shared instance of the HBLibOpener class.
  15. */
  16. + (instancetype)sharedInstance;
  17. /**
  18. * Allows you to register a handler with libopener.
  19. *
  20. * You should call this from all processes that link against the MobileCoreServices framework
  21. * (`com.apple.MobileCoreServices`). See the
  22. * [Cydia Substrate](http://www.cydiasubstrate.com/inject/darwin/) documentation for details on filter
  23. * plists.
  24. *
  25. * @param handler A handler to be registered. See HBLOHandler for more information.
  26. * @param error A pointer to an error object. If an error occurs, this pointer is set to an actual
  27. * error object containing the error information. You may specify nil for this parameter if you do not
  28. * want the error information.
  29. * @returns YES if the handler was registered successfully. Returns NO if an error occurred.
  30. */
  31. - (BOOL)registerHandler:(HBLOHandler *)handler error:(NSError **)error;
  32. /**
  33. * Allows you to register a new legacy handler with libopener.
  34. *
  35. * Supported in SpringBoard only. **Deprecated in libopener 2.0.** Use bundles or
  36. * registerHandler:error: instead.
  37. *
  38. * The old handler API is deprecated. Links in web views are not supported. Migrate to the new API as
  39. * soon as possible.
  40. */
  41. - (BOOL)registerHandlerWithName:(NSString *)name block:(HBLOHandlerCallbackBlock)block;
  42. /**
  43. * Returns whether a handler is enabled or disabled.
  44. *
  45. * @param handler The identifier of the handler.
  46. * @returns YES if the handler is enabled, or uses a custom Preferences list controller. Returns NO if
  47. * the handler has been disabled by the user in the Opener section of Settings.
  48. */
  49. - (BOOL)handlerIsEnabled:(NSString *)handler;
  50. @end