Skip to content

Commit

Permalink
Removes tabBar and introduces Upload button
Browse files Browse the repository at this point in the history
  • Loading branch information
EddyLB committed Jun 25, 2018
1 parent b2fc561 commit 9efd688
Show file tree
Hide file tree
Showing 26 changed files with 238 additions and 61 deletions.
Binary file modified Assets/Navigation bar icons/rootAlbum/rootAlbum.afdesign
Binary file not shown.
Binary file modified Assets/Navigation bar icons/rootAlbum/rootAlbum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Navigation bar icons/rootAlbum/rootAlbum@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Navigation bar icons/rootAlbum/rootAlbum@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferences.afdesign
Binary file not shown.
Binary file modified Assets/Tab bar icons/Preferences/preferences.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferences@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferences@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferencesSelected.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferencesSelected@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Assets/Tab bar icons/Preferences/preferencesSelected@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

Expand Up @@ -559,7 +559,7 @@ -(void)deleteCategory

UIAlertAction* emptyCategoryAction = [UIAlertAction
actionWithTitle:NSLocalizedString(@"deleteCategory_empty", @"Delete Empty Album")
style:UIAlertActionStyleDefault
style:UIAlertActionStyleDestructive
handler:^(UIAlertAction * action) {
[self deleteCategoryWithNumberOfImages:0 deletionMode:kCategoryDeletionModeNone andViewController:topViewController];
}];
Expand Down Expand Up @@ -588,6 +588,7 @@ -(void)deleteCategory
// Add actions
switch (self.albumData.totalNumberOfImages) {
case 0:
[alert addAction:cancelAction];
[alert addAction:emptyCategoryAction];
break;

Expand Down
Binary file modified piwigo/Images.xcassets/preferences.imageset/preferences.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified piwigo/Images.xcassets/preferences.imageset/preferences@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified piwigo/Images.xcassets/preferences.imageset/preferences@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified piwigo/Images.xcassets/rootAlbum.imageset/rootAlbum.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified piwigo/Images.xcassets/rootAlbum.imageset/rootAlbum@2x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified piwigo/Images.xcassets/rootAlbum.imageset/rootAlbum@3x.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions piwigo/Settings/SettingsViewController.m
Expand Up @@ -47,6 +47,7 @@ @interface SettingsViewController () <UITableViewDataSource, UITableViewDelegate
@property (nonatomic, strong) UITableView *settingsTableView;
@property (nonatomic, strong) NSLayoutConstraint *topConstraint;
@property (nonatomic, strong) NSLayoutConstraint *tableViewBottomConstraint;
@property (nonatomic, strong) UIBarButtonItem *doneBarButton;

@property (nonatomic, assign) CGFloat previousContentYOffset;
@property (nonatomic, assign) CGFloat minContentYOffset;
Expand All @@ -60,6 +61,7 @@ -(instancetype)init
self = [super init];
if(self)
{
// Table view
self.settingsTableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleGrouped];
self.settingsTableView.translatesAutoresizingMaskIntoConstraints = NO;
self.settingsTableView.backgroundColor = [UIColor clearColor];
Expand All @@ -71,6 +73,9 @@ -(instancetype)init
self.tableViewBottomConstraint = [NSLayoutConstraint constraintViewFromBottom:self.settingsTableView amount:0];
[self.view addConstraint:self.tableViewBottomConstraint];

// Button for returning to albums/images
self.doneBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(quitSettings)];

// Keyboard management
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChange:) name:UIKeyboardWillChangeFrameNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillDismiss:) name:UIKeyboardWillHideNotification object:nil];
Expand Down Expand Up @@ -98,6 +103,7 @@ -(void)viewWillAppear:(BOOL)animated
[self.navigationController.navigationBar setTintColor:[UIColor piwigoOrange]];
[self.navigationController.navigationBar setBarTintColor:[UIColor piwigoBackgroundColor]];
self.navigationController.navigationBar.barStyle = [Model sharedInstance].isDarkPaletteActive ? UIBarStyleBlack : UIBarStyleDefault;
[self.navigationItem setRightBarButtonItems:@[self.doneBarButton] animated:YES];

// Tab bar appearance
self.tabBarController.tabBar.barTintColor = [UIColor piwigoBackgroundColor];
Expand Down Expand Up @@ -127,6 +133,11 @@ -(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIVie
} completion:nil];
}

-(void)quitSettings
{
[self dismissViewControllerAnimated:YES completion:nil];
}


#pragma mark - UITableView - headers

Expand Down Expand Up @@ -934,6 +945,33 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI
// Redraw views in windows
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate screenBrightnessChanged:nil];

// Background color of the view
self.view.backgroundColor = [UIColor piwigoBackgroundColor];
self.settingsTableView.indicatorStyle = [Model sharedInstance].isDarkPaletteActive ?UIScrollViewIndicatorStyleWhite : UIScrollViewIndicatorStyleBlack;

// Navigation bar appearence
NSDictionary *attributes = @{
NSForegroundColorAttributeName: [UIColor piwigoWhiteCream],
NSFontAttributeName: [UIFont piwigoFontNormal],
};
self.navigationController.navigationBar.titleTextAttributes = attributes;
[self.navigationController.navigationBar setTintColor:[UIColor piwigoOrange]];
[self.navigationController.navigationBar setBarTintColor:[UIColor piwigoBackgroundColor]];
self.navigationController.navigationBar.barStyle = [Model sharedInstance].isDarkPaletteActive ? UIBarStyleBlack : UIBarStyleDefault;
[self.navigationItem setRightBarButtonItems:@[self.doneBarButton] animated:YES];

// Tab bar appearance
self.tabBarController.tabBar.barTintColor = [UIColor piwigoBackgroundColor];
self.tabBarController.tabBar.tintColor = [UIColor piwigoOrange];
if (@available(iOS 10, *)) {
self.tabBarController.tabBar.unselectedItemTintColor = [UIColor piwigoTextColor];
}
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor piwigoTextColor]} forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor piwigoOrange]} forState:UIControlStateSelected];

// Table view
self.settingsTableView.separatorColor = [UIColor piwigoSeparatorColor];
};

tableViewCell = cell;
Expand Down Expand Up @@ -968,6 +1006,33 @@ -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSI
// Redraw views in windows
AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate screenBrightnessChanged:nil];

// Background color of the view
self.view.backgroundColor = [UIColor piwigoBackgroundColor];
self.settingsTableView.indicatorStyle = [Model sharedInstance].isDarkPaletteActive ?UIScrollViewIndicatorStyleWhite : UIScrollViewIndicatorStyleBlack;

// Navigation bar appearence
NSDictionary *attributes = @{
NSForegroundColorAttributeName: [UIColor piwigoWhiteCream],
NSFontAttributeName: [UIFont piwigoFontNormal],
};
self.navigationController.navigationBar.titleTextAttributes = attributes;
[self.navigationController.navigationBar setTintColor:[UIColor piwigoOrange]];
[self.navigationController.navigationBar setBarTintColor:[UIColor piwigoBackgroundColor]];
self.navigationController.navigationBar.barStyle = [Model sharedInstance].isDarkPaletteActive ? UIBarStyleBlack : UIBarStyleDefault;
[self.navigationItem setRightBarButtonItems:@[self.doneBarButton] animated:YES];

// Tab bar appearance
self.tabBarController.tabBar.barTintColor = [UIColor piwigoBackgroundColor];
self.tabBarController.tabBar.tintColor = [UIColor piwigoOrange];
if (@available(iOS 10, *)) {
self.tabBarController.tabBar.unselectedItemTintColor = [UIColor piwigoTextColor];
}
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor piwigoTextColor]} forState:UIControlStateNormal];
[[UITabBarItem appearance] setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor piwigoOrange]} forState:UIControlStateSelected];

// Table view
self.settingsTableView.separatorColor = [UIColor piwigoSeparatorColor];
};

tableViewCell = cell;
Expand Down
4 changes: 2 additions & 2 deletions piwigo/Supporting Files/AppDelegate.m
Expand Up @@ -98,8 +98,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

-(void)loadNavigation
{
TabBarViewController *navigation = [TabBarViewController new];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:navigation];
AlbumImagesViewController *albums = [[AlbumImagesViewController alloc] initWithAlbumId:[Model sharedInstance].defaultCategory];
self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:albums];
[self.loginVC removeFromParentViewController];
self.loginVC = nil;

Expand Down
2 changes: 2 additions & 0 deletions piwigo/Upload/Pick Album/CategoryPickViewController.h
Expand Up @@ -10,4 +10,6 @@

@interface CategoryPickViewController : UIViewController

-(instancetype)initWithCategoryId:(NSInteger)categoryId;

@end
16 changes: 15 additions & 1 deletion piwigo/Upload/Pick Album/CategoryPickViewController.m
Expand Up @@ -25,19 +25,24 @@ @interface CategoryPickViewController () <UITableViewDataSource, UITableViewDele
@property (nonatomic, strong) NSMutableArray *categoriesThatShowSubCategories;
@property (nonatomic, strong) UIAlertAction *createAlbumAction;
@property (nonatomic, strong) UIViewController *hudViewController;
@property (nonatomic, strong) UIBarButtonItem *doneBarButton;

@end

@implementation CategoryPickViewController

-(instancetype)init
-(instancetype)initWithCategoryId:(NSInteger)categoryId;
{
// User can upload images/videos if he/she has:
// — admin rights
// — opened a session on a server having Community extension installed
if(([Model sharedInstance].hasAdminRights) ||
([Model sharedInstance].usesCommunityPluginV29 && [Model sharedInstance].hadOpenedSession))
{
// Current category
self.currentCategoryId = categoryId;
self.title = NSLocalizedString(@"tabBar_upload", @"Upload");

// List of categories to present in 2nd section
self.categories = [NSMutableArray new];
self.categoriesThatShowSubCategories = [NSMutableArray new];
Expand All @@ -56,6 +61,9 @@ -(instancetype)init

[[PhotosFetch sharedInstance] getLocalGroupsOnCompletion:nil];

// Button for returning to albums/images
self.doneBarButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(quitUpload)];

// Current category updated by Albums section
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didChangeCurrentCategory:) name:kPiwigoNotificationChangedCurrentCategory object:nil];
}
Expand Down Expand Up @@ -140,6 +148,7 @@ -(void)viewWillAppear:(BOOL)animated
[self.navigationController.navigationBar setTintColor:[UIColor piwigoOrange]];
[self.navigationController.navigationBar setBarTintColor:[UIColor piwigoBackgroundColor]];
self.navigationController.navigationBar.barStyle = [Model sharedInstance].isDarkPaletteActive ? UIBarStyleBlack : UIBarStyleDefault;
[self.navigationItem setRightBarButtonItems:@[self.doneBarButton] animated:YES];

// Tab bar appearance
self.tabBarController.tabBar.barTintColor = [UIColor piwigoBackgroundColor];
Expand All @@ -159,6 +168,11 @@ -(void)viewWillAppear:(BOOL)animated
}];
}

-(void)quitUpload
{
[self dismissViewControllerAnimated:YES completion:nil];
}


#pragma mark - UITableView - Headers

Expand Down

0 comments on commit 9efd688

Please sign in to comment.