(updating version info) |
|||
Line 40: | Line 40: | ||
|} | |} | ||
''To do: Add missing keys "listed" in the [https://github.com/rpetrich/AppList/blob/master/ALApplicationTableDataSource.m source code].'' | ''To do: Add missing keys "listed" in the [https://github.com/rpetrich/AppList/blob/master/ALApplicationTableDataSource.m source code]. Expand ALSectionDescriptors' usage like in [https://github.com/rpetrich/Emphasize/blob/master/layout/Library/PreferenceLoader/Preferences/Emphasize/Emphasize.plist Emphasize].'' | ||
=== PreferenceBundle Approach === | === PreferenceBundle Approach === |
Revision as of 22:56, 26 January 2015
AppList | |
Cydia Package | |
---|---|
Developer | Ryan Petrich |
Package ID | applist |
Latest Version | 1.5.9 |
AppList is a library for fetching app information. As described on its package page in Cydia: "Allows developers to query the list of installed apps and provide a preferences pane based on that information. Exports displayIdentifier, displayName, icon and smallIcon via a remote messaging center so that it's easy to write a prefs pane that presents a list of apps."
How to use this library
Headers are available from Applist's GitHub project and the library can be found at /usr/lib/libapplist.dylib
on a device where Applist is installed. If using Theos, place the headers in $THEOS/include/Applist
, the library in $THEOS/lib/
and add applist
to the XXX_LIBRARIES
Makefile variable.
PreferenceLoader
Simple Approach
The common way to use AppList is via its PreferenceLoader (preferences) integration, by putting entries in a PreferenceLoader plist: AppListSample.plist.
Key | Type | Description | Default value |
---|---|---|---|
ALNavigationTitle | string | Navigation title. | The specifier name |
ALSingleEnabledMode | bool | Switch between single and multiple row selection. | NO |
ALSectionDescriptors | array | Array of PSSpecifier-style dictionaries. | - |
ALLocalizationBundle | string | Absolute path to a localization bundle. | nil |
ALSettingsDefaultValue | object | Default value. | - |
ALSettingsPath | string | Absolute file path to a settings file. | - |
ALSettingsKey | string | Key for the data to be saved. | - |
ALSettingsKeyPrefix | string | Key prefix for the key for the data to be saved. | "ALValue-" |
ALChangeNotification | string | Darwin notification string to be posted when a change happens. | - |
ALAllowsSelection | bool | Enable row selection. | ALSingleEnabledMode value |
To do: Add missing keys "listed" in the source code. Expand ALSectionDescriptors' usage like in Emphasize.
PreferenceBundle Approach
To get an array of applications' bundle identifiers and their display names sorted in alphabetical order by their display name:
// list all the apps
ALApplicationList *apps = [ALApplicationList sharedApplicationList];
// sort the apps by display name. displayIdentifiers is an autoreleased object.
NSArray *displayIdentifiers = [[apps.applications allKeys] sortedArrayUsingComparator:^NSComparisonResult(id obj1, id obj2) {
return [[apps.applications objectForKey:obj1] caseInsensitiveCompare:[apps.applications objectForKey:obj2]];}];
To get the display identifier and icon for a specific app at index {X}
, choose a size from this enum:
enum {
ALApplicationIconSizeSmall = 29,
ALApplicationIconSizeLarge = 59
};
And use the following snippet:
NSString *displayIdentifier = [displayIdentifiers objectAtIndex:{X}];
UIImage *icon = [apps iconOfSize:ALApplicationIconSizeSmall forDisplayIdentifier:displayIdentifier];
As seen in ListLauncher7.
Retrieving Settings
To access the list of applications use the following, filtered by enabled apps:
This should be revised
NSMutableDictionary *plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistpath];
[[plistDict objectForKey:@"enable"] isEqualToString: @"YES"];
As seen in https://github.com/iceNuts/DisableNC-Switch