mirror of
				https://github.com/opa334/TrollStore.git
				synced 2025-11-04 15:42:35 +08:00 
			
		
		
		
	Let App list show icon and version
This commit is contained in:
		
							parent
							
								
									543ce353ce
								
							
						
					
					
						commit
						54f2c5b7be
					
				@ -2,6 +2,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#import "TSApplicationsManager.h"
 | 
					#import "TSApplicationsManager.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@interface UIImage ()
 | 
				
			||||||
 | 
					+ (UIImage *)_applicationIconImageForBundleIdentifier:(NSString *)id format:(NSInteger)format scale:(double)scale;
 | 
				
			||||||
 | 
					@end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@implementation TSAppTableViewController
 | 
					@implementation TSAppTableViewController
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)reloadTable
 | 
					- (void)reloadTable
 | 
				
			||||||
@ -15,7 +19,6 @@
 | 
				
			|||||||
- (void)loadView
 | 
					- (void)loadView
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    [super loadView];
 | 
					    [super loadView];
 | 
				
			||||||
    [self.tableView registerClass:UITableViewCell.class forCellReuseIdentifier:@"ApplicationCell"];
 | 
					 | 
				
			||||||
    [[NSNotificationCenter defaultCenter] addObserver:self
 | 
					    [[NSNotificationCenter defaultCenter] addObserver:self
 | 
				
			||||||
            selector:@selector(reloadTable)
 | 
					            selector:@selector(reloadTable)
 | 
				
			||||||
            name:@"ApplicationsChanged"
 | 
					            name:@"ApplicationsChanged"
 | 
				
			||||||
@ -81,16 +84,27 @@
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 | 
					- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
 | 
				
			||||||
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ApplicationCell" forIndexPath:indexPath];
 | 
					    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"ApplicationCell"];
 | 
				
			||||||
    
 | 
					    if (!cell) {
 | 
				
			||||||
 | 
					        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"ApplicationCell"];
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    NSString* appPath = [[TSApplicationsManager sharedInstance] installedAppPaths][indexPath.row];
 | 
					    NSString* appPath = [[TSApplicationsManager sharedInstance] installedAppPaths][indexPath.row];
 | 
				
			||||||
    
 | 
					    NSString* appId = [[TSApplicationsManager sharedInstance] appIdForAppPath:appPath];
 | 
				
			||||||
 | 
					    NSString* appVersion = [[TSApplicationsManager sharedInstance] versionStringForAppPath:appPath];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Configure the cell...
 | 
					    // Configure the cell...
 | 
				
			||||||
    cell.textLabel.text = [[TSApplicationsManager sharedInstance] displayNameForAppPath:appPath];
 | 
					    cell.textLabel.text = [[TSApplicationsManager sharedInstance] displayNameForAppPath:appPath];
 | 
				
			||||||
    
 | 
					    cell.detailTextLabel.text = appVersion;
 | 
				
			||||||
 | 
					    cell.imageView.image = [UIImage _applicationIconImageForBundleIdentifier:appId format:10 scale:2.0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return cell;
 | 
					    return cell;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
 | 
				
			||||||
 | 
					    return 80.0f;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 | 
					- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    if(editingStyle == UITableViewCellEditingStyleDelete)
 | 
					    if(editingStyle == UITableViewCellEditingStyleDelete)
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,7 @@
 | 
				
			|||||||
- (NSDictionary*)infoDictionaryForAppPath:(NSString*)appPath;
 | 
					- (NSDictionary*)infoDictionaryForAppPath:(NSString*)appPath;
 | 
				
			||||||
- (NSString*)appIdForAppPath:(NSString*)appPath;
 | 
					- (NSString*)appIdForAppPath:(NSString*)appPath;
 | 
				
			||||||
- (NSString*)displayNameForAppPath:(NSString*)appPath;
 | 
					- (NSString*)displayNameForAppPath:(NSString*)appPath;
 | 
				
			||||||
 | 
					- (NSString*)versionStringForAppPath:(NSString*)appPath;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (NSError*)errorForCode:(int)code;
 | 
					- (NSError*)errorForCode:(int)code;
 | 
				
			||||||
- (int)installIpa:(NSString*)pathToIpa force:(BOOL)force log:(NSString**)logOut;
 | 
					- (int)installIpa:(NSString*)pathToIpa force:(BOOL)force log:(NSString**)logOut;
 | 
				
			||||||
 | 
				
			|||||||
@ -57,6 +57,11 @@
 | 
				
			|||||||
    return displayName;
 | 
					    return displayName;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- (NSString*)versionStringForAppPath:(NSString*)appPath
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return [self infoDictionaryForAppPath:appPath][@"CFBundleShortVersionString"];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (NSError*)errorForCode:(int)code
 | 
					- (NSError*)errorForCode:(int)code
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    NSString* errorDescription = @"Unknown Error";
 | 
					    NSString* errorDescription = @"Unknown Error";
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user