Skip to content

Commit

Permalink
Fixes #33
Browse files Browse the repository at this point in the history
Updates translations & release notes, improves navigation
  • Loading branch information
EddyLB committed Aug 5, 2019
1 parent bdb69aa commit 2fa77d1
Show file tree
Hide file tree
Showing 33 changed files with 194 additions and 197 deletions.
12 changes: 6 additions & 6 deletions piwigo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
AD6B2E731F0930B40040EAD9 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD6B2E751F0930B40040EAD9 /* Localizable.strings */; };
AD6B2E761F0930CE0040EAD9 /* About.strings in Resources */ = {isa = PBXBuildFile; fileRef = AD6B2E781F0930CE0040EAD9 /* About.strings */; };
AD77109A22F48FCD00E64797 /* TagSelectViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD77109922F48FCD00E64797 /* TagSelectViewController.m */; };
AD77109D22F49A6000E64797 /* TagImagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD77109C22F49A6000E64797 /* TagImagesViewController.m */; };
AD77109D22F49A6000E64797 /* TaggedImagesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = AD77109C22F49A6000E64797 /* TaggedImagesViewController.m */; };
AD7823072061BE7F00D5CA70 /* OpenSansRegular.TTF in Resources */ = {isa = PBXBuildFile; fileRef = AD7823062061BC0000D5CA70 /* OpenSansRegular.TTF */; };
AD7B4C1620E031B0003E403A /* AlbumTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D818EA011A74C7BA00733991 /* AlbumTableViewCell.m */; };
AD7B4C1F20E0D6D9003E403A /* CategoryHeaderReusableView.m in Sources */ = {isa = PBXBuildFile; fileRef = AD7B4C1C20E0D6D8003E403A /* CategoryHeaderReusableView.m */; };
Expand Down Expand Up @@ -214,8 +214,8 @@
AD6B2E7A1F0930FD0040EAD9 /* fr */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = fr; path = fr.lproj/About.strings; sourceTree = "<group>"; };
AD77109622F48F6600E64797 /* TagSelectViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TagSelectViewController.h; sourceTree = "<group>"; };
AD77109922F48FCD00E64797 /* TagSelectViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TagSelectViewController.m; sourceTree = "<group>"; };
AD77109B22F49A5300E64797 /* TagImagesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TagImagesViewController.h; sourceTree = "<group>"; };
AD77109C22F49A6000E64797 /* TagImagesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TagImagesViewController.m; sourceTree = "<group>"; };
AD77109B22F49A5300E64797 /* TaggedImagesViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TaggedImagesViewController.h; sourceTree = "<group>"; };
AD77109C22F49A6000E64797 /* TaggedImagesViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TaggedImagesViewController.m; sourceTree = "<group>"; };
AD7823062061BC0000D5CA70 /* OpenSansRegular.TTF */ = {isa = PBXFileReference; lastKnownFileType = file; path = OpenSansRegular.TTF; sourceTree = "<group>"; };
AD7B4C1C20E0D6D8003E403A /* CategoryHeaderReusableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CategoryHeaderReusableView.m; sourceTree = "<group>"; };
AD7B4C1D20E0D6D8003E403A /* CategoryHeaderReusableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CategoryHeaderReusableView.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -539,8 +539,8 @@
ADAA57D022DD00B700EB4EAA /* DiscoverImagesViewController.m */,
AD77109622F48F6600E64797 /* TagSelectViewController.h */,
AD77109922F48FCD00E64797 /* TagSelectViewController.m */,
AD77109B22F49A5300E64797 /* TagImagesViewController.h */,
AD77109C22F49A6000E64797 /* TagImagesViewController.m */,
AD77109B22F49A5300E64797 /* TaggedImagesViewController.h */,
AD77109C22F49A6000E64797 /* TaggedImagesViewController.m */,
);
path = Discover;
sourceTree = "<group>";
Expand Down Expand Up @@ -1367,7 +1367,7 @@
D8A59EF31ACE45BC00D2EBF0 /* AlbumData.m in Sources */,
D847B8391A7BFF1900231886 /* LEColorPicker.m in Sources */,
D82B8CEB1A67909C000E47CA /* NSLayoutConstraint+CommonConstraints.m in Sources */,
AD77109D22F49A6000E64797 /* TagImagesViewController.m in Sources */,
AD77109D22F49A6000E64797 /* TaggedImagesViewController.m in Sources */,
D82B8CC41A67820A000E47CA /* AppDelegate.m in Sources */,
D8D3F7651A7AF2A100AEA7F1 /* CategoriesData.m in Sources */,
D82B8D301A688512000E47CA /* PiwigoImageData.m in Sources */,
Expand Down
39 changes: 21 additions & 18 deletions piwigo/Albums/AlbumImagesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
CGFloat const kRadius = 25.0;
NSString * const kPiwigoNotificationBackToDefaultAlbum = @"kPiwigoNotificationBackToDefaultAlbum";

@interface AlbumImagesViewController () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, UIToolbarDelegate, UISearchControllerDelegate, UISearchResultsUpdating, UISearchBarDelegate, ImageDetailDelegate, MoveImagesDelegate, CategorySortDelegate, CategoryCollectionViewCellDelegate, AsyncImageActivityItemProviderDelegate>
@interface AlbumImagesViewController () <UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout, UIGestureRecognizerDelegate, UIToolbarDelegate, UISearchControllerDelegate, UISearchResultsUpdating, UISearchBarDelegate, ImageDetailDelegate, MoveImagesDelegate, CategorySortDelegate, CategoryCollectionViewCellDelegate, AsyncImageActivityItemProviderDelegate, TagSelectViewDelegate>

@property (nonatomic, strong) UICollectionView *imagesCollection;
@property (nonatomic, strong) AlbumData *albumData;
Expand Down Expand Up @@ -2123,13 +2123,15 @@ -(void)didSelectCategorySortType:(kPiwigoSortCategory)sortType

-(void)pushView:(UIViewController *)viewController
{
if ([viewController isKindOfClass:[AlbumImagesViewController class]]) {
// Push sub-album view controller
if (([viewController isKindOfClass:[AlbumImagesViewController class]]) ||
([viewController isKindOfClass:[DiscoverImagesViewController class]])) {
// Push sub-album view
[self.navigationController pushViewController:viewController animated:YES];
}
else if (([viewController isKindOfClass:[MoveCategoryViewController class]]) ||
([viewController isKindOfClass:[MoveImageViewController class]])) {
// Present album list for moving current album
([viewController isKindOfClass:[MoveImageViewController class]]) ||
([viewController isKindOfClass:[TagSelectViewController class]])) {
// Present album list for moving current album or images, for selecting a tag
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController];
navController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
Expand All @@ -2144,6 +2146,7 @@ -(void)pushView:(UIViewController *)viewController
}
}


#pragma mark - AsyncImageActivityItemProviderDelegate

-(void)imageActivityItemProviderPreprocessingDidBegin:(UIActivityItemProvider *)imageActivityItemProvider withTitle:(NSString *)title
Expand Down Expand Up @@ -2330,24 +2333,24 @@ -(void)discoverImagesInCategoryId:(NSInteger)categoryId
{
// Create Discover view
DiscoverImagesViewController *discoverController = [[DiscoverImagesViewController alloc] initWithCategoryId:categoryId];

// Embed Discover view in navigation interface
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:discoverController];
[self presentViewController:navController animated:YES completion:^{
// NSLog(@"THE END");
}];
[self pushView:discoverController];
}

-(void)discoverImagesByTag
{
// Create tag selector view
// Push tag select view
TagSelectViewController *discoverController = [[TagSelectViewController alloc] init];

// Embed Discover view in navigation interface
UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:discoverController];
[self presentViewController:navController animated:YES completion:^{
// NSLog(@"THE END");
}];
discoverController.tagSelectDelegate = self;
[self pushView:discoverController];
}


#pragma mark - TagSelectViewDelegate Methods

-(void)pushTaggedImagesView:(UIViewController *)viewController
{
// Push sub-album view
[self.navigationController pushViewController:viewController animated:YES];
}

@end
32 changes: 9 additions & 23 deletions piwigo/Albums/Discover/DiscoverImagesViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ @interface DiscoverImagesViewController () <UICollectionViewDelegate, UICollecti
@property (nonatomic, strong) NSIndexPath *imageOfInterest;
@property (nonatomic, assign) BOOL displayImageTitles;

@property (nonatomic, strong) UIBarButtonItem *cancelBarButton;

@property (nonatomic, assign) kPiwigoSortCategory currentSortCategory;
@property (nonatomic, strong) ImageDetailViewController *imageDetailView;

Expand All @@ -47,27 +45,24 @@ -(instancetype)initWithCategoryId:(NSInteger)categoryId
self.displayImageTitles = [Model sharedInstance].displayImageTitles;

// Collection of images
self.imagesCollection = [[UICollectionView alloc] initWithFrame:self.view.frame collectionViewLayout:[UICollectionViewFlowLayout new]];
self.imagesCollection = [[UICollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:[UICollectionViewFlowLayout new]];
self.imagesCollection.translatesAutoresizingMaskIntoConstraints = NO;
self.imagesCollection.backgroundColor = [UIColor clearColor];
self.imagesCollection.alwaysBounceVertical = YES;
self.imagesCollection.showsVerticalScrollIndicator = YES;
self.imagesCollection.dataSource = self;
self.imagesCollection.delegate = self;
self.imagesCollection.dataSource = self;

[self.imagesCollection registerClass:[ImageCollectionViewCell class] forCellWithReuseIdentifier:@"ImageCollectionViewCell"];
[self.imagesCollection registerClass:[NoImagesHeaderCollectionReusableView class] forSupplementaryViewOfKind:UICollectionElementKindSectionHeader withReuseIdentifier:@"NoImagesHeaderCollection"];

[self.view addSubview:self.imagesCollection];
[self.view addConstraints:[NSLayoutConstraint constraintFillSize:self.imagesCollection]];
if (@available(iOS 11.0, *)) {
[self.imagesCollection setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];
} else {
// Fallback on earlier versions
}

// Bar buttons
self.cancelBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(quitDiscover)];
[self.cancelBarButton setAccessibilityIdentifier:@"Cancel"];
// if (@available(iOS 11.0, *)) {
// [self.imagesCollection setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAlways];
// } else {
// // Fallback on earlier versions
// }

// Register palette changes
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paletteChanged) name:kPiwigoNotificationPaletteChanged object:nil];
Expand Down Expand Up @@ -124,9 +119,6 @@ -(void)viewWillAppear:(BOOL)animated
// Title is name of the category
self.title = [[[CategoriesData sharedInstance] getCategoryById:self.categoryId] name];

// Right side of navigation bar
[self.navigationItem setRightBarButtonItem:self.cancelBarButton animated:YES];

// Hide toolbar
[self.navigationController setToolbarHidden:YES animated:YES];
}
Expand Down Expand Up @@ -237,12 +229,6 @@ -(void)viewWillDisappear:(BOOL)animated
}
}

-(void)quitDiscover
{
// Leave Discover images view and return to Albums and Images
[self dismissViewControllerAnimated:YES completion:nil];
}


#pragma mark - UICollectionView Headers

Expand Down Expand Up @@ -391,7 +377,7 @@ -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPat
self.imageDetailView = [[ImageDetailViewController alloc] initWithCategoryId:self.categoryId atImageIndex:indexPath.row withArray:[self.albumData.images copy]];
self.imageDetailView.hidesBottomBarWhenPushed = YES;
self.imageDetailView.imgDetailDelegate = self;
[[self navigationController] pushViewController:self.imageDetailView animated:YES];
[self.navigationController pushViewController:self.imageDetailView animated:YES];
}


Expand Down
8 changes: 8 additions & 0 deletions piwigo/Albums/Discover/TagSelectViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

#import <UIKit/UIKit.h>

@protocol TagSelectViewDelegate <NSObject>

-(void)pushTaggedImagesView:(UIViewController*)viewController;

@end

@interface TagSelectViewController : UIViewController

@property (nonatomic, weak) id<TagSelectViewDelegate> tagSelectDelegate;

@end
42 changes: 17 additions & 25 deletions piwigo/Albums/Discover/TagSelectViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#import "AppDelegate.h"
#import "Model.h"
#import "PiwigoTagData.h"
#import "TagImagesViewController.h"
#import "TaggedImagesViewController.h"
#import "TagSelectViewController.h"
#import "TagsData.h"

Expand All @@ -18,8 +18,6 @@ @interface TagSelectViewController () <UITableViewDelegate, UITableViewDataSourc
@property (nonatomic, strong) UITableView *tagsTableView;
@property (nonatomic, strong) NSArray *letterIndex;

@property (nonatomic, strong) UIBarButtonItem *cancelBarButton;

@end

@implementation TagSelectViewController
Expand All @@ -31,10 +29,12 @@ -(instancetype)init
{
self.view.backgroundColor = [UIColor piwigoBackgroundColor];

self.tagsTableView = [UITableView new];
self.tagsTableView.backgroundColor = [UIColor clearColor];
self.tagsTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
self.tagsTableView.translatesAutoresizingMaskIntoConstraints = NO;
self.tagsTableView.backgroundColor = [UIColor clearColor];
self.tagsTableView.sectionIndexColor = [UIColor piwigoOrange];
self.tagsTableView.alwaysBounceVertical = YES;
self.tagsTableView.showsVerticalScrollIndicator = YES;
self.tagsTableView.delegate = self;
self.tagsTableView.dataSource = self;
[self.view addSubview:self.tagsTableView];
Expand All @@ -52,10 +52,6 @@ -(instancetype)init
[self.tagsTableView reloadData];
}];

// Bar buttons
self.cancelBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemCancel target:self action:@selector(quitTagSelector)];
[self.cancelBarButton setAccessibilityIdentifier:@"Cancel"];

// Register palette changes
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(paletteChanged) name:kPiwigoNotificationPaletteChanged object:nil];
}
Expand Down Expand Up @@ -96,19 +92,10 @@ -(void)viewWillAppear:(BOOL)animated
// Title
self.title = NSLocalizedString(@"tagsTitle_selectOne", @"Select a Tag");

// Right side of navigation bar
[self.navigationItem setRightBarButtonItem:self.cancelBarButton animated:YES];

// Set colors, fonts, etc.
[self paletteChanged];
}

-(void)quitTagSelector
{
// Leave Discover images view and return to Albums and Images
[self dismissViewControllerAnimated:YES completion:nil];
}

-(void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
Expand All @@ -130,7 +117,7 @@ - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index {

NSInteger newRow = [self indexForFirstChar:title inArray:[[TagsData sharedInstance].tagList valueForKey:@"tagName"]];
NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:newRow inSection:1];
NSIndexPath *newIndexPath = [NSIndexPath indexPathForRow:newRow inSection:0];
[tableView scrollToRowAtIndexPath:newIndexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];

return index;
Expand Down Expand Up @@ -173,7 +160,6 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI
cell.backgroundColor = [UIColor piwigoCellBackgroundColor];
cell.tintColor = [UIColor piwigoOrange];
cell.textLabel.textColor = [UIColor piwigoLeftLabelColor];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;

PiwigoTagData *currentTag;
currentTag = [TagsData sharedInstance].tagList[indexPath.row];
Expand All @@ -191,11 +177,17 @@ -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *
{
// Deselect row
[tableView deselectRowAtIndexPath:indexPath animated:YES];

// Display images of selected tag
PiwigoTagData *currentTag = [TagsData sharedInstance].tagList[indexPath.row];
TagImagesViewController *vc = [[TagImagesViewController alloc] initWithTagId:currentTag.tagId andTagName:currentTag.tagName];
[self.navigationController pushViewController:vc animated:YES];

// Dismiss tag select
[self dismissViewControllerAnimated:YES completion:^{
// Push tagged images view
if([self.tagSelectDelegate respondsToSelector:@selector(pushTaggedImagesView:)])
{
PiwigoTagData *currentTag = [TagsData sharedInstance].tagList[indexPath.row];
TaggedImagesViewController *taggedImagesVC = [[TaggedImagesViewController alloc] initWithTagId:currentTag.tagId andTagName:currentTag.tagName];
[self.tagSelectDelegate pushTaggedImagesView:taggedImagesVC];
}
}];
}

@end
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// TagImagesViewController.h
// TaggedImagesViewController.h
// piwigo
//
// Created by Eddy Lelièvre-Berna on 02/08/2019.
Expand All @@ -8,7 +8,7 @@

#import <UIKit/UIKit.h>

@interface TagImagesViewController : UIViewController
@interface TaggedImagesViewController : UIViewController

-(instancetype)initWithTagId:(NSInteger)tagId andTagName:(NSString *)tagName;

Expand Down
Loading

0 comments on commit 2fa77d1

Please sign in to comment.