From 92844a96198190109d9d2a4b8ef104b984f1f87f Mon Sep 17 00:00:00 2001 From: liyuhua <15626451870@163.com> Date: Thu, 9 Nov 2023 15:26:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E8=B0=83=E8=AF=95=E5=B7=A5?= =?UTF-8?q?=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- YuMi.xcodeproj/project.pbxproj | 290 +++++++++ .../xcshareddata/xcschemes/YuMi.xcscheme | 2 +- YuMi/Config/ClientConfig.m | 2 +- YuMi/Global/YUMIConstant.m | 7 +- YuMi/Global/YUMIMacroUitls.h | 13 +- .../View/SubViews/XPNewGuildTimePickView.m | 7 +- .../XPIncomeRecordGoldDetailsPickViewView.m | 7 +- .../XPIncomeRecordGoldDetailsView.m | 7 +- .../YMMine/View/PISwitchingEnvironmentVC.h | 16 + .../YMMine/View/PISwitchingEnvironmentVC.m | 108 ++++ .../YMMine/View/XPMineViewController.m | 20 + .../View/SubViews/XPMonentsTooBarView.m | 2 +- .../View/XPArrangeMicViewController.m | 2 +- .../XPRoomFunctionContainerView.m | 7 +- .../View/RoomHeaderView/RoomHeaderView.m | 2 +- .../View/StageView/MicroView/MicroView.m | 5 +- YuMi/Modules/YMWeb/XPWebViewController.m | 2 +- YuMi/Network/HttpRequestHelper.h | 2 +- YuMi/Network/HttpRequestHelper.m | 211 ++++-- YuMi/Structure/MVP/View/MvpViewController.m | 19 + YuMi/Structure/PrefixHeader.pch | 2 + YuMi/Tools/Date/NSDate+DateUtils.h | 2 +- YuMi/Tools/Date/NSDate+DateUtils.m | 8 +- YuMi/Tools/Timestamp/Timestamp.m | 2 +- YuMi/Tools/YYUtility/YYUtility+App.m | 10 +- .../catagory/3Party/fmdb/BSSDLayoutUtil.h | 31 + .../catagory/3Party/fmdb/BSSDLayoutUtil.m | 17 + .../sdkContent/catagory/Util/BSNSDictionary.h | 39 ++ .../sdkContent/catagory/Util/BSNSDictionary.m | 47 ++ .../sdkContent/catagory/Util/BSNSStringUtil.h | 71 ++ .../sdkContent/catagory/Util/BSNSStringUtil.m | 168 +++++ .../sdkContent/catagory/Util/BSUIDemoUtil.h | 17 + .../sdkContent/catagory/Util/BSUIDemoUtil.m | 33 + .../sdkContent/catagory/Util/BSXWDateUtil.h | 106 +++ .../sdkContent/catagory/Util/BSXWDateUtil.m | 222 +++++++ .../sdkContent/catagory/Util/BS_UIColor.h | 16 + .../sdkContent/catagory/Util/BS_UIColor.m | 31 + .../sdkContent/catagory/system/BS_Define.h | 32 + .../sdkContent/catagory/system/SystemUtil.h | 18 + .../sdkContent/catagory/system/SystemUtil.m | 35 + .../system/UILabel+YBAttributeTextTapAction.h | 62 ++ .../system/UILabel+YBAttributeTextTapAction.m | 396 ++++++++++++ .../FileOption(文件操作)/BSFileOptionModel.h | 32 + .../FileOption(文件操作)/BSFileOptionModel.m | 206 ++++++ .../readMe_FileOption.txt | 11 + YuMi/Tools/sdkContent/content/K/BSDrawLine.h | 90 +++ YuMi/Tools/sdkContent/content/K/BSDrawLine.m | 530 +++++++++++++++ YuMi/Tools/sdkContent/content/K/BSkObject.h | 45 ++ YuMi/Tools/sdkContent/content/K/BSkObject.m | 14 + .../NetListen(网络监听)/BSNetListenModel.h | 60 ++ .../NetListen(网络监听)/BSNetListenModel.m | 263 ++++++++ .../RealTime(实时)/BSLogNetDetailViewController.h | 18 + .../RealTime(实时)/BSLogNetDetailViewController.m | 90 +++ .../RealTime(实时)/BSLogTableViewController.h | 13 + .../RealTime(实时)/BSLogTableViewController.m | 260 ++++++++ .../RealTime(实时)/BSRealTextView.h | 19 + .../RealTime(实时)/BSRealTextView.m | 154 +++++ .../RealTime(实时)/BSRealTimeView.h | 20 + .../RealTime(实时)/BSRealTimeView.m | 611 ++++++++++++++++++ .../RealTime(实时)/model/RealViewCellModel.h | 45 ++ .../RealTime(实时)/model/RealViewCellModel.m | 13 + .../RealTime(实时)/view/RealViewNetWorkCell_0.h | 21 + .../RealTime(实时)/view/RealViewNetWorkCell_0.m | 154 +++++ .../component(组件)/BSSelectView.h | 29 + .../component(组件)/BSSelectView.m | 71 ++ .../component(组件)/pay_off.png | Bin 0 -> 242 bytes .../component(组件)/pay_off@2x.png | Bin 0 -> 483 bytes .../component(组件)/pay_off@3x.png | Bin 0 -> 709 bytes .../component(组件)/pay_on.png | Bin 0 -> 485 bytes .../component(组件)/pay_on@2x.png | Bin 0 -> 986 bytes .../component(组件)/pay_on@3x.png | Bin 0 -> 931 bytes .../NetListen(网络监听)/model/BSRecordModel.h | 50 ++ .../NetListen(网络监听)/model/BSRecordModel.m | 89 +++ .../XWNotification(通知)/BSNotification.h | 132 ++++ .../XWNotification(通知)/BSNotification.m | 193 ++++++ 75 files changed, 5235 insertions(+), 94 deletions(-) create mode 100644 YuMi/Modules/YMMine/View/PISwitchingEnvironmentVC.h create mode 100644 YuMi/Modules/YMMine/View/PISwitchingEnvironmentVC.m create mode 100644 YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.h create mode 100644 YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.m create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.h create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.m create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.h create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.m create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.h create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.m create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.h create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.m create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.h create mode 100644 YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.m create mode 100644 YuMi/Tools/sdkContent/catagory/system/BS_Define.h create mode 100644 YuMi/Tools/sdkContent/catagory/system/SystemUtil.h create mode 100644 YuMi/Tools/sdkContent/catagory/system/SystemUtil.m create mode 100755 YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.h create mode 100755 YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.m create mode 100644 YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.h create mode 100644 YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.m create mode 100644 YuMi/Tools/sdkContent/content/FileOption(文件操作)/readMe_FileOption.txt create mode 100644 YuMi/Tools/sdkContent/content/K/BSDrawLine.h create mode 100644 YuMi/Tools/sdkContent/content/K/BSDrawLine.m create mode 100644 YuMi/Tools/sdkContent/content/K/BSkObject.h create mode 100644 YuMi/Tools/sdkContent/content/K/BSkObject.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.m create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.m create mode 100755 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@2x.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@3x.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_on.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_on@2x.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_on@3x.png create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.h create mode 100644 YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.m create mode 100644 YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.h create mode 100644 YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.m diff --git a/YuMi.xcodeproj/project.pbxproj b/YuMi.xcodeproj/project.pbxproj index f835ed27..55d31612 100644 --- a/YuMi.xcodeproj/project.pbxproj +++ b/YuMi.xcodeproj/project.pbxproj @@ -303,6 +303,35 @@ 23B2AEC42A6516C200543D17 /* LoginForgetPasswordViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23B2AEC22A6516C200543D17 /* LoginForgetPasswordViewController.m */; }; 23BA165B2A5D2ACF0030C5A3 /* PIBaseAnimationViewModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23BA165A2A5D2ACF0030C5A3 /* PIBaseAnimationViewModel.m */; }; 23C7C0B72A7CD7B000802205 /* XPNewMineGuildItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23C7C0B62A7CD7B000802205 /* XPNewMineGuildItemView.m */; }; + 23CEFB6C2AFB803B00576D89 /* PISwitchingEnvironmentVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFB6B2AFB803B00576D89 /* PISwitchingEnvironmentVC.m */; }; + 23CEFC4A2AFB8FC100576D89 /* BSNSStringUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC0C2AFB8FC100576D89 /* BSNSStringUtil.m */; }; + 23CEFC4B2AFB8FC100576D89 /* BSUIDemoUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC0D2AFB8FC100576D89 /* BSUIDemoUtil.m */; }; + 23CEFC4C2AFB8FC100576D89 /* BS_UIColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC0F2AFB8FC100576D89 /* BS_UIColor.m */; }; + 23CEFC4D2AFB8FC100576D89 /* BSXWDateUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC102AFB8FC100576D89 /* BSXWDateUtil.m */; }; + 23CEFC4E2AFB8FC100576D89 /* BSNSDictionary.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC132AFB8FC100576D89 /* BSNSDictionary.m */; }; + 23CEFC4F2AFB8FC100576D89 /* BSSDLayoutUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC172AFB8FC100576D89 /* BSSDLayoutUtil.m */; }; + 23CEFC502AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC1D2AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m */; }; + 23CEFC512AFB8FC100576D89 /* SystemUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC1E2AFB8FC100576D89 /* SystemUtil.m */; }; + 23CEFC522AFB8FC100576D89 /* BSFileOptionModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC222AFB8FC100576D89 /* BSFileOptionModel.m */; }; + 23CEFC532AFB8FC100576D89 /* readMe_FileOption.txt in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC232AFB8FC100576D89 /* readMe_FileOption.txt */; }; + 23CEFC542AFB8FC100576D89 /* BSNotification.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC262AFB8FC100576D89 /* BSNotification.m */; }; + 23CEFC552AFB8FC100576D89 /* pay_off@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC292AFB8FC100576D89 /* pay_off@3x.png */; }; + 23CEFC562AFB8FC100576D89 /* pay_off.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC2A2AFB8FC100576D89 /* pay_off.png */; }; + 23CEFC572AFB8FC100576D89 /* pay_off@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC2B2AFB8FC100576D89 /* pay_off@2x.png */; }; + 23CEFC582AFB8FC100576D89 /* pay_on@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC2C2AFB8FC100576D89 /* pay_on@3x.png */; }; + 23CEFC592AFB8FC100576D89 /* pay_on@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC2E2AFB8FC100576D89 /* pay_on@2x.png */; }; + 23CEFC5A2AFB8FC100576D89 /* pay_on.png in Resources */ = {isa = PBXBuildFile; fileRef = 23CEFC2F2AFB8FC100576D89 /* pay_on.png */; }; + 23CEFC5B2AFB8FC100576D89 /* BSSelectView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC302AFB8FC100576D89 /* BSSelectView.m */; }; + 23CEFC5C2AFB8FC100576D89 /* BSNetListenModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC312AFB8FC100576D89 /* BSNetListenModel.m */; }; + 23CEFC5D2AFB8FC100576D89 /* BSRecordModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC342AFB8FC100576D89 /* BSRecordModel.m */; }; + 23CEFC5E2AFB8FC100576D89 /* BSRealTimeView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC372AFB8FC100576D89 /* BSRealTimeView.m */; }; + 23CEFC5F2AFB8FC100576D89 /* BSLogTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC392AFB8FC100576D89 /* BSLogTableViewController.m */; }; + 23CEFC602AFB8FC100576D89 /* RealViewCellModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC3D2AFB8FC100576D89 /* RealViewCellModel.m */; }; + 23CEFC612AFB8FC100576D89 /* RealViewNetWorkCell_0.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC402AFB8FC100576D89 /* RealViewNetWorkCell_0.m */; }; + 23CEFC622AFB8FC100576D89 /* BSLogNetDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC422AFB8FC100576D89 /* BSLogNetDetailViewController.m */; }; + 23CEFC632AFB8FC100576D89 /* BSRealTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC442AFB8FC100576D89 /* BSRealTextView.m */; }; + 23CEFC642AFB8FC100576D89 /* BSkObject.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC472AFB8FC100576D89 /* BSkObject.m */; }; + 23CEFC652AFB8FC100576D89 /* BSDrawLine.m in Sources */ = {isa = PBXBuildFile; fileRef = 23CEFC482AFB8FC100576D89 /* BSDrawLine.m */; }; 23D321D22ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D12ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m */; }; 23D321D52ADD0F05006B259C /* Api+PhotoAlbum.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D42ADD0F05006B259C /* Api+PhotoAlbum.m */; }; 23D321D92ADD1B46006B259C /* PIRoomPhotoAlbumItemModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 23D321D82ADD1B46006B259C /* PIRoomPhotoAlbumItemModel.m */; }; @@ -2035,6 +2064,58 @@ 23BA165A2A5D2ACF0030C5A3 /* PIBaseAnimationViewModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIBaseAnimationViewModel.m; sourceTree = ""; }; 23C7C0B52A7CD7B000802205 /* XPNewMineGuildItemView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPNewMineGuildItemView.h; sourceTree = ""; }; 23C7C0B62A7CD7B000802205 /* XPNewMineGuildItemView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPNewMineGuildItemView.m; sourceTree = ""; }; + 23CEFB6A2AFB803B00576D89 /* PISwitchingEnvironmentVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PISwitchingEnvironmentVC.h; sourceTree = ""; }; + 23CEFB6B2AFB803B00576D89 /* PISwitchingEnvironmentVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PISwitchingEnvironmentVC.m; sourceTree = ""; }; + 23CEFC0B2AFB8FC100576D89 /* BSXWDateUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSXWDateUtil.h; sourceTree = ""; }; + 23CEFC0C2AFB8FC100576D89 /* BSNSStringUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSNSStringUtil.m; sourceTree = ""; }; + 23CEFC0D2AFB8FC100576D89 /* BSUIDemoUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSUIDemoUtil.m; sourceTree = ""; }; + 23CEFC0E2AFB8FC100576D89 /* BSNSDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSNSDictionary.h; sourceTree = ""; }; + 23CEFC0F2AFB8FC100576D89 /* BS_UIColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BS_UIColor.m; sourceTree = ""; }; + 23CEFC102AFB8FC100576D89 /* BSXWDateUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSXWDateUtil.m; sourceTree = ""; }; + 23CEFC112AFB8FC100576D89 /* BSUIDemoUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSUIDemoUtil.h; sourceTree = ""; }; + 23CEFC122AFB8FC100576D89 /* BSNSStringUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSNSStringUtil.h; sourceTree = ""; }; + 23CEFC132AFB8FC100576D89 /* BSNSDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSNSDictionary.m; sourceTree = ""; }; + 23CEFC142AFB8FC100576D89 /* BS_UIColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BS_UIColor.h; sourceTree = ""; }; + 23CEFC172AFB8FC100576D89 /* BSSDLayoutUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSSDLayoutUtil.m; sourceTree = ""; }; + 23CEFC182AFB8FC100576D89 /* BSSDLayoutUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSSDLayoutUtil.h; sourceTree = ""; }; + 23CEFC1A2AFB8FC100576D89 /* SystemUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SystemUtil.h; sourceTree = ""; }; + 23CEFC1B2AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UILabel+YBAttributeTextTapAction.h"; sourceTree = ""; }; + 23CEFC1C2AFB8FC100576D89 /* BS_Define.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BS_Define.h; sourceTree = ""; }; + 23CEFC1D2AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UILabel+YBAttributeTextTapAction.m"; sourceTree = ""; }; + 23CEFC1E2AFB8FC100576D89 /* SystemUtil.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SystemUtil.m; sourceTree = ""; }; + 23CEFC212AFB8FC100576D89 /* BSFileOptionModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSFileOptionModel.h; sourceTree = ""; }; + 23CEFC222AFB8FC100576D89 /* BSFileOptionModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSFileOptionModel.m; sourceTree = ""; }; + 23CEFC232AFB8FC100576D89 /* readMe_FileOption.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = readMe_FileOption.txt; sourceTree = ""; }; + 23CEFC252AFB8FC100576D89 /* BSNotification.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSNotification.h; sourceTree = ""; }; + 23CEFC262AFB8FC100576D89 /* BSNotification.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSNotification.m; sourceTree = ""; }; + 23CEFC292AFB8FC100576D89 /* pay_off@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pay_off@3x.png"; sourceTree = ""; }; + 23CEFC2A2AFB8FC100576D89 /* pay_off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pay_off.png; sourceTree = ""; }; + 23CEFC2B2AFB8FC100576D89 /* pay_off@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pay_off@2x.png"; sourceTree = ""; }; + 23CEFC2C2AFB8FC100576D89 /* pay_on@3x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pay_on@3x.png"; sourceTree = ""; }; + 23CEFC2D2AFB8FC100576D89 /* BSSelectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSSelectView.h; sourceTree = ""; }; + 23CEFC2E2AFB8FC100576D89 /* pay_on@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "pay_on@2x.png"; sourceTree = ""; }; + 23CEFC2F2AFB8FC100576D89 /* pay_on.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = pay_on.png; sourceTree = ""; }; + 23CEFC302AFB8FC100576D89 /* BSSelectView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSSelectView.m; sourceTree = ""; }; + 23CEFC312AFB8FC100576D89 /* BSNetListenModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSNetListenModel.m; sourceTree = ""; }; + 23CEFC322AFB8FC100576D89 /* BSNetListenModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSNetListenModel.h; sourceTree = ""; }; + 23CEFC342AFB8FC100576D89 /* BSRecordModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSRecordModel.m; sourceTree = ""; }; + 23CEFC352AFB8FC100576D89 /* BSRecordModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSRecordModel.h; sourceTree = ""; }; + 23CEFC372AFB8FC100576D89 /* BSRealTimeView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSRealTimeView.m; sourceTree = ""; }; + 23CEFC382AFB8FC100576D89 /* BSRealTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSRealTextView.h; sourceTree = ""; }; + 23CEFC392AFB8FC100576D89 /* BSLogTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSLogTableViewController.m; sourceTree = ""; }; + 23CEFC3A2AFB8FC100576D89 /* BSLogNetDetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSLogNetDetailViewController.h; sourceTree = ""; }; + 23CEFC3C2AFB8FC100576D89 /* RealViewCellModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealViewCellModel.h; sourceTree = ""; }; + 23CEFC3D2AFB8FC100576D89 /* RealViewCellModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RealViewCellModel.m; sourceTree = ""; }; + 23CEFC3F2AFB8FC100576D89 /* RealViewNetWorkCell_0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RealViewNetWorkCell_0.h; sourceTree = ""; }; + 23CEFC402AFB8FC100576D89 /* RealViewNetWorkCell_0.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RealViewNetWorkCell_0.m; sourceTree = ""; }; + 23CEFC412AFB8FC100576D89 /* BSRealTimeView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSRealTimeView.h; sourceTree = ""; }; + 23CEFC422AFB8FC100576D89 /* BSLogNetDetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSLogNetDetailViewController.m; sourceTree = ""; }; + 23CEFC432AFB8FC100576D89 /* BSLogTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSLogTableViewController.h; sourceTree = ""; }; + 23CEFC442AFB8FC100576D89 /* BSRealTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSRealTextView.m; sourceTree = ""; }; + 23CEFC462AFB8FC100576D89 /* BSDrawLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSDrawLine.h; sourceTree = ""; }; + 23CEFC472AFB8FC100576D89 /* BSkObject.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSkObject.m; sourceTree = ""; }; + 23CEFC482AFB8FC100576D89 /* BSDrawLine.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BSDrawLine.m; sourceTree = ""; }; + 23CEFC492AFB8FC100576D89 /* BSkObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BSkObject.h; sourceTree = ""; }; 23D321D02ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PIRoomPhotoAlbumItemPresenter.h; sourceTree = ""; }; 23D321D12ADD0EBC006B259C /* PIRoomPhotoAlbumItemPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PIRoomPhotoAlbumItemPresenter.m; sourceTree = ""; }; 23D321D32ADD0F05006B259C /* Api+PhotoAlbum.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+PhotoAlbum.h"; sourceTree = ""; }; @@ -4689,6 +4770,7 @@ 189DD5A726DFA09700AB55B1 /* Tools */ = { isa = PBXGroup; children = ( + 23CEFC082AFB8FC100576D89 /* sdkContent */, 23FF255C2ABA8EEE0064E904 /* PIIAPTool */, 23E9EA9B2A84C42B00B792F2 /* SGYProgressView */, 23E9E9AB2A81E8E900B792F2 /* Event */, @@ -5597,6 +5679,183 @@ path = Api; sourceTree = ""; }; + 23CEFC082AFB8FC100576D89 /* sdkContent */ = { + isa = PBXGroup; + children = ( + 23CEFC092AFB8FC100576D89 /* catagory */, + 23CEFC1F2AFB8FC100576D89 /* content */, + ); + path = sdkContent; + sourceTree = ""; + }; + 23CEFC092AFB8FC100576D89 /* catagory */ = { + isa = PBXGroup; + children = ( + 23CEFC0A2AFB8FC100576D89 /* Util */, + 23CEFC152AFB8FC100576D89 /* 3Party */, + 23CEFC192AFB8FC100576D89 /* system */, + ); + path = catagory; + sourceTree = ""; + }; + 23CEFC0A2AFB8FC100576D89 /* Util */ = { + isa = PBXGroup; + children = ( + 23CEFC0B2AFB8FC100576D89 /* BSXWDateUtil.h */, + 23CEFC0C2AFB8FC100576D89 /* BSNSStringUtil.m */, + 23CEFC0D2AFB8FC100576D89 /* BSUIDemoUtil.m */, + 23CEFC0E2AFB8FC100576D89 /* BSNSDictionary.h */, + 23CEFC0F2AFB8FC100576D89 /* BS_UIColor.m */, + 23CEFC102AFB8FC100576D89 /* BSXWDateUtil.m */, + 23CEFC112AFB8FC100576D89 /* BSUIDemoUtil.h */, + 23CEFC122AFB8FC100576D89 /* BSNSStringUtil.h */, + 23CEFC132AFB8FC100576D89 /* BSNSDictionary.m */, + 23CEFC142AFB8FC100576D89 /* BS_UIColor.h */, + ); + path = Util; + sourceTree = ""; + }; + 23CEFC152AFB8FC100576D89 /* 3Party */ = { + isa = PBXGroup; + children = ( + 23CEFC162AFB8FC100576D89 /* fmdb */, + ); + path = 3Party; + sourceTree = ""; + }; + 23CEFC162AFB8FC100576D89 /* fmdb */ = { + isa = PBXGroup; + children = ( + 23CEFC172AFB8FC100576D89 /* BSSDLayoutUtil.m */, + 23CEFC182AFB8FC100576D89 /* BSSDLayoutUtil.h */, + ); + path = fmdb; + sourceTree = ""; + }; + 23CEFC192AFB8FC100576D89 /* system */ = { + isa = PBXGroup; + children = ( + 23CEFC1A2AFB8FC100576D89 /* SystemUtil.h */, + 23CEFC1B2AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.h */, + 23CEFC1C2AFB8FC100576D89 /* BS_Define.h */, + 23CEFC1D2AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m */, + 23CEFC1E2AFB8FC100576D89 /* SystemUtil.m */, + ); + path = system; + sourceTree = ""; + }; + 23CEFC1F2AFB8FC100576D89 /* content */ = { + isa = PBXGroup; + children = ( + 23CEFC202AFB8FC100576D89 /* FileOption(文件操作) */, + 23CEFC242AFB8FC100576D89 /* XWNotification(通知) */, + 23CEFC272AFB8FC100576D89 /* NetListen(网络监听) */, + 23CEFC452AFB8FC100576D89 /* K */, + ); + path = content; + sourceTree = ""; + }; + 23CEFC202AFB8FC100576D89 /* FileOption(文件操作) */ = { + isa = PBXGroup; + children = ( + 23CEFC212AFB8FC100576D89 /* BSFileOptionModel.h */, + 23CEFC222AFB8FC100576D89 /* BSFileOptionModel.m */, + 23CEFC232AFB8FC100576D89 /* readMe_FileOption.txt */, + ); + path = "FileOption(文件操作)"; + sourceTree = ""; + }; + 23CEFC242AFB8FC100576D89 /* XWNotification(通知) */ = { + isa = PBXGroup; + children = ( + 23CEFC252AFB8FC100576D89 /* BSNotification.h */, + 23CEFC262AFB8FC100576D89 /* BSNotification.m */, + ); + path = "XWNotification(通知)"; + sourceTree = ""; + }; + 23CEFC272AFB8FC100576D89 /* NetListen(网络监听) */ = { + isa = PBXGroup; + children = ( + 23CEFC282AFB8FC100576D89 /* component(组件) */, + 23CEFC312AFB8FC100576D89 /* BSNetListenModel.m */, + 23CEFC322AFB8FC100576D89 /* BSNetListenModel.h */, + 23CEFC332AFB8FC100576D89 /* model */, + 23CEFC362AFB8FC100576D89 /* RealTime(实时) */, + ); + path = "NetListen(网络监听)"; + sourceTree = ""; + }; + 23CEFC282AFB8FC100576D89 /* component(组件) */ = { + isa = PBXGroup; + children = ( + 23CEFC292AFB8FC100576D89 /* pay_off@3x.png */, + 23CEFC2A2AFB8FC100576D89 /* pay_off.png */, + 23CEFC2B2AFB8FC100576D89 /* pay_off@2x.png */, + 23CEFC2C2AFB8FC100576D89 /* pay_on@3x.png */, + 23CEFC2D2AFB8FC100576D89 /* BSSelectView.h */, + 23CEFC2E2AFB8FC100576D89 /* pay_on@2x.png */, + 23CEFC2F2AFB8FC100576D89 /* pay_on.png */, + 23CEFC302AFB8FC100576D89 /* BSSelectView.m */, + ); + path = "component(组件)"; + sourceTree = ""; + }; + 23CEFC332AFB8FC100576D89 /* model */ = { + isa = PBXGroup; + children = ( + 23CEFC342AFB8FC100576D89 /* BSRecordModel.m */, + 23CEFC352AFB8FC100576D89 /* BSRecordModel.h */, + ); + path = model; + sourceTree = ""; + }; + 23CEFC362AFB8FC100576D89 /* RealTime(实时) */ = { + isa = PBXGroup; + children = ( + 23CEFC372AFB8FC100576D89 /* BSRealTimeView.m */, + 23CEFC382AFB8FC100576D89 /* BSRealTextView.h */, + 23CEFC392AFB8FC100576D89 /* BSLogTableViewController.m */, + 23CEFC3A2AFB8FC100576D89 /* BSLogNetDetailViewController.h */, + 23CEFC3B2AFB8FC100576D89 /* model */, + 23CEFC3E2AFB8FC100576D89 /* view */, + 23CEFC412AFB8FC100576D89 /* BSRealTimeView.h */, + 23CEFC422AFB8FC100576D89 /* BSLogNetDetailViewController.m */, + 23CEFC432AFB8FC100576D89 /* BSLogTableViewController.h */, + 23CEFC442AFB8FC100576D89 /* BSRealTextView.m */, + ); + path = "RealTime(实时)"; + sourceTree = ""; + }; + 23CEFC3B2AFB8FC100576D89 /* model */ = { + isa = PBXGroup; + children = ( + 23CEFC3C2AFB8FC100576D89 /* RealViewCellModel.h */, + 23CEFC3D2AFB8FC100576D89 /* RealViewCellModel.m */, + ); + path = model; + sourceTree = ""; + }; + 23CEFC3E2AFB8FC100576D89 /* view */ = { + isa = PBXGroup; + children = ( + 23CEFC3F2AFB8FC100576D89 /* RealViewNetWorkCell_0.h */, + 23CEFC402AFB8FC100576D89 /* RealViewNetWorkCell_0.m */, + ); + path = view; + sourceTree = ""; + }; + 23CEFC452AFB8FC100576D89 /* K */ = { + isa = PBXGroup; + children = ( + 23CEFC462AFB8FC100576D89 /* BSDrawLine.h */, + 23CEFC472AFB8FC100576D89 /* BSkObject.m */, + 23CEFC482AFB8FC100576D89 /* BSDrawLine.m */, + 23CEFC492AFB8FC100576D89 /* BSkObject.h */, + ); + path = K; + sourceTree = ""; + }; 23E9E9AB2A81E8E900B792F2 /* Event */ = { isa = PBXGroup; children = ( @@ -9939,6 +10198,8 @@ E8E70D7F26F2F39000F03460 /* SubViews */, E8E70D7526F2F15100F03460 /* XPMineViewController.h */, E8E70D7626F2F15100F03460 /* XPMineViewController.m */, + 23CEFB6A2AFB803B00576D89 /* PISwitchingEnvironmentVC.h */, + 23CEFB6B2AFB803B00576D89 /* PISwitchingEnvironmentVC.m */, 23E9EA932A84BE4800B792F2 /* XPGiftUserDataViewController.h */, 23E9EA922A84BE4800B792F2 /* XPGiftUserDataViewController.m */, 23E9EAA42A84C97C00B792F2 /* XPMineUserInfoTagVC.h */, @@ -10277,6 +10538,7 @@ E80EC81F28ACD84000D133C5 /* emoji_45@2x.png in Resources */, E80EC85A28ACD84000D133C5 /* emoji_14@2x.png in Resources */, E80EC8B828ACD84100D133C5 /* emoji_85@2x.png in Resources */, + 23CEFC5A2AFB8FC100576D89 /* pay_on.png in Resources */, E80EC82828ACD84000D133C5 /* emoji_55@2x.png in Resources */, E84A2EAD2A52F20900D6AF8A /* Launch Screen.storyboard in Resources */, E8729EEF2A3B34D30076D80A /* images in Resources */, @@ -10307,6 +10569,7 @@ E80EC8BF28ACDB2A00D133C5 /* Assets.xcassets in Resources */, E80EC88028ACD84000D133C5 /* emoji_146@2x.png in Resources */, E80EC82F28ACD84000D133C5 /* emoji_71@2x.png in Resources */, + 23CEFC582AFB8FC100576D89 /* pay_on@3x.png in Resources */, E80EC8A428ACD84100D133C5 /* emoji_31@2x.png in Resources */, E80EC85028ACD84000D133C5 /* emoji_96@2x.png in Resources */, E80EC85E28ACD84000D133C5 /* emoji_18@2x.png in Resources */, @@ -10339,6 +10602,7 @@ E80EC81728ACD84000D133C5 /* emoji_134@2x.png in Resources */, E8729EF02A3B34D30076D80A /* js in Resources */, E80EC88328ACD84000D133C5 /* emoji_70@2x.png in Resources */, + 23CEFC532AFB8FC100576D89 /* readMe_FileOption.txt in Resources */, E80EC89528ACD84000D133C5 /* emoji_99@2x.png in Resources */, E80EC89128ACD84000D133C5 /* emoji_133@2x.png in Resources */, E80EC87F28ACD84000D133C5 /* emoji_137@2x.png in Resources */, @@ -10384,6 +10648,7 @@ E80EC84A28ACD84000D133C5 /* emoji_94@2x.png in Resources */, 23FF255B2AB956D50064E904 /* pi_home_new_pk.svga in Resources */, E80EC84F28ACD84000D133C5 /* emoji_151@2x.png in Resources */, + 23CEFC592AFB8FC100576D89 /* pay_on@2x.png in Resources */, E80EC88428ACD84000D133C5 /* emoji_01@2x.png in Resources */, E80EC8B628ACD84100D133C5 /* emoji_107@2x.png in Resources */, E80EC83B28ACD84000D133C5 /* emoji_163@2x.png in Resources */, @@ -10427,6 +10692,7 @@ E80EC8A328ACD84100D133C5 /* emoji_52@2x.png in Resources */, E80EC84E28ACD84000D133C5 /* emoji_132@2x.png in Resources */, E8729EED2A3B34D30076D80A /* upload.html in Resources */, + 23CEFC562AFB8FC100576D89 /* pay_off.png in Resources */, E80EC82928ACD84000D133C5 /* emoji_28@2x.png in Resources */, E80EC82028ACD84000D133C5 /* emoji_38@2x.png in Resources */, 23E9EB332A85E97C00B792F2 /* pi_login_new_logo.png in Resources */, @@ -10446,6 +10712,7 @@ 23E9EAA32A84C80300B792F2 /* pi_new_loading.svga in Resources */, E80EC83628ACD84000D133C5 /* emoji_147@2x.png in Resources */, 23E9EB242A84E98300B792F2 /* pi_new_mine_info_sound_play.svga in Resources */, + 23CEFC552AFB8FC100576D89 /* pay_off@3x.png in Resources */, E80EC86B28ACD84000D133C5 /* emoji_200@2x.png in Resources */, E80EC88F28ACD84000D133C5 /* emoji_121@2x.png in Resources */, E80EC87C28ACD84000D133C5 /* emoji_162@2x.png in Resources */, @@ -10456,6 +10723,7 @@ E80EC88228ACD84000D133C5 /* emoji_13@2x.png in Resources */, E80EC82228ACD84000D133C5 /* emoji_34@2x.png in Resources */, E80EC87628ACD84000D133C5 /* emoji_139@2x.png in Resources */, + 23CEFC572AFB8FC100576D89 /* pay_off@2x.png in Resources */, E80EC86328ACD84000D133C5 /* emoji_41@2x.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -10605,6 +10873,7 @@ E8E20BE2281695800033B688 /* XPMineLoginPasswordViewController.m in Sources */, E84A2EA22A52883000D6AF8A /* XPIncomeRecordGoldDetailsTimeView.m in Sources */, E86E79D628A4EA0C006DAF48 /* SessionRiskCache.m in Sources */, + 23CEFC542AFB8FC100576D89 /* BSNotification.m in Sources */, E824543826F5820A00BE8163 /* XPLoginVerifBindPhonePresenter.m in Sources */, E8B846BF26FD827900A777FE /* XPMineUserInfoAlbumViewController.m in Sources */, E84CBCE128436D3C00D43221 /* XPMineContactViewController.m in Sources */, @@ -10716,6 +10985,7 @@ E8998D7A2859784200C68558 /* XPSVGAPlayer.m in Sources */, 9BD9A18427A0F128004186FE /* XPMineVisitorItemModel.m in Sources */, E852D73E28631C18001465ED /* XPMonentsCommentTableViewCell.m in Sources */, + 23CEFC4E2AFB8FC100576D89 /* BSNSDictionary.m in Sources */, 23FF426A2AA5DF050055733C /* XPNewHomePartyTagView.m in Sources */, E85E7BA22A4EC99300B6D00A /* XPMineGiveDiamondSearchModel.m in Sources */, 1427219829A75F6F00C7C423 /* HTTPServer.m in Sources */, @@ -10739,12 +11009,14 @@ E8BD0F8828A9E9E400DE050D /* RoomSailingPrizeModel.m in Sources */, 238B37B32AC55A2C00BFC9D5 /* XPTreasureFairyPrizeRecordCell.m in Sources */, E8A1F79C290644DC0099C952 /* XPRoomMorePlayCollectionViewCell.m in Sources */, + 23CEFC512AFB8FC100576D89 /* SystemUtil.m in Sources */, E8659909273E800D00EE349D /* XPGiftCollectionViewFlowLayout.m in Sources */, 238B37BD2AC55A2C00BFC9D5 /* XPTreasureFairyTrialsContentView.m in Sources */, E85E7B262A4EB0D300B6D00A /* XPMineGuildViewController.m in Sources */, E85E7B672A4EC35A00B6D00A /* XPBindExtractInfoModel.m in Sources */, E8B846CB26FDD7CD00A777FE /* XPMineRechargeViewController.m in Sources */, E86596512701A1C000846EBD /* StatisticsService.m in Sources */, + 23CEFC5E2AFB8FC100576D89 /* BSRealTimeView.m in Sources */, E824544026F58F9400BE8163 /* XPMinePayPwdViewController.m in Sources */, 9BE01AED2893D0DF00B50299 /* XPDressShopSearchTableViewCell.m in Sources */, 23FF42732AA6CC480055733C /* PIHomeItemModel.m in Sources */, @@ -10770,11 +11042,13 @@ E8AC723D26F4B6AA007D6E91 /* XPLoginBindPhoneResultViewController.m in Sources */, E8AB632728AE13210023B0D2 /* XPMonentsTopicListPresenter.m in Sources */, 1427218729A75F6F00C7C423 /* MyHTTPConnection.m in Sources */, + 23CEFB6C2AFB803B00576D89 /* PISwitchingEnvironmentVC.m in Sources */, E8D55C9D28113218006935A5 /* MessageMenuModel.m in Sources */, E87DF4EF2A42CB90009C1185 /* XPHomeCollectRoomTableViewCell.m in Sources */, 236B2E442AA07D06003967A8 /* UIColor+RW.m in Sources */, 189DD73E26E21C3F00AB55B1 /* YYUtility.m in Sources */, 14A6034F29A36D8300D2A6A5 /* XPSimpleMineHeaderView.m in Sources */, + 23CEFC652AFB8FC100576D89 /* BSDrawLine.m in Sources */, E81C1B2F277071670020D1E4 /* XPArrangeMicInfoModel.m in Sources */, 9B0086CA27BA4F570032BD2B /* AnchorMicroView.m in Sources */, E83ABF00280EC45700322EE4 /* MessageContentApplicationShareView.m in Sources */, @@ -10792,6 +11066,7 @@ E8A03DFF27635F960098D9EA /* XPRoomCandyGiftView.m in Sources */, E8A3538E28FE5CED0014A784 /* Api+WishGift.m in Sources */, 180116F9279E8C4C00F2CBC0 /* PLTimeUtil.m in Sources */, + 23CEFC502AFB8FC100576D89 /* UILabel+YBAttributeTextTapAction.m in Sources */, E87E545429AA05EA00EBE52B /* XPFootPrintNavView.m in Sources */, E8252FEE27687DF1002B3164 /* ActivityInfoModel.m in Sources */, E84BF7D1277BFCDD00EF8877 /* RoomTagModel.m in Sources */, @@ -10808,6 +11083,7 @@ 9BA812E428BF70A600783EA7 /* XPRoomRedPacketPwdView.m in Sources */, 23E9EB1B2A84D28A00B792F2 /* XPMineUserInfoEditTagView.m in Sources */, 237B94BE2A984DA7007853E3 /* XPRoomTrumpetViewController.m in Sources */, + 23CEFC5C2AFB8FC100576D89 /* BSNetListenModel.m in Sources */, 2331C1662A5EB71000E1D940 /* NobleCenterModel.m in Sources */, E8998D8B2859CB6A00C68558 /* XPMineUserInfoGiftWallSubViewController.m in Sources */, E8DEC9A42764A6600078CB70 /* XPMoreMenuPresenter.m in Sources */, @@ -10858,6 +11134,7 @@ E8C1CD6627D88EF800376F83 /* XPRoomFaceViewController.m in Sources */, E80DE4102775C34E00BE5BCB /* XPFirstRechargeSuccessView.m in Sources */, E8412FB32779E285006E1101 /* Api+RoomSetting.m in Sources */, + 23CEFC4A2AFB8FC100576D89 /* BSNSStringUtil.m in Sources */, 9B2F72D028E45A480000E4FA /* XPRoomQuickMessageContainView.m in Sources */, 23FF426D2AA5E4EE0055733C /* XPNewHomePartyAudioView.m in Sources */, E81060E82987720F00B772F0 /* MessageUnSupportModel.m in Sources */, @@ -10866,6 +11143,7 @@ 238B37A52AC55A2C00BFC9D5 /* TreasureFailyKeyInfoModel.m in Sources */, 140A818D299CFF1C00841594 /* XPVendorCallViewController.m in Sources */, E8EEB8F226FC2050007C6EBA /* SDPhotoBrowser.m in Sources */, + 23CEFC4F2AFB8FC100576D89 /* BSSDLayoutUtil.m in Sources */, E81C27AB26EF2D920031E639 /* ThirdUserInfo.m in Sources */, 23FF25682ABC3BC00064E904 /* XPHomeGameCell.m in Sources */, E8788950273A699900BF1D57 /* ThemeColor+SendGift.m in Sources */, @@ -10998,6 +11276,7 @@ E85E7B472A4EB0D300B6D00A /* XPMineGuildManagerPerTableViewCell.m in Sources */, E824544326F58FCE00BE8163 /* XPMinePayPwdInputView.m in Sources */, 23C7C0B72A7CD7B000802205 /* XPNewMineGuildItemView.m in Sources */, + 23CEFC5D2AFB8FC100576D89 /* BSRecordModel.m in Sources */, 9B1B72A1280023F3003FACE9 /* XPMineAnchorFansTeamTableViewCell.m in Sources */, 1808073027315E8E001FD836 /* NetImageView.m in Sources */, E880B3AC278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m in Sources */, @@ -11113,6 +11392,7 @@ 9B1B72BF2800422E003FACE9 /* XPAnchorPKRuleView.m in Sources */, 1427219729A75F6F00C7C423 /* DDRange.m in Sources */, E85E7B6E2A4EC4AE00B6D00A /* XPMineGuildPresenter.m in Sources */, + 23CEFC5B2AFB8FC100576D89 /* BSSelectView.m in Sources */, E81125CA296E606F000D9804 /* QPhotoImageModel.m in Sources */, 9B42869528C1E00A009034D2 /* XPRedPacketResultModel.m in Sources */, 2331C16E2A5EB71000E1D940 /* XPNobleAuthorityDescView.m in Sources */, @@ -11132,6 +11412,7 @@ 18A61BE8274F9CF000A09A54 /* SessionListViewController.m in Sources */, E8C1CD6A27D8937800376F83 /* XPRoomFaceCollectionViewCell.m in Sources */, 9B2EA7C02804037700ED17BF /* AnchorPKStageView.m in Sources */, + 23CEFC622AFB8FC100576D89 /* BSLogNetDetailViewController.m in Sources */, 238B37CF2AC55A2C00BFC9D5 /* XPTreasureFairySendRecordView.m in Sources */, 238B37C52AC55A2C00BFC9D5 /* XPTreasureFairyMoreView.m in Sources */, E811FFF72742367B00918544 /* XPGiftEmptyCollectionViewCell.m in Sources */, @@ -11323,6 +11604,7 @@ E85E3FA728B7A6F000268DC8 /* MessageContentMonentsView.m in Sources */, E880B3AF278BE1D800A83B0D /* Api+AcrossRoomPK.m in Sources */, 238B37DC2AC55A2C00BFC9D5 /* XPTreasureFairyBallView.m in Sources */, + 23CEFC4B2AFB8FC100576D89 /* BSUIDemoUtil.m in Sources */, E8B9842D28AB77F10022D026 /* XPMonentsPublishTopicView.m in Sources */, 239141C62AE129F700322CA9 /* PIInputScrollingView.m in Sources */, E88C72992828F3620047FB2B /* XPRoomMusicLibraryTableViewCell.m in Sources */, @@ -11388,7 +11670,9 @@ E8D34D5628080393009C4835 /* XPMineDataGiftCollectionViewCell.m in Sources */, E84A2E9C2A52823900D6AF8A /* XPTextField.m in Sources */, 186A536926FC6F2E00D67B2C /* XPShareView.m in Sources */, + 23CEFC602AFB8FC100576D89 /* RealViewCellModel.m in Sources */, E8AB632C28AE19600023B0D2 /* XPMonentsMineViewController.m in Sources */, + 23CEFC5F2AFB8FC100576D89 /* BSLogTableViewController.m in Sources */, 236B2E4D2AA07D06003967A8 /* XPRoomLittleGameContainerView.m in Sources */, E87AE8C1284E184300CAFBB3 /* RoomNewUserGreetModel.m in Sources */, 9BC5C91C277C8A7B007C8719 /* XPReleaseRadioViewController.m in Sources */, @@ -11412,6 +11696,7 @@ E818E34B286ECABF005EDF68 /* XPMonentsPublishPresenter.m in Sources */, E85E7B462A4EB0D300B6D00A /* XPGuildEmptyCollectionViewCell.m in Sources */, 9B7B605B27BB53060070BB72 /* XPAnchorAudienceUpMicView.m in Sources */, + 23CEFC522AFB8FC100576D89 /* BSFileOptionModel.m in Sources */, 238B37D02AC55A2C00BFC9D5 /* XPTreasureFairySummonGiftView.m in Sources */, 14DCAD0E299B6AD900A7DD31 /* XPForgetPwdViewController.m in Sources */, 23194DD12AD14BF000649F51 /* DDAbstractDatabaseLogger.m in Sources */, @@ -11458,6 +11743,7 @@ 23E9EA9E2A84C42B00B792F2 /* SGYProgressView.m in Sources */, E87E91552796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m in Sources */, E880B3B5278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m in Sources */, + 23CEFC612AFB8FC100576D89 /* RealViewNetWorkCell_0.m in Sources */, 186A534626FC6ED900D67B2C /* TTPopup.m in Sources */, 9B4D449328F15765002572D5 /* XPGiftLuckyGiftBroadcastView.m in Sources */, E81C278C26EAFAF60031E639 /* Base64.m in Sources */, @@ -11496,6 +11782,7 @@ 9BCE6144277D657600CC0358 /* XPReleaseRadioTableViewCell.m in Sources */, 186A534D26FC6ED900D67B2C /* TTActionSheetView.m in Sources */, E81060E529876FF300B772F0 /* MessageAudioModel.m in Sources */, + 23CEFC642AFB8FC100576D89 /* BSkObject.m in Sources */, E83DB481274649FB00D8CBD1 /* XPGiftBannerUserInfoModel.m in Sources */, 9B3A1DF4280571000058E2DD /* XPAnchorPKInviteView.m in Sources */, 2331C1BD2A60F69E00E1D940 /* UILabel+Utils.m in Sources */, @@ -11531,6 +11818,7 @@ 9B41D36E282649230048C588 /* XPWeekStarRankUserModel.m in Sources */, E824545926F5E65900BE8163 /* XPMineVerifIdentityView.m in Sources */, E841ED61280FB0BD00904808 /* ContentLevelUpgradeModel.m in Sources */, + 23CEFC632AFB8FC100576D89 /* BSRealTextView.m in Sources */, 238B37B92AC55A2C00BFC9D5 /* XPTreasureFairyTrialsRecordCell.m in Sources */, 236B2E542AA08757003967A8 /* LittleGameScrollStageView.m in Sources */, 189DD74026E21C3F00AB55B1 /* YYUtility+App.m in Sources */, @@ -11618,6 +11906,7 @@ E85E7BB62A4ED59900B6D00A /* XPIncomeRecordGoldDetailsCell.m in Sources */, 9B7B606227BB96E40070BB72 /* XPRoomAnchorInfoCardView.m in Sources */, E87DF4FE2A42CD7E009C1185 /* XPRoomSearchRecommendHeadView.m in Sources */, + 23CEFC4D2AFB8FC100576D89 /* BSXWDateUtil.m in Sources */, E85E7B442A4EB0D300B6D00A /* XPMineExchangeAuthorityCell.m in Sources */, E80B0734280D740600A79F63 /* MessageContentGuildView.m in Sources */, E8395334276A03C300CF2F24 /* XPMineDressUpPresenter.m in Sources */, @@ -11690,6 +11979,7 @@ E81A654C28351D9900F55894 /* XPMonentsTopicCollectionViewCell.m in Sources */, E85E7B9F2A4EC99300B6D00A /* XPMineGiveDiamondPresenter.m in Sources */, 14D8767C29A7445C00E1DD7F /* NSObject+AutoCoding.m in Sources */, + 23CEFC4C2AFB8FC100576D89 /* BS_UIColor.m in Sources */, E8412FA92779C2ED006E1101 /* XPRoomSettingItemModel.m in Sources */, 189DD58F26DF97E700AB55B1 /* LoginPresenter.m in Sources */, E88863C9278EBA43004BCFAB /* XPAcrossRoomPKForceEndResultView.m in Sources */, diff --git a/YuMi.xcodeproj/xcshareddata/xcschemes/YuMi.xcscheme b/YuMi.xcodeproj/xcshareddata/xcschemes/YuMi.xcscheme index 9e3921f5..d258e3d3 100644 --- a/YuMi.xcodeproj/xcshareddata/xcschemes/YuMi.xcscheme +++ b/YuMi.xcodeproj/xcshareddata/xcschemes/YuMi.xcscheme @@ -31,7 +31,7 @@ +#import "MvpViewController.h" +NS_ASSUME_NONNULL_BEGIN + +@interface PISwitchingEnvironmentVC : MvpViewController + +@end + +NS_ASSUME_NONNULL_END diff --git a/YuMi/Modules/YMMine/View/PISwitchingEnvironmentVC.m b/YuMi/Modules/YMMine/View/PISwitchingEnvironmentVC.m new file mode 100644 index 00000000..58735e8c --- /dev/null +++ b/YuMi/Modules/YMMine/View/PISwitchingEnvironmentVC.m @@ -0,0 +1,108 @@ +// +// PISwitchingEnvironmentVC.m +// YuMi +// +// Created by duoban on 2023/11/8. +// + +#import "PISwitchingEnvironmentVC.h" +#import "XPLoginViewController.h" +#import "XPAdImageTool.h" +#import "BaseNavigationController.h" + +@interface PISwitchingEnvironmentVC () +@property(nonatomic,strong) UILabel *titleView; +@end + +@implementation PISwitchingEnvironmentVC + +- (void)viewDidLoad { + [super viewDidLoad]; + self.title = @"切换"; + NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"]; + NSString *text = @""; + if([isProduction isEqualToString:@"YES"]){ + text = @"当前环境:正式环境"; + }else{ + text = @"当前环境:测试环境"; + } + self.titleView = [UILabel labelInitWithText:text font:kFontMedium(16) textColor:[DJDKMIMOMColor mainTextColor]]; + [self.view addSubview:self.titleView]; + UILabel *switchTitle = [UILabel labelInitWithText:@"切换环境" font:kFontMedium(15) textColor:[DJDKMIMOMColor secondTextColor]]; + [self.view addSubview:switchTitle]; + + UISwitch *switchView = [[UISwitch alloc]init]; + [switchView setOn:[isProduction isEqualToString:@"YES"]]; + [self.view addSubview:switchView]; + [switchView addTarget:self action:@selector(switchEnvironmentAction:) forControlEvents:UIControlEventValueChanged]; + + + UIButton *realBtn = [UIButton new]; + + [realBtn setTitle:@"调试" forState:UIControlStateNormal]; + [realBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; + + [realBtn addTarget:self action:@selector(showRealTimeView) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:realBtn]; + + + [self.titleView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.mas_equalTo(kGetScaleWidth(30)); + make.top.mas_equalTo(kGetScaleWidth(100)); + }]; + [switchTitle mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.equalTo(self.titleView); + make.top.equalTo(self.titleView.mas_bottom).mas_offset(kGetScaleWidth(20)); + }]; + [switchView mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.equalTo(switchTitle.mas_trailing).mas_offset(kGetScaleWidth(10)); + make.centerY.equalTo(switchTitle); + }]; + [realBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.equalTo(self.titleView); + make.top.equalTo(switchTitle.mas_bottom).mas_offset(kGetScaleWidth(30)); + }]; +} +-(void)showRealTimeView{ + [BSNetListenModel initRealTimeView]; + UIWindow * window = [UIApplication sharedApplication].keyWindow; + [BSNetListenModel sharedInstance:window]; + +} +-(void)switchEnvironmentAction:(UISwitch *)sender{ + + TTAlertConfig *config = [[TTAlertConfig alloc]init]; + config.title = @"提示"; + config.message = @"确认切换网络环境吗?需要重启app"; + [TTPopup alertWithConfig:config confirmHandler:^{ + + if(sender.isOn == YES){ + [[NSUserDefaults standardUserDefaults]setValue:@"YES" forKey:@"kIsProductionEnvironment"]; + [[NSUserDefaults standardUserDefaults]synchronize]; + self.titleView.text = @"当前环境:正式环境"; + [self logoutAction]; + return; + } + [[NSUserDefaults standardUserDefaults]setValue:@"NO" forKey:@"kIsProductionEnvironment"]; + [[NSUserDefaults standardUserDefaults]synchronize]; + self.titleView.text = @"当前环境:测试环境"; + [self logoutAction]; + } cancelHandler:^{ + [sender setOn:!sender.isOn]; + }]; + +} +-(void)logoutAction{ + exit(0); +} +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/YuMi/Modules/YMMine/View/XPMineViewController.m b/YuMi/Modules/YMMine/View/XPMineViewController.m index 5f8c1fbe..750a4a85 100644 --- a/YuMi/Modules/YMMine/View/XPMineViewController.m +++ b/YuMi/Modules/YMMine/View/XPMineViewController.m @@ -62,6 +62,7 @@ #import "HomeLittleGameRoomModel.h" #import "XPLittleGameRoomOpenView.h" #import "XPMineGameTableViewCell.h" +#import "PISwitchingEnvironmentVC.h" UIKIT_EXTERN NSString *kRequestRicket; @interface XPMineViewController () @@ -175,6 +176,8 @@ UIKIT_EXTERN NSString *kRequestRicket; setItem.skipType = XPMineItemType_My_Set; [self.functionArray addObject:setItem]; + + [self.view addSubview:self.bgImageView]; [self.view addSubview:self.tableView]; // [self.view addSubview:self.settingButton]; @@ -197,6 +200,13 @@ UIKIT_EXTERN NSString *kRequestRicket; } - (void)pushViewControllerWithType:(NSInteger)type functionItem:(XPMineFuntionItemModel *)item { + + if([item.centerName isEqualToString:@"切换分区"]){ + PISwitchingEnvironmentVC *vc = [PISwitchingEnvironmentVC new]; + [self.navigationController pushViewController:vc animated:YES]; + return; + } + switch (type) { case XPMineItemType_My_Set:{ [self settingButtonAction]; @@ -509,6 +519,9 @@ UIKIT_EXTERN NSString *kRequestRicket; if (obj.skipType == XPMineItemType_CP || obj.skipType == XPMineItemType_My_Room) { [self.functionArray removeObject:obj]; } + if([obj.centerName isEqualToString:@"切换分区"]){ + [self.functionArray removeObject:obj]; + } }]; NSMutableArray *array = [NSMutableArray array]; for (XPMineFuntionItemModel *item in self.functionArray) { @@ -516,6 +529,13 @@ UIKIT_EXTERN NSString *kRequestRicket; } NSString *trackName = [array componentsJoinedByString:@","]; [StatisticsServiceHelper trackEventWithKey:StatisticsServiceEventusercenter_function_show eventAttributes:@{@"functionName" : trackName}]; +#ifdef DEBUG + XPMineFuntionItemModel *item = [XPMineFuntionItemModel new]; + item.centerName = @"切换分区"; + item.centerPic = @"mineview_set"; + [self.functionArray addObject:item]; +#else +#endif [self.tableView reloadData]; } - (void)onGetMineFuntionItemFail{ diff --git a/YuMi/Modules/YMMonents/View/SubViews/XPMonentsTooBarView.m b/YuMi/Modules/YMMonents/View/SubViews/XPMonentsTooBarView.m index dd39b9c5..4196aa6b 100644 --- a/YuMi/Modules/YMMonents/View/SubViews/XPMonentsTooBarView.m +++ b/YuMi/Modules/YMMonents/View/SubViews/XPMonentsTooBarView.m @@ -296,7 +296,7 @@ shareInfo.shareContent = self.monentsInfo.content; shareInfo.shareImageUrl = self.monentsInfo.avatar; NSString * uid = [AccountInfoStorage instance].getUid; - NSString *urlStr = [NSString stringWithFormat:@"%@/%@?uid=%@&dynamicId=%@&worldId=%ld",API_HOST_URL, URLWithType(kMonentsShareURL), uid, self.monentsInfo.dynamicId, self.monentsInfo.worldId]; + NSString *urlStr = [NSString stringWithFormat:@"%@/%@?uid=%@&dynamicId=%@&worldId=%ld",[HttpRequestHelper getHostUrl], URLWithType(kMonentsShareURL), uid, self.monentsInfo.dynamicId, self.monentsInfo.worldId]; shareInfo.shareUrl = urlStr; shareInfo.dynamicId = self.monentsInfo.dynamicId; shareInfo.uid = self.monentsInfo.uid; diff --git a/YuMi/Modules/YMRoom/View/ArrangeMic/View/XPArrangeMicViewController.m b/YuMi/Modules/YMRoom/View/ArrangeMic/View/XPArrangeMicViewController.m index 46f948db..11ad05b4 100644 --- a/YuMi/Modules/YMRoom/View/ArrangeMic/View/XPArrangeMicViewController.m +++ b/YuMi/Modules/YMRoom/View/ArrangeMic/View/XPArrangeMicViewController.m @@ -654,7 +654,7 @@ shareInfo.type = ShareType_Room; shareInfo.roomUid = self.userInfo.roomUid.integerValue; NSString * uid = [AccountInfoStorage instance].getUid; - NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%@&room_name=%@&room_id=%@&room_avatar=%@&share_name=%@",API_HOST_URL,URLWithType(kShareRoomURL),uid,self.userInfo.roomUid,self.userInfo.nick,self.userInfo.roomId,self.userInfo.roomAvatar,self.userInfo.nick]; + NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%@&room_name=%@&room_id=%@&room_avatar=%@&share_name=%@",[HttpRequestHelper getHostUrl],URLWithType(kShareRoomURL),uid,self.userInfo.roomUid,self.userInfo.nick,self.userInfo.roomId,self.userInfo.roomAvatar,self.userInfo.nick]; shareInfo.shareUrl = urlString; CGFloat margin = 15; CGSize itemSize = CGSizeMake((KScreenWidth-2*margin)/4, 65); diff --git a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m index 240e3f73..238311d8 100644 --- a/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m +++ b/YuMi/Modules/YMRoom/View/BaseUIContainerView/XPRoomFunctionContainerView.m @@ -1364,7 +1364,12 @@ dispatch_source_cancel(self.followAnchorTimer); } #ifdef DEBUG - NSInteger totalTime = 5; + NSInteger totalTime = 5; + NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"]; + if([isProduction isEqualToString:@"YES"]){ + totalTime = 420; + } + #else NSInteger totalTime = 420; #endif diff --git a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m index 10d70333..3ecc93b1 100644 --- a/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m +++ b/YuMi/Modules/YMRoom/View/RoomHeaderView/RoomHeaderView.m @@ -250,7 +250,7 @@ shareInfo.type = ShareType_Room; shareInfo.roomUid = roomInfo.uid; NSString * uid = [AccountInfoStorage instance].getUid; - NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%ld&room_name=%@&room_id=%ld&room_avatar=%@&share_name=%@",API_HOST_URL,URLWithType(kShareRoomURL),uid,roomInfo.uid,roomInfo.title,roomInfo.erbanNo,roomInfo.avatar,roomInfo.nick]; + NSString * urlString = [NSString stringWithFormat:@"%@/%@?shareUid=%@&uid=%ld&room_name=%@&room_id=%ld&room_avatar=%@&share_name=%@",[HttpRequestHelper getHostUrl],URLWithType(kShareRoomURL),uid,roomInfo.uid,roomInfo.title,roomInfo.erbanNo,roomInfo.avatar,roomInfo.nick]; shareInfo.shareUrl = urlString; CGFloat margin = 15; diff --git a/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroView.m b/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroView.m index c3417e95..e65446eb 100644 --- a/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroView.m +++ b/YuMi/Modules/YMRoom/View/StageView/MicroView/MicroView.m @@ -151,10 +151,9 @@ [self.stackView mas_makeConstraints:^(MASConstraintMaker *make) { make.centerX.mas_equalTo(self); make.top.mas_equalTo(self.avatarImageView.mas_bottom).offset(10); + make.width.mas_lessThanOrEqualTo(kGetScaleWidth(88)); }]; - [self.nickLabel mas_makeConstraints:^(MASConstraintMaker *make) { - make.width.mas_lessThanOrEqualTo(kGetScaleWidth(70)); - }]; + [self.postionLabel mas_makeConstraints:^(MASConstraintMaker *make) { make.width.height.mas_equalTo(14); }]; diff --git a/YuMi/Modules/YMWeb/XPWebViewController.m b/YuMi/Modules/YMWeb/XPWebViewController.m index 8f31b8a7..571f1c61 100644 --- a/YuMi/Modules/YMWeb/XPWebViewController.m +++ b/YuMi/Modules/YMWeb/XPWebViewController.m @@ -483,7 +483,7 @@ NSString * const kJSOpenAppConcernedChat = @"openAppConcernedChat"; return; } if (![_url hasPrefix:@"http"] && ![_url hasPrefix:@"https"]){ - _url = [NSString stringWithFormat:@"%@/%@", API_HOST_URL, _url]; + _url = [NSString stringWithFormat:@"%@/%@", [HttpRequestHelper getHostUrl], _url]; } if (![_url containsString:@"?"]) { diff --git a/YuMi/Network/HttpRequestHelper.h b/YuMi/Network/HttpRequestHelper.h index 0110a2fe..44d156ea 100644 --- a/YuMi/Network/HttpRequestHelper.h +++ b/YuMi/Network/HttpRequestHelper.h @@ -21,7 +21,7 @@ typedef void(^HttpRequestHelperCompletion)(BaseModel* _Nullable data, NSInteger NS_ASSUME_NONNULL_BEGIN @interface HttpRequestHelper : NSObject - ++(NSString *)getHostUrl; + (NSDictionary*)configBaseParmars:(NSDictionary *)parmars; + (void)GET:(NSString *)method diff --git a/YuMi/Network/HttpRequestHelper.m b/YuMi/Network/HttpRequestHelper.m index 709265a1..1350a9d3 100644 --- a/YuMi/Network/HttpRequestHelper.m +++ b/YuMi/Network/HttpRequestHelper.m @@ -18,7 +18,7 @@ static AFHTTPSessionManager *manager = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ - manager = [[AFHTTPSessionManager manager]initWithBaseURL:[NSURL URLWithString:API_HOST_URL]]; + manager = [[AFHTTPSessionManager manager]initWithBaseURL:[NSURL URLWithString:[HttpRequestHelper getHostUrl]]]; manager.responseSerializer = [AFJSONResponseSerializer serializer]; manager.requestSerializer.HTTPShouldHandleCookies = YES; // 客户端是否信任非法证书 @@ -32,7 +32,20 @@ }); return manager; } - ++(NSString *)getHostUrl{ +#ifdef DEBUG + NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"]; + if([isProduction isEqualToString:@"YES"]){ + return API_HOST_URL; + } + return API_HOST_TEST_URL; + +#else + + return API_HOST_URL + +#endif +} + (void)GET:(NSString *)method params:(NSDictionary *)params success:(void (^)(BaseModel *data))success @@ -41,25 +54,42 @@ if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ failure(-1, YMLocalizedString(@"HttpRequestHelper0")); + }); return; } [self configHeaders]; params = [self configBaseParmars:params]; + AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; #ifdef DEBUG NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); +#endif +#ifdef DEBUG + NSString *url = API_HOST_URL; + NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; [manager GET:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; + #ifdef DEBUG NSLog(@"\n%@", [baseModel toJSONString]); + NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; + NSDictionary *allHeaders = response.allHeaderFields; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - success(baseModel); + + success(baseModel); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - [self handleNetError:error method:method failure:failure]; + [self handleNetError:error method:method failure:failure]; }]; } @@ -71,58 +101,84 @@ if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ failure(-1, YMLocalizedString(@"HttpRequestHelper0")); - + }); return; } [self configHeaders]; params = [self configBaseParmars:params]; + AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; #ifdef DEBUG NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + + NSString *url = API_HOST_URL; + NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; [manager POST:method parameters:params headers:nil progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; #ifdef DEBUG NSLog(@"\n%@", [baseModel toJSONString]); + NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; + NSDictionary *allHeaders = response.allHeaderFields; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - success(baseModel); + success(baseModel); } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - [self handleNetError:error method:method failure:failure]; + [self handleNetError:error method:method failure:failure]; }]; } + (void)DELETE:(NSString *)method - params:(NSDictionary *)params - success:(void (^)(BaseModel *data))success - failure:(void (^)(NSInteger resCode, NSString *message))failure + params:(NSDictionary *)params + success:(void (^)(BaseModel *data))success + failure:(void (^)(NSInteger resCode, NSString *message))failure { - if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - failure(-1, YMLocalizedString(@"HttpRequestHelper0")); - - }); - return; - } - - [self configHeaders]; - params = [self configBaseParmars:params]; + if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + failure(-1, YMLocalizedString(@"HttpRequestHelper0")); + + }); + return; + } + + [self configHeaders]; + params = [self configBaseParmars:params]; + AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; #ifdef DEBUG - NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); + NSString *url = API_HOST_URL; + NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,method]; + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - - AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; - [manager DELETE:method parameters:params headers:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { - BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; + + [manager DELETE:method parameters:params headers:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; + #ifdef DEBUG - NSLog(@"\n%@", [baseModel toJSONString]); + NSLog(@"\n%@", [baseModel toJSONString]); + NSHTTPURLResponse *response = (NSHTTPURLResponse *)task.response; + NSDictionary *allHeaders = response.allHeaderFields; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else #endif - success(baseModel); - } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { - [self handleNetError:error method:method failure:failure]; - }]; + success(baseModel); + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + [self handleNetError:error method:method failure:failure]; + }]; } + (void)request:(NSString *)url @@ -140,10 +196,10 @@ [self POST:url params:params success:success failure:failure]; } break; - case HttpRequestHelperMethodDELETE:{ - [self DELETE:url params:params success:success failure:failure]; - } - break; + case HttpRequestHelperMethodDELETE:{ + [self DELETE:url params:params success:success failure:failure]; + } + break; } } @@ -205,27 +261,38 @@ + (void)handleNetError:(NSError *)error method:(NSString *)method failure:(void (^)(NSInteger resCode, NSString *message))failure { -#ifdef DEBUG - NSLog(@"\n%@", error); -#endif // 别问,反正 oauth/ticket 接口要通过这种方式取错误码。 NSHTTPURLResponse *response = error.userInfo[@"com.alamofire.serialization.response.error.response"]; + NSString *NETWORK_ERROR = error.description.length > 0 ? error.description : YMLocalizedString(@"HttpRequestHelper5");; if (response && response.statusCode == 401) { failure(response.statusCode, YMLocalizedString(@"HttpRequestHelper7")); + } else { - + if (error.code == -1009 || error.code == -1001 || error.code == -1004 || error.code == -1003 || error.code == -1002 || error.code == 3840) { failure(error.code, @""); - } else { - failure(error.code, error.localizedDescription.length > 0 ? error.localizedDescription : YMLocalizedString(@"HttpRequestHelper4")); + } else { + failure(error.code, error.localizedDescription.length > 0 ? error.localizedDescription : YMLocalizedString(@"HttpRequestHelper4")); } - NSString * code = error.code ? [NSString stringWithFormat:@"%ld", error.code] : @"9999"; - NSString * des = error.description.length > 0 ? error.description : YMLocalizedString(@"HttpRequestHelper5"); - NSException *exception = [NSException exceptionWithName:@"229181" - reason:method - userInfo:@{@"code":code, @"desc":des}]; - + NSString * code = error.code ? [NSString stringWithFormat:@"%ld", error.code] : @"9999"; + NSString * des = error.description.length > 0 ? error.description : YMLocalizedString(@"HttpRequestHelper5"); + NSException *exception = [NSException exceptionWithName:@"229181" + reason:method + userInfo:@{@"code":code, @"desc":des}]; + } +#ifdef DEBUG + NSLog(@"\n%@", error); + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + NSDictionary *allHeaders = response.allHeaderFields; + //3, + NSMutableDictionary *blockDict = [[NSMutableDictionary alloc]init]; + [blockDict setObject:@(response.statusCode) forKey:@"resultCode"]; + [blockDict setObject:NETWORK_ERROR forKey:@"resultDesc"]; + [BSNetListenModel addHttpRsp:method header:allHeaders result:blockDict isSuccess:NO time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else +#endif } /// 增加或编辑技能卡专用接口 Post 请求参数放入到 body 里 使用 application/json 类型传递 @@ -233,9 +300,9 @@ /// @param params 参数 /// @param completion 回调 + (void)postSkillCard:(NSString *)path - params:(NSString *)params + params:(NSString *)params completion:(HttpRequestHelperCompletion)completion{ - + if ([AFNetworkReachabilityManager sharedManager].networkReachabilityStatus == 0) { dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ completion(nil, -1, YMLocalizedString(@"HttpRequestHelper0")); @@ -245,29 +312,28 @@ [self configHeaders]; NSDictionary *baseParams = [self configBaseParmars:nil]; -#ifdef DEBUG -// NSLog(@"\nmethod:\n%@\nparameter:\n%@", method, params); -#endif - AFHTTPSessionManager *manager = [HttpRequestHelper requestManager]; NSString *url = API_HOST_URL; NSString *urlPath = [NSString stringWithFormat:@"%@/%@", url ,path]; - - #ifdef DEBUG - NSLog(@"url:%@,parameter:%@",urlPath, baseParams); - #endif - +#ifdef DEBUG + NSLog(@"\nmethod:\n%@\nparameter:\n%@", path, params); + dispatch_async(dispatch_get_global_queue(0, 0), ^{ + [BSNetListenModel addHttpReq:urlPath header:manager.requestSerializer.HTTPRequestHeaders param:[params copy] time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else +#endif + __block NSString *requestUrl = @""; [baseParams.allKeys enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { NSString *value = baseParams[obj]; requestUrl = [requestUrl stringByAppendingString:[NSString stringWithFormat:@"%@=%@&", obj, value]]; }]; - + urlPath = [NSString stringWithFormat:@"%@?%@", urlPath, requestUrl]; - + NSMutableURLRequest *request = [[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:urlPath parameters:baseParams error:nil]; request.timeoutInterval= [[[NSUserDefaults standardUserDefaults] valueForKey:@"timeoutInterval"] longValue]; - + [request setValue:@"application/json; charset=UTF-8" forHTTPHeaderField:@"Content-Type"]; if ([[AccountInfoStorage instance] getUid].length > 0) { @@ -282,18 +348,29 @@ }else { [request setValue:nil forHTTPHeaderField:@"pub_ticket"]; } - + NSError *error; - + [request setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]]; [[manager dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { if (responseObject) { BaseModel *baseModel = [BaseModel modelWithDictionary:responseObject]; - #ifdef DEBUG + +#ifdef DEBUG NSLog(@"\n%@", [baseModel toJSONString]); - #endif +#else +#endif if (baseModel.code == 200) { +#ifdef DEBUG + + NSHTTPURLResponse *response = response; + NSDictionary *allHeaders = response.allHeaderFields; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [BSNetListenModel addHttpRsp:urlPath header:allHeaders result:baseModel.data isSuccess:YES time:[NSDate getCurrentTimeWithFormat:@"yyyy-MM-dd HH:mm:ss"]]; + }); +#else +#endif if (completion) { completion(baseModel, 200, nil); } @@ -304,7 +381,7 @@ } } if (error) { - [self handleNetError:error method:path failure:^(NSInteger resCode, NSString *message) { + [self handleNetError:error method:path failure:^(NSInteger resCode, NSString *message) { completion(nil, resCode, message); }]; } diff --git a/YuMi/Structure/MVP/View/MvpViewController.m b/YuMi/Structure/MVP/View/MvpViewController.m index 11bda38d..99c019e0 100644 --- a/YuMi/Structure/MVP/View/MvpViewController.m +++ b/YuMi/Structure/MVP/View/MvpViewController.m @@ -18,6 +18,7 @@ #import "DJDKMIMOMColor.h" #import "YUMIMacroUitls.h" #import "YUMIHtmlUrl.h" +#import "BSRealTimeView.h" @interface MvpViewController () @@ -39,6 +40,24 @@ - (void)viewDidLoad { [super viewDidLoad]; +#ifdef DEBUG + for (id obj in kWindow.subviews) { + if([obj isKindOfClass:[BSRealTimeView class]]){ + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + BSRealTimeView *timeView = (BSRealTimeView *)obj; + [timeView removeFromSuperview]; + [kWindow addSubview:timeView]; + }); + break; + } + } +#else +#endif + + + + + } - (void)tokenInvalid { diff --git a/YuMi/Structure/PrefixHeader.pch b/YuMi/Structure/PrefixHeader.pch index f7744903..a5b7fa2c 100644 --- a/YuMi/Structure/PrefixHeader.pch +++ b/YuMi/Structure/PrefixHeader.pch @@ -53,4 +53,6 @@ isEnterprise = [bundleID isEqualToString:@"com.hflighting.yumi"];\ #import "NSObject+MJExtension.h" #import #import +#import "HttpRequestHelper.h" +#import "BSNetListenModel.h" #endif /* PrefixHeader_pch */ diff --git a/YuMi/Tools/Date/NSDate+DateUtils.h b/YuMi/Tools/Date/NSDate+DateUtils.h index 95bbfbb8..0ef8b18f 100644 --- a/YuMi/Tools/Date/NSDate+DateUtils.h +++ b/YuMi/Tools/Date/NSDate+DateUtils.h @@ -21,7 +21,7 @@ NS_ASSUME_NONNULL_BEGIN + (NSString *)stringFromDate:(NSDate *)date; +(NSString *)getNowTimeTimestamp; - ++ (NSString *)getCurrentTimeWithFormat:(NSString *)format; +(NSString *)timestampSwitchTime:(NSInteger)timestamp andFormatter:(NSString *)format; #pragma mark - 将某个时间戳转化成 时间 + (NSString *)timestampSwitchTime:(NSInteger)timestamp formatter:(NSString *)format; diff --git a/YuMi/Tools/Date/NSDate+DateUtils.m b/YuMi/Tools/Date/NSDate+DateUtils.m index d1686ced..fcddc783 100644 --- a/YuMi/Tools/Date/NSDate+DateUtils.m +++ b/YuMi/Tools/Date/NSDate+DateUtils.m @@ -164,7 +164,13 @@ NSString * const kDateFormatYYMMDDTHHmmss = @"yyyy-MM-dd'T'HH:mm:ss"; NSLog(@"两个时间相差%ld年%ld月%ld日%ld小时%ld分钟%ld秒", cmps.year, cmps.month, cmps.day, cmps.hour, cmps.minute, cmps.second); return cmps.second; } - ++ (NSString *)getCurrentTimeWithFormat:(NSString *)format{ + NSDate *now = [NSDate date]; + NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; + formatter.dateFormat = format; + NSString *dateStr = [formatter stringFromDate:now]; + return dateStr; +} @end @implementation NSCalendar (Pick) diff --git a/YuMi/Tools/Timestamp/Timestamp.m b/YuMi/Tools/Timestamp/Timestamp.m index 4fc67c9c..860fd4b3 100644 --- a/YuMi/Tools/Timestamp/Timestamp.m +++ b/YuMi/Tools/Timestamp/Timestamp.m @@ -15,7 +15,7 @@ + (void)getInternetDateWithSuccess:(void(^)(NSTimeInterval timeInterval))succes failure:(void(^)(NSError *error))failure{ //1.创建URL - NSString *urlString = API_HOST_URL; + NSString *urlString = [HttpRequestHelper getHostUrl]; urlString = [urlString stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]]; //2.创建request请求对象 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; diff --git a/YuMi/Tools/YYUtility/YYUtility+App.m b/YuMi/Tools/YYUtility/YYUtility+App.m index 602a50c3..a9b330f4 100644 --- a/YuMi/Tools/YYUtility/YYUtility+App.m +++ b/YuMi/Tools/YYUtility/YYUtility+App.m @@ -25,8 +25,12 @@ + (NSString *)appName { #ifdef DEBUG + NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"]; + if([isProduction isEqualToString:@"YES"]){ + return @"youmi"; + } NSString *text = [NSString stringWithFormat:@"%@%@%@%@",@"p",@"e",@"k",@"o"]; - return text; + return text; #else @@ -76,6 +80,10 @@ static NSString * const kMobileFrameworkResourceBundleName = @"YYMobileFramework + (NSString *)buildType{ #ifdef DEBUG + NSString *isProduction = [[NSUserDefaults standardUserDefaults]valueForKey:@"kIsProductionEnvironment"]; + if([isProduction isEqualToString:@"YES"]){ + return @"RELEASE"; + } return @"DEBUG"; #else return @"RELEASE"; diff --git a/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.h b/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.h new file mode 100644 index 00000000..b503a4ed --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.h @@ -0,0 +1,31 @@ +// +// GWSDLayoutUtil.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/31. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import "Masonry.h" + +//位置固定宽度跟高度 +#define SDLAYOUT_wh1(A,B,C,D,E,F,G) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.leading.equalTo(B).offset(C);make.top.equalTo(D).offset(E);make.width.mas_equalTo(F);make.height.mas_equalTo(G);}];//左上 + +#define SDLAYOUT_wh2(A,B,C,D,E,F,G) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.trailing.equalTo(B).offset(C);make.top.equalTo(D).offset(E);make.width.mas_equalTo(F);make.height.mas_equalTo(G);}];//右上 + +#define SDLAYOUT_wh3(A,B,C,D,E,F,G) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.leading.equalTo(B).offset(C);make.bottom.equalTo(D).offset(E);make.width.mas_equalTo(F);make.height.mas_equalTo(G);}];//左下 + +#define SDLAYOUT_wh4(A,B,C,D,E,F,G) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.trailing.equalTo(B).offset(C);make.bottom.equalTo(D).offset(E);make.width.mas_equalTo(F);make.height.mas_equalTo(G);}];//右下 + + +//固定高度 +#define SDLAYOUT_h(A,B,C,D,E,F,G,H) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.top.equalTo(B).offset(C);make.leading.equalTo(D).offset(E);make.trailing.equalTo(F).offset(G);make.height.mas_equalTo(H);}]; + + +//原始的 +#define SDLAYOUT(A,B,C,D,E,F,G,H,I) [A mas_makeConstraints:^(MASConstraintMaker *make) {make.top.equalTo(B).offset(C);make.leading.equalTo(D).offset(E);make.trailing.equalTo(F).offset(G);make.bottom.equalTo(H).offset(I);}]; + +@interface BSSDLayoutUtil : NSObject + +@end diff --git a/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.m b/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.m new file mode 100644 index 00000000..e60ba2c9 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/3Party/fmdb/BSSDLayoutUtil.m @@ -0,0 +1,17 @@ +// +// GWSDLayoutUtil.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/31. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSSDLayoutUtil.h" + +@implementation BSSDLayoutUtil + + +// + + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.h b/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.h new file mode 100644 index 00000000..e57db98c --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.h @@ -0,0 +1,39 @@ +// +// GWNSDictionary.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/11/8. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + +@interface BSNSDictionary : NSObject + +/*! + + * @brief 把格式化的JSON格式的字符串转换成字典 + + * @param jsonString JSON格式的字符串 + + * @return 返回字典 + + */ + ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString; + + +/*! + + * @brief 把字典转json字符串 + + * @param dic 字典 + + * @return 字符串 + + */ ++ (NSString*)dictionaryToJson:(NSDictionary *)dic; + + + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.m b/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.m new file mode 100644 index 00000000..60e55ef4 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSNSDictionary.m @@ -0,0 +1,47 @@ +// +// GWNSDictionary.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/11/8. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSNSDictionary.h" + +@implementation BSNSDictionary + + +#pragma mark - 把格式化的JSON格式的字符串转换成字典 ++ (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString { + + if (jsonString == nil) { + return nil; + } + + NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; + NSError *err; + NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData + options:NSJSONReadingMutableContainers + error:&err]; + if(err) { + NSLog(@"json解析失败:%@",err); + return nil; + } + return dic; +} + + +#pragma mark - 把字典转json字符串 ++ (NSString*)dictionaryToJson:(NSDictionary *)dic + +{ + + NSError *parseError = nil; + + NSData *jsonData = [NSJSONSerialization dataWithJSONObject:dic options:NSJSONWritingPrettyPrinted error:&parseError]; + + return [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; + +} + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.h b/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.h new file mode 100644 index 00000000..507efb7b --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.h @@ -0,0 +1,71 @@ +// +// NSStringUtil.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/30. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import + +@interface BSNSStringUtil : NSObject + + +/** + 格式换字典,数组,转字符串(格式化) + + @param object 数据对象 + @return 格式化的字符串 + */ ++(NSString *)getStringFromObj:(id)object; + + +/** + 去掉所有的空格和回车,\t + + @param str 原始的字符串 + @return 去掉所有的空格和回车后的字符串 + */ ++(NSString *)clearStr:(NSString *)str; + + +/** + URLEncode url编码 + + @param unencodedString 原始字符串 + @return 编码后的字符串 + */ ++(NSString*)encodeString:(NSString*)unencodedString; + + +/** + URLDEcode url解码 + + @param encodedString 原始字符串 + @return 解码后的字符串 + */ ++(NSString *)decodeString:(NSString*)encodedString; + +/** + 判断字符串是否是纯数字 + + @param BOOL 字符串 + @return 是否纯数字 + */ ++ (BOOL)isPureInt:(NSString *)string; + +#pragma mark - 富文本相关 + +/** + 根据字体,颜色,返回富文本,行距 + + @param str 字符串 + @param color 颜色 + @param font 字体 + @param lineSpac 行距 + @return 富文本 + */ ++(NSAttributedString *)getAttributedString:(NSString *)str color:(UIColor *)color font:(CGFloat)font lineSpa:(CGFloat)lineSpac; + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.m b/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.m new file mode 100644 index 00000000..4f73c15f --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSNSStringUtil.m @@ -0,0 +1,168 @@ +// +// NSStringUtil.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/30. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSNSStringUtil.h" + +@implementation BSNSStringUtil + +#pragma mark - 格式换字典,数组,转字符串(格式化) ++(NSString *)getStringFromObj:(id)object{ + return [self getStringFromObj:object withTimes:0]; +} + + + ++(NSString *)getStringFromObj:(id)object withTimes:(int)times{ + + if (!object) { + return @""; + } + + times++; + NSMutableString *intervalStr = [NSMutableString string]; + for (int i = 1; i < times; i++) { + [intervalStr appendString:@"\t"]; + } + + if ([object isKindOfClass:[NSDictionary class]]) { + NSMutableString *string = [NSMutableString string]; + [string appendString:@"{\n"]; + + // 遍历所有的键值对 + [object enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + + [string appendFormat:@"\t%@%@",intervalStr,key]; + [string appendString:@" : "]; + [string appendFormat:@"%@,\n", [self getStringFromObj:obj withTimes:times]]; + }]; + + // 结尾有个} + [string appendFormat:@"%@}",intervalStr]; + + // 查找最后一个逗号 + NSRange range = [string rangeOfString:@"," options:NSBackwardsSearch]; + if (range.location != NSNotFound){ + [string deleteCharactersInRange:range]; + } + return string; + + }else if([object isKindOfClass:[NSArray class]]){ + + NSMutableString *string = [NSMutableString string]; + + // 开头有个[ + [string appendString:@"[\n"]; + + // 遍历所有的元素 + [object enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + // [string appendFormat:@"\t%@,\n", [self getStringFromObj:obj withTimes:times]]; + [string appendFormat:@"\t%@%@,\n",intervalStr, [self getStringFromObj:obj withTimes:times]]; + }]; + + // 结尾有个] + // [string appendString:@"]"]; + [string appendFormat:@"%@]",intervalStr]; + + // 查找最后一个逗号 + NSRange range = [string rangeOfString:@"," options:NSBackwardsSearch]; + if (range.location != NSNotFound){ + [string deleteCharactersInRange:range]; + } + return string; + + + }else if([object isKindOfClass:[NSString class]]){ + return (NSString *)object; + } + return [object description]; +} + + +#pragma mark - 去掉所有的空格和回车,\t ++(NSString *)clearStr:(NSString *)str{ + str = [str stringByReplacingOccurrencesOfString: @" " withString: @""]; + str = [str stringByReplacingOccurrencesOfString: @"\n" withString: @""]; + str = [str stringByReplacingOccurrencesOfString: @"\t" withString: @""]; + return str; +} + +#pragma mark - URLEncode ++(NSString*)encodeString:(NSString*)unencodedString{ + + #pragma clang diagnostic push + #pragma clang diagnostic ignored"-Wdeprecated-declarations" + NSString *encodedString = (NSString *) + CFBridgingRelease(CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, + (CFStringRef)unencodedString, + NULL, + (CFStringRef)@"!*'();:@&=+$,/?%#[]", + kCFStringEncodingUTF8)); + + #pragma clang diagnostic pop + return encodedString; +} + +#pragma mark - URLDEcode ++(NSString *)decodeString:(NSString*)encodedString + +{ + #pragma clang diagnostic push + #pragma clang diagnostic ignored"-Wdeprecated-declarations" + NSString *decodedString = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, + (__bridge CFStringRef)encodedString, + CFSTR(""), + CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)); + #pragma clang diagnostic pop + return decodedString; +} + +#pragma mark -- 判断字符串是否是纯数字 ++ (BOOL)isPureInt:(NSString *)string{ + + NSScanner* scan = [NSScanner scannerWithString:string]; + + int val; + + return [scan scanInt:&val] && [scan isAtEnd]; + +} + +#pragma mark - 富文本相关 +#pragma mark - 根据字体,颜色,返回富文本,行距 ++(NSAttributedString *)getAttributedString:(NSString *)str color:(UIColor *)color font:(CGFloat)font lineSpa:(CGFloat)lineSpac{ + + if (lineSpac == 0) { + lineSpac = 5; + } + if (str == nil){ + str = @""; + } + if (font <= 0) { + font = 15; + } + if (color == nil) { + color = [UIColor blackColor]; + } + + NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; + paragraphStyle.lineSpacing = lineSpac;// 字体的行间距 + NSDictionary *attributes = @{ + NSFontAttributeName:[UIFont systemFontOfSize:font], + NSParagraphStyleAttributeName:paragraphStyle, + NSForegroundColorAttributeName:color + }; + + return [[NSAttributedString alloc] initWithString:str attributes:attributes]; +} + + +//返回拼接的富文本 + + + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.h b/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.h new file mode 100644 index 00000000..8283311b --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.h @@ -0,0 +1,17 @@ +// +// GWUIDemoUtil.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/10/28. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import + +@interface BSUIDemoUtil : NSObject + +//测试的button ++(UIButton *)addBtn:(NSString *)btnName withView:(UIView *)subViewn frame:(CGRect)frame andtarget:(id)target action:(SEL)action; + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.m b/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.m new file mode 100644 index 00000000..199af9cf --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSUIDemoUtil.m @@ -0,0 +1,33 @@ +// +// GWUIDemoUtil.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/10/28. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSUIDemoUtil.h" + +@implementation BSUIDemoUtil + + +//测试的button ++(UIButton *)addBtn:(NSString *)btnName withView:(UIView *)subViewn frame:(CGRect)frame andtarget:(id)target action:(SEL)action{ + + UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; + [btn setTitle:btnName forState:UIControlStateNormal]; + [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; + btn.backgroundColor = [UIColor grayColor]; + btn.frame = frame; + [btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; + + return btn; +} + +//测试的textFILE + + +//测试的lable + + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.h b/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.h new file mode 100644 index 00000000..efd30fc7 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.h @@ -0,0 +1,106 @@ +// +// XWDateUtil.h +// FrameObject +// +// Created by shenba on 16/4/12. +// Copyright © 2016年 xiaowen. All rights reserved. +// + +#import + +@interface BSXWDateUtil : NSObject + + +/** + 获取多少天,多少小时,多少分钟,多少秒之后的时间 + + @param day 天 + @param hours 小时 + @param min 分数 + @param ss 秒数 + @param date 当前时间 + @param forMet 格式化 + @return 结果字符串 + */ ++(NSString *)getTimeAfterDay:(int)day hours:(int)hours min:(int)min ss:(int)ss fromDate:(NSDate *)date withForMet:(NSString *)forMet; + + + +/** + 时间转字符串 + + @param date 时间 + @param forMet 格式 + @return 结果字符串 + */ ++(NSString *)strWithDate:(NSDate *)date withForMet:(NSString *)forMet; + + + +/** + 字符串转时间 + + @param dateStr 时间格式的字符串 + @param dateFormatterStr 格式 + @return 时间 + */ ++(NSDate *)DateInitWithString:(NSString *)dateStr dateFormatterStr:(NSString *)dateFormatterStr; + + + +/** + 判断是否超过某个时间段 timeInterval:单位秒,记录到硬盘 + + @param timeInterval 时间(秒) + @param tag 标记 + @return 结果是否超过某个时间 + */ ++(Boolean)isTimeOver:(int)timeInterval withTag:(NSString *)tag; + +/** + 清除记录标记的时间 + + @param tag 标记 + */ ++(void)removeTimeOverTag:(NSString *)tag; + + + +/** + 判断是否超过某个时间段 timeInterval:单位秒 分组处理 + + @param timeInterval 时间(秒) + @param tag 标记 + @param group 分组 + @return 结果是否超过某个时间 + */ ++(Boolean)isTimeOver:(int)timeInterval withTag:(NSString *)tag withGroup:(NSString *)group; + +/** + 按照分组清除记录标记的时间 + + @param group 分组 + */ ++(void)removeTimeOverGroup:(NSString *)group; + + +/** + 计算事件差,需要同格式的字符串 + + @param time1 时间1 + @param time2 时间2 + @param formet 时间格式 + @return 时间差 + */ ++(NSTimeInterval)TimeDifferenceWithTime1:(NSString *)time1 AndTime2:(NSString *)time2 formet:(NSString *)formet; + + +/** + 根据日期返回是否今天,明天,昨天 + + @param date 日期 + @return 今天,昨天,明天,... + */ ++(NSString *)compareDate:(NSDate *)date; + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.m b/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.m new file mode 100644 index 00000000..8d8fd387 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BSXWDateUtil.m @@ -0,0 +1,222 @@ +// +// XWDateUtil.m +// FrameObject +// +// Created by shenba on 16/4/12. +// Copyright © 2016年 xiaowen. All rights reserved. +// + +#import "BSXWDateUtil.h" + +@implementation BSXWDateUtil + +static NSDateFormatter *simgle_df; + +#pragma mark - 获取多少天,多少小时,多少分钟,多少秒之后的时间 ++(NSString *)getTimeAfterDay:(int)day hours:(int)hours min:(int)min ss:(int)ss fromDate:(NSDate *)date withForMet:(NSString *)forMet{ + + if (date==nil) { + date = [NSDate date]; + } + + NSDate *resultDate = [[NSDate alloc]initWithTimeInterval:(24 * 60 * 60)*day+(60*60)*hours+min*60+ss sinceDate:date]; + + return [self strWithDate:resultDate withForMet:forMet]; + +} + + +#pragma mark - 时间转字符串 ++(NSString *)strWithDate:(NSDate *)date withForMet:(NSString *)forMet{ + + if (date == nil) { + date = [NSDate date]; + } + if (forMet==nil) { + if (!simgle_df) { + simgle_df = [[NSDateFormatter alloc]init];//格式化 + [simgle_df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//simgle_df保持这个格式,避免多线程调用的时候变化dateFormat造成其他的影响 + } + return [simgle_df stringFromDate:date]; + } + + NSDateFormatter*df = [[NSDateFormatter alloc]init];//格式化 + [df setDateFormat:forMet]; + return [df stringFromDate:date]; + +} + +#pragma mark - 字符串转时间 ++(NSDate *)DateInitWithString:(NSString *)dateStr dateFormatterStr:(NSString *)dateFormatterStr +{ + if (!dateStr) { + return [NSDate date]; + } + + if (dateFormatterStr == nil) { + if (!simgle_df) { + simgle_df = [[NSDateFormatter alloc]init];//格式化 + [simgle_df setDateFormat:@"yyyy-MM-dd HH:mm:ss"];//simgle_df保持这个格式,避免多线程调用的时候变化dateFormat造成其他的影响 + } + return [simgle_df dateFromString:dateStr]; + } + + + NSDate *reslutDate = nil; + NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; + [formatter setDateFormat:dateFormatterStr]; + reslutDate = [formatter dateFromString:dateStr];//得到时间 + return reslutDate; +} + + +#pragma mark - 判断是否超过某个时间段 timeInterval:单位秒 ++(Boolean)isTimeOver:(int)timeInterval withTag:(NSString *)tag{ + + + NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; + NSString *tempStrTag = [NSString stringWithFormat:@"bs_timesover_%@",tag]; + NSString *str = [defaults valueForKey:tempStrTag]; + NSDate *nowDate = [NSDate date]; +// NSLog(@"比较之前存放的时间:%@",tempStrTag); + if (timeInterval == 0) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:tempStrTag]; + return YES;//时间设置为0,表示刷新标志时间,返回成功 + } + if (!str) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:tempStrTag]; + return YES;//第一次调用 + } + + + NSTimeInterval time = [nowDate timeIntervalSinceDate:[self DateInitWithString:str dateFormatterStr:nil]]; +// NSLog(@"比较相差的时间:%f",time); + if (time > timeInterval) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:tempStrTag]; + return YES; + } + return NO; +} + + +#pragma mark - 判断是否超过某个时间段 timeInterval:单位秒 分组处理 ++(Boolean)isTimeOver:(int)timeInterval withTag:(NSString *)tag withGroup:(NSString *)group{ + + if (group == nil || tag == nil) { + return YES; + } + + NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; + + + //记录分组 + NSArray *temp = [defaults valueForKey:@"bs_timesGroup"]; + NSMutableArray *resultArr = [NSMutableArray arrayWithArray:temp]; + NSString *keyStr = [NSString stringWithFormat:@"bs_timeGroup_%@_%@",group,tag]; + if (![resultArr containsObject:keyStr]) { + [resultArr addObject:keyStr]; + [defaults setValue:resultArr forKey:@"bs_timesGroup"]; + } + + + + NSString *str = [defaults valueForKey:keyStr]; + NSDate *nowDate = [NSDate date]; + // NSLog(@"比较之前存放的时间:%@",tempStrTag); + if (timeInterval == 0) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:keyStr]; + return YES;//时间设置为0,表示刷新标志时间,返回成功 + } + if (!str) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:keyStr]; + return YES;//第一次调用 + } + + + NSTimeInterval time = [nowDate timeIntervalSinceDate:[self DateInitWithString:str dateFormatterStr:nil]]; + // NSLog(@"比较相差的时间:%f",time); + if (time > timeInterval) { + [defaults setValue:[self strWithDate:nowDate withForMet:nil] forKey:keyStr]; + return YES; + } + return NO; +} + +#pragma mark - 清除记录标记的时间 ++(void)removeTimeOverTag:(NSString *)tag{ + + if (tag == nil) { + return; + } + + NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; + NSString *tempStrTag = [NSString stringWithFormat:@"bs_timesover_%@",tag]; + [defaults removeObjectForKey:tempStrTag]; +} +#pragma mark - 按照分组清除记录标记的时间 ++(void)removeTimeOverGroup:(NSString *)group{ + + if (group == nil) { + return; + } + + NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults]; + + NSMutableArray *resultArr = [NSMutableArray array]; + NSArray *temp = [defaults valueForKey:@"bs_timesGroup"]; + Boolean isChange = NO; + for (NSString *str in temp) { + if ([str hasPrefix:[NSString stringWithFormat:@"bs_timeGroup_%@_",group]]) { + [defaults removeObjectForKey:str]; + isChange = YES; + }else{ + [resultArr addObject:str]; + } + } + if (isChange) { + [defaults setValue:resultArr forKey:@"bs_timesGroup"]; + } +} + + + +#pragma mark - 计算事件差,需要同格式的字符串 ++(NSTimeInterval)TimeDifferenceWithTime1:(NSString *)time1 AndTime2:(NSString *)time2 formet:(NSString *)formet{ + + return [[self DateInitWithString:time1 dateFormatterStr:formet] timeIntervalSinceDate:[self DateInitWithString:time2 dateFormatterStr:formet]]; +} + + +#pragma mark - ios判断是昨天,今天,还是明天 ++(NSString *)compareDate:(NSDate *)date{ + + NSTimeInterval secondsPerDay = 24 * 60 * 60; + NSDate *today = [[NSDate alloc] init]; + NSDate *tomorrow, *yesterday; + + tomorrow = [today dateByAddingTimeInterval: secondsPerDay]; + yesterday = [today dateByAddingTimeInterval: -secondsPerDay]; + // 10 first characters of description is the calendar date: + NSString * todayString = [[today description] substringToIndex:10]; + NSString * yesterdayString = [[yesterday description] substringToIndex:10]; + NSString * tomorrowString = [[tomorrow description] substringToIndex:10]; + + NSString * dateString = [[date description] substringToIndex:10]; + + if ([dateString isEqualToString:todayString]) + { + return @"今天"; + } else if ([dateString isEqualToString:yesterdayString]) + { + return @"昨天"; + }else if ([dateString isEqualToString:tomorrowString]) + { + return @"明天"; + } + else + { + return dateString; + } +} + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.h b/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.h new file mode 100644 index 00000000..5f2d3ced --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.h @@ -0,0 +1,16 @@ +// +// BS_UIColor.h +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import +#import + +@interface BS_UIColor : NSObject + ++ (UIColor *) stringTOColor:(NSString *)str; + +@end diff --git a/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.m b/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.m new file mode 100644 index 00000000..a24c7499 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/Util/BS_UIColor.m @@ -0,0 +1,31 @@ +// +// BS_UIColor.m +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import "BS_UIColor.h" + +@implementation BS_UIColor + ++ (UIColor *) stringTOColor:(NSString *)str +{ + if (!str || [str isEqualToString:@""]) { + return nil; + } + unsigned red,green,blue; + NSRange range; + range.length = 2; + range.location = 1; + [[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&red]; + range.location = 3; + [[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&green]; + range.location = 5; + [[NSScanner scannerWithString:[str substringWithRange:range]] scanHexInt:&blue]; + UIColor *color= [UIColor colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:1]; + return color; +} + +@end diff --git a/YuMi/Tools/sdkContent/catagory/system/BS_Define.h b/YuMi/Tools/sdkContent/catagory/system/BS_Define.h new file mode 100644 index 00000000..f3e2b780 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/system/BS_Define.h @@ -0,0 +1,32 @@ +// +// BS_Define.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/16. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#define GET_X(view) view.frame.origin.x +#define GET_Y(view) view.frame.origin.y +#define GET_W(view) view.frame.size.width +#define GET_H(view) view.frame.size.height + +#define GET_X_Max(view) view.frame.origin.x + view.frame.size.width +#define GET_Y_Max(view) view.frame.origin.y + view.frame.size.height + +#define Set_frame(tempView,a,b) CGRect bs_tempRect = tempView.frame;bs_tempRect.origin.x = a;bs_tempRect.origin.y = b;tempView.frame = bs_tempRect; + +#define Set_frame2(tempView,a,b,c,d) CGRect bs_tempRect = tempView.frame;bs_tempRect.origin.x = a;bs_tempRect.origin.y = b;bs_tempRect.size.width = c;bs_tempRect.size.height = d;tempView.frame = bs_tempRect; + + + +#define USER_LANGUAGE @"user_language" + + + + +//判断ios系统版本 +#define IOS7 ([[UIDevice currentDevice] systemVersion] floatValue] >= 7.0 ? YES:NO) +#define IOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES:NO) +#define IOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES:NO) +#define IOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0 ? YES:NO) diff --git a/YuMi/Tools/sdkContent/catagory/system/SystemUtil.h b/YuMi/Tools/sdkContent/catagory/system/SystemUtil.h new file mode 100644 index 00000000..fd255e30 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/system/SystemUtil.h @@ -0,0 +1,18 @@ +// +// SystemUtil.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/11/10. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + +@interface SystemUtil : NSObject + +/* + * 获取项目名 + */ ++(NSString *)getProjectName; + +@end diff --git a/YuMi/Tools/sdkContent/catagory/system/SystemUtil.m b/YuMi/Tools/sdkContent/catagory/system/SystemUtil.m new file mode 100644 index 00000000..6672fee8 --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/system/SystemUtil.m @@ -0,0 +1,35 @@ +// +// SystemUtil.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/11/10. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "SystemUtil.h" + +@implementation SystemUtil + + ++(NSString *)getProjectName{ + + NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary]; + + return [infoDictionary objectForKey:(NSString *)kCFBundleExecutableKey]; //获取项目名称 + +} + +@end + + + +// +// +// +// +// +// +// +// + +// diff --git a/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.h b/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.h new file mode 100755 index 00000000..0dfd5a8a --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.h @@ -0,0 +1,62 @@ +// +// UILabel+YBAttributeTextTapAction.h +// +// Created by LYB on 16/7/1. +// Copyright © 2016年 LYB. All rights reserved. +// + +#import + +@protocol YBAttributeTapActionDelegate +@optional +/** + * YBAttributeTapActionDelegate + * + * @param string 点击的字符串 + * @param range 点击的字符串range + * @param index 点击的字符在数组中的index + */ +- (void)yb_attributeTapReturnString:(NSString *)string + range:(NSRange)range + index:(NSInteger)index; +@end + +@interface YBAttributeModel : NSObject + +@property (nonatomic, copy) NSString *str; + +@property (nonatomic, assign) NSRange range; + +@end + + + + + +@interface UILabel (YBAttributeTextTapAction) + +/** + * 是否打开点击效果,默认是打开 + */ +@property (nonatomic, assign) BOOL enabledTapEffect; + +/** + * 给文本添加点击事件Block回调 + * + * @param strings 需要添加的字符串数组 + * @param tapClick 点击事件回调 + */ +- (void)yb_addAttributeTapActionWithStrings:(NSArray *)strings + tapClicked:(void (^) (NSString *string , NSRange range , NSInteger index))tapClick; + +/** + * 给文本添加点击事件delegate回调 + * + * @param strings 需要添加的字符串数组 + * @param delegate delegate + */ +- (void)yb_addAttributeTapActionWithStrings:(NSArray *)strings + delegate:(id )delegate; + +@end + diff --git a/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.m b/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.m new file mode 100755 index 00000000..162ab67a --- /dev/null +++ b/YuMi/Tools/sdkContent/catagory/system/UILabel+YBAttributeTextTapAction.m @@ -0,0 +1,396 @@ +// +// UILabel+YBAttributeTextTapAction.m +// +// Created by LYB on 16/7/1. +// Copyright © 2016年 LYB. All rights reserved. +// + +#import "UILabel+YBAttributeTextTapAction.h" +#import +#import +#import + +@implementation YBAttributeModel + +@end + +@implementation UILabel (YBAttributeTextTapAction) + +#pragma mark - AssociatedObjects + +- (NSMutableArray *)attributeStrings +{ + return objc_getAssociatedObject(self, _cmd); +} + +- (void)setAttributeStrings:(NSMutableArray *)attributeStrings +{ + objc_setAssociatedObject(self, @selector(attributeStrings), attributeStrings, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (NSMutableDictionary *)effectDic +{ + return objc_getAssociatedObject(self, _cmd); +} + +- (void)setEffectDic:(NSMutableDictionary *)effectDic +{ + objc_setAssociatedObject(self, @selector(effectDic), effectDic, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)isTapAction +{ + return [objc_getAssociatedObject(self, _cmd) boolValue]; +} + +- (void)setIsTapAction:(BOOL)isTapAction +{ + objc_setAssociatedObject(self, @selector(isTapAction), @(isTapAction), OBJC_ASSOCIATION_ASSIGN); +} + +- (void (^)(NSString *, NSRange, NSInteger))tapBlock +{ + return objc_getAssociatedObject(self, _cmd); +} + +- (void)setTapBlock:(void (^)(NSString *, NSRange, NSInteger))tapBlock +{ + objc_setAssociatedObject(self, @selector(tapBlock), tapBlock, OBJC_ASSOCIATION_COPY_NONATOMIC); +} + +- (id)delegate +{ + return objc_getAssociatedObject(self, _cmd); +} + +- (BOOL)enabledTapEffect +{ + return [objc_getAssociatedObject(self, _cmd) boolValue]; +} + +- (void)setEnabledTapEffect:(BOOL)enabledTapEffect +{ + objc_setAssociatedObject(self, @selector(enabledTapEffect), @(enabledTapEffect), OBJC_ASSOCIATION_ASSIGN); + self.isTapEffect = enabledTapEffect; +} + +- (BOOL)isTapEffect +{ + return [objc_getAssociatedObject(self, _cmd) boolValue]; +} + +- (void)setIsTapEffect:(BOOL)isTapEffect +{ + objc_setAssociatedObject(self, @selector(isTapEffect), @(isTapEffect), OBJC_ASSOCIATION_ASSIGN); +} + +- (void)setDelegate:(id)delegate +{ + objc_setAssociatedObject(self, @selector(delegate), delegate, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - mainFunction +- (void)yb_addAttributeTapActionWithStrings:(NSArray *)strings tapClicked:(void (^) (NSString *string , NSRange range , NSInteger index))tapClick +{ + [self yb_getRangesWithStrings:strings]; + + if (self.tapBlock != tapClick) { + self.tapBlock = tapClick; + } +} + +- (void)yb_addAttributeTapActionWithStrings:(NSArray *)strings + delegate:(id )delegate +{ + [self yb_getRangesWithStrings:strings]; + + if (self.delegate != delegate) { + self.delegate = delegate; + } +} + +#pragma mark - touchAction +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + if (!self.isTapAction) { + return; + } + + if (objc_getAssociatedObject(self, @selector(enabledTapEffect))) { + self.isTapEffect = self.enabledTapEffect; + } + + UITouch *touch = [touches anyObject]; + + CGPoint point = [touch locationInView:self]; + + __weak typeof(self) weakSelf = self; + + [self yb_getTapFrameWithTouchPoint:point result:^(NSString *string, NSRange range, NSInteger index) { + + if (weakSelf.tapBlock) { + weakSelf.tapBlock (string , range , index); + } + + if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(yb_attributeTapReturnString:range:index:)]) { + [weakSelf.delegate yb_attributeTapReturnString:string range:range index:index]; + } + + if (self.isTapEffect) { + + [self yb_saveEffectDicWithRange:range]; + + [self yb_tapEffectWithStatus:NO]; + } + + }]; +} + +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { + + if (self.isTapAction) { + if ([self yb_getTapFrameWithTouchPoint:point result:nil]) { + return self; + } + } + return [super hitTest:point withEvent:event]; +} + +#pragma mark - getTapFrame +- (BOOL)yb_getTapFrameWithTouchPoint:(CGPoint)point result:(void (^) (NSString *string , NSRange range , NSInteger index))resultBlock +{ + CTFramesetterRef framesetter = CTFramesetterCreateWithAttributedString((CFAttributedStringRef)self.attributedText); + + CGMutablePathRef Path = CGPathCreateMutable(); + + CGPathAddRect(Path, NULL, CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)); + + CTFrameRef frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), Path, NULL); + + CFRange range = CTFrameGetVisibleStringRange(frame); + + if (self.attributedText.length > range.length) { + + UIFont *font ; + + if ([self.attributedText attribute:NSFontAttributeName atIndex:0 effectiveRange:nil]) { + + font = [self.attributedText attribute:NSFontAttributeName atIndex:0 effectiveRange:nil]; + + }else if (self.font){ + font = self.font; + + }else { + font = [UIFont systemFontOfSize:17]; + } + + CGPathRelease(Path); + + Path = CGPathCreateMutable(); + + CGPathAddRect(Path, NULL, CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height + font.lineHeight)); + + frame = CTFramesetterCreateFrame(framesetter, CFRangeMake(0, 0), Path, NULL); + } + + CFArrayRef lines = CTFrameGetLines(frame); + + if (!lines) { + CFRelease(frame); + CFRelease(framesetter); + CGPathRelease(Path); + return NO; + } + + CFIndex count = CFArrayGetCount(lines); + + CGPoint origins[count]; + + CTFrameGetLineOrigins(frame, CFRangeMake(0, 0), origins); + + CGAffineTransform transform = [self yb_transformForCoreText]; + + CGFloat verticalOffset = 0; + + for (CFIndex i = 0; i < count; i++) { + CGPoint linePoint = origins[i]; + + CTLineRef line = CFArrayGetValueAtIndex(lines, i); + + CGRect flippedRect = [self yb_getLineBounds:line point:linePoint]; + + CGRect rect = CGRectApplyAffineTransform(flippedRect, transform); + + rect = CGRectInset(rect, 0, 0); + + rect = CGRectOffset(rect, 0, verticalOffset); + + NSParagraphStyle *style = [self.attributedText attribute:NSParagraphStyleAttributeName atIndex:0 effectiveRange:nil]; + + CGFloat lineSpace; + + if (style) { + lineSpace = style.lineSpacing; + }else { + lineSpace = 0; + } + + CGFloat lineOutSpace = (self.bounds.size.height - lineSpace * (count - 1) -rect.size.height * count) / 2; + + rect.origin.y = lineOutSpace + rect.size.height * i + lineSpace * i; + + if (CGRectContainsPoint(rect, point)) { + + CGPoint relativePoint = CGPointMake(point.x - CGRectGetMinX(rect), point.y - CGRectGetMinY(rect)); + + CFIndex index = CTLineGetStringIndexForPosition(line, relativePoint); + + CGFloat offset; + + CTLineGetOffsetForStringIndex(line, index, &offset); + + if (offset > relativePoint.x) { + index = index - 1; + } + + NSInteger link_count = self.attributeStrings.count; + + for (int j = 0; j < link_count; j++) { + + YBAttributeModel *model = self.attributeStrings[j]; + + NSRange link_range = model.range; + if (NSLocationInRange(index, link_range)) { + if (resultBlock) { + resultBlock (model.str , model.range , (NSInteger)j); + } + CFRelease(frame); + CFRelease(framesetter); + CGPathRelease(Path); + return YES; + } + } + } + } + CFRelease(frame); + CFRelease(framesetter); + CGPathRelease(Path); + return NO; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + if (self.isTapEffect) { + + [self performSelectorOnMainThread:@selector(yb_tapEffectWithStatus:) withObject:nil waitUntilDone:NO]; + + } +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + if (self.isTapEffect) { + + [self performSelectorOnMainThread:@selector(yb_tapEffectWithStatus:) withObject:nil waitUntilDone:NO]; + + } +} + +- (CGAffineTransform)yb_transformForCoreText +{ + return CGAffineTransformScale(CGAffineTransformMakeTranslation(0, self.bounds.size.height), 1.f, -1.f); +} + +- (CGRect)yb_getLineBounds:(CTLineRef)line point:(CGPoint)point +{ + CGFloat ascent = 0.0f; + CGFloat descent = 0.0f; + CGFloat leading = 0.0f; + CGFloat width = (CGFloat)CTLineGetTypographicBounds(line, &ascent, &descent, &leading); + CGFloat height = ascent + fabs(descent) + leading; + + return CGRectMake(point.x, point.y , width, height); +} + +#pragma mark - tapEffect +- (void)yb_tapEffectWithStatus:(BOOL)status +{ + if (self.isTapEffect) { + NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc] initWithAttributedString:self.attributedText]; + + NSMutableAttributedString *subAtt = [[NSMutableAttributedString alloc] initWithAttributedString:[[self.effectDic allValues] firstObject]]; + + NSRange range = NSRangeFromString([[self.effectDic allKeys] firstObject]); + + if (status) { + [subAtt addAttribute:NSBackgroundColorAttributeName value:[UIColor lightGrayColor] range:NSMakeRange(0, subAtt.string.length)]; + + [attStr replaceCharactersInRange:range withAttributedString:subAtt]; + }else { + + [attStr replaceCharactersInRange:range withAttributedString:subAtt]; + } + self.attributedText = attStr; + } +} + +- (void)yb_saveEffectDicWithRange:(NSRange)range +{ + self.effectDic = [NSMutableDictionary dictionary]; + + NSAttributedString *subAttribute = [self.attributedText attributedSubstringFromRange:range]; + + [self.effectDic setObject:subAttribute forKey:NSStringFromRange(range)]; +} + +#pragma mark - getRange +- (void)yb_getRangesWithStrings:(NSArray *)strings +{ + if (self.attributedText == nil) { + self.isTapAction = NO; + return; + } + + self.isTapAction = YES; + + self.isTapEffect = YES; + + __block NSString *totalStr = self.attributedText.string; + + self.attributeStrings = [NSMutableArray array]; + + __weak typeof(self) weakSelf = self; + + [strings enumerateObjectsUsingBlock:^(NSString * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { + + NSRange range = [totalStr rangeOfString:obj]; + + if (range.length != 0) { + + totalStr = [totalStr stringByReplacingCharactersInRange:range withString:[weakSelf yb_getStringWithRange:range]]; + + YBAttributeModel *model = [YBAttributeModel new]; + + model.range = range; + + model.str = obj; + + [weakSelf.attributeStrings addObject:model]; + + } + + }]; +} + +- (NSString *)yb_getStringWithRange:(NSRange)range +{ + NSMutableString *string = [NSMutableString string]; + + for (int i = 0; i < range.length ; i++) { + + [string appendString:@" "]; + } + return string; +} + +@end diff --git a/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.h b/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.h new file mode 100644 index 00000000..c04d42ae --- /dev/null +++ b/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.h @@ -0,0 +1,32 @@ +// +// GWFileOptionModel.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/29. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + +@interface BSFileOptionModel : NSObject + + + +//写入数据 ++(void)writeToFile_RecordModel:(NSArray *)logArray stringForMatBlock:( NSString*(^)( NSString *forMatString) )forMatblock withCompletion:( NSString*(^)( NSString *logString) )block class:(Class)class1; + +/* + * 压缩当天产生的日志文件zip文件: + * 1:如果当天没有日志文件,返回空; + * 2:如果没有实现压缩zip的方法,返回日志的位置路径; + * 3:如果实现了压缩文件的方法,返回日志压缩后的位置路径. + * + */ ++(NSString *)compression:(void(^)( NSString *logPath))block; + + + +//删除所有日志数据 ++(void)deleteFilePathLog; + +@end diff --git a/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.m b/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.m new file mode 100644 index 00000000..800b94a4 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/FileOption(文件操作)/BSFileOptionModel.m @@ -0,0 +1,206 @@ +// +// FileOptionModel.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/29. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSFileOptionModel.h" +#import "BSRecordModel.h" +#import // 导入运行时文件 + +#define BS_DocumentPath [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] + +#define BS_LogFilePath [NSString stringWithFormat:@"%@/%@", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0],@"GWLogFile"] + +#define BS_LogZipFilePath [NSString stringWithFormat:@"%@/%@", [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0],@"GWLogFileZip"] + +@implementation BSFileOptionModel + + + + + ++(void)writeToFile_RecordModel:(NSArray *)logArray stringForMatBlock:( NSString*(^)( NSString *forMatString) )forMatblock withCompletion:( NSString*(^)( NSString *logString) )block class:(Class)class1{ + //日志文件夹 + NSString *logFile = BS_LogFilePath; + if (![[NSFileManager defaultManager] fileExistsAtPath:logFile]) { + [[NSFileManager defaultManager] createDirectoryAtPath:logFile withIntermediateDirectories:YES attributes:nil error:nil]; + } else { + + NSLog(@"FileDir is exists."); + } + + + //日志txt文件 + NSString *logTxtPath = [NSString stringWithFormat:@"%@/%@.txt", logFile,[self currentTime]]; + if (![[NSFileManager defaultManager] fileExistsAtPath:logTxtPath]) { + [[NSFileManager defaultManager] createFileAtPath:logTxtPath contents:nil attributes:nil]; + } +// NSLog(@"logTxtPath = %@",logTxtPath); + //写入日志头 + NSError *error; + NSString *logHead = [NSString stringWithFormat:@"日志协议类型:1,写入时间:%@\n",[self currentTime2]]; + BOOL flag = [logHead writeToFile:logTxtPath atomically:YES encoding:NSUTF8StringEncoding error:&error];//一般error都设置为nil,保证写入成功 + if (flag) { + NSLog(@"写入文件头成功"); + } + else{ + NSLog(@"写入文件头失败"); + } + + + + @autoreleasepool { + NSString *str = @"类型编码:[coding] 类型:ddd 描述:[describe] 关键字:[keyword] 结果:[result] 操作编码:[optionCoding]\n"; + if (forMatblock) { + str = forMatblock(str); + } + id log; + NSFileHandle *fileHandle = [NSFileHandle fileHandleForUpdatingAtPath:logTxtPath]; + for (int i = 0 ; i2016.11.8 +初始导入 by 陈啸文 + + +================================================ diff --git a/YuMi/Tools/sdkContent/content/K/BSDrawLine.h b/YuMi/Tools/sdkContent/content/K/BSDrawLine.h new file mode 100644 index 00000000..468e2084 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/K/BSDrawLine.h @@ -0,0 +1,90 @@ +// +// GWDrawLine.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/9/26. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import + +@interface BSDrawLine : NSObject + + +/* + * 设置坐标系数据 + */ +-(void)initSettingXuint:(CGFloat)xunit xBegin:(CGFloat)xBegin yUint:(CGFloat)yUint yBegain:(CGFloat)yBegain; +/* + * 设置坐标原点 + */ +-(void)initPoint:(CGPoint)point; + +/** + 设置阴线阳线的颜色,是否实心 + + @param color 阳线颜色 + @param color2 阴线颜色 + @param isYangLineSolid 阳线是否实心 + @param isYinLineSolid 阴线是否实心 + . + */ +-(void)initYangLineColor:(UIColor *)color YinLineColor:(UIColor *)color2 isYangLineSolid:(Boolean)isYangLineSolid isYinLineSolid:(Boolean)isYinLineSolid; + + + +/** + 画k图 + + @param arr arr数组长度要>=5 [最大值,最小值,开盘值,收盘值,x坐标,...] + @param ctx CGContextRef画笔对象 + @param scan 放大比例 + */ +-(void)drawKline:(NSArray *)arr withContext:(CGContextRef)contex scan:(CGFloat)scan; + +#pragma mark - 类方法 + +/** + 画直线 + [self.myDraw drawLinePoint:@[@[lineWidthStr,@"185",@"185",@"15",@"1"],@[temp5,temp6]] withContext:UIGraphicsGetCurrentContext()]; + + @param arr2 [[粗细,颜色r,颜色g,颜色b,透明度],[第一条线[第一个点],[第二个点]...],[第二条线]......] + @param ctx CGContextRef画笔对象 + @param scan 放大比例 + */ ++(void)drawLinePoint:(NSArray *)arr2 withContext:(CGContextRef)context scan:(CGFloat)scan; + +/** + 画曲线 + @param lineArr [[线宽,点size,颜色],[第一条线[第一个点],[第二个点]...],[第二条线]...] + @param ctx CGContextRef画笔对象 + @param scan 放大比例 + */ ++(void)drawCurves:(NSArray *)lineArr withContext:(CGContextRef)ctx scan:(CGFloat)scan; + +/** + 画多个多边形 + + @param lineArr [[线宽,线颜色,填充颜色],[第一个多边形[第一个点],[第二个点]...],[第二个多边形]...] + @param ctx CGContextRef画笔对象 + @param scan 放大比例 + */ ++(void)drawMoreRects:(NSArray *)lineArr withContext:(CGContextRef)ctx scan:(CGFloat)scan; + +#pragma mark - 字体类相关 + +/** + 富文本字体 + + @param str 字符串 + @param size 字体范围 + @param point 中心点位置 + @param font 字体大小 + @param color 字体颜色 + */ ++(void)drawWord:(NSString *)str size:(CGSize)size centerPoint:(CGPoint)point font:(CGFloat)font color:(UIColor *)color; + + + +@end diff --git a/YuMi/Tools/sdkContent/content/K/BSDrawLine.m b/YuMi/Tools/sdkContent/content/K/BSDrawLine.m new file mode 100644 index 00000000..0619b578 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/K/BSDrawLine.m @@ -0,0 +1,530 @@ +// +// GWDrawLine.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/9/26. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSDrawLine.h" + +@interface BSDrawLine() + +@property(nonatomic,assign)CGPoint point; //原点坐标 + +@property(nonatomic,assign)CGFloat xUint; //x轴比例 +@property(nonatomic,assign)CGFloat xbegin; //x轴初始值 +@property(nonatomic,assign)CGFloat yUint; //y轴比例 +@property(nonatomic,assign)CGFloat ybegin; //y轴初始值 + +@property(nonatomic,assign)NSString *isSolidYangLine; //阳线是否实心 0(空心),1 +@property(nonatomic,assign)NSString *isSolidYinLine; //阴线是否实心 0(实心),1 + +@property(nonatomic,strong)UIColor *YangLineColor; //阳线颜色 +@property(nonatomic,strong)UIColor *YinLineColor; //阴线颜色 + +@end + + +@implementation BSDrawLine + +//设置坐标系数据 +-(void)initSettingXuint:(CGFloat)xunit xBegin:(CGFloat)xBegin yUint:(CGFloat)yUint yBegain:(CGFloat)yBegain{ + + //检查配置参数 + if (xunit <= 0 || yBegain < 0 || yUint <= 0 || xBegin < 0) { + NSLog(@"参数配置有误...,%.2f,%.2f,%.2f,%.2f",xunit,xBegin,yUint,yBegain); + return; + } + + _xbegin = xBegin; + _ybegin = yBegain; + _xUint = xunit; + _yUint = yUint; + +} +//设置坐标原点 +-(void)initPoint:(CGPoint)point{ + _point = point; +} + +//设置阴线阳线的颜色,是否实心 +-(void)initYangLineColor:(UIColor *)color YinLineColor:(UIColor *)color2 isYangLineSolid:(Boolean)isYangLineSolid isYinLineSolid:(Boolean)isYinLineSolid{ + _YangLineColor = color; + _YinLineColor = color2; + if (isYangLineSolid) { + _isSolidYangLine = @"1"; + }else{ + _isSolidYangLine = @"0"; + } + + if (isYinLineSolid) { + _isSolidYinLine = @"0"; + }else{ + _isSolidYinLine = @"1"; + } +} + + +-(void)drawKline:(NSArray *)arr withContext:(CGContextRef)context scan:(CGFloat)scan{ + + //检查配置参数 + if (_xUint <= 0 ) { + NSLog(@"参数配置未设置..."); + return; + } + if (scan == 0) { + scan = 1; + } + + if ([arr isKindOfClass:[NSArray class]]) { + for (NSArray *tempArr in arr) { + if ([tempArr isKindOfClass:[NSArray class]]) { + if ([tempArr count] >= 5) { + + CGFloat maxTemp = [tempArr[0] floatValue]; + CGFloat minTemp = [tempArr[1] floatValue]; + CGFloat openTemp = [tempArr[2] floatValue]; + CGFloat closeTemp = [tempArr[3] floatValue]; + CGFloat xTemp = [tempArr[4] floatValue]; + + [self drawKLine:maxTemp min:minTemp open:openTemp close:closeTemp x:xTemp lineWidth:1/scan lineWidth2:5/scan context:context]; + + }else{ + NSLog(@"单条数组长度<4"); + } + }else{ + NSLog(@"单条数组数据异常"); + } + } + }else{ + NSLog(@"数组有误"); + } + + + //画坐标系 + + +} + + +-(void)drawKLine:(CGFloat)max min:(CGFloat)min open:(CGFloat)open close:(CGFloat)close x:(CGFloat)x lineWidth:(CGFloat)lineWidth lineWidth2:(CGFloat)lineWidth2 context:(CGContextRef)context{ + + //检查格式是否规范 + if (max < min || max < open || max < close) { + NSLog(@"最大值不正确"); + NSLog(@"最大值:%.2f,最小值:%.2f,开盘:%.2f,收盘:%.2f",max,min,open,close); + } + if (min > max || min > open || min > close) { + NSLog(@"最小值不正确"); + NSLog(@"最大值:%.2f,最小值:%.2f,开盘:%.2f,收盘:%.2f",max,min,open,close); + } + + [self drawKLine:max min:min open:open close:close x:x lineWidth:lineWidth lineWidth2:lineWidth2 withPoint:_point xUnit:_xUint yUnit:_yUint xbegin:_xbegin ybegin:_ybegin context:context]; +} + + +/** + * 画k线 + */ +-(void)drawKLine:(CGFloat)max min:(CGFloat)min open:(CGFloat)open close:(CGFloat)close x:(CGFloat)x lineWidth:(CGFloat)lineWidth lineWidth2:(CGFloat)lineWidth2 withPoint:(CGPoint)point xUnit:(CGFloat)xUnit yUnit:(CGFloat)yUnit xbegin:(CGFloat)xbegin ybegin:(CGFloat)ybegin context:(CGContextRef)context{ + + + //阳线or阴线 + Boolean isYangLine; + CGFloat top = 0; + CGFloat bottom = 0; + if (close > open) { + isYangLine = true; + top = close; + bottom = open; + }else{ + isYangLine = false; + top = open; + bottom = close; + } + + //根据point计算目标点在view中的位置 + max = point.y - (max - ybegin)*yUnit; + min = point.y - (min - ybegin)*yUnit; + top = point.y - (top - ybegin)*yUnit; + bottom = point.y - (bottom - ybegin)*yUnit; + x = (x - xbegin)*xUnit + point.x; + + // NSLog(@"\nmax:%.2f\ntop:%.2f\nbottom:%.2f\nmin:%.2f",max,top,bottom,min); + + UIColor *lineColor = [self getLineColor:isYangLine]; + [lineColor setStroke]; + //画上面的线 + + CGContextSetLineCap(context,kCGLineCapSquare); //指定直线样式 + CGContextSetLineWidth(context,lineWidth); //线宽 + CGContextBeginPath(context); //开始绘制 + CGContextMoveToPoint(context,x, max); //画笔移动到点 + CGContextAddLineToPoint(context,x, top); //下一点 + CGContextStrokePath(context); //绘制完成 + + //画中间的柱体 + CGFloat height = top - bottom == 0 ? 1 : top - bottom; + if (height < 0) { + height = - height; + } + UIColor *solidColor = lineColor; + if (![self getSolid:isYangLine]) { + solidColor = [UIColor clearColor]; //实心的颜色 + } + + CGContextBeginPath(context); //开始绘制 + CGContextMoveToPoint(context,x, top); //画笔移动到点 + [self draw4Rect:CGRectMake(x - lineWidth2/2 , top, lineWidth2,height) withColor:lineColor color2:solidColor withContex:context]; + + //画下面的线 + [lineColor setStroke]; + CGContextSetLineCap(context,kCGLineCapSquare); //指定直线样式 + CGContextSetLineWidth(context,lineWidth); //线宽 + CGContextBeginPath(context); //开始绘制 + CGContextMoveToPoint(context,x, bottom); //画笔移动到点 + CGContextAddLineToPoint(context,x, min); //下一点 + CGContextStrokePath(context); //绘制完成 + + +} +//获取k线的颜色 +-(UIColor *)getLineColor:(Boolean)isYangLine{ + + if (isYangLine) { + if (_YangLineColor == nil) { + return [UIColor redColor]; + } + return _YangLineColor; + } + if (_YinLineColor == nil) { + return [UIColor greenColor]; + } + return _YinLineColor; +} +//获取柱体是否实心 +-(Boolean)getSolid:(Boolean)isYangLine{ + if (isYangLine) { + if ([_isSolidYangLine isEqualToString:@"0"]) { + return false; + } + }else{ + if (![_isSolidYinLine isEqualToString:@"0"]) { + return false; + } + } + return true; +} + +//[[粗细,颜色r,颜色g,颜色b,透明度],[第一个点],[第二个点]......] ++(void)drawLinePoint:(NSArray *)arr2 withContext:(CGContextRef)context scan:(CGFloat)scan{ + + if (arr2.count < 2) { + NSLog(@"数据不全..."); + return; + } + if (scan == 0) { + scan = 1; + } + + @autoreleasepool { + NSArray *arr = arr2[0]; + if (![arr isKindOfClass:[NSArray class]] || arr.count < 5) { + NSLog(@"设置参数不正确..."); + return; + } + + //kCGLineCapButt, + //kCGLineCapRound, + //kCGLineCapSquare + //设置线段头尾部的样式 + CGContextSetLineCap(context,kCGLineCapSquare); + + // kCGLineJoinMiter, + // kCGLineJoinRound, + // kCGLineJoinBevel + //设置线段转折点的样式 + CGContextSetLineJoin(context, kCGLineJoinRound); + + //直线宽度 + CGContextSetLineWidth(context,[arr[0] floatValue]/scan); + //设置颜色 + CGContextSetRGBStrokeColor(context,[arr[1] floatValue]/255.0, [arr[2] floatValue]/255.0, [arr[3] floatValue]/255.0, [arr[4] floatValue]); + //开始绘制 + CGContextBeginPath(context); + //画笔移动到点(31,170) + + for (int i = 1; i < arr2.count; i++) { + NSArray *temp = arr2[i]; + if ([temp isKindOfClass:[NSArray class]]) { + for (int j = 0; j < temp.count; ++j) { + NSString *tempStr = temp[j]; + NSArray *tempArr = [tempStr componentsSeparatedByString:@","]; + if (j == 0) { + if (tempArr.count != 2) { + NSLog(@"初始点异常"); + //绘制完成 + CGContextStrokePath(context); + return; + } + CGContextMoveToPoint(context, + [tempArr[0] floatValue], [tempArr[1] floatValue]); + }else{ + // NSLog(@"画下一个点(%.2f,%.2f);",[tempArr[0] floatValue],[tempArr[1] floatValue]); + //下一点 + CGContextAddLineToPoint(context, + [tempArr[0] floatValue], [tempArr[1] floatValue]); + } + } + + }else{ + NSLog(@"抛弃不规范的数据..."); + } + } + //绘制完成 + CGContextStrokePath(context); + } +} + +//[[线宽,点size,颜色],[第一条线[第一个点],[第二个点]...],[第二条线]...] ++(void)drawCurves:(NSArray *)lineArr withContext:(CGContextRef)ctx scan:(CGFloat)scan{ + + if (lineArr.count < 2) { + return; + } + + if (scan == 0) { + scan = 1; + } + + + NSArray *peizhiArr = lineArr[0]; + CGFloat lineWidth = 0.0; + CGSize pointSize1; + UIColor *lineColor; + + if ([peizhiArr isKindOfClass:[NSArray class]]) { + //线宽 + if (peizhiArr.count > 0) { + lineWidth = [peizhiArr[0] floatValue]; + }else{ + lineWidth = 1; + } + //点大小 + if (peizhiArr.count > 1) { + pointSize1 = [peizhiArr[1] CGSizeValue]; + }else{ + pointSize1 = CGSizeMake(1, 1); + } + //线颜色 + if (peizhiArr.count > 2) { + lineColor = peizhiArr[2]; + }else{ + lineColor = [UIColor blackColor]; + } + + + }else{ + lineWidth = 1; + pointSize1 = CGSizeMake(1, 1); + lineColor = [UIColor blackColor]; + } + + lineWidth = lineWidth/scan; + pointSize1 = CGSizeMake(pointSize1.width/scan, pointSize1.height/scan); + + for (int i = 1; i < lineArr.count; ++i) { + NSArray *tempLineArr = lineArr[i]; + if ([tempLineArr isKindOfClass:[NSArray class]]) { + + [self drawCurve:tempLineArr context:ctx color:lineColor pointSize:pointSize1 lineWidth:lineWidth]; + + } + } + +} + + + +//画曲线 ++(void)drawCurve:(NSArray *)lineArr2_1 context:(CGContextRef)ctx color:(UIColor *)color pointSize:(CGSize)pointSize lineWidth:(CGFloat)lineWidth{ + //bezier 贝赛尔曲线 + if([lineArr2_1 count]){ + //画线 + UIBezierPath* path = [UIBezierPath bezierPath]; + [path setLineWidth:lineWidth]; + for(int i=0; i<[lineArr2_1 count]-1; i++){ + if([lineArr2_1 safeObjectAtIndex1:i] != nil && [lineArr2_1 safeObjectAtIndex1:i+1] != nil){ + CGPoint firstPoint = [[lineArr2_1 safeObjectAtIndex1:i] CGPointValue]; + CGPoint secondPoint = [[lineArr2_1 safeObjectAtIndex1:i+1] CGPointValue]; + [path moveToPoint:firstPoint]; + + // 核心方法ios 如何根据坐标点画曲线 + [path addCurveToPoint:secondPoint controlPoint1:CGPointMake((secondPoint.x-firstPoint.x)/2+firstPoint.x, firstPoint.y) controlPoint2:CGPointMake((secondPoint.x-firstPoint.x)/2+firstPoint.x, secondPoint.y)]; + [color set]; + } + } + path.lineCapStyle = kCGLineCapRound; + [path strokeWithBlendMode:kCGBlendModeNormal alpha:1]; + + //画点 + // for(int i=0; i<[lineArr2_1 count]; i++){ + // CGPoint point = [[lineArr2_1 safeObjectAtIndex1:i] CGPointValue]; + // CGContextFillEllipseInRect(ctx, CGRectMake(point.x-(pointSize.width/2.0), point.y-(pointSize.height/2.0), pointSize.width, pointSize.height)); + // CGContextSetFillColorWithColor(ctx, color.CGColor); + // CGContextFillPath(ctx); + // } + + + } +} + + +/** + * 画折线 + */ +-(void)drawlineWithPointsArray:(CGPoint *)points count:(int)count lineWeight:(CGFloat)lineWeight lineColor:(UIColor *)lineColor withPointWeight1:(CGFloat)width pointWeight2:(CGFloat)width2 pointColor1:(UIColor *)color1 pointColor2:(UIColor *)color2{ + + CGContextRef context = UIGraphicsGetCurrentContext(); + [lineColor setStroke]; + CGContextSetLineWidth(context, lineWeight); + + + CGContextAddLines(context, points, count); + CGContextStrokePath(context); + + for (int i = 0; i < count; i ++) { + CGRect ellipseRect = CGRectMake(points[i].x - (width+width2), points[i].y - (width+width2), (width+width2)*2, (width+width2)*2); + CGContextAddEllipseInRect(context, ellipseRect); + CGContextSetLineWidth(context, width); + [color1 setStroke]; + [color2 setFill]; + CGContextFillEllipseInRect(context, ellipseRect); + CGContextStrokeEllipseInRect(context, ellipseRect); + } +} + + +/** + * 画四边形 + */ +-(void)draw4Rect:(CGRect)rect withColor:(UIColor *)color1 color2:(UIColor *)color2 withContex:(CGContextRef)ctx{ + // 2.画矩形 + CGContextAddRect(ctx,rect); + CGContextSetLineWidth(ctx,0.5f);//边框宽度 + CGContextSetFillColorWithColor(ctx, color2.CGColor);//填充颜色 + CGContextSetStrokeColorWithColor(ctx, color1.CGColor);//线框颜色 + CGContextAddRect(ctx,rect);//画方框 + CGContextDrawPath(ctx, kCGPathFillStroke);//绘画路径 + CGContextFillPath(ctx);// +} + + + +//[[线宽,线颜色,填充颜色],[第一个多边形[第一个点],[第二个点]...],[第二个多边形]...] ++(void)drawMoreRects:(NSArray *)lineArr withContext:(CGContextRef)ctx scan:(CGFloat)scan{ + + if (lineArr.count < 2) { + return; + } + + if (scan == 0) { + scan = 1; + } + + + NSArray *peizhiArr = lineArr[0]; + CGFloat lineWidth = 0.0; + UIColor *lineColor; + UIColor *fileColor; + + if ([peizhiArr isKindOfClass:[NSArray class]]) { + //线宽 + if (peizhiArr.count > 0) { + lineWidth = [peizhiArr[0] floatValue]; + }else{ + lineWidth = 1; + } + //线颜色 + if (peizhiArr.count > 1) { + lineColor = peizhiArr[1]; + }else{ + lineColor = [UIColor blackColor]; + } + + //填充颜色 + if (peizhiArr.count > 2) { + fileColor = peizhiArr[2]; + }else{ + fileColor = [UIColor redColor]; + } + + + }else{ + lineWidth = 1; + lineColor = [UIColor blackColor]; + fileColor = [UIColor redColor]; + } + + lineWidth = lineWidth/scan; + + for (int i = 1; i < lineArr.count; ++i) { + NSArray *tempLineArr = lineArr[i]; + if ([tempLineArr isKindOfClass:[NSArray class]]) { + [self drawMoreRect:tempLineArr withColor:lineColor color2:fileColor width:lineWidth withContex:ctx]; + + } + } + +} + + +/** + * 画多边形 color1线框颜色 color2填充颜色 width线框宽度 pointArr点数组,里面的格式是cgpoint + */ ++(void)drawMoreRect:(NSArray *)pointArr withColor:(UIColor *)color1 color2:(UIColor *)color2 width:(CGFloat)width withContex:(CGContextRef)context{ + + if (pointArr.count < 3) { + NSLog(@"不规范的多边形图"); + return; + } + + //画一个菱形 + CGContextSetLineWidth(context, width); + CGContextSetFillColorWithColor(context, color2.CGColor);//填充颜色 + CGContextSetStrokeColorWithColor(context, color1.CGColor);//线框颜色 + + CGPoint begainPoint = [pointArr[0] CGPointValue]; + CGContextMoveToPoint(context, begainPoint.x, begainPoint.y); + + for (int i = 1; i < pointArr.count; ++i) { + CGPoint tempPoint = [pointArr[i] CGPointValue]; + CGContextAddLineToPoint(context, tempPoint.x, tempPoint.y); + + } + + CGContextFillPath(context); + +} + + +#pragma mark - 字体类相关 ++(void)drawWord:(NSString *)str size:(CGSize)size centerPoint:(CGPoint)point font:(CGFloat)font color:(UIColor *)color{ + + if (color == nil) { + color = [UIColor blueColor]; + } + + NSMutableParagraphStyle *style = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; + style.alignment=NSTextAlignmentCenter; + style.lineSpacing=0.1; + + NSMutableDictionary *attr = [NSMutableDictionary dictionaryWithObject:style forKey:NSParagraphStyleAttributeName]; + [attr setValue:color forKey:NSForegroundColorAttributeName]; + [attr setValue:[UIFont systemFontOfSize:font] forKey:NSFontAttributeName];//[UIFont fontWithName:@"Zapfino"size:5.0] + + [str drawInRect:CGRectMake(point.x - size.width/2.0, point.y - size.height/2.0, size.width, size.height) withAttributes:attr]; +} + +@end diff --git a/YuMi/Tools/sdkContent/content/K/BSkObject.h b/YuMi/Tools/sdkContent/content/K/BSkObject.h new file mode 100644 index 00000000..75d2a32a --- /dev/null +++ b/YuMi/Tools/sdkContent/content/K/BSkObject.h @@ -0,0 +1,45 @@ +// +// GWkObject.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/9/26. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import +/* + * 阳线:收盘价高于开盘价(红色/空心),阴线:收盘价低于开盘价(黑色/实心) + */ +@interface BSkObject : NSObject + +//开盘价 +@property(nonatomic,assign)CGFloat opening; +//收盘价 +@property(nonatomic,assign)CGFloat closing; +//最高价 +@property(nonatomic,assign)CGFloat highest; +//最低价 +@property(nonatomic,assign)CGFloat lowest; + + + +#pragma mark - 时间类 +@property(nonatomic,assign)NSDate *openingTime; //开盘时间 +@property(nonatomic,assign)NSDate *closingTime; //收盘时间 +@property(nonatomic,assign)NSDate *kTime; //k线时间差 + + +#pragma mark - 获取方法 + +/** + 获取当前是否为阳线 + + @return 是否为阳线 + */ +//-(Boolean)isYangLine; + +// + + +@end diff --git a/YuMi/Tools/sdkContent/content/K/BSkObject.m b/YuMi/Tools/sdkContent/content/K/BSkObject.m new file mode 100644 index 00000000..d6ec8f70 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/K/BSkObject.m @@ -0,0 +1,14 @@ +// +// GWkObject.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/9/26. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSkObject.h" + + +@implementation BSkObject + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.h new file mode 100644 index 00000000..1fd9b621 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.h @@ -0,0 +1,60 @@ +// +// NetListenModel.h +// BaseProject +// +// Created by xiaowen.chen on 16/8/12. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import + +@interface BSNetListenModel : NSObject +@property(nonatomic,assign)BOOL isShow; + ++ (instancetype)sharedInstance:(UIWindow *)window; + +//初始化实时监听的view ++(void)initRealTimeView:(UIView *)view; ++(void)initRealTimeView; +//隐藏view ++(void)hideView; + + +//实时打印事件 ++(void)GWPrint:(id)object; + ++(void)GWPrint:(id)object color:(UIColor *)color; + ++(void)GWPrint:(id)object color:(UIColor *)color font:(CGFloat)font; + + + +#pragma mark - 网络类的监听处理 +/* + * url:请求的链接 + * headDic:请求的头文件 + * param:请求的参数 + */ ++(void)addHttpReq:(NSString *)url param:(NSDictionary *)param time:(NSString *)time; ++(void)addHttpReq:(NSString *)url header:(NSDictionary *)headDic param:(NSDictionary *)param time:(NSString *)time; + ++(void)addHttpRsp:(NSString *)url result:(id)result isSuccess:(Boolean)isSuccess time:(NSString *)time; ++(void)addHttpRsp:(NSString *)url header:(NSDictionary *)headDic result:(id)result isSuccess:(Boolean)isSuccess time:(NSString *)time; + + +#pragma mark - 操作记录存储 +/* + * coding:类型编码 + * keyword:关键字,(比如:按钮名) + * describe:描述语,(比如:打开) + * option:操作编码 + */ ++(void)addOptionRecord:(int)coding keyword:(NSString *)keyword describe:(NSString *)describe option:(int)option; + + +#pragma mark - 页面分析 ++(void)pushToLogViewWithNavigationController:(UINavigationController *)na; + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.m new file mode 100644 index 00000000..63a7a212 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/BSNetListenModel.m @@ -0,0 +1,263 @@ +// +// NetListenModel.m +// BaseProject +// +// Created by xiaowen.chen on 16/8/12. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSNetListenModel.h" +#import "BSRealTimeView.h" +#import "BSRecordModel.h" + + +#import "BSLogTableViewController.h" + +#import "BSNotification.h" + +static NSString * const gwTeskSdk_version = @"gwTeskSdk_version"; + + + +@interface BSNetListenModel() + +@property (nonatomic, strong) UIWindow *window; +@property (nonatomic, strong) BSRealTimeView *timeView;//监听的view + + + + + +@end + +@implementation BSNetListenModel + + + ++ (instancetype)sharedInstance:(UIWindow *)window { + static BSNetListenModel *instance; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + instance = [[self alloc] init]; + + instance.window = window; + + [self instance]; + + //关闭监听的view; + [BSNotification addHandler:^(NFMessageType type,NSString *key,NSObject *value) { + [instance.timeView setHidden:YES]; + instance.isShow = NO; + } withName:@"netlisten_viewhide"]; + }); + + return instance; +} + +#pragma mark - 初始化相关的数据 + ++(void)instance{ + + + NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults]; + NSString *result = [userDefaults valueForKey:@"bs_isFirstRunDataBase_gwtestsdk"]; + + + +} + +static NSMutableDictionary *dataDic;//数据 + ++(void)initRealTimeView:(UIView *)view{ + + UIWindow * window = [UIApplication sharedApplication].keyWindow; + BSNetListenModel *netModel = [BSNetListenModel sharedInstance:window]; + if (!netModel.timeView) { + BSRealTimeView *timeView = [[BSRealTimeView alloc] initWithFrame:CGRectMake(20, 300, 200, 160)]; + netModel.timeView = timeView; + }else{ + if (netModel.timeView.subviews) { + [netModel.timeView removeFromSuperview];//父类移除 + } + } + [view addSubview:netModel.timeView]; + [netModel.timeView setHidden:NO]; + +} ++(void)initRealTimeView{ + + UIWindow * window = [UIApplication sharedApplication].keyWindow; + BSNetListenModel *netModel = [BSNetListenModel sharedInstance:window]; + if (!netModel.timeView) { + BSRealTimeView *timeView = [[BSRealTimeView alloc] initWithFrame:CGRectMake(20, 300, 200, 160)]; + netModel.timeView = timeView; + }else{ + if (netModel.timeView.subviews) { + [netModel.timeView removeFromSuperview];//父类移除 + } + } + [netModel.window addSubview:netModel.timeView]; + [netModel.timeView setHidden:NO]; + +} + + ++(void)hideView{ + [BSNotification pushHandle:nil withName:@"netlisten_viewhide"]; + UIWindow * window = [UIApplication sharedApplication].keyWindow; + BSNetListenModel *netModel = [BSNetListenModel sharedInstance:window]; + netModel.isShow = NO; + +} + +#pragma mark - 网络类监听处理 ++(void)addHttpReq:(NSString *)url param:(NSDictionary *)param time:(NSString *)time{ + return [self addHttpReq:url header:nil param:param time:time]; +} ++(void)addHttpReq:(NSString *)url header:(NSDictionary *)headDic param:(NSDictionary *)param time:(NSString *)time{ + + if (time == nil) {//要求有唯一产生规则 + return; + } + + NSMutableDictionary *dic; + if (url == nil) { + url = @"---"; + } + dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:url,@"url",@"netReq",@"handle",time,@"time", nil]; + if (headDic != nil) { + [dic setValue:headDic forKey:@"header"]; + } + if (param != nil) { + [dic setValue:param forKey:@"param"]; + } + + + [BSNotification pushHandle:dic withName:@"gwsdk_print"]; +} ++(void)addHttpRsp:(NSString *)url result:(id)result isSuccess:(Boolean)isSuccess time:(NSString *)time{ + return [self addHttpRsp:url header:nil result:result isSuccess:isSuccess time:time]; +} ++(void)addHttpRsp:(NSString *)url header:(NSDictionary *)headDic result:(id)result isSuccess:(Boolean)isSuccess time:(NSString *)time{ + + if (time == nil) {//要求有唯一产生规则 + return; + } + + NSMutableDictionary *dic; + if (url == nil) { + url = @"---"; + } + dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:url,@"url",@"netRsp",@"handle",time,@"time", nil]; + if (headDic != nil) { + [dic setValue:headDic forKey:@"header"]; + } + if (result != nil) { + [dic setValue:result forKey:@"result"]; + } + if (isSuccess) { + [dic setValue:@"1" forKey:@"isSuccess"]; + }else{ + [dic setValue:@"0" forKey:@"isSuccess"]; + } + [BSNotification pushHandle:dic withName:@"gwsdk_print"]; +} + + + +//实时打印事件 ++(void)GWPrint:(id)object{ + return [self GWPrint:object color:nil font:0]; +} + ++(void)GWPrint:(id)object color:(UIColor *)color{ + return [self GWPrint:object color:color font:0]; +} + ++(void)GWPrint:(id)object color:(UIColor *)color font:(CGFloat)font{ + + NSMutableDictionary *dic; + //字符串 + if ([object isKindOfClass:[NSDictionary class]]||[object isKindOfClass:[NSArray class]]) { + dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"yes",@"isChangeLine",object,@"printData", nil]; + + + }else if([object isKindOfClass:[NSString class]]){ + dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"no",@"isChangeLine",object,@"printData", nil]; + + }else{ + dic = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"yes",@"isChangeLine",@"不支持该打印模式...",@"printData",@"15",@"font",[UIColor redColor],@"color", nil]; + + } + + if (!dic[@"color"] && color != nil) { + [dic setValue:color forKey:@"color"]; + } + if (!dic[@"font"] && font != 0) { + [dic setValue:[NSString stringWithFormat:@"%.2f",font] forKey:@"font"]; + } + + [BSNotification pushHandle:dic withName:@"gwsdk_print"]; +} + + +static NSMutableArray *recordArr;//内存 +#pragma mark - 操作记录存储 + ++(void)addOptionRecord:(int)coding keyword:(NSString *)keyword describe:(NSString *)describe option:(int)option{ + + + + + BSRecordModel *tempModel = [BSRecordModel recordModelWith:coding keyword:keyword describe:describe option:option]; + [self GWPrint:[tempModel description] color:[UIColor orangeColor] font:7]; + + if (tempModel) { + //记录到内存 + [self writeRecordToCache:tempModel]; + + } + +} + + + +//写入内存 ++(void)writeRecordToCache:(BSRecordModel *)record{ + if (!recordArr) { + recordArr = [NSMutableArray array]; + } + + [recordArr addObject:record]; +} + + + +//内存中获取 ++(NSMutableArray *)getRecordFromCache{ + + if (!recordArr) { + recordArr = [NSMutableArray array]; + } + return recordArr; +} + + + + +#pragma mark - 页面分析 ++(void)pushToLogViewWithNavigationController:(UINavigationController *)na{ + + UIWindow * window = [[UIApplication sharedApplication].windows lastObject]; + BSNetListenModel *netModel = [BSNetListenModel sharedInstance:window]; + if (netModel.timeView != nil) { + [netModel.timeView cancleINtime];//暂停实时监听 + } + BSLogTableViewController *gw = [[BSLogTableViewController alloc] init]; + [na pushViewController:gw animated:YES]; +} + + + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.h new file mode 100644 index 00000000..b5f3e450 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.h @@ -0,0 +1,18 @@ +// +// GWLogNetDetailViewController.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/31. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import +#import "BSRecordModel.h" + +//网络详情 + +@interface BSLogNetDetailViewController : UIViewController + +@property (nonatomic, strong) BSRecordModel *model; + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.m new file mode 100644 index 00000000..8f54248a --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogNetDetailViewController.m @@ -0,0 +1,90 @@ +// +// GWLogNetDetailViewController.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/31. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSLogNetDetailViewController.h" +#import "BSSDLayoutUtil.h" + +@interface BSLogNetDetailViewController () + +@property (nonatomic, strong) UILabel *urlLabel; + +@property (nonatomic, strong) UILabel *reqTimeLable; +@property (nonatomic, strong) UILabel *rspTimeLable; + +@property (nonatomic, strong) UITextView *reqLabel; +@property (nonatomic, strong) UITextView *rspLabel; + +@end + +@implementation BSLogNetDetailViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + self.view.backgroundColor = [UIColor whiteColor]; + //url + _urlLabel = [[UILabel alloc] init]; + _urlLabel.numberOfLines = 2; + [self.view addSubview:_urlLabel]; + SDLAYOUT_h(_urlLabel, self.view, 20, self.view, -5, self.view, -5, 40); + + //请求时间 + _reqTimeLable = [[UILabel alloc] init]; + [self.view addSubview:_reqTimeLable]; + SDLAYOUT_h(_reqTimeLable, _urlLabel, 42, self.view, -5, self.view, -5, 22); + + //返回时间 + _rspTimeLable = [[UILabel alloc] init]; + [self.view addSubview:_rspTimeLable]; + SDLAYOUT_h(_rspTimeLable, _reqTimeLable, 25, self.view, -5, self.view, -5, 22); + + + //请求 + _reqLabel = [[UITextView alloc] init]; + _reqLabel.editable = NO; + _reqLabel.textColor = [UIColor grayColor]; + [self.view addSubview:_reqLabel]; + SDLAYOUT_h(_reqLabel, _rspTimeLable, 25, self.view, -5, self.view, -5, 150); + + + //返回 + _rspLabel = [[UITextView alloc] init]; + _rspLabel.editable = NO; + [self.view addSubview:_rspLabel]; + SDLAYOUT(_rspLabel, _reqLabel, 152, self.view, 5, self.view, -5, self.view,-5); + + + + + [self initData]; +} + +-(void)initData{ + + _urlLabel.text = _model.keyword; + _reqTimeLable.text = [NSString stringWithFormat:@"请求时间:%@",_model.time]; + _rspTimeLable.text = [NSString stringWithFormat:@"响应时间:%@",_model.time2]; + _reqLabel.text = [NSString stringWithFormat:@"请求头:%@\n请求参数:%@",_model.describe,_model.result]; + _rspLabel.text = [NSString stringWithFormat:@"结果头:%@\n结果:%@",_model.describe2,_model.result2]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.h new file mode 100644 index 00000000..b8de9155 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.h @@ -0,0 +1,13 @@ +// +// LogTableViewController.h +// BaseProject +// +// Created by xiaowen.chen on 16/8/24. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + +@interface BSLogTableViewController : UIViewController + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.m new file mode 100644 index 00000000..f9eb8bb4 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSLogTableViewController.m @@ -0,0 +1,260 @@ +// +// LogTableViewController.m +// BaseProject +// +// Created by xiaowen.chen on 16/8/24. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSLogTableViewController.h" +#import "BSRecordModel.h" +#import "BSLogNetDetailViewController.h" + +#import "Masonry.h" +#import "BSNSStringUtil.h" +#import "BS_UIColor.h" +#import "BSXWDateUtil.h" + +@interface BSLogTableViewController () + +@property (nonatomic, strong) UITableView *tableView; + +@property (nonatomic, strong) NSMutableArray *arr; + +@end + +@implementation BSLogTableViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + [self createMyView]; +} + +-(void)createMyView{ + self.title = @"历史记录30条"; + self.view.backgroundColor = [UIColor whiteColor]; + _tableView = [[UITableView alloc] init]; + [self.view addSubview:_tableView]; + _tableView.dataSource = self; + _tableView.delegate = self; + + + [_tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(self.view); + make.leading.equalTo(self.view); + make.trailing.equalTo(self.view); + make.bottom.equalTo(self.view); + }]; + + + +// NSLog(@"获取数据1"); + //模拟数据 + _arr = [NSMutableArray array]; + + + + + //右上角菜单 + UIBarButtonItem *rightBarButton = [[UIBarButtonItem alloc] initWithTitle:@"清空" style:UIBarButtonItemStylePlain target:self action:@selector(rightBarButtonItem:) ] ; + [rightBarButton setTintColor:[UIColor blueColor]]; + self.navigationItem.rightBarButtonItem = rightBarButton; + + +} + +//保存txt +-(void)rightBarButtonItem:(UIBarButtonItem *)btnItem{ + + //保存 +// btnItem.enabled = NO; +// [GWFileOptionModel writeToFile_RecordModel:_arr stringForMatBlock:^NSString *(NSString *forMatString) { +// return @"类型编码:[coding] 链接:[keyword] 请求时间:[time] 返回时间:[time2] 关键字:[keyword] 请求:[result] 结果:[result2] 操作编码:[optionCoding]\n\n "; +// } withCompletion:nil class:[BSRecordModel class]]; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored"-Wdeprecated-declarations" + //写在这个中间的代码,都不会被编译器提示-Wdeprecated-declarations类型的警告 + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"是否清空历史记录?" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"确定", nil]; + [alert show]; + +#pragma clang diagnostic pop + +} + +#pragma mark - alertView的代理方法 +#pragma clang diagnostic push +#pragma clang diagnostic ignored"-Wdeprecated-declarations" +-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ + if (buttonIndex == 1) { + //删除所有 + self.navigationItem.rightBarButtonItem.enabled = NO; + BSRecordModel *tempModel = [[BSRecordModel alloc] init]; + + + [_arr removeAllObjects]; + [_tableView reloadData]; + } +} +#pragma clang diagnostic pop + +#pragma mark - 数据源方法 +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + BSRecordModel *model = _arr[section]; + if (model.coding == 200) { + return 1; + }else{ + return 1; + } + +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + + static NSString *indentifiner = @"gwlog_table_cell"; + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:indentifiner]; + if(cell == nil) + { + NSLog(@"创建cell1~~"); + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:indentifiner] ; + cell.textLabel.numberOfLines = 2; + } + + // 设置 Cell... + BSRecordModel *model = _arr[indexPath.section]; + if (model.coding == 200) { + if (indexPath.row == 0) { + cell.textLabel.lineBreakMode = NSLineBreakByTruncatingMiddle; + cell.textLabel.text = model.keyword; + + }else if (indexPath.row == 1){ + cell.textLabel.lineBreakMode = NSLineBreakByTruncatingTail; + cell.textLabel.text = [BSNSStringUtil clearStr:model.result]; + }else{ + cell.textLabel.lineBreakMode = NSLineBreakByTruncatingTail; + cell.textLabel.text = [BSNSStringUtil clearStr:model.result2]; + } + + }else{ + cell.textLabel.lineBreakMode = NSLineBreakByTruncatingTail; + cell.textLabel.text = model.result; + } + + return cell; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + if (indexPath == 0) { + return 45; + }else{ + return 40; + } +} + + + + +#pragma mark - tableView分区设定 +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ + //分区数 + return _arr.count; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ + //分区高度 + return 30; +} + + +-(UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ + + BSRecordModel *model = _arr[section]; + + static NSString *identy = @"headhead"; + UITableViewHeaderFooterView * hf = [tableView dequeueReusableHeaderFooterViewWithIdentifier:identy]; + if (!hf) { + + NSLog(@"创建分区头~~"); + hf = [[UITableViewHeaderFooterView alloc]initWithReuseIdentifier:identy]; + UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 40)]; + view.backgroundColor = [BS_UIColor stringTOColor:@"#ecffff"]; + + UILabel *la = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, view.frame.size.width-40, 40)]; + [view addSubview:la]; + + + NSString *option = @"未知"; + if (model.optionCoding == -1) { + option = @"正在请求"; + }else if (model.optionCoding == 0) { + option = @"请求失败"; + }else if (model.optionCoding == 1) { + option = @"请求成功"; + } + NSMutableAttributedString *att = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"[%@],S:%d,R:%@",model.onlySign,model.coding,option]]; + + if (model.time2.length > 8 && model.time.length > 8) { + NSTimeInterval time = [BSXWDateUtil TimeDifferenceWithTime1:model.time2 AndTime2:model.time formet:nil]; + + UIColor *color = [UIColor blackColor]; + if (time > 30) { + color = [UIColor redColor]; + }else if(time > 15){ + color = [UIColor yellowColor]; + } + + [att appendAttributedString:[BSNSStringUtil getAttributedString:[NSString stringWithFormat:@",T:%.1fS",time] color:color font:14 lineSpa:5]]; + } + la.attributedText = att; + + la.font = [UIFont systemFontOfSize:10]; + + + UIButton *detailBtn = [UIButton buttonWithType:UIButtonTypeCustom]; + detailBtn.tag = section; + [view addSubview:detailBtn]; + + [detailBtn mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(40); + make.height.mas_equalTo(30); + make.bottom.equalTo(view).offset(-2); + make.trailing.equalTo(view).offset(-8); + }]; + + + [detailBtn setTitle:@"详细" forState:UIControlStateNormal]; + [detailBtn setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; + [detailBtn addTarget:self action:@selector(onclicBtn:) forControlEvents:UIControlEventTouchUpInside]; + + + + [hf addSubview:view]; + } + return hf; + +} + + +-(void)onclicBtn:(UIButton *)btn{ + BSRecordModel *model = _arr[btn.tag]; + BSLogNetDetailViewController *tempView = [[BSLogNetDetailViewController alloc] init]; + tempView.model = model; + [self.navigationController pushViewController:tempView animated:YES]; + +} + + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +/* +#pragma mark - Navigation + +// In a storyboard-based application, you will often want to do a little preparation before navigation +- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { + // Get the new view controller using [segue destinationViewController]. + // Pass the selected object to the new view controller. +} +*/ + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.h new file mode 100644 index 00000000..003ec0d0 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.h @@ -0,0 +1,19 @@ +// +// BSRealTextView.h +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import +#import "RealViewCellModel.h" + +@interface BSRealTextView : UIView +@property (nonatomic,strong)RealViewCellModel *tempModel; +@property(nonatomic,strong)NSString *guid; +@property(nonatomic,strong)NSString *number; + +//初始化数据 +-(void)initData; +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.m new file mode 100644 index 00000000..1e91c112 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTextView.m @@ -0,0 +1,154 @@ +// +// BSRealTextView.m +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import "BSRealTextView.h" +#import "BSRecordModel.h" +#import "Masonry.h" +#import "BSSDLayoutUtil.h" +#import "BSNSStringUtil.h" + +@interface BSRealTextView() + +@property (nonatomic, strong) UITextView *dataLabel;//显示的内容 +@property (nonatomic, strong) NSMutableAttributedString *resultAttiText; +@property (nonatomic, strong) UIButton *option_close;//关闭 +@property (nonatomic, strong) UIButton *option_copy;//拷贝 +@property (nonatomic, strong) UILabel *numbLable;//数字 +@end + +@implementation BSRealTextView + + +-(instancetype)init{ + + self = [super init]; + if (self) { + [self initView]; + } + + return self; +} + +-(void)initView{ + + + _option_close = [UIButton buttonWithType:UIButtonTypeCustom]; + [_option_close setTitle:@" x " forState:UIControlStateNormal]; + [_option_close addTarget:self action:@selector(onclick:) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:_option_close]; + _option_close.backgroundColor = [UIColor greenColor]; + SDLAYOUT_wh2(_option_close, self, 0, self, 0, 40, 30) + + _option_copy = [UIButton buttonWithType:UIButtonTypeCustom]; + [_option_copy setTitle:@"copy" forState:UIControlStateNormal]; + [_option_copy addTarget:self action:@selector(onclickCopy:) forControlEvents:UIControlEventTouchUpInside]; + [_option_copy setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; + [self addSubview:_option_copy]; + [_option_copy mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(0); + make.width.mas_offset(40); + make.height.mas_offset(30); + make.trailing.mas_offset(-55); + }]; + + _numbLable = [[UILabel alloc] init]; + [self addSubview:_numbLable]; + [_numbLable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(0); + make.width.mas_offset(50); + make.height.mas_offset(30); + make.leading.mas_offset(10); + }]; + _numbLable.textColor = [UIColor blackColor]; + _numbLable.textAlignment = NSTextAlignmentCenter; + + _dataLabel = [[UITextView alloc] init]; + _dataLabel.editable = NO; + [self addSubview:_dataLabel]; + [_dataLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(30); + make.leading.mas_offset(4); + make.bottom.mas_offset(-4); + make.trailing.mas_offset(-4); + }]; + _dataLabel.backgroundColor = [UIColor whiteColor]; + + + +} + +#pragma mark - 关闭的方法 +-(void)onclick:(UIButton *)btn{ + if (self.subviews) { + [self removeFromSuperview]; + } +} + +#pragma mark - 拷贝的方法 +-(void)onclickCopy:(UIButton *)btn{ + + UIPasteboard *pasteboard = [UIPasteboard generalPasteboard]; + pasteboard.string = _dataLabel.attributedText.string; + [_option_copy setTitleColor:[UIColor blueColor] forState:UIControlStateNormal]; + +} + + +-(void)initData{ + + _resultAttiText = [[NSMutableAttributedString alloc] init]; + _resultAttiText = [[NSMutableAttributedString alloc] init]; + + [_resultAttiText appendAttributedString:[self getAttributedString:[NSString stringWithFormat:@"请求时间:%@",self.tempModel.time1]]]; + [_resultAttiText appendAttributedString:[self getAttributedString:[NSString stringWithFormat:@"\n响应时间:%@",self.tempModel.time2]]]; + [_resultAttiText appendAttributedString:[self getAttributedString:@"\n请求链接:"]]; + [_resultAttiText appendAttributedString:[self getAttributedString:self.tempModel.url color:[UIColor blueColor]]]; + + [_resultAttiText appendAttributedString:[self getAttributedString:@"\n请求header:\n"]]; + NSString *headStr = [NSString stringWithFormat:@"%@\n",[BSNSStringUtil getStringFromObj:self.tempModel.header]]; + [_resultAttiText appendAttributedString:[self getAttributedString:headStr color:[UIColor grayColor] font:12 lineSpa:3]]; + + [_resultAttiText appendAttributedString:[self getAttributedString:@"请求参数:\n"]]; + NSString *paramStr = [NSString stringWithFormat:@"%@\n",[BSNSStringUtil getStringFromObj:self.tempModel.param]]; + [_resultAttiText appendAttributedString:[self getAttributedString:paramStr color:[UIColor redColor] font:12 lineSpa:3]]; + + + [_resultAttiText appendAttributedString:[self getAttributedString:@"返回header:\n"]]; + NSString *headStr2 = [NSString stringWithFormat:@"%@\n",[BSNSStringUtil getStringFromObj:self.tempModel.backHeader]]; + [_resultAttiText appendAttributedString:[self getAttributedString:headStr2 color:[UIColor grayColor] font:12 lineSpa:3]]; + [_resultAttiText appendAttributedString:[self getAttributedString:@"结果:\n"]]; + UIColor *color = [UIColor redColor]; + NSString *resultStr = [NSString stringWithFormat:@"%@\n",[BSNSStringUtil getStringFromObj:self.tempModel.result]]; + [_resultAttiText appendAttributedString:[self getAttributedString:resultStr color:color font:12 lineSpa:3]]; + + _dataLabel.attributedText = _resultAttiText; + _numbLable.text = _number; +} + +-(NSAttributedString *)getAttributedString:(NSString *)str{ + return [self getAttributedString:str color:nil font:0 lineSpa:0]; +} + +-(NSAttributedString *)getAttributedString:(NSString *)str color:(UIColor *)color{ + return [self getAttributedString:str color:color font:0 lineSpa:0]; +} + +//根据字体,颜色,返回富文本 +-(NSAttributedString *)getAttributedString:(NSString *)str color:(UIColor *)color font:(CGFloat)font lineSpa:(CGFloat)lineSpac{ + return [BSNSStringUtil getAttributedString:str color:color font:font lineSpa:lineSpac]; +} + +/* +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect { + // Drawing code +} +*/ + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.h new file mode 100644 index 00000000..4eddabfa --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.h @@ -0,0 +1,20 @@ +// +// RealTimeView.h +// BaseProject +// +// Created by xiaowen.chen on 16/8/12. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + + +@interface BSRealTimeView : UIView + + +//取消实时监听 +-(void)cancleINtime; + + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.m new file mode 100644 index 00000000..f106f73d --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/BSRealTimeView.m @@ -0,0 +1,611 @@ +// +// RealTimeView.m +// BaseProject +// +// Created by xiaowen.chen on 16/8/12. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSRealTimeView.h" +#import "BSSelectView.h" +#import "BSRecordModel.h" +#import "BSDrawLine.h" +#import +#import "RealViewNetWorkCell_0.h" +#import "BSRealTextView.h" +#import "BSNotification.h" +#import "BS_UIColor.h" +#import "BSSDLayoutUtil.h" + +@interface BSRealTimeView() + +@property (nonatomic, assign) Boolean isCanMove; +@property (nonatomic, strong) UIView *topView; +@property (nonatomic, strong) UITableView *tableView; +@property(nonatomic,strong)NSMutableArray *dataArr; + +@property (nonatomic, assign) int model; +@property (nonatomic, assign) CGFloat sc_width; +@property (nonatomic, assign) CGFloat sc_height; +@property (nonatomic, assign) CGRect self_rect; + + +//@property (nonatomic, strong) UITextView *dataLabel; +//@property (nonatomic, strong) NSMutableAttributedString *resultAttiText; + + +//窗口操作按钮' +@property (nonatomic, strong) UIButton *option; +@property (nonatomic, strong) UIButton *option_clear; +@property (nonatomic, strong) BSSelectView *option_intime; + + +@property (nonatomic, strong) UILabel *opLable; +@property (nonatomic, assign) Boolean isMin; + +@end + +@implementation BSRealTimeView + +-(instancetype)initWithFrame:(CGRect)frame{ + self = [super initWithFrame:frame]; + + [self createMyView]; + + //添加监听 todo + [BSNotification addHandler:^(NFMessageType type,NSString *key,NSObject *value) { + + NSDictionary *handleDic = (NSDictionary *)value; + dispatch_async(dispatch_get_main_queue(), ^{ + + NSString *stateStr = handleDic[@"handle"]; + if (stateStr) { + if ([stateStr isEqualToString:@"netReq"]) { + //网络请求类的监听-请求 + [self printReq:handleDic[@"url"] header:handleDic[@"header"] param:handleDic[@"param"] time:handleDic[@"time"]];//发出网络请求 + + }else if([stateStr isEqualToString:@"netRsp"]){ + //网络请求类的监听-返回 + [self printRsp:handleDic[@"url"] header:handleDic[@"header"] result:handleDic[@"result"] isSuccess:handleDic[@"isSuccess"] time:handleDic[@"time"]]; + + }else{ + [self print:@"不支持该打印模式..." isChangeLine:YES colors:[UIColor yellowColor] font:0]; + } + return; + } + [self printDictionary:handleDic]; + + }); + + + } withName:@"gwsdk_print"]; + + + return self; +} + +-(void)createMyView{ + + _isMin = NO; + _model = 0;//移动模式 + _sc_width = [[UIScreen mainScreen] bounds].size.width; + _sc_height = [[UIScreen mainScreen] bounds].size.height; +// _resultAttiText = [[NSMutableAttributedString alloc] init]; + self.clipsToBounds = YES; + self.backgroundColor = [UIColor grayColor]; + + + + + _option = [UIButton buttonWithType:UIButtonTypeCustom]; + [_option setTitle:@" x " forState:UIControlStateNormal]; + [_option addTarget:self action:@selector(onclick:) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:_option]; + _option.backgroundColor = [UIColor greenColor]; + SDLAYOUT_wh1(_option, self, 0, self, 0, 40, 30) + + //双击事件 + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(clickClose:)]; + //设置点击次数 + tap.numberOfTapsRequired = 2;//主要 + //将这个手势添加到图片上 + [_option addGestureRecognizer:tap]; + + + + + + _dataArr = [NSMutableArray array]; +// for (int i = 0; i < 5; i++) { +// RealViewCellModel *modle = [[RealViewCellModel alloc] init]; +// [_dataArr addObject:modle]; +// } + +// _dataLabel = [[UITextView alloc] init]; +// _dataLabel.editable = NO; +// [self addSubview:_dataLabel]; +// SDLAYOUT(_dataLabel, self, 30, self, 2, self, -2, self, -30) + + _tableView = [[UITableView alloc] init]; + [self addSubview:_tableView]; + _tableView.dataSource = self; + _tableView.delegate = self; + [_tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(30); + make.leading.mas_offset(1); + make.bottom.mas_offset(-30); + make.trailing.mas_offset(-1); + }]; + self.tableView.separatorStyle = NO; + self.tableView.backgroundColor = [BS_UIColor stringTOColor:@"#f4f4f4"]; + + + + + + _opLable = [[UILabel alloc] init]; + _opLable.text = @""; + [self addSubview:_opLable]; + SDLAYOUT_wh1(_opLable, _option, 5, self, 5, 50, 20) + + + + _option_intime = [[BSSelectView alloc]init]; + _option_intime.button.tag = 1001; + _option_intime.label.textColor = [UIColor whiteColor]; + [self addSubview:_option_intime]; + [_option_intime setTitle:@"实时" detail:@"" sender:self selector:@selector(buttonDidSelect:)]; + [_option_intime.button setSelected:YES]; + + SDLAYOUT_wh1(_option_intime, _option, 55, self, 10, 50, 20) + + + + _option_clear = [UIButton buttonWithType:UIButtonTypeCustom]; + [_option_clear setTitle:@"清空" forState:UIControlStateNormal]; + [_option_clear addTarget:self action:@selector(onclick:) forControlEvents:UIControlEventTouchUpInside]; + [self addSubview:_option_clear]; + + SDLAYOUT_wh3(_option_clear, self, 5, self, -5, 50, 20) + + + //把view放在最上面 + [self bringSubviewToFront:_option]; +} + + +#pragma mark - 输出数据 +-(void)print:(NSString *)str isChangeLine:(Boolean)isChange colors:(UIColor*)color font:(CGFloat)font{ + + + if (![self isNeedToPrintWithType:@"print"]) { + return; + } + + if (isChange) { + str = [NSString stringWithFormat:@"%@\n",str]; + } + if (font == 0) { + font = 15; + } + if (color == nil) { + color = [UIColor blackColor]; + } + + NSLog(@"暂无实现"); + +// [_resultAttiText appendAttributedString:[self getAttributedString:str color:color font:font lineSpa:8]]; +// [self printToLable:[_resultAttiText copy]]; + + +} + + + +#pragma mark - 特定格式的数据 + +-(void)printReq:(NSString *)url header:(NSDictionary *)headDic param:(NSDictionary *)param time:(NSString *)time{ + + if (![self isNeedToPrintWithType:@"req"]) { + return; + } + + if (!url) { + url = @"---"; + } + + RealViewCellModel *modle = [[RealViewCellModel alloc] init]; + modle.UI_centerStr = @"请求..."; + modle.guid = time; + modle.header = headDic; + modle.time1 = time; + modle.param = param; + modle.UI_rightStr = url; + [_dataArr addObject:modle]; + [_tableView reloadData]; + +} + +-(void)printRsp:(NSString *)url header:(NSDictionary *)headDic result:(id)result isSuccess:(NSString *)isSuccess time:(NSString *)time{ + +// if (![self isNeedToPrintWithType:@"rsp"]) { +// return; +// } + + for (RealViewCellModel *tempModel in _dataArr) { + if ([tempModel.UI_rightStr isEqualToString:url]) { + tempModel.result = result; + tempModel.url = url; + tempModel.backHeader = headDic; + tempModel.time2 = time; + tempModel.isSuccess = [isSuccess isEqualToString:@"1"]; + tempModel.UI_centerStr = isSuccess; + [_tableView reloadData]; + break; + } + } + + +} + + +//判断是否需要打印 +-(Boolean)isNeedToPrintWithType:(NSString *)type{ + + if (!_option_intime.button.isSelected) { + return NO; + } + + //print,req,rsp//根据配置决定是否打印 + + return YES; +} + +#pragma mark - 外部调用的方法 + +-(void)cancleINtime{ + [_option_intime.button setSelected:NO]; +} + + + +#pragma mark - 富文本处理 + ++(void)printRsp:(NSString *)url header:(NSDictionary *)headDic result:(NSDictionary *)result{ + +} + + + +-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{ + if (!_isCanMove) { + return; + } + + if (_model == 0 || _model == 1) { + } +} + + + +#pragma mark - 外部启用事件 +-(void)printDictionary:(NSDictionary *)dic{ + if ([dic isKindOfClass:[NSDictionary class]]) { + + id object = dic[@"printData"]; + Boolean isChange = [dic[@"isChangeLine"] isEqualToString:@"yes"] ? YES : NO; + CGFloat font = 0; + UIColor *color = nil; + if (!dic[@"font"]) { + font = [dic[@"font"] floatValue]; + } + + if ([dic[@"color"] isKindOfClass:[UIColor class]]) { + color = dic[@"color"]; + } + + if (object) { + if ([object isKindOfClass:[NSDictionary class]]) { + NSString *tempStr = [NSString stringWithFormat:@"%@",object]; + [self print:tempStr isChangeLine:isChange colors:color font:font]; + }else if([object isKindOfClass:[NSString class]]){ + [self print:object isChangeLine:isChange colors:color font:font]; + }else if([object isKindOfClass:[NSArray class]]){ + NSString *tempStr = [NSString stringWithFormat:@"%@",object]; + [self print:tempStr isChangeLine:isChange colors:color font:font]; + } + + } + } +} + + +#pragma mark - 点击事件 +-(void)buttonDidSelect:(UIButton *)btn{ + if(btn.tag == 1001){ + if (_option_intime.button.selected) { + [_option_intime.button setSelected:NO]; + }else{ + [_option_intime.button setSelected:YES]; + } + } +} + + +//点击事件 +-(void)onclick:(UIButton *)btn{ + + if (btn == _option_clear) { + +// _resultAttiText = [[NSMutableAttributedString alloc] init]; +// _dataLabel.attributedText = [_resultAttiText copy]; + [_dataArr removeAllObjects]; + [_tableView reloadData]; + + return; + } + + + if (_isMin) { + _isMin = NO; + [self onclick_min_end:btn]; + }else{ + _isMin = YES; + [self onclick_min:btn]; + } + +} + +//关闭事件 +-(void)clickClose:(UITapGestureRecognizer *)tap{ + [BSNotification pushHandle:nil withName:@"netlisten_viewhide"]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"netlisten_viewhide1" object:nil userInfo:nil]; + + //退出实时模式 + [_option_intime.button setSelected:NO]; +} + + + + +-(void)onclick_min:(UIButton *)btn{ + + + _self_rect = self.frame;//记录最小化前的坐标 + [_option_clear setHidden:YES]; + + CGRect endRect = CGRectMake(_self_rect.origin.x, _self_rect.origin.y, _option.frame.size.width, _option.frame.size.height); + + [UIView animateWithDuration:0.2 animations:^{ + self.frame = endRect; + } completion:^(BOOL finished) { + self.frame = endRect; + + [_option_clear setHidden:NO]; + + + }]; + + +} + +-(void)onclick_min_end:(UIButton *)btn{ + + [UIView animateWithDuration:0.2 animations:^{ + self.frame = _self_rect; + } completion:^(BOOL finished) { + self.frame = _self_rect; + + }]; + +} + + + + + +#pragma clang diagnostic push +#pragma clang diagnostic ignored"-Wdeprecated-declarations" + +-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{ + + if (buttonIndex == 1) { + [BSNotification pushHandle:nil withName:@"netlisten_viewhide"]; + [[NSNotificationCenter defaultCenter]postNotificationName:@"netlisten_viewhide1" object:nil userInfo:nil]; + //退出实时模式 + [_option_intime.button setSelected:NO]; + + } + +} +#pragma clang diagnostic pop + +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + + UITouch *touch = [touches anyObject]; + CGPoint currentP = [touch locationInView:self]; +// NSLog(@"当前点击的位置:(%.2f,%.2f)",currentP.x,currentP.y); + + if (currentP.x > self.frame.size.width - 40 && currentP.y > self.frame.size.height - 40) { + _model = 1; +// NSLog(@"进入缩放状态"); + }else{ + _model = 0; +// NSLog(@"进入移动状态"); + } + +} + + +//(2)触摸移动 +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { +// if (!_isCanMove) { +// return; +// } + + if (_model == 0) { +// NSLog(@"改变位置"); + //获取终点 + self.userInteractionEnabled = NO; + + UITouch *touch = [touches anyObject]; + + //当前的point + CGPoint currentP = [touch locationInView:self]; + + //以前的point + CGPoint preP = [touch previousLocationInView:self]; + + //x轴偏移的量 + CGFloat offsetX = currentP.x - preP.x; + + //Y轴偏移的量 + CGFloat offsetY = currentP.y - preP.y; + + self.transform = CGAffineTransformTranslate(self.transform, offsetX, offsetY); + + self.userInteractionEnabled = YES; + + }else if(_model == 1){ + + //最大的情况下不给缩放 +// if ([_option_max.titleLabel.text isEqualToString:@"还原"]) { +// return; +// } + + //获取终点 + self.userInteractionEnabled = NO; + + UITouch *touch = [touches anyObject]; + + //当前的point + CGPoint currentP = [touch locationInView:self]; + + //以前的point + CGPoint preP = [touch previousLocationInView:self]; + + //x轴偏移的量 + CGFloat offsetX = currentP.x - preP.x; + + //Y轴偏移的量 + CGFloat offsetY = currentP.y - preP.y; + + //限制条件 + CGFloat tempWidth = self.frame.size.width + offsetX; + CGFloat tempHeight = self.frame.size.height +offsetY; + if (tempWidth < 165 || tempWidth > KScreenWidth || tempHeight < 150 || tempHeight > _sc_height) { + + self.userInteractionEnabled = YES; + return; + } + + + + self.frame = CGRectMake(self.frame.origin.x,self.frame.origin.y,self.frame.size.width + offsetX, self.frame.size.height +offsetY); + + + self.userInteractionEnabled = YES; + + } + + +} + +-(void)dealloc{ + + [BSNotification removeHandler:@"gwsdk_print"]; + +} + +#pragma mark - tableView代理方法 +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ + return _dataArr.count; +} + +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{ + + RealViewCellModel *tempModel = _dataArr[indexPath.row]; + if (tempModel.type == 0) { + return tempModel.rightCellHeight; + } + return 190; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ + + RealViewCellModel *tempModel = _dataArr[indexPath.row]; + tempModel.UI_leftStr = [NSString stringWithFormat:@"%d",(int)indexPath.row]; + if (tempModel.type == 0) { + static NSString *identifier = @"RealViewNetWorkCell_0"; + RealViewNetWorkCell_0 *cell = [tableView dequeueReusableCellWithIdentifier:identifier]; + if (!cell) + { + cell = [[RealViewNetWorkCell_0 alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier]; + } + cell.model = tempModel; + return cell; + } + + return nil; + +} + +-(BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath{ + return YES; +} +- (NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath { + @kWeakify(self) + UITableViewRowAction * deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"置頂" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) { + @kStrongify(self) + [ self.dataArr removeObjectAtIndex:indexPath.row]; + [self.tableView reloadData]; + }]; + deleteAction.title = @"刪除"; + deleteAction.backgroundColor = [UIColor redColor]; + return @[deleteAction]; +} +-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ + + + RealViewCellModel *tempModel = _dataArr[indexPath.row]; + if (tempModel.type == 0) { + BSRealTextView *textView = [[BSRealTextView alloc] init]; + textView.tempModel = tempModel; + textView.guid = tempModel.guid; + textView.number = tempModel.UI_leftStr; + [textView initData]; + [self addSubview:textView]; + [textView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_offset(30); + make.leading.mas_offset(0); + make.bottom.mas_offset(-30); + make.trailing.mas_offset(0); + }]; + textView.backgroundColor = [BS_UIColor stringTOColor:@"#f4f4f4"]; + } + +} + + + + + + +#pragma mark - 画图部分 +-(void)drawRect:(CGRect)rect{ + [super drawRect:rect]; + + if (_isCanMove) { + NSString *point1 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width - 15,self.frame.size.height]; + NSString *point2 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width ,self.frame.size.height - 15]; + NSString *point3 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width - 10,self.frame.size.height]; + NSString *point4 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width ,self.frame.size.height - 10]; + NSString *point5 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width - 5,self.frame.size.height]; + NSString *point6 = [NSString stringWithFormat:@"%.2f,%.2f",self.frame.size.width ,self.frame.size.height - 5]; + //放大缩小的线 + [BSDrawLine drawLinePoint:@[@[@"1",@"255",@"255",@"255",@"1"],@[point1,point2],@[point3,point4],@[point5,point6]] withContext:UIGraphicsGetCurrentContext() scan:1]; + } + +} + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.h new file mode 100644 index 00000000..d927f5c8 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.h @@ -0,0 +1,45 @@ +// +// RealViewCellModel.h +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import +#import + +@interface RealViewCellModel : NSObject +@property (nonatomic,assign) BOOL isSuccess; +@property (nonatomic,copy) id result; +@property (nonatomic,copy) NSString *url; +@property (nonatomic,copy) NSDictionary * header; +@property (nonatomic,copy) NSDictionary * backHeader; +@property (nonatomic,copy) NSDictionary * param; + +@property (nonatomic,copy) NSString *time1; +@property (nonatomic,copy) NSString *time2; + + + + + +@property(nonatomic,assign)int type;//0 +@property(nonatomic,strong)NSString *guid; + +@property(nonatomic,strong)NSString *UI_leftStr; +@property(nonatomic,assign)CGFloat leftFont; +@property(nonatomic,strong)UIColor *leftColor; + +@property(nonatomic,strong)NSString *UI_centerStr; +@property(nonatomic,assign)CGFloat centerFont; +@property(nonatomic,strong)UIColor *centerColor; + + +@property(nonatomic,strong)NSString *UI_rightStr; +@property(nonatomic,assign)CGFloat rightFont; +@property(nonatomic,strong)UIColor *rightColor; +@property(nonatomic,assign)CGFloat rightCellHeight;//实际的高度 + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.m new file mode 100644 index 00000000..eb19e5f2 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/model/RealViewCellModel.m @@ -0,0 +1,13 @@ +// +// RealViewCellModel.m +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import "RealViewCellModel.h" + +@implementation RealViewCellModel + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.h new file mode 100644 index 00000000..668f24d0 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.h @@ -0,0 +1,21 @@ +// +// RealViewNetWorkCell_0.h +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import +#import "RealViewCellModel.h" + +@interface RealViewNetWorkCell_0 : UITableViewCell + +@property(nonatomic,strong)RealViewCellModel *model; + +@property(nonatomic,strong)UILabel *leftLable; +@property(nonatomic,strong)UILabel *centerLable; +@property(nonatomic,strong)UILabel *rightLable; + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.m new file mode 100644 index 00000000..93bb088e --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/RealTime(实时)/view/RealViewNetWorkCell_0.m @@ -0,0 +1,154 @@ +// +// RealViewNetWorkCell_0.m +// TextSdk +// +// Created by xiaowen on 2017/9/22. +// Copyright © 2017年 gatawang.com. All rights reserved. +// + +#import "RealViewNetWorkCell_0.h" +#import "Masonry.h" +#import "BS_UIColor.h" + +@implementation RealViewNetWorkCell_0 + + +-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{ + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + self.contentView.userInteractionEnabled = YES; + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self initUI]; + } + return self; +} + +-(void)initUI{ + + + + + _rightLable = [[UILabel alloc] init]; + [self addSubview:_rightLable]; + [_rightLable mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self); + make.leading.mas_offset(35); + make.trailing.mas_offset(-10); + make.height.mas_offset(35); + }]; + _rightLable.textAlignment = NSTextAlignmentRight; + _rightLable.text = @"openapi/jfidnfdinfdnfd/fdinfidfndf/nfidjfidjfdijf"; + _rightLable.lineBreakMode = NSLineBreakByTruncatingHead; + + _leftLable = [[UILabel alloc] init]; + [self addSubview:_leftLable]; + [_leftLable mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.equalTo(self.contentView); + make.leading.mas_offset(5); + make.width.mas_offset(20); + make.height.mas_offset(20); + }]; + _leftLable.textAlignment = NSTextAlignmentCenter; + _leftLable.layer.cornerRadius = 10; + _leftLable.layer.masksToBounds = YES; + _leftLable.layer.borderWidth = 0.5; + _leftLable.backgroundColor = [UIColor redColor]; +// _leftLable.text = @"100"; + + + _centerLable = [[UILabel alloc] init]; + [self addSubview:_centerLable]; + [_centerLable mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.equalTo(_rightLable); + make.leading.equalTo(_leftLable.mas_trailing).mas_offset(5); + make.width.mas_offset(0); + make.height.mas_offset(35); + }]; + _centerLable.textAlignment = NSTextAlignmentCenter; +// _centerLable.text = @"请求..."; + + + +} + +-(void)setModel:(RealViewCellModel *)model{ + + _model = model; + _leftLable.text = model.UI_leftStr; + if (model.leftFont != 0) { + _leftLable.font = [UIFont systemFontOfSize:model.leftFont] ; + }else{ + _leftLable.font = [UIFont systemFontOfSize:12]; + } + if (model.leftColor != nil) { + _leftLable.textColor = model.leftColor; + _leftLable.layer.borderColor = model.leftColor.CGColor; + }else{ + _leftLable.textColor = [BS_UIColor stringTOColor:@"#181818"]; + _leftLable.layer.borderColor = [BS_UIColor stringTOColor:@"#181818"].CGColor; + } + +// _centerLable.text = model.UI_centerStr; +// //中间的描述 +// if (model.centerFont != 0) { +// _centerLable.font = AUTOADAPFont(model.centerFont]; +// }else{ +// _centerLable.font = AUTOADAPFont(12]; +// } +// if (model.centerColor != nil) { +// _centerLable.textColor = model.centerColor; +// }else{ +// _centerLable.textColor = [BS_UIColor stringTOColor:@"#181818"]; +// } + + //右边的描述 + if ([model.UI_rightStr isKindOfClass:[NSNull class]]) { + model.UI_rightStr = @""; + } + _rightLable.text = model.UI_rightStr; + if (model.rightFont != 0) { + _rightLable.font = [UIFont systemFontOfSize:model.rightFont] ; + }else{ + _rightLable.font = [UIFont systemFontOfSize:12]; + } + if (model.leftColor != nil) { + _rightLable.textColor = model.rightColor; + }else{ + _rightLable.textColor = [BS_UIColor stringTOColor:@"#676767"]; + } + + if ([model.UI_centerStr isEqualToString:@"0"]) { + + UIColor *redCor = [BS_UIColor stringTOColor:@"#ff2d2d"];; + _rightLable.textColor = redCor; + _leftLable.textColor = redCor; + _leftLable.layer.borderColor = redCor.CGColor; + } + + model.rightCellHeight = 40; + + UIView *view = [[UIView alloc] init]; + [self.contentView addSubview:view]; + [view mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_offset(-1); + make.leading.mas_offset(5); + make.trailing.mas_offset(-5); + make.height.mas_offset(0.5); + }]; + view.backgroundColor = [BS_UIColor stringTOColor:@"#f0f0f0"]; + +} + + + +- (void)awakeFromNib { + [super awakeFromNib]; + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated { + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.h new file mode 100644 index 00000000..6d47d3c3 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.h @@ -0,0 +1,29 @@ +// +// SelectView.h +// lianxi +// +// Created by 陈奕智 on 16/7/7. +// Copyright © 2016年 chenyizhi. All rights reserved. +// + +#import + +@interface BSSelectView : UIView +/** + * 按钮 + */ +@property (nonatomic, strong) UIButton *button; +/** + * 标签 + */ +@property (nonatomic, strong) UILabel *label; + + +/** + * title,detail 显示文字 + * sender,selector 按钮添加点击方法参数 + */ +-(void)setTitle:(NSString*)title detail:(NSString*)detail sender:(id)sender selector:(SEL)selector; + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.m new file mode 100644 index 00000000..16950442 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/BSSelectView.m @@ -0,0 +1,71 @@ +// +// SelectView.m +// lianxi +// +// Created by 陈奕智 on 16/7/7. +// Copyright © 2016年 chenyizhi. All rights reserved. +// + +#import "BSSelectView.h" +#import "Masonry.h" + +static int const FONTSIZE = 14; + + +@implementation BSSelectView + + +-(instancetype)init{ + self = [super init]; + if (self) { + + self.button = [[UIButton alloc]init]; + [self addSubview:self.button]; + [self.button setImage:[UIImage imageNamed:@"pay_off"] forState:UIControlStateNormal]; + [self.button setImage:[UIImage imageNamed:@"pay_on"] forState:UIControlStateSelected]; + + + [self.button mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.equalTo(self).offset(0); + make.top.equalTo(self).offset(0); + make.width.mas_equalTo(12); + make.height.mas_equalTo(12); + }]; + + self.label = [[UILabel alloc]init]; + [self addSubview:self.label]; + + [self.label mas_makeConstraints:^(MASConstraintMaker *make) { + make.leading.equalTo(self).offset(12); + make.bottom.equalTo(self).offset(-4); + make.width.mas_equalTo(40); + }]; + + + + } + return self; +} + + +-(void)setTitle:(NSString *)title detail:(NSString *)detail sender:(id)sender selector:(SEL)selector { + NSInteger len1 = title.length; + NSInteger len2 = detail.length; + NSMutableAttributedString *attStr = [[NSMutableAttributedString alloc]initWithString:[NSString stringWithFormat:@"%@%@", title, detail]]; + [attStr addAttribute:NSFontAttributeName value:[UIFont systemFontOfSize:FONTSIZE weight:UIFontWeightBold] range:NSMakeRange(0, len1)]; + [attStr addAttribute:NSFontAttributeName value:[UIFont italicSystemFontOfSize:FONTSIZE-2] range:NSMakeRange(len1, len2)]; + [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(0, len1)]; + [attStr addAttribute:NSForegroundColorAttributeName value:[UIColor whiteColor] range:NSMakeRange(len1, len2)]; + self.label.attributedText = attStr; + + + [self.button addTarget:sender action:selector forControlEvents:UIControlEventTouchUpInside]; +} + + +-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ + [self.button sendActionsForControlEvents:UIControlEventTouchUpInside]; +} + + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off.png b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off.png new file mode 100755 index 0000000000000000000000000000000000000000..7ef6aaeacb6d67932324ed6edd3175fafe969d70 GIT binary patch literal 242 zcmVnU?gpyGp{4G?vBBot%At=K`VWs= z<$>RMK+d98f*??m78V%6M2-VCctU9zI=Cal05!RpJa?cBw6Vn)F^W8}!U=nHHMN9~ z7~c}Z$K0TX=;L2@xM-@5v}ByZ)YJ>jl5qpMrjD4DjHieUYKVgg8%>k literal 0 HcmV?d00001 diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@2x.png b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..6a628e5c6173782cf1938f5260d89e668315dda8 GIT binary patch literal 483 zcmV<90UZ8`P)Q-=6b zQiDyEgTjHJENQV$4ToCn`YrLGJoxhTfouJ8Pxr54baZr2N{8s?5=|WD4=WUT&KTd> z)Lu4LO+R<3CE0!ofy)f=fQOX%S0%|Bc*`KQ%+N<8Re?tOn4y*d7HCL&ah`edEOCoD zHdZ7&qJt4mGEXZj$ro2MPM%ksVUDeuqlK5`8RtN9_%_WfbA_L5w_jXkiDqmWrjGlp z(?f}!R-%V>?ok)R-Q<|&HM{K%)8y!m;fqAi$W&sZD~3-K&62elqEj(kPxOhbeI}}p z;on46{I@DuB|1vhjuCx};bo$8WbHiByBK~!bc0MKHYQ_uj1rxkWw*7`Nr|x-USo&~ z9+P9I<#<8`L#)McG|UH1FhLF5t%eB-EHa$@gvwm!EA1@M!B%y!Ks#T!Mmaeg6=`FU z0<%of%W?K`kOI9-F`Ia48^yHK^pO_&xx)oW?MKRKGQ7DmgN$&KE}A$(w90!Xd75@i Z{{l04WC0}LC`AAO002ovPDHLkV1lOf)JXsU literal 0 HcmV?d00001 diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@3x.png b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_off@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..6c717f2d78a3d2ce61ae49f84a3cd5fe7d5501a5 GIT binary patch literal 709 zcmV;$0y_PPP)$09LI4xWFx}Tz{+mRLClP&-8MaTj6qef?6&mQL4`3JPc95pP*^)}F)C~`?of5R zXmWBe3Oguh^`sYD>MkAVVI3|J8s?>bp2HtXwOv~K<_jMJIsHfu&-=VXb8~Y~?V#hl z%yFLQ5W{qM$Pz#D4Lopenh!Q*LIT|c7 zzMByTxJsKMQHL8$P^Q2T1j60rV&37 zonjE3BKkg!xI=V?99fp*4AGr5Vu58+!<-|_CMl3wW+4u+I?>w{$f5%85Pi7u6#a}9 zQiu73Ec%$kq*iEd9MPjnbe0->S&a%&m0pa9+FU2P%tiL1i(DqUPJ62d-3xq6YKU3B zV1(T?!spB~MCv=<*zRfjZ(ijtQH5n{JVQU_sIklh(Oq8Q@m3?EE@NCHDlo(EG^ucu zJgGcKsnFyPW+)I{V~lRU7vjgf&TZ-xNewdzeYe7!w03(TZc}EOd+elpOjD-ye_svs rXu!YTPmGYK%PLF!#BCN>=ZXCT;@^~?h|v>~00000NkvXXu0mjfOa4Oo literal 0 HcmV?d00001 diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_on.png b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/component(组件)/pay_on.png new file mode 100644 index 0000000000000000000000000000000000000000..ac4d8f2737ff41f8c30784920be1b9efb32c8f14 GIT binary patch literal 485 zcmVW|jyZn8VGJL4NDh<>oVee*uv`@RncL4XW2RzAz^H7hHgh6W?7 zwO~=0(c}Tvq+>Ybka&xWa$DhS@TKzp;&|@ef~lrA?`CdzOe1}s%Th4qKW_9Eo^2nv zqdL)aN#VR%j!&*Ge!ls}5wlwY&PlpV6h;3)WBAaO zoQfFiB}5Uy?R3_qioaGQ|BtH;{}s(G7a_$7#50^bSX@8)>udwebs;JQDIim0d#4N1 zp3J0`^^D3P1J`$RB0roNUwsLw_(nUNT`FWw^VH6AV}AG2b+}N61s52k-;yl4ZAowI z-00fl*xr383Q@z7#j2YedjwuqMd9}f*0jYC0DhiI7Plmtu5szTg4P)}YCP!nw{PC`XR2~BCt)MVODJ4wuZ+>hh)5{iRP;w*gN7cS?#=a+X5_nxCB zCMK{$`pB~+O@>J?k*tv)NS2%@c{GTPf5##x$#K$&zvB~0KM|fIr^q;YhxogR2gn(~ zq!cuC;7r+mcoI-w0k}>i3C@ptRy7l7_lQC8Cg%?Uc!?}G67M751ExzGXF>a+H?|^$ z>HMBc@U1Geu^~yr!b2zYS9|X!xQ9cjgQL@7Swy>IpD3l*m{X_O~&I&hHG?uy?f!+`$T z3PNL75>w@?@h{hMa>x2QU$Id0>OxX4ivj}fqgPi}SmirejrmhHE^UoYKFZU>?FHliz* zYj1(goyB(2B2E%1xVRddho>u#upo&hV-O@AuXR6>=Sz^#DdJvY3{0M#g3N?V7jVJ}x=UHVK|d97Dt>kq(JZlAcws)%z0 zp016=i$k!3$d4?}p~)!doNI4hCh|N237sOIA@FteSXb#mbgmEj>|DP8rnGG6?Y6Cc zpRcHNe+=8niuhBq$-yyxb*cUvBd9tX*_yL)LK%&nB6Ctxb=If$77ilpcBG8*(&8eY z$;tv5XDKS7(noFO{+5TXy@+VJ`}CiY!ckwlvqZXqAkQ);b5bLd>yw z35d}0d~C<6dtpj-SCjW&cb-q)A|I1XgUj>}lB>H+SI{7T0jbKB1bYsa!{}~ex-wM#+kB3OxJVtbDSFH(j#=y zPs4mhEaN1-R1=MIhCS3$pqv7=?BNWfMAh_gl4Y~K9hLO5h3F3N(ZOBvMiT}&M+>dI zMuAi_H8e0b-H4_1WCPCg3L}*LxcbrDZA&=F zRaRx!+0QVkYW5c2j#i>~_?u`c7ud*L+QX=V;9L=uR z%_ylF>e7hqM4vKFR80#DsfD#f<9tH2J&kyR=yJBYiN!3W#k@#ymx-QCBOWEXPI22P zMNd=QPeiq8#7d&yDQ+F5XaiAxPE{IFNi;@r29~4;v)epIw0u$a8w_NBF) z=$}Q|K@U;fZ zC4Wj<%M0w_VX7G62A^@Bo7v&1L$nh;Pj5aVb&8kBpE0A^KIoQZwb4#Fsnay0Y=o9_ znWu=((aH#UX;gk_aaFv}9-^ykV`8e8pL;yZ6{1E4Im81LH`Ra&4l$SwxWW!5W_kk~ zqn=Yl1={(8ZW>unC8}4jL3-xuZ|*ni!O_?W+a{_6k$002ovPDHLk FV1jw+yZZnD literal 0 HcmV?d00001 diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.h b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.h new file mode 100644 index 00000000..45afa6b9 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.h @@ -0,0 +1,50 @@ +// +// BSRecordModel.h +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/18. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + + +@interface BSRecordModel : NSObject + +//类型编码 +@property (nonatomic, assign) int coding; + +//关键字 +@property (nonatomic, strong) NSString *keyword; + +//描述 +@property (nonatomic, strong) NSString *describe; + +//描述2 +@property (nonatomic, strong) NSString *describe2; + +//操作编码 +@property (nonatomic, assign) int optionCoding; + +//唯一标示 +@property (nonatomic, strong) NSString *onlySign; + + +//时间 +@property (nonatomic, strong) NSString *time; + +//详细时间 +@property (nonatomic, strong) NSString *time2; + +//结果 +@property (nonatomic, strong) NSString *result; +//结果2 +@property (nonatomic, strong) NSString *result2; + + + ++(BSRecordModel *)recordModelWith:(int)coding keyword:(NSString *)keyword describe:(NSString *)describe option:(int)option; + ++(NSString *)getStringWithDate:(NSDate *)date format:(NSString *)format; + +@end diff --git a/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.m b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.m new file mode 100644 index 00000000..31939186 --- /dev/null +++ b/YuMi/Tools/sdkContent/content/NetListen(网络监听)/model/BSRecordModel.m @@ -0,0 +1,89 @@ +// +// RecordModel.m +// GWTestSDK +// +// Created by xiaowen.chen on 16/8/18. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSRecordModel.h" + +@implementation BSRecordModel +// +-(NSDictionary *)getAttribute{ + + return @{ + @"coding":@"INTEGER", + @"keyword":@"TEXT", + @"describe":@"TEXT", + @"describe2":@"TEXT", + @"optionCoding":@"INTEGER", + @"time":@"DATETIME", + @"time2":@"DATETIME", + @"onlySign":@"TEXT", + @"result":@"TEXT", + @"result2":@"TEXT" + }; + +} + + ++(BSRecordModel *)recordModelWith:(int)coding keyword:(NSString *)keyword describe:(NSString *)describe option:(int)option{ + if([keyword rangeOfString:@","].location !=NSNotFound) + { + keyword = @"不合法的keyword"; + } + if([describe rangeOfString:@","].location !=NSNotFound) + { + describe = @"不合法的describe"; + } + + BSRecordModel *recordModel = [[BSRecordModel alloc] init]; + recordModel.coding = coding; + recordModel.keyword = keyword; + recordModel.describe = describe; + recordModel.optionCoding = option; + recordModel.time = [self getStringWithDate:nil format:nil]; + + return recordModel; +} + ++(NSString *)getStringWithDate:(NSDate *)date format:(NSString *)format +{ + if (date == nil) { + date = [NSDate date]; + } + if (format == nil) { + format = @"yyyyMMdd HH:mm:ss.SSS"; + } + NSDateFormatter *formatter = [[NSDateFormatter alloc]init]; + [formatter setDateFormat:format]; + return [formatter stringFromDate:date]; +} + +-(NSString *)description{ + return [NSString stringWithFormat:@"%d,[%@],%@,%@,%d\n",_coding,[_time substringWithRange:NSMakeRange(9, 8)],_keyword,_describe,_optionCoding]; +} + + +-(id)copy{ + BSRecordModel *resultId = [[BSRecordModel alloc] init]; + resultId.coding = _coding; + resultId.keyword = _keyword; + resultId.describe = _describe; + resultId.describe2 = _describe2; + resultId.optionCoding = _optionCoding; + resultId.onlySign = _onlySign; + resultId.time = _time; + resultId.time2 = _time2; + resultId.result = _result; + resultId.result2 = _result2; + + return resultId; +} + +-(void)setValue:(id)value forUndefinedKey:(NSString *)key{ + +} + +@end diff --git a/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.h b/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.h new file mode 100644 index 00000000..e5830edc --- /dev/null +++ b/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.h @@ -0,0 +1,132 @@ +// +// XWNotification.h +// BaseProject +// +// Created by xiaowen.chen on 16/7/19. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import + + +enum{ + //简单的消息 + NFMessageType_Simple, + //api消息 + NFMessageType_API, + //主题消息 + NFMessageType_Theme, + //自定义消息 + NFMessageType_Custom + +}typedef NFMessageType; + + +typedef void(^GWHandleOption)(NFMessageType type,NSString *key,NSObject *value); +typedef NSDictionary *(^GWSingleHandleOption)(NSDictionary *handleDic); + +@interface BSNotification : NSObject + + +/** + 添加处理方法,在viewdeload或者viewwillAppear里面添加,object对象的地址h加key确定唯一性 + + @param block 回调方法块 + @param handleName 处理标识名 + @param object 对象实例 + */ ++(void)addHandler:(GWHandleOption)block withName:(NSString *)handleName andObject:(NSObject *)object; + +/** + 移除处理方法,在dealloc或者viewwillDisAppear里面移除,object对象的地址加key确定唯一性 + + @param handleName 处理标识名 + @param object 对象实例 + */ ++(void)removeHandler:(NSString *)handleName andObject:(NSObject *)object; + +/** + 添加处理方法,在viewdeload或者viewwillAppear里面添加,添加重复的name无效 + + @param block 回调方法块 + @param handleName 处理标识名 + */ ++(void)addHandler:(GWHandleOption)block withName:(NSString *)handleName; + + +/** + 移除处理方法,在dealloc或者viewwillDisAppear里面移除 + + @param name 处理标识名 + */ ++(void)removeHandler:(NSString *)name; + + +/** + 推送消息-简化版本 + + @param handleDic 参数字典 + @param handleName 处理标识名 + */ ++(void)pushHandle:(NSDictionary *)handleDic withName:(NSString *)handleName; + +/** + 推送消息-简化版本 + + @param type 消息类型 + @param key key + @param value 结果对象 + @param handleName 处理标识名 + */ ++(void)pushHandle:(NFMessageType)type withKey:(NSString *)key value:(NSObject *)value withName:(NSString *)handleName; + +/** + 获取所有的注册信息,调试的时候用 + + @return 处理标识名数组 + */ ++(NSMutableDictionary *)getHandleDic; + + +#pragma mark - 有返回值的做法,可以用在一个页面向另外一个页面取值,要求是1对1,不然会出异常 +/** + 添加一个唯一的处理方法 + + @param block 回调方法块 + @param handleName 处理标识名 + */ ++(void)addSingleHandler:(GWSingleHandleOption)block withName:(NSString *)handleName; + +/** + 触发唯一的处理方法,并且从唯一的处理方法中获取结果 + + @param handleDic 参数字典 + @param handleName 处理标识名 + @return 结果字典 + */ ++(NSDictionary *)getResultFromSingleHandle:(NSDictionary *)handleDic withName:(NSString *)handleName; + + +#pragma mark - 批量移除的方法 + + +/** + 移除所有 + */ ++(void)removeAllHandle; + +/** + 移除所有不是指定字符串开头的 + + @param str 指定字符串 + */ ++(void)removeHandleNotInclude:(NSString *)str; + +/** + 移除所有指定字符串开头的 + + @param str 指定字符串 + */ ++(void)removeHandleInclude:(NSString *)str; + +@end diff --git a/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.m b/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.m new file mode 100644 index 00000000..0e138f9f --- /dev/null +++ b/YuMi/Tools/sdkContent/content/XWNotification(通知)/BSNotification.m @@ -0,0 +1,193 @@ + // +// XWNotification.m +// BaseProject +// +// Created by xiaowen.chen on 16/7/19. +// Copyright © 2016年 xw.com. All rights reserved. +// + +#import "BSNotification.h" + +@implementation BSNotification + + +static NSMutableDictionary *bs_handlerDic = nil; +static NSObject *bs_lock_obj = nil; + +static NSString *objectSplit = @"_obj_"; +#pragma mark - 添加处理方法(根据key进行分组,object地址区分不同的实例) ++(void)addHandler:(GWHandleOption)block withName:(NSString *)handleName andObject:(NSObject *)object{ + handleName = [NSString stringWithFormat:@"%@%@%p",handleName,objectSplit,object]; + [self addHandler:block withName:handleName]; +} +#pragma mark - 移除处理方法(根据key进行分组,object地址区分不同的实例) ++(void)removeHandler:(NSString *)handleName andObject:(NSObject *)object{ + handleName = [NSString stringWithFormat:@"%@%@%p",handleName,objectSplit,object]; + [self removeHandler: handleName]; +} + + +#pragma mark - 添加处理方法 ++(void)addHandler:(GWHandleOption)block withName:(NSString *)handleName{ + + [self checkClass]; + @synchronized (bs_lock_obj) { + Boolean ishave = NO; + for (NSString *tempStr in [bs_handlerDic allKeys]) { + if ([tempStr isEqualToString:handleName]) { + ishave = YES; + break; + } + } + if (ishave) { + [bs_handlerDic removeObjectForKey:handleName]; + } + [bs_handlerDic setObject:block forKey:handleName]; + } +} + + + +#pragma mark - 移除处理方法 ++(void)removeHandler:(NSString *)name{ + + [self checkClass]; + @synchronized (bs_lock_obj) { + for (NSString *key in [bs_handlerDic allKeys]) { + if ([key isEqualToString:name]) { + [bs_handlerDic removeObjectForKey:key]; + } + } + } +} + + + +#pragma mark - 推送处理-简化版本 ++(void)pushHandle:(NSDictionary *)handleDic withName:(NSString *)handleName{ + + return [self pushHandle:NFMessageType_Simple withKey:@"BSdefaultKey" value:handleDic withName:handleName]; +} + +#pragma mark - 推送处理 ++(void)pushHandle:(NFMessageType)type withKey:(NSString *)key value:(NSObject *)value withName:(NSString *)handleName{ + [self checkClass]; + + @synchronized (bs_lock_obj) { + for (NSString *temp in [bs_handlerDic allKeys]) { + if ([temp hasPrefix:handleName]) { + GWHandleOption option = (GWHandleOption)[bs_handlerDic objectForKey:temp]; + if (option) { + option(type,key,value); + } + } + } + } +} + ++(NSMutableDictionary *)getHandleDic{ + return bs_handlerDic; +} + +#pragma mark - 有返回值的做法,可以用在一个页面向另外一个页面取值,要求是1对1,不然会出异常 + +/* + * 添加一个唯一的处理方法 + */ ++(void)addSingleHandler:(GWSingleHandleOption)block withName:(NSString *)handleName{ + + [self checkClass]; + + @synchronized (bs_lock_obj) { + Boolean ishave = NO; + for (NSString *tempStr in [bs_handlerDic allKeys]) { + if ([tempStr isEqualToString:handleName]) { + ishave = YES; + break; + } + } + if (ishave) { + [bs_handlerDic removeObjectForKey:handleName]; + } + + [bs_handlerDic setObject:block forKey:handleName]; + } +} +/* + * 触发唯一的处理方法,并且从唯一的处理方法中获取结果 + */ ++(NSDictionary *)getResultFromSingleHandle:(NSDictionary *)handleDic withName:(NSString *)handleName{ + + [self checkClass]; + + @synchronized (bs_lock_obj) { + for (NSString *temp in [bs_handlerDic allKeys]) { + if ([temp isEqualToString:handleName]) { + GWSingleHandleOption option = (GWSingleHandleOption)[bs_handlerDic objectForKey:temp]; + if (option) { + return option(handleDic); + } + } + } + } + return nil; +} + +#pragma mark - 批量移除的方法 +/* + * 移除所有 + */ ++(void)removeAllHandle{ + [self checkClass]; + @synchronized (bs_lock_obj) { + + [bs_handlerDic removeAllObjects]; + } +} +/* + * 移除所有不是指定字符串开头的 + */ ++(void)removeHandleNotInclude:(NSString *)str{ + [self checkClass]; + @synchronized (bs_lock_obj) { + NSMutableArray *resultArr = [NSMutableArray array]; + for (NSString *temp in [bs_handlerDic allKeys]) { + if ([temp hasPrefix:str]) { + [resultArr addObject:temp]; + } + } + for(NSString *temp in resultArr){ + [bs_handlerDic removeObjectForKey:temp]; + } + } +} +/* + * 移除所有指定字符串开头的 + */ ++(void)removeHandleInclude:(NSString *)str{ + [self checkClass]; + @synchronized (bs_lock_obj) { + + NSMutableArray *resultArr = [NSMutableArray array]; + for (NSString *temp in [bs_handlerDic allKeys]) { + if (![temp hasPrefix:str]) { + [resultArr addObject:temp]; + } + } + for(NSString *temp in resultArr){ + [bs_handlerDic removeObjectForKey:temp]; + } + } +} + ++(void)checkClass{ + if (bs_lock_obj == nil) { + bs_lock_obj = [[NSObject alloc] init]; + } + if (bs_handlerDic == nil) { + bs_handlerDic = [NSMutableDictionary dictionary]; + } +} + + +@end