Преглед изворни кода

eSign 1.75

compatible fix
bug fix
update contract
Ray Zhang пре 2 година
родитељ
комит
8bd438ca91
32 измењених фајлова са 1767 додато и 1018 уклоњено
  1. 1 28
      Ants Contract/AntsContract/AntsContract/Base.lproj/Main.storyboard
  2. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Bin & J W Inc.pdf
  3. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Fong Huang.pdf
  4. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Jim Xu.pdf
  5. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - LA House.pdf
  6. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf
  7. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf
  8. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - TN CABINETRY.pdf
  9. BIN
      Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Tan.pdf
  10. 8 8
      Ants Contract/Granite Expo eSign/Granite Expo eSign.xcodeproj/project.pbxproj
  11. 16 16
      Ants Contract/Granite Expo eSign/Granite Expo eSign/DocumentTemplateViewController.m
  12. 31 8
      Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.h
  13. 670 332
      Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.m
  14. 2 2
      Ants Contract/Granite Expo eSign/Granite Expo eSign/RASingleton.h
  15. 1 1
      Ants Contract/Granite Expo eSign/Granite Expo eSign/Template Attributes /AttributeTableDataSourceAndDelegate.m
  16. 71 51
      Ants Contract/Granite Expo eSign/Granite Expo eSign/TemplateViewController.m
  17. 2 2
      Ants Contract/Granite Expo eSign/Granite Expo eSign/config.h
  18. 19 11
      Ants Contract/Granite Expo eSign/Granite Expo eSign/const.h
  19. 0 0
      Ants Contract/Granite Expo eSign/template_07_14_2023_14_35_47.json
  20. 1 1
      Ants Contract/common/AddExtDocumentViewController.h
  21. 84 47
      Ants Contract/common/AddExtDocumentViewController.m
  22. 103 84
      Ants Contract/common/AppDelegate.m
  23. 57 40
      Ants Contract/common/DocnotesViewController.m
  24. 104 34
      Ants Contract/common/DocumentListViewController.m
  25. 217 118
      Ants Contract/common/DocumentPageViewController.m
  26. 2 2
      Ants Contract/common/ExtDocumentsViewController.m
  27. 116 105
      Ants Contract/common/LoginViewController.m
  28. 67 49
      Ants Contract/common/PageViewController.m
  29. 1 1
      Ants Contract/common/PendingDocumentsViewController.m
  30. 188 73
      Ants Contract/common/RootViewController.m
  31. 1 1
      Ants Contract/common/SignatureListViewController.h
  32. 5 4
      Ants Contract/common/SignatureListViewController.m

+ 1 - 28
Ants Contract/AntsContract/AntsContract/Base.lproj/Main.storyboard

@@ -328,33 +328,6 @@
             </objects>
             </objects>
             <point key="canvasLocation" x="2798.4375" y="-36.328125"/>
             <point key="canvasLocation" x="2798.4375" y="-36.328125"/>
         </scene>
         </scene>
-        <!--View Controller-->
-        <scene sceneID="t1D-LS-e1c">
-            <objects>
-                <viewController id="i6d-QF-jHn" sceneMemberID="viewController">
-                    <view key="view" contentMode="scaleToFill" id="Ysi-rt-TDx">
-                        <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
-                        <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
-                        <subviews>
-                            <textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VCV-oY-agH">
-                                <rect key="frame" x="210" y="345" width="409" height="199"/>
-                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
-                                <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                                <string key="text">textAlignment
-textAlignment
-textAlignment</string>
-                                <fontDescription key="fontDescription" name=".AppleSystemUIFont" family=".AppleSystemUIFont" pointSize="21"/>
-                                <textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
-                            </textView>
-                        </subviews>
-                        <viewLayoutGuide key="safeArea" id="oWp-Va-tHh"/>
-                        <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
-                    </view>
-                </viewController>
-                <placeholder placeholderIdentifier="IBFirstResponder" id="Od8-0Y-umN" userLabel="First Responder" sceneMemberID="firstResponder"/>
-            </objects>
-            <point key="canvasLocation" x="2348.4375" y="716.015625"/>
-        </scene>
         <!--Document Page-->
         <!--Document Page-->
         <scene sceneID="8dr-IV-sOm">
         <scene sceneID="8dr-IV-sOm">
             <objects>
             <objects>
@@ -560,7 +533,7 @@ textAlignment</string>
                         </constraints>
                         </constraints>
                     </view>
                     </view>
                     <navigationItem key="navigationItem" title="NPD" id="mpw-4j-jbv">
                     <navigationItem key="navigationItem" title="NPD" id="mpw-4j-jbv">
-                        <barButtonItem key="rightBarButtonItem" image="close" style="plain" id="pGR-8o-BHM">
+                        <barButtonItem key="rightBarButtonItem" image="close" id="pGR-8o-BHM">
                             <connections>
                             <connections>
                                 <action selector="CloseClick:" destination="WUP-k6-BVt" id="gJJ-fM-5Wz"/>
                                 <action selector="CloseClick:" destination="WUP-k6-BVt" id="gJJ-fM-5Wz"/>
                             </connections>
                             </connections>

BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Bin & J W Inc.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Fong Huang.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Jim Xu.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - LA House.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - TN CABINETRY.pdf


BIN
Ants Contract/Granite Expo eSign/GECI - Home Improvement Contract - Tan.pdf


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

@@ -12,11 +12,10 @@
 		3C64CA9E29B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9629B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf */; };
 		3C64CA9E29B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9629B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf */; };
 		3C64CA9F29B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9729B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf */; };
 		3C64CA9F29B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9729B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf */; };
 		3C64CAA029B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */; };
 		3C64CAA029B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */; };
-		3C64CAA129B8605C00CB0B07 /* GECI - Home Improvement Contract - Wilson Ma.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9929B8605C00CB0B07 /* GECI - Home Improvement Contract - Wilson Ma.pdf */; };
 		3C64CAA229B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */; };
 		3C64CAA229B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */; };
 		3C64CAA329B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9B29B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf */; };
 		3C64CAA329B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9B29B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf */; };
 		3C64CAA429B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9C29B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf */; };
 		3C64CAA429B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CA9C29B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf */; };
-		3C64CAA829B8646A00CB0B07 /* template_03_08_2023_14_35_47.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CAA729B8646A00CB0B07 /* template_03_08_2023_14_35_47.json */; };
+		3C64CAA829B8646A00CB0B07 /* template_07_14_2023_14_35_47.json in Resources */ = {isa = PBXBuildFile; fileRef = 3C64CAA729B8646A00CB0B07 /* template_07_14_2023_14_35_47.json */; };
 		3C64CAAD29BB12C800CB0B07 /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C64CAAC29BB12C800CB0B07 /* RASingleton.m */; };
 		3C64CAAD29BB12C800CB0B07 /* RASingleton.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C64CAAC29BB12C800CB0B07 /* RASingleton.m */; };
 		3C69617C23C70ECF0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617B23C70ECF0075172A /* WebViewController.m */; };
 		3C69617C23C70ECF0075172A /* WebViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C69617B23C70ECF0075172A /* WebViewController.m */; };
 		3C6B627E27102F6800E74CF9 /* CommonEditor.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C6B627D27102F6800E74CF9 /* CommonEditor.storyboard */; };
 		3C6B627E27102F6800E74CF9 /* CommonEditor.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3C6B627D27102F6800E74CF9 /* CommonEditor.storyboard */; };
@@ -31,6 +30,7 @@
 		3C9FFAAF274B908E0067830C /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFAAE274B908E0067830C /* RTLabel.m */; };
 		3C9FFAAF274B908E0067830C /* RTLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFAAE274B908E0067830C /* RTLabel.m */; };
 		3C9FFAB2274B91610067830C /* EnumSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFAB1274B91610067830C /* EnumSelectorCell.m */; };
 		3C9FFAB2274B91610067830C /* EnumSelectorCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C9FFAB1274B91610067830C /* EnumSelectorCell.m */; };
 		3CBB92F2248A26EB0099E429 /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBB92F1248A26EB0099E429 /* NetworkUtils.m */; };
 		3CBB92F2248A26EB0099E429 /* NetworkUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CBB92F1248A26EB0099E429 /* NetworkUtils.m */; };
+		3CBC873B2A61476400978758 /* GECI - Home Improvement Contract - TN CABINETRY.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 3CBC873A2A61476400978758 /* GECI - Home Improvement Contract - TN CABINETRY.pdf */; };
 		3CC7E73423BEDE9700BE5561 /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73323BEDE9700BE5561 /* RAPDFViewController.m */; };
 		3CC7E73423BEDE9700BE5561 /* RAPDFViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73323BEDE9700BE5561 /* RAPDFViewController.m */; };
 		3CC7E73623BEDEA000BE5561 /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E73523BEDEA000BE5561 /* wkweb.storyboard */; };
 		3CC7E73623BEDEA000BE5561 /* wkweb.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 3CC7E73523BEDEA000BE5561 /* wkweb.storyboard */; };
 		3CC7E73C23BEE07900BE5561 /* RANetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73B23BEE07900BE5561 /* RANetwork.m */; };
 		3CC7E73C23BEE07900BE5561 /* RANetwork.m in Sources */ = {isa = PBXBuildFile; fileRef = 3CC7E73B23BEE07900BE5561 /* RANetwork.m */; };
@@ -118,11 +118,10 @@
 		3C64CA9629B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Fong Huang.pdf"; sourceTree = "<group>"; };
 		3C64CA9629B8605C00CB0B07 /* GECI - Home Improvement Contract - Fong Huang.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Fong Huang.pdf"; sourceTree = "<group>"; };
 		3C64CA9729B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Bin & J W Inc.pdf"; sourceTree = "<group>"; };
 		3C64CA9729B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Bin & J W Inc.pdf"; sourceTree = "<group>"; };
 		3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf"; sourceTree = "<group>"; };
 		3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf"; sourceTree = "<group>"; };
-		3C64CA9929B8605C00CB0B07 /* GECI - Home Improvement Contract - Wilson Ma.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Wilson Ma.pdf"; sourceTree = "<group>"; };
 		3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf"; sourceTree = "<group>"; };
 		3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf"; sourceTree = "<group>"; };
 		3C64CA9B29B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - LA House.pdf"; sourceTree = "<group>"; };
 		3C64CA9B29B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - LA House.pdf"; sourceTree = "<group>"; };
 		3C64CA9C29B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Jim Xu.pdf"; sourceTree = "<group>"; };
 		3C64CA9C29B8605C00CB0B07 /* GECI - Home Improvement Contract - Jim Xu.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - Jim Xu.pdf"; sourceTree = "<group>"; };
-		3C64CAA729B8646A00CB0B07 /* template_03_08_2023_14_35_47.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = template_03_08_2023_14_35_47.json; sourceTree = "<group>"; };
+		3C64CAA729B8646A00CB0B07 /* template_07_14_2023_14_35_47.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = template_07_14_2023_14_35_47.json; sourceTree = "<group>"; };
 		3C64CAAB29BB12C800CB0B07 /* RASingleton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RASingleton.h; sourceTree = "<group>"; };
 		3C64CAAB29BB12C800CB0B07 /* RASingleton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RASingleton.h; sourceTree = "<group>"; };
 		3C64CAAC29BB12C800CB0B07 /* RASingleton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASingleton.m; sourceTree = "<group>"; };
 		3C64CAAC29BB12C800CB0B07 /* RASingleton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RASingleton.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>"; };
 		3C69617A23C70ECF0075172A /* WebViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebViewController.h; path = "../../../common/WK PDF+Web/WebViewController.h"; sourceTree = "<group>"; };
@@ -150,6 +149,7 @@
 		3C9FFAB1274B91610067830C /* EnumSelectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EnumSelectorCell.m; path = ../../../common/customUI/commoneditor/EnumSelectorCell.m; sourceTree = "<group>"; };
 		3C9FFAB1274B91610067830C /* EnumSelectorCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = EnumSelectorCell.m; path = ../../../common/customUI/commoneditor/EnumSelectorCell.m; sourceTree = "<group>"; };
 		3CBB92F0248A26EB0099E429 /* NetworkUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NetworkUtils.h; path = ../../../common/NetworkUtils.h; 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>"; };
 		3CBB92F1248A26EB0099E429 /* NetworkUtils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NetworkUtils.m; path = ../../../common/NetworkUtils.m; sourceTree = "<group>"; };
+		3CBC873A2A61476400978758 /* GECI - Home Improvement Contract - TN CABINETRY.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = "GECI - Home Improvement Contract - TN CABINETRY.pdf"; 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>"; };
 		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>"; };
 		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>"; };
 		3CC7E73523BEDEA000BE5561 /* wkweb.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = wkweb.storyboard; path = "../../../common/WK PDF+Web/wkweb.storyboard"; sourceTree = "<group>"; };
@@ -616,8 +616,8 @@
 				3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */,
 				3C64CA9A29B8605C00CB0B07 /* GECI - Home Improvement Contract - MMJ Remodeling Inc.pdf */,
 				3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */,
 				3C64CA9829B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf */,
 				3C64CA9529B8605B00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf */,
 				3C64CA9529B8605B00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf */,
-				3C64CA9929B8605C00CB0B07 /* GECI - Home Improvement Contract - Wilson Ma.pdf */,
-				3C64CAA729B8646A00CB0B07 /* template_03_08_2023_14_35_47.json */,
+				3CBC873A2A61476400978758 /* GECI - Home Improvement Contract - TN CABINETRY.pdf */,
+				3C64CAA729B8646A00CB0B07 /* template_07_14_2023_14_35_47.json */,
 				714B870A1E24CAE200A40D18 /* debug.json */,
 				714B870A1E24CAE200A40D18 /* debug.json */,
 				425A00F31F8F0EC200286D6F /* attribute_template.json */,
 				425A00F31F8F0EC200286D6F /* attribute_template.json */,
 				42DDB87B1F91E351002CCE22 /* template_type.json */,
 				42DDB87B1F91E351002CCE22 /* template_type.json */,
@@ -714,7 +714,6 @@
 				425A00F41F8F196900286D6F /* attribute_template.json in Resources */,
 				425A00F41F8F196900286D6F /* attribute_template.json in Resources */,
 				3C64CA9D29B8605C00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf in Resources */,
 				3C64CA9D29B8605C00CB0B07 /* GECI - Home Improvement Contract - Tan.pdf in Resources */,
 				3C64CAA329B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf in Resources */,
 				3C64CAA329B8605C00CB0B07 /* GECI - Home Improvement Contract - LA House.pdf in Resources */,
-				3C64CAA129B8605C00CB0B07 /* GECI - Home Improvement Contract - Wilson Ma.pdf in Resources */,
 				7128C24B1E124F4500FF635B /* Assets.xcassets in Resources */,
 				7128C24B1E124F4500FF635B /* Assets.xcassets in Resources */,
 				7128C26F1E124FF200FF635B /* Main.storyboard in Resources */,
 				7128C26F1E124FF200FF635B /* Main.storyboard in Resources */,
 				3C64CAA029B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf in Resources */,
 				3C64CAA029B8605C00CB0B07 /* GECI - Home Improvement Contract - Sunshine Remodeling Inc.pdf in Resources */,
@@ -722,8 +721,9 @@
 				3CC7E73623BEDEA000BE5561 /* wkweb.storyboard in Resources */,
 				3CC7E73623BEDEA000BE5561 /* wkweb.storyboard in Resources */,
 				42DDB87A1F91DCE8002CCE22 /* ControlTemplateCell.xib in Resources */,
 				42DDB87A1F91DCE8002CCE22 /* ControlTemplateCell.xib in Resources */,
 				7128C27D1E12500B00FF635B /* signature.storyboard in Resources */,
 				7128C27D1E12500B00FF635B /* signature.storyboard in Resources */,
-				3C64CAA829B8646A00CB0B07 /* template_03_08_2023_14_35_47.json in Resources */,
+				3C64CAA829B8646A00CB0B07 /* template_07_14_2023_14_35_47.json in Resources */,
 				3C64CA9F29B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf in Resources */,
 				3C64CA9F29B8605C00CB0B07 /* GECI - Home Improvement Contract - Bin & J W Inc.pdf in Resources */,
+				3CBC873B2A61476400978758 /* GECI - Home Improvement Contract - TN CABINETRY.pdf in Resources */,
 				7128C2E81E12511B00FF635B /* LICENSE in Resources */,
 				7128C2E81E12511B00FF635B /* LICENSE in Resources */,
 				42DDB8751F91C081002CCE22 /* ControlTemplateVC.xib in Resources */,
 				42DDB8751F91C081002CCE22 /* ControlTemplateVC.xib in Resources */,
 				714B870B1E24CAE300A40D18 /* debug.json in Resources */,
 				714B870B1E24CAE300A40D18 /* debug.json in Resources */,

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

@@ -123,13 +123,13 @@
 {
 {
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
 //    AppDelegate *appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
     
     
-    NSString* temp = NSTemporaryDirectory();
-    NSString* filename =[NSString stringWithFormat:@"%@.png", [[NSUUID UUID] UUIDString]];
-    NSString* qrpath=[temp stringByAppendingPathComponent:filename];
-    UIImage* qrimg=[ImageUtils generateBarCode:self.docment_id width:300 height:44];//[QRCodeGenerator qrImageForString:order_code imageSize:240];
+//    NSString* temp = NSTemporaryDirectory();
+//    NSString* filename =[NSString stringWithFormat:@"%@.png", [[NSUUID UUID] UUIDString]];
+//    NSString* qrpath=[temp stringByAppendingPathComponent:filename];
+//    UIImage* qrimg=[ImageUtils generateBarCode:self.docment_id width:300 height:44];//[QRCodeGenerator qrImageForString:order_code imageSize:240];
     
     
     
     
-    bool bwrite=[UIImagePNGRepresentation(qrimg)writeToFile: qrpath    atomically:YES];
+//    bool bwrite=[UIImagePNGRepresentation(qrimg)writeToFile: qrpath    atomically:YES];
     
     
     
     
     
     
@@ -139,9 +139,9 @@
         for(int j=0;j<[page[@"count"] intValue];j++)
         for(int j=0;j<[page[@"count"] intValue];j++)
         {
         {
             NSMutableDictionary* control =page[[NSString stringWithFormat:@"control_%d",j]];
             NSMutableDictionary* control =page[[NSString stringWithFormat:@"control_%d",j]];
-            NSString* type = control[@"type"];
-            NSString* field =control[@"field"];
-            bool disable = [control[@"disable"] boolValue];
+//            NSString* type = control[@"type"];
+//            NSString* field =control[@"field"];
+//            bool disable = [control[@"disable"] boolValue];
             control[@"dirty"]=[NSNumber numberWithBool:false];
             control[@"dirty"]=[NSNumber numberWithBool:false];
 //            if([type isEqualToString:@"Label"])
 //            if([type isEqualToString:@"Label"])
 //            {
 //            {
@@ -191,10 +191,10 @@
     }
     }
     return template;
     return template;
 }
 }
--(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
-    
-}
+//-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+//{
+//
+//}
 - (void)viewDidLoad {
 - (void)viewDidLoad {
     [super viewDidLoad];
     [super viewDidLoad];
     self.title = self.docment_id;
     self.title = self.docment_id;
@@ -514,7 +514,7 @@
 {
 {
     
     
     
     
-    NSArray* arr =self.pageViewController.viewControllers;
+//    NSArray* arr =self.pageViewController.viewControllers;
     
     
     TemplateViewController *currentViewController = (TemplateViewController*)self.pageViewController.viewControllers[0];
     TemplateViewController *currentViewController = (TemplateViewController*)self.pageViewController.viewControllers[0];
     //    PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[self.current_page];
     //    PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[self.current_page];
@@ -542,7 +542,7 @@
     
     
     [str writeToFile:path atomically:true encoding:NSUTF8StringEncoding error:&error];
     [str writeToFile:path atomically:true encoding:NSUTF8StringEncoding error:&error];
     
     
-    NSLog(path);
+    DebugLog(@"%@",path);
     
     
     
     
 //    [self.controlTemplate writeToFile:path atomically:NO];
 //    [self.controlTemplate writeToFile:path atomically:NO];
@@ -689,7 +689,7 @@
     /*
     /*
      PageViewController.pdfview = [[PDFView alloc]initWithFrame:self.view.frame atPage:index];
      PageViewController.pdfview = [[PDFView alloc]initWithFrame:self.view.frame atPage:index];
      [PageViewController.view addSubview:PageViewController.pdfview];
      [PageViewController.view addSubview:PageViewController.pdfview];
-     NSLog(@"index = %d",index);
+     DebugLog(@"index = %d",index);
      
      
      
      
      */
      */
@@ -898,7 +898,7 @@
 #pragma mark - UIPageViewController delegate methods
 #pragma mark - UIPageViewController delegate methods
 - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 {
 {
-    NSLog(@"didFinishAnimating");
+    DebugLog(@"didFinishAnimating");
     
     
     
     
     
     

+ 31 - 8
Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.h

@@ -12,23 +12,46 @@
 
 
 
 
 @interface RANetwork : NetworkUtils
 @interface RANetwork : NetworkUtils
-+(int)Authorize : (NSString*) user password:(NSString*) password;
+//+(int)Authorize : (NSString*) user password:(NSString*) password;
 +(NSString *) prepareUploadFile:(NSString*) file json:(NSMutableDictionary*)json;
 +(NSString *) prepareUploadFile:(NSString*) file json:(NSMutableDictionary*)json;
-+(NSDictionary*)logout;
-+(NSDictionary*)request_DocList:(NSMutableDictionary*) params;
-+(NSDictionary*)new_document;
+//+(NSDictionary*)logout;
+//+(NSDictionary*)request_DocList:(NSMutableDictionary*) params;
+//+(NSDictionary*)new_document;
 
 
-+(NSDictionary*)save_document:(NSString*)file isnew:(bool)isNewDocument;
+//+(NSDictionary*)save_document:(NSString*)file isnew:(bool)isNewDocument;
 
 
 +(NSString *) packfiles2zip:(NSMutableArray*) arr_file;
 +(NSString *) packfiles2zip:(NSMutableArray*) arr_file;
 
 
-+(NSDictionary *) updateNotes:(NSString*) doc_number notes:(NSString*)notes;
-+(NSDictionary*)upload_file:(NSString*)file params:(NSMutableDictionary*) params;
+//+(NSDictionary *) updateNotes:(NSString*) doc_number notes:(NSString*)notes;
+//+(NSDictionary*)upload_file:(NSString*)file params:(NSMutableDictionary*) params;
 
 
 +(NSString *) getjsonPath:(NSString*) serial;
 +(NSString *) getjsonPath:(NSString*) serial;
 +(NSString *) getPDFPath:(NSString*) file;
 +(NSString *) getPDFPath:(NSString*) file;
 +(NSString *) offline_docnumber;
 +(NSString *) offline_docnumber;
 
 
-+ (int)heartBeat;
+//+ (int)heartBeat;
+
+
+
+
+
+
+#pragma mark new network
+
++(void)request_new_document : (NSMutableDictionary*) params completionHandler:(resultHandler)result;
+
++(void)request_login: (NSString*) user password:(NSString*) password completionHandler:(resultHandler)result;
++(void)request_logout:(resultHandler)result;
++(void)request_doc_list:(NSMutableDictionary*) params completionHandler:(resultHandler)result;
++(void)request_save_document:(NSString*)file isnew:(bool)isNewDocument completionHandler:(resultHandler)result;
+
++(void) request_update_notes:(NSString*) doc_number notes:(NSString*)notes completionHandler:(resultHandler)result;
+
+
++ (void)request_heart_beat:(resultHandler)result;
+
++ (void)request_upload_file:(NSString*)file params:(NSMutableDictionary*) params completionHandler:(resultHandler)result;
+
+
 
 
 @end
 @end

Разлика између датотеке није приказан због своје велике величине
+ 670 - 332
Ants Contract/Granite Expo eSign/Granite Expo eSign/RANetwork.m


+ 2 - 2
Ants Contract/Granite Expo eSign/Granite Expo eSign/RASingleton.h

@@ -14,8 +14,8 @@ NS_ASSUME_NONNULL_BEGIN
 + (instancetype)sharedInstance;
 + (instancetype)sharedInstance;
 
 
 
 
-@property (strong,nonatomic) NSString* user;
-@property (strong,nonatomic) NSString * password;
+@property (strong,nonatomic,nullable) NSString* user;
+@property (strong,nonatomic,nullable) NSString * password;
 //@property (strong,nonatomic) NSString* build;
 //@property (strong,nonatomic) NSString* build;
 @property (strong,nonatomic) NSString* agentName;
 @property (strong,nonatomic) NSString* agentName;
 @end
 @end

+ 1 - 1
Ants Contract/Granite Expo eSign/Granite Expo eSign/Template Attributes /AttributeTableDataSourceAndDelegate.m

@@ -229,7 +229,7 @@ typedef enum {
                     value = [item objectForKey:@"value"];
                     value = [item objectForKey:@"value"];
                     if (value == nil) {
                     if (value == nil) {
                         NSMutableDictionary* cadedate = [self.data[@"cadedate"] mutableCopy];
                         NSMutableDictionary* cadedate = [self.data[@"cadedate"] mutableCopy];
-                        NSMutableDictionary *item = [cadedate[[NSString stringWithFormat:@"val+%d",self.data_row] ] mutableCopy];
+                        NSMutableDictionary *item = [cadedate[[NSString stringWithFormat:@"val+%ld",self.data_row] ] mutableCopy];
                         value = item[@"value"];
                         value = item[@"value"];
                     }
                     }
                 }
                 }

+ 71 - 51
Ants Contract/Granite Expo eSign/Granite Expo eSign/TemplateViewController.m

@@ -165,7 +165,7 @@ typedef enum {
     
     
     // pdf
     // pdf
     [self updateView:self.pdfPageView];
     [self updateView:self.pdfPageView];
-    //            NSLog(@"pdf page frame %@",[NSValue valueWithCGRect:self.pdfPageView.frame]);
+    //            DebugLog(@"pdf page frame %@",[NSValue valueWithCGRect:self.pdfPageView.frame]);
     [self.pdfPageView setNeedsDisplay];
     [self.pdfPageView setNeedsDisplay];
     
     
     // edit
     // edit
@@ -409,44 +409,64 @@ typedef enum {
 {
 {
     [[self view] endEditing:YES];
     [[self view] endEditing:YES];
 }
 }
--(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
+//-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+//{
+//    if (self.presentedViewController) {
+//        [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
+//    }
+//    
+//}
+//
+//- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+//    [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
+//}
+
+
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
+    
     if (self.presentedViewController) {
     if (self.presentedViewController) {
         [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
         [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
     }
     }
     
     
-}
+    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
+     {
 
 
-- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
-}
+        [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
+     } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
+     {
 
 
--(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-{
-    
-    //    [self rotateView];
-    
-    //    [self initControl];
-    ////    [self.pdfPageView setNeedsLayout];
-    //    [self.pdfPageView setNeedsDisplay];
-    ////    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
-    //
-    ////    UIApplication * app = [UIApplication sharedApplication];
-    ////    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-    ////    [appDelegate didRotated];
-    //
-    //    //    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
-    //    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
-    //    //    {
-    //    //        self.orientation = orientation;
-    //    //        [self.collectionview.collectionViewLayout invalidateLayout];
-    //    //        DebugLog(@"routed");
-    //    //    }
-    //
-    
+     }];
     
     
     
     
+    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
 }
 }
+//
+//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
+//{
+//
+//    //    [self rotateView];
+//
+//    //    [self initControl];
+//    ////    [self.pdfPageView setNeedsLayout];
+//    //    [self.pdfPageView setNeedsDisplay];
+//    ////    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
+//    //
+//    ////    UIApplication * app = [UIApplication sharedApplication];
+//    ////    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//    ////    [appDelegate didRotated];
+//    //
+//    //    //    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+//    //    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
+//    //    //    {
+//    //    //        self.orientation = orientation;
+//    //    //        [self.collectionview.collectionViewLayout invalidateLayout];
+//    //    //        DebugLog(@"routed");
+//    //    //    }
+//    //
+//
+//
+//
+//}
 
 
 #pragma mark add controls
 #pragma mark add controls
 -(bool) checkActionCondition:(NSString*) condition
 -(bool) checkActionCondition:(NSString*) condition
@@ -584,7 +604,7 @@ if (!update) {
     if(self.currentAppOrientation==ScreenOrientationLand)
     if(self.currentAppOrientation==ScreenOrientationLand)
     fontsize=fontsize*0.8; // 缩小字体否则textview显示不下。
     fontsize=fontsize*0.8; // 缩小字体否则textview显示不下。
     [tv setFont:[UIFont systemFontOfSize:fontsize]];
     [tv setFont:[UIFont systemFontOfSize:fontsize]];
-    bool isdisable = [template[@"disable"] boolValue];
+//    bool isdisable = [template[@"disable"] boolValue];
     
     
 //    tv.editable = !isdisable;
 //    tv.editable = !isdisable;
     tv.editable = true; // for update frame
     tv.editable = true; // for update frame
@@ -953,7 +973,7 @@ if (!update) {
     {
     {
         if([template[@"disable"] boolValue]&& [template[@"required"] boolValue])
         if([template[@"disable"] boolValue]&& [template[@"required"] boolValue])
         {
         {
-            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+//            AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
             UIImage* img = [UIImage imageNamed:@"na"];
             UIImage* img = [UIImage imageNamed:@"na"];
             btn.image = img;
             btn.image = img;
 //            template[@"value"]=appDelegate.na_path;
 //            template[@"value"]=appDelegate.na_path;
@@ -1035,7 +1055,7 @@ if (!update) {
     CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
     CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
     CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
     CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
     //    CGSize size1 = self.pdfScrollView.bounds.size;
     //    CGSize size1 = self.pdfScrollView.bounds.size;
-    //    NSLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
+    //    DebugLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
     contentSize.height+=self.keyboard_h;
     contentSize.height+=self.keyboard_h;
     contentOffsetPoint.y+=self.keyboard_h;
     contentOffsetPoint.y+=self.keyboard_h;
     
     
@@ -1117,7 +1137,7 @@ if (!update) {
     
     
     //    DebugLog(@"cart sort button clicked");
     //    DebugLog(@"cart sort button clicked");
     
     
-    NSLog(@"button clicked;");
+    DebugLog(@"button clicked;");
     //    [self.view addSubview:self.sortItemController.view];
     //    [self.view addSubview:self.sortItemController.view];
 }
 }
 - (void)CheckButtonClicked:(UIButton *)sender {
 - (void)CheckButtonClicked:(UIButton *)sender {
@@ -1128,7 +1148,7 @@ if (!update) {
         return;
         return;
     }
     }
     
     
-    NSLog(@"check clicked;");
+    DebugLog(@"check clicked;");
     
     
     long index = sender.tag - CONTROL_BASE;
     long index = sender.tag - CONTROL_BASE;
     
     
@@ -1230,7 +1250,7 @@ if (!update) {
                         {
                         {
                             
                             
                             NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                             NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                            formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                            formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                             NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                             NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                             if(prefix_str.length==0)
                             if(prefix_str.length==0)
                             prefix_str = @"";
                             prefix_str = @"";
@@ -1248,7 +1268,7 @@ if (!update) {
                         {
                         {
                             //                                float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
                             //                                float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
                             NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                             NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                            formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                            formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                             NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                             NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                             if(prefix_str.length==0)
                             if(prefix_str.length==0)
                             prefix_str = @"";
                             prefix_str = @"";
@@ -1526,7 +1546,7 @@ if (!update) {
         
         
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         
         
-        formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+        formatter.numberStyle =NSNumberFormatterCurrencyStyle;
         NSNumber* number= [formatter numberFromString:text];
         NSNumber* number= [formatter numberFromString:text];
         if(number!=nil)
         if(number!=nil)
         textView.text = [NSString stringWithFormat:@"%.2f",[number doubleValue]];
         textView.text = [NSString stringWithFormat:@"%.2f",[number doubleValue]];
@@ -1551,7 +1571,7 @@ if (!update) {
         [self.controlUpdateDelegate focusControlView:textView frame:[self getViewFrame:textView]];
         [self.controlUpdateDelegate focusControlView:textView frame:[self getViewFrame:textView]];
         return NO;
         return NO;
     }
     }
-    NSLog(@"textViewShouldBeginEditing");
+    DebugLog(@"textViewShouldBeginEditing");
     
     
     
     
     //    long index = textView.tag - CONTROL_BASE;
     //    long index = textView.tag - CONTROL_BASE;
@@ -1606,7 +1626,7 @@ if (!update) {
         
         
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         
         
-        formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+        formatter.numberStyle =NSNumberFormatterCurrencyStyle;
         
         
         
         
         NSNumber * nprice =[NSNumber numberWithDouble: [text doubleValue]];
         NSNumber * nprice =[NSNumber numberWithDouble: [text doubleValue]];
@@ -1646,7 +1666,7 @@ if (!update) {
             {
             {
                 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.1;
                 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.1;
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -1682,7 +1702,7 @@ if (!update) {
             {
             {
                 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.9;
                 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.9;
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -1715,7 +1735,7 @@ if (!update) {
                 
                 
                 
                 
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -1916,7 +1936,7 @@ if (!update) {
     
     
     if(touchImageView.image!=nil)
     if(touchImageView.image!=nil)
     {
     {
-        NSLog(@"long press");
+        DebugLog(@"long press");
         
         
         
         
         [self becomeFirstResponder];
         [self becomeFirstResponder];
@@ -1970,7 +1990,7 @@ if (!update) {
     }
     }
 
 
     
     
-    NSLog(@"signature button clicked;");
+    DebugLog(@"signature button clicked;");
     
     
     //
     //
     //    __weak __typeof(self)weakSelf = self;
     //    __weak __typeof(self)weakSelf = self;
@@ -2156,10 +2176,10 @@ if (!update) {
 }
 }
 
 
 - (void)keyboardWillChangeFrame:(NSNotification *)notification {
 - (void)keyboardWillChangeFrame:(NSNotification *)notification {
-    NSLog(@"keyboardWillChangeFrame");
+    DebugLog(@"keyboardWillChangeFrame");
 }
 }
 - (void)keyboardWillShow:(NSNotification *)notification {
 - (void)keyboardWillShow:(NSNotification *)notification {
-    NSLog(@"keyboardWillShow");
+    DebugLog(@"keyboardWillShow");
     
     
     if(self.keyboard_show)
     if(self.keyboard_show)
     return;
     return;
@@ -2174,7 +2194,7 @@ if (!update) {
     
     
     NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
     NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
     CGSize keyboardSize = [aValue CGRectValue].size;
     CGSize keyboardSize = [aValue CGRectValue].size;
-    NSLog(@"keyboard height:%f",keyboardSize.height);
+    DebugLog(@"keyboard height:%f",keyboardSize.height);
     
     
     
     
     CGRect cellrect_screen = [self relativeFrameForScreenWithView:self.hotTextView];
     CGRect cellrect_screen = [self relativeFrameForScreenWithView:self.hotTextView];
@@ -2188,7 +2208,7 @@ if (!update) {
         CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
         CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
         CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
         CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
         CGSize size1 = self.pdfScrollView.bounds.size;
         CGSize size1 = self.pdfScrollView.bounds.size;
-        NSLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
+        DebugLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
         contentSize.height+=self.keyboard_h;
         contentSize.height+=self.keyboard_h;
         contentOffsetPoint.y+=self.keyboard_h;
         contentOffsetPoint.y+=self.keyboard_h;
         
         
@@ -2210,7 +2230,7 @@ if (!update) {
     //  [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];
     //  [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];
 }
 }
 - (void)keyboardWillHide:(NSNotification *)notification {
 - (void)keyboardWillHide:(NSNotification *)notification {
-    NSLog(@"keyboardWillHide");
+    DebugLog(@"keyboardWillHide");
     
     
     self.keyboard_show=false;
     self.keyboard_show=false;
     //    NSDictionary* userInfo = [notification userInfo];
     //    NSDictionary* userInfo = [notification userInfo];
@@ -2239,7 +2259,7 @@ if (!update) {
     //   self.pdfScrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
     //   self.pdfScrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
     
     
     self.keyboard_h= 0;
     self.keyboard_h= 0;
-    //    NSLog(@"before refresh %@",NSStringFromCGSize(self.editorTable.contentSize));
+    //    DebugLog(@"before refresh %@",NSStringFromCGSize(self.editorTable.contentSize));
     
     
     
     
     //    if(self.resize)
     //    if(self.resize)

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

@@ -12,9 +12,9 @@
 
 
 
 
 
 
-#define CONTRACT_TEMPLATE @"template_03_08_2023_14_35_47.json"
+#define CONTRACT_TEMPLATE @"template_07_14_2023_14_35_47.json"
 
 
-#define GET_JSON
+//#define GET_JSON
 
 
 //#define ENCRYPT_OFF
 //#define ENCRYPT_OFF
 # ifdef DEBUG
 # ifdef DEBUG

+ 19 - 11
Ants Contract/Granite Expo eSign/Granite Expo eSign/const.h

@@ -12,17 +12,25 @@
 
 
 #define CONTROL_BASE 19871
 #define CONTROL_BASE 19871
 #define CHECK_BASE 29871
 #define CHECK_BASE 29871
-#define DEBUGLOG 1
-#ifdef DEBUGLOG
-#ifdef DEBUG
-//     #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
-#define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
-#else
-#define DebugLog( s, ... )
-#endif
-#else
-#define DebugLog( s, ... )
-#endif
+//
+//#define DEBUGLOG 
+//#ifdef DEBUGLOG
+//    #ifdef DEBUG
+//   //     #define DebugLog( s, ... ) fprintf(stderr,"%s\n",[[NSString stringWithFormat:s, ##__VA_ARGS__] UTF8String])//
+//#define DebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n", self, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
+//
+//#define blockDebugLog( s, ... ) fprintf(stderr, "<%p %s:(%d)> %s \n",weakself, [[[NSString stringWithUTF8String:__FILE__] lastPathComponent]UTF8String], __LINE__, [[NSString stringWithFormat:(s), ##__VA_ARGS__]UTF8String] )
+//
+//    #else
+//        #define DebugLog( s, ... )
+//
+//        #define blockDebugLog( s, ... )
+//    #endif
+//#else
+//    #define DebugLog( s, ... )
+//
+//    #define blockDebugLog( s, ... )
+//#endif
 
 
 
 
 #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
 #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]

Разлика између датотеке није приказан због своје велике величине
+ 0 - 0
Ants Contract/Granite Expo eSign/template_07_14_2023_14_35_47.json


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

@@ -8,7 +8,7 @@
 
 
 #import <UIKit/UIKit.h>
 #import <UIKit/UIKit.h>
 
 
-@interface AddExtDocumentViewController : UIViewController<UIImagePickerControllerDelegate>
+@interface AddExtDocumentViewController : UIViewController<UINavigationControllerDelegate, UIImagePickerControllerDelegate>
 @property (weak, nonatomic) IBOutlet UITableView *tableView;
 @property (weak, nonatomic) IBOutlet UITableView *tableView;
 @property (strong, nonatomic) NSMutableArray * arr_documents;
 @property (strong, nonatomic) NSMutableArray * arr_documents;
 @property (weak, nonatomic) IBOutlet UITextField *editDocNumber;
 @property (weak, nonatomic) IBOutlet UITextField *editDocNumber;

+ 84 - 47
Ants Contract/common/AddExtDocumentViewController.m

@@ -275,56 +275,93 @@
     
     
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Upload Documents" completion:nil];
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Upload Documents" completion:nil];
 //    __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Upload Documents" completion:^{
 //    __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;
-            
-            
-            NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
-            params[@"doc_number"]=docNumber;
-            json = [RANetwork upload_file:zipfile params:params];
-            
-            dispatch_async(dispatch_get_main_queue(), ^{
-                
+    
+    NSMutableDictionary* params = [[NSMutableDictionary alloc] init];
+    params[@"doc_number"]=docNumber;
+    [RANetwork request_upload_file:zipfile params:params completionHandler:^(NSMutableDictionary *result) {
+        
+        
+        [pop hide];
+        NSDictionary* json  = result;
+            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];
+                }
                 
                 
-//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//                if(self.uploadSuccess)
+//                    self.uploadSuccess(self.arr_documents);
                 
                 
-//                [waitalert dismissViewControllerAnimated:YES completion:^{
-                [pop hide];
-                    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
-                    {
+            }
+            else
+            {
 //                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
 //                        [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Upload Documents" controller:self] ;
-                        
-                        [RAUtils message_box:@"Upload Documents"  message:[json valueForKey:@"err_msg"]  completion:nil];
-                    }
-//                }];
-
-                
-
-                
                 
                 
-            });
-        });
+                [RAUtils message_box:@"Upload Documents"  message:[json valueForKey:@"err_msg"]  completion:nil];
+            }
+        
+    }];
+    
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//            
+//            NSDictionary* json = nil;
+//            
+//            
+//            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:^{
+//                [pop hide];
+//                    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] ;
+//                        
+//                        [RAUtils message_box:@"Upload Documents"  message:[json valueForKey:@"err_msg"]  completion:nil];
+//                    }
+////                }];
+//
+//                
+//
+//                
+//                
+//            });
+//        });
         
         
 //    }];
 //    }];
     
     
@@ -381,7 +418,7 @@
     NSString* type = item_json[@"type"];
     NSString* type = item_json[@"type"];
     NSString* file_name = item_json[@"file_name"];
     NSString* file_name = item_json[@"file_name"];
     NSString* upload_date = item_json[@"upload_date"];
     NSString* upload_date = item_json[@"upload_date"];
-    NSString* url = item_json[@"url"];
+//    NSString* url = item_json[@"url"];
     if([type isEqualToString:@"file"])
     if([type isEqualToString:@"file"])
         cell.imageView.image = [UIImage imageNamed:@"file_icon"];
         cell.imageView.image = [UIImage imageNamed:@"file_icon"];
     else
     else

+ 103 - 84
Ants Contract/common/AppDelegate.m

@@ -103,7 +103,7 @@
 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options
 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(nonnull NSDictionary<NSString *,id> *)options
 {
 {
 
 
-    NSLog(@"URL:%@, OPTIONS:%@",[url absoluteString],[RAConvertor dict2string:options]);
+    DebugLog(@"URL:%@, OPTIONS:%@",[url absoluteString],[RAConvertor dict2string:options]);
     
     
     if (self.accessMode == AppAccessModeOffline) {
     if (self.accessMode == AppAccessModeOffline) {
         
         
@@ -216,79 +216,78 @@
 }
 }
  -(void)function_test
  -(void)function_test
 {
 {
-
-    return;
-    
-    printf("function test======================");
-//    NSString* pdffile = [PDFUtils SavePDF:nil source:nil window_rect:CGRectMake(0, 0, 768, 960)];
-
-//    [PDFUtils leak_test];
-    
-
-//    获取路径
-    
-    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
-    
-    NSString *saveDirectory=[paths objectAtIndex:0];
-    
-    NSString *saveFileName=[NSString stringWithFormat:@"%@.pdf",[[NSUUID UUID ] UUIDString] ] ;;
-    
-    NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
-    
-    const char *filename=[newFilePath UTF8String];
-    
-    NSLog(@"%@",newFilePath);
-    //设置页面大小 Letter纸
-    
-
-    
-    
-    CFStringRef path;
-    
-    CFURLRef url;
-    
-    path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
-    
-    url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
-    
-    CFRelease(path);
-    // CGPDFCONTEXTCREATE
-    
-    
-    CGContextRef pdfContext;
-    CGRect docsize = CGRectMake(0, 0, 612, 1008);
-    
-    
-    CFMutableDictionaryRef myDictionary = NULL;
-    myDictionary= CFDictionaryCreateMutable(NULL,
-                                            0,
-                                            NULL,
-                                            NULL);
-
-    CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("usai2010"));
-    CFDictionarySetValue(myDictionary, kCGPDFContextAllowsPrinting, kCFBooleanTrue);
-    CFDictionarySetValue(myDictionary, kCGPDFContextAllowsCopying, kCFBooleanFalse);
-    
-    
-    
-    pdfContext=CGPDFContextCreateWithURL(url, &docsize,myDictionary);
-    
-    CFRelease(myDictionary);
-    CFRelease(url);
-    CGContextBeginPage(pdfContext, &docsize);
-//    cgpdfpage
-    
-    CGContextEndPage(pdfContext);
-    
-    CGPDFContextClose(pdfContext);
-
-    CGContextRelease(pdfContext);
-
-    
-
-    
-    return ;
-    
+//
+//
+//    printf("function test======================");
+////    NSString* pdffile = [PDFUtils SavePDF:nil source:nil window_rect:CGRectMake(0, 0, 768, 960)];
+//
+////    [PDFUtils leak_test];
+//
+//
+////    获取路径
+//
+//    NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);//坐标
+//
+//    NSString *saveDirectory=[paths objectAtIndex:0];
+//
+//    NSString *saveFileName=[NSString stringWithFormat:@"%@.pdf",[[NSUUID UUID ] UUIDString] ] ;;
+//
+//    NSString *newFilePath=[saveDirectory stringByAppendingPathComponent:saveFileName];
+//
+//    const char *filename=[newFilePath UTF8String];
+//
+//    DebugLog(@"%@",newFilePath);
+//    //设置页面大小 Letter纸
+//
+//
+//
+//    
+//    CFStringRef path;
+//
+//    CFURLRef url;
+//
+//    path=CFStringCreateWithCString(NULL, filename, kCFStringEncodingUTF8);
+//
+//    url=CFURLCreateWithFileSystemPath(NULL, path, kCFURLPOSIXPathStyle, 0);
+//
+//    CFRelease(path);
+//    // CGPDFCONTEXTCREATE
+//
+//
+//    CGContextRef pdfContext;
+//    CGRect docsize = CGRectMake(0, 0, 612, 1008);
+//
+//
+//    CFMutableDictionaryRef myDictionary = NULL;
+//    myDictionary= CFDictionaryCreateMutable(NULL,
+//                                            0,
+//                                            NULL,
+//                                            NULL);
+//
+//    CFDictionarySetValue(myDictionary, kCGPDFContextOwnerPassword, CFSTR("usai2010"));
+//    CFDictionarySetValue(myDictionary, kCGPDFContextAllowsPrinting, kCFBooleanTrue);
+//    CFDictionarySetValue(myDictionary, kCGPDFContextAllowsCopying, kCFBooleanFalse);
+//
+//
+//
+//    pdfContext=CGPDFContextCreateWithURL(url, &docsize,myDictionary);
+//
+//    CFRelease(myDictionary);
+//    CFRelease(url);
+//    CGContextBeginPage(pdfContext, &docsize);
+////    cgpdfpage
+//
+//    CGContextEndPage(pdfContext);
+//
+//    CGPDFContextClose(pdfContext);
+//
+//    CGContextRelease(pdfContext);
+//
+//
+//
+//
+//    return ;
+//
 }
 }
 
 
 - (void)applicationWillResignActive:(UIApplication *)application {
 - (void)applicationWillResignActive:(UIApplication *)application {
@@ -546,16 +545,14 @@
     if (self.accessMode == AppAccessModeOffline) return;
     if (self.accessMode == AppAccessModeOffline) return;
     
     
     __weak typeof(self) weakself = self;
     __weak typeof(self) weakself = self;
-    dispatch_async(dispatch_get_global_queue(0, 0), ^{
-       
-        int result = [RANetwork heartBeat];
-//        int result = 2;
-        
-        if (result == 2) {
+    
+    [RANetwork request_heart_beat:^(NSMutableDictionary *result) {
+        int iresult=[result[@"result"] intValue];
+        if (iresult == 2) {
             // 心跳成功才处理计时
             // 心跳成功才处理计时
             [self markHeartBeatTime];
             [self markHeartBeatTime];
             
             
-        } else if (result == 4) { // 心跳超时
+        } else if (iresult == 4) { // 心跳超时
             
             
             [weakself heartBeatTimeout];
             [weakself heartBeatTimeout];
             
             
@@ -566,9 +563,31 @@
 //            [weakself heartBeatTimeout];
 //            [weakself heartBeatTimeout];
         }
         }
         
         
-        NSLog(@"heart beat result %d",result);
-        
-    });
+        DebugLog(@"heart beat result %d",iresult);
+    }];
+//    dispatch_async(dispatch_get_global_queue(0, 0), ^{
+//
+//        int result = [RANetwork heartBeat];
+////        int result = 2;
+//
+//        if (result == 2) {
+//            // 心跳成功才处理计时
+//            [self markHeartBeatTime];
+//
+//        } else if (result == 4) { // 心跳超时
+//
+//            [weakself heartBeatTimeout];
+//
+//
+//        } else if ([weakself checkHearBeatTimeOut]) {// 本地检查超时(上一次成功心跳距现在的间隔时间超出1h)
+//
+//            // 本地不检查超时!!!不能知道后台设置的超时时长
+////            [weakself heartBeatTimeout];
+//        }
+//
+//        DebugLog(@"heart beat result %d",result);
+//
+//    });
 }
 }
 
 
 - (void)dealloc {
 - (void)dealloc {

+ 57 - 40
Ants Contract/common/DocnotesViewController.m

@@ -71,49 +71,66 @@
     
     
     
     
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Update Notes" completion:nil];
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Update Notes" completion:nil];
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            
-            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:^{
-                
-                [pop hide];
-                    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:@"Update Notes" controller:self] ;
-                        
-                        [RAUtils message_box:@"Update Notes"  message:[json valueForKey:@"err_msg"]  completion:nil];
-                    }
-//                }];
-                
+    
+    [RANetwork request_update_notes:self.docNumber notes:self.docNotes completionHandler:^(NSMutableDictionary *result) {
+        NSMutableDictionary* json= result;
+        [pop hide];
+            if([json[@"result"] intValue]==RESULT_TRUE)
                 
                 
+            {
+                [self dismissViewControllerAnimated:false completion:nil];
 
 
+            }
+            else
+            {
+//                        [RAUtils message_alert:[json valueForKey:@"err_msg"]  title:@"Update Notes" controller:self] ;
                 
                 
-                
-            });
-        });
+                [RAUtils message_box:@"Update Notes"  message:[json valueForKey:@"err_msg"]  completion:nil];
+            }
+    }];
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//            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:^{
+//
+//                [pop hide];
+//                    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:@"Update Notes" controller:self] ;
+//
+//                        [RAUtils message_box:@"Update Notes"  message:[json valueForKey:@"err_msg"]  completion:nil];
+//                    }
+////                }];
+//
+//
+//
+//
+//
+//            });
+//        });
 //    }];
 //    }];
     
     
 
 

+ 104 - 34
Ants Contract/common/DocumentListViewController.m

@@ -170,7 +170,7 @@
 
 
 -(void) previewPDF:(NSString*)url title:(NSString*)title subject:(NSString*)subject islocal:(bool) islocalfile
 -(void) previewPDF:(NSString*)url title:(NSString*)title subject:(NSString*)subject islocal:(bool) islocalfile
 {
 {
-    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
+//    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
 //    NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
 //    NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
     
     
     
     
@@ -339,31 +339,28 @@
     });
     });
     
     
     
     
-    NSMutableDictionary* content=nil;
+    
     
     
    // NSMutableDictionary* params = [[NSMutableDictionary alloc]init];
    // NSMutableDictionary* params = [[NSMutableDictionary alloc]init];
     
     
     self.filterparams[@"offset"] = [NSNumber numberWithLong:self.offset];
     self.filterparams[@"offset"] = [NSNumber numberWithLong:self.offset];
     
     
     
     
-   // self.filterparams = params;
-    content=[[RANetwork request_DocList:self.filterparams]mutableCopy];
     
     
     
     
-    dispatch_sync(dispatch_get_main_queue(), ^{
-        
-        
-        //在主线程处理界请求结果
+    [RANetwork request_doc_list:self.filterparams completionHandler:^(NSMutableDictionary *result) {
         
         
+        NSMutableDictionary* content=nil;
+        content = result;
         
         
         [self.mum stopAnimating];
         [self.mum stopAnimating];
 //        self.isrefreshing=false;
 //        self.isrefreshing=false;
         if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
         if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
             return ;
             return ;
         }
         }
-        int result=[[content valueForKey:@"result"] intValue];
+        int iresult=[[content valueForKey:@"result"] intValue];
         
         
-        if(result==2||result==0)
+        if(iresult==2||iresult==0)
         {
         {
             
             
             
             
@@ -376,13 +373,13 @@
             [self.table_data addObjectsFromArray:arrlist];
             [self.table_data addObjectsFromArray:arrlist];
 //            for(int i=0;i<count;i++)
 //            for(int i=0;i<count;i++)
 //            {
 //            {
-//                
+//
 //                NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
 //                NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
-//                
+//
 //                table_data
 //                table_data
-//                
+//
 //                [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
 //                [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
-//                
+//
 //            }
 //            }
             if(count<self.limit)
             if(count<self.limit)
             {
             {
@@ -405,7 +402,7 @@
             self.reset_result=false;
             self.reset_result=false;
             [self.tableView reloadData ];
             [self.tableView reloadData ];
         }
         }
-        else if(result==RESULT_NET_ERROR &&self.offset==0)
+        else if(iresult==RESULT_NET_ERROR &&self.offset==0)
         {
         {
             self.label_net_err.hidden=false;
             self.label_net_err.hidden=false;
             self.tableView.hidden = true;
             self.tableView.hidden = true;
@@ -417,23 +414,96 @@
             [RAUtils message_box:@"Loading Document List"  message:[content valueForKey:@"err_msg"]  completion:nil];
             [RAUtils message_box:@"Loading Document List"  message:[content valueForKey:@"err_msg"]  completion:nil];
         }
         }
 
 
-        
-        
-        
-        
-        
-        //            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
-        //            bool autologin =[defaults boolForKey:@"autologin"];
-        //            if(!autologin)
-        //            {
-        //                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
-        //                [self presentViewController:viewController animated:YES completion:^{
-        //
-        //                }];
-        //            }
-        
-        
-    });
+    }];
+    
+   // self.filterparams = params;
+//    content=[[RANetwork request_DocList:self.filterparams]mutableCopy];
+//    
+//    
+//    dispatch_sync(dispatch_get_main_queue(), ^{
+//        
+//        
+//        //在主线程处理界请求结果
+//        
+//        
+//        [self.mum stopAnimating];
+////        self.isrefreshing=false;
+//        if (self.dataOperationQueue.operationCount > 1) { // 队列后面还有操作
+//            return ;
+//        }
+//        int result=[[content valueForKey:@"result"] intValue];
+//        
+//        if(result==2||result==0)
+//        {
+//            
+//            
+//            NSArray * arrlist = content[@"list"];
+//            long count = arrlist.count ;
+//            
+//            
+//
+//            self.offset += count;
+//            [self.table_data addObjectsFromArray:arrlist];
+////            for(int i=0;i<count;i++)
+////            {
+////                
+////                NSDictionary* objmsg = [content objectForKey:[NSString stringWithFormat:@"item_%d",i]];
+////                
+////                table_data
+////                
+////                [self.content_data addObject:[NSMutableDictionary dictionaryWithDictionary:objmsg]];
+////                
+////            }
+//            if(count<self.limit)
+//            {
+//                
+//                //                    int i =self.btnrefresh.state;
+//                self.load_more_hint=@"All loaded";
+//                //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"no_more", nil);
+//                //                    [self.btnrefresh setTitle:@"No more" forState:UIControlStateNormal];
+//            }
+//            else
+//            {
+//                self.load_more_hint=@"Load more...";
+//                //                    self.btnrefresh.enabled = true;
+//                //                    self.btnrefresh.titleLabel.text =NSLocalizedString(@"load_more",nil);
+//                //                    [self.btnrefresh setTitle:@"Load more" forState:UIControlStateNormal];
+//            }
+//            
+//            
+//            self.tableView.hidden = false;
+//            self.reset_result=false;
+//            [self.tableView reloadData ];
+//        }
+//        else if(result==RESULT_NET_ERROR &&self.offset==0)
+//        {
+//            self.label_net_err.hidden=false;
+//            self.tableView.hidden = true;
+//        }
+//        else
+//        {
+////            [RAUtils message_alert:[content valueForKey:@"err_msg"]  title:@"Loading Document List" controller:self] ;
+//            
+//            [RAUtils message_box:@"Loading Document List"  message:[content valueForKey:@"err_msg"]  completion:nil];
+//        }
+//
+//        
+//        
+//        
+//        
+//        
+//        //            NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
+//        //            bool autologin =[defaults boolForKey:@"autologin"];
+//        //            if(!autologin)
+//        //            {
+//        //                TabBarController * viewController =[self.storyboard instantiateViewControllerWithIdentifier:@"LoginTabBar"];
+//        //                [self presentViewController:viewController animated:YES completion:^{
+//        //
+//        //                }];
+//        //            }
+//        
+//        
+//    });
     
     
 }
 }
 
 
@@ -992,8 +1062,8 @@
 
 
 {
 {
     
     
-    __weak typeof (self) weekself=self;
-    __weak NSIndexPath* weekindex = indexPath;
+//    __weak typeof (self) weekself=self;
+//    __weak NSIndexPath* weekindex = indexPath;
     NSDictionary * item_json = self.table_data[indexPath.row];
     NSDictionary * item_json = self.table_data[indexPath.row];
     
     
     NSString* notes = item_json[@"notes"];
     NSString* notes = item_json[@"notes"];

+ 217 - 118
Ants Contract/common/DocumentPageViewController.m

@@ -186,10 +186,10 @@
     }
     }
     return template;
     return template;
 }
 }
--(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
-
-}
+//-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+//{
+//
+//}
 
 
 -(void) setupTemplete
 -(void) setupTemplete
 {
 {
@@ -521,7 +521,7 @@
 {
 {
     
     
     
     
-    NSArray* arr =self.pageViewController.viewControllers;
+//    NSArray* arr =self.pageViewController.viewControllers;
     
     
      PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[0];
      PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[0];
 //    PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[self.current_page];
 //    PageViewController *currentViewController = (PageViewController*)self.pageViewController.viewControllers[self.current_page];
@@ -544,7 +544,7 @@
     
     
     NSString* pdffile = nil;
     NSString* pdffile = nil;
     NSString* zipfile = nil;
     NSString* zipfile = nil;
-    NSString* jsonfile = nil;
+//    NSString* jsonfile = nil;
    // for(int l=0;l<1;l++)
    // for(int l=0;l<1;l++)
     {
     {
         
         
@@ -608,128 +608,223 @@
 //        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving" completion:^{
 //        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Saving" completion:^{
         
         
         PopWaitAlert* pop =[RAUtils waiting_pop:@"Saving..." completion:nil];
         PopWaitAlert* pop =[RAUtils waiting_pop:@"Saving..." completion:nil];
-            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                
-                NSDictionary* json = nil;
-                
-                
-                
-                json = [RANetwork save_document:zipfile isnew:self.action==PDFEditActionNew];
-                
-                dispatch_async(dispatch_get_main_queue(), ^{
-                    
-                    
-//                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-//                    [waitalert dismissViewControllerAnimated:YES completion:^{
-                    [pop hide];
-                        if([[json valueForKey:@"result"] intValue]==2)
+        
+        [RANetwork request_save_document:zipfile isnew:self.action==PDFEditActionNew completionHandler:^(NSMutableDictionary *result) {
+            NSDictionary* json = result;
+
+            [pop hide];
+                    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] ;
                             
                             
-                            
-                            [weakSelf.navigationController popViewControllerAnimated:false];
-                            if(weakSelf.OnSave)
-                                weakSelf.OnSave(pdffile,json[@"subject"]);
-                            
-                            
+                            [RAUtils message_box:@"Save document" message:@"Can not upload pending documents please try again later." completion:nil];
+                            return;
                         }
                         }
-                        else
-                        {
-        //                    [RAUtils message_alert:[json valueForKey:@"err_msg"] title:@"Save document" controller:self] ;
-                            
-                            if(self.hide_control)
+                        
+                        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:@"Can not upload pending documents please try again later." title:@"Save document" controller:self] ;
+//                                    [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] ;
                                 
                                 
-                                [RAUtils message_box:@"Save document" message:@"Can not upload pending documents please try again later." completion:nil];
+                                [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
                                 return;
                                 return;
                             }
                             }
+                            [appDelegate SwitchToOffline:RASingleton.sharedInstance.user];
                             
                             
-                            UIAlertController *alertControl = [UIAlertController alertControllerWithTitle:@"Create Customer" message:@"Can not create new customer on server, do you want to create an offline document?" preferredStyle:UIAlertControllerStyleAlert];
                             
                             
+                            NSMutableDictionary * json = [[NSMutableDictionary alloc]init];
                             
                             
-                            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] ;
-                                    
-                                    [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
-                                    return;
-                                }
-                                [appDelegate SwitchToOffline:RASingleton.sharedInstance.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"]=RASingleton.sharedInstance.user;
-                                
-                                
-                                json[@"agent_name"]=[self extract_data:@"sales_person"];
-                                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,@"");
-                                
-                                
-                            }];
+                            json[@"json"]=@"json.json";
+                            json[@"pdf"]=pdffile.lastPathComponent;
+                            json[@"zip"]=zipfile.lastPathComponent;
+                            json[@"serial"]=[json[@"zip"] stringByDeletingPathExtension];
                             
                             
-                            UIAlertAction *alertthree = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) {
-                                DebugLog(@"Cancel");
-                            }];
-                            [alertControl addAction:actionOne];
                             
                             
-                            [alertControl addAction:alertthree];
                             
                             
-                            //UIAlertControllerStyle类型为UIAlertControllerStyleAlert可以添加addTextFieldWithConfigurationHandler:^(UITextField *textField)
+                            json[@"create_by"]=RASingleton.sharedInstance.user;
                             
                             
                             
                             
-                            [self presentViewController:alertControl animated:YES completion:nil];
+                            json[@"agent_name"]=[self extract_data:@"sales_person"];
+                            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"];
                             
                             
-                        }
-//                    }];
-                    //                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] ;
-                    //                }
-                    
-                    
-                    
-                    
-                });
-            });
+                            
+                            
+                            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];
+                        
+                    }
+
+            
+        }];
+//            dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//                NSDictionary* json = nil;
+//
+//
+//
+//                json = [RANetwork save_document:zipfile isnew:self.action==PDFEditActionNew];
+//
+//                dispatch_async(dispatch_get_main_queue(), ^{
+//
+//
+////                    [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+////                    [waitalert dismissViewControllerAnimated:YES completion:^{
+//                    [pop hide];
+//                        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] ;
+//
+//                                [RAUtils message_box:@"Save document" message:@"Can not upload pending documents please try again later." completion:nil];
+//                                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] ;
+//
+//                                    [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
+//                                    return;
+//                                }
+//                                [appDelegate SwitchToOffline:RASingleton.sharedInstance.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"]=RASingleton.sharedInstance.user;
+//
+//
+//                                json[@"agent_name"]=[self extract_data:@"sales_person"];
+//                                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];
+//
+//                        }
+////                    }];
+//                    //                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] ;
+//                    //                }
+//
+//
+//
+//
+//                });
+//            });
 //        }];
 //        }];
         
         
 
 
@@ -882,7 +977,7 @@
     /*
     /*
      PageViewController.pdfview = [[PDFView alloc]initWithFrame:self.view.frame atPage:index];
      PageViewController.pdfview = [[PDFView alloc]initWithFrame:self.view.frame atPage:index];
      [PageViewController.view addSubview:PageViewController.pdfview];
      [PageViewController.view addSubview:PageViewController.pdfview];
-     NSLog(@"index = %d",index);
+     DebugLog(@"index = %d",index);
      
      
      
      
      */
      */
@@ -927,7 +1022,9 @@
     //    titleLabel.textAlignment = NSTextAlignmentRight;
     //    titleLabel.textAlignment = NSTextAlignmentRight;
     titleLabel.textAlignment = NSTextAlignmentCenter;
     titleLabel.textAlignment = NSTextAlignmentCenter;
     CGSize constraintkey = CGSizeMake(270, 20000.0f);//key label width is 40% cell width;
     CGSize constraintkey = CGSizeMake(270, 20000.0f);//key label width is 40% cell width;
-    CGSize sizetitle = [@"Missing fields:" sizeWithFont:[UIFont systemFontOfSize:20.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
+    
+    CGSize sizetitle =[RAUtils sizeWithFont:@"Missing fields:" font:[UIFont systemFontOfSize:20.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
+//    CGSize sizetitle = [@"Missing fields:" sizeWithFont:[UIFont systemFontOfSize:20.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
     
     
     //[titleLabel sizeToFit];
     //[titleLabel sizeToFit];
     //    titleLabel.center.x = demoView.center.x;
     //    titleLabel.center.x = demoView.center.x;
@@ -942,7 +1039,8 @@
     
     
     
     
     constraintkey = CGSizeMake(260, 20000.0f);
     constraintkey = CGSizeMake(260, 20000.0f);
-    CGSize sizemsg = [msg sizeWithFont:[UIFont boldSystemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
+    CGSize sizemsg = [RAUtils sizeWithFont:msg font:[UIFont boldSystemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
+//    CGSize sizemsg = [msg sizeWithFont:[UIFont boldSystemFontOfSize:17.0] constrainedToSize:constraintkey lineBreakMode:NSLineBreakByWordWrapping];
     
     
     lineLabel.frame = CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, sizemsg.height);
     lineLabel.frame = CGRectMake(15, titleLabel.frame.origin.y+ titleLabel.frame.size.height+20, 260, sizemsg.height);
     //[lineLabel sizeToFit];
     //[lineLabel sizeToFit];
@@ -984,7 +1082,7 @@
                 {
                 {
                     ret=false;
                     ret=false;
                     
                     
-                    NSString* msg=[NSString stringWithFormat:@"%u. Page %d: %@",fields.count+1,i+1,name];
+                    NSString* msg=[NSString stringWithFormat:@"%ld. Page %d: %@",fields.count+1,i+1,name];
                     if(fields.count<15)
                     if(fields.count<15)
                         [fields addObject:msg];
                         [fields addObject:msg];
                     else
                     else
@@ -1092,7 +1190,7 @@
 #pragma mark - UIPageViewController delegate methods
 #pragma mark - UIPageViewController delegate methods
 - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray<UIViewController *> *)previousViewControllers transitionCompleted:(BOOL)completed
 {
 {
-    NSLog(@"didFinishAnimating");
+    DebugLog(@"didFinishAnimating");
     
     
     
     
     
     
@@ -1109,7 +1207,8 @@
     //        self.title = [NSString stringWithFormat:@"%@ [%ld/%ld]", self.docment_id,((PageViewController*)self.pageViewController.viewControllers[0]).pageIndex+1, self.total_page ];
     //        self.title = [NSString stringWithFormat:@"%@ [%ld/%ld]", self.docment_id,((PageViewController*)self.pageViewController.viewControllers[0]).pageIndex+1, self.total_page ];
 }
 }
 - (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation {
 - (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation {
-    if (true||UIInterfaceOrientationIsPortrait(orientation) || ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)) {
+    if (true/*||UIInterfaceOrientationIsPortrait(orientation) || ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)*/)
+    {
         // In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller. Setting the spine position to 'UIPageViewControllerSpineLocationMid' in landscape orientation sets the doubleSided property to YES, so set it to NO here.
         // In portrait orientation or on iPhone: Set the spine position to "min" and the page view controller's view controllers array to contain just one view controller. Setting the spine position to 'UIPageViewControllerSpineLocationMid' in landscape orientation sets the doubleSided property to YES, so set it to NO here.
         
         
         UIViewController *currentViewController = self.pageViewController.viewControllers[0];
         UIViewController *currentViewController = self.pageViewController.viewControllers[0];

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

@@ -21,7 +21,7 @@
     [super viewDidLoad];
     [super viewDidLoad];
     
     
         self.labelDocNumber.text = self.docNumber;
         self.labelDocNumber.text = self.docNumber;
-        self.edgesForExtendedLayout = UIRectEdgeNone;
+//        self.edgesForExtendedLayout = UIRectEdgeNone;
     
     
     
     
     UIBarButtonItem *closeButton =nil;
     UIBarButtonItem *closeButton =nil;
@@ -340,7 +340,7 @@
     NSString* type = item_json[@"type"];
     NSString* type = item_json[@"type"];
     NSString* file_name = item_json[@"file_name"];
     NSString* file_name = item_json[@"file_name"];
     NSString* upload_date = item_json[@"upload_date"];
     NSString* upload_date = item_json[@"upload_date"];
-    NSString* url = item_json[@"url"];
+//    NSString* url = item_json[@"url"];
     if([type isEqualToString:@"file"])
     if([type isEqualToString:@"file"])
         cell.imageView.image = [UIImage imageNamed:@"file_icon"];
         cell.imageView.image = [UIImage imageNamed:@"file_icon"];
     else
     else

+ 116 - 105
Ants Contract/common/LoginViewController.m

@@ -154,6 +154,7 @@
     
     
     
     
 }
 }
+
 - (IBAction)onRetrievePassword:(id)sender {
 - (IBAction)onRetrievePassword:(id)sender {
 //    RetrievePassViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"RetrievePassViewController" ];
 //    RetrievePassViewController* vc = [self.storyboard instantiateViewControllerWithIdentifier:@"RetrievePassViewController" ];
 //    //            dvc
 //    //            dvc
@@ -209,119 +210,129 @@
     
     
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign in" completion:nil];
     PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign in" completion:nil];
     
     
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+    
+    [RANetwork request_login:user password:password completionHandler:^(NSMutableDictionary *result) {
+        [pop hide];
+        
+//        int ret=[RANetwork  Authorize:user password:password];
+        int ret=[result[@"result"] intValue];
+        self.btnLogin.enabled = true;
+        
+        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:RASingleton.sharedInstance.user password:@"usai"];
+            NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
             
             
             
             
-            int ret=[RANetwork  Authorize:user password:password];
+//                long index =[self.logindata indexOfObject:appDelegate.user];
+            if(![self.logindata containsObject:RASingleton.sharedInstance.user])
+            {
+                [self.logindata addObject:RASingleton.sharedInstance.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"];
             
             
-            dispatch_async(dispatch_get_main_queue(), ^{
-//                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-//                [waitalert dismissViewControllerAnimated:YES completion:^{
-                
-                
-                
-                [pop hide];
-                
-                
+            
+            
+            
+            if(self.checkSavePassword.selected)
+            {
                 
                 
+                [defaults setValue:encryptu forKey:@"user"];
+                [defaults setValue:encryptp forKey:@"password"];
+
+            }
+
+            [defaults synchronize];
+            
+            [self dismissViewControllerAnimated:YES completion:^{
                 
                 
-                    self.btnLogin.enabled = true;
+
+                {
+                if(self.returnValue)
+                    self.returnValue(true);
+                }
+                    }];
+
+
+        }
+        else
+        {
+            NSString* msg=nil;
+            
+            switch (ret) {
                     
                     
-                    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:RASingleton.sharedInstance.user password:@"usai"];
-                        NSString* encryptp=[AESCrypt encrypt:self.editpass.text password:@"usai"] ;
-                        
-                        
-        //                long index =[self.logindata indexOfObject:appDelegate.user];
-                        if(![self.logindata containsObject:RASingleton.sharedInstance.user])
-                        {
-                            [self.logindata addObject:RASingleton.sharedInstance.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"];
-
-                        }
-
-                        [defaults synchronize];
-                        
-                        [self dismissViewControllerAnimated:YES completion:^{
-                            
-
-                            {
-                            if(self.returnValue)
-                                self.returnValue(true);
-                            }
-                                }];
-
-
-                    }
-                    else
-                    {
-                        NSString* msg=nil;
-                        
-                        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;
-                        }
-                        
+                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"];
 //                        [RAUtils alert_view:msg title:@"Cannot sign-in"];
-                        
+            
 //                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
 //                        [RAUtils message_alert:msg title:@"Cannot sign-in" controller:self];
-                        
-                        [RAUtils message_box:@"Cannot sign-in"  message:msg  completion:nil];
-                        
-                    }
-//                }];
-                
-                
-                
-                
-            });
-        });
+            
+            [RAUtils message_box:@"Cannot sign-in"  message:msg  completion:nil];
+            
+        }
+    }];
+    
+    
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+////                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+////                [waitalert dismissViewControllerAnimated:YES completion:^{
+//
+//
+//
+//
+//
+//
+//
+//
+//
+////                }];
+//
+//
+//
+//
+//            });
+//        });
 //    }];
 //    }];
 
 
     
     

+ 67 - 49
Ants Contract/common/PageViewController.m

@@ -162,7 +162,7 @@ typedef enum {
     
     
     // pdf
     // pdf
     [self updateView:self.pdfPageView];
     [self updateView:self.pdfPageView];
-    //            NSLog(@"pdf page frame %@",[NSValue valueWithCGRect:self.pdfPageView.frame]);
+    //            DebugLog(@"pdf page frame %@",[NSValue valueWithCGRect:self.pdfPageView.frame]);
     [self.pdfPageView setNeedsDisplay];
     [self.pdfPageView setNeedsDisplay];
     
     
     // edit
     // edit
@@ -410,44 +410,62 @@ typedef enum {
 {
 {
     [[self view] endEditing:YES];
     [[self view] endEditing:YES];
 }
 }
--(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
-{
+//-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
+//{
+//    if (self.presentedViewController) {
+//        [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
+//    }
+//
+//}
+
+//- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
+//    [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
+//}
+
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
+    
     if (self.presentedViewController) {
     if (self.presentedViewController) {
         [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
         [self.presentedViewController dismissViewControllerAnimated:NO completion:nil];
     }
     }
     
     
-}
-
-- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
-    [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
-}
+    [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context)
+     {
 
 
--(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-{
+        [self rotateView];// 在此重新布局使视图在旋转过程中减少卡顿,更自然。
+     } completion:^(id<UIViewControllerTransitionCoordinatorContext> context)
+     {
 
 
-//    [self rotateView];
+     }];
     
     
-//    [self initControl];
-////    [self.pdfPageView setNeedsLayout];
-//    [self.pdfPageView setNeedsDisplay];
-////    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
+    
+    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+}
+//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
+//{
+//
+////    [self rotateView];
 //    
 //    
-////    UIApplication * app = [UIApplication sharedApplication];
-////    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-////    [appDelegate didRotated];
+////    [self initControl];
+//////    [self.pdfPageView setNeedsLayout];
+////    [self.pdfPageView setNeedsDisplay];
+//////    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
+////    
+//////    UIApplication * app = [UIApplication sharedApplication];
+//////    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+//////    [appDelegate didRotated];
+////    
+////    //    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
+////    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
+////    //    {
+////    //        self.orientation = orientation;
+////    //        [self.collectionview.collectionViewLayout invalidateLayout];
+////    //        DebugLog(@"routed");
+////    //    }
+////    
 //    
 //    
-//    //    UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
-//    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
-//    //    {
-//    //        self.orientation = orientation;
-//    //        [self.collectionview.collectionViewLayout invalidateLayout];
-//    //        DebugLog(@"routed");
-//    //    }
 //    
 //    
-    
-    
-    
-}
+//    
+//}
 
 
 #pragma mark add controls
 #pragma mark add controls
 -(bool) checkActionCondition:(NSString*) condition
 -(bool) checkActionCondition:(NSString*) condition
@@ -740,7 +758,7 @@ typedef enum {
         
         
         enumvc.single_select =true;
         enumvc.single_select =true;
         
         
-        __weak typeof(self) weakSelf = self;
+//        __weak typeof(self) weakSelf = self;
         
         
         enumvc.returnValue = ^(NSMutableDictionary* value){
         enumvc.returnValue = ^(NSMutableDictionary* value){
             control_json[@"cadedate"]=value;
             control_json[@"cadedate"]=value;
@@ -1047,7 +1065,7 @@ typedef enum {
     CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
     CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
     CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
     CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
 //    CGSize size1 = self.pdfScrollView.bounds.size;
 //    CGSize size1 = self.pdfScrollView.bounds.size;
-//    NSLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
+//    DebugLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
     contentSize.height+=self.keyboard_h;
     contentSize.height+=self.keyboard_h;
     contentOffsetPoint.y+=self.keyboard_h;
     contentOffsetPoint.y+=self.keyboard_h;
     
     
@@ -1111,7 +1129,7 @@ typedef enum {
 - (void)ControlButtonClicked:(UIButton *)sender {
 - (void)ControlButtonClicked:(UIButton *)sender {
     //    DebugLog(@"cart sort button clicked");
     //    DebugLog(@"cart sort button clicked");
     
     
-    NSLog(@"button clicked;");
+    DebugLog(@"button clicked;");
     
     
     if([sender.titleLabel.text isEqualToString:@"Initial All"])
     if([sender.titleLabel.text isEqualToString:@"Initial All"])
     {
     {
@@ -1262,7 +1280,7 @@ typedef enum {
 - (void)CheckButtonClicked:(UIButton *)sender {
 - (void)CheckButtonClicked:(UIButton *)sender {
     //    DebugLog(@"cart sort button clicked");
     //    DebugLog(@"cart sort button clicked");
     
     
-    NSLog(@"check clicked;");
+    DebugLog(@"check clicked;");
     
     
     long index = sender.tag - CONTROL_BASE;
     long index = sender.tag - CONTROL_BASE;
     
     
@@ -1364,7 +1382,7 @@ typedef enum {
                                 {
                                 {
                                     
                                     
                                     NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                                     NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                                    formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                                    formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                                     NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                                     NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                                     if(prefix_str.length==0)
                                     if(prefix_str.length==0)
                                         prefix_str = @"";
                                         prefix_str = @"";
@@ -1382,7 +1400,7 @@ typedef enum {
                                 {
                                 {
                                     //                                float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
                                     //                                float f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] floatValue]*0.9;
                                     NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                                     NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                                    formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                                    formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                                     NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                                     NSString* prefix_str= self.page_controlTemplate [control[@"control"] ][@"prefix_str"];
                                     if(prefix_str.length==0)
                                     if(prefix_str.length==0)
                                         prefix_str = @"";
                                         prefix_str = @"";
@@ -1669,7 +1687,7 @@ typedef enum {
         
         
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         
         
-        formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+        formatter.numberStyle =NSNumberFormatterCurrencyStyle;
         NSNumber* number= [formatter numberFromString:text];
         NSNumber* number= [formatter numberFromString:text];
         if(number!=nil)
         if(number!=nil)
             textView.text = [NSString stringWithFormat:@"%.2f",[number doubleValue]];
             textView.text = [NSString stringWithFormat:@"%.2f",[number doubleValue]];
@@ -1691,7 +1709,7 @@ typedef enum {
 - (BOOL)textViewShouldBeginEditing:(UITextView *)textView
 - (BOOL)textViewShouldBeginEditing:(UITextView *)textView
 {
 {
     
     
-    NSLog(@"textViewShouldBeginEditing");
+    DebugLog(@"textViewShouldBeginEditing");
     
     
     
     
 //    long index = textView.tag - CONTROL_BASE;
 //    long index = textView.tag - CONTROL_BASE;
@@ -1746,7 +1764,7 @@ typedef enum {
 
 
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
         
         
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
         
         
         
         
         NSNumber * nprice =[NSNumber numberWithDouble: [text doubleValue]];
         NSNumber * nprice =[NSNumber numberWithDouble: [text doubleValue]];
@@ -1786,7 +1804,7 @@ typedef enum {
             {
             {
 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.1;
 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.1;
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -1822,7 +1840,7 @@ typedef enum {
             {
             {
 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.9;
 //                double f= [[text stringByReplacingOccurrencesOfString:@"$" withString:@"" ] doubleValue]*0.9;
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -1855,7 +1873,7 @@ typedef enum {
 
 
                 
                 
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
                 NSNumberFormatter *formatter = [[NSNumberFormatter alloc]init];
-                formatter.numberStyle =kCFNumberFormatterCurrencyStyle;
+                formatter.numberStyle =NSNumberFormatterCurrencyStyle;
                 
                 
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 NSString* prefix_str= self.page_controlTemplate [[NSString stringWithFormat:@"control_%ld",index] ][@"prefix_str"];
                 if(prefix_str.length==0)
                 if(prefix_str.length==0)
@@ -2084,7 +2102,7 @@ typedef enum {
     
     
     if(touchImageView.image!=nil)
     if(touchImageView.image!=nil)
     {
     {
-        NSLog(@"long press");
+        DebugLog(@"long press");
         
         
         
         
         [self becomeFirstResponder];
         [self becomeFirstResponder];
@@ -2132,7 +2150,7 @@ typedef enum {
 - (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView
 - (void)TouchImageViewOnTouche:(TouchImageView *)touchImageView
 {
 {
     
     
-    NSLog(@"signature button clicked;");
+    DebugLog(@"signature button clicked;");
     
     
 //    
 //    
 //    __weak __typeof(self)weakSelf = self;
 //    __weak __typeof(self)weakSelf = self;
@@ -2318,10 +2336,10 @@ typedef enum {
 }
 }
 
 
 - (void)keyboardWillChangeFrame:(NSNotification *)notification {
 - (void)keyboardWillChangeFrame:(NSNotification *)notification {
-    NSLog(@"keyboardWillChangeFrame");
+    DebugLog(@"keyboardWillChangeFrame");
 }
 }
 - (void)keyboardWillShow:(NSNotification *)notification {
 - (void)keyboardWillShow:(NSNotification *)notification {
-    NSLog(@"keyboardWillShow");
+    DebugLog(@"keyboardWillShow");
     
     
     if(self.keyboard_show)
     if(self.keyboard_show)
         return;
         return;
@@ -2336,7 +2354,7 @@ typedef enum {
     
     
     NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
     NSValue* aValue = [userInfo objectForKey:UIKeyboardFrameEndUserInfoKey];
     CGSize keyboardSize = [aValue CGRectValue].size;
     CGSize keyboardSize = [aValue CGRectValue].size;
-    NSLog(@"keyboard height:%f",keyboardSize.height);
+    DebugLog(@"keyboard height:%f",keyboardSize.height);
 
 
     
     
     CGRect cellrect_screen = [self relativeFrameForScreenWithView:self.hotTextView];
     CGRect cellrect_screen = [self relativeFrameForScreenWithView:self.hotTextView];
@@ -2350,7 +2368,7 @@ typedef enum {
         CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
         CGPoint contentOffsetPoint = self.pdfScrollView.contentOffset;
         CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
         CGSize contentSize =self.pdfScrollView.contentSize;//frame.size;
         CGSize size1 = self.pdfScrollView.bounds.size;
         CGSize size1 = self.pdfScrollView.bounds.size;
-        NSLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
+        DebugLog(@"frame:%@ bound:%@", NSStringFromCGSize(contentSize),NSStringFromCGSize(size1) );
         contentSize.height+=self.keyboard_h;
         contentSize.height+=self.keyboard_h;
         contentOffsetPoint.y+=self.keyboard_h;
         contentOffsetPoint.y+=self.keyboard_h;
         
         
@@ -2372,7 +2390,7 @@ typedef enum {
     //  [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];
     //  [self moveInputBarWithKeyboardHeight:keyboardRect.size.height withDuration:animationDuration];
 }
 }
 - (void)keyboardWillHide:(NSNotification *)notification {
 - (void)keyboardWillHide:(NSNotification *)notification {
-    NSLog(@"keyboardWillHide");
+    DebugLog(@"keyboardWillHide");
     
     
     self.keyboard_show=false;
     self.keyboard_show=false;
 //    NSDictionary* userInfo = [notification userInfo];
 //    NSDictionary* userInfo = [notification userInfo];
@@ -2401,7 +2419,7 @@ typedef enum {
  //   self.pdfScrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
  //   self.pdfScrollView.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
     
     
     self.keyboard_h= 0;
     self.keyboard_h= 0;
-//    NSLog(@"before refresh %@",NSStringFromCGSize(self.editorTable.contentSize));
+//    DebugLog(@"before refresh %@",NSStringFromCGSize(self.editorTable.contentSize));
     
     
     
     
     //    if(self.resize)
     //    if(self.resize)

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

@@ -152,7 +152,7 @@
 
 
 -(void) previewPDF:(NSString*)url title:(NSString*)title subject:(NSString*)subject
 -(void) previewPDF:(NSString*)url title:(NSString*)title subject:(NSString*)subject
 {
 {
-    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
+//    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
     //    NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
     //    NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
     
     
     
     

+ 188 - 73
Ants Contract/common/RootViewController.m

@@ -173,8 +173,11 @@
         
         
         
         
         
         
+        if (@available(iOS 13, *)) {
+            navi.modalInPresentation = true;
+        }
         
         
-        
+
         
         
         navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         navi.modalPresentationStyle = UIModalPresentationFormSheet;//有三种状态,自己看看是哪种
         [self presentViewController:navi animated:YES completion:^{
         [self presentViewController:navi animated:YES completion:^{
@@ -304,13 +307,11 @@
         
         
         PopWaitAlert* pop =[RAUtils waiting_pop:@"Create customer" completion:nil];
         PopWaitAlert* pop =[RAUtils waiting_pop:@"Create customer" completion:nil];
         
         
-//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create customer" completion:^{
-        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-            
-            
-            NSMutableDictionary* json=[[RANetwork  new_document] mutableCopy];
+        
+        NSMutableDictionary* param = [NSMutableDictionary new];
+        [RANetwork request_new_document:param completionHandler:^(NSMutableDictionary *result) {
+            NSMutableDictionary* json= result;
             
             
-            dispatch_async(dispatch_get_main_queue(), ^{
                 
                 
                 
                 
                 
                 
@@ -390,8 +391,97 @@
  
  
                 
                 
                 
                 
-            });
-        });
+            
+        }];
+        
+//        __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Create customer" completion:^{
+//        dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//
+//            NSMutableDictionary* json=[[RANetwork  new_document] mutableCopy];
+//
+//            dispatch_async(dispatch_get_main_queue(), ^{
+//
+//
+//
+////                [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//
+//
+////                [waitalert dismissViewControllerAnimated:YES completion:^{
+//
+//                [pop hide];
+//                    if([json[@"result"] intValue]==RESULT_TRUE)
+//
+//                    {
+//                        DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
+//
+//                        //                dvc.templateName = @"debug.json";
+//                        dvc.templatePath = [[NSBundle mainBundle] pathForResource:CONTRACT_TEMPLATE ofType:nil];
+//                        dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"GECI - Home Improvement Contract - Tan.pdf" ofType:nil];
+//                        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] ;
+//
+//                        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] ;
+//                                [RAUtils message_box:@"Create Customer" message:@"Offline document number prefix not found, Please check your user name and make sure you had signed in at least once."  completion:nil];
+//                                return;
+//                            }
+//                            [appDelegate SwitchToOffline:RASingleton.sharedInstance.user];
+//                            DocumentPageViewController* dvc = [self.storyboard instantiateViewControllerWithIdentifier:@"DocumentPageViewController" ];
+//
+//                            //                dvc.templateName = @"debug.json";
+//                            dvc.templatePath = [[NSBundle mainBundle] pathForResource:CONTRACT_TEMPLATE ofType:nil];
+//                            dvc.pdfPath = [[NSBundle mainBundle] pathForResource:@"GECI - Home Improvement Contract - Tan.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];
+//
+//
+//                    }
+////                }];
+//
+//
+//
+//
+//            });
+//        });
         
         
 //        }];
 //        }];
         
         
@@ -530,35 +620,39 @@
             break;
             break;
     }
     }
 }
 }
--(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
-{
-    
-    [self reloadBG];
-    
-    
-//    [self initControl];
-//    //    [self.pdfPageView setNeedsLayout];
-//    [self.pdfPageView setNeedsDisplay];
-//    //    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
+//-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
+//{
+//    
+//    [self reloadBG];
+//    
+//    
+////    [self initControl];
+////    //    [self.pdfPageView setNeedsLayout];
+////    [self.pdfPageView setNeedsDisplay];
+////    //    UIDeviceOrientation dev_ori = [[UIDevice currentDevice]orientation];
+////    
+////    //    UIApplication * app = [UIApplication sharedApplication];
+////    //    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
+////    //    [appDelegate didRotated];
+////    
+//
 //    
 //    
-//    //    UIApplication * app = [UIApplication sharedApplication];
-//    //    AppDelegate *appDelegate = (AppDelegate *)[app delegate];
-//    //    [appDelegate didRotated];
+////    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
+////    //    {
+////    //        self.orientation = orientation;
+////    //        [self.collectionview.collectionViewLayout invalidateLayout];
+////    //        DebugLog(@"routed");
+////    //    }
 //    
 //    
+//    
+//    
+//    
+//}
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
+    [self reloadBG];
+    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
 
 
-    
-//    //    if (UIInterfaceOrientationIsLandscape(orientation)|| UIInterfaceOrientationIsPortrait(orientation))
-//    //    {
-//    //        self.orientation = orientation;
-//    //        [self.collectionview.collectionViewLayout invalidateLayout];
-//    //        DebugLog(@"routed");
-//    //    }
-    
-    
-    
-    
 }
 }
-
 - (void)dealWithUILogout {
 - (void)dealWithUILogout {
     self.welcomeLabel.text=@"Not sign in";
     self.welcomeLabel.text=@"Not sign in";
     //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
     //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
@@ -598,47 +692,68 @@
 //            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
 //            __block UIAlertController * waitalert = [RAUtils waiting_alert:self title:@"Sign out" completion:^{
             
             
             PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign out" completion:nil];
             PopWaitAlert* pop =[RAUtils waiting_pop:@"Sign out" completion:nil];
-
-                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
-                    
-                    NSDictionary* logout_json = nil;
-                    
-                    
-                    
-                    logout_json = [RANetwork logout];
-                    
-                    dispatch_async(dispatch_get_main_queue(), ^{
-                        
-                        
-//                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
-                        
-//                        [waitalert dismissViewControllerAnimated:YES completion:^{
+            
+            [RANetwork request_logout:^(NSMutableDictionary *result) {
+                NSDictionary* logout_json = result;
+                [pop hide];
+                    if([[logout_json valueForKey:@"result"] intValue]==2)
+                    {
+                        self.welcomeLabel.text=@"Not sign in";
+                        //                        [sender setTitle:@"Sign in" forState:UIControlStateNormal];
+                        [bbitem setTitle:@"Sign in"];
                         
                         
-                        [pop hide];
-                            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
-                            {
+                        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] ;
 //                                [RAUtils message_alert:[logout_json valueForKey:@"err_msg"] title:@"Sign out" controller:self] ;
-                                
-                                [RAUtils message_box:@"Sign out"  message:[logout_json valueForKey:@"err_msg"]  completion:nil];
-                            }
-//                        }];
-
-                        
                         
                         
-                        
-                        
-                    });
-                });
+                        [RAUtils message_box:@"Sign out"  message:[logout_json valueForKey:@"err_msg"]  completion:nil];
+                    }
+            }];
+
+//                dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+//
+//                    NSDictionary* logout_json = nil;
+//
+//
+//
+//                    logout_json = [RANetwork logout];
+//
+//                    dispatch_async(dispatch_get_main_queue(), ^{
+//
+//
+////                        [waitalert dismissWithClickedButtonIndex:0 animated:FALSE];
+//
+////                        [waitalert dismissViewControllerAnimated:YES completion:^{
+//
+//                        [pop hide];
+//                            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] ;
+//
+//                                [RAUtils message_box:@"Sign out"  message:[logout_json valueForKey:@"err_msg"]  completion:nil];
+//                            }
+////                        }];
+//
+//
+//
+//
+//
+//                    });
+//                });
 //            }];
 //            }];
             
             
             
             
@@ -673,7 +788,7 @@
 {
 {
 //    return;
 //    return;
     
     
-    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
+//    NSString* name=@"";//[self.content_data[indexPath.row] valueForKey:@"tear_name"];
     NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
     NSString* url= file;//[self.content_data[indexPath.row] valueForKey:@"pdf_path"];
     
     
     
     

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

@@ -18,7 +18,7 @@
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *bbAdd;
 @property (strong, nonatomic) IBOutlet UIBarButtonItem *bbAdd;
 @property bool can_fill;
 @property bool can_fill;
 //@property (strong, nonatomic)  UIImageView *imageView;
 //@property (strong, nonatomic)  UIImageView *imageView;
-@property (nonatomic , copy) void (^blk_Add)();
+@property (nonatomic , copy) void (^blk_Add)(void);
 @property (nonatomic , copy) void (^blk_Select)(NSString* file);
 @property (nonatomic , copy) void (^blk_Select)(NSString* file);
 @property (nonatomic , copy) void (^blk_Fill)(NSString* file, bool fillFullDoc);
 @property (nonatomic , copy) void (^blk_Fill)(NSString* file, bool fillFullDoc);
 @property CGSize signature_ratio;
 @property CGSize signature_ratio;

+ 5 - 4
Ants Contract/common/SignatureListViewController.m

@@ -8,6 +8,7 @@
 
 
 #import "SignatureListViewController.h"
 #import "SignatureListViewController.h"
 #import "SignatureTableViewCell.h"
 #import "SignatureTableViewCell.h"
+#import "RAUtils.h"
 
 
 @interface SignatureListViewController ()
 @interface SignatureListViewController ()
 
 
@@ -410,7 +411,7 @@
 {
 {
     if(self.blk_Select)
     if(self.blk_Select)
     {
     {
-        NSLog(@"signature selected.");
+        DebugLog(@"signature selected.");
 //        SignatureTableViewCell * cell= [tableView cellForRowAtIndexPath:indexPath];
 //        SignatureTableViewCell * cell= [tableView cellForRowAtIndexPath:indexPath];
         
         
         NSDictionary * item_json = self.signatureData[self.subType][[NSString stringWithFormat:@"item_%ld",(long)indexPath.section]];
         NSDictionary * item_json = self.signatureData[self.subType][[NSString stringWithFormat:@"item_%ld",(long)indexPath.section]];
@@ -422,14 +423,14 @@
 
 
     }
     }
     
     
-    NSLog(@"before dismiss signature list");
+    DebugLog(@"before dismiss signature list");
     [self dismissViewControllerAnimated:false completion:nil];
     [self dismissViewControllerAnimated:false completion:nil];
     
     
 //    [self dismissViewControllerAnimated:false completion:^{
 //    [self dismissViewControllerAnimated:false completion:^{
-//        NSLog(@"dismiss completion");
+//        DebugLog(@"dismiss completion");
 //    }];
 //    }];
     
     
-    NSLog(@"after dismiss signature list");
+    DebugLog(@"after dismiss signature list");
     
     
 //    if (tableView.isEditing) { // 编辑模式下不响应
 //    if (tableView.isEditing) { // 编辑模式下不响应
 //        return;
 //        return;

Неке датотеке нису приказане због велике количине промена