chore: remove cephei headers

This commit is contained in:
zx
2024-09-03 17:30:13 -04:00
parent 5fe28ee86c
commit 8e9fa1e993
30 changed files with 0 additions and 2145 deletions

View File

@@ -1,8 +0,0 @@
#import "HBOutputForShellCommand.h"
#import "HBPreferences.h"
#import "HBRespringController.h"
#import "NSDictionary+HBAdditions.h"
#import "NSLayoutConstraint+CompactConstraint.h"
#import "NSString+HBAdditions.h"
#import "UIColor+HBAdditions.h"
#import "UIView+CompactConstraint.h"

View File

@@ -1,19 +0,0 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// Executes a shell command and returns its output.
///
/// @param command The shell command to run.
/// @param returnCode A pointer to an integer that will contain the return code of the command.
/// @return The output of the provided command.
FOUNDATION_EXPORT NSString * _Nullable HBOutputForShellCommandWithReturnCode(NSString *command, int *returnCode);
/// Executes a shell command and returns its output.
///
/// @param command The shell command to run.
/// @return The output of the provided command, or nil if the command returned with a code other
/// than 0.
FOUNDATION_EXPORT NSString * _Nullable HBOutputForShellCommand(NSString *command);
NS_ASSUME_NONNULL_END

View File

@@ -1,529 +0,0 @@
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^HBPreferencesChangeCallback)(void);
typedef void (^HBPreferencesValueChangeCallback)(NSString *key, id<NSCopying> _Nullable value);
/// The HBPreferences class in Cephei provides an interface for managing user-defined
/// preferences of a tweak, and the default values used when the user has not yet changed a value.
///
/// `HBPreferences` is very similar to `NSUserDefaults`, however it is specifically tailored to iOS
/// tweak development, since tweaks may be loaded into a sandboxed process (most obviously, App
/// Store apps, but also system apps like Safari), or one that runs as the `root` user (for
/// instance, iFile, although these apps are slowly changing their model so they now run as mobile).
/// In both of these cases, using `NSUserDefaults` will result in reading from preferences inside
/// the sandbox, or inside `root`’s home directory; both of which are not what is expected.
///
/// Advantages `HBPreferences` has over `NSUserDefaults` are:
///
/// - Directly reading the property list from the `mobile` user’s home directory, to support
/// sandboxed apps and apps running as `root`.
/// - Intuitive method of setting a default preference value.
/// - Updating of the app/tweak’s variables when preferences are changed.
/// - Keyed subscripting is allowed, which enables simple array syntax.
/// - Values in the preferences plist are called preferences, not defaults, to avoid ambiguity -
/// `NSUserDefaults` uses “defaults” to refer to both preferences themselves and the fallback values
/// if a key doesn’t exist.
///
/// Ensure you read the discussion for `-registerObject:default:forKey:` before using the automatic
/// updating mechanism. `-objectForKey:` does not update as another process updates the preferences
/// on iOS 7 or older; if you need to support older iOS versions, use the registration methods
/// instead.
///
/// As of Cephei 1.17, HBPreferences supports Key-Value Observation. As such, you may subscribe to
/// changes made to preferences through observer callbacks. The `-registerPreferenceChangeBlock:`
/// and `-registerPreferenceChangeBlockForKey:block:` methods are provided to subscribe to
/// preference changes via a callback block since Cephei 1.3, and you can additionally observe
/// `HBPreferencesDidChangeNotification`.
///
/// ### Example usage
/// In Objective-C/Logos:
///
/// ```logos
/// HBPreferences *preferences;
/// BOOL doThing;
///
/// %ctor {
/// preferences = [[HBPreferences alloc] initWithIdentifier:@"ws.hbang.common.demo"];
/// [preferences registerDefaults:@{
/// @"Enabled": @YES,
/// @"AnotherSetting": @1.f
/// }];
///
/// [preferences registerBool:&doThing default:NO forKey:@"DoThing"];
///
/// NSLog(@"Am I enabled? %i", [preferences boolForKey:@"Enabled"]);
/// NSLog(@"Can I do thing? %i", doThing);
/// }
/// ```
///
/// In Swift:
///
/// ```swift
/// class Preferences {
///
/// private let preferences = HBPreferences(identifier: "ws.hbang.common.demo")
///
/// // Example using registration method
/// private(set) var canDoThing: ObjCBool = false
///
/// // Example using custom getter and setter
/// var anotherSetting: Int {
/// get { preferences["AnotherSetting"] as? Int ?? -1 }
/// set { preferences["AnotherSetting"] = newValue }
/// }
///
/// // Example using KVO observation
/// private var doThingObserver: NSKeyValueObserving?
///
/// init() {
/// preferences.register(defaults: [
/// "Enabled": true,
/// "AnotherSetting": 1
/// ])
///
/// preferences.register(&canDoThing, default: false, forKey: "DoThing")
///
/// print("Am I enabled? \(preferences["Enabled"] as? Bool ?? false)")
/// print("Can I do thing? \(canDoThing)")
/// }
///
/// }
/// ```
///
/// ### References
/// * [NSUserDefaults in Practice](http://dscoder.com/defaults.html)
///
/// ### Security
/// As of Cephei 1.12, HBPreferences restricts most Apple preferences (identifiers starting with
/// `com.apple.…`) from being read/written from a sandboxed process. This protects against a
/// malicious app using HBPreferences as a way to gather sensitive information or change system
/// preferences without the user’s knowledge. For instance, an App Store app could
/// [phish for the user’s Apple ID login](https://krausefx.com/blog/ios-privacy-stealpassword-easily-get-the-users-apple-id-password-just-by-asking),
/// creating a very real-looking login prompt by pre-filling their email address in the username box,
/// or gain access to the numbers/email addresses of people the user has recently contacted.
///
/// There is currently no way to avoid this restriction while still using HBPreferences. If you need
/// access to Apple preferences, design your code to not need to do this from within the sandbox.
/// This could be done [using IPC](http://iphonedevwiki.net/index.php/IPC) from an unsandboxed
/// process such as SpringBoard. Avoid sending sensitive information via IPC to sandboxed apps, as
/// they can still get access to data you send through various ways.
@interface HBPreferences : NSObject
/// @name Initializing an HBPreferences Object
/// Creates an instance of the class for the specified identifier.
///
/// @param identifier The identifier to be used. This is usually the same as the package identifier
/// of the tweak.
/// @return An autoreleased instance of HBPreferences for the specified identifier.
+ (instancetype)preferencesForIdentifier:(NSString *)identifier NS_SWIFT_UNAVAILABLE("");
/// Initializes an instance of the class for the specified identifier.
///
/// @param identifier The identifier to be used. This is usually the same as the package identifier
/// of the tweak.
/// @return An autoreleased instance of HBPreferences for the specified identifier.
- (instancetype)initWithIdentifier:(NSString *)identifier NS_DESIGNATED_INITIALIZER;
/// The preferences identifier provided at initialisation.
@property (nonatomic, retain, readonly) NSString *identifier;
/// @name Synchronizing Preferences
/// Synchronizes preferences data to prevent race conditions.
///
/// On iOS 8.0 and later, waits until all communications between the `cfprefsd` daemon and the
/// current process have completed, preventing race conditions and guaranteeing no data will be
/// lost. Prior to iOS 8.0, writes all pending changes to disk, and reads latest preferences from
/// disk.
///
/// Deprecated. On iOS 12.0 and later, synchronization is
/// [no longer required](https://developer.apple.com/documentation/ios-ipados-release-notes/foundation-release-notes#UserDefaults).
/// The underlying CFPreferencesSynchronize() function simply returns `YES`.
///
/// For earlier iOS releases, do not use this method directly unless you have a specific need.
/// HBPreferences will synchronize automatically when needed. For further information on what this
/// method does and when to use it, refer to
/// [NSUserDefaults in Practice](http://dscoder.com/defaults.html) § “Sharing Defaults Between
/// Programs”.
///
/// @return `YES` if synchronization was successful, `NO` if an error occurred.
- (BOOL)synchronize API_DEPRECATED("Synchronization is no longer required as of iOS 12", ios(5.0, 12.0));
/// @name Registering Default Preference Values
/// The default preferences to be used when no value has been set by the user.
///
/// You may modify the values of this dictionary directly.
@property (nonatomic, copy, readonly) NSMutableDictionary <NSString *, id> *defaults;
/// Adds the contents of the specified dictionary to the defaults property.
///
/// Merges the provided dictionary with the mutable dictionary found on the defaults property.
///
/// @param defaultValues The dictionary of keys and values you want to register.
/// @see `defaults`
- (void)registerDefaults:(NSDictionary <NSString *, id> *)defaultValues NS_SWIFT_NAME(register(defaults:));
/// @name Getting Preference Values
/// Returns a dictionary that contains all preferences that are set.
///
/// This does not include default values.
///
/// @return A dictionary containing all keys and values.
- (NSDictionary <NSString *, id> *)dictionaryRepresentation;
/// Returns the object associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The object associated with the specified key.
/// @warning You must manually synchronize preferences or use `-registerObject:default:forKey:` for
/// this value to be updated when running on iOS 7 or older.
- (id)objectForKey:(NSString *)key;
/// Returns the integer value associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The integer value associated with the specified key.
/// @see `-objectForKey:`
- (NSInteger)integerForKey:(NSString *)key;
/// Returns the unsigned integer value associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The unsigned integer value associated with the specified key.
/// @see `-objectForKey:`
- (NSUInteger)unsignedIntegerForKey:(NSString *)key;
/// Returns the floating-point value associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The floating-point value associated with the specified key.
/// @see `-objectForKey:`
- (CGFloat)floatForKey:(NSString *)key;
/// Returns the double value associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The double value associated with the specified key.
/// @see `-objectForKey:`
- (double)doubleForKey:(NSString *)key;
/// Returns the Boolean value associated with the specified key.
///
/// If the preference is not yet set, returns the default. If no default is set, returns `nil`.
///
/// @param key The key for which to return the corresponding value.
/// @return The Boolean value associated with the specified key.
/// @see `-objectForKey:`
- (BOOL)boolForKey:(NSString *)key;
/// Returns the value associated with a given key.
///
/// This method behaves the same as `-objectForKey:`, and enables the preferences object to be used
/// with a subscript (square brackets). For example:
///
/// Objective-C:
///
/// ```objc
/// NSString *fooBar = preferences[@"FooBar"];
/// preferences[@"Awesome"] = @YES;
/// ```
///
/// Swift:
///
/// ```swift
/// let fooBar = preferences["FooBar"] as? String
/// preferences["Awesome"] = true
/// ```
///
/// @param key The key for which to return the corresponding value.
/// @return The value associated with the specified key.
/// @see `-objectForKey:`
- (id)objectForKeyedSubscript:(id)key;
/// Returns the object associated with the specified key, or if no user preference is set, the
/// provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The object associated with the specified key, or the default value.
- (id)objectForKey:(NSString *)key default:(nullable id)defaultValue;
/// Returns the integer value associated with the specified key, or if no user preference is set,
/// the provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The integer value associated with the specified key, or the default value.
/// @see `-objectForKey:default:`
- (NSInteger)integerForKey:(NSString *)key default:(NSInteger)defaultValue;
/// Returns the unsigned integer value associated with the specified key, or if no user preference
/// is set, the provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The unsigned integer value associated with the specified key, or the default value.
/// @see `-objectForKey:default:`
- (NSUInteger)unsignedIntegerForKey:(NSString *)key default:(NSUInteger)defaultValue;
/// Returns the floating-point value associated with the specified key, or if no user preference is
/// set, the provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The floating-point value associated with the specified key, or the default value.
/// @see `-objectForKey:default:`
- (CGFloat)floatForKey:(NSString *)key default:(CGFloat)defaultValue;
/// Returns the double value associated with the specified key, or if no user preference is set,
/// the provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The double value associated with the specified key, or the default value.
/// @see `-objectForKey:default:`
- (double)doubleForKey:(NSString *)key default:(double)defaultValue;
/// Returns the Boolean value associated with the specified key, or if no user preference is set,
/// the provided default.
///
/// @param key The key for which to return the corresponding value.
/// @param defaultValue The default value to use when no user preference is set.
/// @return The Boolean value associated with the specified key, or the default value.
/// @see `-objectForKey:default:`
- (BOOL)boolForKey:(NSString *)key default:(BOOL)defaultValue;
/// @name Setting Preference Values
/// Sets the value of the specified key.
///
/// You should only call these methods if you are certain that the process is running as the
/// `mobile` user.
///
/// @param value The object to store in the preferences.
/// @param key The key with which to associate with the value.
/// @exception HBPreferencesNotMobileException Thrown when the method is called by a process not
/// running as the `mobile` user.
- (void)setObject:(nullable id)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified integer value.
///
/// This is a convenience method that calls `-setObject:forKey:`. See the discussion of that method
/// for more details.
///
/// @param value The integer value to store in the preferences.
/// @param key The key with which to associate with the value.
/// @see `-setObject:forKey:`
- (void)setInteger:(NSInteger)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified unsigned integer value.
///
/// This is a convenience method that calls `-setObject:forKey:`. See the discussion of that method
/// for more details.
///
/// @param value The unsigned integer value to store in the preferences.
/// @param key The key with which to associate with the value.
/// @see `-setObject:forKey:`
- (void)setUnsignedInteger:(NSUInteger)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified floating-point value.
///
/// This is a convenience method that calls `-setObject:forKey:`. See the discussion of that method
/// for more details.
///
/// @param value The floating-point value to store in the preferences.
/// @param key The key with which to associate with the value.
/// @see `-setObject:forKey:`
- (void)setFloat:(CGFloat)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified double value.
///
/// This is a convenience method that calls `-setObject:forKey:`. See the discussion of that method
/// for more details.
///
/// @param value The double value to store in the preferences.
/// @param key The key with which to associate with the value.
/// @see `-setObject:forKey:`
- (void)setDouble:(double)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified Boolean value.
///
/// This is a convenience method that calls `-setObject:forKey:`. See the discussion of that method
/// for more details.
///
/// @param value The Boolean value to store in the preferences.
/// @param key The key with which to associate with the value.
/// @see `-setObject:forKey:`
- (void)setBool:(BOOL)value forKey:(NSString *)key NS_SWIFT_NAME(set(_:forKey:));
/// Sets the value of the specified key to the specified value.
///
/// This method behaves the same as `-setObject:forKey:`, and enables the preferences object to be
/// used with a subscript (square brackets). For example:
///
/// ```objc
/// NSString *fooBar = preferences[@"FooBar"];
/// preferences[@"Awesome"] = @YES;
/// ```
///
/// @param object The value to store in the preferences.
/// @param key The key with which to associate with the value.
- (void)setObject:(nullable id)object forKeyedSubscript:(id)key;
/// @name Removing Preference Values
/// Removes a given key and its associated value from the dictionary.
///
/// @param key The key to remove.
- (void)removeObjectForKey:(NSString *)key NS_SWIFT_NAME(removeValue(forKey:));
/// Removes all stored preferences.
///
/// This method acts in the same way as discussed in `-removeObjectForKey:`.
- (void)removeAllObjects NS_SWIFT_NAME(removeAll());
/// @name Registering Variables
/// Register an object to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// You must post a Darwin notification after updating preferences for this to work. In particular,
/// it must be set to the value of identifier, followed by `/ReloadPrefs` - for instance,
/// `ws.hbang.common.demo/ReloadPrefs`. In a Preferences specifier property list, you can use the
/// `PostNotification` key on your specifiers to achieve this:
///
/// ```xml
/// <dict>
/// …
/// <key>PostNotification</key>
/// <string>ws.hbang.common.demo/ReloadPrefs</string>
/// </dict>
/// ```
///
/// @param object The pointer to the object.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerObject:(_Nullable id __strong * _Nonnull)object default:(nullable id)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// Register an integer value to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// @param object The pointer to the integer.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerInteger:(NSInteger *)object default:(NSInteger)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// Register an unsigned integer value to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// @param object The pointer to the unsigned integer.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerUnsignedInteger:(NSUInteger *)object default:(NSUInteger)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// Register a floating-point value to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// @param object The pointer to the integer.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerFloat:(CGFloat *)object default:(CGFloat)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// Register a double value to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// @param object The pointer to the double.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerDouble:(double *)object default:(double)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// Register a Boolean value to be automatically set to the user’s preference.
///
/// If the preference is not yet set, the object will be set to the provided default.
///
/// @param object The pointer to the Boolean.
/// @param defaultValue The default value to be used if no user preference is set.
/// @param key The key in the preferences property list.
/// @see `-registerObject:default:forKey:`
- (void)registerBool:(BOOL *)object default:(BOOL)defaultValue forKey:(NSString *)key NS_SWIFT_NAME(register(_:default:forKey:));
/// @name Preference Change Callbacks
/// Register a block to be called when a preference change is detected.
///
/// Blocks are called after HBPreferences’ cache of values is updated. The block will also be called
/// immediately after calling this method. See `registerObject:default:forKey:` for details on how
/// to set up callbacks.
///
/// @param callback A block object called when the specified key’s value changes. The block object
/// takes no parameters and returns no value.
/// @see `-registerObject:default:forKey:`
- (void)registerPreferenceChangeBlock:(HBPreferencesChangeCallback)callback;
/// Register a block to be called when a specific preference is changed.
///
/// Blocks are called after HBPreferences’ cache of values is updated. The block will also be called
/// immediately after calling this method. See `registerObject:default:forKey:` for details on how
/// to set up callbacks.
///
/// @param key The key to listen for.
/// @param callback A block object called when the specified key’s value changes. The block object’s
/// parameters are the key and its new value.
/// @see `-registerObject:default:forKey:`
- (void)registerPreferenceChangeBlockForKey:(NSString *)key block:(HBPreferencesValueChangeCallback)callback;
/// Register a block to be called when a specific preference is changed.
///
/// Blocks are called after HBPreferences’ cache of values is updated. The block will also be called
/// immediately after calling this method. See `-registerObject:default:forKey:` for details on how
/// to set up callbacks.
///
/// Deprecated. This method signature changed in Cephei 1.17 to better support the order of
/// arguments preferred by Swift closure syntax. Use `-registerPreferenceChangeBlockForKey:block:`
/// instead.
///
/// @param callback A block object called when the specified key’s value changes. The block object’s
/// parameters are the key and its new value.
/// @param key The key to listen for.
/// @see `-registerPreferenceChangeBlockForKey:block:`
/// @see `-registerObject:default:forKey:`
- (void)registerPreferenceChangeBlock:(HBPreferencesValueChangeCallback)callback forKey:(NSString *)key __attribute((deprecated("Use registerPreferenceChangeBlockForKey:block: instead.")));
@end
/// Name of an exception that occurs when attempting to set preferences from a process not running
/// as the `mobile` user.
extern NSExceptionName const HBPreferencesNotMobileException NS_SWIFT_NAME(HBPreferences.notMobileException);
/// This notification is posted when a change is made to a registered preferences identifier. The
/// notification object is the associated HBPreferences object.
extern NSNotificationName const HBPreferencesDidChangeNotification NS_SWIFT_NAME(HBPreferences.didChangeNotification);
NS_ASSUME_NONNULL_END

View File

@@ -1,26 +0,0 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// The HBRespringController class in Cephei provides conveniences for restarting the system app
/// (usually SpringBoard). It also ensures battery usage statistics are not lost when performing the
/// restart.
@interface HBRespringController : NSObject
/// Restart the system app.
///
/// On iOS 8.0 and newer, fades out and then returns to the home screen (system remains unlocked).
/// On older iOS versions, a standard restart occurs.
+ (void)respring;
/// Restart the system app and immediately launch a URL.
///
/// Requires iOS 8.0 or newer. On older iOS versions, a standard restart occurs and the URL is not
/// opened.
///
/// @param returnURL The URL to launch after restarting.
+ (void)respringAndReturnTo:(nullable NSURL *)returnURL;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,20 +0,0 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// NSDictionary (HBAdditions) is a class category in Cephei that provides some convenience methods.
@interface NSDictionary (HBAdditions)
/// Constructs and returns an NSString object that is the result of joining the dictionary keys and
/// values into an HTTP query string.
///
/// On iOS 8.0 and newer, this uses the built in NSURLComponents functionality to deserialize the
/// query string. On earlier versions, uses an approximation implemented within Cephei. This
/// implementation is simplistic and does not handle edge cases that NSURLComponents does support.
///
/// @return An NSString containing an HTTP query string.
- (NSString *)hb_queryString;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,34 +0,0 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// NSString (HBAdditions) is a class category in Cephei that provides some convenience methods.
@interface NSString (HBAdditions)
/// Returns a string encoded for an HTTP query parameter.
///
/// This method encodes a variety of symbols that can conflict with other portions of a URL, such as
/// `&` and `=`, and other similar symbols that could otherwise be misinterpreted by some
/// implementations.
///
/// @return A string encoded for an HTTP query parameter.
- (NSString *)hb_stringByEncodingQueryPercentEscapes;
/// Returns a string decoded from an HTTP query parameter.
///
/// This method decodes percent escapes, as well as spaces encoded with a `+`.
///
/// @return A string decoded from an HTTP query parameter.
- (NSString *)hb_stringByDecodingQueryPercentEscapes;
/// Returns a dictionary containing the HTTP query parameters in the string.
///
/// The string is expected to be in the format `key=value&key=value`, with both keys and values
/// encoded where necessary.
///
/// @return An NSDictionary object containing the keys and values from the query string.
- (NSDictionary *)hb_queryStringComponents;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,18 +0,0 @@
#import "HBAboutListController.h"
#import "HBAppearanceSettings.h"
#import "HBDiscreteSliderTableCell.h"
#import "HBImageTableCell.h"
#import "HBInitialsLinkTableCell.h"
#import "HBLinkTableCell.h"
#import "HBListController.h"
#import "HBListController+Actions.h"
#import "HBListItemsController.h"
#import "HBPackageTableCell.h"
#import "HBPackageNameHeaderCell.h"
#import "HBRootListController.h"
#import "HBSpinnerTableCell.h"
#import "HBStepperTableCell.h"
#import "HBSupportController.h"
#import "HBTintedTableCell.h"
#import "HBTwitterCell.h"
#import "PSListController+HBTintAdditions.h"

View File

@@ -1,113 +0,0 @@
#import "HBListController.h"
NS_ASSUME_NONNULL_BEGIN
/// The HBAboutListController class in CepheiPrefs provides a list controller with functions
/// that would typically be used on an "about" page. It includes two class methods you can override
/// to provide a developer website and donation URL, and a class method to provide an email address
/// so the user can send the developer an email right from the tweak's settings.
///
/// There is a sample of an HBAboutListController implemented in the Cephei demo preferences. See
/// the Cephei readme for details.
///
/// ### Example Usage
/// ```xml
/// <dict>
/// <key>cell</key>
/// <string>PSLinkCell</string>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>label</key>
/// <string>Visit Website</string>
/// <key>url</key>
/// <string>https://hashbang.productions/</string>
/// </dict>
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>label</key>
/// <string>Experiencing issues?</string>
/// </dict>
/// <dict>
/// <key>action</key>
/// <string>hb_sendSupportEmail</string>
/// <key>cell</key>
/// <string>PSLinkCell</string>
/// <key>label</key>
/// <string>Email Support</string>
/// </dict>
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>footerText</key>
/// <string>If you like this tweak, please consider a donation.</string>
/// </dict>
/// <dict>
/// <key>cell</key>
/// <string>PSLinkCell</string>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>label</key>
/// <string>Donate</string>
/// <key>url</key>
/// <string>https://hashbang.productions/donate/</string>
/// </dict>
/// ```
@interface HBAboutListController : HBListController
/// @name Constants
/// The website URL to open when tapping the “visit website” cell. Override this method to return
/// your own URL.
///
/// Deprecated. It is encouraged to use an `HBLinkTableCell` instead.
///
/// @return By default, https://hashbang.productions/.
+ (NSURL *)hb_websiteURL __attribute((deprecated("Use an HBLinkTableCell instead.")));
/// The website URL to open when tapping the "donate" cell. Override this method to return your own
/// URL.
///
/// Deprecated. It is encouraged to use an `HBLinkTableCell` instead.
///
/// @return By default, https://hashbang.productions/donate/.
+ (NSURL *)hb_donateURL __attribute((deprecated("Use an HBLinkTableCell instead.")));
/// The email address to use in the support email composer form. Override this method to return an
/// email address.
///
/// If this method returns nil, the package’s author email address is used.
///
/// @return By default, nil.
+ (nullable NSString *)hb_supportEmailAddress;
/// No longer supported.
///
/// @return By default, nil.
/// @see `HBSupportController`
+ (nullable NSArray *)hb_supportInstructions __attribute((deprecated("TechSupport is no longer supported.")));
/// @name Preference Specifier Actions
/// Opens the user's browser to the URL specified by `-hb_websiteURL`.
///
/// Deprecated. Use an `HBLinkTableCell` instead.
- (void)hb_openWebsite __attribute((deprecated("Use an HBLinkTableCell instead.")));
/// Opens the user's browser to the URL specified by `-hb_donateURL`.
///
/// Deprecated. Use an `HBLinkTableCell` instead.
- (void)hb_openDonate __attribute((deprecated("Use an HBLinkTableCell instead.")));
/// Displays a support composer form.
///
/// The `-hb_supportEmailAddress` and `-hb_supportInstructions` methods are used to provide the
/// appropriate parameters to `HBSupportController`.
///
/// @see `HBSupportController`
- (void)hb_sendSupportEmail;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,167 +0,0 @@
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// Constants indicating how to size the title of this item.
typedef NS_ENUM(NSUInteger, HBAppearanceSettingsLargeTitleStyle) {
/// Display a large title only when the current view controller is a subclass of
/// `HBRootListController`.
///
/// This is the default mode.
HBAppearanceSettingsLargeTitleStyleRootOnly,
/// Always display a large title.
HBAppearanceSettingsLargeTitleStyleAlways,
/// Never display a large title.
HBAppearanceSettingsLargeTitleStyleNever
} NS_SWIFT_NAME(HBAppearanceSettings.LargeTitleStyle);
/// The HBAppearanceSettings class in CepheiPrefs provides a model object read by other components
/// of Cephei to determine colors and other appearence settings to use in the user interface.
///
/// Appearance settings are typically set on a view controller, via the
/// `-[PSListController(HBTintAdditions) hb_appearanceSettings]` property. This is automatically
/// managed by Cephei and provided to view controllers as they are pushed onto the stack.
///
/// Most commonly, the API will be used by setting the `hb_appearanceSettings` property from the
/// init method. The following example sets the tint color, table view background color, and
/// customises the navigation bar with a background, title, and status bar color:
///
/// ```objc
/// - (instancetype)init {
/// self = [super init];
///
/// if (self) {
/// HBAppearanceSettings *appearanceSettings = [[HBAppearanceSettings alloc] init];
/// appearanceSettings.tintColor = [UIColor colorWithRed:66.f / 255.f green:105.f / 255.f blue:154.f / 255.f alpha:1];
/// appearanceSettings.barTintColor = [UIColor systemRedColor];
/// appearanceSettings.navigationBarTitleColor = [UIColor whiteColor];
/// appearanceSettings.tableViewBackgroundColor = [UIColor colorWithWhite:242.f / 255.f alpha:1];
/// appearanceSettings.statusBarStyle = UIStatusBarStyleLightContent;
/// self.hb_appearanceSettings = appearanceSettings;
/// }
///
/// return self;
/// }
/// ```
@interface HBAppearanceSettings : NSObject
/// @name General
/// The tint color to use for interactable elements within the list controller. Set this property to
/// a UIColor to use.
///
/// A nil value will cause no modification of the tint to occur.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tintColor;
#ifdef __IPHONE_13_0
/// The user interface style to use. Set this property to a UIUserInterfaceStyle to use.
///
/// @return By default, UIUserInterfaceStyleUnspecified.
@property (nonatomic, assign) UIUserInterfaceStyle userInterfaceStyle API_AVAILABLE(ios(13.0));
#endif
/// @name Navigation Bar
/// The tint color to use for the navigation bar buttons, or, if invertedNavigationBar is set, the
/// background of the navigation bar. Set this property to a UIColor to use, if you don’t want to
/// use the same color as tintColor.
///
/// A nil value will cause no modification of the navigation bar tint to occur.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *navigationBarTintColor;
/// The color to use for the navigation bar title label. Set this property to a UIColor to use.
///
/// A nil value will cause no modification of the navigation bar title color to occur.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *navigationBarTitleColor;
/// The background color to use for the navigation bar. Set this property to a UIColor to use.
///
/// A nil value will cause no modification of the navigation bar background to occur.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *navigationBarBackgroundColor;
/// The status bar style to use. Set this property to a UIStatusBarStyle to use.
///
/// @return By default, UIStatusBarStyleDefault.
@property (nonatomic, assign) UIStatusBarStyle statusBarStyle;
/// The color to use for the status bar icons. Set this property to a UIColor to use.
///
/// A nil value will cause no modification of the status bar color to occur.
///
/// @return By default, nil.
/// @warning Setting the status bar to a custom color is no longer possible as of iOS 13. Set
/// statusBarStyle instead.
@property (nonatomic, copy, nullable) UIColor *statusBarTintColor __attribute((deprecated("Set statusBarStyle instead.")));
/// Whether to use an inverted navigation bar.
///
/// An inverted navigation bar has a tinted background, rather than the buttons being tinted. All
/// other interface elements will be tinted the same.
///
/// @return By default, NO.
@property (nonatomic, assign) BOOL invertedNavigationBar __attribute((deprecated("Set navigationBarBackgroundColor and navigationBarTitleColor instead.")));
/// Whether to use a translucent navigation bar. Set this property to YES if you want this behavior.
///
/// @return By default, YES.
@property (nonatomic, assign) BOOL translucentNavigationBar;
/// Whether to show the shadow (separator line) at the bottom of the navigation bar.
///
/// Requires iOS 13 or later.
///
/// @return By default, YES.
@property (nonatomic, assign) BOOL showsNavigationBarShadow;
/// Whether to use a large title on iOS 11 and newer. Set this property to a value from
/// HBAppearanceSettingsLargeTitleStyle.
///
/// @return By default, HBAppearanceSettingsLargeTitleStyleRootOnly.
@property (nonatomic, assign) HBAppearanceSettingsLargeTitleStyle largeTitleStyle;
/// @name Table View
/// The color to be used for the overall background of the table view. Set this property to a
/// UIColor to use.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tableViewBackgroundColor;
/// The color to be used for the text color of table view cells. Set this property to a UIColor to
/// use.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tableViewCellTextColor;
/// The color to be used for the background color of table view cells. Set this property to a
/// UIColor to use.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tableViewCellBackgroundColor;
/// The color to be used for the separator between table view cells. Set this property to a UIColor
/// to use.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tableViewCellSeparatorColor;
/// The color to be used when a table view cell is selected. This color will be shown when the cell
/// is in the highlighted state.
///
/// @return By default, nil.
@property (nonatomic, copy, nullable) UIColor *tableViewCellSelectionColor;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,46 +0,0 @@
#import <Preferences/PSSliderTableCell.h>
#import <Preferences/PSDiscreteSlider.h>
/// The HBDiscreteSliderTableCell class in CepheiPrefs is a subclass of the standard slider
/// cell, which displays a vertical line at every whole number. Additionally, when dragging the
/// slider, it jumps to these lines so the user’s preference will always be a whole number.
///
/// It is no longer necessary to use this as of iOS 8.2, which has built in `isSegmented` and
/// `segmentCount` parameters on PSSliderCell. This class is kept for backwards compatibility, and
/// will use the built-in implementation on iOS 8.2 and newer.
///
/// Requires iOS 7.0 or later. A normal slider is shown for older versions.
///
/// ### Specifier Parameters
/// All parameters specific to
/// [PSSliderCell](http://iphonedevwiki.net/index.php/Preferences_specifier_plist#PSSliderCell)
/// are applicable here. There are no custom parameters.
///
/// ### Example Usage
/// ```xml
/// <dict>
/// <key>cell</key>
/// <string>PSSliderCell</string>
/// <key>cellClass</key>
/// <string>HBDiscreteSliderTableCell</string>
/// <key>default</key>
/// <real>5</real>
/// <key>defaults</key>
/// <string>ws.hbang.common.demo</string>
/// <key>key</key>
/// <string>Discrete</string>
/// <key>label</key>
/// <string>Discrete</string>
/// <key>max</key>
/// <real>15</real>
/// <key>min</key>
/// <real>1</real>
/// </dict>
/// ```
@interface HBDiscreteSliderTableCell : PSControlTableCell
/// The slider control.
@property (nonatomic, retain) PSDiscreteSlider *control;
@end

View File

@@ -1,45 +0,0 @@
#import <Preferences/PSTableCell.h>
#import <Preferences/PSHeaderFooterView.h>
/// The HBImageTableCell class in CepheiPrefs provides a simple way to display an image as a
/// table cell, or a header or footer.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>icon</td> <td>Required. The file name of the image to display in the cell.</td>
/// </tr>
/// </table>
///
/// If you use `HBImageTableCell` as a header or footer with `headerCellClass` or `footerCellClass`,
/// it will size automatically to fit the image. If you use it as a cell with `cellClass`, you must
/// set the height yourself using the `height` key.
///
/// ### Example Usage
/// ```xml
/// <!-- As a header (or footer): -->
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>headerCellClass</key>
/// <string>HBImageTableCell</string>
/// <key>height</key>
/// <integer>100</integer>
/// <key>icon</key>
/// <string>logo.png</string>
/// </dict>
///
/// <!-- As a cell: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBImageTableCell</string>
/// <key>height</key>
/// <integer>100</integer>
/// <key>icon</key>
/// <string>logo.png</string>
/// </dict>
/// ```
@interface HBImageTableCell : PSTableCell <PSHeaderFooterView>
@end

View File

@@ -1,8 +0,0 @@
#import "HBLinkTableCell.h"
/// The HBInitialsLinkTableCell class in CepheiPrefs is a shim kept for compatibility reasons.
/// The class is now called `HBLinkTableCell`.
@interface HBInitialsLinkTableCell : HBLinkTableCell
@end

View File

@@ -1,129 +0,0 @@
#import "HBTintedTableCell.h"
/// The HBLinkTableCell class in CepheiPrefs displays a button that, when tapped, opens the
/// specified URL. A typical icon can be used, or the initials key can be set to one or two
/// characters to show as the icon.
///
/// This cell can either be used without setting any cell type, or by setting it to `PSButtonCell`
/// to get a tinted button.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>url</td> <td>Required. The URL to open.</td>
/// </tr>
/// <tr>
/// <td>subtitle</td> <td>Optional. A subtitle to display below the label. The default is an empty
/// string, hiding the subtitle.</td>
/// </tr>
/// <tr>
/// <td>initials</td> <td>Optional. One or two characters to show as the icon.</td>
/// </tr>
/// <tr>
/// <td>iconURL</td> <td>Optional. The URL to an image to display. The default is no value,
/// hiding the image.</td>
/// </tr>
/// <tr>
/// <td>iconCircular</td> <td>Optional. Whether the icon should be displayed as a circle. The
/// default is NO when an iconURL is set, otherwise this property is unused.</td>
/// </tr>
/// <tr>
/// <td>iconCornerRadius</td> <td>Optional. A custom corner radius to use for the icon. Ignored
/// if iconCircular is set to true. If set to -1, the operating system’s default icon corner radius
/// is used. The default is -1.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <!-- With icon: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>icon</key>
/// <string>example.png</string>
/// <key>label</key>
/// <string>Example</string>
/// <key>url</key>
/// <string>http://example.com/</string>
/// </dict>
///
/// <!-- With initials: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>initials</key>
/// <string>XX</string>
/// <key>label</key>
/// <string>Example</string>
/// <key>url</key>
/// <string>http://example.com/</string>
/// </dict>
///
/// <!-- With a subtitle: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>label</key>
/// <string>Example</string>
/// <key>subtitle</key>
/// <string>Visit our amazing website</string>
/// <key>url</key>
/// <string>http://example.com/</string>
/// </dict>
///
/// <!-- With a subtitle, in big mode: -->
/// <dict>
/// <key>big</key>
/// <true/>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>height</key>
/// <integer>64</integer>
/// <key>label</key>
/// <string>Example</string>
/// <key>subtitle</key>
/// <string>Visit our amazing website</string>
/// <key>url</key>
/// <string>http://example.com/</string>
/// </dict>
/// ```
@interface HBLinkTableCell : HBTintedTableCell
/// Whether the cell is 64 pixels or more in height.
///
/// This is not set automatically; the specifier for the cell must set the `big` property to true
/// (see examples above).
@property (nonatomic, readonly) BOOL isBig;
/// The view containing the icon image view.
@property (nonatomic, retain, readonly) UIView *iconView;
/// The icon image view.
@property (nonatomic, retain, readonly) UIImageView *iconImageView;
/// The image to display as the icon, if enabled.
@property (nonatomic, retain) UIImage *iconImage;
/// A URL to load into iconImage to display as the icon, if enabled.
@property (nonatomic, retain) NSURL *iconURL;
/// Whether the image displays as a circle.
///
/// The default is YES if an iconURL is set in the specifier, otherwise NO.
@property (nonatomic, readonly) BOOL isIconCircular;
/// Load and display the icon.
///
/// You don’t need to call this unless subclassing.
- (void)loadIconIfNeeded;
/// Handle failure to load the icon.
///
/// You don’t need to call this unless subclassing. The default implementation replaces the image
/// with the operating system’s generic “no icon” placeholder if `iconCornerRadius` is set to -1,
/// and `isIconCircular` is set to NO.
- (void)iconLoadDidFailWithResponse:(NSURLResponse *)response error:(NSError *)error;
@end

View File

@@ -1,42 +0,0 @@
#import "HBListController.h"
@class PSSpecifier;
NS_ASSUME_NONNULL_BEGIN
/// The HBListController (Actions) class category in CepheiPrefs implements action methods you can
/// use with link and button specifiers.
@interface HBListController (Actions)
/// Specifier action to perform a restart of the system app (respring).
///
/// You should prefer to have preferences immediately take effect, rather than using this method.
///
/// @see `-hb_respringAndReturn:`
- (void)hb_respring:(PSSpecifier *)specifier;
/// Specifier action to perform a restart of the system app (respring), and return to the current
/// preferences screen.
///
/// You should prefer to have preferences immediately take effect, rather than using this method.
///
/// @see `-hb_respring:`
- (void)hb_respringAndReturn:(PSSpecifier *)specifier;
/// Specifier action to open the URL specified by the specifier.
///
/// This is intended to be used with `HBLinkTableCell`.
///
/// @see `HBLinkTableCell`
- (void)hb_openURL:(PSSpecifier *)specifier;
/// Specifier action to open the package specified by the specifier.
///
/// This is intended to be used with `HBPackageTableCell`.
///
/// @see `HBPackageTableCell`
- (void)hb_openPackage:(PSSpecifier *)specifier;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,260 +0,0 @@
#import <Preferences/PSListController.h>
#import "PSListController+HBTintAdditions.h"
NS_ASSUME_NONNULL_BEGIN
/// The HBListController class in CepheiPrefs provides a list controller with various
/// conveniences such as a unique tint color for the list controllers within a preference bundle,
/// and bug fixes for common issues within the Settings app and Preferences framework. In
/// particular, a bug with the list controller’s content disappearing after closing the Settings
/// app and opening it again is worked around, as well as an issue on iOS 7 where in some cases a
/// cell may stay highlighted after being tapped.
///
/// It includes two class methods you can override to return the name of a Preferences specifier
/// property list, and various methods to control appearance of the interface.
///
/// If you use `HBLinkTableCell` or subclasses such as `HBTwitterCell` and `HBPackageTableCell`, it
/// is recommended to subclass from HBListController on the view controller classes containing these
/// cells to use CepheiPrefs’s built-in callback actions. If you do not subclass from
/// HBListController, you will need to implement action methods yourself.
///
/// ### Specifier Parameters
/// HBListController extends specifiers with the following parameters:
///
/// <table class="graybox">
/// <tr>
/// <td>pl_filter</td> <td>Optional. Supports additional filters that decide whether a specifier
/// should be displayed, as specified below.</td>
/// </tr>
/// <tr>
/// <td>iconImageSystem</td> <td>Optional. Supports displaying a system image as the cell icon, as
/// specified below.</td>
/// </tr>
/// <tr>
/// <td>leftImageSystem</td> <td>Optional. Supports displaying a system image as the icon to the
/// left of a PSSliderCell’s slider control, as specified below.</td>
/// </tr>
/// <tr>
/// <td>rightImageSystem</td> <td>Optional. Supports displaying a system image as the icon to the
/// right of a PSSliderCell’s slider control, as specified below.</td>
/// </tr>
/// </table>
///
/// #### PreferenceLoader Filter Parameters
/// The `pl_filter` key is inherited from PreferenceLoader’s libprefs, and can be used to specify
/// [CoreFoundation version](https://iphonedev.wiki/index.php/CoreFoundation.framework) criteria
/// for a specifier. Specifiers that do not meet the `pl_filter` criteria will be discarded.
///
/// The version number of CoreFoundation is often used as a stable method of checking the operating
/// system version in use. It has the benefit of increasing in predictable amounts (to the next
/// hundred or more) for each major revision of Apple’s OS platforms, and it is typically roughly
/// the same between all Apple OS platforms at any point in time.
///
/// <table class="graybox">
/// <tr>
/// <td>CoreFoundationVersion</td> <td>Optional. An array of one or two CoreFoundation version
/// numbers in decimal (&lt;real&gt;). If one number is present, this is a minimum bound. The
/// current device’s CoreFoundation version must be greater than or equal to this number. If two
/// numbers are present, the first number is the lower bound, and the second number is one more than
/// the upper bound. The current device’s CoreFoundation version must be greater than or equal to
/// the first number, and less than (but not equal to) the second number.</td>
/// </tr>
/// </table>
///
/// ##### Example Usage
/// ```xml
/// <!-- Will only display on iOS 12.0 (CF 1556.0) or newer: -->
/// <dict>
/// <key>cell</key>
/// <string>PSSwitchCell</string>
/// <key>label</key>
/// <string>My iOS 12+ Only Feature</string>
/// <key>pl_filter</key>
/// <dict>
/// <key>CoreFoundationVersion</key>
/// <array>
/// <real>1556.00</real>
/// </array>
/// </dict>
/// </dict>
///
/// <!-- Will only display between iOS 7.0 (CF 847.20) and 12.0 (CF 1556.00): -->
/// <dict>
/// <key>cell</key>
/// <string>PSSwitchCell</string>
/// <key>label</key>
/// <string>My iOS 7-11 Only Feature</string>
/// <key>pl_filter</key>
/// <dict>
/// <key>CoreFoundationVersion</key>
/// <array>
/// <real>847.20</real>
/// <real>1556.00</real>
/// </array>
/// </dict>
/// </dict>
///
/// <!-- Will only display on versions earlier than iOS 12.0 (CF 1556.00): -->
/// <dict>
/// <key>cell</key>
/// <string>PSSwitchCell</string>
/// <key>label</key>
/// <string>My iOS &lt;12 Only Feature</string>
/// <key>pl_filter</key>
/// <dict>
/// <key>CoreFoundationVersion</key>
/// <array>
/// <real>0.0</real>
/// <real>1556.00</real>
/// </array>
/// </dict>
/// </dict>
/// ```
///
/// #### System Icon Parameters
/// On iOS 13.0 and newer, you can specify a system icon
/// ([SF Symbols](https://developer.apple.com/sf-symbols/) glyph) to be displayed in a cell. Use the
/// SF Symbols app to find symbol names.
///
/// When running on iOS versions earlier than 13.0, icons will not be rendered. This also applies
/// when a symbol name is specified that was added in a later iOS version than is currently in use.
/// In this case, you can supply a PNG icon through the usual means as a fallback.
///
/// <table class="graybox">
/// <tr>
/// <td>name</td> <td>Required. The symbol name to use.</td>
/// </tr>
/// <tr>
/// <td>weight</td> <td>Optional. The weight to render the symbol at. The supported values are:
/// ultraLight, thin, light, regular, medium, semibold, bold, heavy, black. The default is
/// regular.</td>
/// </tr>
/// <tr>
/// <td>scale</td> <td>Optional. The scale to render the symbol at. The supported values are: small,
/// medium, large. The default is medium.</td>
/// </tr>
/// <tr>
/// <td>pointSize</td> <td>Optional. The equivalent font size to render the symbol at. The default
/// is 20.0.</td>
/// </tr>
/// <tr>
/// <td>tintColor</td> <td>Optional. The color to render the icon in. The default is no value, which
/// means the tint color will be inherited from the -[HBAppearanceSettings tintColor]; if neither
/// value is set, the default iOS blue tint color is used. When backgroundColor is set, no value
/// means white (#ffffff) will be used.</td>
/// </tr>
/// <tr>
/// <td>backgroundColor</td> <td>Optional. The background color to use for the symbol. When
/// specified, the symbol will be rendered inside an icon shape of the specified background color.
/// The symbol will be scaled down by 20% to appropriately fit the icon shape. The default is no
/// value, which means no icon shape will be rendered.</td>
/// </tr>
/// </table>
///
/// ##### Example Usage
///
/// ```xml
/// <!-- A switch with a two switches symbol as its icon -->
/// <dict>
/// <key>cell</key>
/// <string>PSSwitchCell</string>
/// <key>label</key>
/// <string>Awesome</string>
/// <key>iconImageSystem</key>
/// <dict>
/// <key>name</key>
/// <string>switch.2</string>
/// </dict>
/// </dict>
///
/// <!-- A link cell with an information symbol as its icon -->
/// <dict>
/// <key>cell</key>
/// <string>PSLinkCell</string>
/// <key>detail</key>
/// <string>HBDemoAboutListController</string>
/// <key>isController</key>
/// <true/>
/// <key>label</key>
/// <string>ABOUT</string>
/// <key>iconImageSystem</key>
/// <dict>
/// <key>name</key>
/// <string>info.circle</string>
/// </dict>
/// </dict>
///
/// <!-- A slider cell with brightness sun symbols on the left and right -->
/// <dict>
/// <key>cell</key>
/// <string>PSSliderCell</string>
/// <key>min</key>
/// <real>1</real>
/// <key>max</key>
/// <real>15</real>
/// <key>leftImageSystem</key>
/// <dict>
/// <key>name</key>
/// <string>sun.min</string>
/// </dict>
/// <key>rightImageSystem</key>
/// <dict>
/// <key>name</key>
/// <string>sun.max</string>
/// </dict>
/// </dict>
///
/// <!-- A link cell with white heart symbol in a red icon shape -->
/// <dict>
/// <key>cell</key>
/// <string>PSButtonCell</string>
/// <key>cellClass</key>
/// <string>HBLinkTableCell</string>
/// <key>label</key>
/// <string>DONATE</string>
/// <key>url</key>
/// <string>https://hashbang.productions/</string>
/// <key>iconImageSystem</key>
/// <dict>
/// <key>name</key>
/// <string>heart</string>
/// <key>backgroundColor</key>
/// <string>#ff3b30</string>
/// </dict>
/// </dict>
/// ```
@interface HBListController : PSListController
/// @name Specifiers
/// The property list that contains Preference framework specifiers to display as the content of the
/// list controller. Override this method to return the file name of a property list inside your
/// preference bundle, omitting the file extension.
///
/// Example:
/// ```objc
/// + (NSString *)hb_specifierPlist {
/// return @"Root";
/// }
/// ```
///
/// If you use this method and override the `specifiers` method, ensure you call the super method
/// with `[super specifiers];` first in your `specifiers` implementation.
///
/// @return By default, nil.
@property (nonatomic, strong, readonly, class, nullable) NSString *hb_specifierPlist NS_SWIFT_NAME(specifierPlist);
/// @name Related View Controllers
/// Returns the “real” navigation controller for this view controller.
///
/// As of iOS 8.0, the navigation controller that owns the navigation bar and other responsibilities
/// is actually a parent of `self.navigationController` on iPhone, due to the larger Plus models.
/// The realNavigationController method returns the correct navigation controller.
///
/// @return The real navigation controller.
- (UINavigationController *)realNavigationController;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,10 +0,0 @@
#import <UIKit/UIKit.h>
#import <Preferences/PSListItemsController.h>
/// The HBListItemsController class in CepheiPrefs was used with previous versions to ensure
/// that the tint color from the previous view controller is retained. As of Cephei 1.4, this is no
/// longer needed, and this class is kept for backwards compatibility purposes.
@interface HBListItemsController : PSListItemsController
@end

View File

@@ -1,114 +0,0 @@
#import <Preferences/PSTableCell.h>
#import <Preferences/PSHeaderFooterView.h>
/// The HBPackageNameHeaderCell class in CepheiPrefs displays a header containing the package’s
/// icon, name, version number, and author. It can be displayed in a subtle condensed design, or, by
/// default, a tall header that might be displayed at the top of a preference bundle’s root list
/// controller, for instance.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>condensed</td> <td>Optional. When true, displays an icon, the package name and version in
/// one line, and on another displays the author name. When false, displays a large package name,
/// and on two lines in small font the package version and author. The default is false.</td>
/// </tr>
/// <tr>
/// <td>icon</td> <td>Required in condensed mode. Not used otherwise. The file name of the icon to
/// use within the current preference bundle.</td>
/// </tr>
/// <tr>
/// <td>packageIdentifier</td> <td>Required. The package identifier to retrieve the required
/// information from.</td>
/// </tr>
/// <tr>
/// <td>packageNameOverride</td> <td>Optional. A custom name to use instead of the package’s
/// name.</td>
/// </tr>
/// <tr>
/// <td>showAuthor</td> <td>Optional. Whether to show the Author field of the package. The default
/// is true.</td>
/// </tr>
/// <tr>
/// <td>showVersion</td> <td>Optional. Whether to show the Version field of the package. The default
/// is true.</td>
/// </tr>
/// <tr>
/// <td>titleColor</td> <td>Optional. The color to apply to the name of the package. The default is
/// #111111.</td>
/// </tr>
/// <tr>
/// <td>subtitleColor</td> <td>Optional. The color to apply to the subtitles. The default is
/// #444444.</td>
/// </tr>
/// <tr>
/// <td>backgroundGradientColors</td> <td>Optional. An array of color stops to use as a background
/// gradient. At least one is required. The default is no background gradient.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <!-- Standard size: -->
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>headerCellClass</key>
/// <string>HBPackageNameHeaderCell</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// </dict>
///
/// <!-- Condensed size: -->
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>condensed</key>
/// <true/>
/// <key>headerCellClass</key>
/// <string>HBPackageNameHeaderCell</string>
/// <key>icon</key>
/// <string>icon.png</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// </dict>
///
/// <!-- Standard size with custom colors: -->
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>headerCellClass</key>
/// <string>HBPackageNameHeaderCell</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// <key>titleColor</key>
/// <string>#CC0000</string>
/// <key>subtitleColor</key>
/// <array>
/// <integer>55</integer>
/// <integer>147</integer>
/// <integer>230</integer>
/// </array>
/// </dict>
///
/// <!-- Standard size with gradient background: -->
/// <dict>
/// <key>cell</key>
/// <string>PSGroupCell</string>
/// <key>headerCellClass</key>
/// <string>HBPackageNameHeaderCell</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// <key>backgroundGradientColors</key>
/// <array>
/// <string>#5AD427</string>
/// <string>#FFDB4C</string>
/// <string>#EF4DB6</string>
/// <string>#898C90</string>
/// </array>
/// </dict>
/// ```
@interface HBPackageNameHeaderCell : PSTableCell <PSHeaderFooterView>
@end

View File

@@ -1,63 +0,0 @@
#import "HBLinkTableCell.h"
/// The HBPackageTableCell class in CepheiPrefs provides a cell containing any package's icon,
/// name, and description. Tapping it opens the package in Cydia.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>packageIdentifier</td> <td>Required. The package identifier to retrieve the required
/// information from.</td>
/// </tr>
/// <tr>
/// <td>packageRepository</td> <td>Optional. The URL to the repository the package is available on,
/// if not one of the default repos.</td>
/// </tr>
/// <tr>
/// <td>label</td> <td>Required. The name of the package.</td>
/// </tr>
/// <tr>
/// <td>subtitle</td> <td>Optional. Can be used for a description of the package.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <!-- Typical: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBPackageTableCell</string>
/// <key>label</key>
/// <string>Cephei</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// </dict>
///
/// <!-- With subtitle: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBPackageTableCell</string>
/// <key>label</key>
/// <string>Cephei</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// <key>subtitle</key>
/// <string>Support library for tweaks</string>
/// </dict>
///
/// <!-- From a repository: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBPackageTableCell</string>
/// <key>label</key>
/// <string>Cephei</string>
/// <key>packageIdentifier</key>
/// <string>ws.hbang.common</string>
/// <key>packageRepository</key>
/// <string>https://repo.chariz.io</string>
/// </dict>
/// ```
@interface HBPackageTableCell : HBLinkTableCell
@end

View File

@@ -1,38 +0,0 @@
#import "HBListController.h"
NS_ASSUME_NONNULL_BEGIN
/// The HBRootListController class in CepheiPrefs provides a list controller class that should
/// be used as the root of the package's settings. It includes two class methods you can override to
/// provide a default message and a URL that the user can share via a sharing button displayed to
/// the right of the navigation bar.
///
/// It is recommended that you use this class even if its current features aren’t appealing in case
/// of future improvements or code that relies on the presence of an HBRootListController.
@interface HBRootListController : HBListController
/// @name Constants
/// A string to be used as a default message when the user shares the package to a friend or social
/// website. Override this method to return your own string.
///
/// If the return value of this method and `hb_shareURL `are nil, the sharing button will not be
/// displayed.
///
/// @return By default, nil.
+ (nullable NSString *)hb_shareText;
/// The URL to be shared when the user shares the package to a friend or social website. Override
/// this method to return your own URL.
///
/// If the return value of this method and `hb_shareText` are nil, the sharing button will not be
/// displayed.
///
/// @return By default, nil.
+ (nullable NSURL *)hb_shareURL;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,35 +0,0 @@
#import "HBTintedTableCell.h"
/// The HBSpinnerTableCell class in CepheiPrefs displays an activity indicator when the cell is
/// disabled.
///
/// ### Example Usage
/// Specifier plist:
///
/// ```xml
/// <dict>
/// <key>action</key>
/// <string>doStuffTapped:</string>
/// <key>cell</key>
/// <string>PSButtonCell</string>
/// <key>cellClass</key>
/// <string>HBSpinnerTableCell</string>
/// <key>label</key>
/// <string>Do Stuff</string>
/// </dict>
/// ```
///
/// List controller implementation:
///
/// ```objc
/// - (void)doStuffTapped:(PSSpecifier *)specifier {
/// PSTableCell *cell = [self cachedCellForSpecifier:specifier];
/// cell.cellEnabled = NO;
/// // do something in the background…
/// cell.cellEnabled = YES;
/// }
/// ```
@interface HBSpinnerTableCell : HBTintedTableCell
@end

View File

@@ -1,52 +0,0 @@
#import <Preferences/PSControlTableCell.h>
/// The HBStepperTableCell class in CepheiPrefs allows setting a value using a stepper control
/// ("minus" and "plus" buttons).
///
/// Requires iOS 6.0 or later.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>label</td> <td>Required. The label displayed when the value is plural. Use <code>%i</code>
/// to denote where the number should be displayed.</td>
/// </tr>
/// <tr>
/// <td>max</td> <td>Required. The highest possible numeric value for the stepper.</td>
/// </tr>
/// <tr>
/// <td>min</td> <td>Required. The lowest possible numeric value for the stepper.</td>
/// </tr>
/// <tr>
/// <td>singularLabel</td> <td>Required. The label displayed when the value is singular.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <dict>
/// <key>cellClass</key>
/// <string>HBStepperTableCell</string>
/// <key>default</key>
/// <real>5</real>
/// <key>defaults</key>
/// <string>ws.hbang.common.demo</string>
/// <key>key</key>
/// <string>Stepper</string>
/// <key>label</key>
/// <string>%i Things</string>
/// <key>max</key>
/// <real>15</real>
/// <key>min</key>
/// <real>1</real>
/// <key>singularLabel</key>
/// <string>1 Thing</string>
/// </dict>
/// ```
@interface HBStepperTableCell : PSControlTableCell
/// The stepper control.
@property (nonatomic, retain) UIStepper *control;
@end

View File

@@ -1,77 +0,0 @@
@import UIKit;
NS_ASSUME_NONNULL_BEGIN
/// The HBSupportController class in CepheiPrefs provides a factory that configures an email
/// composer for package support.
///
/// The resulting view controller should be presented modally; it should not be pushed on a
/// navigation controller stack.
@interface HBSupportController : NSObject
/// Initialises a Mail composer by using information provided by a bundle and preferences identifier.
///
/// Either a bundle or preferences identifier is required. If both are nil, an exception will be
/// thrown. The email address is derived from the `Author` field of the package’s control file.
/// `HBSupportController` implicitly adds the user’s package listing (output of `dpkg -l`) and the
/// preferences plist as attachments.
///
/// @param bundle A bundle included with the package.
/// @param preferencesIdentifier A preferences identifier that is used by the package.
/// @return A pre-configured email composer.
/// @see `+supportViewControllerForBundle:preferencesIdentifier:sendToEmail:`
+ (UIViewController *)supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier;
/// Initialises a Mail composer by using information provided by a bundle, preferences identifier,
/// and optional email address.
///
/// Either a bundle or preferences identifier is required. If both are nil, an exception will be
/// thrown. If sendToEmail is nil, the email address is derived from the `Author` field of the
/// package’s control file. `HBSupportController` implicitly adds the user’s package listing (output
/// of `dpkg -l`) and the preferences plist as attachments.
///
/// @param bundle A bundle included with the package.
/// @param preferencesIdentifier A preferences identifier that is used by the package.
/// @param sendToEmail The email address to prefill in the To field. Pass nil to use the email
/// address from the package.
/// @return A pre-configured email composer.
+ (UIViewController *)supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier sendToEmail:(nullable NSString *)sendToEmail;
/// @name Deprecated
/// No longer supported. Returns nil.
///
/// @return nil.
+ (id)linkInstructionForEmailAddress:(NSString *)emailAddress __attribute((deprecated("TechSupport is no longer supported.")));
/// Initialises a Mail composer by using information provided by a bundle.
///
/// Refer to `+supportViewControllerForBundle:preferencesIdentifier:linkInstruction:supportInstructions:`
/// for information on how the bundle is used.
///
/// @param bundle A bundle included with the package.
/// @return A pre-configured email composer.
/// @see `+supportViewControllerForBundle:preferencesIdentifier:sendToEmail:`
+ (UIViewController *)supportViewControllerForBundle:(NSBundle *)bundle __attribute((deprecated("TechSupport is no longer supported.")));
/// Initialises a Mail composer by using information provided by either a bundle or a preferences
/// identifier, and providing it a custom link instruction and support instructions.
///
/// The bundle may set the key `HBPackageIdentifier` in its Info.plist, containing the package
/// identifier to gather information from. Otherwise, the dpkg file lists are searched to find the
/// package that contains the bundle. The package’s name, identifier, and author will be used to
/// fill out fields in the information that the user will submit.
///
/// @param bundle A bundle included with the package.
/// @param preferencesIdentifier The preferences identifier of the package, if it’s different from
/// the package identifier that contains the bundle.
/// @param linkInstruction Ignored.
/// @param supportInstructions Ignored.
/// @return A pre-configured email composer.
/// @see `+supportViewControllerForBundle:preferencesIdentifier:`
+ (UIViewController *)supportViewControllerForBundle:(nullable NSBundle *)bundle preferencesIdentifier:(nullable NSString *)preferencesIdentifier linkInstruction:(nullable id)linkInstruction supportInstructions:(nullable NSArray *)supportInstructions __attribute((deprecated("Use +[HBSupportController supportViewControllerForBundle:preferencesIdentifier:].")));
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,43 +0,0 @@
#import <Preferences/PSTableCell.h>
/// The HBTintedTableCell class in CepheiPrefs ensures that a tint set with `HBAppearanceSettings`
/// will also be applied to the title label of a of a cell intended to be used as a button.
///
/// ### Specifier Parameters
/// HBListController extends specifiers with the following parameters:
///
/// <table class="graybox">
/// <tr>
/// <td>tintColor</td> <td>Optional. The color to use for the label of the cell. The default is no
/// value, which means the tint color will be inherited from the -[HBAppearanceSettings tintColor];
/// if neither value is set, the default iOS blue tint color is used.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <dict>
/// <key>cell</key>
/// <string>PSButtonCell</string>
/// <key>cellClass</key>
/// <string>HBTintedTableCell</string>
/// <key>label</key>
/// <string>Do Something</string>
/// </dict>
///
/// <!-- Or with a custom tint color: -->
/// <dict>
/// <key>cell</key>
/// <string>PSButtonCell</string>
/// <key>cellClass</key>
/// <string>HBTintedTableCell</string>
/// <key>label</key>
/// <string>Do Something</string>
/// <key>tintColor</key>
/// <string>#33b5e5</string>
/// </dict>
/// ```
@interface HBTintedTableCell : PSTableCell
@end

View File

@@ -1,83 +0,0 @@
#import "HBLinkTableCell.h"
/// The HBTwitterCell class in CepheiPrefs displays a button containing a person’s name, along
/// with their Twitter username and avatar. When tapped, a Twitter client installed on the user’s
/// device or the Twitter website is opened to the person’s profile.
///
/// ### Specifier Parameters
/// <table class="graybox">
/// <tr>
/// <td>big</td> <td>Optional. Whether to display the username below the name (true) or to the right
/// of it (false). The default is false. If you set this to true, you should also set the cell’s
/// height to 56pt.</td>
/// </tr>
/// <tr>
/// <td>initials</td> <td>Optional. One or two characters to show instead of an avatar.</td>
/// </tr>
/// <tr>
/// <td>label</td> <td>Required. The name of the person.</td>
/// </tr>
/// <tr>
/// <td>user</td> <td>Required. The Twitter username of the person.</td>
/// </tr>
/// <tr>
/// <td>userID</td> <td>Optional. The Twitter user identifier number of the person. You can find
/// the user ID using <a href="https://www.google.com/search?q=find+twitter+user+id">online tools</a>.
/// </td>
/// </tr>
/// <tr>
/// <td>showAvatar</td> <td>Optional. Whether to show the avatar of the user. The default is
/// true.</td>
/// </tr>
/// <tr>
/// <td>iconURL</td> <td>Optional. The URL to an image to display. The default is no value, meaning
/// meaning to retrieve the avatar for the Twitter username specified in the user property.</td>
/// </tr>
/// <tr>
/// <td>iconCircular</td> <td>Optional. Whether the icon should be displayed as a circle. The
/// default is YES.</td>
/// </tr>
/// </table>
///
/// ### Example Usage
/// ```xml
/// <!-- Standard size: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBTwitterCell</string>
/// <key>label</key>
/// <string>HASHBANG Productions</string>
/// <key>user</key>
/// <string>hashbang</string>
/// </dict>
///
/// <!-- Big size: -->
/// <dict>
/// <key>big</key>
/// <true/>
/// <key>cellClass</key>
/// <string>HBTwitterCell</string>
/// <key>height</key>
/// <integer>56</integer>
/// <key>label</key>
/// <string>HASHBANG Productions</string>
/// <key>user</key>
/// <string>hashbang</string>
/// </dict>
///
/// <!-- Without an avatar: -->
/// <dict>
/// <key>cellClass</key>
/// <string>HBTwitterCell</string>
/// <key>label</key>
/// <string>HASHBANG Productions</string>
/// <key>showAvatar</key>
/// <false/>
/// <key>user</key>
/// <string>hashbang</string>
/// </dict>
/// ```
@interface HBTwitterCell : HBLinkTableCell
@end

View File

@@ -1,20 +0,0 @@
#import <Preferences/PSListController.h>
@class HBAppearanceSettings;
NS_ASSUME_NONNULL_BEGIN
/// The PSListController (HBTintAdditions) class category in CepheiPrefs provides a property for
/// setting the desired appearance settings of the view controller.
@interface PSListController (HBTintAdditions)
/// The appearance settings for the view controller.
///
/// This should only be set in an init or viewDidLoad method of the view controller. The result when
/// this property or its properties are changed after the view has appeared is undefined.
@property (nonatomic, copy, nullable, setter=hb_setAppearanceSettings:) HBAppearanceSettings *hb_appearanceSettings NS_SWIFT_NAME(appearanceSettings);
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,2 +0,0 @@
#import "CompactConstraint/CompactConstraint.h"
#import "UIColor+HBAdditions.h"

View File

@@ -1,7 +0,0 @@
//
// Created by Marco Arment on 2014-04-06.
// Copyright (c) 2014 Marco Arment. See included LICENSE file.
//
#import "NSLayoutConstraint+CompactConstraint.h"
#import "UIView+CompactConstraint.h"

View File

@@ -1,29 +0,0 @@
//
// Created by Marco Arment on 2014-04-06.
// Copyright (c) 2014 Marco Arment. See included LICENSE file.
//
#import <UIKit/UIKit.h>
/// NSLayoutConstraint (CompactConstraint), a class category from Marco Arment’s
/// [CompactConstraint](https://github.com/marcoarment/CompactConstraint) library, is integrated
/// with Cephei. CompactConstraint provides an Auto Layout grammar and methods that are easier to
/// use and understand than UIKit’s built in functions for programmatically adding constraints.
///
/// Refer to [its readme](https://github.com/marcoarment/CompactConstraint/blob/master/README.md) to
/// learn how to use it. There are two changes to note: most importantly, the methods have an `hb_`
/// prefix, and two methods that are marked as deprecated in the original project have been removed.
///
/// CompactConstraint is licensed under the MIT License.
@interface NSLayoutConstraint (CompactConstraint)
/// Instantiate a single constraint with the compact syntax.
+ (instancetype)hb_compactConstraint:(NSString *)relationship metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views self:(id)selfView;
/// Instantiate any number of constraints. Can also mix in Visual Format Language strings.
+ (NSArray <NSLayoutConstraint *> *)hb_compactConstraints:(NSArray <NSString *> *)relationshipStrings metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views self:(id)selfView;
/// And a convenient shortcut for creating constraints with the visualFormat string as the identifier
+ (NSArray <NSLayoutConstraint *> *)hb_identifiedConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views;
@end

View File

@@ -1,79 +0,0 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
/// UIColor (HBAdditions) is a class category in Cephei that provides some convenience methods.
@interface UIColor (HBAdditions)
/// Creates and returns a color object using data from the specified object.
///
/// The value is expected to be one of the types specified in hb_initWithPropertyListValue:.
///
/// @param value The object to retrieve data from. See the discussion for the supported object
/// types.
/// @return The color object. The color information represented by this object is in the device RGB
/// colorspace.
/// @see `-hb_initWithPropertyListValue:`
+ (instancetype)hb_colorWithPropertyListValue:(id)value NS_SWIFT_NAME(init(propertyListValue:));
/// Initializes and returns a color object using data from the specified object.
///
/// The value is expected to be one of:
///
/// * An array of 3 or 4 integer RGB or RGBA color components, with values between 0 and 255 (e.g.
/// `@[ 218, 192, 222 ]`)
/// * A CSS-style hex string, with an optional alpha component (e.g. `#DAC0DE` or `#DACODE55`)
/// * A short CSS-style hex string, with an optional alpha component (e.g. `#DC0` or `#DC05`)
///
/// @param value The object to retrieve data from. See the discussion for the supported object
/// types.
/// @return An initialized color object. The color information represented by this object is in the
/// device RGB colorspace.
- (instancetype)hb_initWithPropertyListValue:(id)value NS_SWIFT_UNAVAILABLE("Use init(propertyListValue:)");
/// Initializes and returns a dynamic color object using the provided interface style variants.
///
/// This color dynamically changes based on the interface style on iOS 13 and newer. If dynamic
/// colors are not supported by the operating system, the value for UIUserInterfaceStyleLight or
/// UIUserInterfaceStyleUnspecified is returned.
///
/// Example:
///
/// ```objc
/// UIColor *myColor = [UIColor hb_colorWithInterfaceStyleVariants:@{
/// @(UIUserInterfaceStyleLight): [UIColor systemRedColor],
/// @(UIUserInterfaceStyleDark): [UIColor systemOrangeColor]
/// }];
/// ```
///
/// @param variants A dictionary of interface style keys and UIColor values.
/// @return An initialized dynamic color object, or the receiver if dynamic colors are unsupported
/// by the current operating system.
+ (instancetype)hb_colorWithInterfaceStyleVariants:(NSDictionary <NSNumber *, UIColor *> *)variants;
/// Initializes and returns a dynamic color object, with saturation decreased by 4% in the dark
/// interface style.
///
/// @return If the color is already a dynamic color, returns the receiver. Otherwise, a new dynamic
/// color object.
/// @see `+hb_colorWithInterfaceStyleVariants:`
- (instancetype)hb_colorWithDarkInterfaceVariant NS_SWIFT_NAME(withDarkInterfaceVariant());
/// Initializes and returns a dynamic color object, with the specified variant color for the dark
/// interface style.
///
/// Example:
///
/// ```objc
/// UIColor *myColor = [[UIColor systemRedColor] hb_colorWithDarkInterfaceVariant:[UIColor systemOrangeColor]];
/// ```
///
/// @param darkColor The color to use in the dark interface style.
/// @return A new dynamic color object.
/// @see `-hb_colorWithInterfaceStyleVariants:`
- (instancetype)hb_colorWithDarkInterfaceVariant:(UIColor *)darkColor NS_SWIFT_NAME(withDarkInterfaceVariant(_:));
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,29 +0,0 @@
//
// Created by Marco Arment on 2014-04-06.
// Copyright (c) 2014 Marco Arment. See included LICENSE file.
//
#import "NSLayoutConstraint+CompactConstraint.h"
/// UIView (CompactConstraint), a class category from Marco Arment’s
/// [CompactConstraint](https://github.com/marcoarment/CompactConstraint) library, is integrated
/// with Cephei. CompactConstraint provides an Auto Layout grammar and methods that are easier to
/// use and understand than UIKit’s built in functions for programmatically adding constraints.
///
/// Refer to [its readme](https://github.com/marcoarment/CompactConstraint/blob/master/README.md) to
/// learn how to use it. There are two changes to note: most importantly, the methods have an `hb_`
/// prefix, and two methods that are marked as deprecated in the original project have been removed.
///
/// CompactConstraint is licensed under the MIT License.
@interface UIView (CompactConstraint)
/// Add a single constraint with the compact syntax.
- (NSLayoutConstraint *)hb_addCompactConstraint:(NSString *)relationship metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views;
/// Add any number of constraints. Can also mix in Visual Format Language strings.
- (NSArray <NSLayoutConstraint *> *)hb_addCompactConstraints:(NSArray <NSString *> *)relationshipStrings metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views;
/// And a convenient shortcut for what we always end up doing with the visualFormat call.
- (void)hb_addConstraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary <NSString *, NSNumber *> *)metrics views:(NSDictionary <NSString *, UIView *> *)views;
@end