Browse Source

New settings view

Marino Faggiana 8 years ago
parent
commit
8a8f568da6

+ 0 - 1
iOSClient/Settings/CCSettings.h

@@ -28,7 +28,6 @@
 #import "BKPasscodeViewController.h"
 #import "CCUtility.h"
 #import "CCHud.h"
-#import "APAvatarImageView.h"
 #import "TableAccount+CoreDataClass.h"
 
 @interface CCSettings : XLFormViewController <BKPasscodeViewControllerDelegate, MFMailComposeViewControllerDelegate>

+ 5 - 34
iOSClient/Settings/CCSettings.m

@@ -123,11 +123,10 @@
     section = [XLFormSectionDescriptor formSectionWithTitle:NSLocalizedString(@"_user_information_", nil)];
     [form addFormSection:section];
     
-    // Display Name
-    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userdisplayname" rowType:XLFormRowDescriptorTypeInfo];
+    // Full Name
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"userfullname" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_user_full_name_", nil)];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
-    row.cellConfig[@"textLabel.numberOfLines"] = @0;
     [section addFormRow:row];
     
     // Address
@@ -400,7 +399,7 @@
     XLFormRowDescriptor *rowUserNameCloud = [self.form formRowWithTag:@"usernamecloud"];
     XLFormRowDescriptor *rowQuota = [self.form formRowWithTag:@"quota"];
 
-    XLFormRowDescriptor *rowUserDisplayName = [self.form formRowWithTag:@"userdisplayname"];
+    XLFormRowDescriptor *rowUserFullName = [self.form formRowWithTag:@"userfullname"];
     XLFormRowDescriptor *rowUserAddress = [self.form formRowWithTag:@"useraddress"];
     XLFormRowDescriptor *rowUserPhone = [self.form formRowWithTag:@"userphone"];
     XLFormRowDescriptor *rowUserEmail = [self.form formRowWithTag:@"useremail"];
@@ -424,21 +423,6 @@
     if ([CCUtility getOnlyLockDir]) [rowOnlyLockDir setValue:@1]; else [rowOnlyLockDir setValue:@0];
     if ([CCUtility getFavoriteOffline]) [rowFavoriteOffline setValue:@1]; else [rowFavoriteOffline setValue:@0];
     
-    // Avatar
-    UIImage *avatar = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/avatar.png", app.directoryUser]];
-    if (avatar) {
-        
-        avatar =  [CCGraphics scaleImage:avatar toSize:CGSizeMake(50, 50)];
-        APAvatarImageView *avatarImageView = [[APAvatarImageView alloc] initWithImage:avatar borderColor:[UIColor lightGrayColor] borderWidth:0.5];
-        
-        CGSize imageSize = avatarImageView.bounds.size;
-        UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
-        CGContextRef context = UIGraphicsGetCurrentContext();
-        [avatarImageView.layer renderInContext:context];
-        avatar = UIGraphicsGetImageFromCurrentImageContext();
-        UIGraphicsEndImageContext();
-    }
-    
     _tableAccount = [CCCoreData getActiveAccount];
     
     rowVersionServer.value = [NSString stringWithFormat:@"%lu.%lu.%lu",(unsigned long)[_tableAccount.versionMajor integerValue], (unsigned long)[_tableAccount.versionMinor integerValue], (unsigned long)[_tableAccount.versionMicro integerValue]];
@@ -450,21 +434,8 @@
     rowQuota.title = [NSString stringWithFormat:NSLocalizedString(@"_quota_using_", nil), quotaUsed, quota];
     //rowQuota.title = [NSString stringWithFormat:@"%@ / %@ %@", quota, quotaAvailable, NSLocalizedString(@"_available_", nil)];
     
-    if (avatar || _tableAccount.displayName.length > 0) {
-        
-        rowUserDisplayName.title = _tableAccount.displayName;
-        rowUserDisplayName.disabled = @YES;
-        if (avatar)
-            [rowUserDisplayName.cellConfig setObject:avatar forKey:@"imageView.image"];
-        else
-            [rowUserDisplayName.cellConfig setObject:[UIImage imageNamed:image_avatar] forKey:@"imageView.image"];
-
-    } else {
-        
-        rowUserDisplayName.title = @"";
-        rowUserDisplayName.disabled = @NO;
-        [rowUserDisplayName.cellConfig setObject:[UIImage imageNamed:image_avatar] forKey:@"imageView.image"];
-    }
+    rowUserFullName.value = _tableAccount.displayName;
+    if ([_tableAccount.displayName isEqualToString:@""]) rowUserFullName.hidden = @YES;
     
     rowUserAddress.value = _tableAccount.address;
     if ([_tableAccount.address isEqualToString:@""]) rowUserAddress.hidden = @YES;

+ 1 - 0
iOSClient/Supporting Files/en.lproj/Localizable.strings

@@ -136,6 +136,7 @@
 "_cloud_account_"           = "Cloud Account";
 "_information_"             = "Information";
 "_user_information_"        = "User Information";
+"_user_full_name_"          = "Full name";
 "_user_address_"            = "Address";
 "_user_phone_"              = "Phone number";
 "_user_email_"              = "Email";

+ 0 - 2
iOSClient/Utility/CCGraphics.h

@@ -39,6 +39,4 @@
 
 + (UIImage *)scaleImage:(UIImage *)image toSize:(CGSize)targetSize;
 
-+ (UIView *)navigationBarTitle:(NSString *)title image:(UIImage *)image frame:(CGRect)frame;
-
 @end

+ 0 - 31
iOSClient/Utility/CCGraphics.m

@@ -233,35 +233,4 @@
 #endif
 }
 
-+ (UIView *)navigationBarTitle:(NSString *)title image:(UIImage *)image frame:(CGRect)frame
-{
-    UIView *view = [UIView new];
-    UILabel *label = [UILabel new];
-        
-    title = [@" " stringByAppendingString:title];
-    NSInteger width = floor(frame.size.width/3);
-    if (width < 80)
-        width = 80;
-    label.text =  [title stringByTruncatingToWidth:width withFont:label.font atEnd:YES];
-    label.textColor = COLOR_NAVIGATIONBAR_TEXT;
-    
-    label.textAlignment = NSTextAlignmentCenter;
-    [label sizeToFit];
-    label.center = view.center;
-    
-    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
-    UIImageView *imageView = [[UIImageView alloc] initWithImage:image];
-    float imageAspect = imageView.image.size.width / imageView.image.size.height;
-    imageView.frame = CGRectMake(label.frame.origin.x-label.frame.size.height*imageAspect, label.frame.origin.y, label.frame.size.height*imageAspect, label.frame.size.height);
-    imageView.contentMode = UIViewContentModeScaleAspectFit;
-    imageView.tintColor = COLOR_NAVIGATIONBAR_TEXT;
-
-    [view addSubview:label];
-    [view addSubview:imageView];
-    
-    [view sizeToFit];
-    
-    return view;
-}
-
 @end