模版工具sse接口
This commit is contained in:
parent
0a0bbc9ee9
commit
cb21773e26
|
@ -8,166 +8,232 @@
|
|||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>DZNEmptyDataSet.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>2</integer>
|
||||
</dict>
|
||||
<key>FMDB.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>3</integer>
|
||||
</dict>
|
||||
<key>GTCommonSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>4</integer>
|
||||
</dict>
|
||||
<key>GTExtensionSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>5</integer>
|
||||
</dict>
|
||||
<key>GTSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>6</integer>
|
||||
</dict>
|
||||
<key>GYSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
<key>HXPhotoPicker.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>8</integer>
|
||||
</dict>
|
||||
<key>IQKeyboardManager.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>9</integer>
|
||||
</dict>
|
||||
<key>LSTTimer.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>11</integer>
|
||||
</dict>
|
||||
<key>MBProgressHUD.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>13</integer>
|
||||
</dict>
|
||||
<key>MJRefresh.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>14</integer>
|
||||
</dict>
|
||||
<key>MOFSPickerManager.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>15</integer>
|
||||
</dict>
|
||||
<key>Masonry.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>12</integer>
|
||||
</dict>
|
||||
<key>Pods-ProductApp.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>16</integer>
|
||||
</dict>
|
||||
<key>PopupKit.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>17</integer>
|
||||
</dict>
|
||||
<key>Reachability.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>18</integer>
|
||||
</dict>
|
||||
<key>SDAutoLayout.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>19</integer>
|
||||
</dict>
|
||||
<key>SDCycleScrollView.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>20</integer>
|
||||
</dict>
|
||||
<key>SDWebImage.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>21</integer>
|
||||
</dict>
|
||||
<key>SSZipArchive.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>23</integer>
|
||||
</dict>
|
||||
<key>SocketRocket.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>22</integer>
|
||||
</dict>
|
||||
<key>UITableView+FDTemplateLayoutCell.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>24</integer>
|
||||
</dict>
|
||||
<key>UMAPM.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>25</integer>
|
||||
</dict>
|
||||
<key>UMCCommonLog.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>26</integer>
|
||||
</dict>
|
||||
<key>UMCommon.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>27</integer>
|
||||
</dict>
|
||||
<key>UMDevice.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>28</integer>
|
||||
</dict>
|
||||
<key>UMLink.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>29</integer>
|
||||
</dict>
|
||||
<key>WechatOpenSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>30</integer>
|
||||
</dict>
|
||||
<key>YYModel.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>31</integer>
|
||||
</dict>
|
||||
<key>YYText.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>32</integer>
|
||||
</dict>
|
||||
<key>ZXSDK.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>33</integer>
|
||||
</dict>
|
||||
<key>libpag.xcscheme</key>
|
||||
<dict>
|
||||
<key>isShown</key>
|
||||
<false/>
|
||||
<key>orderHint</key>
|
||||
<integer>10</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
|
|
|
@ -11,6 +11,12 @@
|
|||
CA0688CD2CD328C500DF7025 /* ToolCheckModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688CC2CD328C500DF7025 /* ToolCheckModel.m */; };
|
||||
CA0688D02CD3291900DF7025 /* OcrModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688CF2CD3291900DF7025 /* OcrModel.m */; };
|
||||
CA0688D32CD329AD00DF7025 /* TranslateLanguageModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688D22CD329AD00DF7025 /* TranslateLanguageModel.m */; };
|
||||
CA0688E52CD374CD00DF7025 /* DiffMatchPatch.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688DC2CD374CB00DF7025 /* DiffMatchPatch.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
CA0688E62CD374CD00DF7025 /* NSString+UnicharUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688DE2CD374CC00DF7025 /* NSString+UnicharUtilities.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
CA0688E72CD374CD00DF7025 /* NSMutableDictionary+DMPExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688E12CD374CC00DF7025 /* NSMutableDictionary+DMPExtensions.m */; };
|
||||
CA0688E82CD374CD00DF7025 /* NSString+JavaSubstring.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688E22CD374CC00DF7025 /* NSString+JavaSubstring.m */; settings = {COMPILER_FLAGS = "-fno-objc-arc"; }; };
|
||||
CA0688E92CD374CD00DF7025 /* NSString+UriCompatibility.m in Sources */ = {isa = PBXBuildFile; fileRef = CA0688E32CD374CC00DF7025 /* NSString+UriCompatibility.m */; };
|
||||
CA0689252CD3753F00DF7025 /* DiffMatchPatchCFUtilities.c in Sources */ = {isa = PBXBuildFile; fileRef = CA0689232CD3753F00DF7025 /* DiffMatchPatchCFUtilities.c */; };
|
||||
CA07CD142CC5E5C500AF41ED /* XieYiAlterView.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */; };
|
||||
CA07CD172CC5F25B00AF41ED /* TextbookDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD162CC5F25B00AF41ED /* TextbookDetailModel.m */; };
|
||||
CA07CD1A2CC6335400AF41ED /* ExampleCorrectList.m in Sources */ = {isa = PBXBuildFile; fileRef = CA07CD192CC6335400AF41ED /* ExampleCorrectList.m */; };
|
||||
|
@ -531,6 +537,20 @@
|
|||
CA0688CF2CD3291900DF7025 /* OcrModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = OcrModel.m; sourceTree = "<group>"; };
|
||||
CA0688D12CD329AD00DF7025 /* TranslateLanguageModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TranslateLanguageModel.h; sourceTree = "<group>"; };
|
||||
CA0688D22CD329AD00DF7025 /* TranslateLanguageModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = TranslateLanguageModel.m; sourceTree = "<group>"; };
|
||||
CA0688DB2CD374CB00DF7025 /* NSString+JavaSubstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+JavaSubstring.h"; sourceTree = "<group>"; };
|
||||
CA0688DC2CD374CB00DF7025 /* DiffMatchPatch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DiffMatchPatch.m; sourceTree = "<group>"; };
|
||||
CA0688DD2CD374CC00DF7025 /* NSMutableDictionary+DMPExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DMPExtensions.h"; sourceTree = "<group>"; };
|
||||
CA0688DE2CD374CC00DF7025 /* NSString+UnicharUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+UnicharUtilities.m"; sourceTree = "<group>"; };
|
||||
CA0688DF2CD374CC00DF7025 /* NSString+UriCompatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+UriCompatibility.h"; sourceTree = "<group>"; };
|
||||
CA0688E02CD374CC00DF7025 /* NSString+UnicharUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+UnicharUtilities.h"; sourceTree = "<group>"; };
|
||||
CA0688E12CD374CC00DF7025 /* NSMutableDictionary+DMPExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DMPExtensions.m"; sourceTree = "<group>"; };
|
||||
CA0688E22CD374CC00DF7025 /* NSString+JavaSubstring.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+JavaSubstring.m"; sourceTree = "<group>"; };
|
||||
CA0688E32CD374CC00DF7025 /* NSString+UriCompatibility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+UriCompatibility.m"; sourceTree = "<group>"; };
|
||||
CA0688E42CD374CC00DF7025 /* DiffMatchPatch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiffMatchPatch.h; sourceTree = "<group>"; };
|
||||
CA0689212CD3753F00DF7025 /* DiffMatchPatchCFUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiffMatchPatchCFUtilities.h; sourceTree = "<group>"; };
|
||||
CA0689222CD3753F00DF7025 /* MinMaxMacros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MinMaxMacros.h; sourceTree = "<group>"; };
|
||||
CA0689232CD3753F00DF7025 /* DiffMatchPatchCFUtilities.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = DiffMatchPatchCFUtilities.c; sourceTree = "<group>"; };
|
||||
CA0689242CD3753F00DF7025 /* DiffMatchPatch_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiffMatchPatch_Prefix.pch; sourceTree = "<group>"; };
|
||||
CA07CD122CC5E5C500AF41ED /* XieYiAlterView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XieYiAlterView.h; sourceTree = "<group>"; };
|
||||
CA07CD132CC5E5C500AF41ED /* XieYiAlterView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XieYiAlterView.m; sourceTree = "<group>"; };
|
||||
CA07CD152CC5F25B00AF41ED /* TextbookDetailModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TextbookDetailModel.h; sourceTree = "<group>"; };
|
||||
|
@ -1571,6 +1591,35 @@
|
|||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA0688DA2CD374BC00DF7025 /* Diff */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CA0689202CD3753400DF7025 /* other */,
|
||||
CA0688E42CD374CC00DF7025 /* DiffMatchPatch.h */,
|
||||
CA0688DC2CD374CB00DF7025 /* DiffMatchPatch.m */,
|
||||
CA0688DD2CD374CC00DF7025 /* NSMutableDictionary+DMPExtensions.h */,
|
||||
CA0688E12CD374CC00DF7025 /* NSMutableDictionary+DMPExtensions.m */,
|
||||
CA0688DB2CD374CB00DF7025 /* NSString+JavaSubstring.h */,
|
||||
CA0688E22CD374CC00DF7025 /* NSString+JavaSubstring.m */,
|
||||
CA0688E02CD374CC00DF7025 /* NSString+UnicharUtilities.h */,
|
||||
CA0688DE2CD374CC00DF7025 /* NSString+UnicharUtilities.m */,
|
||||
CA0688DF2CD374CC00DF7025 /* NSString+UriCompatibility.h */,
|
||||
CA0688E32CD374CC00DF7025 /* NSString+UriCompatibility.m */,
|
||||
);
|
||||
path = Diff;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA0689202CD3753400DF7025 /* other */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CA0689242CD3753F00DF7025 /* DiffMatchPatch_Prefix.pch */,
|
||||
CA0689232CD3753F00DF7025 /* DiffMatchPatchCFUtilities.c */,
|
||||
CA0689212CD3753F00DF7025 /* DiffMatchPatchCFUtilities.h */,
|
||||
CA0689222CD3753F00DF7025 /* MinMaxMacros.h */,
|
||||
);
|
||||
path = other;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
CA0C3A802CB4C25B00E01A72 /* 换个思路 */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
@ -3287,6 +3336,7 @@
|
|||
CABD8C8A2CBF919D009A5E5E /* view */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
CA0688DA2CD374BC00DF7025 /* Diff */,
|
||||
CABD8C8B2CBF91B0009A5E5E /* GongJuWenBenView.h */,
|
||||
CABD8C8C2CBF91B0009A5E5E /* GongJuWenBenView.m */,
|
||||
);
|
||||
|
@ -4445,6 +4495,7 @@
|
|||
knownRegions = (
|
||||
en,
|
||||
Base,
|
||||
English,
|
||||
);
|
||||
mainGroup = CB489DBC27449D5C00DA044A;
|
||||
productRefGroup = CB489DC627449D5C00DA044A /* Products */;
|
||||
|
@ -4739,6 +4790,7 @@
|
|||
CA0D08712CA54D4B0086855E /* ShouYeLiShiJiLuXZTableViewCell.m in Sources */,
|
||||
CB489F742744A0BD00DA044A /* MCTabBar.m in Sources */,
|
||||
CB489FB12744A0BD00DA044A /* FSActionSheetCell.m in Sources */,
|
||||
CA0688E92CD374CD00DF7025 /* NSString+UriCompatibility.m in Sources */,
|
||||
CA11ED782CA69B5200209DFC /* GaiXieRunSeView.m in Sources */,
|
||||
CB489F6D2744A0BD00DA044A /* UIView+Additions.m in Sources */,
|
||||
CAB0D3752CAA47F3009BF67D /* ZhiNengXieZuoViewController.m in Sources */,
|
||||
|
@ -4766,6 +4818,7 @@
|
|||
CA0D085A2CA543E40086855E /* ShouYeZCPPTTableViewCell.m in Sources */,
|
||||
CA6D547A2CCB9F00001B530A /* CorrectWriteCorrectModel.m in Sources */,
|
||||
CA81819D2C9E9C6600EE7E6E /* StartKTXZPGDetailViewController.m in Sources */,
|
||||
CA0688E52CD374CD00DF7025 /* DiffMatchPatch.m in Sources */,
|
||||
CB489FA32744A0BD00DA044A /* ZJContentView.m in Sources */,
|
||||
CA5D02E62CC0DD6B007B3BA5 /* UserUploadModel.m in Sources */,
|
||||
CA5D02EA2CC0DD6B007B3BA5 /* UserShareModel.m in Sources */,
|
||||
|
@ -4773,6 +4826,7 @@
|
|||
CA0688D32CD329AD00DF7025 /* TranslateLanguageModel.m in Sources */,
|
||||
CAC8064E2CA119F800C21AA7 /* StartZWPIDetailView.m in Sources */,
|
||||
CA5D02E32CC0DD6B007B3BA5 /* UserModel.m in Sources */,
|
||||
CA0688E72CD374CD00DF7025 /* NSMutableDictionary+DMPExtensions.m in Sources */,
|
||||
CB489F6C2744A0BD00DA044A /* RadianDisView.m in Sources */,
|
||||
CA07CD1A2CC6335400AF41ED /* ExampleCorrectList.m in Sources */,
|
||||
CA487D8A2CA3AB6B00AE773B /* UITableView+MoveCell.m in Sources */,
|
||||
|
@ -4886,6 +4940,7 @@
|
|||
CB489F6E2744A0BD00DA044A /* UIButton+EnlargeTouchArea.m in Sources */,
|
||||
CB489F972744A0BD00DA044A /* WkWebviewViewController.m in Sources */,
|
||||
CB489F692744A0BD00DA044A /* CalendarDataDays.m in Sources */,
|
||||
CA0689252CD3753F00DF7025 /* DiffMatchPatchCFUtilities.c in Sources */,
|
||||
CB489F932744A0BD00DA044A /* PutImageModel.m in Sources */,
|
||||
CA6B97252CBCEBE3000213F3 /* AIChatTextTableViewCell.m in Sources */,
|
||||
CA11ED5D2CA653F600209DFC /* CamreImagesView.m in Sources */,
|
||||
|
@ -4971,6 +5026,7 @@
|
|||
CA11ED612CA6556900209DFC /* CamreImagesCollectionViewCell.m in Sources */,
|
||||
CAF76E942CBE69F900825E5E /* GongJuCreateTimeView.m in Sources */,
|
||||
CA0D08452CA5316B0086855E /* ShouYeShenFenView.m in Sources */,
|
||||
CA0688E82CD374CD00DF7025 /* NSString+JavaSubstring.m in Sources */,
|
||||
CB489FB52744A0BD00DA044A /* HYTimePickerView.m in Sources */,
|
||||
CA4257A32CA29BF900A36A10 /* StartZNPPTDaGangAlterView.m in Sources */,
|
||||
CA0D08832CA5682D0086855E /* CamreViewController.m in Sources */,
|
||||
|
@ -4980,6 +5036,7 @@
|
|||
CA22D1CA2CD07D9100CA7E93 /* CorrectSaveModel.m in Sources */,
|
||||
CAC8066C2CA16DCC00C21AA7 /* StartPZXZViewController.m in Sources */,
|
||||
CB489F722744A0BD00DA044A /* MCTabBarController.m in Sources */,
|
||||
CA0688E62CD374CD00DF7025 /* NSString+UnicharUtilities.m in Sources */,
|
||||
CABD8CAB2CBFB39F009A5E5E /* GongJuMinGanCiController.m in Sources */,
|
||||
CA5D03642CC0DE8D007B3BA5 /* YaoQingViewController.m in Sources */,
|
||||
CB489F9F2744A0BD00DA044A /* LogView.m in Sources */,
|
||||
|
|
Binary file not shown.
|
@ -148,38 +148,6 @@
|
|||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "C8E8B872-E034-45E0-AEFF-DE7601EB99A9"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "1723"
|
||||
endingLineNumber = "1723"
|
||||
landmarkName = "+requestToolCheckData:content:type:Callback:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "9FFFA0FB-EB13-41E4-BCFC-3275868D28DE"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "ProductApp/ProductMain/NetWorkManager/NetWorkManager.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "1758"
|
||||
endingLineNumber = "1758"
|
||||
landmarkName = "+requestApiOcrData:ID:Callback:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
|
@ -196,5 +164,21 @@
|
|||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "26D5C33E-BBFC-4B24-8518-3E0B0F5B3170"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "ProductApp/ProductMain/工具/文本比较/view/NSString+KMP.m"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "23"
|
||||
endingLineNumber = "23"
|
||||
landmarkName = "-kmpIndexesOfString:options:"
|
||||
landmarkType = "7">
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
|
|
@ -2,6 +2,19 @@
|
|||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>wx</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>wx31efd88bd33ae068</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
<key>GT_MinimumOSVersion</key>
|
||||
<integer>11</integer>
|
||||
<key>LSApplicationQueriesSchemes</key>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
#ifndef PrefixHeader_pch
|
||||
#define PrefixHeader_pch
|
||||
|
||||
|
||||
#ifdef __OBJC__
|
||||
|
||||
#import <AFNetworking/AFNetworking.h>
|
||||
#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
|
||||
#import <IQKeyboardManager/IQKeyboardManager.h>
|
||||
|
@ -42,5 +43,9 @@
|
|||
#import "ViewLable.h"
|
||||
|
||||
#import "LoadAlterView.h"
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#endif /* PrefixHeader_pch */
|
||||
|
|
|
@ -11,7 +11,7 @@ NS_ASSUME_NONNULL_BEGIN
|
|||
|
||||
@interface ToolCheckModel : BaseModel
|
||||
///
|
||||
@property (nonatomic , strong) NSString *data;
|
||||
@property (nonatomic , strong) NSArray *data;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
|
|
@ -12,8 +12,15 @@
|
|||
#import "NetWorkManager.h"
|
||||
#import "GongJuSearchViewController.h"
|
||||
|
||||
#import "StartPayViewController.h"
|
||||
#import "KeTangXieZuoViewController.h"
|
||||
|
||||
#import "ShouYeLingYuViewController.h"
|
||||
#import "ShouYeShenFenViewController.h"
|
||||
|
||||
@interface GongJuViewController ()<SDCycleScrollViewDelegate,ZJScrollPageViewDelegate>
|
||||
///
|
||||
@property (nonatomic , strong) UIButton *btnianji;
|
||||
//轮播
|
||||
@property (nonatomic, strong) SDCycleScrollView *cleScrollView;
|
||||
|
||||
|
@ -31,6 +38,14 @@
|
|||
-(void)viewWillAppear:(BOOL)animated
|
||||
{
|
||||
[super viewWillAppear:animated];
|
||||
[self updateBtShow];
|
||||
|
||||
if([UserInfoModel shareModel].isupdataJiaoyu && self.arrdata.count>0)
|
||||
{
|
||||
[UserInfoModel shareModel].isupdataJiaoyu = NO;
|
||||
[self getdata];
|
||||
}
|
||||
|
||||
}
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
|
@ -43,12 +58,12 @@
|
|||
SDCycleScrollView *cleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectZero imageNamesGroup:@[]];
|
||||
cleScrollView.scrollDirection = UICollectionViewScrollDirectionHorizontal;
|
||||
cleScrollView.delegate = self;
|
||||
cleScrollView.backgroundColor = [UIColor whiteColor];
|
||||
// cleScrollView.backgroundColor = [UIColor whiteColor];
|
||||
cleScrollView.titleLabelBackgroundColor = [UIColor clearColor];
|
||||
cleScrollView.titleLabelTextColor = [UIColor darkGrayColor];
|
||||
cleScrollView.titleLabelTextFont = [UIFont systemFontOfSize:[Tools sizeFont:14]];
|
||||
cleScrollView.autoScrollTimeInterval = 3.0;
|
||||
cleScrollView.placeholderImage = [UIImage imageNamed:@"home_bannernomo"];
|
||||
// cleScrollView.placeholderImage = [UIImage imageNamed:@"home_bannernomo"];
|
||||
cleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFill;
|
||||
[cleScrollView setShowPageControl:YES];
|
||||
cleScrollView.pageControlBottomOffset = -5;
|
||||
|
@ -61,10 +76,16 @@
|
|||
make.height.offset(90);
|
||||
}];
|
||||
[cleScrollView.layer setMasksToBounds:YES];
|
||||
[cleScrollView.layer setCornerRadius:8];
|
||||
[cleScrollView.layer setCornerRadius:17];
|
||||
_cleScrollView = cleScrollView;
|
||||
|
||||
cleScrollView.imageURLStringsGroup = @[@"",@"",@""];
|
||||
NSArray *arrbanner = [[UserInfoModel shareModel].config objectForKey:@"client.tools.banner.urls"];
|
||||
NSMutableArray *arrurls = [NSMutableArray new];
|
||||
for(NSDictionary *dic in arrbanner)
|
||||
{
|
||||
[arrurls addObject:[Tools isStringnil:[dic objectForKey:@"image"]]];
|
||||
}
|
||||
cleScrollView.imageURLStringsGroup = arrurls;
|
||||
|
||||
[self drawUI];
|
||||
|
||||
|
@ -121,6 +142,7 @@
|
|||
[btnianji setIconInRightWithSpacing:6];
|
||||
[btnianji setTag:0];
|
||||
[btnianji addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
_btnianji = btnianji;
|
||||
|
||||
PGJSearchView *viewsearh = [[PGJSearchView alloc] init];
|
||||
[self.navigationView addSubview:viewsearh];
|
||||
|
@ -139,6 +161,8 @@
|
|||
make.edges.equalTo(viewsearh);
|
||||
}];
|
||||
|
||||
|
||||
|
||||
UIButton *btsearch = [[UIButton alloc] init];
|
||||
[viewsearh addSubview:btsearch];
|
||||
[btsearch mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
|
@ -146,14 +170,54 @@
|
|||
}];
|
||||
[btsearch setTag:1];
|
||||
[btsearch addTarget:self action:@selector(topAction:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
[self updateBtShow];
|
||||
}
|
||||
-(void)updateBtShow
|
||||
{
|
||||
if([UserInfoModel shareModel].identityType.intValue==3)
|
||||
{
|
||||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@",[UserInfoModel getidentityTypeString]] forState:UIControlStateNormal];
|
||||
}
|
||||
else
|
||||
{
|
||||
if([UserInfoModel shareModel].user_stage==nil)
|
||||
{
|
||||
[self.btnianji setTitle:@"请选择" forState:UIControlStateNormal];
|
||||
}
|
||||
else
|
||||
{
|
||||
if([UserInfoModel shareModel].isAllLevel.intValue==1)
|
||||
{
|
||||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.parent_name] forState:UIControlStateNormal];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self.btnianji setTitle:[NSString stringWithFormat:@"%@-%@",[UserInfoModel getidentityTypeString],[UserInfoModel shareModel].user_stage.name] forState:UIControlStateNormal];
|
||||
}
|
||||
}
|
||||
}
|
||||
float f_width = [Tools getWidthWithText:self.btnianji.titleLabel.text height:20 font:16]+20;
|
||||
[self.btnianji mas_updateConstraints:^(MASConstraintMaker *make) {
|
||||
make.width.offset(f_width);
|
||||
}];
|
||||
[self.btnianji setIconInRightWithSpacing:6];
|
||||
}
|
||||
|
||||
-(void)topAction:(UIButton *)sender
|
||||
{
|
||||
if(sender.tag==0)
|
||||
{
|
||||
|
||||
///未选择过身份或者是职场
|
||||
if([UserInfoModel shareModel].identityType.intValue == 3 || [UserInfoModel shareModel].user_stage==nil)
|
||||
{
|
||||
ShouYeLingYuViewController *vc = [ShouYeLingYuViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
ShouYeShenFenViewController *vc = [ShouYeShenFenViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -193,8 +257,39 @@
|
|||
#pragma mark -/** 点击图片回调 */
|
||||
- (void)cycleScrollView:(SDCycleScrollView *)cycleScrollView didSelectItemAtIndex:(NSInteger)index
|
||||
{
|
||||
|
||||
[self pushAction:index];
|
||||
}
|
||||
-(void)pushAction:(NSInteger)index
|
||||
{
|
||||
NSArray *arrbanner = [[UserInfoModel shareModel].config objectForKey:@"client.home.banner.urls"];
|
||||
|
||||
NSDictionary *dic = arrbanner[index];
|
||||
NSString *strpage = [Tools isStringnil:[dic objectForKey:@"page"]];
|
||||
if([strpage isEqualToString:@"recharge"])
|
||||
{
|
||||
StartPayViewController *vc = [StartPayViewController new];
|
||||
vc.ptype = 1;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if([strpage isEqualToString:@"composition"])
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"1"];
|
||||
}
|
||||
else if([strpage isEqualToString:@"write_tools"])
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"3"];
|
||||
}
|
||||
else if([strpage isEqualToString:@"classroom_write"])
|
||||
{
|
||||
KeTangXieZuoViewController *vc = [KeTangXieZuoViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if([strpage isEqualToString:@"write_assistant"])
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:@"carnumberChangeNotifi" object:@"2"];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - custom delegate - 自定义或者第三方控件的delegate
|
||||
- (NSInteger)numberOfChildViewControllers {
|
||||
return self.arrdata.count;
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
#import "UIView+XLExtension.h"
|
||||
#import "UIAlertController+Blocks.h"
|
||||
#import "WYCamaImageTools.h"
|
||||
#import "PublicUploadImageManager.h"
|
||||
#import "NetWorkManager.h"
|
||||
|
||||
@interface GongJuImageToTextView ()<WYCamaImageToolsDelegate>
|
||||
///
|
||||
|
@ -23,6 +25,9 @@
|
|||
|
||||
@property (nonatomic, strong) WYCamaImageTools *tools;
|
||||
|
||||
///
|
||||
@property (nonatomic , strong) UIImage *imageshow;
|
||||
|
||||
@end
|
||||
|
||||
@implementation GongJuImageToTextView
|
||||
|
@ -293,17 +298,54 @@
|
|||
}
|
||||
-(void)delAction
|
||||
{
|
||||
self.imageshow = nil;
|
||||
[self.imgvshow setHidden:YES];
|
||||
}
|
||||
-(void)bottomAction
|
||||
{
|
||||
[self.viewout setHidden:NO];
|
||||
|
||||
|
||||
|
||||
|
||||
if(self.imageshow==nil)
|
||||
{
|
||||
[HXHud showMessage:@"请添加图片" afterDelayType:0];
|
||||
return;
|
||||
}
|
||||
[LoadAlterView show];
|
||||
[[PublicUploadImageManager shareManager] netWorkUrlUserPost:[NSString stringWithFormat:@"%@%@",BaseUrl,@"api/file/ocr"] UploadImage:self.imageshow dicQuery:@{} Callback:^(BOOL state, NSDictionary *responseObject, NSString * _Nullable describle) {
|
||||
if(state)
|
||||
{
|
||||
[self getData:[responseObject objectForKey:@"id"]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[LoadAlterView dismiss];
|
||||
[HXHud showMessage:describle afterDelayType:1];
|
||||
}
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getData:(NSString *)strid
|
||||
{
|
||||
[self addtoolsNumber];
|
||||
[NetWorkManager requestApiOcrData:self ID:strid Callback:^(BOOL state, OcrModel *responseObject, NSString * _Nullable describle) {
|
||||
[LoadAlterView dismiss];
|
||||
if(state)
|
||||
{
|
||||
[self.viewout setHidden:NO];
|
||||
self.lbcontent.text = responseObject.data.result;
|
||||
}
|
||||
else
|
||||
{
|
||||
[HXHud showMessage:responseObject.message afterDelayType:1];
|
||||
}
|
||||
}];
|
||||
|
||||
}
|
||||
-(void)addtoolsNumber
|
||||
{
|
||||
[NetWorkManager requestToolsAdd_countData:self tool_id:[NSString stringWithFormat:@"%d",1] Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)didEndChoosePic:(UIImage *)image
|
||||
{
|
||||
UIImage *imagetemp = image;
|
||||
|
@ -327,6 +369,7 @@
|
|||
}
|
||||
- (void)uploadImgData:(UIImage *)image {
|
||||
|
||||
self.imageshow = image;
|
||||
self.imgvshow.image = image;
|
||||
[self.imgvshow setHidden:NO];
|
||||
// [HXLoadingHUD showWithStatus:@"" maskType:0];
|
||||
|
|
|
@ -11,6 +11,15 @@
|
|||
#import "GongJuListTableViewCell.h"
|
||||
#import "NetWorkManager.h"
|
||||
|
||||
#import "GongJuCreateViewController.h"
|
||||
#import "KeTangXieZuoViewController.h"
|
||||
#import "GongJuTextViewController.h"
|
||||
#import "GongJuWenBenViewController.h"
|
||||
#import "GongJuFanYiViewController.h"
|
||||
#import "GongJuImageToTextViewController.h"
|
||||
#import "GongJuMinGanCiController.h"
|
||||
|
||||
|
||||
@interface GongJuSearchListViewController ()<UITableViewDelegate,UITableViewDataSource>
|
||||
///
|
||||
@property (nonatomic , strong) UITableView *tableView;
|
||||
|
@ -191,7 +200,48 @@
|
|||
}
|
||||
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
|
||||
{
|
||||
|
||||
ToolsListModelDataItems *model = self.arrdata[indexPath.row];
|
||||
if(model.ID.intValue>=1 && model.ID.intValue<=9)
|
||||
{
|
||||
if(model.ID.intValue==9)
|
||||
{
|
||||
KeTangXieZuoViewController *vc = [KeTangXieZuoViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==6||model.ID.intValue==7||model.ID.intValue==8||model.ID.intValue==3)
|
||||
{
|
||||
GongJuTextViewController *vc = [GongJuTextViewController new];
|
||||
vc.strtitle = model.tool_name;
|
||||
vc.type = model.ID.intValue;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==5)
|
||||
{
|
||||
GongJuMinGanCiController *vc = [GongJuMinGanCiController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==4)
|
||||
{
|
||||
GongJuFanYiViewController *vc = [GongJuFanYiViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==2)
|
||||
{
|
||||
GongJuWenBenViewController *vc = [GongJuWenBenViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==1)
|
||||
{
|
||||
GongJuImageToTextViewController *vc = [GongJuImageToTextViewController new];
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
GongJuCreateViewController *vc = [GongJuCreateViewController new];
|
||||
vc.modelDetail = model;
|
||||
[self.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -398,8 +398,9 @@
|
|||
[LoadAlterView dismiss];
|
||||
if(state)
|
||||
{
|
||||
[self.viewout setHidden:NO];
|
||||
self.lbcontent.isCloseAnimation = YES;
|
||||
self.lbcontent.strValue = responseObject.data;
|
||||
self.lbcontent.strValue = [responseObject.data componentsJoinedByString:@"、"];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
@property (nonatomic , strong) SSEConfigModel *modelConfig;
|
||||
|
||||
@property (nonatomic , assign) BOOL isDragging;
|
||||
@property (nonatomic , assign) BOOL isDraw;
|
||||
@end
|
||||
|
||||
@implementation GongJuTextView
|
||||
|
@ -326,6 +327,11 @@
|
|||
}
|
||||
-(void)bottomAction
|
||||
{
|
||||
if(self.isDraw==YES)
|
||||
{
|
||||
[HXHud showMessage:@"请等待处理完成" afterDelayType:0];
|
||||
return;
|
||||
}
|
||||
if(self.textview.text.length==0)
|
||||
{
|
||||
[HXHud showMessage:self.textview.placeholder afterDelayType:0];
|
||||
|
@ -343,6 +349,7 @@
|
|||
|
||||
-(void)getdata
|
||||
{
|
||||
self.isDraw = YES;
|
||||
[LoadAlterView show];
|
||||
///translate 翻译、get_summary 摘要、get_keyword 关键字、to_sort 缩写、to_long 扩写
|
||||
/*
|
||||
|
@ -387,6 +394,7 @@
|
|||
} error:^(NSString * _Nonnull errorString) {
|
||||
[LoadAlterView dismiss];
|
||||
[HXHud showMessage:errorString afterDelayType:0];
|
||||
self.isDraw = NO;
|
||||
} ID:^(NSString * _Nonnull value) {
|
||||
|
||||
}];
|
||||
|
@ -396,6 +404,7 @@
|
|||
NSLog(@"%@",value);
|
||||
if(isfinish)
|
||||
{
|
||||
self.isDraw = NO;
|
||||
self.lbcontent.isWriteEnd = YES;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -0,0 +1,173 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/*
|
||||
* Functions for diff, match and patch.
|
||||
* Computes the difference between two texts to create a patch.
|
||||
* Applies the patch onto another text, allowing for errors.
|
||||
*/
|
||||
|
||||
/*
|
||||
* The data structure representing a diff is an NSMutableArray of Diff objects:
|
||||
* {Diff(Operation.DIFF_DELETE, "Hello"),
|
||||
* Diff(Operation.DIFF_INSERT, "Goodbye"),
|
||||
* Diff(Operation.DIFF_EQUAL, " world.")}
|
||||
* which means: delete "Hello", add "Goodbye" and keep " world."
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
DIFF_DELETE = 1,
|
||||
DIFF_INSERT = 2,
|
||||
DIFF_EQUAL = 3
|
||||
} Operation;
|
||||
|
||||
|
||||
/*
|
||||
* Class representing one diff operation.
|
||||
*/
|
||||
@interface Diff : NSObject <NSCopying> {
|
||||
Operation operation; // One of: DIFF_INSERT, DIFF_DELETE or DIFF_EQUAL.
|
||||
NSString *text; // The text associated with this diff operation.
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) Operation operation;
|
||||
@property (nonatomic, copy) NSString *text;
|
||||
|
||||
+ (id)diffWithOperation:(Operation)anOperation andText:(NSString *)aText;
|
||||
|
||||
- (id)initWithOperation:(Operation)anOperation andText:(NSString *)aText;
|
||||
|
||||
@end
|
||||
|
||||
/*
|
||||
* Class representing one patch operation.
|
||||
*/
|
||||
@interface Patch : NSObject <NSCopying> {
|
||||
NSMutableArray *diffs;
|
||||
NSUInteger start1;
|
||||
NSUInteger start2;
|
||||
NSUInteger length1;
|
||||
NSUInteger length2;
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSMutableArray *diffs;
|
||||
@property (nonatomic, assign) NSUInteger start1;
|
||||
@property (nonatomic, assign) NSUInteger start2;
|
||||
@property (nonatomic, assign) NSUInteger length1;
|
||||
@property (nonatomic, assign) NSUInteger length2;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
/*
|
||||
* Class containing the diff, match and patch methods.
|
||||
* Also Contains the behaviour settings.
|
||||
*/
|
||||
@interface DiffMatchPatch : NSObject {
|
||||
// Number of seconds to map a diff before giving up (0 for infinity).
|
||||
NSTimeInterval Diff_Timeout;
|
||||
|
||||
// Cost of an empty edit operation in terms of edit characters.
|
||||
NSUInteger Diff_EditCost;
|
||||
|
||||
// At what point is no match declared (0.0 = perfection, 1.0 = very loose).
|
||||
double Match_Threshold;
|
||||
|
||||
// How far to search for a match (0 = exact location, 1000+ = broad match).
|
||||
// A match this many characters away from the expected location will add
|
||||
// 1.0 to the score (0.0 is a perfect match).
|
||||
NSInteger Match_Distance;
|
||||
|
||||
// When deleting a large block of text (over ~64 characters), how close
|
||||
// do the contents have to be to match the expected contents. (0.0 =
|
||||
// perfection, 1.0 = very loose). Note that Match_Threshold controls
|
||||
// how closely the end points of a delete need to match.
|
||||
float Patch_DeleteThreshold;
|
||||
|
||||
// Chunk size for context length.
|
||||
uint16_t Patch_Margin;
|
||||
|
||||
// The number of bits in an int.
|
||||
NSUInteger Match_MaxBits;
|
||||
}
|
||||
|
||||
@property (nonatomic, assign) NSTimeInterval Diff_Timeout;
|
||||
@property (nonatomic, assign) NSUInteger Diff_EditCost;
|
||||
@property (nonatomic, assign) double Match_Threshold;
|
||||
@property (nonatomic, assign) NSInteger Match_Distance;
|
||||
@property (nonatomic, assign) float Patch_DeleteThreshold;
|
||||
@property (nonatomic, assign) uint16_t Patch_Margin;
|
||||
|
||||
- (NSMutableArray *)diff_mainOfOldString:(NSString *)text1 andNewString:(NSString *)text2;
|
||||
- (NSMutableArray *)diff_mainOfOldString:(NSString *)text1 andNewString:(NSString *)text2 checkLines:(BOOL)checklines;
|
||||
- (NSUInteger)diff_commonPrefixOfFirstString:(NSString *)text1 andSecondString:(NSString *)text2;
|
||||
- (NSUInteger)diff_commonSuffixOfFirstString:(NSString *)text1 andSecondString:(NSString *)text2;
|
||||
- (void)diff_cleanupSemantic:(NSMutableArray *)diffs;
|
||||
- (void)diff_cleanupSemanticLossless:(NSMutableArray *)diffs;
|
||||
- (void)diff_cleanupEfficiency:(NSMutableArray *)diffs;
|
||||
- (void)diff_cleanupMerge:(NSMutableArray *)diffs;
|
||||
- (NSUInteger)diff_xIndexIn:(NSMutableArray *)diffs location:(NSUInteger) loc;
|
||||
- (NSString *)diff_prettyHtml:(NSMutableArray *)diffs;
|
||||
- (NSString *)diff_text1:(NSMutableArray *)diffs;
|
||||
- (NSString *)diff_text2:(NSMutableArray *)diffs;
|
||||
- (NSUInteger)diff_levenshtein:(NSMutableArray *)diffs;
|
||||
- (NSString *)diff_toDelta:(NSMutableArray *)diffs;
|
||||
- (NSMutableArray *)diff_fromDeltaWithText:(NSString *)text1 andDelta:(NSString *)delta error:(NSError **)error;
|
||||
|
||||
- (NSUInteger)match_mainForText:(NSString *)text pattern:(NSString *)pattern near:(NSUInteger)loc;
|
||||
- (NSMutableDictionary *)match_alphabet:(NSString *)pattern;
|
||||
|
||||
- (NSMutableArray *)patch_makeFromOldString:(NSString *)text1 andNewString:(NSString *)text2;
|
||||
- (NSMutableArray *)patch_makeFromDiffs:(NSMutableArray *)diffs;
|
||||
- (NSMutableArray *)patch_makeFromOldString:(NSString *)text1 newString:(NSString *)text2 diffs:(NSMutableArray *)diffs;
|
||||
- (NSMutableArray *)patch_makeFromOldString:(NSString *)text1 andDiffs:(NSMutableArray *)diffs;
|
||||
- (NSMutableArray *)patch_deepCopy:(NSArray *)patches; // Copy rule applies!
|
||||
- (NSArray *)patch_apply:(NSArray *)sourcePatches toString:(NSString *)text;
|
||||
- (NSString *)patch_addPadding:(NSMutableArray *)patches;
|
||||
- (void)patch_splitMax:(NSMutableArray *)patches;
|
||||
- (NSString *)patch_toText:(NSMutableArray *)patches;
|
||||
- (NSMutableArray *)patch_fromText:(NSString *)textline error:(NSError **)error;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface DiffMatchPatch (PrivateMethods)
|
||||
|
||||
- (NSMutableArray *)diff_mainOfOldString:(NSString *)text1 andNewString:(NSString *)text2 checkLines:(BOOL)checklines deadline:(NSTimeInterval)deadline;
|
||||
- (NSMutableArray *)diff_computeFromOldString:(NSString *)text1 andNewString:(NSString *)text2 checkLines:(BOOL)checklines deadline:(NSTimeInterval)deadline;
|
||||
- (NSMutableArray *)diff_lineModeFromOldString:(NSString *)text1 andNewString:(NSString *)text2 deadline:(NSTimeInterval)deadline;
|
||||
- (NSArray *)diff_linesToCharsForFirstString:(NSString *)text1 andSecondString:(NSString *)text2;
|
||||
- (void)diff_chars:(NSArray *)diffs toLines:(NSMutableArray *)lineArray;
|
||||
- (NSMutableArray *)diff_bisectOfOldString:(NSString *)text1 andNewString:(NSString *)text2 deadline:(NSTimeInterval)deadline;
|
||||
- (NSMutableArray *)diff_bisectSplitOfOldString:(NSString *)text1 andNewString:(NSString *)text2 x:(NSUInteger)x y:(NSUInteger)y deadline:(NSTimeInterval)deadline;
|
||||
- (NSUInteger)diff_commonOverlapOfFirstString:(NSString *)text1 andSecondString:(NSString *)text2;
|
||||
- (NSArray *)diff_halfMatchOfFirstString:(NSString *)text1 andSecondString:(NSString *)text2;
|
||||
- (NSArray *)diff_halfMatchIOfLongString:(NSString *)longtext andShortString:(NSString *)shorttext;
|
||||
- (NSInteger)diff_cleanupSemanticScoreOfFirstString:(NSString *)one andSecondString:(NSString *)two;
|
||||
|
||||
- (NSUInteger)match_bitapOfText:(NSString *)text andPattern:(NSString *)pattern near:(NSUInteger)loc;
|
||||
- (double)match_bitapScoreForErrorCount:(NSUInteger)e location:(NSUInteger)x near:(NSUInteger)loc pattern:(NSString *)pattern;
|
||||
|
||||
- (void)patch_addContextToPatch:(Patch *)patch sourceText:(NSString *)text;
|
||||
|
||||
@end
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSMutableDictionary (DMPExtensions)
|
||||
|
||||
- (id)diff_objectForIntegerKey:(NSInteger)keyInteger;
|
||||
- (id)diff_objectForUnsignedIntegerKey:(NSUInteger)keyUInteger;
|
||||
- (id)diff_objectForUnicharKey:(unichar)aUnicharKey;
|
||||
|
||||
- (NSInteger)diff_integerForKey:(id)aKey;
|
||||
- (NSUInteger)diff_unsignedIntegerForKey:(id)aKey;
|
||||
- (NSInteger)diff_integerForIntegerKey:(NSInteger)keyInteger;
|
||||
- (NSUInteger)diff_unsignedIntegerForUnicharKey:(unichar)aUnicharKey;
|
||||
|
||||
- (BOOL)diff_containsObjectForKey:(id)aKey;
|
||||
- (BOOL)diff_containsObjectForUnicharKey:(unichar)aUnicharKey;
|
||||
|
||||
- (void)diff_setIntegerValue:(NSInteger)anInteger forKey:(id)aKey;
|
||||
- (void)diff_setIntegerValue:(NSInteger)anInteger forIntegerKey:(NSInteger)keyInteger;
|
||||
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forKey:(id)aKey;
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forUnsignedIntegerKey:(NSUInteger)keyUInteger;
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forUnicharKey:(unichar)aUnicharKey;
|
||||
|
||||
@end
|
|
@ -0,0 +1,108 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import "NSMutableDictionary+DMPExtensions.h"
|
||||
|
||||
#import "NSString+UnicharUtilities.h"
|
||||
|
||||
|
||||
@implementation NSMutableDictionary (DMPExtensions)
|
||||
|
||||
- (id)diff_objectForIntegerKey:(NSInteger)keyInteger;
|
||||
{
|
||||
return [self objectForKey:[NSNumber numberWithInteger:keyInteger]];
|
||||
}
|
||||
|
||||
- (id)diff_objectForUnsignedIntegerKey:(NSUInteger)keyUInteger;
|
||||
{
|
||||
return [self objectForKey:[NSNumber numberWithUnsignedInteger:keyUInteger]];
|
||||
}
|
||||
|
||||
- (id)diff_objectForUnicharKey:(unichar)aUnicharKey;
|
||||
{
|
||||
return [self objectForKey:[NSString diff_stringFromUnichar:aUnicharKey]];
|
||||
}
|
||||
|
||||
|
||||
- (NSInteger)diff_integerForKey:(id)aKey;
|
||||
{
|
||||
return [((NSNumber *)[self objectForKey:aKey]) integerValue];
|
||||
}
|
||||
|
||||
- (NSUInteger)diff_unsignedIntegerForKey:(id)aKey;
|
||||
{
|
||||
return [((NSNumber *)[self objectForKey:aKey]) unsignedIntegerValue];
|
||||
}
|
||||
|
||||
- (NSInteger)diff_integerForIntegerKey:(NSInteger)keyInteger;
|
||||
{
|
||||
return [((NSNumber *)[self objectForKey:[NSNumber numberWithInteger:keyInteger]]) integerValue];
|
||||
}
|
||||
|
||||
- (NSUInteger)diff_unsignedIntegerForUnicharKey:(unichar)aUnicharKey;
|
||||
{
|
||||
return [((NSNumber *)[self diff_objectForUnicharKey:aUnicharKey]) unsignedIntegerValue];
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)diff_containsObjectForKey:(id)aKey;
|
||||
{
|
||||
return ([self objectForKey:aKey] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)containsObjectForIntegerKey:(NSInteger)keyInteger;
|
||||
{
|
||||
return ([self objectForKey:[NSNumber numberWithInteger:keyInteger]] != nil);
|
||||
}
|
||||
|
||||
- (BOOL)diff_containsObjectForUnicharKey:(unichar)aUnicharKey;
|
||||
{
|
||||
return ([self diff_objectForUnicharKey:aUnicharKey] != nil);
|
||||
}
|
||||
|
||||
|
||||
- (void)diff_setIntegerValue:(NSInteger)anInteger forKey:(id)aKey;
|
||||
{
|
||||
[self setObject:[NSNumber numberWithInteger:anInteger] forKey:aKey];
|
||||
}
|
||||
|
||||
- (void)diff_setIntegerValue:(NSInteger)anInteger forIntegerKey:(NSInteger)keyInteger;
|
||||
{
|
||||
[self setObject:[NSNumber numberWithInteger:anInteger] forKey:[NSNumber numberWithInteger:keyInteger]];
|
||||
}
|
||||
|
||||
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forKey:(id)aKey;
|
||||
{
|
||||
[self setObject:[NSNumber numberWithUnsignedInteger:anUInteger] forKey:aKey];
|
||||
}
|
||||
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forUnsignedIntegerKey:(NSUInteger)keyUInteger;
|
||||
{
|
||||
[self setObject:[NSNumber numberWithUnsignedInteger:anUInteger] forKey:[NSNumber numberWithUnsignedInteger:keyUInteger]];
|
||||
}
|
||||
|
||||
- (void)diff_setUnsignedIntegerValue:(NSUInteger)anUInteger forUnicharKey:(unichar)aUnicharKey;
|
||||
{
|
||||
[self setObject:[NSNumber numberWithUnsignedInteger:anUInteger] forKey:[NSString diff_stringFromUnichar:aUnicharKey]];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,29 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSString (JavaSubstring)
|
||||
|
||||
- (NSString *)diff_javaSubstringFromStart:(NSUInteger)start toEnd:(NSUInteger)end;
|
||||
|
||||
@end
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import "NSString+JavaSubstring.h"
|
||||
|
||||
#import "DiffMatchPatchCFUtilities.h"
|
||||
|
||||
@implementation NSString (JavaSubstring)
|
||||
|
||||
- (NSString *)diff_javaSubstringFromStart:(NSUInteger)start toEnd:(NSUInteger)end;
|
||||
{
|
||||
CFStringRef c = diff_CFStringCreateJavaSubstring((CFStringRef)self, (CFIndex)start, (CFIndex)end);
|
||||
CFMakeCollectable(c);
|
||||
return [(NSString *)c autorelease];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSString (UnicharUtilities)
|
||||
|
||||
+ (NSString *)diff_stringFromUnichar:(unichar)ch;
|
||||
- (NSString *)diff_substringWithCharacterAtIndex:(NSUInteger)anIndex;
|
||||
|
||||
@end
|
|
@ -0,0 +1,39 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import "NSString+UnicharUtilities.h"
|
||||
|
||||
|
||||
@implementation NSString (UnicharUtilities)
|
||||
|
||||
+ (NSString *)diff_stringFromUnichar:(unichar)ch;
|
||||
{
|
||||
CFStringRef c = CFStringCreateWithCharacters(kCFAllocatorDefault, &ch, 1);
|
||||
CFMakeCollectable(c);
|
||||
return [(NSString *)c autorelease];
|
||||
}
|
||||
|
||||
- (NSString *)diff_substringWithCharacterAtIndex:(NSUInteger)anIndex;
|
||||
{
|
||||
return [self substringWithRange:NSMakeRange(anIndex, 1)];
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSString (UriCompatibility)
|
||||
|
||||
- (NSString *)diff_stringByAddingPercentEscapesForEncodeUriCompatibility;
|
||||
- (NSString *)diff_stringByReplacingPercentEscapesForEncodeUriCompatibility;
|
||||
|
||||
@end
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#import "NSString+UriCompatibility.h"
|
||||
|
||||
|
||||
@implementation NSString (UriCompatibility)
|
||||
|
||||
/**
|
||||
* Escape excluding selected chars for compatability with JavaScript's encodeURI.
|
||||
* This method produces uppercase hex.
|
||||
*
|
||||
* @return The escaped CFStringRef.
|
||||
*/
|
||||
- (NSString *)diff_stringByAddingPercentEscapesForEncodeUriCompatibility {
|
||||
NSMutableCharacterSet *allowedCharacters =
|
||||
[NSMutableCharacterSet characterSetWithCharactersInString:@" !~*'();/?:@&=+$,#"];
|
||||
[allowedCharacters formUnionWithCharacterSet:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
NSString *URLString =
|
||||
[self stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters];
|
||||
|
||||
return URLString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unescape all percent escapes.
|
||||
*
|
||||
* Example: "%3f" -> "?", "%24" -> "$", etc.
|
||||
*
|
||||
* @return The unescaped NSString.
|
||||
*/
|
||||
- (NSString *)diff_stringByReplacingPercentEscapesForEncodeUriCompatibility {
|
||||
NSString *decodedString = [self stringByRemovingPercentEncoding];
|
||||
return decodedString;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,592 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#include <CoreFoundation/CoreFoundation.h>
|
||||
|
||||
#include "DiffMatchPatchCFUtilities.h"
|
||||
|
||||
#include "MinMaxMacros.h"
|
||||
#include <regex.h>
|
||||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
|
||||
CFStringRef diff_CFStringCreateSubstring(CFStringRef text, CFIndex start_index, CFIndex length);
|
||||
CFRange diff_RightSubstringRange(CFIndex text_length, CFIndex new_length);
|
||||
CFStringRef diff_CFStringCreateRightSubstring(CFStringRef text, CFIndex text_length, CFIndex new_length);
|
||||
CFRange diff_LeftSubstringRange(CFIndex new_length);
|
||||
CFStringRef diff_CFStringCreateLeftSubstring(CFStringRef text, CFIndex new_length);
|
||||
CFStringRef diff_CFStringCreateSubstringWithStartIndex(CFStringRef text, CFIndex start_index);
|
||||
CFStringRef diff_CFStringCreateJavaSubstring(CFStringRef s, CFIndex begin, CFIndex end);
|
||||
CFStringRef diff_CFStringCreateByCombiningTwoStrings(CFStringRef best_common_part1, CFStringRef best_common_part2);
|
||||
Boolean diff_regExMatch(CFStringRef text, const regex_t *re);
|
||||
|
||||
CFArrayRef diff_halfMatchICreate(CFStringRef longtext, CFStringRef shorttext, CFIndex i);
|
||||
|
||||
// Utility functions
|
||||
CFStringRef diff_CFStringCreateFromUnichar(UniChar ch) {
|
||||
CFStringRef c = CFStringCreateWithCharacters(kCFAllocatorDefault, &ch, 1);
|
||||
CFMakeCollectable(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateSubstring(CFStringRef text, CFIndex start_index, CFIndex length) {
|
||||
CFRange substringRange;
|
||||
substringRange.length = length;
|
||||
substringRange.location = start_index;
|
||||
|
||||
CFStringRef substring = CFStringCreateWithSubstring(kCFAllocatorDefault, text, substringRange);
|
||||
CFMakeCollectable(substring);
|
||||
|
||||
return substring;
|
||||
}
|
||||
|
||||
CFRange diff_RightSubstringRange(CFIndex text_length, CFIndex new_length) {
|
||||
CFRange substringRange;
|
||||
substringRange.length = new_length;
|
||||
substringRange.location = text_length - new_length;
|
||||
return substringRange;
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateRightSubstring(CFStringRef text, CFIndex text_length, CFIndex new_length) {
|
||||
return diff_CFStringCreateSubstring(text, text_length - new_length, new_length);
|
||||
}
|
||||
|
||||
CFRange diff_LeftSubstringRange(CFIndex new_length) {
|
||||
CFRange substringRange;
|
||||
substringRange.length = new_length;
|
||||
substringRange.location = 0;
|
||||
return substringRange;
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateLeftSubstring(CFStringRef text, CFIndex new_length) {
|
||||
return diff_CFStringCreateSubstring(text, 0, new_length);
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateSubstringWithStartIndex(CFStringRef text, CFIndex start_index) {
|
||||
return diff_CFStringCreateSubstring(text, start_index, (CFStringGetLength(text) - start_index));
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateJavaSubstring(CFStringRef s, CFIndex begin, CFIndex end) {
|
||||
return diff_CFStringCreateSubstring(s, begin, end - begin);
|
||||
}
|
||||
|
||||
CFStringRef diff_CFStringCreateByCombiningTwoStrings(CFStringRef best_common_part1, CFStringRef best_common_part2) {
|
||||
CFIndex best_common_length;
|
||||
CFMutableStringRef best_common_mutable;
|
||||
best_common_length = CFStringGetLength(best_common_part1) + CFStringGetLength(best_common_part2);
|
||||
best_common_mutable = CFStringCreateMutableCopy(kCFAllocatorDefault, best_common_length, best_common_part1);
|
||||
CFMakeCollectable(best_common_mutable);
|
||||
CFStringAppend(best_common_mutable, best_common_part2);
|
||||
return best_common_mutable;
|
||||
}
|
||||
|
||||
Boolean diff_regExMatch(CFStringRef text, const regex_t *re) {
|
||||
//TODO(jan): Using regex.h is far from optimal. Find an alternative.
|
||||
Boolean isMatch;
|
||||
const char *bytes;
|
||||
char *localBuffer = NULL;
|
||||
char *textCString = NULL;
|
||||
// We are only interested in line endings anyway so ASCII is fine.
|
||||
CFStringEncoding encoding = kCFStringEncodingASCII;
|
||||
|
||||
bytes = CFStringGetCStringPtr(text, encoding);
|
||||
|
||||
if (bytes == NULL) {
|
||||
Boolean success;
|
||||
CFIndex length;
|
||||
CFIndex usedBufferLength;
|
||||
CFIndex textLength = CFStringGetLength(text);
|
||||
CFRange rangeToProcess = CFRangeMake(0, textLength);
|
||||
|
||||
success = (CFStringGetBytes(text, rangeToProcess, encoding, '?', false, NULL, LONG_MAX, &usedBufferLength) > 0);
|
||||
if (success) {
|
||||
length = usedBufferLength + 1;
|
||||
|
||||
localBuffer = calloc(length, sizeof(char));
|
||||
success = (CFStringGetBytes(text, rangeToProcess, encoding, '?', false, (UInt8 *)localBuffer, length, NULL) > 0);
|
||||
|
||||
if (success) {
|
||||
textCString = localBuffer;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
textCString = (char *)bytes;
|
||||
}
|
||||
|
||||
if (textCString != NULL) {
|
||||
isMatch = (regexec(re, textCString, 0, NULL, 0) == 0);
|
||||
} else {
|
||||
isMatch = false;
|
||||
//assert(0);
|
||||
}
|
||||
|
||||
if (localBuffer != NULL) {
|
||||
free(localBuffer);
|
||||
}
|
||||
|
||||
return isMatch;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the common prefix of two strings.
|
||||
* @param text1 First string.
|
||||
* @param text2 Second string.
|
||||
* @return The number of characters common to the start of each string.
|
||||
*/
|
||||
CFIndex diff_commonPrefix(CFStringRef text1, CFStringRef text2) {
|
||||
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
|
||||
CFIndex text1_length = CFStringGetLength(text1);
|
||||
CFIndex text2_length = CFStringGetLength(text2);
|
||||
|
||||
CFStringInlineBuffer text1_inlineBuffer, text2_inlineBuffer;
|
||||
CFStringInitInlineBuffer(text1, &text1_inlineBuffer, CFRangeMake(0, text1_length));
|
||||
CFStringInitInlineBuffer(text2, &text2_inlineBuffer, CFRangeMake(0, text2_length));
|
||||
|
||||
UniChar char1, char2;
|
||||
CFIndex n = MIN(text1_length, text2_length);
|
||||
|
||||
for (CFIndex i = 0; i < n; i++) {
|
||||
char1 = CFStringGetCharacterFromInlineBuffer(&text1_inlineBuffer, i);
|
||||
char2 = CFStringGetCharacterFromInlineBuffer(&text2_inlineBuffer, i);
|
||||
|
||||
if (char1 != char2) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the common suffix of two strings.
|
||||
* @param text1 First string.
|
||||
* @param text2 Second string.
|
||||
* @return The number of characters common to the end of each string.
|
||||
*/
|
||||
CFIndex diff_commonSuffix(CFStringRef text1, CFStringRef text2) {
|
||||
// Performance analysis: https://neil.fraser.name/news/2007/10/09/
|
||||
CFIndex text1_length = CFStringGetLength(text1);
|
||||
CFIndex text2_length = CFStringGetLength(text2);
|
||||
|
||||
CFStringInlineBuffer text1_inlineBuffer, text2_inlineBuffer;
|
||||
CFStringInitInlineBuffer(text1, &text1_inlineBuffer, CFRangeMake(0, text1_length));
|
||||
CFStringInitInlineBuffer(text2, &text2_inlineBuffer, CFRangeMake(0, text2_length));
|
||||
|
||||
UniChar char1, char2;
|
||||
CFIndex n = MIN(text1_length, text2_length);
|
||||
|
||||
for (CFIndex i = 1; i <= n; i++) {
|
||||
char1 = CFStringGetCharacterFromInlineBuffer(&text1_inlineBuffer, (text1_length - i));
|
||||
char2 = CFStringGetCharacterFromInlineBuffer(&text2_inlineBuffer, (text2_length - i));
|
||||
|
||||
if (char1 != char2) {
|
||||
return i - 1;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if the suffix of one CFStringRef is the prefix of another.
|
||||
* @param text1 First CFStringRef.
|
||||
* @param text2 Second CFStringRef.
|
||||
* @return The number of characters common to the end of the first
|
||||
* CFStringRef and the start of the second CFStringRef.
|
||||
*/
|
||||
CFIndex diff_commonOverlap(CFStringRef text1, CFStringRef text2) {
|
||||
CFIndex common_overlap = 0;
|
||||
|
||||
// Cache the text lengths to prevent multiple calls.
|
||||
CFIndex text1_length = CFStringGetLength(text1);
|
||||
CFIndex text2_length = CFStringGetLength(text2);
|
||||
|
||||
// Eliminate the nil case.
|
||||
if (text1_length == 0 || text2_length == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Truncate the longer CFStringRef.
|
||||
CFStringRef text1_trunc;
|
||||
CFStringRef text2_trunc;
|
||||
CFIndex text1_trunc_length;
|
||||
if (text1_length > text2_length) {
|
||||
text1_trunc_length = text2_length;
|
||||
text1_trunc = diff_CFStringCreateRightSubstring(text1, text1_length, text1_trunc_length);
|
||||
|
||||
text2_trunc = CFRetain(text2);
|
||||
} else if (text1_length < text2_length) {
|
||||
text1_trunc_length = text1_length;
|
||||
text1_trunc = CFRetain(text1);
|
||||
|
||||
CFIndex text2_trunc_length = text1_length;
|
||||
text2_trunc = diff_CFStringCreateLeftSubstring(text2, text2_trunc_length);
|
||||
} else {
|
||||
text1_trunc_length = text1_length;
|
||||
text1_trunc = CFRetain(text1);
|
||||
|
||||
text2_trunc = CFRetain(text2);
|
||||
}
|
||||
|
||||
CFIndex text_length = MIN(text1_length, text2_length);
|
||||
// Quick check for the worst case.
|
||||
if (text1_trunc == text2_trunc) {
|
||||
common_overlap = text_length;
|
||||
} else {
|
||||
// Start by looking for a single character match
|
||||
// and increase length until no match is found.
|
||||
// Performance analysis: https://neil.fraser.name/news/2010/11/04/
|
||||
CFIndex best = 0;
|
||||
CFIndex length = 1;
|
||||
while (true) {
|
||||
CFStringRef pattern = diff_CFStringCreateRightSubstring(text1_trunc, text1_trunc_length, length);
|
||||
CFRange foundRange = CFStringFind(text2_trunc, pattern, 0);
|
||||
CFRelease(pattern);
|
||||
|
||||
CFIndex found = foundRange.location;
|
||||
if (found == kCFNotFound) {
|
||||
common_overlap = best;
|
||||
break;
|
||||
}
|
||||
length += found;
|
||||
|
||||
CFStringRef text1_sub = diff_CFStringCreateRightSubstring(text1_trunc, text1_trunc_length, length);
|
||||
CFStringRef text2_sub = diff_CFStringCreateLeftSubstring(text2_trunc, length);
|
||||
|
||||
if (found == 0 || (CFStringCompare(text1_sub, text2_sub, 0) == kCFCompareEqualTo)) {
|
||||
best = length;
|
||||
length++;
|
||||
}
|
||||
|
||||
CFRelease(text1_sub);
|
||||
CFRelease(text2_sub);
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(text1_trunc);
|
||||
CFRelease(text2_trunc);
|
||||
return common_overlap;
|
||||
}
|
||||
|
||||
/**
|
||||
* Do the two texts share a Substring which is at least half the length of
|
||||
* the longer text?
|
||||
* This speedup can produce non-minimal diffs.
|
||||
* @param text1 First CFStringRef.
|
||||
* @param text2 Second CFStringRef.
|
||||
* @param diffTimeout Time limit for diff.
|
||||
* @return Five element String array, containing the prefix of text1, the
|
||||
* suffix of text1, the prefix of text2, the suffix of text2 and the
|
||||
* common middle. Or NULL if there was no match.
|
||||
*/
|
||||
CFArrayRef diff_halfMatchCreate(CFStringRef text1, CFStringRef text2, const float diffTimeout) {
|
||||
if (diffTimeout <= 0) {
|
||||
// Don't risk returning a non-optimal diff if we have unlimited time.
|
||||
return NULL;
|
||||
}
|
||||
CFStringRef longtext = CFStringGetLength(text1) > CFStringGetLength(text2) ? text1 : text2;
|
||||
CFStringRef shorttext = CFStringGetLength(text1) > CFStringGetLength(text2) ? text2 : text1;
|
||||
if (CFStringGetLength(longtext) < 4 || CFStringGetLength(shorttext) * 2 < CFStringGetLength(longtext)) {
|
||||
return NULL; // Pointless.
|
||||
}
|
||||
|
||||
// First check if the second quarter is the seed for a half-match.
|
||||
CFArrayRef hm1 = diff_halfMatchICreate(longtext, shorttext,
|
||||
(CFStringGetLength(longtext) + 3) / 4);
|
||||
// Check again based on the third quarter.
|
||||
CFArrayRef hm2 = diff_halfMatchICreate(longtext, shorttext,
|
||||
(CFStringGetLength(longtext) + 1) / 2);
|
||||
CFArrayRef hm;
|
||||
if (hm1 == NULL && hm2 == NULL) {
|
||||
return NULL;
|
||||
} else if (hm2 == NULL) {
|
||||
hm = CFRetain(hm1);
|
||||
} else if (hm1 == NULL) {
|
||||
hm = CFRetain(hm2);
|
||||
} else {
|
||||
// Both matched. Select the longest.
|
||||
hm = CFStringGetLength(CFArrayGetValueAtIndex(hm1, 4)) > CFStringGetLength(CFArrayGetValueAtIndex(hm2, 4)) ? CFRetain(hm1) : CFRetain(hm2);
|
||||
}
|
||||
|
||||
if (hm1 != NULL) {
|
||||
CFRelease(hm1);
|
||||
}
|
||||
if (hm2 != NULL) {
|
||||
CFRelease(hm2);
|
||||
}
|
||||
|
||||
// A half-match was found, sort out the return data.
|
||||
if (CFStringGetLength(text1) > CFStringGetLength(text2)) {
|
||||
return hm;
|
||||
//return new CFStringRef[]{hm[0], hm[1], hm[2], hm[3], hm[4]};
|
||||
} else {
|
||||
// { hm[0], hm[1], hm[2], hm[3], hm[4] }
|
||||
// => { hm[2], hm[3], hm[0], hm[1], hm[4] }
|
||||
|
||||
CFMutableArrayRef hm_mutable = CFArrayCreateMutableCopy(kCFAllocatorDefault, CFArrayGetCount(hm), hm);
|
||||
CFMakeCollectable(hm_mutable);
|
||||
|
||||
CFRelease(hm);
|
||||
|
||||
CFArrayExchangeValuesAtIndices(hm_mutable, 0, 2);
|
||||
CFArrayExchangeValuesAtIndices(hm_mutable, 1, 3);
|
||||
return hm_mutable;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Does a Substring of shorttext exist within longtext such that the
|
||||
* Substring is at least half the length of longtext?
|
||||
* @param longtext Longer CFStringRef.
|
||||
* @param shorttext Shorter CFStringRef.
|
||||
* @param i Start index of quarter length Substring within longtext.
|
||||
* @return Five element CFStringRef array, containing the prefix of longtext, the
|
||||
* suffix of longtext, the prefix of shorttext, the suffix of shorttext
|
||||
* and the common middle. Or NULL if there was no match.
|
||||
*/
|
||||
CFArrayRef diff_halfMatchICreate(CFStringRef longtext, CFStringRef shorttext, CFIndex i) {
|
||||
// Start with a 1/4 length Substring at position i as a seed.
|
||||
CFStringRef seed = diff_CFStringCreateSubstring(longtext, i, CFStringGetLength(longtext) / 4);
|
||||
CFIndex j = -1;
|
||||
CFStringRef best_common = CFSTR("");
|
||||
CFStringRef best_longtext_a = CFSTR(""), best_longtext_b = CFSTR("");
|
||||
CFStringRef best_shorttext_a = CFSTR(""), best_shorttext_b = CFSTR("");
|
||||
|
||||
CFStringRef best_common_part1, best_common_part2;
|
||||
|
||||
CFStringRef longtext_substring, shorttext_substring;
|
||||
CFIndex shorttext_length = CFStringGetLength(shorttext);
|
||||
CFRange resultRange;
|
||||
CFRange rangeToSearch;
|
||||
rangeToSearch.length = shorttext_length - (j + 1);
|
||||
rangeToSearch.location = j + 1;
|
||||
|
||||
while (j < CFStringGetLength(shorttext)
|
||||
&& (CFStringFindWithOptions(shorttext, seed, rangeToSearch, 0, &resultRange) == true)) {
|
||||
j = resultRange.location;
|
||||
rangeToSearch.length = shorttext_length - (j + 1);
|
||||
rangeToSearch.location = j + 1;
|
||||
|
||||
longtext_substring = diff_CFStringCreateSubstringWithStartIndex(longtext, i);
|
||||
shorttext_substring = diff_CFStringCreateSubstringWithStartIndex(shorttext, j);
|
||||
|
||||
CFIndex prefixLength = diff_commonPrefix(longtext_substring, shorttext_substring);
|
||||
|
||||
CFRelease(longtext_substring);
|
||||
CFRelease(shorttext_substring);
|
||||
|
||||
longtext_substring = diff_CFStringCreateLeftSubstring(longtext, i);
|
||||
shorttext_substring = diff_CFStringCreateLeftSubstring(shorttext, j);
|
||||
|
||||
CFIndex suffixLength = diff_commonSuffix(longtext_substring, shorttext_substring);
|
||||
|
||||
CFRelease(longtext_substring);
|
||||
CFRelease(shorttext_substring);
|
||||
|
||||
if (CFStringGetLength(best_common) < suffixLength + prefixLength) {
|
||||
CFRelease(best_common);
|
||||
CFRelease(best_longtext_a);
|
||||
CFRelease(best_longtext_b);
|
||||
CFRelease(best_shorttext_a);
|
||||
CFRelease(best_shorttext_b);
|
||||
|
||||
best_common_part1 = diff_CFStringCreateSubstring(shorttext, j - suffixLength, suffixLength);
|
||||
best_common_part2 = diff_CFStringCreateSubstring(shorttext, j, prefixLength);
|
||||
|
||||
best_common = diff_CFStringCreateByCombiningTwoStrings(best_common_part1, best_common_part2);
|
||||
|
||||
CFRelease(best_common_part1);
|
||||
CFRelease(best_common_part2);
|
||||
|
||||
best_longtext_a = diff_CFStringCreateLeftSubstring(longtext, i - suffixLength);
|
||||
best_longtext_b = diff_CFStringCreateSubstringWithStartIndex(longtext, i + prefixLength);
|
||||
best_shorttext_a = diff_CFStringCreateLeftSubstring(shorttext, j - suffixLength);
|
||||
best_shorttext_b = diff_CFStringCreateSubstringWithStartIndex(shorttext, j + prefixLength);
|
||||
}
|
||||
}
|
||||
|
||||
CFRelease(seed);
|
||||
|
||||
CFArrayRef halfMatchIArray;
|
||||
if (CFStringGetLength(best_common) * 2 >= CFStringGetLength(longtext)) {
|
||||
const CFStringRef values[] = { best_longtext_a, best_longtext_b,
|
||||
best_shorttext_a, best_shorttext_b, best_common };
|
||||
halfMatchIArray = CFArrayCreate(kCFAllocatorDefault, (const void **)values, (sizeof(values) / sizeof(values[0])), &kCFTypeArrayCallBacks);
|
||||
CFMakeCollectable(halfMatchIArray);
|
||||
} else {
|
||||
halfMatchIArray = NULL;
|
||||
}
|
||||
|
||||
CFRelease(best_common);
|
||||
CFRelease(best_longtext_a);
|
||||
CFRelease(best_longtext_b);
|
||||
CFRelease(best_shorttext_a);
|
||||
CFRelease(best_shorttext_b);
|
||||
|
||||
return halfMatchIArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Split a text into a list of strings. Reduce the texts to a CFStringRef of
|
||||
* hashes where each Unicode character represents one line.
|
||||
* @param text CFString to encode.
|
||||
* @param lineArray CFMutableArray of unique strings.
|
||||
* @param lineHash Map of strings to indices.
|
||||
* @param maxLines Maximum length for lineArray.
|
||||
* @return Encoded CFStringRef.
|
||||
*/
|
||||
CFStringRef diff_linesToCharsMungeCFStringCreate(CFStringRef text, CFMutableArrayRef lineArray, CFMutableDictionaryRef lineHash, CFIndex maxLines) {
|
||||
#define lineStart lineStartRange.location
|
||||
#define lineEnd lineEndRange.location
|
||||
|
||||
CFRange lineStartRange;
|
||||
CFRange lineEndRange;
|
||||
lineStart = 0;
|
||||
lineEnd = -1;
|
||||
CFStringRef line;
|
||||
CFMutableStringRef chars = CFStringCreateMutable(kCFAllocatorDefault, 0);
|
||||
|
||||
CFIndex textLength = CFStringGetLength(text);
|
||||
CFIndex hash;
|
||||
CFNumberRef hashNumber;
|
||||
|
||||
// Walk the text, pulling out a Substring for each line.
|
||||
// CFStringCreateArrayBySeparatingStrings(kCFAllocatorDefault, text, CFSTR("\n")) would temporarily double our memory footprint.
|
||||
// Modifying text would create many large strings.
|
||||
while (lineEnd < textLength - 1) {
|
||||
lineStartRange.length = textLength - lineStart;
|
||||
|
||||
if (CFStringFindWithOptions(text, CFSTR("\n"), lineStartRange, 0, &lineEndRange) == false) {
|
||||
lineEnd = textLength - 1;
|
||||
} /* else {
|
||||
lineEnd = lineEndRange.location;
|
||||
}*/
|
||||
|
||||
line = diff_CFStringCreateJavaSubstring(text, lineStart, lineEnd + 1);
|
||||
|
||||
if (CFDictionaryContainsKey(lineHash, line)) {
|
||||
CFDictionaryGetValueIfPresent(lineHash, line, (const void **)&hashNumber);
|
||||
CFNumberGetValue(hashNumber, kCFNumberCFIndexType, &hash);
|
||||
const UniChar hashChar = (UniChar)hash;
|
||||
CFStringAppendCharacters(chars, &hashChar, 1);
|
||||
} else {
|
||||
if (CFArrayGetCount(lineArray) == maxLines) {
|
||||
// Bail out at 65535 because char 65536 == char 0.
|
||||
line = diff_CFStringCreateJavaSubstring(text, lineStart, textLength);
|
||||
lineEnd = textLength;
|
||||
}
|
||||
CFArrayAppendValue(lineArray, line);
|
||||
hash = CFArrayGetCount(lineArray) - 1;
|
||||
hashNumber = CFNumberCreate(kCFAllocatorDefault, kCFNumberCFIndexType, &hash);
|
||||
CFMakeCollectable(hashNumber);
|
||||
CFDictionaryAddValue(lineHash, line, hashNumber);
|
||||
CFRelease(hashNumber);
|
||||
const UniChar hashChar = (UniChar)hash;
|
||||
CFStringAppendCharacters(chars, &hashChar, 1);
|
||||
}
|
||||
lineStart = lineEnd + 1;
|
||||
|
||||
CFRelease(line);
|
||||
}
|
||||
return chars;
|
||||
|
||||
#undef lineStart
|
||||
#undef lineEnd
|
||||
}
|
||||
|
||||
/**
|
||||
* Given two strings, compute a score representing whether the internal
|
||||
* boundary falls on logical boundaries.
|
||||
* Scores range from 6 (best) to 0 (worst).
|
||||
* @param one First CFStringRef.
|
||||
* @param two Second CFStringRef.
|
||||
* @return The score.
|
||||
*/
|
||||
CFIndex diff_cleanupSemanticScore(CFStringRef one, CFStringRef two) {
|
||||
static Boolean firstRun = true;
|
||||
static CFCharacterSetRef alphaNumericSet = NULL;
|
||||
static CFCharacterSetRef whiteSpaceSet = NULL;
|
||||
static CFCharacterSetRef controlSet = NULL;
|
||||
static regex_t blankLineEndRegEx;
|
||||
static regex_t blankLineStartRegEx;
|
||||
|
||||
if (firstRun) {
|
||||
// Define some regex patterns for matching boundaries.
|
||||
alphaNumericSet = CFCharacterSetGetPredefined(kCFCharacterSetAlphaNumeric);
|
||||
whiteSpaceSet = CFCharacterSetGetPredefined(kCFCharacterSetWhitespaceAndNewline);
|
||||
controlSet = CFCharacterSetGetPredefined(kCFCharacterSetControl);
|
||||
int status;
|
||||
status = regcomp(&blankLineEndRegEx, "\n\r?\n$", REG_EXTENDED | REG_NOSUB);
|
||||
assert(status == 0);
|
||||
status = regcomp(&blankLineStartRegEx, "^\r?\n\r?\n", REG_EXTENDED | REG_NOSUB);
|
||||
assert(status == 0);
|
||||
firstRun = false;
|
||||
}
|
||||
|
||||
if (CFStringGetLength(one) == 0 || CFStringGetLength(two) == 0) {
|
||||
// Edges are the best.
|
||||
return 6;
|
||||
}
|
||||
|
||||
// Each port of this function behaves slightly differently due to
|
||||
// subtle differences in each language's definition of things like
|
||||
// 'whitespace'. Since this function's purpose is largely cosmetic,
|
||||
// the choice has been made to use each language's native features
|
||||
// rather than force total conformity.
|
||||
UniChar char1 =
|
||||
CFStringGetCharacterAtIndex(one, (CFStringGetLength(one) - 1));
|
||||
UniChar char2 =
|
||||
CFStringGetCharacterAtIndex(two, 0);
|
||||
Boolean nonAlphaNumeric1 =
|
||||
!CFCharacterSetIsCharacterMember(alphaNumericSet, char1);
|
||||
Boolean nonAlphaNumeric2 =
|
||||
!CFCharacterSetIsCharacterMember(alphaNumericSet, char2);
|
||||
Boolean whitespace1 =
|
||||
nonAlphaNumeric1 && CFCharacterSetIsCharacterMember(whiteSpaceSet, char1);
|
||||
Boolean whitespace2 =
|
||||
nonAlphaNumeric2 && CFCharacterSetIsCharacterMember(whiteSpaceSet, char2);
|
||||
Boolean lineBreak1 =
|
||||
whitespace1 && CFCharacterSetIsCharacterMember(controlSet, char1);
|
||||
Boolean lineBreak2 =
|
||||
whitespace2 && CFCharacterSetIsCharacterMember(controlSet, char2);
|
||||
Boolean blankLine1 =
|
||||
lineBreak1 && diff_regExMatch(one, &blankLineEndRegEx);
|
||||
Boolean blankLine2 =
|
||||
lineBreak2 && diff_regExMatch(two, &blankLineStartRegEx);
|
||||
|
||||
if (blankLine1 || blankLine2) {
|
||||
// Five points for blank lines.
|
||||
return 5;
|
||||
} else if (lineBreak1 || lineBreak2) {
|
||||
// Four points for line breaks.
|
||||
return 4;
|
||||
} else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) {
|
||||
// Three points for end of sentences.
|
||||
return 3;
|
||||
} else if (whitespace1 || whitespace2) {
|
||||
// Two points for whitespace.
|
||||
return 2;
|
||||
} else if (nonAlphaNumeric1 || nonAlphaNumeric2) {
|
||||
// One point for non-alphanumeric.
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#ifndef _DIFFMATCHPATCHCFUTILITIES_H
|
||||
#define _DIFFMATCHPATCHCFUTILITIES_H
|
||||
|
||||
CFStringRef diff_CFStringCreateFromUnichar(UniChar ch);
|
||||
CFStringRef diff_CFStringCreateJavaSubstring(CFStringRef s, CFIndex begin, CFIndex end);
|
||||
|
||||
CFIndex diff_commonPrefix(CFStringRef text1, CFStringRef text2);
|
||||
CFIndex diff_commonSuffix(CFStringRef text1, CFStringRef text2);
|
||||
CFIndex diff_commonOverlap(CFStringRef text1, CFStringRef text2);
|
||||
CFArrayRef diff_halfMatchCreate(CFStringRef text1, CFStringRef text2, const float diffTimeout);
|
||||
CFArrayRef diff_halfMatchICreate(CFStringRef longtext, CFStringRef shorttext, CFIndex i);
|
||||
|
||||
CFStringRef diff_linesToCharsMungeCFStringCreate(CFStringRef text, CFMutableArrayRef lineArray, CFMutableDictionaryRef lineHash, CFIndex maxLines);
|
||||
|
||||
CFIndex diff_cleanupSemanticScore(CFStringRef one, CFStringRef two);
|
||||
|
||||
CF_INLINE void diff_CFStringPrepareUniCharBuffer(CFStringRef string, const UniChar **string_chars, UniChar **string_buffer, CFRange string_range) {
|
||||
*string_chars = CFStringGetCharactersPtr(string);
|
||||
if (*string_chars == NULL) {
|
||||
// Fallback in case CFStringGetCharactersPtr() didn’t work.
|
||||
*string_buffer = malloc(string_range.length * sizeof(UniChar));
|
||||
CFStringGetCharacters(string, string_range, *string_buffer);
|
||||
*string_chars = *string_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
#endif //ifndef _DIFFMATCHPATCHCFUTILITIES_H
|
|
@ -0,0 +1,7 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'DiffMatchPatch' target in the 'DiffMatchPatch' project.
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif
|
|
@ -0,0 +1,40 @@
|
|||
/*
|
||||
* Diff Match and Patch
|
||||
* Copyright 2018 The diff-match-patch Authors.
|
||||
* https://github.com/google/diff-match-patch
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
* Author: fraser@google.com (Neil Fraser)
|
||||
* ObjC port: jan@geheimwerk.de (Jan Weiß)
|
||||
*/
|
||||
|
||||
#if !defined(MIN)
|
||||
#define MIN(A,B) \
|
||||
({__typeof__(A) a = (A); \
|
||||
__typeof__(B) b = (B); \
|
||||
(a < b) ? a : b; })
|
||||
#endif
|
||||
|
||||
#if !defined(MAX)
|
||||
#define MAX(A,B) \
|
||||
({__typeof__(A) a = (A); \
|
||||
__typeof__(B) b = (B); \
|
||||
(a > b) ? a : b; })
|
||||
#endif
|
||||
|
||||
#if !defined(ABS)
|
||||
#define ABS(A) \
|
||||
({__typeof__(A) a = (A); \
|
||||
(a > 0) ? a : -a; })
|
||||
#endif
|
|
@ -8,11 +8,18 @@
|
|||
#import "GongJuWenBenView.h"
|
||||
#import "FSTextView.h"
|
||||
|
||||
#import "PauseAlterView.h"
|
||||
|
||||
|
||||
#import "DiffMatchPatch.h"
|
||||
|
||||
@interface GongJuWenBenView ()
|
||||
///
|
||||
@property (nonatomic , strong) FSTextView *textone;
|
||||
|
||||
@property (nonatomic , strong) FSTextView *texttwo;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
@implementation GongJuWenBenView
|
||||
|
@ -49,8 +56,8 @@
|
|||
make.height.equalTo(viewback).multipliedBy(0.5).offset(-10);
|
||||
}];
|
||||
_texttwo = [self drawWenBenView:viewtwo title:@"文本二" tag:1];
|
||||
[[viewtwo viewWithTag:1000] setHidden:YES];
|
||||
[[viewtwo viewWithTag:1] setHidden:YES];
|
||||
// [[viewtwo viewWithTag:1000] setHidden:YES];
|
||||
// [[viewtwo viewWithTag:1] setHidden:YES];
|
||||
|
||||
UILabel *lbts = [[UILabel alloc] init];
|
||||
[lbts setText:@"温馨提示:仅支持输入汉字,数字以及标点符号。"];
|
||||
|
@ -72,6 +79,16 @@
|
|||
}];
|
||||
[self drawBottomView:viewbottom];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString *strtemp = [self getpasteInfo];
|
||||
if(strtemp.length>1)
|
||||
{
|
||||
[PauseAlterView showTitle:@"您已复制文本,是否粘贴?" info:strtemp back:^(NSString * _Nonnull value) {
|
||||
self.textone.text = strtemp;
|
||||
}];
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
@ -171,14 +188,32 @@
|
|||
[btsend addTarget:self action:@selector(bottomAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[Tools changedView:btsend colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
||||
}
|
||||
-(NSString *)getpasteInfo
|
||||
{
|
||||
// 获取通用剪贴板
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
// 检查剪贴板是否包含文本
|
||||
if ([pasteboard isKindOfClass:[UIPasteboard class]]) {
|
||||
NSString *clipboardContent = [pasteboard string];
|
||||
if (clipboardContent) {
|
||||
return clipboardContent;
|
||||
} else {
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
-(void)clearAction:(UIButton *)sender
|
||||
{
|
||||
if(sender.tag==1)
|
||||
{
|
||||
self.texttwo.text = @"";
|
||||
|
||||
[[self.texttwo.superview viewWithTag:1000] setHidden:YES];
|
||||
[[self.texttwo.superview viewWithTag:1] setHidden:YES];
|
||||
// [[self.texttwo.superview viewWithTag:1000] setHidden:YES];
|
||||
// [[self.texttwo.superview viewWithTag:1] setHidden:YES];
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -188,11 +223,48 @@
|
|||
|
||||
-(void)bottomAction
|
||||
{
|
||||
[[self.texttwo.superview viewWithTag:1000] setHidden:NO];
|
||||
[[self.texttwo.superview viewWithTag:1] setHidden:NO];
|
||||
NSString *stra = self.textone.text;
|
||||
|
||||
NSString *strb = self.texttwo.text;
|
||||
|
||||
|
||||
DiffMatchPatch *dmp = [[DiffMatchPatch alloc]init];
|
||||
NSMutableArray *diffs = [NSMutableArray array];
|
||||
diffs = [dmp diff_mainOfOldString:stra andNewString:strb checkLines:NO];
|
||||
|
||||
NSMutableAttributedString *attstringA = [[NSMutableAttributedString alloc] initWithString:stra];
|
||||
NSMutableAttributedString *attstringB = [[NSMutableAttributedString alloc] initWithString:strb];
|
||||
[attstringA addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, stra.length)];
|
||||
|
||||
[attstringB addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:14] range:NSMakeRange(0, strb.length)];
|
||||
|
||||
NSInteger ilocationA = 0;
|
||||
NSInteger ilocationB = 0;
|
||||
for(Diff *item in diffs)
|
||||
{
|
||||
NSString *strtemp = item.text;
|
||||
if(item.operation == DIFF_INSERT)
|
||||
{
|
||||
[attstringB addAttribute:NSForegroundColorAttributeName value:RGBCOLOR(255, 50, 50) range:NSMakeRange(ilocationB, strtemp.length)];
|
||||
ilocationB+=strtemp.length;
|
||||
|
||||
}
|
||||
else if(item.operation == DIFF_DELETE)
|
||||
{
|
||||
[attstringA addAttribute:NSForegroundColorAttributeName value:RGBCOLOR(255, 50, 50) range:NSMakeRange(ilocationA, strtemp.length)];
|
||||
ilocationA+=strtemp.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
ilocationA+=strtemp.length;
|
||||
ilocationB+=strtemp.length;
|
||||
}
|
||||
}
|
||||
|
||||
self.textone.attributedText = attstringA;
|
||||
self.texttwo.attributedText = attstringB;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#import "NetWorkManager.h"
|
||||
#import "LanguageSelectAlterView.h"
|
||||
|
||||
#import "PauseAlterView.h"
|
||||
#import "SSENetWorkManager.h"
|
||||
|
||||
@interface GongJuFanYiView ()
|
||||
///
|
||||
|
@ -18,7 +20,7 @@
|
|||
@property (nonatomic , strong) FSTextView *textview;
|
||||
|
||||
@property (nonatomic , strong) UIView *viewout;
|
||||
@property (nonatomic , strong) UILabel *lbcontent;
|
||||
@property (nonatomic , strong) ViewLable *lbcontent;
|
||||
|
||||
///
|
||||
@property (nonatomic , strong) UILabel *lbone;
|
||||
|
@ -27,6 +29,11 @@
|
|||
///
|
||||
@property (nonatomic , strong) NSMutableArray *arrdata;
|
||||
|
||||
///
|
||||
@property (nonatomic , strong) SSEConfigModel *modelConfig;
|
||||
|
||||
@property (nonatomic , assign) BOOL isDragging;
|
||||
@property (nonatomic , assign) BOOL isDraw;
|
||||
@end
|
||||
@implementation GongJuFanYiView
|
||||
|
||||
|
@ -54,6 +61,16 @@
|
|||
}];
|
||||
[self drawBottomView:viewbottom];
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
||||
NSString *strtemp = [self getpasteInfo];
|
||||
if(strtemp.length>1)
|
||||
{
|
||||
[PauseAlterView showTitle:@"您已复制文本,是否粘贴?" info:strtemp back:^(NSString * _Nonnull value) {
|
||||
self.textview.text = strtemp;
|
||||
}];
|
||||
}
|
||||
});
|
||||
|
||||
[self getCountryData];
|
||||
|
||||
}
|
||||
|
@ -113,27 +130,33 @@
|
|||
make.left.equalTo(viewline.mas_right).offset(6);
|
||||
}];
|
||||
|
||||
UILabel *lbcontent = [[UILabel alloc] init];
|
||||
[lbcontent setText:@"结果"];
|
||||
[lbcontent setTextColor:RGBCOLOR(51, 51, 51)];
|
||||
[lbcontent setTextAlignment:NSTextAlignmentLeft];
|
||||
[lbcontent setFont:[UIFont systemFontOfSize:14]];
|
||||
[lbcontent setNumberOfLines:0];
|
||||
[view addSubview:lbcontent];
|
||||
[lbcontent mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
ViewLable *lbwz = [[ViewLable alloc] init];
|
||||
[view addSubview:lbwz];
|
||||
[lbwz mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.left.offset(27);
|
||||
make.right.equalTo(view).offset(-27);
|
||||
make.top.equalTo(viewline.mas_bottom).offset(17);
|
||||
}];
|
||||
_lbcontent = lbcontent;
|
||||
lbwz.textColor = RGBCOLOR(61, 61, 61);
|
||||
lbwz.textFont = [UIFont systemFontOfSize:16];
|
||||
[lbwz setBackHeight:^(float fheight, BOOL isend) {
|
||||
if(self.isDragging==NO)
|
||||
{
|
||||
if(self.scvback.contentSize.height-self.scvback.height>0)
|
||||
{
|
||||
[self.scvback setContentOffset:CGPointMake(0, self.scvback.contentSize.height-self.scvback.height)];
|
||||
}
|
||||
}
|
||||
}];
|
||||
_lbcontent = lbwz;
|
||||
|
||||
[lbcontent setUserInteractionEnabled:YES];
|
||||
[lbwz setUserInteractionEnabled:YES];
|
||||
UILongPressGestureRecognizer *pressl = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(copyTextAction:)];
|
||||
[lbcontent addGestureRecognizer:pressl];
|
||||
[lbwz addGestureRecognizer:pressl];
|
||||
|
||||
|
||||
[view mas_makeConstraints:^(MASConstraintMaker *make) {
|
||||
make.bottom.equalTo(lbcontent).offset(25);
|
||||
make.bottom.equalTo(lbwz).offset(25);
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -311,26 +334,47 @@
|
|||
[btsend addTarget:self action:@selector(bottomAction) forControlEvents:UIControlEventTouchUpInside];
|
||||
[Tools changedView:btsend colors:MainJBColors startPoint:CGPointMake(0, 0) endPoint:CGPointMake(1, 0)];
|
||||
}
|
||||
-(NSString *)getpasteInfo
|
||||
{
|
||||
// 获取通用剪贴板
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
// 检查剪贴板是否包含文本
|
||||
if ([pasteboard isKindOfClass:[UIPasteboard class]]) {
|
||||
NSString *clipboardContent = [pasteboard string];
|
||||
if (clipboardContent) {
|
||||
return clipboardContent;
|
||||
} else {
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
}
|
||||
-(void)clearAction
|
||||
{
|
||||
self.textview.text = @"";
|
||||
}
|
||||
-(void)copyTextAction:(UIGestureRecognizer *)gesture
|
||||
{
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
pasteboard.string = self.lbcontent.text;
|
||||
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
||||
if(gesture.state == UIGestureRecognizerStateBegan)
|
||||
{
|
||||
UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];
|
||||
pasteboard.string = self.lbcontent.strValue;
|
||||
[HXHud showMessage:@"复制成功" afterDelayType:0];
|
||||
}
|
||||
}
|
||||
-(void)changeAction
|
||||
{
|
||||
NSString *str = self.lbone.text;
|
||||
if([str isEqualToString:@"自动检测"])
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
self.lbone.text = self.lbtwo.text;
|
||||
self.lbtwo.text = str;
|
||||
// NSString *str = self.lbone.text;
|
||||
// if([str isEqualToString:@"自动检测"])
|
||||
// {
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// self.lbone.text = self.lbtwo.text;
|
||||
// self.lbtwo.text = str;
|
||||
}
|
||||
-(void)countryAction:(UIButton *)sender
|
||||
{
|
||||
|
@ -348,11 +392,6 @@
|
|||
}
|
||||
}];
|
||||
}
|
||||
-(void)bottomAction
|
||||
{
|
||||
[self.viewout setHidden:NO];
|
||||
}
|
||||
|
||||
-(void)getCountryData
|
||||
{
|
||||
[HXLoadingHUD showWithStatus:@"" maskType:0];
|
||||
|
@ -382,4 +421,90 @@
|
|||
}];
|
||||
}
|
||||
|
||||
|
||||
-(void)bottomAction
|
||||
{
|
||||
if(self.isDraw==YES)
|
||||
{
|
||||
[HXHud showMessage:@"请等待处理完成" afterDelayType:0];
|
||||
return;
|
||||
}
|
||||
if(self.textview.text.length==0)
|
||||
{
|
||||
[HXHud showMessage:self.textview.placeholder afterDelayType:0];
|
||||
return;
|
||||
}
|
||||
[self addtoolsNumber];
|
||||
[self getdata];
|
||||
}
|
||||
-(void)addtoolsNumber
|
||||
{
|
||||
[NetWorkManager requestToolsAdd_countData:self tool_id:[NSString stringWithFormat:@"%d",4] Callback:^(BOOL state, id _Nullable responseObject, NSString * _Nullable describle) {
|
||||
|
||||
}];
|
||||
}
|
||||
|
||||
-(void)getdata
|
||||
{
|
||||
self.isDraw = YES;
|
||||
[LoadAlterView show];
|
||||
///translate 翻译、get_summary 摘要、get_keyword 关键字、to_sort 缩写、to_long 扩写
|
||||
/*
|
||||
8 扩写 7缩写 6摘要提取 3提取关键词
|
||||
*/
|
||||
NSString *scene = @"translate";
|
||||
|
||||
NSDictionary *dicpush = @{@"content":self.textview.text,
|
||||
@"after":self.lbtwo.text};
|
||||
|
||||
[[SSENetWorkManager shareManager] requestTo:[NSString stringWithFormat:@"https://aiw.batiao8.com/api/tool/completions?scene=%@",scene] dicpush:dicpush config:^(SSEConfigModel * _Nonnull config) {
|
||||
[LoadAlterView dismiss];
|
||||
self.modelConfig = config;
|
||||
[self.viewout setHidden:NO];
|
||||
self.lbcontent.fspeed = self.modelConfig.time.intValue/1000.0;
|
||||
} backValue:^(NSString * _Nonnull value, BOOL isfinish) {
|
||||
if(value.length>3)
|
||||
{
|
||||
[self chuliShuJu:value isfinish:NO];
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isfinish)
|
||||
{
|
||||
[self chuliShuJu:value isfinish:YES];
|
||||
}
|
||||
}
|
||||
} error:^(NSString * _Nonnull errorString) {
|
||||
[LoadAlterView dismiss];
|
||||
[HXHud showMessage:errorString afterDelayType:0];
|
||||
self.isDraw = NO;
|
||||
} ID:^(NSString * _Nonnull value) {
|
||||
|
||||
}];
|
||||
}
|
||||
-(void)chuliShuJu:(NSString *)value isfinish:(BOOL)isfinish
|
||||
{
|
||||
NSLog(@"%@",value);
|
||||
if(isfinish)
|
||||
{
|
||||
self.isDraw = NO;
|
||||
self.lbcontent.isWriteEnd = YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
self.lbcontent.strValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - UIScrollView
|
||||
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView
|
||||
{
|
||||
self.isDragging = YES;
|
||||
}
|
||||
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
|
||||
{
|
||||
self.isDragging = NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -449,6 +449,7 @@
|
|||
///常用工具
|
||||
-(void)getTools
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:HomeToosRef];
|
||||
[NetWorkManager requestToolsFavData:self.view page:1 size:@"100" Callback:^(BOOL state, ToolsListModel *responseObject, NSString * _Nullable describle) {
|
||||
[self.tableView.mj_header endRefreshing];
|
||||
if(state)
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
make.edges.equalTo(viewback);
|
||||
}];
|
||||
[cleScrollView.layer setMasksToBounds:YES];
|
||||
[cleScrollView.layer setCornerRadius:8];
|
||||
[cleScrollView.layer setCornerRadius:17];
|
||||
[cleScrollView setUserInteractionEnabled:YES];
|
||||
_cleScrollView = cleScrollView;
|
||||
|
||||
|
|
|
@ -162,6 +162,7 @@
|
|||
{
|
||||
GongJuTextViewController *vc = [GongJuTextViewController new];
|
||||
vc.strtitle = model.tool_name;
|
||||
vc.type=model.ID.intValue;
|
||||
[self.viewController.navigationController pushViewController:vc animated:YES];
|
||||
}
|
||||
else if(model.ID.intValue==5)
|
||||
|
|
|
@ -196,6 +196,9 @@
|
|||
[UserInfoModel shareModel].user_stage = modelson;
|
||||
[UserInfoModel shareModel].isAllLevel = [NSString stringWithFormat:@"%@",[NSNumber numberWithBool:NO]];
|
||||
[UserInfoModel shareModel].identityType = @"3";
|
||||
|
||||
[UserInfoModel shareModel].isupdataJiaoyu = YES;
|
||||
|
||||
[self.navigationController popToRootViewControllerAnimated:YES];
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue