Sfoglia il codice sorgente

RA Image iOS 26 compatible update

Ray Zhang 6 mesi fa
parent
commit
e843d23bc4

+ 27 - 49
RA Image/RA Image.xcodeproj/project.pbxproj

@@ -7,6 +7,8 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C7F02232E828BB00045BA97 /* SceneDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7F02222E828BAF0045BA97 /* SceneDelegate.m */; };
+		3C7F022C2E829D0F0045BA97 /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C7F022B2E829D0F0045BA97 /* RASingleton.m */; };
 		3C9CCF4A247E4B07006A49A5 /* UIImage+RedAnt.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9CCF48247E4B07006A49A5 /* UIImage+RedAnt.m */; };
 		3CBC87372A53E99200978758 /* PopWaitAlert.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBC87342A53E99200978758 /* PopWaitAlert.m */; };
 		3CBC87382A53E99200978758 /* MessageBox.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBC87352A53E99200978758 /* MessageBox.m */; };
@@ -74,12 +76,6 @@
 		71114AC91EB1C73B00D2200C /* zip.c in Sources */ = {isa = PBXBuildFile; fileRef = 71114AC41EB1C73B00D2200C /* zip.c */; };
 		71114ACC1EB1C76E00D2200C /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 71114ACB1EB1C76E00D2200C /* libz.tbd */; };
 		71114ACF1EB1C79300D2200C /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114ACE1EB1C79300D2200C /* Reachability.m */; };
-		71114AEE1EB2DEF900D2200C /* cam_scan.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 71114AE31EB2DEF900D2200C /* cam_scan.storyboard */; };
-		71114AEF1EB2DEF900D2200C /* MenuViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AE51EB2DEF900D2200C /* MenuViewController.m */; };
-		71114AF01EB2DEF900D2200C /* RAMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AE71EB2DEF900D2200C /* RAMenu.m */; };
-		71114AF11EB2DEF900D2200C /* ScannerControllerView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AE91EB2DEF900D2200C /* ScannerControllerView.m */; };
-		71114AF21EB2DEF900D2200C /* ScannerViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AEB1EB2DEF900D2200C /* ScannerViewController.m */; };
-		71114AF31EB2DEF900D2200C /* SCShapeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 71114AED1EB2DEF900D2200C /* SCShapeView.m */; };
 		71749AFD1ECC199300018EEC /* UIImage+fixOrientation.m in Sources */ = {isa = PBXBuildFile; fileRef = 71749AFC1ECC199300018EEC /* UIImage+fixOrientation.m */; };
 		717A37AE1ED6BF0700E09FB6 /* ImageUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 717A37AD1ED6BF0700E09FB6 /* ImageUtils.m */; };
 		71961CB01EC00DDD002C4096 /* RANetworkTaskDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 71961CAB1EC00DDD002C4096 /* RANetworkTaskDelegate.m */; };
@@ -96,6 +92,10 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C7F02212E828BAF0045BA97 /* SceneDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SceneDelegate.h; sourceTree = "<group>"; };
+		3C7F02222E828BAF0045BA97 /* SceneDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SceneDelegate.m; sourceTree = "<group>"; };
+		3C7F022A2E829D0F0045BA97 /* RASingleton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RASingleton.h; sourceTree = "<group>"; };
+		3C7F022B2E829D0F0045BA97 /* RASingleton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASingleton.m; sourceTree = "<group>"; };
 		3C9CCF48247E4B07006A49A5 /* UIImage+RedAnt.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+RedAnt.m"; path = "../../common/UIImage/UIImage+RedAnt.m"; sourceTree = "<group>"; };
 		3C9CCF49247E4B07006A49A5 /* UIImage+RedAnt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+RedAnt.h"; path = "../../common/UIImage/UIImage+RedAnt.h"; sourceTree = "<group>"; };
 		3CBC87312A53E99200978758 /* MessageBox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBox.h; sourceTree = "<group>"; };
@@ -219,17 +219,6 @@
 		71114ACB1EB1C76E00D2200C /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
 		71114ACD1EB1C79300D2200C /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Reachability.h; path = "../../RedAnt ERP Mobile/common/Reachability.h"; sourceTree = "<group>"; };
 		71114ACE1EB1C79300D2200C /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Reachability.m; path = "../../RedAnt ERP Mobile/common/Reachability.m"; sourceTree = "<group>"; };
-		71114AE31EB2DEF900D2200C /* cam_scan.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = cam_scan.storyboard; path = ../../common/cam_scan.storyboard; sourceTree = "<group>"; };
-		71114AE41EB2DEF900D2200C /* MenuViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MenuViewController.h; path = ../../common/MenuViewController.h; sourceTree = "<group>"; };
-		71114AE51EB2DEF900D2200C /* MenuViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MenuViewController.m; path = ../../common/MenuViewController.m; sourceTree = "<group>"; };
-		71114AE61EB2DEF900D2200C /* RAMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAMenu.h; path = ../../common/RAMenu.h; sourceTree = "<group>"; };
-		71114AE71EB2DEF900D2200C /* RAMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAMenu.m; path = ../../common/RAMenu.m; sourceTree = "<group>"; };
-		71114AE81EB2DEF900D2200C /* ScannerControllerView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScannerControllerView.h; path = ../../common/ScannerControllerView.h; sourceTree = "<group>"; };
-		71114AE91EB2DEF900D2200C /* ScannerControllerView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ScannerControllerView.m; path = ../../common/ScannerControllerView.m; sourceTree = "<group>"; };
-		71114AEA1EB2DEF900D2200C /* ScannerViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScannerViewController.h; path = ../../common/ScannerViewController.h; sourceTree = "<group>"; };
-		71114AEB1EB2DEF900D2200C /* ScannerViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ScannerViewController.m; path = ../../common/ScannerViewController.m; sourceTree = "<group>"; };
-		71114AEC1EB2DEF900D2200C /* SCShapeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SCShapeView.h; path = ../../common/SCShapeView.h; sourceTree = "<group>"; };
-		71114AED1EB2DEF900D2200C /* SCShapeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SCShapeView.m; path = ../../common/SCShapeView.m; sourceTree = "<group>"; };
 		71749AFB1ECC199300018EEC /* UIImage+fixOrientation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIImage+fixOrientation.h"; path = "../../common/UIImage+fixOrientation.h"; sourceTree = "<group>"; };
 		71749AFC1ECC199300018EEC /* UIImage+fixOrientation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIImage+fixOrientation.m"; path = "../../common/UIImage+fixOrientation.m"; sourceTree = "<group>"; };
 		717A37AC1ED6BF0700E09FB6 /* ImageUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageUtils.h; path = "../../RedAnt ERP Mobile/common/ImageUtils.h"; sourceTree = "<group>"; };
@@ -658,24 +647,6 @@
 			name = Frameworks;
 			sourceTree = "<group>";
 		};
-		71114AE21EB2DEE800D2200C /* cam scan */ = {
-			isa = PBXGroup;
-			children = (
-				71114AE31EB2DEF900D2200C /* cam_scan.storyboard */,
-				71114AE41EB2DEF900D2200C /* MenuViewController.h */,
-				71114AE51EB2DEF900D2200C /* MenuViewController.m */,
-				71114AE61EB2DEF900D2200C /* RAMenu.h */,
-				71114AE71EB2DEF900D2200C /* RAMenu.m */,
-				71114AE81EB2DEF900D2200C /* ScannerControllerView.h */,
-				71114AE91EB2DEF900D2200C /* ScannerControllerView.m */,
-				71114AEA1EB2DEF900D2200C /* ScannerViewController.h */,
-				71114AEB1EB2DEF900D2200C /* ScannerViewController.m */,
-				71114AEC1EB2DEF900D2200C /* SCShapeView.h */,
-				71114AED1EB2DEF900D2200C /* SCShapeView.m */,
-			);
-			name = "cam scan";
-			sourceTree = "<group>";
-		};
 		71DCDC2B1EAF234E00BA045A = {
 			isa = PBXGroup;
 			children = (
@@ -709,12 +680,15 @@
 				42A829C91EBC6BF500898B8A /* Upload */,
 				42BC2CFC1EBAC3D40016B30D /* PhotoList */,
 				71DCDC4E1EAF34F800BA045A /* modes */,
-				71114AE21EB2DEE800D2200C /* cam scan */,
 				42E1B0F71EB1C8BB00EEF27C /* Login */,
 				42E1B10E1EB1E93E00EEF27C /* Root */,
 				42CE45C7217D73E6003ECD01 /* signature */,
 				71DCDC3A1EAF234E00BA045A /* AppDelegate.h */,
 				71DCDC3B1EAF234E00BA045A /* AppDelegate.m */,
+				3C7F022A2E829D0F0045BA97 /* RASingleton.h */,
+				3C7F022B2E829D0F0045BA97 /* RASingleton.m */,
+				3C7F02212E828BAF0045BA97 /* SceneDelegate.h */,
+				3C7F02222E828BAF0045BA97 /* SceneDelegate.m */,
 				42A829BE1EBC027100898B8A /* RootNavigationController.h */,
 				42A829BF1EBC027100898B8A /* RootNavigationController.m */,
 				71DCDC401EAF234E00BA045A /* RAImage.storyboard */,
@@ -777,12 +751,13 @@
 			isa = PBXProject;
 			attributes = {
 				BuildIndependentTargetsInParallel = YES;
-				LastUpgradeCheck = 1630;
+				LastUpgradeCheck = 2600;
 				ORGANIZATIONNAME = USAI;
 				TargetAttributes = {
 					71DCDC331EAF234E00BA045A = {
 						CreatedOnToolsVersion = 8.3.2;
 						DevelopmentTeam = HXWLAA5YN5;
+						LastSwiftMigration = 2600;
 						ProvisioningStyle = Automatic;
 					};
 				};
@@ -819,7 +794,6 @@
 				4203E61121BA65F5003E90BD /* RAPhotoPreview.xcassets in Resources */,
 				4203E61221BA65F5003E90BD /* PhotoList.storyboard in Resources */,
 				3CC5BEE0254D10CD00ECBE20 /* Launch Screen.storyboard in Resources */,
-				71114AEE1EB2DEF900D2200C /* cam_scan.storyboard in Resources */,
 				42CE45CE217D73E6003ECD01 /* signature.storyboard in Resources */,
 				71DCDC421EAF234E00BA045A /* RAImage.storyboard in Resources */,
 				71114AB31EB1C5C800D2200C /* LICENSE in Resources */,
@@ -847,10 +821,8 @@
 				426E6B241EB85C2B00942BE1 /* PopModeViewController.m in Sources */,
 				42CE45C4217D6D0D003ECD01 /* PODModeViewController.m in Sources */,
 				4203E60121BA5E88003E90BD /* RACameraViewController.m in Sources */,
-				71114AF01EB2DEF900D2200C /* RAMenu.m in Sources */,
 				71114AC61EB1C73B00D2200C /* ioapi.c in Sources */,
 				42056E7E1EB989AB0010597A /* JLKeyboardListener.m in Sources */,
-				71114AF11EB2DEF900D2200C /* ScannerControllerView.m in Sources */,
 				428566D51EF1220F0041208A /* NewPhotoPreviewController.m in Sources */,
 				71114A9D1EB1BCB400D2200C /* LoginViewController.m in Sources */,
 				71114AB51EB1C5C800D2200C /* NSData+CommonCrypto.m in Sources */,
@@ -866,18 +838,16 @@
 				42E1B1081EB1D9B100EEF27C /* LoginSettingViewController.m in Sources */,
 				71F8D1CE1EC955BF002003DB /* UIView+Toast.m in Sources */,
 				71114AC81EB1C73B00D2200C /* unzip.c in Sources */,
-				71114AEF1EB2DEF900D2200C /* MenuViewController.m in Sources */,
 				71E9F6B31F8B46380052C78E /* NetworkUtils.m in Sources */,
 				71114AA31EB1C40900D2200C /* RANetwork.m in Sources */,
 				71114AC91EB1C73B00D2200C /* zip.c in Sources */,
 				428566D81EF122360041208A /* RAImagePhotoPreviewCell.m in Sources */,
 				3CD0EDFE2541BB5C00BDA788 /* RAUtils.m in Sources */,
-				71114AF31EB2DEF900D2200C /* SCShapeView.m in Sources */,
 				71961CB11EC00DDD002C4096 /* RAUploadManager.m in Sources */,
 				3CBE7AE425469D9E000D520B /* ReceivingPalletIDViewController.m in Sources */,
-				71114AF21EB2DEF900D2200C /* ScannerViewController.m in Sources */,
 				717A37AE1ED6BF0700E09FB6 /* ImageUtils.m in Sources */,
 				42BC2D091EBAC75F0016B30D /* TouchImageView.m in Sources */,
+				3C7F022C2E829D0F0045BA97 /* RASingleton.m in Sources */,
 				42A829C31EBC0F8300898B8A /* ManufacturerListController.m in Sources */,
 				4203E5FE21BA5E88003E90BD /* RAQRCodeScannerViewController.m in Sources */,
 				71114AB61EB1C5C800D2200C /* NSString+Base64.m in Sources */,
@@ -900,6 +870,7 @@
 				42E1B0FE1EB1C8EE00EEF27C /* LoginTextFiledCell.m in Sources */,
 				71961CB01EC00DDD002C4096 /* RANetworkTaskDelegate.m in Sources */,
 				42A829D21EBC6D3300898B8A /* UploadCell.m in Sources */,
+				3C7F02232E828BB00045BA97 /* SceneDelegate.m in Sources */,
 				42CE45D0217D73E6003ECD01 /* SignatureView.m in Sources */,
 				71114AB41EB1C5C800D2200C /* NSData+Base64.m in Sources */,
 				71114ACF1EB1C79300D2200C /* Reachability.m in Sources */,
@@ -978,6 +949,7 @@
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
+				STRING_CATALOG_GENERATE_SYMBOLS = YES;
 			};
 			name = Debug;
 		};
@@ -1031,6 +1003,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
+				STRING_CATALOG_GENERATE_SYMBOLS = YES;
 				VALIDATE_PRODUCT = YES;
 			};
 			name = Release;
@@ -1039,21 +1012,24 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_ENABLE_MODULES = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 53235;
+				CURRENT_PROJECT_VERSION = 57532;
 				INFOPLIST_FILE = "RA Image/Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 1.24;
+				MARKETING_VERSION = 1.25;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.RA-Image";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
 				SUPPORTS_MACCATALYST = NO;
 				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+				SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+				SWIFT_VERSION = 6.0;
 				TARGETED_DEVICE_FAMILY = 1;
 			};
 			name = Debug;
@@ -1062,21 +1038,23 @@
 			isa = XCBuildConfiguration;
 			buildSettings = {
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+				CLANG_ENABLE_MODULES = YES;
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
-				CURRENT_PROJECT_VERSION = 53235;
+				CURRENT_PROJECT_VERSION = 57532;
 				INFOPLIST_FILE = "RA Image/Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 13.0;
 				LD_RUNPATH_SEARCH_PATHS = (
 					"$(inherited)",
 					"@executable_path/Frameworks",
 				);
-				MARKETING_VERSION = 1.24;
+				MARKETING_VERSION = 1.25;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.RA-Image";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				PROVISIONING_PROFILE_SPECIFIER = "";
 				SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
 				SUPPORTS_MACCATALYST = NO;
 				SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+				SWIFT_VERSION = 6.0;
 				TARGETED_DEVICE_FAMILY = 1;
 			};
 			name = Release;

+ 17 - 17
RA Image/RA Image/AppDelegate.h

@@ -13,23 +13,23 @@
 
 @property (strong, nonatomic) UIWindow *window;
 
-@property (strong,nonatomic) NSString* user;
-@property (strong,nonatomic) NSString * password;
-@property (strong,nonatomic) NSString* build;
-@property (strong,nonatomic) NSString* shortver;
-@property bool bLogin;
-@property (nonatomic,copy) NSString *address;
-@property (nonatomic,copy) NSString *companyName;
-@property (nonatomic,copy) UIImage *companyIcon;
-@property (nonatomic,strong) NSArray *modeList;
-@property (nonatomic,assign) BOOL shouldAutoShowModeVC;
-@property (assign) bool bEnable_Cache;
-@property (nonatomic,assign) BOOL compressFile;
+//@property (strong,nonatomic) NSString* user;
+//@property (strong,nonatomic) NSString * password;
+//@property (strong,nonatomic) NSString* build;
+//@property (strong,nonatomic) NSString* shortver;
+//@property bool bLogin;
+//@property (nonatomic,copy) NSString *address;
+//@property (nonatomic,copy) NSString *companyName;
+//@property (nonatomic,copy) UIImage *companyIcon;
+//@property (nonatomic,strong) NSArray *modeList;
+//@property (nonatomic,assign) BOOL shouldAutoShowModeVC;
+//@property (assign) bool bEnable_Cache;
+//@property (nonatomic,assign) BOOL compressFile;
 
-- (void)showNormalRootVC;
-- (void)showLoginVC;
-- (void)logout;
-- (void)loadCompanyIcon:(NSString *)url;
-@property (strong, nonatomic)  RAUploadManager *uploadManager;
+//- (void)showNormalRootVC;
+//- (void)showLoginVC;
+//- (void)logout;
+
+//@property (strong, nonatomic)  RAUploadManager *uploadManager;
 @end
 

+ 79 - 90
RA Image/RA Image/AppDelegate.m

@@ -10,89 +10,68 @@
 #import "LoginViewController.h"
 #import "RootViewController.h"
 #import "UploadSettingController.h"
+#import "RASingleton.h"
 
 @interface AppDelegate ()
 
-@property (nonatomic,strong) UIViewController *rootVC;
+//@property (nonatomic,strong) UIViewController *rootVC;
 
 @end
 
 @implementation AppDelegate
 
-- (void)showNormalRootVC {
-    self.window.rootViewController = self.rootVC;
-//    NSMutableArray *arr = [self cachedUploadTasks];
-//    if (arr && arr.count) {
-//        [self.uploadManager addTasks:arr];
+//- (void)showNormalRootVC {
+//    self.window.rootViewController = self.rootVC;
+////    NSMutableArray *arr = [self cachedUploadTasks];
+////    if (arr && arr.count) {
+////        [self.uploadManager addTasks:arr];
+////    }
+//}
+//
+//- (void)showLoginVC {
+//    if (![self.window.rootViewController isKindOfClass:[LoginViewController class]]) {
+//        LoginViewController *loginVC = [[UIStoryboard storyboardWithName:@"RAImage" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
+//        
+//        [self.window setRootViewController:loginVC];
+//        RASingleton.sharedInstance.shouldAutoShowModeVC = YES;
 //    }
-}
-
-- (void)showLoginVC {
-    if (![self.window.rootViewController isKindOfClass:[LoginViewController class]]) {
-        LoginViewController *loginVC = [[UIStoryboard storyboardWithName:@"RAImage" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
-        
-        [self.window setRootViewController:loginVC];
-        self.shouldAutoShowModeVC = YES;
-    }
-}
+//}
 
-- (void)logout {
-    self.user = nil;
-    self.password = nil;
-    self.address = nil;
-    self.bLogin = false;
-    self.companyName = nil;
-    self.companyIcon = nil;
-    self.modeList = nil;
-    [[NSNotificationCenter defaultCenter] postNotificationName:LogoutNotification object:nil];
-    
-    [self showLoginVC];
-}
+//- (void)logout {
+//    RASingleton.sharedInstance.user = nil;
+//    RASingleton.sharedInstance.password = nil;
+//    RASingleton.sharedInstance.address = nil;
+//    RASingleton.sharedInstance.bLogin = false;
+//    RASingleton.sharedInstance.companyName = nil;
+//    RASingleton.sharedInstance.companyIcon = nil;
+//    RASingleton.sharedInstance.modeList = nil;
+//    [[NSNotificationCenter defaultCenter] postNotificationName:LogoutNotification object:nil];
+//    
+//    [self showLoginVC];
+//}
 
-- (void)setCompanyIcon:(UIImage *)companyIcon {
-    if (!companyIcon) {
-        companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
-    }
-    _companyIcon = companyIcon;
-    __weak typeof(self) weakself = self;
-    dispatch_async(dispatch_get_main_queue(), ^{
-        UINavigationController *nav = (UINavigationController *)weakself.rootVC;
-        RootViewController *rvc = [nav.viewControllers firstObject];
-        [rvc setCompanyIcon:companyIcon];
-    });
+//- (void)setCompanyIcon:(UIImage *)companyIcon {
+//    if (!companyIcon) {
+//        companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
+//    }
+//    RASingleton.sharedInstance.companyIcon = companyIcon;
+//    __weak typeof(self) weakself = self;
+//    dispatch_async(dispatch_get_main_queue(), ^{
+//        UINavigationController *nav = (UINavigationController *)weakself.rootVC;
+//        RootViewController *rvc = [nav.viewControllers firstObject];
+//        [rvc setCompanyIcon:companyIcon];
+//    });
+//
+//}
 
-}
 
-- (void)loadCompanyIcon:(NSString *)url {
-    if (!url.length) return;
-    NSString *name = [url lastPathComponent];
-    NSFileManager *manager = [NSFileManager defaultManager];
-    NSString *path = [[RAUtils appCacheDirectory] stringByAppendingPathComponent:name];
-    if ([manager fileExistsAtPath:path]) {
-        self.companyIcon = [UIImage imageWithContentsOfFile:path];
-    } else {
-        __weak typeof(self) weakself = self;
-        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-            UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
-            if (weakself.bLogin) {
-                if (img) {
-                    weakself.companyIcon = img;
-                    [RAUtils saveData:UIImagePNGRepresentation(img) toPath:path];
-                } else {
-                    weakself.companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
-                }
-            }
-        });
-    }
-    
-}
 
-- (NSString *)address {
-    if (_address) {
-        return [_address stringByAppendingString:@"/index.php?_action=handset_new"];
-    }
-    return nil;
-}
+//- (NSString *)address {
+//    if (_address) {
+//        return [_address stringByAppendingString:@"/index.php?_action=handset_new"];
+//    }
+//    return nil;
+//}
 
 #pragma mark - Exception
 
@@ -119,8 +98,10 @@ void UncaughtExceptionHandler(NSException *exception) {
         if(true/*||self.uploadManager.arr_queue!=nil*/)
         {
             
-            [self.uploadManager stopAllTasks];
-            [self.uploadManager saveTasks];
+            [RASingleton.sharedInstance.uploadManager stopAllTasks];
+            [RASingleton.sharedInstance.uploadManager saveTasks];
+//            [self.uploadManager stopAllTasks];
+//            [self.uploadManager saveTasks];
 
             
         }
@@ -130,10 +111,10 @@ void UncaughtExceptionHandler(NSException *exception) {
 }
 
 - (NSMutableArray *)cachedUploadTasks {
-    if (!self.user) {
+    if (!RASingleton.sharedInstance.user) {
         return nil;
     }
-    NSString *path = [[RAUtils appCacheDirectory] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_uploadTasks",self.user]];
+    NSString *path = [[RAUtils appCacheDirectory] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@_uploadTasks",RASingleton.sharedInstance.user]];
     
     NSFileManager *manager = [NSFileManager defaultManager];
     if ([manager fileExistsAtPath:path]) {
@@ -148,17 +129,21 @@ void UncaughtExceptionHandler(NSException *exception) {
 #pragma mark - App Delegate
 
 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+    
+
+
     // Override point for customization after application launch.
     
     [self setUpUncaughtExceptionHandler];
     
     NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
-    self.build =[infoDict objectForKey:@"CFBundleVersion"];
-    self.shortver=[infoDict objectForKey:@"CFBundleShortVersionString"];
-    self.rootVC = self.window.rootViewController;
+    RASingleton.sharedInstance.build =[infoDict objectForKey:@"CFBundleVersion"];
+    RASingleton.sharedInstance.shortver=[infoDict objectForKey:@"CFBundleShortVersionString"];
+    
+//    self.rootVC = self.window.rootViewController;
     
 //    self.uploadManager.maxRetry = 2;
-    self.compressFile = [[RAUPloadManagerConfigure alloc] init].compressImage;
+    RASingleton.sharedInstance.compressFile = [[RAUPloadManagerConfigure alloc] init].compressImage;
     
     return YES;
 }
@@ -167,7 +152,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 - (void)applicationWillResignActive:(UIApplication *)application {
     // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
     // Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
-    [self.rootVC.view endEditing:YES];
+//    [self.rootVC.view endEditing:YES];
 }
 
 
@@ -187,18 +172,7 @@ void UncaughtExceptionHandler(NSException *exception) {
 
 - (void)applicationDidBecomeActive:(UIApplication *)application {
     // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
-    if (!self.bLogin) {
-        [self showLoginVC];
-    }
-    
-    [RAUploadManager configureUploadManager:^(RAUPloadManagerConfigure *configure) {
-       
-        configure.autoRemoveFinish = YES;
-    }];
-    
-    if (!self.uploadManager) {
-        self.uploadManager=[RAUploadManager sharedManager];
-    }
+
 }
 
 
@@ -207,6 +181,21 @@ void UncaughtExceptionHandler(NSException *exception) {
     [self saveUploadTasks];
 }
 
+#pragma mark - UISceneSession lifecycle
+
+
+- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options {
+    // Called when a new scene session is being created.
+    // Use this method to select a configuration to create the new scene with.
+    return [[UISceneConfiguration alloc] initWithName:@"Default Configuration" sessionRole:connectingSceneSession.role];
+}
+
+
+- (void)application:(UIApplication *)application didDiscardSceneSessions:(NSSet<UISceneSession *> *)sceneSessions {
+    // Called when the user discards a scene session.
+    // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
+    // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
+}
 
 
 @end

+ 60 - 73
RA Image/RA Image/Base.lproj/RAImage.storyboard

@@ -1,9 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="21701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="zf9-JT-Kr2">
-    <device id="retina4_7" orientation="portrait" appearance="light"/>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="24128" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="zf9-JT-Kr2">
+    <device id="retina6_9" orientation="portrait" appearance="light"/>
     <dependencies>
         <deployment identifier="iOS"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="21678"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="24063"/>
+        <capability name="Safe area layout guides" minToolsVersion="9.0"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -12,7 +13,7 @@
             <objects>
                 <navigationController id="zf9-JT-Kr2" customClass="RootNavigationController" sceneMemberID="viewController">
                     <navigationBar key="navigationBar" contentMode="scaleToFill" id="fQ0-CT-SJq">
-                        <rect key="frame" x="0.0" y="20" width="375" height="44"/>
+                        <rect key="frame" x="0.0" y="124" width="440" height="54"/>
                         <autoresizingMask key="autoresizingMask"/>
                     </navigationBar>
                     <connections>
@@ -27,27 +28,23 @@
         <scene sceneID="OHA-Vc-Klx">
             <objects>
                 <viewController storyboardIdentifier="RootViewController" useStoryboardIdentifierAsRestorationIdentifier="YES" id="Dtz-oi-w09" customClass="RootViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="qba-7X-gfw"/>
-                        <viewControllerLayoutGuide type="bottom" id="X0p-Er-QSV"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="0cG-hA-GsV">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="440" height="956"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="40" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="qOW-M6-IJk">
-                                <rect key="frame" x="0.0" y="135" width="375" height="481"/>
+                                <rect key="frame" x="0.0" y="249" width="440" height="656"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <prototypes>
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="RootModeCell" rowHeight="40" id="a3Z-Pv-WAq" customClass="RootModeCell">
-                                        <rect key="frame" x="0.0" y="50" width="375" height="40"/>
+                                        <rect key="frame" x="0.0" y="50.333333969116211" width="440" height="40"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="a3Z-Pv-WAq" id="KU3-qN-JgJ">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="40"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="440" height="40"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Mode" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="wdD-Sc-rpM">
-                                                    <rect key="frame" x="10" y="5" width="355" height="30"/>
+                                                    <rect key="frame" x="10" y="5" width="420" height="30"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
@@ -71,7 +68,7 @@
                                 </connections>
                             </tableView>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="76b-Zz-kRV">
-                                <rect key="frame" x="0.0" y="64" width="375" height="70"/>
+                                <rect key="frame" x="0.0" y="178" width="440" height="70"/>
                                 <subviews>
                                     <imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="redAnt" translatesAutoresizingMaskIntoConstraints="NO" id="jOJ-Py-4V7">
                                         <rect key="frame" x="10" y="10" width="50" height="50"/>
@@ -82,7 +79,7 @@
                                         </constraints>
                                     </imageView>
                                     <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Npd" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jih-EZ-3Hj">
-                                        <rect key="frame" x="70" y="25" width="295" height="20"/>
+                                        <rect key="frame" x="70" y="25" width="360" height="20"/>
                                         <constraints>
                                             <constraint firstAttribute="height" constant="20" id="qYa-PP-rUN"/>
                                         </constraints>
@@ -102,24 +99,24 @@
                                 </constraints>
                             </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="U7i-RF-fNv">
-                                <rect key="frame" x="0.0" y="132.5" width="375" height="0.5"/>
+                                <rect key="frame" x="0.0" y="246.66666666666666" width="440" height="0.33333333333334281"/>
                                 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="0.5" id="BoU-iz-Rb0"/>
                                 </constraints>
                             </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="I9R-Zj-mk5">
-                                <rect key="frame" x="0.0" y="616" width="375" height="0.5"/>
+                                <rect key="frame" x="0.0" y="905" width="440" height="0.66666666666662877"/>
                                 <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="0.5" id="s2D-BK-xN7"/>
                                 </constraints>
                             </view>
                             <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="TfJ-sO-Wub">
-                                <rect key="frame" x="0.0" y="617" width="375" height="50"/>
+                                <rect key="frame" x="0.0" y="906" width="440" height="50"/>
                                 <subviews>
                                     <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="I2w-Kd-8pR">
-                                        <rect key="frame" x="10" y="8.5" width="109" height="33"/>
+                                        <rect key="frame" x="10" y="8.6666666666666288" width="109" height="33"/>
                                         <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                         <state key="normal" title="upload setting">
                                             <color key="titleColor" red="0.0" green="0.47843137250000001" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
@@ -138,23 +135,24 @@
                                 </constraints>
                             </view>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="btN-dX-nvt"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
                             <constraint firstAttribute="bottom" secondItem="TfJ-sO-Wub" secondAttribute="bottom" id="17k-AL-bPf"/>
-                            <constraint firstItem="TfJ-sO-Wub" firstAttribute="leading" secondItem="0cG-hA-GsV" secondAttribute="leading" id="DHk-0v-LNU"/>
+                            <constraint firstItem="TfJ-sO-Wub" firstAttribute="leading" secondItem="btN-dX-nvt" secondAttribute="leading" id="DHk-0v-LNU"/>
                             <constraint firstItem="I9R-Zj-mk5" firstAttribute="width" secondItem="TfJ-sO-Wub" secondAttribute="width" id="G7R-Lf-7r1"/>
                             <constraint firstItem="qOW-M6-IJk" firstAttribute="top" secondItem="76b-Zz-kRV" secondAttribute="bottom" constant="1" id="IKq-f3-3C9"/>
-                            <constraint firstAttribute="trailing" secondItem="76b-Zz-kRV" secondAttribute="trailing" id="QGk-4V-qOB"/>
+                            <constraint firstItem="btN-dX-nvt" firstAttribute="trailing" secondItem="76b-Zz-kRV" secondAttribute="trailing" id="QGk-4V-qOB"/>
                             <constraint firstItem="U7i-RF-fNv" firstAttribute="leading" secondItem="76b-Zz-kRV" secondAttribute="leading" id="e40-iU-EoT"/>
-                            <constraint firstItem="76b-Zz-kRV" firstAttribute="leading" secondItem="0cG-hA-GsV" secondAttribute="leading" id="eXT-Ew-DCY"/>
-                            <constraint firstAttribute="trailing" secondItem="TfJ-sO-Wub" secondAttribute="trailing" id="iBQ-rl-Ihk"/>
-                            <constraint firstAttribute="trailing" secondItem="qOW-M6-IJk" secondAttribute="trailing" id="jxV-4b-nO7"/>
+                            <constraint firstItem="76b-Zz-kRV" firstAttribute="leading" secondItem="btN-dX-nvt" secondAttribute="leading" id="eXT-Ew-DCY"/>
+                            <constraint firstItem="btN-dX-nvt" firstAttribute="trailing" secondItem="TfJ-sO-Wub" secondAttribute="trailing" id="iBQ-rl-Ihk"/>
+                            <constraint firstItem="btN-dX-nvt" firstAttribute="trailing" secondItem="qOW-M6-IJk" secondAttribute="trailing" id="jxV-4b-nO7"/>
                             <constraint firstItem="I9R-Zj-mk5" firstAttribute="top" secondItem="TfJ-sO-Wub" secondAttribute="top" constant="-1" id="khb-wd-8tZ"/>
                             <constraint firstItem="U7i-RF-fNv" firstAttribute="bottom" secondItem="76b-Zz-kRV" secondAttribute="bottom" constant="-1" id="ocf-gQ-IUN"/>
-                            <constraint firstItem="76b-Zz-kRV" firstAttribute="top" secondItem="qba-7X-gfw" secondAttribute="bottom" id="qpe-mG-XQC"/>
+                            <constraint firstItem="76b-Zz-kRV" firstAttribute="top" secondItem="btN-dX-nvt" secondAttribute="top" id="qpe-mG-XQC"/>
                             <constraint firstItem="I9R-Zj-mk5" firstAttribute="leading" secondItem="TfJ-sO-Wub" secondAttribute="leading" id="se4-kr-7RF"/>
                             <constraint firstItem="TfJ-sO-Wub" firstAttribute="top" secondItem="qOW-M6-IJk" secondAttribute="bottom" constant="1" id="uaP-Zb-zmr"/>
-                            <constraint firstItem="qOW-M6-IJk" firstAttribute="leading" secondItem="0cG-hA-GsV" secondAttribute="leading" id="vgN-vX-TtL"/>
+                            <constraint firstItem="qOW-M6-IJk" firstAttribute="leading" secondItem="btN-dX-nvt" secondAttribute="leading" id="vgN-vX-TtL"/>
                             <constraint firstItem="U7i-RF-fNv" firstAttribute="width" secondItem="76b-Zz-kRV" secondAttribute="width" id="zm7-mY-DJF"/>
                         </constraints>
                     </view>
@@ -173,16 +171,12 @@
         <scene sceneID="5BS-AD-3M8">
             <objects>
                 <viewController storyboardIdentifier="LoginViewController" id="l61-Sy-3V2" customClass="LoginViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="H4k-R1-29n"/>
-                        <viewControllerLayoutGuide type="bottom" id="p61-40-fkz"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="eFV-Mf-82R">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="440" height="956"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="RA Image" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7Tz-Ne-9Q4">
-                                <rect key="frame" x="0.0" y="100" width="375" height="50"/>
+                                <rect key="frame" x="0.0" y="204" width="440" height="50"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="50" id="tbZ-ys-B3a"/>
                                 </constraints>
@@ -191,21 +185,21 @@
                                 <nil key="highlightedColor"/>
                             </label>
                             <tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" scrollEnabled="NO" showsHorizontalScrollIndicator="NO" showsVerticalScrollIndicator="NO" bouncesZoom="NO" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="50" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ZEy-rA-ish">
-                                <rect key="frame" x="0.0" y="190" width="375" height="200"/>
+                                <rect key="frame" x="0.0" y="294" width="440" height="200"/>
                                 <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="200" id="qNy-dF-L1y"/>
                                 </constraints>
                                 <prototypes>
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="LoginTextFiledCell" rowHeight="50" id="AzG-Bz-3Gu" customClass="LoginTextFiledCell">
-                                        <rect key="frame" x="0.0" y="50" width="375" height="50"/>
+                                        <rect key="frame" x="0.0" y="50.333333969116211" width="440" height="50"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="AzG-Bz-3Gu" id="DIU-Qe-sGe">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="440" height="50"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" placeholder="place order" textAlignment="natural" minimumFontSize="17" clearButtonMode="whileEditing" translatesAutoresizingMaskIntoConstraints="NO" id="YXP-if-YQ2">
-                                                    <rect key="frame" x="10" y="5" width="355" height="40"/>
+                                                    <rect key="frame" x="10" y="5" width="420" height="40"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <textInputTraits key="textInputTraits"/>
                                                     <connections>
@@ -225,38 +219,33 @@
                                         </connections>
                                     </tableViewCell>
                                     <tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="none" indentationWidth="10" reuseIdentifier="LoginSwitchCell" rowHeight="50" id="LYr-Om-Dpu" customClass="LoginSwitchCell">
-                                        <rect key="frame" x="0.0" y="100" width="375" height="50"/>
+                                        <rect key="frame" x="0.0" y="100.33333396911621" width="440" height="50"/>
                                         <autoresizingMask key="autoresizingMask"/>
                                         <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="LYr-Om-Dpu" id="DQB-yC-XbO">
-                                            <rect key="frame" x="0.0" y="0.0" width="375" height="50"/>
+                                            <rect key="frame" x="0.0" y="0.0" width="440" height="50"/>
                                             <autoresizingMask key="autoresizingMask"/>
                                             <subviews>
                                                 <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="记住我的登录状态" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l0F-dN-mYq">
-                                                    <rect key="frame" x="10" y="5" width="285" height="40"/>
+                                                    <rect key="frame" x="10" y="5" width="350" height="40"/>
                                                     <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                                     <nil key="textColor"/>
                                                     <nil key="highlightedColor"/>
                                                 </label>
-                                                <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ayl-9L-kj9">
-                                                    <rect key="frame" x="315" y="9.5" width="52" height="31"/>
-                                                    <connections>
-                                                        <action selector="switchClick:" destination="LYr-Om-Dpu" eventType="valueChanged" id="AD8-uu-gGL"/>
-                                                    </connections>
+                                                <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Fj5-eS-Jo1">
+                                                    <rect key="frame" x="369" y="11" width="63" height="28"/>
                                                 </switch>
                                             </subviews>
                                             <constraints>
                                                 <constraint firstItem="l0F-dN-mYq" firstAttribute="leading" secondItem="DQB-yC-XbO" secondAttribute="leading" constant="10" id="2Pv-EG-Typ"/>
-                                                <constraint firstItem="Ayl-9L-kj9" firstAttribute="centerY" secondItem="l0F-dN-mYq" secondAttribute="centerY" id="6oC-p4-LHA"/>
+                                                <constraint firstItem="Fj5-eS-Jo1" firstAttribute="centerY" secondItem="l0F-dN-mYq" secondAttribute="centerY" id="4T0-Tr-t6l"/>
                                                 <constraint firstItem="l0F-dN-mYq" firstAttribute="top" secondItem="DQB-yC-XbO" secondAttribute="top" constant="5" id="AS5-qb-qmA"/>
-                                                <constraint firstAttribute="trailing" secondItem="Ayl-9L-kj9" secondAttribute="trailing" constant="10" id="KKL-7Y-rGz"/>
+                                                <constraint firstAttribute="trailing" secondItem="Fj5-eS-Jo1" secondAttribute="trailing" constant="10" id="r7M-vz-vUk"/>
                                                 <constraint firstAttribute="bottom" secondItem="l0F-dN-mYq" secondAttribute="bottom" constant="5" id="sMp-Be-x6B"/>
-                                                <constraint firstItem="Ayl-9L-kj9" firstAttribute="leading" secondItem="l0F-dN-mYq" secondAttribute="trailing" constant="20" id="szM-HB-JH2"/>
                                                 <constraint firstAttribute="trailing" secondItem="l0F-dN-mYq" secondAttribute="trailing" constant="80" id="wBz-OH-Old"/>
                                             </constraints>
                                         </tableViewCellContentView>
                                         <connections>
                                             <outlet property="msgLabel" destination="l0F-dN-mYq" id="0Wu-o2-zG7"/>
-                                            <outlet property="stateSwitch" destination="Ayl-9L-kj9" id="0Af-UQ-jWz"/>
                                         </connections>
                                     </tableViewCell>
                                 </prototypes>
@@ -266,7 +255,7 @@
                                 </connections>
                             </tableView>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Qgm-gt-QHB">
-                                <rect key="frame" x="10" y="627" width="30" height="30"/>
+                                <rect key="frame" x="10" y="848" width="30" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="width" constant="30" id="Zih-se-HAO"/>
                                     <constraint firstAttribute="height" constant="30" id="jjZ-vh-Hjh"/>
@@ -277,7 +266,7 @@
                                 </connections>
                             </button>
                             <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="9eS-az-Avg">
-                                <rect key="frame" x="20" y="420" width="335" height="50"/>
+                                <rect key="frame" x="20" y="524" width="400" height="50"/>
                                 <color key="backgroundColor" systemColor="lightTextColor"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="50" id="q1V-lL-5KU"/>
@@ -290,7 +279,7 @@
                                 </connections>
                             </button>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="v1.0" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="KNq-Qe-MCi">
-                                <rect key="frame" x="337.5" y="637" width="27.5" height="20"/>
+                                <rect key="frame" x="402.66666666666669" y="858" width="27.333333333333314" height="20"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="20" id="pQX-il-KH2"/>
                                 </constraints>
@@ -299,22 +288,23 @@
                                 <nil key="highlightedColor"/>
                             </label>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="Ibb-XF-n7z"/>
                         <color key="backgroundColor" red="0.21907718691379285" green="0.71136361904577949" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
                         <constraints>
-                            <constraint firstItem="Qgm-gt-QHB" firstAttribute="leading" secondItem="eFV-Mf-82R" secondAttribute="leading" constant="10" id="Di9-kk-t7S"/>
-                            <constraint firstAttribute="trailing" secondItem="ZEy-rA-ish" secondAttribute="trailing" id="NTf-3C-4Ro"/>
-                            <constraint firstAttribute="trailing" secondItem="KNq-Qe-MCi" secondAttribute="trailing" constant="10" id="V3y-Nf-hHp"/>
+                            <constraint firstItem="Qgm-gt-QHB" firstAttribute="leading" secondItem="Ibb-XF-n7z" secondAttribute="leading" constant="10" id="Di9-kk-t7S"/>
+                            <constraint firstItem="Ibb-XF-n7z" firstAttribute="trailing" secondItem="ZEy-rA-ish" secondAttribute="trailing" id="NTf-3C-4Ro"/>
+                            <constraint firstItem="Ibb-XF-n7z" firstAttribute="trailing" secondItem="KNq-Qe-MCi" secondAttribute="trailing" constant="10" id="V3y-Nf-hHp"/>
                             <constraint firstItem="9eS-az-Avg" firstAttribute="top" secondItem="ZEy-rA-ish" secondAttribute="bottom" constant="30" id="VHh-eU-GOx"/>
-                            <constraint firstItem="7Tz-Ne-9Q4" firstAttribute="top" secondItem="H4k-R1-29n" secondAttribute="bottom" constant="80" id="aNW-Be-opP"/>
+                            <constraint firstItem="7Tz-Ne-9Q4" firstAttribute="top" secondItem="Ibb-XF-n7z" secondAttribute="top" constant="80" id="aNW-Be-opP"/>
                             <constraint firstItem="KNq-Qe-MCi" firstAttribute="bottom" secondItem="Qgm-gt-QHB" secondAttribute="bottom" id="dFz-ee-Wx1"/>
-                            <constraint firstItem="9eS-az-Avg" firstAttribute="leading" secondItem="eFV-Mf-82R" secondAttribute="leading" constant="20" id="dQN-LQ-RKc"/>
-                            <constraint firstItem="p61-40-fkz" firstAttribute="top" secondItem="Qgm-gt-QHB" secondAttribute="bottom" constant="10" id="dZy-Uz-47Q"/>
+                            <constraint firstItem="9eS-az-Avg" firstAttribute="leading" secondItem="Ibb-XF-n7z" secondAttribute="leading" constant="20" id="dQN-LQ-RKc"/>
+                            <constraint firstItem="Ibb-XF-n7z" firstAttribute="bottom" secondItem="Qgm-gt-QHB" secondAttribute="bottom" constant="10" id="dZy-Uz-47Q"/>
                             <constraint firstItem="ZEy-rA-ish" firstAttribute="top" secondItem="7Tz-Ne-9Q4" secondAttribute="bottom" constant="40" id="dkW-VQ-pSb"/>
-                            <constraint firstAttribute="trailing" secondItem="7Tz-Ne-9Q4" secondAttribute="trailing" id="kYo-Ne-fAZ"/>
-                            <constraint firstItem="7Tz-Ne-9Q4" firstAttribute="leading" secondItem="eFV-Mf-82R" secondAttribute="leading" id="n2h-R0-gci"/>
-                            <constraint firstAttribute="trailing" secondItem="9eS-az-Avg" secondAttribute="trailing" constant="20" id="qS8-xf-h6A"/>
-                            <constraint firstItem="ZEy-rA-ish" firstAttribute="leading" secondItem="eFV-Mf-82R" secondAttribute="leading" id="w9O-y0-08A"/>
-                            <constraint firstItem="ZEy-rA-ish" firstAttribute="centerX" secondItem="eFV-Mf-82R" secondAttribute="centerX" id="zTH-G4-bdZ"/>
+                            <constraint firstItem="Ibb-XF-n7z" firstAttribute="trailing" secondItem="7Tz-Ne-9Q4" secondAttribute="trailing" id="kYo-Ne-fAZ"/>
+                            <constraint firstItem="7Tz-Ne-9Q4" firstAttribute="leading" secondItem="Ibb-XF-n7z" secondAttribute="leading" id="n2h-R0-gci"/>
+                            <constraint firstItem="Ibb-XF-n7z" firstAttribute="trailing" secondItem="9eS-az-Avg" secondAttribute="trailing" constant="20" id="qS8-xf-h6A"/>
+                            <constraint firstItem="ZEy-rA-ish" firstAttribute="leading" secondItem="Ibb-XF-n7z" secondAttribute="leading" id="w9O-y0-08A"/>
+                            <constraint firstItem="ZEy-rA-ish" firstAttribute="centerX" secondItem="Ibb-XF-n7z" secondAttribute="centerX" id="zTH-G4-bdZ"/>
                         </constraints>
                     </view>
                     <connections>
@@ -332,22 +322,18 @@
         <scene sceneID="g1f-oD-LiL">
             <objects>
                 <viewController storyboardIdentifier="LoginSettingViewController" id="r7u-Ls-Lza" customClass="LoginSettingViewController" sceneMemberID="viewController">
-                    <layoutGuides>
-                        <viewControllerLayoutGuide type="top" id="pYb-eQ-flk"/>
-                        <viewControllerLayoutGuide type="bottom" id="dmd-sA-BVL"/>
-                    </layoutGuides>
                     <view key="view" contentMode="scaleToFill" id="mu4-lc-PRk">
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+                        <rect key="frame" x="0.0" y="0.0" width="440" height="956"/>
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                         <subviews>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Name" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="T2p-m2-k3U">
-                                <rect key="frame" x="26" y="30" width="45" height="21"/>
+                                <rect key="frame" x="30" y="134" width="45" height="21"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" placeholder="Name" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="N4g-tS-PSF">
-                                <rect key="frame" x="26" y="61" width="323" height="30"/>
+                                <rect key="frame" x="30" y="165" width="380" height="30"/>
                                 <constraints>
                                     <constraint firstAttribute="height" constant="30" id="m3z-CE-Fja"/>
                                 </constraints>
@@ -358,13 +344,13 @@
                                 </connections>
                             </textField>
                             <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Server" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="l39-8d-pmH">
-                                <rect key="frame" x="26" y="101" width="323" height="20.5"/>
+                                <rect key="frame" x="30" y="205" width="380" height="20.666666666666657"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <nil key="textColor"/>
                                 <nil key="highlightedColor"/>
                             </label>
                             <textField opaque="NO" clipsSubviews="YES" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" borderStyle="roundedRect" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="blU-4o-XVJ">
-                                <rect key="frame" x="26" y="132" width="323" height="34"/>
+                                <rect key="frame" x="30" y="236.33333333333334" width="380" height="34.000000000000028"/>
                                 <fontDescription key="fontDescription" type="system" pointSize="17"/>
                                 <textInputTraits key="textInputTraits"/>
                                 <connections>
@@ -372,11 +358,12 @@
                                 </connections>
                             </textField>
                         </subviews>
+                        <viewLayoutGuide key="safeArea" id="itN-Et-50T"/>
                         <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
                         <constraints>
-                            <constraint firstItem="N4g-tS-PSF" firstAttribute="centerX" secondItem="mu4-lc-PRk" secondAttribute="centerX" id="4kc-tk-11e"/>
+                            <constraint firstItem="N4g-tS-PSF" firstAttribute="centerX" secondItem="itN-Et-50T" secondAttribute="centerX" id="4kc-tk-11e"/>
                             <constraint firstItem="N4g-tS-PSF" firstAttribute="leading" secondItem="mu4-lc-PRk" secondAttribute="leadingMargin" constant="10" id="ES9-Ie-txh"/>
-                            <constraint firstItem="T2p-m2-k3U" firstAttribute="top" secondItem="pYb-eQ-flk" secondAttribute="bottom" constant="10" id="OaF-TU-6MG"/>
+                            <constraint firstItem="T2p-m2-k3U" firstAttribute="top" secondItem="itN-Et-50T" secondAttribute="top" constant="10" id="OaF-TU-6MG"/>
                             <constraint firstItem="blU-4o-XVJ" firstAttribute="leading" secondItem="N4g-tS-PSF" secondAttribute="leading" id="TYO-qT-Lfe"/>
                             <constraint firstItem="blU-4o-XVJ" firstAttribute="top" secondItem="l39-8d-pmH" secondAttribute="bottom" constant="10.5" id="aia-zU-K38"/>
                             <constraint firstItem="T2p-m2-k3U" firstAttribute="leading" secondItem="mu4-lc-PRk" secondAttribute="leadingMargin" constant="10" id="bQX-1H-XT5"/>

+ 20 - 16
RA Image/RA Image/BasicModeViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "BasicModeViewController.h"
-#import "ScannerViewController.h"
+//#import "ScannerViewController.h"
 #import "PhotoListViewController.h"
 #import "UploadViewController.h"
 #import <AVFoundation/AVFoundation.h>
@@ -17,6 +17,7 @@
 #import "RACameraViewController.h"
 #import "RAQRCodeScannerViewController.h"
 #import "UIImage+fixOrientation.h"
+#import "RASingleton.h"
 
 
 #pragma clang diagnostic push 
@@ -41,13 +42,13 @@
     UIBarButtonItem *uploadListItem = [[UIBarButtonItem alloc] initWithTitle:@"Upload List" style:UIBarButtonItemStylePlain target:self action:@selector(showUploadList)];
     self.navigationItem.rightBarButtonItem = uploadListItem;
     
-    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
-    [appdelegate.uploadManager addObserver:self
+    [RASingleton.sharedInstance.uploadManager addObserver:self
                                 forKeyPath:@"queue_status"
                                    options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
                                    context:@"queue_status changed"];
-    if (appdelegate.compressFile) {
+    if (RASingleton.sharedInstance.compressFile) {
         
         
         [RAUtils message_box:@"Attention" message:@"The photos will be compressed" completion:nil];
@@ -80,8 +81,8 @@
 
 -(void) dealloc
 {
-    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    [appdelegate.uploadManager removeObserver:self forKeyPath:@"queue_status"];
+//    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    [RASingleton.sharedInstance.uploadManager removeObserver:self forKeyPath:@"queue_status"];
 }
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@@ -235,8 +236,8 @@
     
     __weak typeof(self) weakself = self;
     RACameraViewController *cameraVC = [RACameraViewController showCameraFromViewController:self withTakeMode:RACameraTakeModeTakeASerial videoGravity:AVLayerVideoGravityResizeAspect completion:^(UIImage *img) {
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        bool bcompress =appDelegate.compressFile;
+//        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+        bool bcompress =RASingleton.sharedInstance.compressFile;
         if (img) {
             dispatch_async(dispatch_get_global_queue(0, 0), ^{
                 UIImage *newImg = [img fixOrientation];
@@ -393,8 +394,8 @@
 }
 
 - (BOOL)shouldUploadWithCurrentNerworkStatus {
-    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    if (appdelegate.uploadManager.onlyWiFi && appdelegate.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
+//    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    if (RASingleton.sharedInstance.uploadManager.onlyWiFi && RASingleton.sharedInstance.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
         return NO;
     }
     return YES;
@@ -403,8 +404,8 @@
 - (NSDictionary *)saveSignature:(UIImage *)img {
     
     if (img) {
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        bool bcompress =appDelegate.compressFile;
+//        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+        bool bcompress =RASingleton.sharedInstance.compressFile;
         NSString *path = [self saveImage:img bcompress:bcompress];
         
         if (path) {// 保存成功
@@ -501,8 +502,8 @@
         preVC.photoHandler = ^(UIImage *img){
             if (img) {
                 
-                AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-                bool bcompress =appDelegate.compressFile;
+//                AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+                bool bcompress =RASingleton.sharedInstance.compressFile;
                 
                 dispatch_async(dispatch_get_global_queue(0, 0), ^{
                     NSString *path = [weakself saveImage:img bcompress:bcompress];
@@ -535,8 +536,8 @@
         
         image = [info objectForKey:UIImagePickerControllerOriginalImage];
         [picker dismissViewControllerAnimated:YES completion:nil];
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        bool bcompress =appDelegate.compressFile;
+//        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+        bool bcompress =RASingleton.sharedInstance.compressFile;
         
         dispatch_async(dispatch_get_global_queue(0, 0), ^{
             NSString *path = [self saveImage:image bcompress:bcompress];
@@ -631,6 +632,7 @@
                         break;
                     }
                     case RESULT_NET_ERROR:
+                    case RESULT_NET_NOTAVAILABLE:
                     {
                         __weak typeof(self) weakSelf = self;
                         UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:@"Warning" message:@"Can not connect to server,still upload?" preferredStyle:UIAlertControllerStyleAlert];
@@ -644,8 +646,10 @@
                         [alertVC addAction:yesAction];
                         [alertVC addAction:noAction];
                         [self presentViewController:alertVC animated:yesAction completion:nil];
+                        break;
                         
                     }
+    
                     default:
                         break;
                 }

+ 19 - 0
RA Image/RA Image/Info.plist

@@ -2,6 +2,25 @@
 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
 <plist version="1.0">
 <dict>
+	<key>UIApplicationSceneManifest</key>
+	<dict>
+		<key>UIApplicationSupportsMultipleScenes</key>
+		<false/>
+		<key>UISceneConfigurations</key>
+		<dict>
+			<key>UIWindowSceneSessionRoleApplication</key>
+			<array>
+				<dict>
+					<key>UISceneConfigurationName</key>
+					<string>Default Configuration</string>
+					<key>UISceneDelegateClassName</key>
+					<string>SceneDelegate</string>
+					<key>UISceneStoryboardFile</key>
+					<string>RAImage</string>
+				</dict>
+			</array>
+		</dict>
+	</dict>
 	<key>CFBundleDevelopmentRegion</key>
 	<string>en</string>
 	<key>CFBundleExecutable</key>

+ 1 - 1
RA Image/RA Image/LoginSettingViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "LoginSettingViewController.h"
-#import "ScannerViewController.h"
+//#import "ScannerViewController.h"
 #import "RAQRCodeScannerViewController.h"
 
 

+ 18 - 9
RA Image/RA Image/LoginViewController.m

@@ -10,6 +10,8 @@
 #import "LoginTextFiledCell.h"
 #import "LoginSwitchCell.h"
 #import "LoginSettingViewController.h"
+#import "RASingleton.h"
+#import "SceneDelegate.h"
 
 static NSString *kRememberLogin = @"RememberLogin";
 static NSString *kLoginUserInfo = @"UserInfo";
@@ -212,8 +214,8 @@ static NSString *kLoginUserInfo = @"UserInfo";
         [RAUtils message_box:@"Warning" message:@"Password cannot be blank" completion:nil];
         return;
     }
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    appDelegate.address = self.address;
+//
+    RASingleton.sharedInstance.address = self.address;
 //    __weak typeof(self) weakself = self;
     
 //    UIAlertView *alert = [RAUtils waiting_alert:@"Please wait" title:@"Login"];
@@ -234,13 +236,20 @@ static NSString *kLoginUserInfo = @"UserInfo";
                                    } else {
                                        [self setUserDefaultsValue:@{@"address" : self.address,@"user" : self.user,@"pwd" : self.pwd} forKey:kLoginUserInfo];
                                    }
-                                   appDelegate.bLogin = YES;
-                                   appDelegate.user = self.user;
-                                   appDelegate.password = self.pwd;
-                                   appDelegate.companyName = [result objectForKey:@"company_name"];
-                                   [appDelegate loadCompanyIcon:[result objectForKey:@"company_icon"]];
-                                   appDelegate.modeList = [result objectForKey:@"modellist"];
-                                   [appDelegate showNormalRootVC];
+                                   RASingleton.sharedInstance.bLogin = YES;
+                                   RASingleton.sharedInstance.user = self.user;
+                                   RASingleton.sharedInstance.password = self.pwd;
+                                   RASingleton.sharedInstance.companyName = [result objectForKey:@"company_name"];
+                                   [RASingleton.sharedInstance loadCompanyIcon:[result objectForKey:@"company_icon"]];
+                                   RASingleton.sharedInstance.modeList = [result objectForKey:@"modellist"];
+                                   
+                                   
+                                   SceneDelegate * sd=(SceneDelegate*)self.view.window.windowScene.delegate;
+                                   [sd  showNormalRootVC];
+                          
+//                                   UIApplication.sharedApplication.connectedScenes[0];
+//                                   AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//                                   [appDelegate showNormalRootVC];
                                } else {
                                    NSString *msg = [result objectForKey:@"err_msg"];
                                    

+ 9 - 8
RA Image/RA Image/ModelModeViewController.m

@@ -13,6 +13,7 @@
 #import "ManufacturerListController.h"
 #import "UploadViewController.h"
 #import "AESCrypt.h"
+#import "RASingleton.h"
 
 
 @interface ModelModeViewController ()<UITextViewDelegate>
@@ -117,10 +118,10 @@
     }
 
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
-    NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+    NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
     
     NSMutableDictionary* params = [@{
                                      @"user" : encryptu,
@@ -154,7 +155,7 @@
         [self.view makeToast:@"Current network is not WiFi,you can upload it manually when wifi connected." duration:3.0 position:CSToastPositionCenter];
     }
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
     NSString *manufacturer = self.manufacturer;
 
@@ -174,11 +175,11 @@
         task[@"path"]=self.name;
         task[@"file"]=photo[@"file"];
         
-        task[@"url"]=Appdelegate.address;
+        task[@"url"]=RASingleton.sharedInstance.address;
         NSString *md5 = [photo objectForKey:@"md5"];
         
-        NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-        NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+        NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+        NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
         NSMutableDictionary* params = [@{
                                          @"user" : encryptu,
                                          @"password" : encryptp,
@@ -208,7 +209,7 @@
     
     
     //    // add upload tasks;
-    [Appdelegate.uploadManager addTasks:tasks];
+    [RASingleton.sharedInstance.uploadManager addTasks:tasks];
     
     [self clear];
 }

+ 13 - 12
RA Image/RA Image/PODModeViewController.m

@@ -11,6 +11,7 @@
 #import "AESCrypt.h"
 #import "config.h"
 #import "SignatureViewController.h"
+#import "RASingleton.h"
 
 @interface PODModeViewController ()
 
@@ -77,17 +78,17 @@
     
     if (photo) {
         
-        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
         NSMutableDictionary* task=[[NSMutableDictionary alloc]init];
         
         task[@"path"]=self.name;
         task[@"file"]=photo[@"file"];
         
-        task[@"url"]=Appdelegate.address;
+        task[@"url"]=RASingleton.sharedInstance.address;
         NSString *md5 = [photo objectForKey:@"md5"];
         
-        NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-        NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+        NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+        NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
         NSDictionary* params = @{
                                  @"user" : encryptu,
                                  @"password" : encryptp,
@@ -150,9 +151,9 @@
     
     
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
     NSMutableDictionary* params = [@{
                                      @"user" : encryptu,
                                      @"password" : encryptp,
@@ -172,7 +173,7 @@
 -(void)addTasks
 {
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
     if (![self shouldUploadWithCurrentNerworkStatus]) {
         [self.view makeToast:@"Current network is not WiFi,you can upload it manually when wifi connected." duration:3.0 position:CSToastPositionCenter];
@@ -190,13 +191,13 @@
         task[@"path"]=self.name;
         task[@"file"]=photo[@"file"];
         
-        task[@"url"]=Appdelegate.address;
+        task[@"url"]=RASingleton.sharedInstance.address;
         NSString *md5 = [photo objectForKey:@"md5"];
         
         
         
-        NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-        NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+        NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+        NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
         NSDictionary* params = @{
                                  @"user" : encryptu,
                                  @"password" : encryptp,
@@ -224,7 +225,7 @@
     }
     
     //    // add upload tasks;
-    [Appdelegate.uploadManager addTasks:tasks];
+    [RASingleton.sharedInstance.uploadManager addTasks:tasks];
     
     [self clear];
 }

+ 10 - 8
RA Image/RA Image/PopModeViewController.m

@@ -11,6 +11,7 @@
 #import "PopModeViewController.h"
 #import "UploadViewController.h"
 #import "AESCrypt.h"
+#import "RASingleton.h"
 
 
 @interface PopModeViewController ()
@@ -89,9 +90,9 @@
 
     
     
-        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+//        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
     NSMutableDictionary* params = [@{
                              @"user" : encryptu,
                              @"password" : encryptp,
@@ -111,7 +112,7 @@
 -(void)addTasks
 {
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    
     
     if (![self shouldUploadWithCurrentNerworkStatus]) {
         [self.view makeToast:@"Current network is not WiFi,you can upload it manually when wifi connected." duration:3.0 position:CSToastPositionCenter];
@@ -129,13 +130,13 @@
         task[@"path"]=self.name;
         task[@"file"]=photo[@"file"];
         
-        task[@"url"]=Appdelegate.address;
+        task[@"url"]=RASingleton.sharedInstance.address;
         NSString *md5 = [photo objectForKey:@"md5"];
         
         
         
-        NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-        NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+        NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+        NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
         NSDictionary* params = @{
                                  @"user" : encryptu,
                                  @"password" : encryptp,
@@ -158,7 +159,8 @@
     
     
     //    // add upload tasks;
-    [Appdelegate.uploadManager addTasks:tasks];
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    [RASingleton.sharedInstance.uploadManager addTasks:tasks];
     
     [self clear];
 }

+ 16 - 15
RA Image/RA Image/RANetwork.m

@@ -11,20 +11,21 @@
 #import "AESCrypt.h"
 #import "RAUtils.h"
 #import "RAConvertor.h"
+#import "RASingleton.h"
 
 @implementation RANetwork
 
 +(NSMutableDictionary*) prepare_addtional_params:(NSMutableDictionary* ) params
 {
-    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    if(appDelegate.user!=nil)
-        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user key:@"usai"] forKey:@"user"];
-    if(appDelegate.password!=nil)
-        [params setValue:[AESCrypt AES128Encrypt:appDelegate.password key:@"usai"] forKey:@"password"];
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(RASingleton.sharedInstance.user!=nil)
+        [params setValue:[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"] forKey:@"user"];
+    if(RASingleton.sharedInstance.password!=nil)
+        [params setValue:[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"] forKey:@"password"];
     
     
     
-    [params setValue:appDelegate.build forKey:@"app_ver"];
+    [params setValue:RASingleton.sharedInstance.build forKey:@"app_ver"];
     
     NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
     NSString* short_version =[infoDict objectForKey:@"CFBundleShortVersionString"];
@@ -185,10 +186,10 @@
                                     @"_action":@"handset_new",
                                     @"_operate":@"handset_login"
                                     }.mutableCopy;
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
-    [self request_interface:appDelegate.address parameters:params err_record_url:nil completionHandler:result retry:0];
-//    
+    [self request_interface:RASingleton.sharedInstance.address parameters:params err_record_url:nil completionHandler:result retry:0];
+//
 //    NSData *data = [self get_json:appDelegate.address parameters:params file:nil];
 //    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
 //    return resultDic;
@@ -206,9 +207,9 @@
     
 
    // params[@"_operate"]=@"valid_upload";
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     
-    [self request_interface:appDelegate.address parameters:params err_record_url:nil completionHandler:result retry:0];
+    [self request_interface:RASingleton.sharedInstance.address parameters:params err_record_url:nil completionHandler:result retry:0];
     
 //    NSData *data = [self get_json:appDelegate.address parameters:params file:nil];
 //    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];
@@ -217,10 +218,10 @@
 + (void)request_modelmanufacture:(NSString *)model completionHandler:(resultHandler)result
 {
     
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
 
-    NSString* encryptu=[AESCrypt AES128Encrypt:appDelegate.user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:appDelegate.password key:@"usai"];
+    NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
     NSMutableDictionary *params = @{
                                     @"user":encryptu,
                                     @"password":encryptp,
@@ -229,7 +230,7 @@
                                     @"barcode":model
                                     }.mutableCopy;
     
-    [self request_interface:appDelegate.address parameters:params err_record_url:nil completionHandler:result retry:0];
+    [self request_interface:RASingleton.sharedInstance.address parameters:params err_record_url:nil completionHandler:result retry:0];
     
 //    NSData *data = [self get_json:appDelegate.address parameters:params file:nil];
 //    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];

+ 33 - 0
RA Image/RA Image/RASingleton.h

@@ -0,0 +1,33 @@
+//
+//  Singleton.h
+//  iSales-NPD
+//
+//  Created by Jack on 2016/10/12.
+//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <sqlite3.h>
+#import "RAUploadManager.h"
+#import <UIKit/UIKit.h>
+
+@interface RASingleton : NSObject
+
+@property (strong,nonatomic) NSString* user;
+@property (strong,nonatomic) NSString * password;
+@property (strong,nonatomic) NSString* build;
+@property (strong,nonatomic) NSString* shortver;
+@property bool bLogin;
+@property (nonatomic,copy) NSString *address;
+@property (nonatomic,copy) NSString *companyName;
+@property (nonatomic,copy) UIImage *companyIcon;
+@property (nonatomic,strong) NSArray *modeList;
+@property (nonatomic,assign) BOOL shouldAutoShowModeVC;
+@property (assign) bool bEnable_Cache;
+@property (nonatomic,assign) BOOL compressFile;
+@property (strong, nonatomic)  RAUploadManager *uploadManager;
++ (instancetype)sharedInstance;
+- (void)loadCompanyIcon:(NSString *)url;
+- (void)logout;
+
+@end

+ 187 - 0
RA Image/RA Image/RASingleton.m

@@ -0,0 +1,187 @@
+//
+//  Singleton.m
+//  iSales-NPD
+//
+//  Created by Jack on 2016/10/12.
+//  Copyright © 2016年 United Software Applications, Inc. All rights reserved.
+//
+
+#import "RASingleton.h"
+//#import "AppDelegate.h"
+#import "RAUtils.h"
+#import "BasicViewController.h"
+
+@interface RASingleton ()
+
+@property (nonatomic,strong) NSMutableDictionary *globalParameters;
+
+
+@end
+
+@implementation RASingleton
+#pragma mark - Global Parameter
+//
+//- (NSMutableDictionary *)globalParameters {
+//    if (!_globalParameters) {
+//        _globalParameters = [NSMutableDictionary dictionary];
+//    }
+//    return _globalParameters;
+//}
+//
+//
+//- (void)setGlobalParameter:(id)param forKey:(NSString *)key {
+//    if (param == nil || key == nil) {
+//        return;
+//    }
+//    [self.globalParameters setObject:param forKey:key];
+//}
+//- (id)globalParameterForKey:(NSString *)key {
+//    if (key == nil) {
+//        return nil;
+//    }
+//    return [self.globalParameters objectForKey:key];
+//}
+//- (void)setUser:(NSString *)user {
+//    _user = user;
+//    
+//    [self setGlobalParameter:_user forKey:@"user"];
+//}
+//- (void)setPassword:(NSString *)password {
+//    _password = password;
+//    [self setGlobalParameter:_password forKey:@"password"];
+//}
+
+- (void)dealloc {
+//    [[NSNotificationCenter defaultCenter] removeObserver:self];
+    
+//    [self removeObserver:self forKeyPath:@"stack_contents"];
+}
+//- (instancetype)init {
+//    if (self = [super init]) {
+//        
+//        [self addObserver:self forKeyPath:@"scan_cart"
+//                                       options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
+//                                       context:@"content changed"];
+//      
+//    }
+//    return self;
+//}
+
++ (instancetype)sharedInstance {
+    
+    static RASingleton *singleton = nil;
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        
+        singleton = [[RASingleton alloc] init];
+//        [[NSNotificationCenter defaultCenter] addObserver:singleton selector:@selector(handleLogin:) name:User_LoginOK_Notification object:nil];
+        
+
+        
+//        self addObserver:self forKeyPath:self.scan_cart options:<#(NSKeyValueObservingOptions)#> context:<#(nullable void *)#>
+    });
+    return singleton;
+}
+
+- (NSString *)address {
+    if (_address) {
+        return [_address stringByAppendingString:@"/index.php?_action=handset_new"];
+    }
+    return nil;
+}
+
+//- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
+//{
+//    if(self.enable_OfflineOrder)
+//    {
+//    if([keyPath isEqualToString:@"scan_cart"])
+//    {
+//        NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+//        NSString *documents = [paths objectAtIndex:0];
+//        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//            
+//            
+//        NSString *orderdir = [documents stringByAppendingPathComponent:appDelegate.order_code];
+//        
+//        NSString *cartpath = [orderdir stringByAppendingPathComponent:@"cart.json"];
+//        
+//        
+//        
+//        [RAUtils dicttofile:cartpath dict:self.scan_cart];
+//        
+//        
+//        self.scan_cart addObserver:<#(nonnull NSObject *)#> forKeyPath:<#(nonnull NSString *)#> options:<#(NSKeyValueObservingOptions)#> context:<#(nullable void *)#>
+//        
+//    }
+//    }
+//
+//}
+//
+//- (void)setGlobal_lock:(BOOL)global_lock {
+//    _global_lock = global_lock;
+//    if (global_lock) {
+//        [[NSNotificationCenter defaultCenter] postNotificationName:Lock_Permission_Notification object:nil];
+//    } else {
+//        [[NSNotificationCenter defaultCenter] postNotificationName:unLock_Permission_Notification object:nil];
+//    }
+//}
+//
+//- (void)resetGlobalLock {
+//    _global_lock = NO;
+//}
+//
+//- (void)handleLogin:(NSNotification *)notification {
+//    self.currentOrderIsMerged = NO;
+//}
+//
+//- (NSString *)homeClickedItemName {
+//    if (!_homeClickedItemName) {
+//        _homeClickedItemName = @"";
+//    }
+//    return _homeClickedItemName;
+//}
+//
+//- (NSString *)deliveryString {
+//    if (!_deliveryString) {
+//        _deliveryString = @"";
+//    }
+//    return _deliveryString;
+//}
+- (void)loadCompanyIcon:(NSString *)url {
+    if (!url.length) return;
+    NSString *name = [url lastPathComponent];
+    NSFileManager *manager = [NSFileManager defaultManager];
+    NSString *path = [[RAUtils appCacheDirectory] stringByAppendingPathComponent:name];
+    if ([manager fileExistsAtPath:path]) {
+        self.companyIcon = [UIImage imageWithContentsOfFile:path];
+    } else {
+        __weak typeof(self) weakself = self;
+        dispatch_async(dispatch_get_global_queue(0, 0), ^{
+            UIImage *img = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:url]]];
+            if (RASingleton.sharedInstance.bLogin) {
+                if (img) {
+                    weakself.companyIcon = img;
+                    [RAUtils saveData:UIImagePNGRepresentation(img) toPath:path];
+                } else {
+                    weakself.companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
+                }
+            }
+        });
+    }
+    
+}
+
+
+- (void)logout {
+    RASingleton.sharedInstance.user = nil;
+    RASingleton.sharedInstance.password = nil;
+    RASingleton.sharedInstance.address = nil;
+    RASingleton.sharedInstance.bLogin = false;
+    RASingleton.sharedInstance.companyName = nil;
+    RASingleton.sharedInstance.companyIcon = nil;
+    RASingleton.sharedInstance.modeList = nil;
+    [[NSNotificationCenter defaultCenter] postNotificationName:LogoutNotification object:nil];
+    
+
+}
+@end

+ 11 - 8
RA Image/RA Image/ReceivingPalletIDViewController.m

@@ -10,6 +10,7 @@
 #import "UploadViewController.h"
 #import "AESCrypt.h"
 #import "JLKeyboardListener.h"
+#import "RASingleton.h"
 
 @interface ReceivingPalletIDViewController ()<UITextViewDelegate>
 @property (strong, nonatomic) IBOutlet UITextView *noteTextView;
@@ -91,9 +92,9 @@
 
     
     
-        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-    NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+//        AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+    NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
     NSMutableDictionary* params = [@{
                              @"user" : encryptu,
                              @"password" : encryptp,
@@ -119,7 +120,7 @@
 -(void)addTasks
 {
     
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//
     
     if (![self shouldUploadWithCurrentNerworkStatus]) {
         [self.view makeToast:@"Current network is not WiFi,you can upload it manually when wifi connected." duration:3.0 position:CSToastPositionCenter];
@@ -137,13 +138,13 @@
         task[@"path"]=self.name;
         task[@"file"]=photo[@"file"];
         
-        task[@"url"]=Appdelegate.address;
+        task[@"url"]=RASingleton.sharedInstance.address;
         NSString *md5 = [photo objectForKey:@"md5"];
         
         
         
-        NSString* encryptu=[AESCrypt AES128Encrypt:Appdelegate.user key:@"usai"];
-        NSString* encryptp=[AESCrypt AES128Encrypt:Appdelegate.password key:@"usai"];
+        NSString* encryptu=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.user key:@"usai"];
+        NSString* encryptp=[AESCrypt AES128Encrypt:RASingleton.sharedInstance.password key:@"usai"];
         NSMutableDictionary* params = [@{
                                  @"user" : encryptu,
                                  @"password" : encryptp,
@@ -173,7 +174,9 @@
     
     
     //    // add upload tasks;
-    [Appdelegate.uploadManager addTasks:tasks];
+    
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    [RASingleton.sharedInstance.uploadManager addTasks:tasks];
     
     [self clear];
 }

+ 25 - 14
RA Image/RA Image/RootViewController.m

@@ -14,6 +14,8 @@
 #import "UploadSettingController.h"
 #import "PODModeViewController.h"
 #import "ReceivingPalletIDViewController.h"
+#import "RASingleton.h"
+#import "SceneDelegate.h"
 
 static NSString *kLastMode = @"lastChooseMode";
 
@@ -56,22 +58,22 @@ static NSString *kLastMode = @"lastChooseMode";
     [super viewWillAppear:animated];
     
     [self.modeTable reloadData];
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    self.companyNameLabel.text = appDelegate.companyName;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    self.companyNameLabel.text = RASingleton.sharedInstance.companyName;
 }
 
 - (void)viewDidAppear:(BOOL)animated {
     [super viewDidAppear:animated];
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
     NSString *lastChoosedMode = [self userDefaultsValue:kLastMode];
     NSArray *savedArr = [lastChoosedMode componentsSeparatedByString:@"<&&>"];
     NSString *lastLoginName = [savedArr firstObject];
-    if (![lastLoginName isEqualToString:appDelegate.user]) { // 登录用户与上一次使用过模式的用户相同才进入上一次模式。
-        appDelegate.shouldAutoShowModeVC = NO;
+    if (![lastLoginName isEqualToString:RASingleton.sharedInstance.user]) { // 登录用户与上一次使用过模式的用户相同才进入上一次模式。
+        RASingleton.sharedInstance.shouldAutoShowModeVC = NO;
         return;
     }
-    if (appDelegate.shouldAutoShowModeVC) {
-        appDelegate.shouldAutoShowModeVC = NO;
+    if (RASingleton.sharedInstance.shouldAutoShowModeVC) {
+        RASingleton.sharedInstance.shouldAutoShowModeVC = NO;
         if (self.lastChoosedIndex > -1) {
             //            RootModeCell *cell = [self.modeTable cellForRowAtIndexPath:[NSIndexPath indexPathForRow:self.lastChoosedIndex inSection:0]];
             //            [self pushCurrentModeController:cell];
@@ -94,8 +96,8 @@ static NSString *kLastMode = @"lastChooseMode";
 }
 
 - (NSArray *)modeList {
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-    return appDelegate.modeList;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+    return RASingleton.sharedInstance.modeList;
 }
 
 #pragma mark - DataSource
@@ -144,9 +146,9 @@ static NSString *kLastMode = @"lastChooseMode";
     BOOL enable = [[mode objectForKey:@"enable"] boolValue];
     if (enable) {
         NSString *name = cell.mode;
-        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
-        appDelegate.shouldAutoShowModeVC = NO;
-        [self setUserDefaultsValue:[NSString stringWithFormat:@"%@<&&>%@",appDelegate.user,name] forKey:kLastMode];
+//        AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+        RASingleton.sharedInstance.shouldAutoShowModeVC = NO;
+        [self setUserDefaultsValue:[NSString stringWithFormat:@"%@<&&>%@",RASingleton.sharedInstance.user,name] forKey:kLastMode];
         [self pushCurrentModeController:cell];
     }
 }
@@ -230,10 +232,19 @@ static NSString *kLastMode = @"lastChooseMode";
 //                [alertcontroller dismissViewControllerAnimated:true completion:^{
                 
                 [pop hide];
-                    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+       //             AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;//
                     if (result == RESULT_TRUE) {
                         weakself.companyIcon = [UIImage imageNamed:@"AppIcon40x40"];
-                        [appDelegate logout];
+                        
+                        
+//                        SceneDelegate* sd=UIApplication.sharedApplication.delegate;
+                        [RASingleton.sharedInstance logout];
+
+//                        [appDelegate showLoginVC];
+                        
+                        SceneDelegate * sd=(SceneDelegate*)self.view.window.windowScene.delegate;
+                        [sd  showLoginVC];
+                        
                     } else {
                         
                         NSString *msg = [logoutDic objectForKey:@"err_msg"];

+ 17 - 0
RA Image/RA Image/SceneDelegate.h

@@ -0,0 +1,17 @@
+//
+//  SceneDelegate.h
+//  RA Image
+//
+//  Created by Rui Zhang on 9/23/25.
+//
+
+#import <UIKit/UIKit.h>
+
+#import "RASingleton.h"
+@interface SceneDelegate : UIResponder <UIWindowSceneDelegate>
+
+@property (strong, nonatomic) UIWindow * window;
+- (void)showNormalRootVC;
+- (void)showLoginVC;
+@end
+

+ 99 - 0
RA Image/RA Image/SceneDelegate.m

@@ -0,0 +1,99 @@
+//
+//  SceneDelegate.m
+//  RA Image
+//
+//  Created by Rui Zhang on 9/23/25.
+//
+
+#import "SceneDelegate.h"
+#import "LoginViewController.h"
+
+@interface SceneDelegate ()
+@property (nonatomic,strong) UIViewController *rootVC;
+@end
+
+@implementation SceneDelegate
+
+
+- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
+    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
+    // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
+    // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
+}
+
+
+- (void)sceneDidDisconnect:(UIScene *)scene {
+    // Called as the scene is being released by the system.
+    // This occurs shortly after the scene enters the background, or when its session is discarded.
+    // Release any resources associated with this scene that can be re-created the next time the scene connects.
+    // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
+}
+
+
+- (void)sceneDidBecomeActive:(UIScene *)scene {
+    
+    
+
+    
+    
+    if (!RASingleton.sharedInstance.bLogin) {
+        
+        [self showLoginVC];
+    }
+    
+    [RAUploadManager configureUploadManager:^(RAUPloadManagerConfigure *configure) {
+       
+        configure.autoRemoveFinish = YES;
+    }];
+    
+    if (!RASingleton.sharedInstance.uploadManager) {
+        RASingleton.sharedInstance.uploadManager=[RAUploadManager sharedManager];
+    }
+    
+    
+    
+    
+    // Called when the scene has moved from an inactive state to an active state.
+    // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+}
+
+
+- (void)sceneWillResignActive:(UIScene *)scene {
+    // Called when the scene will move from an active state to an inactive state.
+    // This may occur due to temporary interruptions (ex. an incoming phone call).
+}
+
+
+- (void)sceneWillEnterForeground:(UIScene *)scene {
+    if(self.rootVC==nil)
+        self.rootVC = self.window.rootViewController;
+    // Called as the scene transitions from the background to the foreground.
+    // Use this method to undo the changes made on entering the background.
+}
+
+
+- (void)sceneDidEnterBackground:(UIScene *)scene {
+    [self.rootVC.view endEditing:YES];
+    // Called as the scene transitions from the foreground to the background.
+    // Use this method to save data, release shared resources, and store enough scene-specific state information
+    // to restore the scene back to its current state.
+}
+
+- (void)showLoginVC {
+    if (![self.window.rootViewController isKindOfClass:[LoginViewController class]]) {
+        LoginViewController *loginVC = [[UIStoryboard storyboardWithName:@"RAImage" bundle:nil] instantiateViewControllerWithIdentifier:@"LoginViewController"];
+        
+        [self.window setRootViewController:loginVC];
+        RASingleton.sharedInstance.shouldAutoShowModeVC = YES;
+    }
+}
+
+- (void)showNormalRootVC {
+    self.window.rootViewController = self.rootVC;
+//    NSMutableArray *arr = [self cachedUploadTasks];
+//    if (arr && arr.count) {
+//        [self.uploadManager addTasks:arr];
+//    }
+}
+
+@end

+ 3 - 2
RA Image/RA Image/UploadSettingController.m

@@ -8,6 +8,7 @@
 
 #import "UploadSettingController.h"
 #import "RAUploadManager.h"
+#import "RASingleton.h"
 
 @interface UploadSettingController ()<UITextFieldDelegate>
 
@@ -122,12 +123,12 @@
         configure.retryTimeIntetval = retryTimeInterval;
     }];
     
-    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
+//    AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
 //    appDelegate.uploadManager.maxRetry = retryCount;
 //    appDelegate.uploadManager.autoStart = autoUpload;
 //    appDelegate.uploadManager.removeFinish = autoRmFinish;
 //    appDelegate.uploadManager.removeError = autoRmErr;
-    appDelegate.compressFile = compress;
+    RASingleton.sharedInstance.compressFile = compress;
 //    appDelegate.uploadManager.onlyWiFi = onlyWiFi;
 //    appDelegate.uploadManager.retryTimeInterval = retryTimeInterval;
     

+ 130 - 57
RA Image/RA Image/UploadViewController.m

@@ -9,6 +9,7 @@
 #import "UploadViewController.h"
 #import "UploadCell.h"
 #import "UIView+Toast.h"
+#import "RASingleton.h"
 
 @interface UploadViewController ()<UITableViewDelegate,UITableViewDataSource>
 
@@ -24,10 +25,10 @@
     // Do any additional setup after loading the view.
     [self.view insertSubview:[UIView new] atIndex:0];
     
-    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
     
-    [appdelegate.uploadManager addObserver:self
+    [RASingleton.sharedInstance.uploadManager addObserver:self
                                 forKeyPath:@"arr_queue"
                                    options:(NSKeyValueObservingOptionNew|NSKeyValueObservingOptionOld)
                                    context:@"arr_queue changed"];
@@ -42,8 +43,8 @@
 }
 - (void)clearList {
     
-    AppDelegate* appdelegate = (AppDelegate* )[UIApplication sharedApplication].delegate;
-    if(appdelegate.uploadManager.arr_queue.count==0)
+//    AppDelegate* appdelegate = (AppDelegate* )[UIApplication sharedApplication].delegate;
+    if(RASingleton.sharedInstance.uploadManager.arr_queue.count==0)
     {
 
         
@@ -58,12 +59,12 @@
     UIAlertAction *OK = [UIAlertAction actionWithTitle:@"YES" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
         
         NSMutableArray* arr_tasks =[NSMutableArray new];
-        for(NSMutableDictionary* task in appdelegate.uploadManager.arr_queue)
+        for(NSMutableDictionary* task in RASingleton.sharedInstance.uploadManager.arr_queue)
         {
             if([task[@"status"] intValue]==TaskStatusFinish||[task[@"status"] intValue]==TaskStatusError)
                 [arr_tasks addObject:task];
         }
-        [appdelegate.uploadManager removeTasks:arr_tasks];
+        [RASingleton.sharedInstance.uploadManager removeTasks:arr_tasks];
         
     }];
     
@@ -80,8 +81,8 @@
 -(void) dealloc
 {
     [ [ UIApplication sharedApplication] setIdleTimerDisabled:NO ] ;
-    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    [appdelegate.uploadManager removeObserver:self forKeyPath:@"arr_queue"];
+//    AppDelegate* appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    [RASingleton.sharedInstance.uploadManager removeObserver:self forKeyPath:@"arr_queue"];
 }
 
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
@@ -113,13 +114,16 @@
 #pragma mark - TableView DataSource
 
 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-    return Appdelegate.uploadManager.arr_queue.count;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+    
+//    return Appdelegate.uploadManager.arr_queue.count;
+    
+    return RASingleton.sharedInstance.uploadManager.arr_queue.count;
 }
 
 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     
 
     
@@ -129,8 +133,8 @@
         UploadCell * cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
         
         
-        NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
-//        
+        NSDictionary * item_json = RASingleton.sharedInstance.uploadManager.arr_queue[indexPath.row];
+//
 //        if (cell.operation) {
 //            cell.operation.updateUI = nil;
 //        }
@@ -220,78 +224,147 @@
 }
 
 #pragma mark - TableView Delegate
+//
+//- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+//{
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//               NSMutableDictionary * task = Appdelegate.uploadManager.arr_queue[indexPath.row];
+//    
+//    
+//    __weak typeof(self) weakself = self;
+//    UITableViewRowAction *startAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Restart"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        
+//        if (Appdelegate.uploadManager.onlyWiFi && Appdelegate.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
+//            [weakself.view makeToast:@"Current Network is not WiFi" duration:3.0 position:CSToastPositionCenter];
+//            [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+//            return ;
+//        }
+//        DebugLog(@"Start click");
+//        task[@"retry"]=[NSNumber numberWithInt:0];
+//        [Appdelegate.uploadManager startTask:task];
+//        
+//        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+//        
+//        
+//     
+//        
+//    }];
+//    
+//    
+//    startAction.backgroundColor = UIColorFromRGB(0xff9933);
+//    
+//    
+//    UITableViewRowAction *removeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Remove" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+//        
+//        
+//        [Appdelegate.uploadManager removeTask:task];
+//        
+//      //  [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+//        
+//    }];
+//    
+//    removeAction.backgroundColor = UIColorFromRGB(0x9BBF5A);
+//    
+//    
+//  
+//    
+//  //   UIColorFromRGB(0x336699);
+//    
+//    
+//    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    
+//    switch ([task[@"status"] intValue]) {
+//
+//        case TaskStatusFinish:
+//            return @[removeAction];
+//        
+//        case TaskStatusError:
+//            
+//            return @[startAction,removeAction];
+//            
+//            case TaskStatusStop:
+//            return @[startAction];
+//        default:
+//            return nil;
+//            break;
+//    }
+//    
+//    
+//    
+//}
 
-- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
+
+- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath
 {
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-               NSMutableDictionary * task = Appdelegate.uploadManager.arr_queue[indexPath.row];
-    
+//    AppDelegate* Appdelegate = (AppDelegate*)[UIApplication sharedApplication].delegate;
+    NSMutableDictionary *task = RASingleton.sharedInstance.uploadManager.arr_queue[indexPath.row];
     
     __weak typeof(self) weakself = self;
-    UITableViewRowAction *startAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Restart"handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
+    
+    // Restart Action
+    UIContextualAction *startAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal
+                                                                              title:@"Restart"
+                                                                            handler:^(UIContextualAction *action, __kindof UIView *sourceView, void (^completionHandler)(BOOL)) {
         
-        if (Appdelegate.uploadManager.onlyWiFi && Appdelegate.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
+        if (RASingleton.sharedInstance.uploadManager.onlyWiFi && RASingleton.sharedInstance.uploadManager.reach.currentReachabilityStatus != ReachableViaWiFi) {
             [weakself.view makeToast:@"Current Network is not WiFi" duration:3.0 position:CSToastPositionCenter];
-            [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
-            return ;
+            completionHandler(NO);
+            return;
         }
-        DebugLog(@"Start click");
-        task[@"retry"]=[NSNumber numberWithInt:0];
-        [Appdelegate.uploadManager startTask:task];
         
-        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
-        
-        
-     
+        DebugLog(@"Start click");
+        task[@"retry"] = [NSNumber numberWithInt:0];
+        [RASingleton.sharedInstance.uploadManager startTask:task];
         
+        [tableView reloadRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationMiddle];
+        completionHandler(YES);
     }];
     
-    
     startAction.backgroundColor = UIColorFromRGB(0xff9933);
     
-    
-    UITableViewRowAction *removeAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Remove" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath) {
-        
-        
-        [Appdelegate.uploadManager removeTask:task];
-        
-      //  [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];
+    // Remove Action
+    UIContextualAction *removeAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
+                                                                               title:@"Remove"
+                                                                             handler:^(UIContextualAction *action, __kindof UIView *sourceView, void (^completionHandler)(BOOL)) {
         
+        [RASingleton.sharedInstance.uploadManager removeTask:task];
+        // 如果需要删除行,使用:
+        // [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationMiddle];
+        completionHandler(YES);
     }];
     
     removeAction.backgroundColor = UIColorFromRGB(0x9BBF5A);
     
-    
-  
-    
-  //   UIColorFromRGB(0x336699);
-    
-    
-    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-    
+    // 根据任务状态返回不同的操作
+    NSArray *actions;
     switch ([task[@"status"] intValue]) {
-
         case TaskStatusFinish:
-            return @[removeAction];
-        
+            actions = @[removeAction];
+            break;
+            
         case TaskStatusError:
+            actions = @[removeAction, startAction];
+            break;
             
-            return @[startAction,removeAction];
+        case TaskStatusStop:
+            actions = @[startAction];
+            break;
             
-            case TaskStatusStop:
-            return @[startAction];
         default:
-            return nil;
+            actions = @[];
             break;
     }
     
+    UISwipeActionsConfiguration *configuration = [UISwipeActionsConfiguration configurationWithActions:actions];
+    configuration.performsFirstActionWithFullSwipe = NO; // 可选:禁用完全滑动自动执行第一个操作
     
-    
+    return configuration;
 }
 
+
 - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
-           NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+           NSDictionary * item_json = RASingleton.sharedInstance.uploadManager.arr_queue[indexPath.row];
     
     bool ret=false;
     switch ([item_json[@"status"] intValue]) {
@@ -334,11 +407,11 @@
 //    if (upCell.operation) {
 //        upCell.operation.updateUI = nil;
 //    }
-    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
+//    AppDelegate* Appdelegate=(AppDelegate*)[UIApplication sharedApplication].delegate;
     NSUInteger row = indexPath.row;
-    NSUInteger count = Appdelegate.uploadManager.arr_queue.count;
+    NSUInteger count = RASingleton.sharedInstance.uploadManager.arr_queue.count;
     if (count > row) {
-        NSDictionary * item_json = Appdelegate.uploadManager.arr_queue[indexPath.row];
+        NSDictionary * item_json = RASingleton.sharedInstance.uploadManager.arr_queue[indexPath.row];
         RAUploadOperation* operation = item_json[@"operation"];
         UploadCell *newCell = (UploadCell *)[tableView cellForRowAtIndexPath:indexPath];
         if (newCell != upCell) {

+ 10 - 1
RA Image/RA Image/main.m

@@ -8,9 +8,18 @@
 
 #import <UIKit/UIKit.h>
 #import "AppDelegate.h"
+//
+//int main(int argc, char * argv[]) {
+//    @autoreleasepool {
+//        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+//    }
+//}
 
 int main(int argc, char * argv[]) {
+    NSString * appDelegateClassName;
     @autoreleasepool {
-        return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+        // Setup code that might create autoreleased objects goes here.
+        appDelegateClassName = NSStringFromClass([AppDelegate class]);
     }
+    return UIApplicationMain(argc, argv, nil, appDelegateClassName);
 }