m (→Simple Approach: More to do) |
(Fixed/removed dead link and minor updates) |
||
(15 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
{{Infobox Package | {{Infobox Package | ||
|developer=[[User:Rpetrich|Ryan Petrich]] | |developer=[[User:Rpetrich|Ryan Petrich]] | ||
|version=1.5. | |version=1.5.9 | ||
|package=applist | |package=applist | ||
}} | }} | ||
'''AppList''' is a library for fetching app information. As described on its package page | '''AppList''' is a library for fetching app information. As described on its package page: "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 == | == How to use this library == | ||
Headers are available from [https://github.com/rpetrich/AppList/tree/master/public Applist's GitHub project] and the library can be found at <code>/usr/lib/libapplist.dylib</code> on a device where | |||
Headers are available from [https://github.com/rpetrich/AppList/tree/master/public Applist's GitHub project] and the library can be found at <code>/usr/lib/libapplist.dylib</code> on a device where AppList is installed. If using Theos, place the headers in <code>$THEOS/include/AppList</code>, the library in <code>$THEOS/lib/</code>. | |||
=== Include directive === | |||
<source lang="objc"> | |||
#import <AppList/AppList.h> | |||
</source> | |||
=== Makefile === | |||
Add to your Makefile: | |||
* <code>applist</code> to the <code>XXX_LIBRARIES</code> variable. | |||
=== Packaging === | |||
Add to your package's control file: | |||
* <code>, mobilesubstrate (>= 0.9.5000), firmware (>= 3.0), com.rpetrich.rocketbootstrap (>= 1.0.3) | firmware (<< 7.0)</code> to the <code>Depends</code> field. | |||
== PreferenceLoader == | == PreferenceLoader == | ||
Line 17: | Line 36: | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! 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 when <tt>ALSingleEnabledMode</tt> is true. || - | |||
|- | |||
| ALSettingsKeyPrefix || string || Key prefix for the key for the data to be saved when <tt>ALSingleEnabledMode</tt> is false. || "ALValue-" | |||
|- | |||
| ALChangeNotification || string || Darwin notification string to be posted when a change happens. || - | |||
|- | |||
| ALAllowsSelection || bool || Enable row selection. || ALSingleEnabledMode value | |||
|} | |} | ||
''To do: | ''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].'' | ||
The following specifier presents a <code>PSLinkCell</code> for Cydia and iFile, which present a <code>PSLinkListCell</code> for a selection of options. | |||
<source lang="xml"> | |||
{ | |||
bundle = AppList; | |||
cell = PSLinkCell; | |||
icon = "/Applications/Preferences.app/icon.png"; | |||
isController = 1; | |||
label = "AppList Sample"; | |||
ALAllowsSelection = 1; | |||
ALSectionDescriptors = ( | |||
{ | |||
title = "Supported Applications"; | |||
predicate = "(displayIdentifier IN {'com.saurik.Cydia','eu.heinelt.ifile'})"; | |||
"cell-class-name" = "ALDisclosureIndicatedCell"; | |||
"icon-size" = 29; | |||
"suppress-hidden-apps" = 1; | |||
action = "showPreferences"; | |||
"display-identifier-macro" = "@@DISPLAYIDENTIFIER@@"; | |||
entry = { | |||
PostNotification = "com.rpetrich.applist.example.plist"; | |||
cell = PSLinkListCell; | |||
default = 0; | |||
defaults = "com.rpetrich.applist.example"; | |||
detail = PSListItemsController; | |||
key = "AppColor-@@DISPLAYIDENTIFIER@@"; | |||
validTitles = ("Default", "iOS Standard"); | |||
validValues = (0, 1); | |||
bundle = "AppList"; | |||
isController = 1; | |||
overridePrincipalClass = 1; | |||
}; | |||
} | |||
); | |||
} | |||
</source> | |||
== | == Retrieving Lists and Icons == | ||
To get an array of applications' bundle identifiers and their display names sorted in alphabetical order by their display name: | To get an array of applications' bundle identifiers and their display names sorted in alphabetical order by their display name: | ||
<source lang=objc> | <source lang=objc> | ||
// sort the apps by display name. displayIdentifiers is an autoreleased object. | |||
NSArray *sortedDisplayIdentifiers; | |||
NSDictionary *applications = [[ALApplicationList sharedApplicationList] applicationsFilteredUsingPredicate:[NSPredicate predicateWithFormat:@"isSystemApplication = TRUE"] | |||
onlyVisible:YES titleSortedIdentifiers:&sortedDisplayIdentifiers]; | |||
</source> | </source> | ||
To get the display identifier and icon for a specific app at index <code> | To get the display identifier and icon for a specific app at index <code>idx</code>, choose a size from this enum: | ||
<source lang=objc> | <source lang=objc> | ||
Line 55: | Line 119: | ||
<source lang=objc> | <source lang=objc> | ||
NSString *displayIdentifier = [displayIdentifiers objectAtIndex: | NSString *displayIdentifier = [displayIdentifiers objectAtIndex:idx]; | ||
UIImage *icon = [apps iconOfSize:ALApplicationIconSizeSmall forDisplayIdentifier:displayIdentifier]; | UIImage *icon = [apps iconOfSize:ALApplicationIconSizeSmall forDisplayIdentifier:displayIdentifier]; | ||
</source> | </source> | ||
As seen in https://github.com/twodayslate/ListLauncher7 | As seen in [https://github.com/twodayslate/ListLauncher7 ListLauncher7]. | ||
== Retrieving Settings == | == Retrieving Settings == | ||
As a filter, when using the simple selections (as single or switch options): | |||
<source lang=logos> | |||
%ctor { | |||
NSString *identifier = [NSBundle mainBundle].bundleIdentifier; | |||
NSMutableDictionary *plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistpath]; | |||
if ([[plistDict objectForKey:[ALSettingsKeyPrefix stringByAppendingString:identifier]] boolValue]) { | |||
%init(someGroup); | |||
} | |||
} | |||
</source> | |||
== Usages in opensource projects == | |||
* https://github.com/iceNuts/DisableNC-Switch | |||
* https://github.com/PoomSmart/AppPad | |||
== External links == | == External links == | ||
* [https://github.com/rpetrich/AppList AppList on GitHub] | * [https://github.com/rpetrich/AppList AppList on GitHub] | ||
{{Navbox Library}} | |||
[[Category:Cydia packages]] | [[Category:Cydia packages]] | ||
[[Category:Directories in /Library]] |
Latest revision as of 04:20, 8 May 2021
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: "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/
.
Include directive
#import <AppList/AppList.h>
Makefile
Add to your Makefile:
applist
to theXXX_LIBRARIES
variable.
Packaging
Add to your package's control file:
, mobilesubstrate (>= 0.9.5000), firmware (>= 3.0), com.rpetrich.rocketbootstrap (>= 1.0.3) | firmware (<< 7.0)
to theDepends
field.
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 when ALSingleEnabledMode is true. | - |
ALSettingsKeyPrefix | string | Key prefix for the key for the data to be saved when ALSingleEnabledMode is false. | "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.
The following specifier presents a PSLinkCell
for Cydia and iFile, which present a PSLinkListCell
for a selection of options.
{
bundle = AppList;
cell = PSLinkCell;
icon = "/Applications/Preferences.app/icon.png";
isController = 1;
label = "AppList Sample";
ALAllowsSelection = 1;
ALSectionDescriptors = (
{
title = "Supported Applications";
predicate = "(displayIdentifier IN {'com.saurik.Cydia','eu.heinelt.ifile'})";
"cell-class-name" = "ALDisclosureIndicatedCell";
"icon-size" = 29;
"suppress-hidden-apps" = 1;
action = "showPreferences";
"display-identifier-macro" = "@@DISPLAYIDENTIFIER@@";
entry = {
PostNotification = "com.rpetrich.applist.example.plist";
cell = PSLinkListCell;
default = 0;
defaults = "com.rpetrich.applist.example";
detail = PSListItemsController;
key = "AppColor-@@DISPLAYIDENTIFIER@@";
validTitles = ("Default", "iOS Standard");
validValues = (0, 1);
bundle = "AppList";
isController = 1;
overridePrincipalClass = 1;
};
}
);
}
Retrieving Lists and Icons
To get an array of applications' bundle identifiers and their display names sorted in alphabetical order by their display name:
// sort the apps by display name. displayIdentifiers is an autoreleased object.
NSArray *sortedDisplayIdentifiers;
NSDictionary *applications = [[ALApplicationList sharedApplicationList] applicationsFilteredUsingPredicate:[NSPredicate predicateWithFormat:@"isSystemApplication = TRUE"]
onlyVisible:YES titleSortedIdentifiers:&sortedDisplayIdentifiers];
To get the display identifier and icon for a specific app at index idx
, choose a size from this enum:
enum {
ALApplicationIconSizeSmall = 29,
ALApplicationIconSizeLarge = 59
};
And use the following snippet:
NSString *displayIdentifier = [displayIdentifiers objectAtIndex:idx];
UIImage *icon = [apps iconOfSize:ALApplicationIconSizeSmall forDisplayIdentifier:displayIdentifier];
As seen in ListLauncher7.
Retrieving Settings
As a filter, when using the simple selections (as single or switch options):
%ctor {
NSString *identifier = [NSBundle mainBundle].bundleIdentifier;
NSMutableDictionary *plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:plistpath];
if ([[plistDict objectForKey:[ALSettingsKeyPrefix stringByAppendingString:identifier]] boolValue]) {
%init(someGroup);
}
}
Usages in opensource projects
External links
|