Browse Source

Add new field Quota in Settings

Marino Faggiana 8 years ago
parent
commit
7ae3f1c0ea

+ 2 - 0
iOSClient/AppDelegate.h

@@ -39,6 +39,7 @@
 #import "CCMain.h"
 #import "CCPhotosCameraUpload.h"
 #import "CCFavorite.h"
+#import "CCSettings.h"
 
 @interface AppDelegate : UIResponder <UIApplicationDelegate, BKPasscodeLockScreenManagerDelegate, BKPasscodeViewControllerDelegate, LMMediaPlayerViewDelegate, TWMessageBarStyleSheet>
 
@@ -136,6 +137,7 @@
 @property (nonatomic, strong) CCPhotosCameraUpload *activePhotosCameraUpload;
 @property (nonatomic, retain) CCDetail *activeDetail;
 @property (nonatomic, retain) CCFavorite *activeFavorite;
+@property (nonatomic, retain) CCSettings *activeSettings;
 
 @property (nonatomic, strong) NSMutableDictionary *listMainVC;
 @property (nonatomic, strong) NSMutableDictionary *listProgressMetadata;

+ 2 - 1
iOSClient/Main/CCMain.m

@@ -1595,7 +1595,8 @@
     // Quota
     if ([metadataNet.selector isEqualToString:selectorReadFileQuota]) {
         
-        NSLog(@"Quota");
+        if (app.activeSettings)
+            [app.activeSettings reloadForm];        
     }
 }
 

+ 2 - 0
iOSClient/Settings/CCSettings.h

@@ -38,4 +38,6 @@
 
 @property (nonatomic, strong) CCHud *hud;
 
+- (void)reloadForm;
+
 @end

+ 15 - 1
iOSClient/Settings/CCSettings.m

@@ -38,6 +38,8 @@
     if (self) {
         
         [self initializeForm];
+        
+        app.activeSettings = self;
     }
     
     return self;
@@ -110,6 +112,13 @@
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
     [section addFormRow:row];
     
+    // quota
+    row = [XLFormRowDescriptor formRowDescriptorWithTag:@"quota" rowType:XLFormRowDescriptorTypeInfo title:NSLocalizedString(@"_quota_", nil)];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
+    [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"detailTextLabel.font"];
+    [section addFormRow:row];
+
+    
     // Change Account
     row = [XLFormRowDescriptor formRowDescriptorWithTag:@"changecredentials" rowType:XLFormRowDescriptorTypeButton title:NSLocalizedString(@"_change_credentials_", nil)];
     [row.cellConfig setObject:[UIFont systemFontOfSize:15.0]forKey:@"textLabel.font"];
@@ -210,7 +219,6 @@
     row.action.formSelector = @selector(sendMail:);
     [section addFormRow:row];
 
-    
     // Section : cache
     
     section = [XLFormSectionDescriptor formSection];
@@ -391,6 +399,7 @@
     
     XLFormRowDescriptor *rowUrlCloud = [self.form formRowWithTag:@"urlcloud"];
     XLFormRowDescriptor *rowUserNameCloud = [self.form formRowWithTag:@"usernamecloud"];
+    XLFormRowDescriptor *rowQuota = [self.form formRowWithTag:@"quota"];
     
     // ------------------------------------------------------------------
     
@@ -410,6 +419,11 @@
     
     rowUrlCloud.value = app.activeUrl;
     rowUserNameCloud.value = app.activeUser;
+    
+    NSString *quota = [CCUtility transformedSize:(app.quotaAvailable + app.quotaUsed)];
+    NSString *quotaAvailable = [CCUtility transformedSize:(app.quotaAvailable)];
+    
+    rowQuota.value = [NSString stringWithFormat:@"%@ / %@ %@", quota, quotaAvailable, NSLocalizedString(@"_available_", nil)];
         
     // -----------------------------------------------------------------
     

+ 2 - 0
iOSClient/en.lproj/Localizable.strings

@@ -123,6 +123,8 @@
 "_help_"                    = "Help";
 "_lock_protection_simply_"  = "Weak password protection";
 "_change_simply_passcode_"  = "Change password type";
+"_quota_"                   = "Quota";
+"_available_"               = "available";
 
 // Manage Camera Upload