fixed Sync
This commit is contained in:
parent
bcc049f369
commit
7d001c9d16
9 changed files with 139 additions and 139 deletions
|
@ -50,16 +50,25 @@
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleLeftView)];
|
// menu
|
||||||
|
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
UIImage *leftButtonImage = [UIImage imageNamed:@"button-navigation-menu.png"] ;
|
||||||
|
[leftButton setImage:leftButtonImage forState:UIControlStateNormal];
|
||||||
|
leftButton.frame = CGRectMake(0, 0, leftButtonImage.size.width, leftButtonImage.size.height);
|
||||||
|
[leftButton addTarget:self.viewDeckController action:@selector(toggleLeftView) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
if ([self.navigationItem respondsToSelector:@selector(rightBarButtonItems)]) {
|
UIBarButtonItem *customLeftButton = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||||
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:
|
self.navigationItem.leftBarButtonItem = customLeftButton;
|
||||||
[[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)],
|
|
||||||
nil];
|
// camera
|
||||||
}
|
UIButton *buttonRight = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
else {
|
UIImage *buttonRightImage = [UIImage imageNamed:@"button-navigation-camera.png"] ;
|
||||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)];
|
[buttonRight setImage:buttonRightImage forState:UIControlStateNormal];
|
||||||
}
|
buttonRight.frame = CGRectMake(0, 0, buttonRightImage.size.width, buttonRightImage.size.height);
|
||||||
|
[buttonRight addTarget:self action:@selector(capturePhoto) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
UIBarButtonItem *customRightButton = [[UIBarButtonItem alloc] initWithCustomView:buttonRight];
|
||||||
|
self.navigationItem.rightBarButtonItem = customRightButton;
|
||||||
|
|
||||||
// title
|
// title
|
||||||
self.navigationItem.title = NSLocalizedString(@"Albums", @"Menu - title for Albums");
|
self.navigationItem.title = NSLocalizedString(@"Albums", @"Menu - title for Albums");
|
||||||
|
@ -83,6 +92,8 @@
|
||||||
[self.navigationController.navigationBar insertSubview:imageView atIndex:0];
|
[self.navigationController.navigationBar insertSubview:imageView atIndex:0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,16 +41,25 @@
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleLeftView)];
|
// menu
|
||||||
|
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
UIImage *leftButtonImage = [UIImage imageNamed:@"button-navigation-menu.png"] ;
|
||||||
|
[leftButton setImage:leftButtonImage forState:UIControlStateNormal];
|
||||||
|
leftButton.frame = CGRectMake(0, 0, leftButtonImage.size.width, leftButtonImage.size.height);
|
||||||
|
[leftButton addTarget:self.viewDeckController action:@selector(toggleLeftView) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
if ([self.navigationItem respondsToSelector:@selector(rightBarButtonItems)]) {
|
UIBarButtonItem *customLeftButton = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||||
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:
|
self.navigationItem.leftBarButtonItem = customLeftButton;
|
||||||
[[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)],
|
|
||||||
nil];
|
// camera
|
||||||
}
|
UIButton *buttonRight = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
else {
|
UIImage *buttonRightImage = [UIImage imageNamed:@"button-navigation-camera.png"] ;
|
||||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)];
|
[buttonRight setImage:buttonRightImage forState:UIControlStateNormal];
|
||||||
}
|
buttonRight.frame = CGRectMake(0, 0, buttonRightImage.size.width, buttonRightImage.size.height);
|
||||||
|
[buttonRight addTarget:self action:@selector(capturePhoto) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
UIBarButtonItem *customRightButton = [[UIBarButtonItem alloc] initWithCustomView:buttonRight];
|
||||||
|
self.navigationItem.rightBarButtonItem = customRightButton;
|
||||||
|
|
||||||
// image for the navigator
|
// image for the navigator
|
||||||
if([[UINavigationBar class] respondsToSelector:@selector(appearance)]){
|
if([[UINavigationBar class] respondsToSelector:@selector(appearance)]){
|
||||||
|
|
|
@ -129,7 +129,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// check if needs to update the profile
|
// check if needs to update the profile
|
||||||
[self needsUpdateProfileDetails];
|
[self needsUpdateProfileDetails];
|
||||||
}
|
}
|
||||||
|
@ -177,12 +176,6 @@
|
||||||
|
|
||||||
// title
|
// title
|
||||||
self.navigationItem.title = @"";
|
self.navigationItem.title = @"";
|
||||||
|
|
||||||
UIImage *backgroundImage = [UIImage imageNamed:@"Background.png"];
|
|
||||||
|
|
||||||
// color separator
|
|
||||||
self.tableView.backgroundColor = [[UIColor alloc] initWithPatternImage:backgroundImage];
|
|
||||||
self.tableView.separatorColor = UIColorFromRGB(0xC8BEA0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import "AuthenticationService.h"
|
#import "AuthenticationService.h"
|
||||||
#import "TagViewController.h"
|
#import "TagViewController.h"
|
||||||
|
@ -30,6 +29,15 @@
|
||||||
#import "GalleryViewController.h"
|
#import "GalleryViewController.h"
|
||||||
#import "DisplayUtilities.h"
|
#import "DisplayUtilities.h"
|
||||||
|
|
||||||
@interface MenuViewController : UITableViewController
|
// for settings
|
||||||
|
#import "IASKAppSettingsViewController.h"
|
||||||
|
#import "IASKSettingsStoreFile.h"
|
||||||
|
|
||||||
|
@interface MenuViewController : UITableViewController<IASKSettingsDelegate>
|
||||||
|
{
|
||||||
|
OpenPhotoIASKAppSettingsViewController *appSettingsViewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
@property (nonatomic, strong) OpenPhotoIASKAppSettingsViewController *appSettingsViewController;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#import "IIViewDeckController.h"
|
#import "IIViewDeckController.h"
|
||||||
|
|
||||||
@implementation MenuViewController
|
@implementation MenuViewController
|
||||||
|
@synthesize appSettingsViewController;
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
|
- (id)initWithNibName:(NSString *)nibName bundle:(NSBundle *)nibBundle
|
||||||
{
|
{
|
||||||
|
@ -73,10 +74,10 @@
|
||||||
{
|
{
|
||||||
if (section == 0){
|
if (section == 0){
|
||||||
// your photos menu
|
// your photos menu
|
||||||
return 4;
|
return 5;
|
||||||
}else{
|
}else{
|
||||||
// settings
|
// settings
|
||||||
return 3;
|
return 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@
|
||||||
return NSLocalizedString(@"Your Photos", @"Used to title your photos in Menu");
|
return NSLocalizedString(@"Your Photos", @"Used to title your photos in Menu");
|
||||||
}else{
|
}else{
|
||||||
// settings
|
// settings
|
||||||
return NSLocalizedString(@"Settings", @"Used to title Settings in Menu");
|
return NSLocalizedString(@"PREFERENCES", @"Used to title Preferences in Menu");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,7 +105,7 @@
|
||||||
// your photos menu
|
// your photos menu
|
||||||
switch (indexPath.row) {
|
switch (indexPath.row) {
|
||||||
case 0:
|
case 0:
|
||||||
cell.textLabel.text = NSLocalizedString(@"Home", @"Menu - title for Home");
|
cell.textLabel.text = NSLocalizedString(@"Latest Activity", @"Menu - title for Home");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cell.textLabel.text = NSLocalizedString(@"Gallery", @"Menu - title for Gallery");
|
cell.textLabel.text = NSLocalizedString(@"Gallery", @"Menu - title for Gallery");
|
||||||
|
@ -115,6 +116,9 @@
|
||||||
case 3:
|
case 3:
|
||||||
cell.textLabel.text = NSLocalizedString(@"Tags", @"Menu - title for Tags");
|
cell.textLabel.text = NSLocalizedString(@"Tags", @"Menu - title for Tags");
|
||||||
break;
|
break;
|
||||||
|
case 4:
|
||||||
|
cell.textLabel.text = NSLocalizedString(@"Upload & Sync", @"Menu - title for Upload & Sync");
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
cell.textLabel.text = @"not defined";
|
cell.textLabel.text = @"not defined";
|
||||||
break;
|
break;
|
||||||
|
@ -122,19 +126,10 @@
|
||||||
}else{
|
}else{
|
||||||
switch (indexPath.row) {
|
switch (indexPath.row) {
|
||||||
case 0:
|
case 0:
|
||||||
cell.textLabel.text = NSLocalizedString(@"Account", @"Menu - title for Account");
|
cell.textLabel.text = NSLocalizedString(@"My Account", @"Menu - title for Account");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
cell.textLabel.text = ([AuthenticationService isLogged] ? NSLocalizedString(@"Log out", @"Menu - title for Log out") : NSLocalizedString(@"Login", @"Menu - title for Login"));
|
cell.textLabel.text = NSLocalizedString(@"Settings", @"Menu - title for Settings");
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
cell.textLabel.text = NSLocalizedString(@"Upgrade", @"Menu - title for Upgrade");
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
cell.textLabel.text = NSLocalizedString(@"Properties", @"Menu - title for Properties");
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
cell.textLabel.text = NSLocalizedString(@"Contact Us", @"Menu - title for Contact us");
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cell.textLabel.text = @"not defined";
|
cell.textLabel.text = @"not defined";
|
||||||
|
@ -159,7 +154,7 @@
|
||||||
cc.navigationItem.title = [tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
cc.navigationItem.title = [tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
|
|
||||||
if ( indexPath.section == 0 && indexPath.row == 0){
|
if ( indexPath.section == 0 && indexPath.row == 0){
|
||||||
// Home
|
// Latest activity
|
||||||
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[HomeTableViewController alloc] init]];
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[HomeTableViewController alloc] init]];
|
||||||
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
controller.centerController = nav;
|
controller.centerController = nav;
|
||||||
|
@ -178,24 +173,19 @@
|
||||||
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[TagViewController alloc] init]];
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[TagViewController alloc] init]];
|
||||||
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
controller.centerController = nav;
|
controller.centerController = nav;
|
||||||
|
}else if ( indexPath.section == 0 && indexPath.row == 4){
|
||||||
|
// Upload & Sync
|
||||||
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[SyncViewController alloc] init]];
|
||||||
|
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
|
controller.centerController = nav;
|
||||||
}else if ( indexPath.section == 1 && indexPath.row == 0){
|
}else if ( indexPath.section == 1 && indexPath.row == 0){
|
||||||
// Account
|
// Account - Profile
|
||||||
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[AccountViewController alloc] init]];
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[ProfileViewController alloc] init]];
|
||||||
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
controller.centerController = nav;
|
controller.centerController = nav;
|
||||||
}else if ( indexPath.section == 1 && indexPath.row == 1){
|
}else if ( indexPath.section == 1 && indexPath.row == 1){
|
||||||
// Log out
|
// Settings
|
||||||
if ([AuthenticationService isLogged]){
|
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:self.appSettingsViewController];
|
||||||
// do the log out
|
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Are you sure?", @"Message when logging out") message:nil delegate:self cancelButtonTitle:NSLocalizedString(@"Cancel",@"General") otherButtonTitles:NSLocalizedString(@"Log out",@"General"),nil] ;
|
|
||||||
[alert show];
|
|
||||||
}else{
|
|
||||||
// open the login
|
|
||||||
[self openLoginViewController];
|
|
||||||
}
|
|
||||||
}else if ( indexPath.section == 1 && indexPath.row == 2){
|
|
||||||
// Profile
|
|
||||||
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[ProfileViewController alloc] init]];
|
|
||||||
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
nav.title=[tableView cellForRowAtIndexPath:indexPath].textLabel.text;
|
||||||
controller.centerController = nav;
|
controller.centerController = nav;
|
||||||
}
|
}
|
||||||
|
@ -210,22 +200,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)alertView:(UIAlertView *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
|
|
||||||
if (buttonIndex == 1){
|
|
||||||
|
|
||||||
#ifdef DEVELOPMENT_ENABLED
|
|
||||||
NSLog(@"Log out");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
AuthenticationService *service = [[AuthenticationService alloc]init];
|
|
||||||
[service logout];
|
|
||||||
[self.tableView reloadData];
|
|
||||||
|
|
||||||
// open the login
|
|
||||||
[self openLoginViewController];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) openLoginViewController
|
- (void) openLoginViewController
|
||||||
{
|
{
|
||||||
// open the login
|
// open the login
|
||||||
|
@ -247,6 +221,37 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (OpenPhotoIASKAppSettingsViewController*)appSettingsViewController {
|
||||||
|
if (!appSettingsViewController) {
|
||||||
|
appSettingsViewController = [[OpenPhotoIASKAppSettingsViewController alloc] initWithNibName:@"IASKAppSettingsView" bundle:nil];
|
||||||
|
appSettingsViewController.delegate = self;
|
||||||
|
[appSettingsViewController setShowCreditsFooter:NO];
|
||||||
|
appSettingsViewController.showDoneButton = NO;
|
||||||
|
}
|
||||||
|
return appSettingsViewController;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key {
|
||||||
|
if ([key isEqualToString:@"CleanCache"]){
|
||||||
|
[Timeline deleteAllTimelineInManagedObjectContext:[SharedAppDelegate managedObjectContext]];
|
||||||
|
[Synced deleteAllSyncedPhotosInManagedObjectContext:[SharedAppDelegate managedObjectContext]];
|
||||||
|
NSError *saveError = nil;
|
||||||
|
if (![[SharedAppDelegate managedObjectContext] save:&saveError]){
|
||||||
|
NSLog(@"Error to save context = %@",[saveError localizedDescription]);
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove cache
|
||||||
|
SDImageCache *imageCache = [SDImageCache sharedImageCache];
|
||||||
|
[imageCache clearMemory];
|
||||||
|
[imageCache clearDisk];
|
||||||
|
[imageCache cleanDisk];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender {
|
||||||
|
[self dismissModalViewControllerAnimated:YES];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||||
|
|
|
@ -33,6 +33,16 @@
|
||||||
|
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
|
|
||||||
|
// menu
|
||||||
|
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
UIImage *leftButtonImage = [UIImage imageNamed:@"button-navigation-menu.png"] ;
|
||||||
|
[leftButton setImage:leftButtonImage forState:UIControlStateNormal];
|
||||||
|
leftButton.frame = CGRectMake(0, 0, leftButtonImage.size.width, leftButtonImage.size.height);
|
||||||
|
[leftButton addTarget:self.viewDeckController action:@selector(toggleLeftView) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
UIBarButtonItem *customLeftButton = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||||
|
self.navigationItem.leftBarButtonItem = customLeftButton;
|
||||||
|
|
||||||
// add log out
|
// add log out
|
||||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
UIImage *buttonImage = [UIImage imageNamed:@"logout.png"] ;
|
UIImage *buttonImage = [UIImage imageNamed:@"logout.png"] ;
|
||||||
|
|
|
@ -8,9 +8,6 @@
|
||||||
|
|
||||||
#import "WebService.h"
|
#import "WebService.h"
|
||||||
#import "OpenPhotoIASKAppSettingsViewController.h"
|
#import "OpenPhotoIASKAppSettingsViewController.h"
|
||||||
#import "IASKAppSettingsViewController.h"
|
|
||||||
#import "IASKSettingsStoreFile.h"
|
|
||||||
|
|
||||||
// image cache
|
// image cache
|
||||||
#import <SDWebImage/UIImageView+WebCache.h>
|
#import <SDWebImage/UIImageView+WebCache.h>
|
||||||
|
|
||||||
|
@ -27,10 +24,7 @@
|
||||||
#import <QuartzCore/QuartzCore.h>
|
#import <QuartzCore/QuartzCore.h>
|
||||||
#import "WebViewController.h"
|
#import "WebViewController.h"
|
||||||
|
|
||||||
@interface ProfileViewController : GAITrackedViewController <UIAlertViewDelegate, IASKSettingsDelegate>
|
@interface ProfileViewController : GAITrackedViewController <UIAlertViewDelegate>
|
||||||
{
|
|
||||||
OpenPhotoIASKAppSettingsViewController *appSettingsViewController;
|
|
||||||
}
|
|
||||||
|
|
||||||
@property (nonatomic, weak) IBOutlet UILabel *labelAlbums;
|
@property (nonatomic, weak) IBOutlet UILabel *labelAlbums;
|
||||||
@property (nonatomic, weak) IBOutlet UILabel *labelPhotos;
|
@property (nonatomic, weak) IBOutlet UILabel *labelPhotos;
|
||||||
|
@ -47,6 +41,5 @@
|
||||||
- (IBAction)openFeaturesList:(id)sender;
|
- (IBAction)openFeaturesList:(id)sender;
|
||||||
@property (nonatomic, weak) IBOutlet UIButton *buttonFeatureList;
|
@property (nonatomic, weak) IBOutlet UIButton *buttonFeatureList;
|
||||||
|
|
||||||
@property (nonatomic, retain) OpenPhotoIASKAppSettingsViewController *appSettingsViewController;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
|
|
||||||
@implementation ProfileViewController
|
@implementation ProfileViewController
|
||||||
|
|
||||||
@synthesize appSettingsViewController;
|
|
||||||
|
|
||||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
|
||||||
{
|
{
|
||||||
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
|
||||||
|
@ -45,36 +43,6 @@
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (OpenPhotoIASKAppSettingsViewController*)appSettingsViewController {
|
|
||||||
if (!appSettingsViewController) {
|
|
||||||
appSettingsViewController = [[OpenPhotoIASKAppSettingsViewController alloc] initWithNibName:@"IASKAppSettingsView" bundle:nil];
|
|
||||||
appSettingsViewController.delegate = self;
|
|
||||||
}
|
|
||||||
return appSettingsViewController;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)settingsViewController:(IASKAppSettingsViewController*)sender buttonTappedForKey:(NSString*)key {
|
|
||||||
if ([key isEqualToString:@"CleanCache"]){
|
|
||||||
[Timeline deleteAllTimelineInManagedObjectContext:[SharedAppDelegate managedObjectContext]];
|
|
||||||
[Synced deleteAllSyncedPhotosInManagedObjectContext:[SharedAppDelegate managedObjectContext]];
|
|
||||||
NSError *saveError = nil;
|
|
||||||
if (![[SharedAppDelegate managedObjectContext] save:&saveError]){
|
|
||||||
NSLog(@"Error to save context = %@",[saveError localizedDescription]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//remove cache
|
|
||||||
SDImageCache *imageCache = [SDImageCache sharedImageCache];
|
|
||||||
[imageCache clearMemory];
|
|
||||||
[imageCache clearDisk];
|
|
||||||
[imageCache cleanDisk];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)settingsViewControllerDidEnd:(IASKAppSettingsViewController*)sender {
|
|
||||||
[self dismissModalViewControllerAnimated:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)viewDidLoad
|
- (void)viewDidLoad
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
@ -92,14 +60,15 @@
|
||||||
[super viewWillAppear:animated];
|
[super viewWillAppear:animated];
|
||||||
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
|
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
|
||||||
|
|
||||||
UIButton *buttonSettings = [UIButton buttonWithType:UIButtonTypeCustom];
|
// menu
|
||||||
UIImage *buttonImageSettings = [UIImage imageNamed:@"settingsbtn.png"] ;
|
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
[buttonSettings setImage:buttonImageSettings forState:UIControlStateNormal];
|
UIImage *leftButtonImage = [UIImage imageNamed:@"button-navigation-menu.png"] ;
|
||||||
buttonSettings.frame = CGRectMake(0, 0, buttonImageSettings.size.width, buttonImageSettings.size.height);
|
[leftButton setImage:leftButtonImage forState:UIControlStateNormal];
|
||||||
[buttonSettings addTarget:self action:@selector(settingsButton) forControlEvents:UIControlEventTouchUpInside];
|
leftButton.frame = CGRectMake(0, 0, leftButtonImage.size.width, leftButtonImage.size.height);
|
||||||
|
[leftButton addTarget:self.viewDeckController action:@selector(toggleLeftView) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
UIBarButtonItem *customBarItemRefresh = [[UIBarButtonItem alloc] initWithCustomView:buttonSettings];
|
UIBarButtonItem *customLeftButton = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||||
self.navigationItem.leftBarButtonItem = customBarItemRefresh;
|
self.navigationItem.leftBarButtonItem = customLeftButton;
|
||||||
|
|
||||||
// add log out
|
// add log out
|
||||||
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
@ -115,13 +84,6 @@
|
||||||
[self loadUserDetails];
|
[self loadUserDetails];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) settingsButton
|
|
||||||
{
|
|
||||||
[self.appSettingsViewController setShowCreditsFooter:NO];
|
|
||||||
self.appSettingsViewController.showDoneButton = NO;
|
|
||||||
[self.navigationController pushViewController:self.appSettingsViewController animated:YES];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) logoutButton{
|
- (void) logoutButton{
|
||||||
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log out. Are you sure?" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Log out",nil] ;
|
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Log out. Are you sure?" message:nil delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Log out",nil] ;
|
||||||
[alert show];
|
[alert show];
|
||||||
|
|
|
@ -106,16 +106,25 @@
|
||||||
{
|
{
|
||||||
[super viewDidLoad];
|
[super viewDidLoad];
|
||||||
|
|
||||||
self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Menu" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleLeftView)];
|
// menu
|
||||||
|
UIButton *leftButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
|
UIImage *leftButtonImage = [UIImage imageNamed:@"button-navigation-menu.png"] ;
|
||||||
|
[leftButton setImage:leftButtonImage forState:UIControlStateNormal];
|
||||||
|
leftButton.frame = CGRectMake(0, 0, leftButtonImage.size.width, leftButtonImage.size.height);
|
||||||
|
[leftButton addTarget:self.viewDeckController action:@selector(toggleLeftView) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
if ([self.navigationItem respondsToSelector:@selector(rightBarButtonItems)]) {
|
UIBarButtonItem *customLeftButton = [[UIBarButtonItem alloc] initWithCustomView:leftButton];
|
||||||
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:
|
self.navigationItem.leftBarButtonItem = customLeftButton;
|
||||||
[[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)],
|
|
||||||
nil];
|
// camera
|
||||||
}
|
UIButton *buttonRight = [UIButton buttonWithType:UIButtonTypeCustom];
|
||||||
else {
|
UIImage *buttonRightImage = [UIImage imageNamed:@"button-navigation-camera.png"] ;
|
||||||
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Sync" style:UIBarButtonItemStyleBordered target:self.viewDeckController action:@selector(toggleRightView)];
|
[buttonRight setImage:buttonRightImage forState:UIControlStateNormal];
|
||||||
}
|
buttonRight.frame = CGRectMake(0, 0, buttonRightImage.size.width, buttonRightImage.size.height);
|
||||||
|
[buttonRight addTarget:self action:@selector(capturePhoto) forControlEvents:UIControlEventTouchUpInside];
|
||||||
|
|
||||||
|
UIBarButtonItem *customRightButton = [[UIBarButtonItem alloc] initWithCustomView:buttonRight];
|
||||||
|
self.navigationItem.rightBarButtonItem = customRightButton;
|
||||||
|
|
||||||
// title
|
// title
|
||||||
self.navigationItem.title = NSLocalizedString(@"Tags", @"Menu - title for Tags");
|
self.navigationItem.title = NSLocalizedString(@"Tags", @"Menu - title for Tags");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue