Bladeren bron

1.完成iOS Apex Drivers Change Password。
2.修改iOS Apex Drivers Detail增加请求参数StatusNo。

Pen Li 7 jaren geleden
bovenliggende
commit
d97f92535e
20 gewijzigde bestanden met toevoegingen van 489 en 27 verwijderingen
  1. 16 2
      Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj
  2. 3 0
      Redant Drivers/Apex And Drivers/Detail/Cell/RADetailMapCell.h
  3. 33 0
      Redant Drivers/Apex And Drivers/Detail/Cell/RADetailMapCell.m
  4. 7 0
      Redant Drivers/Apex And Drivers/Detail/Model/RADetailMapModel.h
  5. 52 2
      Redant Drivers/Apex And Drivers/Detail/Model/RADetailMapModel.m
  6. 2 1
      Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m
  7. 1 0
      Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.h
  8. 1 1
      Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.m
  9. 3 2
      Redant Drivers/Apex And Drivers/Home/More/RAHomeMoreViewController.m
  10. 1 0
      Redant Drivers/Apex And Drivers/Home/RAHomeOrderModel.h
  11. 3 15
      Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m
  12. 3 1
      Redant Drivers/Apex And Drivers/RADataProvider.h
  13. 9 1
      Redant Drivers/Apex And Drivers/RADataProvider.m
  14. 3 2
      Redant Drivers/Apex And Drivers/RANavigationController.m
  15. 2 0
      Redant Drivers/Apex And Drivers/RASingleton.h
  16. 6 0
      Redant Drivers/Apex And Drivers/RASingleton.m
  17. 15 0
      Redant Drivers/Apex And Drivers/Setting/ChangePassword/RAChangePasswordViewController.h
  18. 188 0
      Redant Drivers/Apex And Drivers/Setting/ChangePassword/RAChangePasswordViewController.m
  19. 13 0
      Redant Drivers/Apex And Drivers/Setting/RASettingViewController+TableDelegate.m
  20. 128 0
      Redant Drivers/Apex And Drivers/Setting/setting.storyboard

+ 16 - 2
Redant Drivers/Apex And Drivers.xcodeproj/project.pbxproj

@@ -164,6 +164,7 @@
 		42DFE26F213FC1B8000213C2 /* RAHomeSectionHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 42DFE26E213FC1B7000213C2 /* RAHomeSectionHeaderView.m */; };
 		42ECE182214A04BE00AD8283 /* RASettingAboutModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ECE181214A04BE00AD8283 /* RASettingAboutModel.m */; };
 		42ECE185214A08A900AD8283 /* RASettingAboutCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ECE184214A08A900AD8283 /* RASettingAboutCell.m */; };
+		42ECE189214A49B600AD8283 /* RAChangePasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ECE188214A49B600AD8283 /* RAChangePasswordViewController.m */; };
 		42ED62D920F85ADB00E08CCB /* NotificationService.m in Sources */ = {isa = PBXBuildFile; fileRef = 42ED62D820F85ADB00E08CCB /* NotificationService.m */; };
 		42ED62DD20F85ADB00E08CCB /* RADriversNotificationService.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = 42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
 		42F0C5D720E20B3F00922442 /* RACameraViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 42F0C5D620E20B3E00922442 /* RACameraViewController.m */; };
@@ -492,6 +493,8 @@
 		42ECE181214A04BE00AD8283 /* RASettingAboutModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASettingAboutModel.m; sourceTree = "<group>"; };
 		42ECE183214A08A900AD8283 /* RASettingAboutCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RASettingAboutCell.h; sourceTree = "<group>"; };
 		42ECE184214A08A900AD8283 /* RASettingAboutCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASettingAboutCell.m; sourceTree = "<group>"; };
+		42ECE187214A49B600AD8283 /* RAChangePasswordViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RAChangePasswordViewController.h; sourceTree = "<group>"; };
+		42ECE188214A49B600AD8283 /* RAChangePasswordViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RAChangePasswordViewController.m; sourceTree = "<group>"; };
 		42ED62D520F85ADB00E08CCB /* RADriversNotificationService.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = RADriversNotificationService.appex; sourceTree = BUILT_PRODUCTS_DIR; };
 		42ED62D720F85ADB00E08CCB /* NotificationService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = NotificationService.h; sourceTree = "<group>"; };
 		42ED62D820F85ADB00E08CCB /* NotificationService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = NotificationService.m; sourceTree = "<group>"; };
@@ -1005,6 +1008,7 @@
 		42D7B072214794380046FE89 /* Setting */ = {
 			isa = PBXGroup;
 			children = (
+				42ECE186214A499A00AD8283 /* ChangePassword */,
 				4259599621490AD400F7DD41 /* Option */,
 				425959932149040300F7DD41 /* Data */,
 				425959712148F30700F7DD41 /* Cell */,
@@ -1166,6 +1170,15 @@
 			path = EmptyView;
 			sourceTree = "<group>";
 		};
+		42ECE186214A499A00AD8283 /* ChangePassword */ = {
+			isa = PBXGroup;
+			children = (
+				42ECE187214A49B600AD8283 /* RAChangePasswordViewController.h */,
+				42ECE188214A49B600AD8283 /* RAChangePasswordViewController.m */,
+			);
+			path = ChangePassword;
+			sourceTree = "<group>";
+		};
 		42ED62D620F85ADB00E08CCB /* RADriversNotificationService */ = {
 			isa = PBXGroup;
 			children = (
@@ -1202,8 +1215,6 @@
 		71EAA33020B9571B002F003C /* Apex And Drivers */ = {
 			isa = PBXGroup;
 			children = (
-				42D7B073214794420046FE89 /* Message */,
-				42D7B072214794380046FE89 /* Setting */,
 				42DFE267213F81F8000213C2 /* EmptyView */,
 				42DFE260213F80AF000213C2 /* UIScrollVIew+Empty */,
 				422DA1BD2134FA510021BD70 /* PresentationController */,
@@ -1215,6 +1226,8 @@
 				42529D2220C0E91E000C0F4D /* DataProvider */,
 				42529D1E20C0E8C4000C0F4D /* Network */,
 				4205FD5920C1313F00DB42B4 /* BaseViewController */,
+				42D7B073214794420046FE89 /* Message */,
+				42D7B072214794380046FE89 /* Setting */,
 				4205FD4520C0F33500DB42B4 /* Login */,
 				420D10FF2133DFFF00149B37 /* Filter */,
 				4205FD5E20C1359C00DB42B4 /* Home */,
@@ -1400,6 +1413,7 @@
 				42C1B2742134F24C00637085 /* RADatePickerViewController.m in Sources */,
 				42529D3B20C0EA3F000C0F4D /* unzip.c in Sources */,
 				4205FD4B20C0F4C400DB42B4 /* RetrievePasswordViewController.m in Sources */,
+				42ECE189214A49B600AD8283 /* RAChangePasswordViewController.m in Sources */,
 				420D11292133F7F600149B37 /* RAOrderFilterViewController+TableDelegate.m in Sources */,
 				420D11262133F7E200149B37 /* RAOrderFilterViewController+DataSource.m in Sources */,
 				42529D4320C0EB01000C0F4D /* RANetworkTaskDelegate.m in Sources */,

+ 3 - 0
Redant Drivers/Apex And Drivers/Detail/Cell/RADetailMapCell.h

@@ -8,6 +8,9 @@
 
 #import <UIKit/UIKit.h>
 
+@class RADetailMapModel;
 @interface RADetailMapCell : UITableViewCell
 
+@property (nonatomic,strong) RADetailMapModel *model;
+
 @end

+ 33 - 0
Redant Drivers/Apex And Drivers/Detail/Cell/RADetailMapCell.m

@@ -8,6 +8,7 @@
 
 #import "RADetailMapCell.h"
 #import <MapKit/MapKit.h>
+#import "RADetailMapModel.h"
 
 @interface RADetailMapCell ()
 
@@ -30,4 +31,36 @@
     // Configure the view for the selected state
 }
 
+- (void)prepareForReuse {
+    [super prepareForReuse];
+    
+    self.model = nil;
+}
+
+- (void)setModel:(RADetailMapModel *)model {
+    _model = model;
+    
+    self.titleLabel.text = _model.title;
+    self.valueLabel.text = _model.location;
+    
+    
+    NSString *lonStr = _model.lon;
+    NSString *latStr = _model.lat;
+    if (lonStr && lonStr.length > 0 && latStr && latStr.length > 0) {
+        
+        double longitude = [lonStr doubleValue];
+        double latitude = [latStr doubleValue];
+        
+        CLLocationCoordinate2D c2d = CLLocationCoordinate2DMake(latitude, longitude);
+        
+        MKCoordinateSpan span = MKCoordinateSpanMake(180, 360);
+        // 创建一个区域结构体变量
+        MKCoordinateRegion region = MKCoordinateRegionMake(c2d, span);
+        
+        // 将大头针数据模型添加到MKMapView上管理
+        [self.mapView setRegion:region animated:YES];
+        
+    }
+}
+
 @end

+ 7 - 0
Redant Drivers/Apex And Drivers/Detail/Model/RADetailMapModel.h

@@ -10,4 +10,11 @@
 
 @interface RADetailMapModel : RADetailBaseModel
 
+@property (nonatomic,copy) NSString *title;
+@property (nonatomic,copy) NSString *location;
+@property (nonatomic,copy) NSString *latlon;
+
+@property (nonatomic,copy) NSString *lat;
+@property (nonatomic,copy) NSString *lon;
+
 @end

+ 52 - 2
Redant Drivers/Apex And Drivers/Detail/Model/RADetailMapModel.m

@@ -8,10 +8,60 @@
 
 #import "RADetailMapModel.h"
 
-@implementation RADetailMapModel
+static const CGFloat SpaceWidth = 90.0f;
+static const CGFloat SpaceHeight = 38.0f;
+
+@implementation RADetailMapModel {
+    CGFloat _height;
+}
+
+- (void)setLatlon:(NSString *)latlon {
+    _latlon = latlon;
+    if ([_latlon containsString:@","]) {
+        NSArray *arr = [_latlon componentsSeparatedByString:@","];
+        NSString *lat = [arr objectAtIndex:0];
+        NSString *lon = [arr objectAtIndex:1];
+        self.lat = lat;
+        self.lon = lon;
+    }
+}
+
+- (void)setLocation:(NSString *)location {
+    _location = location;
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+        [self caculateValueHeight];
+    });
+}
 
 - (CGFloat)height {
-    return 100.0f;
+    if (_height <= 0) {
+        [self caculateValueHeight];
+    }
+    return _height;
+}
+
+- (void)caculateValueHeight {
+    if (self.location.length == 0) {
+        return;
+    }
+    CGFloat w = self.width;
+    if (w <= 0) {
+        w = CGRectGetWidth([UIScreen mainScreen].bounds);
+    }
+    
+    CGFloat h = [self.location boundingRectWithSize:CGSizeMake(w - SpaceWidth, FLT_MAX)
+                                            options:(NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading)
+                                         attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:15.0f]}
+                                            context:nil].size.height;
+    CGFloat navBtnHeight = 30.0f;
+    if (h < navBtnHeight) { // navigation button height
+        h = navBtnHeight;
+    }
+    
+    _height = h + SpaceHeight;
+    if (_height < 100.0f) {
+        _height = 100.0f;
+    }
 }
 
 @end

+ 2 - 1
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController+TableViewDataSource.m

@@ -76,7 +76,8 @@
         case RAOrderDetailValueTypeMap: {
             
             RADetailMapCell *cell = [tableView dequeueReusableCellWithIdentifier:@"RADetailMapCell" forIndexPath:indexPath];
-            
+            RADetailMapModel *mapModel = (RADetailMapModel *)model;
+            [cell setModel:mapModel];
             return cell;
         }
             break;

+ 1 - 0
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.h

@@ -14,6 +14,7 @@
 @property (nonatomic,copy) NSString *orderID;
 @property (nonatomic,assign) NSInteger orderType;
 @property (nonatomic,copy) NSString *orderType2;
+@property (nonatomic,copy) NSString *status_no;
 
 - (NSInteger)sectionNumber;
 - (NSString *)titleForSection:(NSInteger)section;

+ 1 - 1
Redant Drivers/Apex And Drivers/Detail/RAOrderDetailViewController.m

@@ -194,7 +194,7 @@
     
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
         
-        NSDictionary *json = [RADataProvider requestOrderDetail:self.orderID type:self.orderType type2:self.orderType2];
+        NSDictionary *json = [RADataProvider requestOrderDetail:self.orderID type:self.orderType type2:self.orderType2 statusNo:self.status_no];
         
         dispatch_async(dispatch_get_main_queue(), ^{
             

+ 3 - 2
Redant Drivers/Apex And Drivers/Home/More/RAHomeMoreViewController.m

@@ -151,10 +151,10 @@ typedef enum {
 
 - (void)pushDetailViewControllerForModel:(RAHomeOrderModel *)model {
     
-    [self pushDetailViewControllerForOrderID:model.orderID type:model.status type2:model.order_type2];
+    [self pushDetailViewControllerForOrderID:model.orderID type:model.status type2:model.order_type2 statusNo:model.status_no];
 }
 
-- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 {
+- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo {
     
     if (!orderID) {
         return;
@@ -163,6 +163,7 @@ typedef enum {
     detailVC.orderID = orderID;
     detailVC.orderType = type;
     detailVC.orderType2 = type2;
+    detailVC.status_no = statusNo;
     [self.navigationController pushViewController:detailVC animated:YES];
 }
 

+ 1 - 0
Redant Drivers/Apex And Drivers/Home/RAHomeOrderModel.h

@@ -31,6 +31,7 @@ typedef enum {
 @property (nonatomic,copy) NSString *order_type2;
 @property (nonatomic,copy) NSString *iconURL;
 @property (nonatomic,assign) BOOL backendFlag;
+@property (nonatomic,copy) NSString *status_no;
 
 @property (nonatomic,strong,readonly) UIImage *icon;
 

+ 3 - 15
Redant Drivers/Apex And Drivers/Home/RAHomeViewController.m

@@ -411,10 +411,10 @@
 
 - (void)pushDetailViewControllerForModel:(RAHomeOrderModel *)model {
     
-    [self pushDetailViewControllerForOrderID:model.orderID type:model.status type2:model.order_type2];
+    [self pushDetailViewControllerForOrderID:model.orderID type:model.status type2:model.order_type2 statusNo:model.status_no];
 }
 
-- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 {
+- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo {
     
     if (!orderID) {
         return;
@@ -423,6 +423,7 @@
     detailVC.orderID = orderID;
     detailVC.orderType = type;
     detailVC.orderType2 = type2;
+    detailVC.status_no = statusNo;
     [self.navigationController pushViewController:detailVC animated:YES];
 }
 
@@ -451,19 +452,6 @@
     [self loadData];
 }
 
-- (void)receiveGoDetailNotification:(NSNotification *)notification {
-    
-    NSDictionary *userInfo = notification.object;
-    if (userInfo) {
-        NSString *orderID = [userInfo objectForKey:@"orderID"];
-        NSInteger orderType = [[userInfo objectForKey:@"orderType"] integerValue];
-        NSString *orderType2 = [userInfo objectForKey:@"orderType2"];
-        if (orderID) {
-            [self pushDetailViewControllerForOrderID:orderID type:orderType type2:orderType2];
-        }
-    }
-}
-
 #pragma mark - Header Delegate
 
 - (void)signoutClick:(UIButton *)sender {

+ 3 - 1
Redant Drivers/Apex And Drivers/RADataProvider.h

@@ -18,7 +18,7 @@
 
 + (NSDictionary *)requestMoreOrder:(NSInteger)orderType offset:(NSInteger)offset limit:(NSInteger)limit filter:(NSDictionary *)filter;
 
-+ (NSDictionary *)requestOrderDetail:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2;
++ (NSDictionary *)requestOrderDetail:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo;
 
 + (NSDictionary *)requestUpdateOrder:(NSString *)orderID driverAction:(NSInteger)action;
 
@@ -42,4 +42,6 @@
 
 + (NSDictionary *)loadDataFromBundleFile:(NSString *)fileName;
 
++ (NSDictionary *)requestChange:(NSString *)old password:(NSString *)pass;
+
 @end

+ 9 - 1
Redant Drivers/Apex And Drivers/RADataProvider.m

@@ -197,7 +197,7 @@
     return [self handleJsonData:json];
 }
 
-+ (NSDictionary *)requestOrderDetail:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 {
++ (NSDictionary *)requestOrderDetail:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo {
     
     NSMutableDictionary *params = [NSMutableDictionary dictionary];
     if (orderID) {
@@ -207,6 +207,9 @@
     if (type2) {
         [params setObject:type2 forKey:@"orderType2"];
     }
+    if (statusNo) {
+        [params setObject:statusNo forKey:@"statusNo"];
+    }
     
     NSData* json=[self get_json:URL_DETAIL parameters:params  file:nil];
     
@@ -348,6 +351,11 @@
     return [self loadFakeData:fileName];
 }
 
++ (NSDictionary *)requestChange:(NSString *)old password:(NSString *)pass {
+    
+    return nil;
+}
+
 #pragma mark - Utils
 
 + (NSString *)dic2String:(NSDictionary *)dic {

+ 3 - 2
Redant Drivers/Apex And Drivers/RANavigationController.m

@@ -56,6 +56,7 @@
     NSString *orderID = [aps objectForKey:@"order-id"];
     NSInteger orderType = [[aps objectForKey:@"order-type"] integerValue];
     NSString *orderType2 = [aps objectForKey:@"order-type2"];
+    NSString *statusNo = [aps objectForKey:@"status-no"];
     if (!orderType2) {
         orderType2 = @"";
     }
@@ -77,7 +78,7 @@
         
         __weak typeof(self) weakSelf = self;
         UIAlertAction *detailAction = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
-            [weakSelf pushDetailViewControllerForOrderID:orderID type:orderType type2:orderType2];
+            [weakSelf pushDetailViewControllerForOrderID:orderID type:orderType type2:orderType2 statusNo:statusNo];
         }];
         
         [alertVC addAction:cancelAction];
@@ -87,7 +88,7 @@
     }
 }
 
-- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 {
+- (void)pushDetailViewControllerForOrderID:(NSString *)orderID type:(NSInteger)type type2:(NSString *)type2 statusNo:(NSString *)statusNo {
     
     if (!orderID) {
         return;

+ 2 - 0
Redant Drivers/Apex And Drivers/RASingleton.h

@@ -58,4 +58,6 @@ typedef enum {
 
 - (void)saveLogs;
 
+- (void)changePassword:(NSString *)password;
+
 @end

+ 6 - 0
Redant Drivers/Apex And Drivers/RASingleton.m

@@ -118,6 +118,12 @@ static RASingleton *singleton;
     [defaults synchronize];
 }
 
+- (void)changePassword:(NSString *)password {
+    _password = password;
+    
+    [self saveUserInfo];
+}
+
 #pragma mark - Location
 
 - (void)setRequiredLocation:(BOOL)requiredLocation {

+ 15 - 0
Redant Drivers/Apex And Drivers/Setting/ChangePassword/RAChangePasswordViewController.h

@@ -0,0 +1,15 @@
+//
+//  RAChangePasswordViewController.h
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/9/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "JLCustomerAlertController.h"
+
+@interface RAChangePasswordViewController : JLCustomerAlertController
+
++ (instancetype)viewControllerFromStoryboard;
+
+@end

+ 188 - 0
Redant Drivers/Apex And Drivers/Setting/ChangePassword/RAChangePasswordViewController.m

@@ -0,0 +1,188 @@
+//
+//  RAChangePasswordViewController.m
+//  Apex And Drivers
+//
+//  Created by Jack on 2018/9/13.
+//  Copyright © 2018年 USAI. All rights reserved.
+//
+
+#import "RAChangePasswordViewController.h"
+#import "RAProgressHUD.h"
+
+@interface RAChangePasswordViewController () <UITextFieldDelegate>
+
+@property (nonatomic,strong) IBOutlet UITextField *oldTextField;
+@property (nonatomic,strong) IBOutlet UITextField *changeTextField;
+@property (nonatomic,strong) IBOutlet UITextField *confirmTextField;
+
+@property (nonatomic,strong) IBOutlet UIButton *cancelBtn;
+@property (nonatomic,strong) IBOutlet UIButton *changeBtn;
+
+@property (nonatomic,assign) CGFloat offset;
+
+@end
+
+@implementation RAChangePasswordViewController
+
++ (instancetype)viewControllerFromStoryboard {
+    RAChangePasswordViewController *vc = [[UIStoryboard storyboardWithName:@"setting" bundle:nil] instantiateViewControllerWithIdentifier:@"RAChangePasswordViewController"];
+    vc.preferredContentSize = CGSizeMake(300, 210);
+    return vc;
+}
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+    // Do any additional setup after loading the view.
+}
+
+- (void)viewWillAppear:(BOOL)animated {
+    [super viewWillAppear:animated];
+    
+    [self registKeyboardListener];
+}
+
+- (void)viewWillDisappear:(BOOL)animated {
+    [super viewWillDisappear:animated];
+    
+    [self unregistKeyboardListener];
+}
+
+- (void)didReceiveMemoryWarning {
+    [super didReceiveMemoryWarning];
+    // Dispose of any resources that can be recreated.
+}
+
+- (void)registKeyboardListener {
+    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillChangeFrame:) name:UIKeyboardWillChangeFrameNotification object:nil];
+}
+
+- (void)unregistKeyboardListener {
+    [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+#pragma mark - Keyboard Listener
+
+- (void)keyboardWillChangeFrame:(NSNotification *)notification {
+    
+    CGRect end = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
+    CGFloat screenHeight = CGRectGetHeight([UIScreen mainScreen].bounds);
+//    CGFloat keyboardHeight = screenHeight - CGRectGetMinY(end);
+    
+    CGRect frame = self.view.frame;
+    CGFloat maxY = CGRectGetMaxY(frame);
+    
+    if (end.origin.y >= screenHeight) {
+        frame.origin.y -= self.offset;
+        self.offset = 0;
+    } else {
+        self.offset += end.origin.y - maxY;
+        frame.origin.y += self.offset;
+    }
+    
+    self.view.frame = frame;
+}
+
+#pragma mark - Action
+
+- (IBAction)cancelBtnClick:(id)sender {
+    [self.view endEditing:YES];
+    [self dismissViewControllerAnimated:YES completion:nil];
+}
+
+- (IBAction)changeBtnClick:(id)sender {
+    
+    NSString* oldpass = self.oldTextField.text;
+    NSString* newpass = self.changeTextField.text;
+    NSString* confirmpass = self.confirmTextField.text;
+
+    if(oldpass.length==0||oldpass.length==0||confirmpass.length==0)
+    {
+        
+        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"Required fields can not be empty!" preferredStyle:UIAlertControllerStyleAlert];
+        UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+        }];
+        
+        [alertVC addAction:action];
+        
+        [self presentViewController:alertVC animated:YES completion:nil];
+        
+        return;
+    }
+    if(! [newpass isEqualToString:confirmpass])
+    {
+        
+        UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Waning" message:@"New password not equal confirm password!" preferredStyle:UIAlertControllerStyleAlert];
+        UIAlertAction *action = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+            
+        }];
+        
+        [alertVC addAction:action];
+        
+        [self presentViewController:alertVC animated:YES completion:nil];
+        
+        return;
+    }
+    
+    self.changeBtn.enabled = NO;
+    self.cancelBtn.enabled = NO;
+    
+    RAProgressHUD *hud = [RAProgressHUD showHUDOnView:self.view];
+    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+       
+        NSDictionary *json = [RADataProvider requestChange:oldpass password:newpass];
+        int result = [[json objectForKey:@"result"] intValue];
+        dispatch_async(dispatch_get_main_queue(), ^{
+            
+            [hud dismiss];
+            self.changeBtn.enabled = YES;
+            self.cancelBtn.enabled = YES;
+            
+            if (result == RESULT_TRUE) {
+
+                [RASingleton.sharedInstance changePassword:newpass];
+                
+                UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"change password success" preferredStyle:UIAlertControllerStyleAlert];
+                UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                    
+                }];
+                
+                [alertVC addAction:okAction];
+                
+                [self presentViewController:alertVC animated:YES completion:nil];
+                
+            } else {
+                NSString *msg = [json objectForKey:@"err_msg"];
+                if (msg.length == 0) {
+                    msg = @"Sorry,something is wrong";
+                }
+                
+                UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:msg preferredStyle:UIAlertControllerStyleAlert];
+                UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
+                    
+                }];
+                
+                [alertVC addAction:okAction];
+                
+                [self presentViewController:alertVC animated:YES completion:nil];
+            }
+            
+        });
+    });
+    
+}
+
+#pragma mark - TextField Delegate
+
+- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
+    [[self view] endEditing:YES];
+
+}
+
+-(BOOL)textFieldShouldReturn:(UITextField *)textField {
+    
+    [textField resignFirstResponder];
+    return YES;
+}
+
+@end

+ 13 - 0
Redant Drivers/Apex And Drivers/Setting/RASettingViewController+TableDelegate.m

@@ -11,6 +11,7 @@
 #import "RASettingOptionModel.h"
 #import "RASettingSwitchModel.h"
 #import "RASettingActionModel.h"
+#import "RAChangePasswordViewController.h"
 
 #import "RAOptionViewController.h"
 
@@ -67,6 +68,10 @@
             [self cleanDiskCache:model];
         }
             break;
+        case RASettingActionTypeChangePassword: {
+            [self changePassword:model];
+        }
+            break;
             
         default:
             break;
@@ -94,6 +99,8 @@
             sleep(1.0);
             dispatch_async(dispatch_get_main_queue(), ^{
                 model.active = NO;
+                
+                [self showAlert:@"Clean Success"];
             });
         });
         
@@ -106,6 +113,12 @@
     [self presentViewController:alertVC animated:YES completion:nil];
 }
 
+- (void)changePassword:(RASettingActionModel *)model {
+    
+    RAChangePasswordViewController *vc = [RAChangePasswordViewController viewControllerFromStoryboard];
+    [self presentViewController:vc animated:YES completion:nil];
+}
+
 #pragma mark - Show Option
 
 - (void)showOption:(RASettingOptionModel *)model {

+ 128 - 0
Redant Drivers/Apex And Drivers/Setting/setting.storyboard

@@ -309,6 +309,134 @@
             </objects>
             <point key="canvasLocation" x="658" y="54"/>
         </scene>
+        <!--Change Password View Controller-->
+        <scene sceneID="SiS-Sm-5ua">
+            <objects>
+                <viewController storyboardIdentifier="RAChangePasswordViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="q0p-GF-XgD" customClass="RAChangePasswordViewController" sceneMemberID="viewController">
+                    <view key="view" contentMode="scaleToFill" id="XiV-dx-5Lf">
+                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+                        <subviews>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Old password *required" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="AGg-Is-zfV">
+                                <rect key="frame" x="5" y="61" width="365" height="30"/>
+                                <constraints>
+                                    <constraint firstAttribute="height" constant="30" id="tdG-fz-DUH"/>
+                                </constraints>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
+                                <connections>
+                                    <outlet property="delegate" destination="q0p-GF-XgD" id="4Xo-J8-U63"/>
+                                </connections>
+                            </textField>
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Change Password" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="XYO-s8-g1R">
+                                <rect key="frame" x="5" y="30" width="365" height="21"/>
+                                <fontDescription key="fontDescription" type="boldSystem" pointSize="17"/>
+                                <nil key="textColor"/>
+                                <nil key="highlightedColor"/>
+                            </label>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="New password *required" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="one-j7-LgU">
+                                <rect key="frame" x="5" y="101" width="365" height="30"/>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
+                                <connections>
+                                    <outlet property="delegate" destination="q0p-GF-XgD" id="s14-bx-KKH"/>
+                                </connections>
+                            </textField>
+                            <textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Confirm new password *required" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="dQK-Xb-iG2">
+                                <rect key="frame" x="5" y="141" width="365" height="30"/>
+                                <nil key="textColor"/>
+                                <fontDescription key="fontDescription" type="system" pointSize="17"/>
+                                <textInputTraits key="textInputTraits" returnKeyType="done" secureTextEntry="YES"/>
+                                <connections>
+                                    <outlet property="delegate" destination="q0p-GF-XgD" id="vKK-Ne-nD6"/>
+                                </connections>
+                            </textField>
+                            <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="mZu-0K-iio">
+                                <rect key="frame" x="0.0" y="181" width="375" height="40"/>
+                                <subviews>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="gkw-yN-ovJ">
+                                        <rect key="frame" x="10" y="0.0" width="172.5" height="40"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="i90-wQ-C0t">
+                                                <rect key="frame" x="62" y="5" width="48" height="30"/>
+                                                <state key="normal" title="Cancel"/>
+                                                <connections>
+                                                    <action selector="cancelBtnClick:" destination="q0p-GF-XgD" eventType="touchUpInside" id="Bfz-hQ-8gd"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="i90-wQ-C0t" firstAttribute="centerY" secondItem="gkw-yN-ovJ" secondAttribute="centerY" id="03R-zG-jjK"/>
+                                            <constraint firstItem="i90-wQ-C0t" firstAttribute="centerX" secondItem="gkw-yN-ovJ" secondAttribute="centerX" id="teA-L3-jiv"/>
+                                        </constraints>
+                                    </view>
+                                    <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="xb4-bE-BCi">
+                                        <rect key="frame" x="192.5" y="0.0" width="172.5" height="40"/>
+                                        <subviews>
+                                            <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="NV0-3K-Irh">
+                                                <rect key="frame" x="60" y="5" width="53" height="30"/>
+                                                <state key="normal" title="Change"/>
+                                                <connections>
+                                                    <action selector="changeBtnClick:" destination="q0p-GF-XgD" eventType="touchUpInside" id="oHD-Ns-DyX"/>
+                                                </connections>
+                                            </button>
+                                        </subviews>
+                                        <constraints>
+                                            <constraint firstItem="NV0-3K-Irh" firstAttribute="centerX" secondItem="xb4-bE-BCi" secondAttribute="centerX" id="41i-b6-WRa"/>
+                                            <constraint firstItem="NV0-3K-Irh" firstAttribute="centerY" secondItem="xb4-bE-BCi" secondAttribute="centerY" id="PBX-UU-rDL"/>
+                                        </constraints>
+                                    </view>
+                                </subviews>
+                                <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                                <constraints>
+                                    <constraint firstItem="xb4-bE-BCi" firstAttribute="height" secondItem="gkw-yN-ovJ" secondAttribute="height" id="7zk-T8-l0Z"/>
+                                    <constraint firstItem="xb4-bE-BCi" firstAttribute="centerY" secondItem="gkw-yN-ovJ" secondAttribute="centerY" id="9xp-pz-4Qt"/>
+                                    <constraint firstItem="xb4-bE-BCi" firstAttribute="leading" secondItem="gkw-yN-ovJ" secondAttribute="trailing" constant="10" id="Amh-VE-NCY"/>
+                                    <constraint firstAttribute="trailing" secondItem="xb4-bE-BCi" secondAttribute="trailing" constant="10" id="M6u-j4-dlI"/>
+                                    <constraint firstItem="gkw-yN-ovJ" firstAttribute="height" secondItem="mZu-0K-iio" secondAttribute="height" id="PqS-yU-544"/>
+                                    <constraint firstItem="xb4-bE-BCi" firstAttribute="width" secondItem="gkw-yN-ovJ" secondAttribute="width" id="dKj-40-hMP"/>
+                                    <constraint firstAttribute="height" constant="40" id="eDb-up-scU"/>
+                                    <constraint firstItem="gkw-yN-ovJ" firstAttribute="leading" secondItem="mZu-0K-iio" secondAttribute="leading" constant="10" id="h9P-QF-shc"/>
+                                    <constraint firstItem="gkw-yN-ovJ" firstAttribute="centerY" secondItem="mZu-0K-iio" secondAttribute="centerY" id="ocf-ue-dhy"/>
+                                </constraints>
+                            </view>
+                        </subviews>
+                        <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+                        <constraints>
+                            <constraint firstItem="XYO-s8-g1R" firstAttribute="leading" secondItem="wbS-Du-ewM" secondAttribute="leading" constant="5" id="1Wv-CX-Hbg"/>
+                            <constraint firstItem="mZu-0K-iio" firstAttribute="leading" secondItem="wbS-Du-ewM" secondAttribute="leading" id="5RY-GD-sLK"/>
+                            <constraint firstItem="mZu-0K-iio" firstAttribute="top" secondItem="dQK-Xb-iG2" secondAttribute="bottom" constant="10" id="6hY-8G-FDo"/>
+                            <constraint firstItem="AGg-Is-zfV" firstAttribute="leading" secondItem="XYO-s8-g1R" secondAttribute="leading" id="9yH-gO-Mbr"/>
+                            <constraint firstItem="AGg-Is-zfV" firstAttribute="top" secondItem="XYO-s8-g1R" secondAttribute="bottom" constant="10" id="BIt-jU-RuU"/>
+                            <constraint firstItem="dQK-Xb-iG2" firstAttribute="leading" secondItem="one-j7-LgU" secondAttribute="leading" id="HFH-vU-gQ0"/>
+                            <constraint firstItem="dQK-Xb-iG2" firstAttribute="top" secondItem="one-j7-LgU" secondAttribute="bottom" constant="10" id="L0x-Ni-kFD"/>
+                            <constraint firstItem="one-j7-LgU" firstAttribute="top" secondItem="AGg-Is-zfV" secondAttribute="bottom" constant="10" id="Lyy-X2-PbC"/>
+                            <constraint firstItem="dQK-Xb-iG2" firstAttribute="height" secondItem="one-j7-LgU" secondAttribute="height" id="Mb5-xc-Yxl"/>
+                            <constraint firstItem="dQK-Xb-iG2" firstAttribute="trailing" secondItem="one-j7-LgU" secondAttribute="trailing" id="Zk2-fJ-kqA"/>
+                            <constraint firstItem="wbS-Du-ewM" firstAttribute="trailing" secondItem="XYO-s8-g1R" secondAttribute="trailing" constant="5" id="dag-gm-Dxn"/>
+                            <constraint firstItem="one-j7-LgU" firstAttribute="height" secondItem="AGg-Is-zfV" secondAttribute="height" id="gJG-Ax-FnN"/>
+                            <constraint firstItem="AGg-Is-zfV" firstAttribute="trailing" secondItem="XYO-s8-g1R" secondAttribute="trailing" id="jfR-7a-CWn"/>
+                            <constraint firstItem="one-j7-LgU" firstAttribute="leading" secondItem="AGg-Is-zfV" secondAttribute="leading" id="oCk-B6-DdE"/>
+                            <constraint firstItem="wbS-Du-ewM" firstAttribute="trailing" secondItem="mZu-0K-iio" secondAttribute="trailing" id="qFG-a9-W1c"/>
+                            <constraint firstItem="one-j7-LgU" firstAttribute="trailing" secondItem="AGg-Is-zfV" secondAttribute="trailing" id="veq-oU-lur"/>
+                            <constraint firstItem="XYO-s8-g1R" firstAttribute="top" secondItem="wbS-Du-ewM" secondAttribute="top" constant="10" id="ztq-Pn-u66"/>
+                        </constraints>
+                        <viewLayoutGuide key="safeArea" id="wbS-Du-ewM"/>
+                    </view>
+                    <connections>
+                        <outlet property="cancelBtn" destination="i90-wQ-C0t" id="e53-2c-oAC"/>
+                        <outlet property="changeBtn" destination="NV0-3K-Irh" id="njh-FX-gJO"/>
+                        <outlet property="changeTextField" destination="one-j7-LgU" id="dsp-U4-vpx"/>
+                        <outlet property="confirmTextField" destination="dQK-Xb-iG2" id="E4L-0U-0pP"/>
+                        <outlet property="oldTextField" destination="AGg-Is-zfV" id="DFx-tR-NRD"/>
+                    </connections>
+                </viewController>
+                <placeholder placeholderIdentifier="IBFirstResponder" id="SjR-G2-BNH" userLabel="First Responder" sceneMemberID="firstResponder"/>
+            </objects>
+            <point key="canvasLocation" x="1376.8" y="53.523238380809602"/>
+        </scene>
     </scenes>
     <resources>
         <image name="icon_50" width="50" height="50"/>