Browse Source

granite expo esign 1.56

Ray Zhang 5 năm trước cách đây
mục cha
commit
9d1c8e91ca

+ 0 - 3
Ants Contract/AntsContract.xcworkspace/contents.xcworkspacedata

@@ -1,9 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <Workspace
    version = "1.0">
-   <FileRef
-      location = "group:AntsContract/AntsContract.xcodeproj">
-   </FileRef>
    <FileRef
       location = "group:Granite Expo eSign/Granite Expo eSign.xcodeproj">
    </FileRef>

+ 0 - 6
Ants Contract/AntsContract/AntsContract.xcodeproj/project.pbxproj

@@ -8,7 +8,6 @@
 
 /* Begin PBXBuildFile section */
 		3CC7E74223BEE1B000BE5561 /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E74023BEE1B000BE5561 /* NetworkUtils.m */; };
-		3CC7E74523BEE1BE00BE5561 /* ACNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E74323BEE1BE00BE5561 /* ACNetwork.m */; };
 		3CC7E74923BEE1D500BE5561 /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E74723BEE1D500BE5561 /* RAPDFViewController.m */; };
 		3CC7E74A23BEE1D500BE5561 /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E74823BEE1D500BE5561 /* wkweb.storyboard */; };
 		3CC7E74E23BEE2C500BE5561 /* DocumentTemplateViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E74C23BEE2C400BE5561 /* DocumentTemplateViewController.m */; };
@@ -59,8 +58,6 @@
 /* Begin PBXFileReference section */
 		3CC7E74023BEE1B000BE5561 /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../../common/NetworkUtils.m; sourceTree = "<group>"; };
 		3CC7E74123BEE1B000BE5561 /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../../common/NetworkUtils.h; sourceTree = "<group>"; };
-		3CC7E74323BEE1BE00BE5561 /* ACNetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ACNetwork.m; path = "../../Granite Expo eSign/Granite Expo eSign/ACNetwork.m"; sourceTree = "<group>"; };
-		3CC7E74423BEE1BE00BE5561 /* ACNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ACNetwork.h; path = "../../Granite Expo eSign/Granite Expo eSign/ACNetwork.h"; sourceTree = "<group>"; };
 		3CC7E74623BEE1D500BE5561 /* RAPDFViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAPDFViewController.h; path = "../../../common/WK PDF+Web/RAPDFViewController.h"; sourceTree = "<group>"; };
 		3CC7E74723BEE1D500BE5561 /* RAPDFViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAPDFViewController.m; path = "../../../common/WK PDF+Web/RAPDFViewController.m"; sourceTree = "<group>"; };
 		3CC7E74823BEE1D500BE5561 /* wkweb.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
@@ -342,8 +339,6 @@
 				7156713B1E10AF67006324A0 /* RAUtils.m */,
 				3CC7E74123BEE1B000BE5561 /* NetworkUtils.h */,
 				3CC7E74023BEE1B000BE5561 /* NetworkUtils.m */,
-				3CC7E74423BEE1BE00BE5561 /* ACNetwork.h */,
-				3CC7E74323BEE1BE00BE5561 /* ACNetwork.m */,
 			);
 			name = utils;
 			sourceTree = "<group>";
@@ -452,7 +447,6 @@
 				713E83BA1E037C2000C4F12A /* AppDelegate.m in Sources */,
 				71D01AFA1E092304006620CE /* GroupDrawable.m in Sources */,
 				71D01AED1E09215E006620CE /* RAPDFPage.m in Sources */,
-				3CC7E74523BEE1BE00BE5561 /* ACNetwork.m in Sources */,
 				7156713C1E10AF67006324A0 /* RAUtils.m in Sources */,
 				3CC7E74223BEE1B000BE5561 /* NetworkUtils.m in Sources */,
 				715671671E10BE28006324A0 /* NSData+CommonCrypto.m in Sources */,

+ 27 - 25
Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj

@@ -7,13 +7,14 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		3C2B045B253D27AD00B52A74 /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C2B045A253D27AD00B52A74 /* RAUtils.m */; };
 		3C69617C23C70ECF0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617B23C70ECF0075172A /* WebViewController.m */; };
 		3C69618E23C819F70075172A /* 2020 GECI - Home Improvement Contract.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618D23C819F70075172A /* 2020 GECI - Home Improvement Contract.pdf */; };
 		3C69619023C81A500075172A /* 2020 GECI - Home Improvement Contract.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C69618F23C81A500075172A /* 2020 GECI - Home Improvement Contract.json */; };
+		3CBB92F2248A26EB0099E429 /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBB92F1248A26EB0099E429 /* NetworkUtils.m */; };
 		3CC7E73423BEDE9700BE5561 /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73323BEDE9700BE5561 /* RAPDFViewController.m */; };
 		3CC7E73623BEDEA000BE5561 /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E73523BEDEA000BE5561 /* wkweb.storyboard */; };
-		3CC7E73C23BEE07900BE5561 /* ACNetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73B23BEE07900BE5561 /* ACNetwork.m */; };
-		3CC7E73F23BEE13200BE5561 /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73E23BEE13200BE5561 /* NetworkUtils.m */; };
+		3CC7E73C23BEE07900BE5561 /* RANetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73B23BEE07900BE5561 /* RANetwork.m */; };
 		3CC7E7B723C5CB7800BE5561 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E7B623C5CB7800BE5561 /* Launch Screen.storyboard */; };
 		425A00F41F8F196900286D6F /* attribute_template.json in Resources */ = {isa = PBXBuildFile; fileRef = 425A00F31F8F0EC200286D6F /* attribute_template.json */; };
 		42D49E561F8DF13A00AE39D5 /* AttributeTextFieldCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 42D49E551F8DF13A00AE39D5 /* AttributeTextFieldCell.m */; };
@@ -55,7 +56,6 @@
 		7128C2C71E1250FC00FF635B /* PDFUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2BD1E1250FC00FF635B /* PDFUtils.m */; };
 		7128C2C81E1250FC00FF635B /* TextUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2BF1E1250FC00FF635B /* TextUtils.m */; };
 		7128C2C91E1250FC00FF635B /* Reachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2C11E1250FC00FF635B /* Reachability.m */; };
-		7128C2CB1E1250FC00FF635B /* RAUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2C51E1250FC00FF635B /* RAUtils.m */; };
 		7128C2D81E12510900FF635B /* ioapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2CE1E12510900FF635B /* ioapi.c */; };
 		7128C2D91E12510900FF635B /* mztools.c in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2D01E12510900FF635B /* mztools.c */; };
 		7128C2DA1E12510900FF635B /* unzip.c in Sources */ = {isa = PBXBuildFile; fileRef = 7128C2D21E12510900FF635B /* unzip.c */; };
@@ -96,17 +96,19 @@
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
+		3C200FD6248A2165000E2FD5 /* RANetwork.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RANetwork.h; sourceTree = "<group>"; };
+		3C2B0459253D27AD00B52A74 /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = ../../../common/RAUtils.h; sourceTree = "<group>"; };
+		3C2B045A253D27AD00B52A74 /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = ../../../common/RAUtils.m; sourceTree = "<group>"; };
 		3C69617A23C70ECF0075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
 		3C69617B23C70ECF0075172A /* WebViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = WebViewController.m; path = "../../../common/WK PDF+Web/WebViewController.m"; sourceTree = "<group>"; };
 		3C69618D23C819F70075172A /* 2020 GECI - Home Improvement Contract.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "2020 GECI - Home Improvement Contract.pdf"; sourceTree = "<group>"; };
 		3C69618F23C81A500075172A /* 2020 GECI - Home Improvement Contract.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "2020 GECI - Home Improvement Contract.json"; sourceTree = "<group>"; };
+		3CBB92F0248A26EB0099E429 /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../../common/NetworkUtils.h; sourceTree = "<group>"; };
+		3CBB92F1248A26EB0099E429 /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../../common/NetworkUtils.m; sourceTree = "<group>"; };
 		3CC7E73223BEDE9700BE5561 /* RAPDFViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAPDFViewController.h; path = "../../../common/WK PDF+Web/RAPDFViewController.h"; sourceTree = "<group>"; };
 		3CC7E73323BEDE9700BE5561 /* RAPDFViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAPDFViewController.m; path = "../../../common/WK PDF+Web/RAPDFViewController.m"; sourceTree = "<group>"; };
 		3CC7E73523BEDEA000BE5561 /* wkweb.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
-		3CC7E73A23BEE07900BE5561 /* ACNetwork.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ACNetwork.h; sourceTree = "<group>"; };
-		3CC7E73B23BEE07900BE5561 /* ACNetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ACNetwork.m; sourceTree = "<group>"; };
-		3CC7E73D23BEE13200BE5561 /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../../common/NetworkUtils.h; sourceTree = "<group>"; };
-		3CC7E73E23BEE13200BE5561 /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../../common/NetworkUtils.m; sourceTree = "<group>"; };
+		3CC7E73B23BEE07900BE5561 /* RANetwork.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RANetwork.m; sourceTree = "<group>"; };
 		3CC7E7B623C5CB7800BE5561 /* Launch Screen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = "Launch Screen.storyboard"; sourceTree = "<group>"; };
 		425A00F31F8F0EC200286D6F /* attribute_template.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = attribute_template.json; sourceTree = "<group>"; };
 		42D49E541F8DF13A00AE39D5 /* AttributeTextFieldCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AttributeTextFieldCell.h; sourceTree = "<group>"; };
@@ -181,8 +183,6 @@
 		7128C2BF1E1250FC00FF635B /* TextUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TextUtils.m; path = "../../../RedAnt ERP Mobile/common/TextUtils.m"; sourceTree = "<group>"; };
 		7128C2C01E1250FC00FF635B /* Reachability.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Reachability.h; path = "../../../RedAnt ERP Mobile/common/Reachability.h"; sourceTree = "<group>"; };
 		7128C2C11E1250FC00FF635B /* Reachability.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Reachability.m; path = "../../../RedAnt ERP Mobile/common/Reachability.m"; sourceTree = "<group>"; };
-		7128C2C41E1250FC00FF635B /* RAUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RAUtils.h; path = "../../../RedAnt ERP Mobile/common/RAUtils.h"; sourceTree = "<group>"; };
-		7128C2C51E1250FC00FF635B /* RAUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RAUtils.m; path = "../../../RedAnt ERP Mobile/common/RAUtils.m"; sourceTree = "<group>"; };
 		7128C2CD1E12510900FF635B /* crypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = crypt.h; path = "../../../RedAnt ERP Mobile/common/zip/minizip/crypt.h"; sourceTree = "<group>"; };
 		7128C2CE1E12510900FF635B /* ioapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ioapi.c; path = "../../../RedAnt ERP Mobile/common/zip/minizip/ioapi.c"; sourceTree = "<group>"; };
 		7128C2CF1E12510900FF635B /* ioapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ioapi.h; path = "../../../RedAnt ERP Mobile/common/zip/minizip/ioapi.h"; sourceTree = "<group>"; };
@@ -486,10 +486,12 @@
 		7128C2B91E1250F000FF635B /* utils */ = {
 			isa = PBXGroup;
 			children = (
-				3CC7E73D23BEE13200BE5561 /* NetworkUtils.h */,
-				3CC7E73E23BEE13200BE5561 /* NetworkUtils.m */,
-				3CC7E73A23BEE07900BE5561 /* ACNetwork.h */,
-				3CC7E73B23BEE07900BE5561 /* ACNetwork.m */,
+				3C2B0459253D27AD00B52A74 /* RAUtils.h */,
+				3C2B045A253D27AD00B52A74 /* RAUtils.m */,
+				3C200FD6248A2165000E2FD5 /* RANetwork.h */,
+				3CC7E73B23BEE07900BE5561 /* RANetwork.m */,
+				3CBB92F0248A26EB0099E429 /* NetworkUtils.h */,
+				3CBB92F1248A26EB0099E429 /* NetworkUtils.m */,
 				7115D4241E13B32800EF4E4C /* customerUI */,
 				7128C2DD1E12511400FF635B /* aes */,
 				7128C2CC1E1250FF00FF635B /* zip */,
@@ -503,8 +505,6 @@
 				7128C2C11E1250FC00FF635B /* Reachability.m */,
 				718697572113F40D00CE31EC /* RAConvertor.h */,
 				718697582113F40D00CE31EC /* RAConvertor.m */,
-				7128C2C41E1250FC00FF635B /* RAUtils.h */,
-				7128C2C51E1250FC00FF635B /* RAUtils.m */,
 			);
 			name = utils;
 			sourceTree = "<group>";
@@ -604,7 +604,7 @@
 		7128C2331E124F4500FF635B /* Project object */ = {
 			isa = PBXProject;
 			attributes = {
-				LastUpgradeCheck = 1130;
+				LastUpgradeCheck = 1200;
 				ORGANIZATIONNAME = "United Software Applications, Inc";
 				TargetAttributes = {
 					7128C23A1E124F4500FF635B = {
@@ -672,10 +672,11 @@
 				7115D4271E13B70C00EF4E4C /* DocumentListViewController.m in Sources */,
 				7128C2B71E1250CA00FF635B /* RectDrawable.m in Sources */,
 				71BBFC3A1E651CC4008668A7 /* DocnotesViewController.m in Sources */,
+				3C2B045B253D27AD00B52A74 /* RAUtils.m in Sources */,
 				42D49E591F8DF15800AE39D5 /* AttributeLabelCell.m in Sources */,
 				3CC7E73423BEDE9700BE5561 /* RAPDFViewController.m in Sources */,
 				7128C2D91E12510900FF635B /* mztools.c in Sources */,
-				3CC7E73C23BEE07900BE5561 /* ACNetwork.m in Sources */,
+				3CC7E73C23BEE07900BE5561 /* RANetwork.m in Sources */,
 				714A9AEF1E9CADA100371995 /* PendingDocumentsTableViewCell.m in Sources */,
 				7128C2EB1E12511B00FF635B /* NSString+Base64.m in Sources */,
 				7128C2B31E1250CA00FF635B /* BasicDrawable.m in Sources */,
@@ -710,7 +711,6 @@
 				42D49E671F8DFA4B00AE39D5 /* PageSubItemCell.m in Sources */,
 				42DDB8741F91C081002CCE22 /* ControlTemplateVC.m in Sources */,
 				71CDA0901F75EE400079F8E6 /* DocumentTemplateViewController.m in Sources */,
-				7128C2CB1E1250FC00FF635B /* RAUtils.m in Sources */,
 				7128C2C81E1250FC00FF635B /* TextUtils.m in Sources */,
 				7128C33B1E12540F00FF635B /* AppDelegate.m in Sources */,
 				7128C27B1E12500B00FF635B /* SignatureView.m in Sources */,
@@ -719,12 +719,12 @@
 				7115D4591E162BA800EF4E4C /* DatePickerViewController.m in Sources */,
 				7128C2401E124F4500FF635B /* main.m in Sources */,
 				7128C3551E12548C00FF635B /* SignatureListViewController.m in Sources */,
+				3CBB92F2248A26EB0099E429 /* NetworkUtils.m in Sources */,
 				714B37041E70F2BF00E99B90 /* ScannerControllerView.m in Sources */,
 				7128C2EA1E12511B00FF635B /* NSData+CommonCrypto.m in Sources */,
 				7128C2B01E1250CA00FF635B /* TextDrawable.m in Sources */,
 				71BBFC371E6419D4008668A7 /* ExtDocumentsViewController.m in Sources */,
 				7128C3531E12548C00FF635B /* RAPDFPageView.m in Sources */,
-				3CC7E73F23BEE13200BE5561 /* NetworkUtils.m in Sources */,
 				7128C33E1E12541800FF635B /* RootViewController.m in Sources */,
 				7128C2E91E12511B00FF635B /* NSData+Base64.m in Sources */,
 				714B37051E70F2BF00E99B90 /* ScannerViewController.m in Sources */,
@@ -774,6 +774,7 @@
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
 				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -798,7 +799,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				MTL_ENABLE_DEBUG_INFO = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				SDKROOT = iphoneos;
@@ -831,6 +832,7 @@
 				CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
 				CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
 				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
 				CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
 				CLANG_WARN_STRICT_PROTOTYPES = YES;
 				CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -849,7 +851,7 @@
 				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
 				GCC_WARN_UNUSED_FUNCTION = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				MTL_ENABLE_DEBUG_INFO = NO;
 				SDKROOT = iphoneos;
 				TARGETED_DEVICE_FAMILY = 2;
@@ -864,9 +866,9 @@
 				CURRENT_PROJECT_VERSION = 44118;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.51;
+				MARKETING_VERSION = 1.56;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.Granite-Expo-eSign";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};
@@ -879,9 +881,9 @@
 				CURRENT_PROJECT_VERSION = 44118;
 				DEVELOPMENT_TEAM = HXWLAA5YN5;
 				INFOPLIST_FILE = "Granite Expo eSign/Info.plist";
-				IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+				IPHONEOS_DEPLOYMENT_TARGET = 12.0;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
-				MARKETING_VERSION = 1.51;
+				MARKETING_VERSION = 1.56;
 				PRODUCT_BUNDLE_IDENTIFIER = "usai.redant.Granite-Expo-eSign";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 			};

+ 2 - 2
Ants Contract/Granite Expo eSign/Granite Expo eSign/DocumentTemplateViewController.m

@@ -12,11 +12,11 @@
 #import "SignatureListViewController.h"
 #import "SignatureViewController.h"
 #import "PDFUtils.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 
 //#import "AFHTTPSessionManager.h"
 #import "AppDelegate.h"
-#import "ACNetwork.h"
+
 #import "RAUtils.h"
 //#import "RAPDFViewController.h"
 #import "config.h"

+ 34 - 0
Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.h

@@ -0,0 +1,34 @@
+//
+//  ACNetwork.h
+//  AntsContract
+//
+//  Created by Ray on 12/26/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import "NetworkUtils.h"
+
+
+
+
+@interface RANetwork : NetworkUtils
++(int)Authorize : (NSString*) user password:(NSString*) password;
++(NSString *) prepareUploadFile:(NSString*) file json:(NSMutableDictionary*)json;
++(NSDictionary*)logout;
++(NSDictionary*)request_DocList:(NSMutableDictionary*) params;
++(NSDictionary*)new_document;
+
++(NSDictionary*)save_document:(NSString*)file isnew:(bool)isNewDocument;
+
++(NSString *) packfiles2zip:(NSMutableArray*) arr_file;
+
++(NSDictionary *) updateNotes:(NSString*) doc_number notes:(NSString*)notes;
++(NSDictionary*)upload_file:(NSString*)file params:(NSMutableDictionary*) params;
+
++(NSString *) getjsonPath:(NSString*) serial;
++(NSString *) getPDFPath:(NSString*) file;
++(NSString *) offline_docnumber;
+
++ (int)heartBeat;
+
+@end

+ 862 - 0
Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.m

@@ -0,0 +1,862 @@
+//
+//  ACNetwork.m
+//  AntsContract
+//
+//  Created by Ray on 12/26/16.
+//  Copyright © 2016 United Software Applications, Inc. All rights reserved.
+//
+
+#import "RANetwork.h"
+#import "AppDelegate.h"
+
+#import "RAUtils.h"
+#import "ZipArchive.h"
+
+#import "config.h"
+#import "AESCrypt.h"
+//#import <AdSupport/ASIdentifierManager.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:@"usai2010"] forKey:@"user"];
+    if(appDelegate.password!=nil)
+        [params setValue:[AESCrypt AES128Encrypt:appDelegate.password key:@"usai2010"] forKey:@"password"];
+    
+
+    
+    [params setValue:appDelegate.build forKey:@"app_ver"];
+    
+    NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
+    NSString* short_version =[infoDict objectForKey:@"CFBundleShortVersionString"];
+    [params setValue:short_version forKey:@"app_short_ver"];
+    
+    
+
+#if TARGET_IPHONE_SIMULATOR//模拟器
+    [params setValue:@"simulator_uuid" forKey:@"deviceid"];
+#elif TARGET_OS_IPHONE//真机
+    UIDevice * dev = [UIDevice currentDevice];
+    NSUUID* uuid =dev.identifierForVendor;
+    [params setValue:uuid.UUIDString forKey:@"deviceid"];
+#endif
+    
+    return params;
+}
+
++(NSData*)get_json : (NSString*) url parameters:(NSMutableDictionary *) params file:(NSString *) file //delegate:(id < NSURLConnectionDelegate >)delegate
+{
+    
+    
+    
+    
+//    NSString* e=[AESCrypt AES128Encrypt:@"密码学中的高级加密标准(Advanced Encryption Standard,AES),又称 高级加密标准Rijndael加密法,是美国联邦政府采用的一种区块加密标准。这个标准用来替代原先的DES,已经被多方分析且广为全世界所使用。经过五年的甄选流程,高级加密标准由美国国家标准与技术研究院 (NIST)于2001年11月26日发布于FIPS PUB 197,并在2002年5月26日成为有效的标准。2006年,高级加密标准已然成为对称密钥加密中最流行的算法之一。 " key:@"usai2010"];
+//    DebugLog(e);
+//    NSString* d=[AESCrypt decrypt:@"VzB4+lENfbzWX7ggHh2Os1P69l5YBzKmM51yqA37AfoKgPY8bJgdK8M4WvF+wDyOsLWP\/o8H5+bHMivQp1u8wM2QV7SYzgzPwV85QKtYWIzEgLe9T0HO69EdutWz7k1rdAT\/mftsRin0Hy5SHk7txTZT\/zPH5X+FQiExCTFm5Zus39HYvp+VxCX4+kYeymn8B63AUd3mRQyscUvDjfgU2olKR\/TP8PV3g+VQMZxpKfol3P1iOtz3XQlHZV0pM6SAf+SwT0sPfrdn6CZFfNQlrKA9QjMrnBdMeSCquSIWXnmLv6okzvnlJnT0SjvJuUeqNdBC5EZ0ACnhI0MrXVZEsq1EuM9al7oPzvU5EZbjZpmx+fSFIkMzTT8bYClTnG1bsL1MCcU4pSODDorUj8zalA==" password:@"usai2010"];
+    params = [self prepare_addtional_params:params];
+    
+    return [super get_json:url parameters:params file:(NSString*)file err_recorder:URL_ERR_LOG result_handler:^NSMutableDictionary *(NSMutableDictionary *jsobj) {
+        int result=[[jsobj valueForKey:@"result"] intValue];
+//        UIApplication * app = [UIApplication sharedApplication];
+//        AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+
+        switch (result) {
+            case 0:
+                [jsobj setValue:MSG_USERAUTH_ERROR forKey:@"err_msg"];
+                break;
+            case 1:
+                [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
+                break;
+            case 2:
+                [jsobj setValue:MSG_SUCCESS forKey:@"err_msg"];
+                break;
+            case 8:
+                [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
+                break;
+            case 9:
+                [jsobj setValue:[jsobj valueForKey:@"msg"] forKey:@"err_msg"];
+                break;
+            case 99:
+                [jsobj setValue:MSG_TIMEOUT forKey:@"err_msg"];
+                break;
+            default:
+                [jsobj setValue:MSG_ERROR forKey:@"err_msg"];
+                break;
+        }
+        
+        
+//        if([appDelegate.build intValue]< [[jsobj valueForKey:@"min_ver"]intValue])
+//        {
+//            [jsobj setValue:@"9" forKey:@"result"];
+//            [jsobj setValue:MSG_VER_LOW forKey:@"err_msg"];
+//        }
+        return jsobj;
+    } decrypt_handler:^NSMutableDictionary *(NSMutableDictionary *jsobj) {
+        
+        NSString* base64str = jsobj[@"str"];
+        NSString* decryptstr=[AESCrypt AES128Decrypt:base64str key:@"usai2010"];
+        jsobj=[[RAConvertor string2dict:decryptstr] mutableCopy];
+        return jsobj;
+    }];
+    
+    
+    /*
+
+
+     
+     */
+    return nil;
+}
++(NSDictionary*)new_document
+{
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    
+    
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    params[@"_operate"]=@"doc_id";
+    
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_NEW_DOCUMENT parameters:params file:nil];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    DebugLog(@"new_document result:%d",result);
+
+    return jsobj;
+}
++(NSDictionary*)upload_file:(NSString*)file params:(NSMutableDictionary*) params
+{
+    
+    
+    
+   // NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    //    if(appDelegate.user!=nil)
+    //        [params setValue:appDelegate.user forKey:@"user"];
+    //
+    //
+    //    if(appDelegate.password!=nil)
+    //        [params setValue:appDelegate.password forKey:@"password"];
+    params[@"_operate"]=@"uploadFileIpad";
+    
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_UPLOAD_PDF parameters:params file:file];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    
+    DebugLog(@"upload_file result:%d",result);
+    return jsobj;
+}
++(NSDictionary*)save_document:(NSString*)file isnew:(bool)isNewDocument
+{
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
+//    
+//    
+//    if(appDelegate.password!=nil)
+//        [params setValue:appDelegate.password forKey:@"password"];
+    params[@"_operate"]=@"deviceMain";
+    params[@"modify_document"]=[NSNumber numberWithBool:!isNewDocument];
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_UPLOAD_PDF parameters:params file:file];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    
+        DebugLog(@"new_document result:%d",result);
+    return jsobj;
+}
++(NSDictionary*)logout
+{
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    
+    
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    params[@"_operate"]=@"logout_zip";
+    
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_LOGOUT parameters:params file:nil];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    
+    if (result==2)
+    {
+        [appDelegate Logout];
+  
+    }
+    return jsobj;
+}
++(int)Authorize : (NSString*) user password:(NSString*) password{
+    
+    //    if(![ApexMobileNetwork IsHostAvailable:URL_UPDATE_AUTH])
+    //        return RESULT_NET_ERROR;
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    long ver =[defaults integerForKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+    
+    
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(appDelegate.duid !=nil)
+//        [params setValue:appDelegate.duid forKey:@"udid"];
+//    [params setValue:@"handset_login" forKey:@"action"];
+    //    [headers setValue:[NSString stringWithFormat:@"%d",dataLength] forKey:@"Content-Length"];
+    
+    
+    
+    
+    [params setValue:[AESCrypt AES128Encrypt:user  key:@"usai2010"] forKey:@"user"];
+    [params setValue:[AESCrypt AES128Encrypt:password  key:@"usai2010"] forKey:@"password"];
+    [params setValue:[NSString stringWithFormat:@"%ld",ver]  forKey:@"auth_ver"];
+        [params setValue:@"login"  forKey:@"_operate"];
+    
+
+//#ifdef TEST
+//    [params setValue:@"true" forKey:@"is_debug"];
+//#else
+//    [params setValue:@"false" forKey:@"is_debug"];
+//#endif
+    
+    NSData* json= nil;
+//    if(appDelegate.offline_mode)
+//    {
+//        json= [OLDataProvider offline_login:params] ;
+//        
+//    }
+//    else
+    
+        if(![self IsNetworkAvailable])
+            return RESULT_NET_NOTAVAILABLE;
+        json =[self get_json:URL_UPDATE_AUTH parameters:params file:nil];
+        
+    
+    
+    if(json==nil)
+        return RESULT_NET_ERROR;
+    
+    
+    int ret = [self parse_authinfo:json user:user password:password];
+    DebugLog(@"parse_authinfo return %d ",ret);
+    
+    
+    return ret;
+    
+    
+}
++(int)parse_authinfo : (NSData *) json user:(NSString*) user password:(NSString*) password
+{
+    DebugLog(@"parse_authinfo");
+    NSError *error=nil;
+    
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    if(jsobj)
+    {
+        
+        UIApplication * app = [UIApplication sharedApplication];
+        AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+        int result = [[jsobj valueForKey:@"result"] intValue];
+        
+        if (result<0)
+            return result;
+        if(result!=AP_USER_AUTH&& result!=9)
+        {
+            
+            
+            DebugLog(@"USER NOT AUTHORIZED CODE=%d ",result);
+            [appDelegate Logout];
+            if(result==8)
+            {
+                return RESULT_LOGIN_DEVICE;
+            }
+            return RESULT_FALSE;
+            
+        }
+        
+        NSString* offPrefix = jsobj[@"randcode"];
+        bool canModify = [jsobj[@"can_modify"] boolValue];
+        
+        
+        
+        NSString* agentName = jsobj[@"agent_name"];
+        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+        
+        
+       
+
+        
+        NSMutableDictionary* user_info = [NSMutableDictionary new];
+        user_info[@"prefix"]=offPrefix;
+        user_info[@"agent_name"]= agentName;
+        
+
+        
+        [defaults setObject:user_info forKey:user];
+//        if(offPrefix!=nil)
+//        {
+//            [defaults setValue:offPrefix forKey:user];
+//            
+//            
+//        }
+//        if(agentName!=nil)
+//        {
+//            [defaults setValue:agentName forKey:@"agent_name"];
+//            
+//            
+//        }
+        
+        [defaults synchronize];
+//        NSDictionary* objheader = [jsobj objectForKey:@"header"];
+//        
+//        NSString* required_ver=[jsobj objectForKey:@"min_ver"] ;
+//        user=[objheader objectForKey:@"username"] ;
+//        DebugLog(@"required_ver=%@ ",required_ver);
+//        //        NSDictionary* infoDict =[[NSBundle mainBundle] infoDictionary];
+//        //        NSString* versionNum =[infoDict valueForKey:@"CFBundleVersion"];
+//        //        versionNum = [NSString stringWithFormat:@"A%@",versionNum];
+//        int ibadge = [[objheader valueForKey:@"badge"] intValue];
+//        
+//        //        if([ibadge isEqual:[NSNull null]])
+//        //            strbadge=@"0";
+//        //        if(ibadge==nil)
+//        //            ibadge=@"0";
+//        //        if([strbadge isEqualToString:@"null"])
+//        //            strbadge=@"0";
+//        app.applicationIconBadgeNumber = ibadge;//[strbadge intValue];
+//        
+//        //  BOOL bigger = [appDelegate.build compare:required_ver] ;
+//        if([appDelegate.build intValue]<[required_ver intValue])
+//            return RESULT_VER_LOW;
+//        //        appDelegate.sessionid = [objheader valueForKey:@"sessionid"];
+//        appDelegate.user = user;
+//        appDelegate.password = password;
+////        appDelegate.user_type = [[objheader valueForKey:@"user_type"] intValue];
+////        appDelegate.user_icon =[objheader valueForKey:@"user_img"] ;
+//        appDelegate.bLogin = true;
+        
+        
+        [appDelegate Login:user pwd:password canModify:canModify offPrefix:offPrefix agentName:agentName];
+        
+        
+//        
+//        if(appDelegate.user_type==USER_ROLE_CUSTOMER)
+//        {
+//            appDelegate.customerInfo = [[objheader objectForKeyedSubscript:@"customerInfo"] mutableCopy];
+//            appDelegate.contact_id = [objheader valueForKey:@"contact_id"];
+//            //            appDelegate.order_code =[objheader valueForKey:@"orderCode"];
+//            //            appDelegate.order_status =[[objheader valueForKey:@"orderStatus"] intValue];
+//            //            [appDelegate SetSo:[objheader valueForKey:@"soId"]];
+//        }
+//        NSString* mode =[jsobj valueForKey:@"mode"] ;
+//        [appDelegate SetMode:mode];
+//        
+//        
+//        appDelegate.cart_count = [[objheader valueForKey:@"cart_count"] intValue];
+//        appDelegate.wish_count =[[objheader valueForKey:@"wish_count"] intValue];
+//        appDelegate.port_count =[[objheader valueForKey:@"portfolio_count"] intValue];
+//        
+//        [appDelegate update_count_mark];
+//        
+//        
+//        
+//        appDelegate.can_show_price =[[objheader valueForKey:@"can_show_price"] boolValue];
+//        appDelegate.can_see_price =[[objheader valueForKey:@"can_see_price"] boolValue];
+//        appDelegate.can_create_portfolio =[[objheader valueForKey:@"can_create_portfolio"] boolValue];
+//        appDelegate.can_create_order =[[objheader valueForKey:@"can_create_order"] boolValue];
+//        
+//        appDelegate.can_cancel_order =[[objheader valueForKey:@"can_cancel_order"] boolValue];
+//        appDelegate.can_set_cart_price =[[objheader valueForKey:@"can_set_cart_price"] boolValue];
+//        appDelegate.can_delete_order =[[objheader valueForKey:@"can_delete_order"] boolValue];
+//        appDelegate.can_update_contact_info =[[objheader valueForKey:@"can_update_contact_info"] boolValue];
+//        appDelegate.can_submit_order =[[objheader valueForKey:@"can_submit_order"] boolValue];
+//        appDelegate.can_set_tearsheet_price =[[objheader valueForKey:@"can_set_tearsheet_price"] boolValue];
+//        
+//        appDelegate.save_order_logout =[[objheader valueForKey:@"save_order_logout"] boolValue];
+//        appDelegate.submit_order_logout =[[objheader valueForKey:@"submit_order_logout"] boolValue];
+//        
+//        appDelegate.alert_sold_in_quantities = [[objheader valueForKey:@"alert_sold_in_quantities"] boolValue];
+//        
+//        
+//        
+//        appDelegate.ipad_perm =[objheader valueForKey:@"ipad_perm"] ;
+//        
+//        NSString* strfilter = [objheader valueForKey:@"statusFilter"] ;
+//        
+//        
+//        
+//        appDelegate.OrderFilter= [[RAUtils string2dict:strfilter] mutableCopy];
+//        
+//        
+//        [appDelegate set_main_button_panel];
+//        
+//        if(appDelegate.user_type==USER_ROLE_CUSTOMER) {
+//            
+//            // shop order status filter
+//            NSString *shopOrderStatusFilterStr = [objheader valueForKey:@"shopOrderFilter"] ;
+//            [Singleton sharedInstance].shop_order_status_filter = [[RAUtils string2dict:shopOrderStatusFilterStr] mutableCopy];
+//            
+//            // specialInstruction
+//            [Singleton sharedInstance].specialInstruction = [objheader valueForKey:@"specialInstruction"];
+//            
+//            //-价格类型
+//            [Singleton sharedInstance].npd_shop_price_type = [[objheader valueForKey:@"price_type"] integerValue];
+//            
+//            // 权限
+//            [Singleton sharedInstance].permissions_price_setting = [[objheader valueForKey:@"can_set_price_formula"] boolValue];
+//            [Singleton sharedInstance].permissions_edit_order = [[objheader valueForKey:@"can_place_order"] boolValue];
+//            
+//            [Singleton sharedInstance].permissions_submit_order = [[objheader valueForKey:@"can_submit_order"] boolValue];
+//            
+//            [Singleton sharedInstance].permissions_merge_order = [[objheader valueForKey:@"can_merge_order"] boolValue];
+//            
+//            [Singleton sharedInstance].deliveryString = [objheader valueForKey:@"delivery_price"];
+//            [[Singleton sharedInstance] resetGlobalLock];
+//            [Singleton sharedInstance].customer_can_see_sales_Order = [[objheader valueForKey:@"can_see_salesorder"] boolValue];
+//        }
+        
+        //        DebugLog(@"sessionid=%@ ",appDelegate.sessionid);
+        //        if ([[objheader valueForKey:@"update"] boolValue]==false)
+        //        {
+        //            // no update on the server;
+        //            return RESULT_TRUE;
+        //        }
+        //        int Auth_InfoVer = [[objheader valueForKey:@"ver"] intValue];
+        //        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+        //        [defaults removeObjectForKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+        //       [defaults setInteger:Auth_InfoVer forKey:[NSString stringWithFormat:@"%@_Auth_InfoVer",user]];
+        //        [defaults synchronize];
+        //
+        //        NSDictionary* objfuncs = [jsobj objectForKey:@"functions"];
+        //        NSArray* keys= [objfuncs allKeys];
+        
+        
+        /*
+         
+         db.setTransactionSuccessful();
+         db.endTransaction();
+         */
+        return RESULT_TRUE;
+        
+    }
+    //    NSDictionary *weatherInfo = [jsobj objectForKey:@"weatherinfo"];
+    //    txtView.text = [NSString stringWithFormat:@"今天是 %@  %@  %@  的天气状况是:%@  %@ ",[weatherInfo objectForKey:@"date_y"],[weatherInfo objectForKey:@"week"],[weatherInfo objectForKey:@"city"], [weatherInfo objectForKey:@"weather1"], [weatherInfo objectForKey:@"temp1"]];
+    //      DebugLog(@"weatherInfo字典里面的内容为--》%@", weatherDic );
+    
+    
+    
+    return RESULT_USERAUTH_ERROR;
+}
++(NSDictionary*)err_log:(NSString*) up_params result:(NSString*)result module:(NSString*) module code:(int) code//device:(NSString*) device
+{
+//    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
+//    
+//    [params setValue:up_params forKey:@"upparam"];
+//    
+//    [params setValue:[NSNumber numberWithInt:code ] forKey:@"code"];
+//    
+//    [params setValue:result forKey:@"result"];
+//    [params setValue:module forKey:@"interfac"];
+//    
+//    [params setValue:[RAUtils base64en:[RAUtils dict2string: [RAUtils device_info]]] forKey:@"device"];
+//    
+//    
+//    //     [params setValue:module forKey:@"module"];
+//    
+//    //  [[UIDevice currentDevice]  name];
+//    
+//    //    if(appDelegate.offline_mode)
+//    //    {
+//    //        return [OLDataProvider offline_notimpl];
+//    //    }
+//    if(![self IsNetworkAvailable])
+//        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+//    
+//    NSData* json=[self get_json:URL_ERR_LOG parameters:params];
+//    if(json==nil)
+//        return nil;
+//    NSError *error=nil;
+//    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+//    return jsobj;
+    NSMutableDictionary* jsobj = [@{@"result":@"2"} mutableCopy];
+    return jsobj;
+}
++(NSString *) packfiles2zip:(NSMutableArray*) arr_file
+{
+    
+    if(arr_file.count==0)
+    {
+        DebugLog(@"packfiles2zip: source list is empty.");
+        return @"";
+    }
+    NSString* serial= [[NSUUID UUID] UUIDString];
+    
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *cachefolder = [paths objectAtIndex:0];
+    
+    NSString *upfolder = [cachefolder stringByAppendingPathComponent:@"upload_data"];
+    upfolder = [upfolder stringByAppendingPathComponent:serial];
+    
+    NSFileManager* fileManager = [NSFileManager defaultManager];
+    BOOL bdir=YES;
+    if(!  [fileManager fileExistsAtPath:upfolder isDirectory:&bdir])
+    {
+        
+        NSError *error = nil;
+        bool bsuccess=[fileManager createDirectoryAtPath:upfolder withIntermediateDirectories:YES attributes:nil error:&error];
+        
+        if(!bsuccess)
+        {
+            DebugLog(@"Create UPLOAD folder failed");
+            return @"";
+        }
+        
+    }
+    
+
+    
+    
+    NSString * zippath= [upfolder stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",serial]];
+    
+    
+    ZipArchive* zip = [[ZipArchive alloc] init];
+    
+    
+    BOOL result = [zip CreateZipFile2:zippath Password:nil];
+    
+    for(int i=0;i<arr_file.count;i++)
+    {
+        NSString* file = arr_file[i];
+        result = [zip addFileToZip:file newname:[file lastPathComponent]];
+    }
+    
+   
+    
+    
+    if( ![zip CloseZipFile2] )
+    {
+        zippath = @"";
+    }
+    
+    
+    
+    
+    
+    return zippath;
+}
+
++(NSString *) prepareUploadFile:(NSString*) file json:(NSMutableDictionary*)json
+{
+    NSString* serial= [[NSUUID UUID] UUIDString];
+    
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *cachefolder = [paths objectAtIndex:0];
+    
+    NSString *upfolder = [cachefolder stringByAppendingPathComponent:@"upload_data"];
+    upfolder = [upfolder stringByAppendingPathComponent:serial];
+    
+    NSFileManager* fileManager = [NSFileManager defaultManager];
+    BOOL bdir=YES;
+    if(!  [fileManager fileExistsAtPath:upfolder isDirectory:&bdir])
+    {
+        
+        NSError *error = nil;
+        bool bsuccess=[fileManager createDirectoryAtPath:upfolder withIntermediateDirectories:YES attributes:nil error:&error];
+        
+        if(!bsuccess)
+            DebugLog(@"Create UPLOAD folder failed");
+        
+    }
+    
+//    NSMutableDictionary* ret = [[NSMutableDictionary alloc] init];
+//    ret[@"contact"]=[self prepareContact:serial];
+//    ret[@"wishlist"]=[self prepareWishlist:serial];
+//    ret[@"order"]=[self prepareOrder:serial soid:arr_order];
+//    ret[@"portfolio"] = [self preparePortfolio:serial];
+//    ret[@"view_portfolio"] = [self preparePDF:serial];
+    
+    NSString* str= [RAConvertor dict2string:json];
+    
+    
+    
+    
+    
+    NSString * jsonpath= [upfolder stringByAppendingPathComponent:@"json.json"];
+    
+    NSString * zippath= [upfolder stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.zip",serial]];
+    
+    
+    NSError *error=nil;
+    
+    [str writeToFile:jsonpath atomically:true encoding:NSUTF8StringEncoding error:&error];
+    
+   // NSArray* arr_files=[RAUtils allFilesAtPath:upfolder];
+    
+    ZipArchive* zip = [[ZipArchive alloc] init];
+    
+    
+    BOOL result = [zip CreateZipFile2:zippath Password:nil];
+    
+
+        result = [zip addFileToZip:file newname:[file lastPathComponent]];
+    result = [zip addFileToZip:jsonpath newname:[jsonpath lastPathComponent]];
+
+    
+//    for(int l=0;l<[json[@"count"] intValue];l++)
+//    {
+//        
+//        NSMutableDictionary * page_json = json[[NSString stringWithFormat:@"page_%d",l] ];
+//        
+//        for(int p=0;p<[page_json[@"count"] intValue];p++)
+//        {
+//            NSMutableDictionary * control_json = page_json[[NSString stringWithFormat:@"control_%d",p] ];
+//            if([control_json[@"type"] isEqualToString:@"Signature"] )
+//            {
+//                NSString* signature_path = control_json[@"value"];
+//                if(signature_path.length>0)
+//                    result = [zip addFileToZip:signature_path newname:[signature_path lastPathComponent]];
+//            }
+//        }
+//    }
+    
+    if( ![zip CloseZipFile2] )
+    {
+        zippath = @"";
+    }
+    
+    
+    
+
+    
+    return zippath;
+}
+
++(NSDictionary*)request_DocList:(NSMutableDictionary*) params
+{
+//    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+//    if(appDelegate.user!=nil)
+//        [params setValue:appDelegate.user forKey:@"user"];
+//    
+//    
+//    if(appDelegate.password!=nil)
+//        [params setValue:appDelegate.password forKey:@"password"];
+    params[@"_operate"]=@"listIpad";
+    
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_REQUEST_DOC parameters:params file:nil];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+
+    return jsobj;
+}
+
++(NSDictionary *) updateNotes:(NSString*) doc_number notes:(NSString*)notes
+{
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    
+    
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+  
+    params[@"doc_number"]=doc_number;
+    params[@"notes"]=notes;
+    
+    params[@"_operate"]=@"updateNotes";
+    
+    if(![self IsNetworkAvailable])
+    {
+        DebugLog(@"NET ERR");
+        
+        return [RAUtils error_json:RESULT_NET_NOTAVAILABLE err_msg:nil];
+        //        return nil;
+    }
+    NSData* json=[self get_json:URL_UPDATE_NOTES parameters:params file:nil];
+    //if(json==nil)
+    
+    
+    if(json==nil)
+        return nil;
+    NSError *error=nil;
+    NSDictionary *jsobj = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+    int result = [[jsobj valueForKey:@"result"] intValue];
+    DebugLog(@"new_document result:%d",result);
+    
+    return jsobj;
+
+}
+
++(NSString *) getjsonPath:(NSString*) serial
+{
+    
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
+    NSString *cachefolder = [paths objectAtIndex:0];
+    
+    NSString *upfolder = [cachefolder stringByAppendingPathComponent:@"upload_data"];
+    upfolder = [upfolder stringByAppendingPathComponent:serial];
+    
+    NSString * jsonpath= [upfolder stringByAppendingPathComponent:@"json.json"];
+    return jsonpath;
+}
++(NSString *) getPDFPath:(NSString*) file
+{
+    
+    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
+    
+    NSString *saveDirectory=[paths objectAtIndex:0];
+
+    NSString *saveFileName=file ;
+    
+    NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
+    
+    
+    NSLog(@"%@",newFilePath);
+    return newFilePath;
+}
++(NSString *) offline_docnumber
+{
+//    return @"prefix123";
+    
+  
+        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    if( appDelegate.user==nil)
+        return nil;
+
+    
+    
+    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+    
+    NSDictionary* user_info = [defaults dictionaryForKey:appDelegate.user];
+    NSString* prefix=user_info[@"prefix"];
+    NSString* agentname=user_info[@"agent_name"];
+    appDelegate.agentName = agentname;
+    if(prefix==nil)
+        return nil;
+    long docint=[defaults integerForKey:prefix];
+    docint++;
+            [defaults removeObjectForKey:prefix];
+           [defaults setInteger:docint forKey:prefix];
+            [defaults synchronize];
+    
+    return [NSString stringWithFormat:@"%@%06ld",prefix,docint ];
+}
+
++ (int)heartBeat {
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    
+    [params setObject:@"getStatus" forKey:@"_operate"];
+    
+    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+    
+//    if(appDelegate.user!=nil)
+//        [params setValue:[AESCrypt AES128Encrypt:appDelegate.user  key:@"usai2010"] forKey:@"user"];
+//    if(appDelegate.password!=nil)
+//        [params setValue:[AESCrypt AES128Encrypt:appDelegate.password  key:@"usai2010"] forKey:@"password"];
+    
+    if(appDelegate.user!=nil)
+        [params setValue:appDelegate.user forKey:@"user"];
+    if(appDelegate.password!=nil)
+        [params setValue:appDelegate.password forKey:@"password"];
+    
+//    
+//    NSString *DeviceToken = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
+//    [params setValue:DeviceToken forKey:@"deviceid"];
+    
+    
+    NSData* json=[self get_json:URL_HEART_BEAT parameters:params file:nil];
+    if(json==nil)
+        return -1;
+    NSError *error=nil;
+    NSDictionary *resultDic = [NSJSONSerialization JSONObjectWithData:json options:NSJSONReadingMutableLeaves error:&error];
+
+    return [[resultDic objectForKey:@"result"] intValue];
+}
+
+@end

+ 19 - 19
Ants Contract/Granite Expo eSign/Granite Expo eSign/config.h

@@ -18,7 +18,7 @@
 //#define ENCRYPT_OFF
 # ifdef DEBUG
     #define NO_SAVE_VERIFY false
-    #define test_server
+//    #define test_server
     #define DEBUG_PDFSIG true
 # else
     #define NO_SAVE_VERIFY false
@@ -33,32 +33,32 @@
 
 #ifdef test_server
 //    #define  URL_ERR_LOG  @""
-//    #define  URL_UPDATE_AUTH  @"http://192.168.0.112/phpcms/index.php"
-//    #define  URL_UPLOAD_PDF  @"http://192.168.0.112/phpcms/index.php"
+//    #define  URL_UPDATE_AUTH  @"http://192.168.50.15:8888/index.php"
+//    #define  URL_UPLOAD_PDF  @"http://192.168.50.15:8888/index.php"
 //    #define  URL_LOGOUT  @"http://192.168.0.177/esign/admin.php"
 //    #define  URL_NEW_DOCUMENT  @"http://192.168.0.177/esign/admin.php"
 //    #define  URL_REQUEST_DOC  @"http://192.168.0.177/esign/admin.php"
 
 
     #define  URL_ERR_LOG  @""
-    #define  URL_UPDATE_AUTH  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define  URL_UPLOAD_PDF  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define  URL_LOGOUT  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define  URL_NEW_DOCUMENT  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define  URL_UPDATE_NOTES  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define  URL_REQUEST_DOC  @"http://192.168.0.112/phpcms/admin_v2.php"
-    #define URL_HEART_BEAT @"http://192.168.0.112/phpcms/admin_v2.php"
-#define URL_PRIVACY @"https://www.thegraniteexpo.com/privacyPolicy.htm"
+    #define  URL_UPDATE_AUTH  @"http://192.168.50.15:8888/admin_v2.php"
+    #define  URL_UPLOAD_PDF  @"http://192.168.50.15:8888/admin_v2.php"
+    #define  URL_LOGOUT  @"http://192.168.50.15:8888/admin_v2.php"
+    #define  URL_NEW_DOCUMENT  @"http://192.168.50.15:8888/admin_v2.php"
+    #define  URL_UPDATE_NOTES  @"http://192.168.50.15:8888/admin_v2.php"
+    #define  URL_REQUEST_DOC  @"http://192.168.50.15:8888/admin_v2.php"
+    #define URL_HEART_BEAT @"http://192.168.50.15:8888/admin_v2.php"
+    #define URL_PRIVACY @"https://ge.united-us.net/privacyPolicy.htm"
 #else
     #define  URL_ERR_LOG  @""
-    #define  URL_UPDATE_AUTH  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define  URL_UPLOAD_PDF  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define  URL_LOGOUT  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define  URL_REQUEST_DOC  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define  URL_NEW_DOCUMENT  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define  URL_UPDATE_NOTES  @"https://www.thegraniteexpo.com/admin_v2.php"
-    #define URL_HEART_BEAT @"https://www.thegraniteexpo.com/admin_v2.php"
-#define URL_PRIVACY @"https://www.thegraniteexpo.com/privacyPolicy.htm"
+    #define  URL_UPDATE_AUTH  @"https://ge.united-us.net/admin_v2.php"
+    #define  URL_UPLOAD_PDF  @"https://ge.united-us.net/admin_v2.php"
+    #define  URL_LOGOUT  @"https://ge.united-us.net/admin_v2.php"
+    #define  URL_REQUEST_DOC  @"https://ge.united-us.net/admin_v2.php"
+    #define  URL_NEW_DOCUMENT  @"https://ge.united-us.net/admin_v2.php"
+    #define  URL_UPDATE_NOTES  @"https://ge.united-us.net/admin_v2.php"
+    #define URL_HEART_BEAT @"https://ge.united-us.net/admin_v2.php"
+    #define URL_PRIVACY @"https://ge.united-us.net/privacyPolicy.htm"
 #endif
 
 #endif /* config_h */

+ 53 - 43
Ants Contract/common/AddExtDocumentViewController.m

@@ -13,7 +13,7 @@
 #import "const.h"
 #import "RAUtils.h"
 
-#import "ACNetwork.h"
+#import "RANetwork.h"
 
 #import "RAPDFViewController.h"
 #import "ScannerViewController.h"
@@ -231,21 +231,22 @@
     
 }
 - (IBAction)onAddFileClicked:(id)sender {
-    [RAUtils alert_view:@"To upload a file, you must share it from Third Party App." title:@"Upload"];
+    [RAUtils message_alert:@"To upload a file, you must share it from Third Party App." title:@"Upload" controller:self];
+//    [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
     return;
 }
 - (IBAction)onUploadClicked:(id)sender {
     
     if(self.arr_documents.count==0)
     {
-        [RAUtils alert_view:@"Upload list is empty." title:@"Upload"];
+        [RAUtils message_alert:@"Upload list is empty." title:@"Upload" controller:self];
         return;
     }
     
     NSString* docNumber = self.editDocNumber.text;
     if(docNumber.length==0)
     {
-        [RAUtils alert_view:@"Document number is empty." title:@"Upload"];
+        [RAUtils message_alert:@"Document number is empty." title:@"Upload" controller:self];
         return;
     }
     
@@ -263,56 +264,65 @@
         
         
     }
-    zipfile =[ACNetwork packfiles2zip:arr_files];
+    zipfile =[RANetwork packfiles2zip:arr_files];
     
     
     __weak typeof(self) weakSelf = self;
     
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Upload Documents"];
-    
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        NSDictionary* json = nil;
-        
-        
-        NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-        params[@"doc_number"]=docNumber;
-        json = [ACNetwork upload_file:zipfile params:params];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
+//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Upload Documents"];
+    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Upload Documents" completion:^{
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
+            NSDictionary* json = nil;
             
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-
             
-            if([[json valueForKey:@"result"] intValue]==2)
-            {
-                NSMutableArray* arr = [json[@"documents"] mutableCopy];
-                if(self.is_present)
-                [weakSelf dismissViewControllerAnimated:false completion:^{
-                                    if(weakSelf.uploadSuccess)
-                                        weakSelf.uploadSuccess(arr);
-                    
+            NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+            params[@"doc_number"]=docNumber;
+            json = [RANetwork upload_file:zipfile params:params];
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+                
+                
+//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                
+                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    if([[json valueForKey:@"result"] intValue]==2)
+                    {
+                        NSMutableArray* arr = [json[@"documents"] mutableCopy];
+                        if(self.is_present)
+                        [weakSelf dismissViewControllerAnimated:false completion:^{
+                                            if(weakSelf.uploadSuccess)
+                                                weakSelf.uploadSuccess(arr);
+                            
+                        }];
+                        else
+                        {
+                            if(weakSelf.uploadSuccess)
+                                weakSelf.uploadSuccess(arr);
+                            [self.navigationController popViewControllerAnimated:false];
+                        }
+                        
+        //                if(self.uploadSuccess)
+        //                    self.uploadSuccess(self.arr_documents);
+                        
+                    }
+                    else
+                    {
+                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
+                    }
                 }];
-                else
-                {
-                    if(weakSelf.uploadSuccess)
-                        weakSelf.uploadSuccess(arr);
-                    [self.navigationController popViewControllerAnimated:false];
-                }
+
                 
-//                if(self.uploadSuccess)
-//                    self.uploadSuccess(self.arr_documents);
+
                 
-            }
-            else
-            {
-                [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
-            }
-            
-            
+                
+            });
         });
-    });
+        
+    }];
+    
+    
+
     
 
 }

+ 2 - 2
Ants Contract/common/AppDelegate.m

@@ -7,7 +7,7 @@
 //
 
 #import "AppDelegate.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "TextUtils.h"
 #import "PDFUtils.h"
 #import "RAUtils.h"
@@ -532,7 +532,7 @@
     __weak typeof(self) weakself = self;
     dispatch_async(dispatch_get_global_queue(0, 0), ^{
        
-        int result = [ACNetwork heartBeat];
+        int result = [RANetwork heartBeat];
 //        int result = 2;
         
         if (result == 2) {

+ 41 - 33
Ants Contract/common/DocnotesViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "DocnotesViewController.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "RAUtils.h"
 
 
@@ -66,42 +66,50 @@
     self.docNumber = self.editDocNumber.text;
     self.docNotes = self.tvNotes.text;
     
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Notes"];
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        NSMutableDictionary* json=[[ACNetwork updateNotes:self.docNumber notes:self.docNotes ] mutableCopy];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Update Notes"];
+    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Update Notes" completion:^{
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             
-            if([json[@"result"] intValue]==RESULT_TRUE)
-                
-            {
-                [self dismissViewControllerAnimated:false completion:nil];
-//                DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
-//                
-//                //                dvc.templateName = @"debug.json";
-//                dvc.templateName = @"GEIC - Home Improvement Contract 2017.json";
-//                dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
-//                dvc.docment_id = json[@"doc_number"];
-//                dvc.OnSave=^(NSString* file, NSString* subject)
-//                {
-//                    
-//                    [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
-//                };
-//                
-//                [self.navigationController pushViewController:dvc animated:true];
-            }
-            else
-            {
-                [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Create Customer" controller:self] ;
-            }
-            
+            NSMutableDictionary* json=[[RANetwork updateNotes:self.docNumber notes:self.docNotes ] mutableCopy];
             
+            dispatch_async(dispatch_get_main_queue(), ^{
+//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                
+                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    if([json[@"result"] intValue]==RESULT_TRUE)
+                        
+                    {
+                        [self dismissViewControllerAnimated:false completion:nil];
+        //                DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
+        //
+        //                //                dvc.templateName = @"debug.json";
+        //                dvc.templateName = @"GEIC - Home Improvement Contract 2017.json";
+        //                dvc.pdfName = @"GEIC - Home Improvement Contract 2017.pdf";
+        //                dvc.docment_id = json[@"doc_number"];
+        //                dvc.OnSave=^(NSString* file, NSString* subject)
+        //                {
+        //
+        //                    [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
+        //                };
+        //
+        //                [self.navigationController pushViewController:dvc animated:true];
+                    }
+                    else
+                    {
+                        [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Create Customer" controller:self] ;
+                    }
+                }];
+                
+                
+
+                
+                
+            });
         });
-    });
+    }];
+    
+
     
     
 }

+ 53 - 46
Ants Contract/common/DocumentListViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "DocumentListViewController.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "DocListTableViewCell.h"
 #import "RAUtils.h"
 #import "GEContractFilterViewController.h"
@@ -347,7 +347,7 @@
     
     
    // self.filterparams = params;
-    content=[[ACNetwork request_DocList:self.filterparams]mutableCopy];
+    content=[[RANetwork request_DocList:self.filterparams]mutableCopy];
     
     
     dispatch_sync(dispatch_get_main_queue(), ^{
@@ -1059,52 +1059,59 @@
          __weak typeof(self) weakSelf = self;
         DebugLog(@"modify click");
         
-        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Downloading contract"];
-        dispatch_async(dispatch_get_global_queue(0, 0), ^{
-            NSData* jsondata= [NSData dataWithContentsOfURL:[NSURL URLWithString:jsonurl]];
-            NSData* pdfdata= [NSData dataWithContentsOfURL:[NSURL URLWithString:pdfurl]];
-            dispatch_async(dispatch_get_main_queue(), ^{
-                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                if(jsondata==nil||pdfdata==nil)
-                {
-                    
-                    [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
-                    return;
-                }
-                
-                NSString* tempDir = NSTemporaryDirectory();
-                
-                NSString* jsonpath=[tempDir stringByAppendingPathComponent:@"json.json"];
-                NSString* pdfpath=[tempDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.pdf",item_json[@"doc_number"]]];
-                [jsondata writeToFile:jsonpath atomically:true];
-                [pdfdata writeToFile:pdfpath atomically:true];
-                
-                NSString* md52 = [RAUtils md5WithFile:pdfpath];
-                if(md51.length>0&&![md51 isEqualToString:md52])
-                {
-                    
-                    [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
-                    return;
-                }
-                
-                
-                DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
-                
-                //                dvc.templateName = @"debug.json";
-                dvc.templatePath = jsonpath;
-                dvc.pdfPath = pdfpath;
-                dvc.action = PDFEditActionModify;
-                dvc.docment_id =  item_json[@"doc_number"];
-                dvc.OnSave=^(NSString* file, NSString* subject)
-                {
-                    
-                    [weakSelf previewPDF:file title:item_json[@"doc_number"] subject:subject islocal:true];
-                };
-                
-                [self.navigationController pushViewController:dvc animated:true];
+//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Downloading contract"];
+        
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Download contract" completion:^{
+            dispatch_async(dispatch_get_global_queue(0, 0), ^{
+                NSData* jsondata= [NSData dataWithContentsOfURL:[NSURL URLWithString:jsonurl]];
+                NSData* pdfdata= [NSData dataWithContentsOfURL:[NSURL URLWithString:pdfurl]];
+                dispatch_async(dispatch_get_main_queue(), ^{
+//                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                        if(jsondata==nil||pdfdata==nil)
+                        {
+                            
+                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+                            return;
+                        }
+                        
+                        NSString* tempDir = NSTemporaryDirectory();
+                        
+                        NSString* jsonpath=[tempDir stringByAppendingPathComponent:@"json.json"];
+                        NSString* pdfpath=[tempDir stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.pdf",item_json[@"doc_number"]]];
+                        [jsondata writeToFile:jsonpath atomically:true];
+                        [pdfdata writeToFile:pdfpath atomically:true];
+                        
+                        NSString* md52 = [RAUtils md5WithFile:pdfpath];
+                        if(md51.length>0&&![md51 isEqualToString:md52])
+                        {
+                            
+                            [RAUtils message_alert:@"Please try again."  title:@"Can not download contract" controller:self];
+                            return;
+                        }
+                        
+                        
+                        DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
+                        
+                        //                dvc.templateName = @"debug.json";
+                        dvc.templatePath = jsonpath;
+                        dvc.pdfPath = pdfpath;
+                        dvc.action = PDFEditActionModify;
+                        dvc.docment_id =  item_json[@"doc_number"];
+                        dvc.OnSave=^(NSString* file, NSString* subject)
+                        {
+                            
+                            [weakSelf previewPDF:file title:item_json[@"doc_number"] subject:subject islocal:true];
+                        };
+                        
+                        [self.navigationController pushViewController:dvc animated:true];
+                    }];
+
+                });
+
             });
+        }];
 
-        });
         
         
 //        [tableView reloadRowsAtIndexPaths:@[indexPath]withRowAnimation:UITableViewRowAnimationMiddle];

+ 112 - 106
Ants Contract/common/DocumentPageViewController.m

@@ -11,13 +11,13 @@
 #import "SignatureListViewController.h"
 #import "SignatureViewController.h"
 #import "PDFUtils.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 
 #import "dbgPageVC.h"
 
 //#import "AFHTTPSessionManager.h"
 #import "AppDelegate.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "RAUtils.h"
 //#import "PDFViewController.h"
 #import "config.h"
@@ -514,7 +514,7 @@
         pdffile = [PDFUtils SavePDF:self.controlTemplate source:self.document window_rect:CGRectMake(0, 0, 768, 960) name:self.docment_id isnew:self.action==PDFEditActionNew];
         }
         
-     zipfile=[ACNetwork prepareUploadFile:pdffile json:self.controlTemplate];
+     zipfile=[RANetwork prepareUploadFile:pdffile json:self.controlTemplate];
         
         //jsonfile = [ACNetwork getjsonPath:zip];
         
@@ -561,122 +561,128 @@
     }
     else
     {
-        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Saving"];
-        
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            NSDictionary* json = nil;
-            
-            
-            
-            json = [ACNetwork save_document:zipfile isnew:self.action==PDFEditActionNew];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
+//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Saving"];
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving" completion:^{
+            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                 
+                NSDictionary* json = nil;
                 
-                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                //                if([[logout_json valueForKey:@"result"] intValue]==2)
-                //                {
-                //                    self.welcomeLabel.text=@"Not sign in";
-                //                    //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
-                //                    [bbitem setTitle:@"Sign in"];
-                //
-                //                    self.buttonHIC.enabled = false;
-                //                    self.buttonSRL.enabled = false;
-                //                    self.coverView.hidden = false;
-                //                }
-                //                else
-                //                {
-                //                    [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
-                //                }
                 
-                if([[json valueForKey:@"result"] intValue]==2)
-                {
-                    
-                    
-                    [weakSelf.navigationController popViewControllerAnimated:false];
-                    if(weakSelf.OnSave)
-                        weakSelf.OnSave(pdffile,json[@"subject"]);
-                    
-                    
-                }
-                else
-                {
-//                    [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save document" controller:self] ;
-                    
-                    if(self.hide_control)
-                    {
-                        //提交离线合同
-                        [RAUtils message_alert:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
-                        return;
-                    }
-                    
-                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
+                
+                json = [RANetwork save_document:zipfile isnew:self.action==PDFEditActionNew];
+                
+                dispatch_async(dispatch_get_main_queue(), ^{
                     
                     
-                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-                        __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
-                        if(offline_docnumber==nil)
+//                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                    [waitalert dismissViewControllerAnimated:YES completion:^{
+                        if([[json valueForKey:@"result"] intValue]==2)
                         {
-                            [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
-                            return;
+                            
+                            
+                            [weakSelf.navigationController popViewControllerAnimated:false];
+                            if(weakSelf.OnSave)
+                                weakSelf.OnSave(pdffile,json[@"subject"]);
+                            
+                            
+                        }
+                        else
+                        {
+        //                    [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save document" controller:self] ;
+                            
+                            if(self.hide_control)
+                            {
+                                //提交离线合同
+                                [RAUtils message_alert:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
+                                return;
+                            }
+                            
+                            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
+                            
+                            
+                            UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+                                __block NSString* offline_docnumber =[RANetwork offline_docnumber];
+                                if(offline_docnumber==nil)
+                                {
+                                    [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+                                    return;
+                                }
+                                [appDelegate SwitchToOffline:appDelegate.user];
+                                
+                                
+                                NSMutableDictionary * json = [[NSMutableDictionary alloc]init];
+                                
+                                json[@"json"]=@"json.json";
+                                json[@"pdf"]=pdffile.lastPathComponent;
+                                json[@"zip"]=zipfile.lastPathComponent;
+                                json[@"serial"]=[json[@"zip"] stringByDeletingPathExtension];
+                                
+                                
+                                
+                                json[@"create_by"]=appDelegate.user;
+                                
+                                
+                                json[@"agent_name"]=[self extract_data:@"agent_name"];
+                                json[@"doc_number"]=[self extract_data:@"doc_number"];
+                                json[@"job_date"]=[self extract_data:@"job_date"];
+                                json[@"customer_name"]=[self extract_data:@"customer_name"];
+                                json[@"signed_date"]=[self extract_data:@"signed_date"];
+                                
+                                
+                                
+                                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+                                NSMutableArray * arr_pending = [[defaults arrayForKey:@"pending_doc"] mutableCopy];
+                                if(arr_pending==nil)
+                                    arr_pending = [[NSMutableArray alloc]init];
+                                [arr_pending addObject:json];
+                                [defaults setObject:arr_pending forKey:@"pending_doc"];
+                                [defaults synchronize];
+                                
+                                
+                                [weakSelf.navigationController popViewControllerAnimated:false];
+                                if(weakSelf.OnSave)
+                                    weakSelf.OnSave(pdffile,@"");
+                                
+                                
+                            }];
+                            
+                            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                                DebugLog(@"Cancel");
+                            }];
+                            [alertControl addAction:actionOne];
+                            
+                            [alertControl addAction:alertthree];
+                            
+                            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                            
+                            
+                            [self presentViewController:alertControl animated:YES completion:nil];
+                            
                         }
-                        [appDelegate SwitchToOffline:appDelegate.user];
-                        
-                        
-                        NSMutableDictionary * json = [[NSMutableDictionary alloc]init];
-                        
-                        json[@"json"]=@"json.json";
-                        json[@"pdf"]=pdffile.lastPathComponent;
-                        json[@"zip"]=zipfile.lastPathComponent;
-                        json[@"serial"]=[json[@"zip"] stringByDeletingPathExtension];
-                        
-                        
-                        
-                        json[@"create_by"]=appDelegate.user;
-                        
-                        
-                        json[@"agent_name"]=[self extract_data:@"agent_name"];
-                        json[@"doc_number"]=[self extract_data:@"doc_number"];
-                        json[@"job_date"]=[self extract_data:@"job_date"];
-                        json[@"customer_name"]=[self extract_data:@"customer_name"];
-                        json[@"signed_date"]=[self extract_data:@"signed_date"];
-                        
-                        
-                        
-                        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                        NSMutableArray * arr_pending = [[defaults arrayForKey:@"pending_doc"] mutableCopy];
-                        if(arr_pending==nil)
-                            arr_pending = [[NSMutableArray alloc]init];
-                        [arr_pending addObject:json];
-                        [defaults setObject:arr_pending forKey:@"pending_doc"];
-                        [defaults synchronize];
-                        
-                        
-                        [weakSelf.navigationController popViewControllerAnimated:false];
-                        if(weakSelf.OnSave)
-                            weakSelf.OnSave(pdffile,@"");
-                        
-                        
-                    }];
-                    
-                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                        DebugLog(@"Cancel");
                     }];
-                    [alertControl addAction:actionOne];
-                    
-                    [alertControl addAction:alertthree];
+                    //                if([[logout_json valueForKey:@"result"] intValue]==2)
+                    //                {
+                    //                    self.welcomeLabel.text=@"Not sign in";
+                    //                    //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
+                    //                    [bbitem setTitle:@"Sign in"];
+                    //
+                    //                    self.buttonHIC.enabled = false;
+                    //                    self.buttonSRL.enabled = false;
+                    //                    self.coverView.hidden = false;
+                    //                }
+                    //                else
+                    //                {
+                    //                    [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
+                    //                }
                     
-                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
                     
                     
-                    [self presentViewController:alertControl animated:YES completion:nil];
                     
-                }
-                
-                
+                });
             });
-        });
+        }];
+        
+
     }
     
     

+ 1 - 1
Ants Contract/common/LoginViewController.h

@@ -7,7 +7,7 @@
 //
 
 #import <UIKit/UIKit.h>
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "AESCrypt.h"
 //#import "MyAutocompleteView.h"
 @class LoginViewController;

+ 135 - 125
Ants Contract/common/LoginViewController.m

@@ -10,7 +10,7 @@
 
 
 #import "RAUtils.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "AppDelegate.h"
 
 
@@ -190,7 +190,8 @@
         //        [alert show];
         
         
-        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
+//        [RAUtils alert_view:@"Username or Password cannot be blank." title:@"Cannot sign-in"];
+        [RAUtils message_alert:@"Username or Password cannot be blank." title:@"Cannot sign-in" controller:self];
         return;
     }
     DebugLog(@"Login...   user= %@ ; password= %@",user,password);
@@ -199,146 +200,155 @@
     
     
     self.btnLogin.enabled = false;
-    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign in"];
-    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-        
-        
-        int ret=[ACNetwork  Authorize:user password:password];
-        
-        dispatch_async(dispatch_get_main_queue(), ^{
-            [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-            self.btnLogin.enabled = true;
+//    UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign in"];
+    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign in" completion:^{
+        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
-            if(ret==RESULT_TRUE)
-                
-            {
-               
-                //
-                //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
-                AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
-                //                appDelegate.contact_id=contactid;
-                //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
-                
-                NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                [defaults removeObjectForKey:@"user"];
-                [defaults removeObjectForKey:@"password"];
-                NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
-                NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
-                
-                
-//                long index =[self.logindata indexOfObject:appDelegate.user];
-                if(![self.logindata containsObject:appDelegate.user])
-                {
-                    [self.logindata addObject:appDelegate.user];
-                    NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES];
-                    self.logindata = [[self.logindata sortedArrayUsingDescriptors:[NSArray arrayWithObjects:sortDescriptor,nil]] mutableCopy];
-                }
-                [defaults setObject:self.logindata forKey:@"login_data"];
-                
-                
-                
-                
-                if(self.checkSavePassword.selected)
-                {
-                    
-                    [defaults setValue:encryptu forKey:@"user"];
-                    [defaults setValue:encryptp forKey:@"password"];
-//                    sqlite3 *db = [iSalesDB get_db];
-//                    
-//                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
-//                    
-//                    if(count==0)
-//                    {
-//                        
-//                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
-//                        [iSalesDB execSql:savelogin db:db];
-//                    }
-//                    else
-//                    {
-//                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
-//                        [iSalesDB execSql:savelogin db:db];
-//                    }
-//                    
-//                    [iSalesDB close_db:db];
-                    
-                    //                    [defaults setBool:TRUE forKey:@"autologin"];
-                }
-//                else
-//                {
-//                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
-//                    [iSalesDB execSql:sql];
-//                }
-                [defaults synchronize];
-                
-                [self dismissViewControllerAnimated:YES completion:^{
-                    
-//                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-                    
-//                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
-//                    sqlite3* db = [iSalesDB get_db];
-//                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
-//                    
-//                    [iSalesDB close_db:db];
-                    
-                    
+            
+            int ret=[RANetwork  Authorize:user password:password];
+            
+            dispatch_async(dispatch_get_main_queue(), ^{
+//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    self.btnLogin.enabled = true;
                     
-
-                  //  else
+                    if(ret==RESULT_TRUE)
+                        
                     {
-                    if(self.returnValue)
-                        self.returnValue(true);
-//                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
-                    }
-                        }];
+                       
+                        //
+                        //                NSString* contactid=[self.content_data[indexPath.row] valueForKey:@"contact_id"] ;
+                        AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+                        //                appDelegate.contact_id=contactid;
+                        //                appDelegate.contact_name =[self.content_data[indexPath.row] valueForKey:@"name"];
+                        
+                        NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+                        [defaults removeObjectForKey:@"user"];
+                        [defaults removeObjectForKey:@"password"];
+                        NSString* encryptu=[AESCrypt encrypt:appDelegate.user password:@"usai"];
+                        NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
+                        
+                        
+        //                long index =[self.logindata indexOfObject:appDelegate.user];
+                        if(![self.logindata containsObject:appDelegate.user])
+                        {
+                            [self.logindata addObject:appDelegate.user];
+                            NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES];
+                            self.logindata = [[self.logindata sortedArrayUsingDescriptors:[NSArray arrayWithObjects:sortDescriptor,nil]] mutableCopy];
+                        }
+                        [defaults setObject:self.logindata forKey:@"login_data"];
+                        
+                        
+                        
+                        
+                        if(self.checkSavePassword.selected)
+                        {
+                            
+                            [defaults setValue:encryptu forKey:@"user"];
+                            [defaults setValue:encryptp forKey:@"password"];
+        //                    sqlite3 *db = [iSalesDB get_db];
+        //
+        //                    int count =[iSalesDB get_recordcount:db table:@"login_info" where:[NSString stringWithFormat:@"name='%@'",encryptu]];
+        //
+        //                    if(count==0)
+        //                    {
+        //
+        //                        NSString * savelogin=[NSString stringWithFormat:@"insert into login_info(name,pwd) values('%@','%@')",encryptu,encryptp];
+        //                        [iSalesDB execSql:savelogin db:db];
+        //                    }
+        //                    else
+        //                    {
+        //                        NSString * savelogin=[NSString stringWithFormat:@"update login_info set pwd='%@' where name='%@'",encryptp,encryptu];
+        //                        [iSalesDB execSql:savelogin db:db];
+        //                    }
+        //
+        //                    [iSalesDB close_db:db];
+                            
+                            //                    [defaults setBool:TRUE forKey:@"autologin"];
+                        }
+        //                else
+        //                {
+        //                    NSString* sql=[NSString stringWithFormat:@"delete from login_info where name='%@'",encryptu];
+        //                    [iSalesDB execSql:sql];
+        //                }
+                        [defaults synchronize];
+                        
+                        [self dismissViewControllerAnimated:YES completion:^{
+                            
+        //                    NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+                            
+        //                    bool offline_dirty=[defaults boolForKey:@"OFFLINE_DIRTY"];
+        //                    sqlite3* db = [iSalesDB get_db];
+        //                    int offline_user_exist=[iSalesDB get_recordcount:db table:@"offline_login" where:[NSString stringWithFormat:@"username='%@'",appDelegate.user ]];
+        //
+        //                    [iSalesDB close_db:db];
+                            
+                            
+                            
+
+                          //  else
+                            {
+                            if(self.returnValue)
+                                self.returnValue(true);
+        //                    [[NSNotificationCenter defaultCenter] postNotificationName:LoginOK_HandleUrgencyFile_Notification object:nil];
+                            }
+                                }];
 
 
-                
-                //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
-                //                    [self.delegate LoginViewControllerDidLogin:self];
-                //                }
-                
-//                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
-            }
-            else
-            {
-                NSString* msg=nil;
-                
-                switch (ret) {
                         
-                    case RESULT_NET_NOTAVAILABLE:
-                        msg = MSG_NET_NOTAVAILABLE;
-                        break;
+                        //                if (self.delegate && [self.delegate respondsToSelector:@selector(LoginViewControllerDidLogin:)]) {
+                        //                    [self.delegate LoginViewControllerDidLogin:self];
+                        //                }
                         
+        //                [[NSNotificationCenter defaultCenter] postNotificationName:User_LoginOK_Notification object:nil];
+                    }
+                    else
+                    {
+                        NSString* msg=nil;
                         
-                    case RESULT_NET_ERROR:
-                        msg = MSG_NET_ERROR;
-                        break;
+                        switch (ret) {
+                                
+                            case RESULT_NET_NOTAVAILABLE:
+                                msg = MSG_NET_NOTAVAILABLE;
+                                break;
+                                
+                                
+                            case RESULT_NET_ERROR:
+                                msg = MSG_NET_ERROR;
+                                break;
+                                
+                                
+                            case RESULT_FALSE:
+                                msg = MSG_USERAUTH_ERROR;
+                                break;
+                                
+                            case RESULT_VER_LOW:
+                                msg = MSG_VER_LOW;
+                                break;
+                                
+                            case RESULT_LOGIN_DEVICE:
+                                msg= MSG_LOGIN_DEVICE;
+                                break;
+                            default:
+                                break;
+                        }
                         
+//                        [RAUtils alert_view:msg title:@"Cannot sign-in"];
                         
-                    case RESULT_FALSE:
-                        msg = MSG_USERAUTH_ERROR;
-                        break;
+                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
                         
-                    case RESULT_VER_LOW:
-                        msg = MSG_VER_LOW;
-                        break;
                         
-                    case RESULT_LOGIN_DEVICE:
-                        msg= MSG_LOGIN_DEVICE;
-                        break;
-                    default:
-                        break;
-                }
+                        
+                    }
+                }];
                 
-                [RAUtils alert_view:msg title:@"Cannot sign-in"];
                 
                 
                 
-            }
-            
-            
+            });
         });
-    });
+    }];
+
     
     
     

+ 3 - 3
Ants Contract/common/PendingDocumentsViewController.m

@@ -7,7 +7,7 @@
 //
 
 #import "PendingDocumentsViewController.h"
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "PendingDocumentsTableViewCell.h"
 #import "RAUtils.h"
 #import "GEContractFilterViewController.h"
@@ -551,8 +551,8 @@
     
     //                dvc.templateName = @"debug.json";
     
-    dvc.templatePath = [ACNetwork getjsonPath:item_json[@"serial"]];
-    dvc.pdfPath = [ACNetwork getPDFPath:item_json[@"pdf"]] ;
+    dvc.templatePath = [RANetwork getjsonPath:item_json[@"serial"]];
+    dvc.pdfPath = [RANetwork getPDFPath:item_json[@"pdf"]] ;
     
     dvc.hide_control =true;
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];

+ 100 - 84
Ants Contract/common/RootViewController.m

@@ -16,7 +16,7 @@
 #import "DocumentListViewController.h"
 #import "PendingDocumentsViewController.h"
 
-#import "ACNetwork.h"
+#import "RANetwork.h"
 #import "PDFUtils.h"
 #import "AddExtDocumentViewController.h"
 #import "config.h"
@@ -272,7 +272,7 @@
     AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     if(appDelegate.accessMode == AppAccessModeOffline)
     {
-        __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
+        __block NSString* offline_docnumber =[RANetwork offline_docnumber];
         
         if(offline_docnumber==nil)
         {
@@ -301,86 +301,95 @@
         
         
         
-        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Create customer"];
+//        UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Create customer"];
+        
+        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create customer" completion:^{
         dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
             
             
-            NSMutableDictionary* json=[[ACNetwork  new_document] mutableCopy];
+            NSMutableDictionary* json=[[RANetwork  new_document] mutableCopy];
             
             dispatch_async(dispatch_get_main_queue(), ^{
-                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
                 
                 
-                if([json[@"result"] intValue]==RESULT_TRUE)
-                    
-                {
-                    DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
-                    
-                    //                dvc.templateName = @"debug.json";
-                    dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.json" ofType:nil];
-                    dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.pdf" ofType:nil];
-                    dvc.docment_id = json[@"doc_number"];
-                    dvc.OnSave=^(NSString* file, NSString* subject)
-                    {
+                
+//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                
+                
+                [waitalert dismissViewControllerAnimated:YES completion:^{
+                    if([json[@"result"] intValue]==RESULT_TRUE)
                         
-                        [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
-                    };
-                    
-                    [self.navigationController pushViewController:dvc animated:true];
-                }
-                else
-                {
-                    //                [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Create Customer" controller:self] ;
-                    
-                    UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
-                    
-                    
-                    UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
-                        __block NSString* offline_docnumber =[ACNetwork offline_docnumber];
-                        if(offline_docnumber==nil)
-                        {
-                            [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
-                            return;
-                        }
-                        [appDelegate SwitchToOffline:appDelegate.user];
+                    {
                         DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
                         
                         //                dvc.templateName = @"debug.json";
                         dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.json" ofType:nil];
                         dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.pdf" ofType:nil];
-
-                        dvc.docment_id =  offline_docnumber;
+                        dvc.docment_id = json[@"doc_number"];
                         dvc.OnSave=^(NSString* file, NSString* subject)
                         {
                             
-                            [weakSelf previewPDF:file title:offline_docnumber subject:subject];
+                            [weakSelf previewPDF:file title:json[@"doc_number"] subject:subject];
                         };
                         
                         [self.navigationController pushViewController:dvc animated:true];
+                    }
+                    else
+                    {
+                        //                [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Create Customer" controller:self] ;
                         
+                        UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
                         
-                    }];
-                    
-                    UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                        DebugLog(@"Cancel");
-                    }];
-                    [alertControl addAction:actionOne];
-                    
-                    [alertControl addAction:alertthree];
-                    
-                    //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
-                    
-                    
-                    [self presentViewController:alertControl animated:YES completion:nil];
-                    
-                    
-                }
+                        
+                        UIAlertAction *actionOne = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDestructive handler:^(UIAlertAction *action) {
+                            __block NSString* offline_docnumber =[RANetwork offline_docnumber];
+                            if(offline_docnumber==nil)
+                            {
+                                [RAUtils message_alert:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  title:@"Create Customer" controller:self] ;
+                                return;
+                            }
+                            [appDelegate SwitchToOffline:appDelegate.user];
+                            DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
+                            
+                            //                dvc.templateName = @"debug.json";
+                            dvc.templatePath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.json" ofType:nil];
+                            dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"2020 GECI - Home Improvement Contract.pdf" ofType:nil];
+
+                            dvc.docment_id =  offline_docnumber;
+                            dvc.OnSave=^(NSString* file, NSString* subject)
+                            {
+                                
+                                [weakSelf previewPDF:file title:offline_docnumber subject:subject];
+                            };
+                            
+                            [self.navigationController pushViewController:dvc animated:true];
+                            
+                            
+                        }];
+                        
+                        UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
+                            DebugLog(@"Cancel");
+                        }];
+                        [alertControl addAction:actionOne];
+                        
+                        [alertControl addAction:alertthree];
+                        
+                        //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                        
+                        
+                        [self presentViewController:alertControl animated:YES completion:nil];
+                        
+                        
+                    }
+                }];
+                
+ 
                 
                 
             });
         });
         
-        
+        }];
         
     }
     
@@ -578,40 +587,47 @@
         UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Yes" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
             
             
-            UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign out"];
-            
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                
-                NSDictionary* logout_json = nil;
-                
-                
-                
-                logout_json = [ACNetwork logout];
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
+//            UIAlertView * waitalert = [RAUtils waiting_alert:@"Please wait..." title:@"Sign out"];
+            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
+                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
                     
-                    
-                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                    if([[logout_json valueForKey:@"result"] intValue]==2)
-                    {
-                        self.welcomeLabel.text=@"Not sign in";
-                        //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
-                        [bbitem setTitle:@"Sign in"];
-                        
-                        self.buttonHIC.enabled = false;
-                        self.buttonSRL.enabled = false;
-                        self.coverView.hidden = false;
-                    }
-                    else
-                    {
-                        [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
-                    }
+                    NSDictionary* logout_json = nil;
                     
                     
                     
+                    logout_json = [RANetwork logout];
                     
+                    dispatch_async(dispatch_get_main_queue(), ^{
+                        
+                        
+//                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+                        
+                        [waitalert dismissViewControllerAnimated:YES completion:^{
+                            if([[logout_json valueForKey:@"result"] intValue]==2)
+                            {
+                                self.welcomeLabel.text=@"Not sign in";
+                                //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
+                                [bbitem setTitle:@"Sign in"];
+                                
+                                self.buttonHIC.enabled = false;
+                                self.buttonSRL.enabled = false;
+                                self.coverView.hidden = false;
+                            }
+                            else
+                            {
+                                [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
+                            }
+                        }];
+
+                        
+                        
+                        
+                        
+                    });
                 });
-            });
+            }];
+            
+