瀏覽代碼

Move app delegate user to rasgngleton

Ray Zhang 2 年之前
父節點
當前提交
9e241bbb1b

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/ChangePasswordViewController.m

@@ -30,7 +30,7 @@
     NSString* pwd = self.editnpwd.text;
     NSString* cpwd = self.editcpwd.text;
     
-    if(![opwd isEqualToString: appDelegate.password])
+    if(![opwd isEqualToString: RASingleton.sharedInstance.password])
     {
         
         
@@ -62,7 +62,7 @@
                 {
 
                     [RAUtils message_box:@"Change Password" message:@"Successful" completion:^{
-                        appDelegate.password = pwd;
+                        RASingleton.sharedInstance.password = pwd;
                         [self dismissViewControllerAnimated:true completion:nil];
                         
                         

+ 4 - 4
RedAnt ERP Mobile/HMLG Scan Order/MainViewController.m

@@ -1321,7 +1321,7 @@
     {
 
 //        RASingleton.sharedInstance.user = nil;
-//        appDelegate.password = nil;
+//        RASingleton.sharedInstance.password = nil;
         LoginViewController * loginvc =[[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
         //        loginvc.delegate = self;
         //    loginvc.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
@@ -1394,7 +1394,7 @@
 //                                    appDelegate.submit_order_logout = false;
 //                                    appDelegate.alert_sold_in_quantities = false;
 //
-//                                    appDelegate.ipad_perm =nil ;
+//                                    RASingleton.sharedInstance.ipad_perm =nil ;
 //                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
 //                                    appDelegate.OrderFilter= nil;
 //                                    [appDelegate SetSo:nil];
@@ -1434,7 +1434,7 @@
 //                                    appDelegate.submit_order_logout = false;
 //                                    appDelegate.alert_sold_in_quantities = false;
 //
-//                                    appDelegate.ipad_perm =nil ;
+//                                    RASingleton.sharedInstance.ipad_perm =nil ;
 //                                    appDelegate.user_type = USER_ROLE_UNKNOWN;
 //                                    appDelegate.OrderFilter= nil;
 //                                    [appDelegate SetSo:nil];
@@ -1482,7 +1482,7 @@
 //                            appDelegate.submit_order_logout = false;
 //                            appDelegate.alert_sold_in_quantities = false;
 //
-//                            appDelegate.ipad_perm =nil ;
+//                            RASingleton.sharedInstance.ipad_perm =nil ;
 //                            appDelegate.user_type = USER_ROLE_UNKNOWN;
 //                            appDelegate.OrderFilter= nil;
 //                            [appDelegate SetSo:nil];

+ 2 - 2
RedAnt ERP Mobile/HMLG Scan Order/ServerSettingViewController.m

@@ -472,7 +472,7 @@
             appDelegate.submit_order_logout = false;
             appDelegate.alert_sold_in_quantities = false;
             
-            appDelegate.ipad_perm =nil ;
+            RASingleton.sharedInstance.ipad_perm =nil ;
             appDelegate.user_type = USER_ROLE_UNKNOWN;
             appDelegate.OrderFilter= nil;
             [appDelegate SetSo:nil];
@@ -834,7 +834,7 @@
             //获取第1个输入框;
             UITextField *titleTextField = alertController.textFields.firstObject;
 
-            if([appDelegate.password isEqualToString:titleTextField.text])
+            if([RASingleton.sharedInstance.password isEqualToString:titleTextField.text])
             {
                 DebugLog(@"%@", @"run process");
 //                __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{

+ 3 - 3
RedAnt ERP Mobile/common/AppDelegateBase.h

@@ -95,12 +95,12 @@ typedef enum {
 @property (nonatomic,assign) bool offline_mode;
 @property (strong , nonatomic) NSString* contact_id;
 @property bool bEnable_Cache;
-@property (strong,nonatomic) NSString* build;
+
 //@property (strong, nonatomic) NSMutableArray* arr_scannerReceiver;
 
 @property (strong, nonatomic) UIWindow *window;
 //@property (strong,nonatomic) NSString* user;
-@property (strong,nonatomic) NSString * password;
+//@property (strong,nonatomic) NSString * password;
 @property (strong,nonatomic) NSString * user_icon;
 //@property (strong,nonatomic) NSString * sessionid;
 //@property (strong,nonatomic) NSString * duid;
@@ -164,7 +164,7 @@ typedef enum {
 //@property bool can_show_price;
 //@property bool can_show_price;
 
-@property (strong , nonatomic) NSString* ipad_perm;
+
 
 -(void) update_count_mark;
 // downloader

+ 7 - 7
RedAnt ERP Mobile/common/AppDelegateBase.m

@@ -139,10 +139,10 @@
 {
     _user_type = user_type;
 }
-- (void)setPassword:(NSString *)password {
-    _password = password;
-    [RASingleton.sharedInstance setGlobalParameter:_password forKey:@"password"];
-}
+//- (void)setPassword:(NSString *)password {
+//    _password = password;
+//    [RASingleton.sharedInstance setGlobalParameter:_password forKey:@"password"];
+//}
 
 #pragma mark - Normal
 
@@ -1170,7 +1170,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         [main_vc hideMenu];
         [main_vc switchToHome];
         RASingleton.sharedInstance.user = nil;
-        self.password=nil;
+        RASingleton.sharedInstance.password=nil;
         self.user_icon=nil;
         self.user_type = USER_ROLE_UNKNOWN;
         self.bLogin = false;
@@ -1741,7 +1741,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 
         NSMutableDictionary* add_params=[NSMutableDictionary new];
         add_params[@"user"]=RASingleton.sharedInstance.user;
-        add_params[@"password"]=self.password;
+        add_params[@"password"]=RASingleton.sharedInstance.password;
         add_params[@"contact_id"]=self.contact_id;
         [self upload_offline:ver useInternalAddress:buseinternaladdress orderid:arr_order params:add_params];
         SyncControlPanelViewController * syncVC =[ [UIStoryboard storyboardWithName:@"OLM" bundle:nil] instantiateViewControllerWithIdentifier:@"SyncControlPanelViewController"];
@@ -2919,7 +2919,7 @@ void UncaughtExceptionHandler(NSException *exception) {
         self.bEnable_Cache = true;
     
     NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
-    self.build =[infoDict objectForKey:@"CFBundleVersion"];
+    RASingleton.sharedInstance.build =[infoDict objectForKey:@"CFBundleVersion"];
     
     //scanner
  

+ 1 - 1
RedAnt ERP Mobile/common/Functions/MainViewController.m

@@ -3107,7 +3107,7 @@
                 UITextField *titleTextField = alertController.textFields.firstObject;
                 UIApplication * app = [UIApplication sharedApplication];
                 AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-                if([appDelegate.password isEqualToString:titleTextField.text])
+                if([RASingleton.sharedInstance.password isEqualToString:titleTextField.text])
                 {
                     DebugLog(@"%@", @"run process");
 //                    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Delete Account" completion:^{

+ 2 - 2
RedAnt ERP Mobile/common/Functions/offline/OLDataProvider.m

@@ -4595,7 +4595,7 @@ if(stockUom==0)
 //    appDelegate.submit_order_logout = false;
 //    appDelegate.alert_sold_in_quantities = false;
 //    
-//    appDelegate.ipad_perm =nil ;
+//    RASingleton.sharedInstance.ipad_perm =nil ;
 //    appDelegate.user_type = USER_ROLE_UNKNOWN;
 //    appDelegate.OrderFilter= nil;
 //    [appDelegate SetSo:nil];
@@ -15904,7 +15904,7 @@ if(stockUom==0)
             appDelegate.submit_order_logout = false;
             appDelegate.alert_sold_in_quantities = false;
             
-            appDelegate.ipad_perm =nil ;
+            RASingleton.sharedInstance.ipad_perm =nil ;
             appDelegate.user_type = USER_ROLE_UNKNOWN;
             appDelegate.OrderFilter= nil;
             [appDelegate SetSo:nil];

+ 2 - 2
RedAnt ERP Mobile/common/Functions/order/OrderDetailViewController.m

@@ -775,8 +775,8 @@
         AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
         if(RASingleton.sharedInstance.user!=nil)
             [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
-        if(appDelegate.password!=nil)
-            [params setValue:appDelegate.password forKey:@"password"];
+        if(RASingleton.sharedInstance.password!=nil)
+            [params setValue:RASingleton.sharedInstance.password forKey:@"password"];
         __weak typeof(self) weakSelf = self;
 //        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Signature" completion:^{
         

+ 6 - 6
RedAnt ERP Mobile/common/Functions/sidemenu/UserListViewController.m

@@ -141,7 +141,7 @@
                         appDelegate.submit_order_logout = false;
                         appDelegate.alert_sold_in_quantities = false;
                         
-                        appDelegate.ipad_perm =nil ;
+                        RASingleton.sharedInstance.ipad_perm =nil ;
                         appDelegate.user_type = USER_ROLE_UNKNOWN;
                         appDelegate.OrderFilter= nil;
                         [appDelegate SetSo:nil];
@@ -168,7 +168,7 @@
                                     if(true)
                                     {
                                         NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
-                                        NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
+                                        NSString* encryptp=[AESCrypt encrypt:RASingleton.sharedInstance.password password:@"usai"] ;
                                         
                                         [defaults setValue:encryptu forKey:@"user"];
                                         [defaults setValue:encryptp forKey:@"password"];
@@ -264,7 +264,7 @@
                         //                            if(true)
                         //                            {
                         //                                NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
-                        //                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
+                        //                                NSString* encryptp=[AESCrypt encrypt:RASingleton.sharedInstance.password password:@"usai"] ;
                         //
                         //                                [defaults setValue:encryptu forKey:@"user"];
                         //                                [defaults setValue:encryptp forKey:@"password"];
@@ -375,7 +375,7 @@
 //                appDelegate.submit_order_logout = false;
 //                appDelegate.alert_sold_in_quantities = false;
 //
-//                appDelegate.ipad_perm =nil ;
+//                RASingleton.sharedInstance.ipad_perm =nil ;
 //                appDelegate.user_type = USER_ROLE_UNKNOWN;
 //                appDelegate.OrderFilter= nil;
 //                [appDelegate SetSo:nil];
@@ -402,7 +402,7 @@
 //                        if(true)
 //                        {
 //                            NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
-//                            NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
+//                            NSString* encryptp=[AESCrypt encrypt:RASingleton.sharedInstance.password password:@"usai"] ;
 //
 //                            [defaults setValue:encryptu forKey:@"user"];
 //                            [defaults setValue:encryptp forKey:@"password"];
@@ -494,7 +494,7 @@
 ////                            if(true)
 ////                            {
 ////                                NSString* encryptu=[AESCrypt encrypt:RASingleton.sharedInstance.user password:@"usai"];
-////                                NSString* encryptp=[AESCrypt encrypt:appDelegate.password password:@"usai"] ;
+////                                NSString* encryptp=[AESCrypt encrypt:RASingleton.sharedInstance.password password:@"usai"] ;
 ////
 ////                                [defaults setValue:encryptu forKey:@"user"];
 ////                                [defaults setValue:encryptp forKey:@"password"];

+ 2 - 2
RedAnt ERP Mobile/common/JKLock/JKLockController.m

@@ -309,7 +309,7 @@
         
         AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
         
-        if ([text isEqualToString:appDelegate.password]) {
+        if ([text isEqualToString:RASingleton.sharedInstance.password]) {
             
 //            [[NSUserDefaults standardUserDefaults] removeObjectForKey:self.passwordKey];
 //            weakself.password = nil;
@@ -375,7 +375,7 @@
         
         AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
         
-        if ([text isEqualToString:appDelegate.password]) {
+        if ([text isEqualToString:RASingleton.sharedInstance.password]) {
             
             [[NSUserDefaults standardUserDefaults] removeObjectForKey:self.passwordKey];
             weakself.password = nil;

+ 6 - 3
RedAnt ERP Mobile/common/RASingleton.h

@@ -47,9 +47,12 @@ typedef enum {
 @property int price_type; //当前设置的价格类型
 
 
-@property (nonatomic,  copy) NSString *user;///替代appdelegate里的user访问
-///
-///
+@property (nonatomic,  strong) NSString *user;///替代appdelegate里的user访问
+@property (strong,nonatomic) NSString * password;
+@property (strong , nonatomic) NSString* ipad_perm;
+@property (strong,nonatomic) NSString* build;
+
+
 @property (strong,nonatomic) NSString * duid; //推送令牌
 ///
 ///

+ 5 - 0
RedAnt ERP Mobile/common/RASingleton.m

@@ -45,6 +45,11 @@
     
     [self setGlobalParameter:_user forKey:@"user"];
 }
+- (void)setPassword:(NSString *)password {
+    _password = password;
+    [self setGlobalParameter:_password forKey:@"password"];
+}
+
 - (void)dealloc {
     [[NSNotificationCenter defaultCenter] removeObserver:self];
     

+ 2 - 2
RedAnt ERP Mobile/common/customUI/ImageUploadViewController.m

@@ -310,8 +310,8 @@
         
         if(RASingleton.sharedInstance.user!=nil)
             [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
-        if(appDelegate.password!=nil)
-            [params setValue:appDelegate.password forKey:@"password"];
+        if(RASingleton.sharedInstance.password!=nil)
+            [params setValue:RASingleton.sharedInstance.password forKey:@"password"];
         
        
         __weak typeof(self) weakSelf = self;

+ 5 - 5
RedAnt ERP Mobile/common/data_provider/RADataProvider.m

@@ -774,7 +774,7 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     appDelegate=(AppDelegate*)[[UIApplication sharedApplication] delegate];
     NSMutableDictionary* param = [NSMutableDictionary new];
     param[@"_method"]=@"changePasswordOfflineOrderUser";
-    param[@"opsw"]=appDelegate.password;
+    param[@"opsw"]=RASingleton.sharedInstance.password;
     param[@"npsw"]=pwd;
     param[@"user"]=RASingleton.sharedInstance.user;
     param[@"site_name"]=[self getSiteName];
@@ -842,8 +842,8 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
     
     if(appDelegate.contact_id!=nil)
         [params setValue:appDelegate.contact_id forKey:@"contactId"];
-    if(appDelegate.password!=nil)
-        [params setValue:appDelegate.password forKey:@"password"];
+    if(RASingleton.sharedInstance.password!=nil)
+        [params setValue:RASingleton.sharedInstance.password forKey:@"password"];
     
     if(appDelegate.order_code!=nil)
         [params setValue:appDelegate.order_code forKey:@"orderCode"];
@@ -1002,8 +1002,8 @@ NSDate * ddate =[dateFormatter dateFromString:@"2023-08-01"];
         [params setValue:RASingleton.sharedInstance.user forKey:@"user"];
     if(appDelegate.contact_id!=nil)
         [params setValue:appDelegate.contact_id forKey:@"contactId"];
-    if(appDelegate.password!=nil)
-        [params setValue:appDelegate.password forKey:@"password"];
+    if(RASingleton.sharedInstance.password!=nil)
+        [params setValue:RASingleton.sharedInstance.password forKey:@"password"];
     
     //    if(appDelegate.order_code!=nil)
     //        [params setValue:appDelegate.order_code forKey:@"orderCode"];

File diff suppressed because it is too large
+ 182 - 182
RedAnt ERP Mobile/common/data_provider/RANetwork.m


Some files were not shown because too many files changed in this diff