Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Resources/Legacy/Localization/ar.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"EXPANDED_SIZE" = "حجم موسع";
"EXPERT" = "خبير";
"FAQ" = "الأسئلة الشائعة";
"FAVORITES" = "المفضلة";
"FEATURED_PACKAGES" = "حزم مميزة";
"FILES" = "الملفات";
"FILESYSTEM_CONTENT" = "محتوى Filesystem ";
Expand Down
1 change: 1 addition & 0 deletions Resources/Legacy/Localization/en.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"EXPANDED_SIZE" = "Expanded Size";
"EXPERT" = "Expert";
"FAQ" = "FAQ";
"FAVORITES" = "Favorites";
"FEATURED_PACKAGES" = "Featured Packages";
"FILES" = "Files";
"FILESYSTEM_CONTENT" = "Filesystem Content";
Expand Down
1 change: 1 addition & 0 deletions Resources/Legacy/Localization/fr.lproj/Localizable.strings
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"EXPANDED_SIZE" = "Taille décompressée";
"EXPERT" = "Expert";
"FAQ" = "FAQ";
"FAVORITES" = "Favoris";
"FEATURED_PACKAGES" = "Paquets conseillés";
"FILES" = "Fichiers";
"FILESYSTEM_CONTENT" = "Contenu";
Expand Down
3 changes: 3 additions & 0 deletions Source/Controllers/Database/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,7 @@ typedef std::map< unsigned long, _H<Source> > SourceMap;

- (NSString *) mappedSectionForPointer:(const char *)pointer;

// new favorites list
- (NSArray *)currentFavorites;
- (void)addPackageToFavoritesList:(Package *)package;
@end
15 changes: 15 additions & 0 deletions Source/Controllers/Database/Database.mm
Original file line number Diff line number Diff line change
Expand Up @@ -777,4 +777,19 @@ - (NSString *) mappedSectionForPointer:(const char *)section {
} return *mapped;
}

// new favorites list
- (NSArray *)currentFavorites {
return [[NSUserDefaults standardUserDefaults] objectForKey:@"FavoritesPackages"];
}

- (void)addPackageToFavoritesList:(Package *)package {
NSMutableArray *currentFavoritesMutable = [[NSMutableArray alloc] initWithArray:[self currentFavorites]];
if (currentFavoritesMutable == nil) {
currentFavoritesMutable = [[NSMutableArray alloc] init];
}
NSString *packageID = package.id;
[currentFavoritesMutable addObject:packageID];
[[NSUserDefaults standardUserDefaults] setObject:[currentFavoritesMutable copy] forKey:@"FavoritesPackages"];
[[NSUserDefaults standardUserDefaults] synchronize];
}
@end
11 changes: 11 additions & 0 deletions Source/Legacy/iPhonePrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ static const UIActivityIndicatorViewStyle UIActivityIndicatorViewStyleWhiteTiny(

@interface UIColor (Apple)
+ (UIColor *) pinStripeColor;
+ (UIColor *)systemDarkGreenColor;
@end

@interface UIControl (Apple)
Expand Down Expand Up @@ -291,6 +292,16 @@ static const UIActivityIndicatorViewStyle UIActivityIndicatorViewStyleWhiteTiny(
- (void) _updateHighlightColorsForView:(id)view highlighted:(BOOL)highlighted;
@end

@class UITableViewRowAction;
@interface _UITableViewCellActionButton : UIButton
- (void)setAction:(UITableViewRowAction *)arg1;
@end

@interface UITableViewRowAction (Apple)
- (void)_setButton:(_UITableViewCellActionButton *)arg1;
- (id)_button;
@end

@interface UITextField (Apple)
- (UITextInputTraits *) textInputTraits;
@end
Expand Down
1 change: 1 addition & 0 deletions Source/Models/Packages/Package/Package.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct ParsedPackage {
- (bool) setSubscribed:(bool)subscribed;

- (BOOL) ignored;
- (bool)isFavorited;

- (NSString *) latest;
- (NSString *) installed;
Expand Down
4 changes: 4 additions & 0 deletions Source/Models/Packages/Package/Package.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,10 @@ - (bool) isCommercial {
return [self hasTag:@"cydia::commercial"];
}

- (bool)isFavorited {

return [[database_ currentFavorites] containsObject:[self id]];
}
- (void) setIndex:(size_t)index {
if (metadata_->index_ != index)
metadata_->index_ = index;
Expand Down
15 changes: 12 additions & 3 deletions Source/UI/Packages/View Controllers/InstalledController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ - (void) useRecent {

- (void) useFilter:(UISegmentedControl *)segmented {
NSInteger selected([segmented selectedSegmentIndex]);
[self updateInstalledListIfNeeded:NO];
if (selected == 3) {
return [self updateInstalledListIfNeeded:YES];
}
if (selected == 2)
return [self useRecent];
bool simple(selected == 0);
Expand All @@ -48,7 +52,9 @@ - (void) useFilter:(UISegmentedControl *)segmented {
}];

[self setSorter:nullptr];
} }
}

}

- (NSArray *) sectionsForPackages:(NSMutableArray *)packages {
if (sectioned_)
Expand Down Expand Up @@ -93,7 +99,10 @@ - (NSArray *) sectionsForPackages:(NSMutableArray *)packages {

- (id) initWithDatabase:(Database *)database {
if ((self = [super initWithDatabase:database title:UCLocalize("INSTALLED")]) != nil) {
UISegmentedControl *segmented([[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:UCLocalize("USER"), UCLocalize("EXPERT"), UCLocalize("RECENT"), nil]] autorelease]);
UISegmentedControl *segmented([[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:UCLocalize("USER"), UCLocalize("EXPERT"), UCLocalize("RECENT"), UCLocalize("FAVORITES"), nil]] autorelease]);
segmented.layer.cornerRadius = CGRectGetHeight(segmented.bounds) / 2;
segmented.layer.borderColor = [UIColor colorWithRed:138 green:89 blue:255 alpha: 1.0].CGColor;
segmented.layer.borderWidth = 1;
[segmented setSelectedSegmentIndex:0];
[segmented setSegmentedControlStyle:UISegmentedControlStyleBar];
[[self navigationItem] setTitleView:segmented];
Expand Down Expand Up @@ -131,4 +140,4 @@ - (void) modeChanged:(UISegmentedControl *)segmented {
[self reloadData];
}

@end
@end
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,5 @@

- (void) didSelectPackage:(Package *)package;

- (void)updateInstalledListIfNeeded:(BOOL)needed;
@end
28 changes: 27 additions & 1 deletion Source/UI/Packages/View Controllers/PackageListController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ - (void) viewDidAppear:(BOOL)animated {
[self deselectWithAnimation:animated];
}

- (void)updateInstalledListIfNeeded:(BOOL)needed {
if (needed == YES) {
// reload table with favorites tweaks
}
}
- (void) didSelectPackage:(Package *)package {
CYPackageController *view([[[CYPackageController alloc] initWithDatabase:database_ forPackage:[package id] withReferrer:[[self referrerURL] absoluteString]] autorelease]);
[view setDelegate:delegate_];
Expand Down Expand Up @@ -178,6 +183,27 @@ - (NSInteger) tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NS
return offset_[index];
}

- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)path {

Package *package([self packageAtIndexPath:path]);
package = [database_ packageWithName:[package id]];

_UITableViewCellActionButton *favoritesButton = [_UITableViewCellActionButton buttonWithType:UIButtonTypeCustom];
[favoritesButton setFrame:CGRectMake(0, 0, 40, ([self isSummarized] ? 38 : 73))];
[favoritesButton setImage:[UIImage imageNamed:@"home7s"] forState:UIControlStateNormal];
favoritesButton.imageView.contentMode = UIViewContentModeScaleAspectFit;
[favoritesButton setBackgroundColor:[UIColor systemDarkGreenColor]];
UITableViewRowAction *addToFavoritesAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {

[tableView setEditing:NO animated:YES];
[database_ addPackageToFavoritesList:package];

}];
[addToFavoritesAction _setButton:favoritesButton];
addToFavoritesAction.backgroundColor = [UIColor systemDarkGreenColor];
return @[addToFavoritesAction];
}

- (void) updateHeight {
[list_ setRowHeight:([self isSummarized] ? 38 : 73)];
}
Expand Down Expand Up @@ -374,4 +400,4 @@ - (void) clearData {
[self resetCursor];
}

@end
@end