feat: INJECTION !!

PYZULE FINALLY DOESNT SUCK!
This commit is contained in:
zx
2024-09-03 00:13:00 -04:00
parent 8c4d35f568
commit 5fe28ee86c
218 changed files with 7414 additions and 19 deletions

View File

@@ -0,0 +1,18 @@
#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

@@ -0,0 +1,113 @@
#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

@@ -0,0 +1,167 @@
#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

@@ -0,0 +1,46 @@
#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

@@ -0,0 +1,45 @@
#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

@@ -0,0 +1,8 @@
#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

@@ -0,0 +1,129 @@
#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

@@ -0,0 +1,42 @@
#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

@@ -0,0 +1,260 @@
#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

@@ -0,0 +1,10 @@
#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

@@ -0,0 +1,114 @@
#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

@@ -0,0 +1,63 @@
#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

@@ -0,0 +1,38 @@
#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

@@ -0,0 +1,35 @@
#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

@@ -0,0 +1,52 @@
#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

@@ -0,0 +1,77 @@
@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

@@ -0,0 +1,43 @@
#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

@@ -0,0 +1,83 @@
#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

@@ -0,0 +1,20 @@
#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