提交tool工具类

This commit is contained in:
linyudan
2023-12-12 14:50:44 -08:00
parent 697d3cfe40
commit ae24bfd582
17 changed files with 1316 additions and 198 deletions

View File

@@ -710,6 +710,11 @@
8C2C3F202B2801AC002C3C34 /* DDStatisticsService.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */; }; 8C2C3F202B2801AC002C3C34 /* DDStatisticsService.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */; };
8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */; }; 8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */; };
8C2C3F272B2803CA002C3C34 /* DDSpriteSheeImagetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */; }; 8C2C3F272B2803CA002C3C34 /* DDSpriteSheeImagetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */; };
8C2C3F2B2B28CDEF002C3C34 /* DDDate.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F2A2B28CDEF002C3C34 /* DDDate.m */; };
8C2C3F2E2B28D8B7002C3C34 /* DDTimeUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F2D2B28D8B7002C3C34 /* DDTimeUtil.m */; };
8C2C3F322B28DD95002C3C34 /* NSDate+DDDateUtils.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F312B28DD95002C3C34 /* NSDate+DDDateUtils.m */; };
8C2C3F362B28DDCE002C3C34 /* NSCalendar+DDPick.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F352B28DDCE002C3C34 /* NSCalendar+DDPick.m */; };
8C2C3F3A2B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F392B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m */; };
8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; }; 8CE493992B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */; };
8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; }; 8CE4939C2B23F45C00CA14D5 /* NSArray+DDSafe.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939B2B23F45C00CA14D5 /* NSArray+DDSafe.m */; };
8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; }; 8CE493A02B23F5FA00CA14D5 /* DDUploadFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 8CE4939F2B23F5FA00CA14D5 /* DDUploadFile.m */; };
@@ -2010,11 +2015,8 @@
8C2C3F102B27ECEE002C3C34 /* DDCarrierIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCarrierIdentifier.h; sourceTree = "<group>"; }; 8C2C3F102B27ECEE002C3C34 /* DDCarrierIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDCarrierIdentifier.h; sourceTree = "<group>"; };
8C2C3F112B27ED3C002C3C34 /* DDUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDUtility.h; sourceTree = "<group>"; }; 8C2C3F112B27ED3C002C3C34 /* DDUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDUtility.h; sourceTree = "<group>"; };
8C2C3F122B27ED3C002C3C34 /* DDUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDUtility.m; sourceTree = "<group>"; }; 8C2C3F122B27ED3C002C3C34 /* DDUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDUtility.m; sourceTree = "<group>"; };
8C2C3F142B27ED7C002C3C34 /* DDUtility+App.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DDUtility+App.h"; sourceTree = "<group>"; };
8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+App.m"; sourceTree = "<group>"; }; 8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+App.m"; sourceTree = "<group>"; };
8C2C3F172B27F10D002C3C34 /* DDUtility+Device.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DDUtility+Device.h"; sourceTree = "<group>"; };
8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+Device.m"; sourceTree = "<group>"; }; 8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+Device.m"; sourceTree = "<group>"; };
8C2C3F1A2B27FE43002C3C34 /* DDUtility+Carrier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DDUtility+Carrier.h"; sourceTree = "<group>"; };
8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+Carrier.m"; sourceTree = "<group>"; }; 8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "DDUtility+Carrier.m"; sourceTree = "<group>"; };
8C2C3F1E2B2801AC002C3C34 /* DDStatisticsService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDStatisticsService.h; sourceTree = "<group>"; }; 8C2C3F1E2B2801AC002C3C34 /* DDStatisticsService.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDStatisticsService.h; sourceTree = "<group>"; };
8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDStatisticsService.m; sourceTree = "<group>"; }; 8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDStatisticsService.m; sourceTree = "<group>"; };
@@ -2022,6 +2024,16 @@
8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDStatisticsServiceHelper.m; sourceTree = "<group>"; }; 8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDStatisticsServiceHelper.m; sourceTree = "<group>"; };
8C2C3F252B2803CA002C3C34 /* DDSpriteSheeImagetManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDSpriteSheeImagetManager.h; sourceTree = "<group>"; }; 8C2C3F252B2803CA002C3C34 /* DDSpriteSheeImagetManager.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDSpriteSheeImagetManager.h; sourceTree = "<group>"; };
8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDSpriteSheeImagetManager.m; sourceTree = "<group>"; }; 8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDSpriteSheeImagetManager.m; sourceTree = "<group>"; };
8C2C3F292B28CDEF002C3C34 /* DDDate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDDate.h; sourceTree = "<group>"; };
8C2C3F2A2B28CDEF002C3C34 /* DDDate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDDate.m; sourceTree = "<group>"; };
8C2C3F2C2B28D8B7002C3C34 /* DDTimeUtil.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDTimeUtil.h; sourceTree = "<group>"; };
8C2C3F2D2B28D8B7002C3C34 /* DDTimeUtil.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDTimeUtil.m; sourceTree = "<group>"; };
8C2C3F302B28DD95002C3C34 /* NSDate+DDDateUtils.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSDate+DDDateUtils.h"; sourceTree = "<group>"; };
8C2C3F312B28DD95002C3C34 /* NSDate+DDDateUtils.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSDate+DDDateUtils.m"; sourceTree = "<group>"; };
8C2C3F342B28DDCE002C3C34 /* NSCalendar+DDPick.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSCalendar+DDPick.h"; sourceTree = "<group>"; };
8C2C3F352B28DDCE002C3C34 /* NSCalendar+DDPick.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSCalendar+DDPick.m"; sourceTree = "<group>"; };
8C2C3F382B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "YYAnimatedImageView+ShowImage.h"; sourceTree = "<group>"; };
8C2C3F392B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "YYAnimatedImageView+ShowImage.m"; sourceTree = "<group>"; };
8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; 8CAB97312B2259EA00ED8639 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; }; 8CE493972B23F44800CA14D5 /* NSMutableDictionary+DDSafe.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSMutableDictionary+DDSafe.h"; sourceTree = "<group>"; };
8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; }; 8CE493982B23F44800CA14D5 /* NSMutableDictionary+DDSafe.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSMutableDictionary+DDSafe.m"; sourceTree = "<group>"; };
@@ -5036,6 +5048,9 @@
8C2C3ED82B279208002C3C34 /* DDCategory */ = { 8C2C3ED82B279208002C3C34 /* DDCategory */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8C2C3F372B28E213002C3C34 /* YYAnimatedImageView */,
8C2C3F332B28DDB9002C3C34 /* NSCalendar */,
8C2C3F2F2B28DD74002C3C34 /* NSDate */,
8C2C3EF02B27D1D7002C3C34 /* NSObject */, 8C2C3EF02B27D1D7002C3C34 /* NSObject */,
8C2C3EDB2B279265002C3C34 /* NSString */, 8C2C3EDB2B279265002C3C34 /* NSString */,
8C2C3EDA2B27924E002C3C34 /* NSArray */, 8C2C3EDA2B27924E002C3C34 /* NSArray */,
@@ -5124,11 +5139,8 @@
8C2C3F102B27ECEE002C3C34 /* DDCarrierIdentifier.h */, 8C2C3F102B27ECEE002C3C34 /* DDCarrierIdentifier.h */,
8C2C3F112B27ED3C002C3C34 /* DDUtility.h */, 8C2C3F112B27ED3C002C3C34 /* DDUtility.h */,
8C2C3F122B27ED3C002C3C34 /* DDUtility.m */, 8C2C3F122B27ED3C002C3C34 /* DDUtility.m */,
8C2C3F142B27ED7C002C3C34 /* DDUtility+App.h */,
8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */, 8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */,
8C2C3F172B27F10D002C3C34 /* DDUtility+Device.h */,
8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */, 8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */,
8C2C3F1A2B27FE43002C3C34 /* DDUtility+Carrier.h */,
8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */, 8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */,
); );
path = DDUtility; path = DDUtility;
@@ -5154,9 +5166,48 @@
path = DDSpriteSheetManager; path = DDSpriteSheetManager;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
8C2C3F282B28CDBC002C3C34 /* DDDate */ = {
isa = PBXGroup;
children = (
8C2C3F292B28CDEF002C3C34 /* DDDate.h */,
8C2C3F2A2B28CDEF002C3C34 /* DDDate.m */,
8C2C3F2C2B28D8B7002C3C34 /* DDTimeUtil.h */,
8C2C3F2D2B28D8B7002C3C34 /* DDTimeUtil.m */,
);
path = DDDate;
sourceTree = "<group>";
};
8C2C3F2F2B28DD74002C3C34 /* NSDate */ = {
isa = PBXGroup;
children = (
8C2C3F302B28DD95002C3C34 /* NSDate+DDDateUtils.h */,
8C2C3F312B28DD95002C3C34 /* NSDate+DDDateUtils.m */,
);
path = NSDate;
sourceTree = "<group>";
};
8C2C3F332B28DDB9002C3C34 /* NSCalendar */ = {
isa = PBXGroup;
children = (
8C2C3F342B28DDCE002C3C34 /* NSCalendar+DDPick.h */,
8C2C3F352B28DDCE002C3C34 /* NSCalendar+DDPick.m */,
);
path = NSCalendar;
sourceTree = "<group>";
};
8C2C3F372B28E213002C3C34 /* YYAnimatedImageView */ = {
isa = PBXGroup;
children = (
8C2C3F382B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.h */,
8C2C3F392B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m */,
);
path = YYAnimatedImageView;
sourceTree = "<group>";
};
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = { 8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
8C2C3F282B28CDBC002C3C34 /* DDDate */,
8C2C3F242B2803BD002C3C34 /* DDSpriteSheetManager */, 8C2C3F242B2803BD002C3C34 /* DDSpriteSheetManager */,
8C2C3F1D2B280186002C3C34 /* DDStatisticsService */, 8C2C3F1D2B280186002C3C34 /* DDStatisticsService */,
8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */, 8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */,
@@ -5749,6 +5800,7 @@
18E659CD2A5655790017854A /* DDSearchRoomCell.m in Sources */, 18E659CD2A5655790017854A /* DDSearchRoomCell.m in Sources */,
8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */, 8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */,
18660D572A2193C50032D0C9 /* UIView+SDAutoLayout.m in Sources */, 18660D572A2193C50032D0C9 /* UIView+SDAutoLayout.m in Sources */,
8C2C3F322B28DD95002C3C34 /* NSDate+DDDateUtils.m in Sources */,
1834018B2A49991700B924BF /* RoomLuckGiftDetailView.m in Sources */, 1834018B2A49991700B924BF /* RoomLuckGiftDetailView.m in Sources */,
18D786272A2305E700C9875F /* RoomPopTool.m in Sources */, 18D786272A2305E700C9875F /* RoomPopTool.m in Sources */,
181F754B2A5409AB006FA7F5 /* DDGradientView.m in Sources */, 181F754B2A5409AB006FA7F5 /* DDGradientView.m in Sources */,
@@ -5786,6 +5838,7 @@
1812EC8D2A54FD9200FF2AC0 /* DDRoomRapidChangeAlertView.m in Sources */, 1812EC8D2A54FD9200FF2AC0 /* DDRoomRapidChangeAlertView.m in Sources */,
188EC1372A47CF3300060F03 /* HXPhotoPreviewViewCell.m in Sources */, 188EC1372A47CF3300060F03 /* HXPhotoPreviewViewCell.m in Sources */,
188EC1512A47CF3300060F03 /* HXPhotoEditMosaicView.m in Sources */, 188EC1512A47CF3300060F03 /* HXPhotoEditMosaicView.m in Sources */,
8C2C3F3A2B28E22E002C3C34 /* YYAnimatedImageView+ShowImage.m in Sources */,
186EBFA32A3FE362005623CC /* DDKuoLieModel.m in Sources */, 186EBFA32A3FE362005623CC /* DDKuoLieModel.m in Sources */,
1838644D2A28A17B005BF235 /* ZLDrawItem.m in Sources */, 1838644D2A28A17B005BF235 /* ZLDrawItem.m in Sources */,
18660D542A2193C50032D0C9 /* UIView+Additions.m in Sources */, 18660D542A2193C50032D0C9 /* UIView+Additions.m in Sources */,
@@ -5880,6 +5933,7 @@
188CA96C2A4FCE9600DAFC86 /* DDV2HomeHeaderView.m in Sources */, 188CA96C2A4FCE9600DAFC86 /* DDV2HomeHeaderView.m in Sources */,
189481022A5B90DB005ED591 /* DDSetUserView.m in Sources */, 189481022A5B90DB005ED591 /* DDSetUserView.m in Sources */,
18CF77DB2A4ECC4A0009B602 /* RoomEventView.m in Sources */, 18CF77DB2A4ECC4A0009B602 /* RoomEventView.m in Sources */,
8C2C3F2B2B28CDEF002C3C34 /* DDDate.m in Sources */,
186A89202A41ABBA001DE99E /* DDMyAuthorStatusViewController.m in Sources */, 186A89202A41ABBA001DE99E /* DDMyAuthorStatusViewController.m in Sources */,
1812EC902A54FDA900FF2AC0 /* DDRoomGiftBottomView.m in Sources */, 1812EC902A54FDA900FF2AC0 /* DDRoomGiftBottomView.m in Sources */,
186C9D1F2A2A163100209BB5 /* DDLineView.m in Sources */, 186C9D1F2A2A163100209BB5 /* DDLineView.m in Sources */,
@@ -6161,6 +6215,7 @@
186777852A429D0C0096D802 /* RoomBgCollectionViewCell.m in Sources */, 186777852A429D0C0096D802 /* RoomBgCollectionViewCell.m in Sources */,
183864382A28A17B005BF235 /* ZLBigImageCell.m in Sources */, 183864382A28A17B005BF235 /* ZLBigImageCell.m in Sources */,
18660D5B2A2193C50032D0C9 /* UILabel+Custom.m in Sources */, 18660D5B2A2193C50032D0C9 /* UILabel+Custom.m in Sources */,
8C2C3F362B28DDCE002C3C34 /* NSCalendar+DDPick.m in Sources */,
183864432A28A17B005BF235 /* ZLCustomCamera.m in Sources */, 183864432A28A17B005BF235 /* ZLCustomCamera.m in Sources */,
188EC1302A47CF3300060F03 /* HXPhotoView.m in Sources */, 188EC1302A47CF3300060F03 /* HXPhotoView.m in Sources */,
186EBFCD2A4036C0005623CC /* DynamicCommentTableViewCell.m in Sources */, 186EBFCD2A4036C0005623CC /* DynamicCommentTableViewCell.m in Sources */,
@@ -6254,6 +6309,7 @@
183864412A28A17B005BF235 /* ZLProgressHUD.m in Sources */, 183864412A28A17B005BF235 /* ZLProgressHUD.m in Sources */,
188EBF6B2A47CEA500060F03 /* DDMListCell.m in Sources */, 188EBF6B2A47CEA500060F03 /* DDMListCell.m in Sources */,
18660D6D2A21942F0032D0C9 /* WLBaseCollectionView.m in Sources */, 18660D6D2A21942F0032D0C9 /* WLBaseCollectionView.m in Sources */,
8C2C3F2E2B28D8B7002C3C34 /* DDTimeUtil.m in Sources */,
188EC1272A47CF3200060F03 /* HXCameraBottomView.m in Sources */, 188EC1272A47CF3200060F03 /* HXCameraBottomView.m in Sources */,
18E94E832A275E0A0055E8F0 /* RoomCharmView.m in Sources */, 18E94E832A275E0A0055E8F0 /* RoomCharmView.m in Sources */,
18660DD12A21E54B0032D0C9 /* RoomToolView.m in Sources */, 18660DD12A21E54B0032D0C9 /* RoomToolView.m in Sources */,

View File

@@ -0,0 +1,16 @@
//
// NSCalendar+Pick.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSCalendar (DDPick)
+ (instancetype)sharedCalendar;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,21 @@
//
// NSCalendar+Pick.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "NSCalendar+DDPick.h"
@implementation NSCalendar (DDPick)
+ (instancetype)sharedCalendar {
static id instance;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
instance = [NSCalendar currentCalendar];
});
return instance;
}
@end

View File

@@ -0,0 +1,21 @@
//
// NSDate+DDDateUtils.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSDate (DDDateUtils)
+ (NSDateFormatter *)shareDateFormatter;
- (NSInteger)dd_daysBetween:(NSDate *)aDate;
- (NSDate *)dd_dateByAddingDays:(NSInteger)days;
- (NSString *)dd_stringForFormat:(NSString *)format;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,76 @@
//
// NSDate+DDDateUtils.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "NSDate+DDDateUtils.h"
#import "NSCalendar+DDPick.h"
NSString * const kDateFormatYYYYMMDD = @"yyyy-MM-dd";
NSString * const kDateFormatYYMMDDTHHmmss = @"yyyy-MM-dd'T'HH:mm:ss";
@implementation NSDate (DDDateUtils)
+ (NSDateFormatter *)shareDateFormatter {
static NSDateFormatter *_instance = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
_instance = [[NSDateFormatter alloc] init];
[_instance setDateFormat:kDateFormatYYYYMMDD];
[_instance setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]];
});
return _instance;
}
- (NSDate *)dd_dateByAddingDays:(NSInteger)days {
NSCalendar *calendar = [NSCalendar sharedCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setDay:days];
return [calendar dateByAddingComponents:components toDate:self options:0];
}
- (NSInteger)dd_daysBetween:(NSDate *)aDate {
NSUInteger unitFlags = NSCalendarUnitDay;
NSDate *from = [NSDate dd_at_dateFromString:[self dd_stringForYearMonthDayDashed]];
NSDate *to = [NSDate dd_at_dateFromString:[aDate dd_stringForYearMonthDayDashed]];
NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
NSDateComponents *components = [calendar components:unitFlags fromDate:from toDate:to options:0];
return labs([components day]) + 1;
}
#pragma mark - Private Method
- (NSString *)dd_stringForYearMonthDayDashed {
return [self dd_stringForFormat:kDateFormatYYYYMMDD];
}
- (NSString *)dd_stringForFormat:(NSString *)format {
if (!format) {
return nil;
}
NSDateFormatter *formatter = [NSDate shareDateFormatter];
[formatter setDateFormat:format];
NSString *timeStr = [formatter stringFromDate:self];
return timeStr;
}
+ (NSDate *)dd_at_dateFromString:(NSString *)dateString {
NSDateFormatter *dateFormatter = [self shareDateFormatter];
if (dateString.length > kDateFormatYYYYMMDD.length) {
[dateFormatter setDateFormat:kDateFormatYYMMDDTHHmmss];
} else {
[dateFormatter setDateFormat:kDateFormatYYYYMMDD];
}
NSDate *date = [dateFormatter dateFromString:dateString];
if (!date) {
date = [NSDate date];
}
return date;
}
@end

View File

@@ -0,0 +1,16 @@
//
// YYAnimatedImageView+ShowImage.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import "YYAnimatedImageView.h"
NS_ASSUME_NONNULL_BEGIN
@interface YYAnimatedImageView (ShowImage)
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,34 @@
//
// YYAnimatedImageView+ShowImage.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "YYAnimatedImageView+ShowImage.h"
@implementation YYAnimatedImageView (ShowImage)
+ (void)load {
//
Method displayLayerMethod = class_getInstanceMethod(self, @selector(displayLayer:));
//
Method displayLayerNewMethod = class_getInstanceMethod(self, @selector(displayLayerNew:));
//
method_exchangeImplementations(displayLayerMethod, displayLayerNewMethod);
}
- (void)displayLayerNew:(CALayer *)layer {
Ivar imageIvar = class_getInstanceVariable([self class], @"_curFrame");
UIImage *image = object_getIvar(self, imageIvar);
if (image) {
layer.contents = (__bridge id)image.CGImage;
} else {
if (@available(iOS 14.0, *)) {
[super displayLayer:layer];
}
}
}
@end

View File

@@ -0,0 +1,101 @@
//
// DDDate.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import <Foundation/Foundation.h>
typedef NS_OPTIONS(NSUInteger, DDDayUnit) {
DDDayUnitSunday = 1,
DDDayUnitMonday = 2,
DDDayUnitTuesday = 3,
DDDayUnitWednesday = 4,
DDDayUnitThursday = 5,
DDDayUnitFriday = 6,
DDDayUnitSaturday = 7
};
typedef NS_OPTIONS(NSUInteger, DDMonthUnit) {
DDMonthUnitJanuary = 1,
DDMonthUnitFebruary = 2,
DDMonthUnitMarch = 3,
DDMonthUnitApril = 4,
DDMonthUnitMay = 5,
DDMonthUnitJune = 6,
DDMonthUnitJuly = 7,
DDMonthUnitAugust = 8,
DDMonthUnitSeptember = 9,
DDMonthUnitOctober = 10,
DDMonthUnitNovember = 11,
DDMonthUnitDecember = 12,
};
NS_ASSUME_NONNULL_BEGIN
@interface DDDate : NSObject
- (id)initUsingToday;
- (id)initUsingDate:(NSDate *)date;
- (id)initUsingYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
- (id)initUsingYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second;
- (id)initUsingString:(NSString *)stringDate;
- (id)initUsingString:(NSString *)stringDate withFormat:(NSString *)dateFormat;
- (id)initUsingSeconds:(NSInteger)seconds;
- (NSDate *)dd_date;
- (NSString *)dd_stringValue;
- (NSString *)dd_stringValueWithFormat:(NSString *)dateFormat;
- (instancetype)dd_zeroTime;
- (instancetype)dd_previousDay;
- (instancetype)dd_previousDays:(NSInteger)days;
- (instancetype)dd_nextDay;
- (instancetype)dd_nextDays:(NSInteger)days;
- (instancetype)dd_previousWeek;
- (instancetype)dd_previousWeeks:(NSInteger)weeks;
- (instancetype)dd_nextWeek;
- (instancetype)dd_nextWeeks:(NSInteger)weeks;
- (instancetype)dd_previousMonth;
- (instancetype)dd_previousMonths:(NSInteger)months;
- (instancetype)dd_nextMonth;
- (instancetype)dd_nextMonths:(NSInteger)months;
- (instancetype)dd_previousYear;
- (instancetype)dd_previousYears:(NSInteger)years;
- (instancetype)dd_nextYear;
- (instancetype)dd_nextYears:(NSInteger)years;
- (instancetype)dd_firstDayOfMonth;
- (instancetype)dd_lastDayOfMonth;
- (instancetype)dd_firstMonthOfYear;
- (instancetype)dd_lastMonthOfYear;
- (instancetype)dd_previousDayOfDayName:(DDDayUnit)dayUnit;
- (instancetype)dd_nextDayOfDayName:(DDDayUnit)dayUnit;
- (BOOL)dd_isCurrentDayName:(DDDayUnit)dayUnit;
- (BOOL)dd_isCurrentMonthName:(DDMonthUnit)monthUnit;
@property NSString *dateFormatUsingString;
@property NSDateFormatterStyle dateFormatUsingStyle;
@property NSDateFormatterStyle timeFormatUsingStyle;
@property NSInteger year;
@property NSInteger month;
@property (readonly) NSInteger week;
@property NSInteger day;
@property NSInteger hour;
@property NSInteger minute;
@property NSInteger second;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,399 @@
//
// DDDate.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "DDDate.h"
@implementation DDDate {
NSDateFormatter *_dateFormatter;
NSCalendar *_calendar;
NSDate *_date;
NSCalendarUnit _dateTimeCalendarUnit;
}
#pragma mark - Init
- (id)init {
if (self = [super init]) {
_dateFormatter = [[NSDateFormatter alloc] init];
_dateFormatter.dateStyle = NSDateFormatterFullStyle;
_dateFormatter.timeStyle = NSDateFormatterFullStyle;
_calendar = [NSCalendar currentCalendar];
_date = [[NSDate alloc] init];
_dateTimeCalendarUnit = (NSCalendarUnitYear | NSCalendarUnitMonth | NSWeekCalendarUnit | NSCalendarUnitWeekday | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond);
}
return self;
}
- (id)initUsingToday {
if (self = [self init]) {
_date = [NSDate date];
}
return self;
}
- (id)initUsingString:(NSString *)stringDate {
if (self = [self init]) {
_date = [_dateFormatter dateFromString:stringDate];
}
return self;
}
- (id)initUsingString:(NSString *)stringDate withFormat:(NSString *)dateFormat {
if (self = [self init]) {
_dateFormatter.dateFormat = dateFormat;
_date = [_dateFormatter dateFromString:stringDate];
}
return self;
}
- (id)initUsingYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day {
if (self = [self init]) {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.year = year;
dateComponents.month = month;
dateComponents.day = day;
_date = [_calendar dateFromComponents:dateComponents];
}
return self;
}
- (id)initUsingYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day hour:(NSInteger)hour minute:(NSInteger)minute second:(NSInteger)second {
if (self = [self init]) {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.year = year;
dateComponents.month = month;
dateComponents.day = day;
dateComponents.hour = hour;
dateComponents.minute = minute;
dateComponents.second = second;
_date = [_calendar dateFromComponents:dateComponents];
}
return self;
}
- (id)initUsingDate:(NSDate *)date {
if (self = [self init]) {
_date = date;
}
return self;
}
- (id)initUsingSeconds:(NSInteger)seconds {
if (self = [self init]) {
_date = [NSDate dateWithTimeIntervalSinceReferenceDate:seconds];
}
return self;
}
- (NSDate *)dd_date {
return _date;
}
- (NSString *)dd_stringValue {
return [_dateFormatter stringFromDate:_date];
}
- (NSString *)dd_stringValueWithFormat:(NSString *)dateFormat {
NSDateFormatter *localDateFormatter = [_dateFormatter copy];
localDateFormatter.dateFormat = dateFormat;
return [localDateFormatter stringFromDate:_date];
}
- (instancetype)dd_zeroTime {
NSDateComponents *dateComponents = [_calendar components:(NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond) fromDate:_date];
dateComponents.hour = 0;
dateComponents.minute = 0;
dateComponents.second = 0;
_date = [_calendar dateFromComponents:dateComponents];
return self;
}
- (void)setDateFormatUsingString:(NSString *)dateFormatUsingString {
_dateFormatter.dateFormat = dateFormatUsingString;
}
- (NSString *)dateFormatUsingString {
return _dateFormatter.dateFormat;
}
- (void)setDateFormatUsingStyle:(NSDateFormatterStyle)dateFormatUsingStyle {
_dateFormatter.dateStyle = dateFormatUsingStyle;
}
- (NSDateFormatterStyle)dateFormatUsingStyle {
return _dateFormatter.dateStyle;
}
- (void)setTimeFormatUsingStyle:(NSDateFormatterStyle)timeFormatUsingStyle {
_dateFormatter.timeStyle = timeFormatUsingStyle;
}
- (NSDateFormatterStyle)timeFormatUsingStyle {
return _dateFormatter.timeStyle;
}
- (instancetype)daysCalculate:(NSInteger)days isForward:(BOOL)isForward {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.day = days * (isForward ? 1 : -1);
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (instancetype)dd_previousDay {
return [self dd_previousDays:1];
}
- (instancetype)dd_previousDays:(NSInteger)days {
return [self daysCalculate:days isForward:NO];
}
- (instancetype)dd_nextDay {
return [self dd_nextDays:1];
}
- (instancetype)dd_nextDays:(NSInteger)days {
return [self daysCalculate:days isForward:YES];
}
- (instancetype)weeksCalculate:(NSInteger)weeks isForward:(BOOL)isForward {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.day = (7 * weeks) * (isForward ? 1 : -1);
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (instancetype)dd_previousWeek {
return [self dd_previousWeeks:1];
}
- (instancetype)dd_previousWeeks:(NSInteger)weeks {
return [self weeksCalculate:weeks isForward:NO];
}
- (instancetype)dd_nextWeek {
return [self dd_nextWeeks:1];
}
- (instancetype)dd_nextWeeks:(NSInteger)weeks {
return [self weeksCalculate:weeks isForward:YES];
}
- (instancetype)monthsCalculate:(NSInteger)months isForward:(BOOL)isForward {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.month = months * (isForward ? 1 : -1);
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (instancetype)dd_previousMonth {
return [self dd_previousMonths:1];
}
- (instancetype)dd_previousMonths:(NSInteger)months {
return [self monthsCalculate:months isForward:NO];
}
- (instancetype)dd_nextMonth {
return [self dd_nextMonths:1];
}
- (instancetype)dd_nextMonths:(NSInteger)months {
return [self monthsCalculate:months isForward:YES];
}
- (instancetype)yearsCalculate:(NSInteger)years isForward:(BOOL)isForward {
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
dateComponents.year = years * (isForward ? 1 : -1);
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (instancetype)dd_previousYear {
return [self dd_previousYears:1];
}
- (instancetype)dd_previousYears:(NSInteger)years {
return [self yearsCalculate:years isForward:NO];
}
- (instancetype)dd_nextYear {
return [self dd_nextYears:1];
}
- (instancetype)dd_nextYears:(NSInteger)years {
return [self yearsCalculate:years isForward:YES];
}
- (instancetype)dd_firstDayOfMonth {
NSDateComponents *dateComponents = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
dateComponents.day = 1;
_date = [_calendar dateFromComponents:dateComponents];
return self;
}
- (instancetype)dd_lastDayOfMonth {
NSDateComponents *dateComponents;
NSDate *date;
dateComponents = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
dateComponents.day = 1;
date = [_calendar dateFromComponents:dateComponents];
dateComponents = [[NSDateComponents alloc] init];
dateComponents.month = 1;
date = [_calendar dateByAddingComponents:dateComponents toDate:date options:0];
dateComponents = [[NSDateComponents alloc] init];
dateComponents.day = -1;
_date = [_calendar dateByAddingComponents:dateComponents toDate:date options:0];
return self;
}
- (instancetype)dd_firstMonthOfYear {
NSDateComponents *dateComponents = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
dateComponents.month = DDMonthUnitJanuary;
_date = [_calendar dateFromComponents:dateComponents];
return self;
}
- (instancetype)dd_lastMonthOfYear {
NSDateComponents *dateComponents = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
dateComponents.month = DDMonthUnitDecember;
_date = [_calendar dateFromComponents:dateComponents];
return self;
}
- (instancetype)dd_previousDayOfDayName:(DDDayUnit)dayUnit {
NSInteger currentWeekDay = [_calendar components:_dateTimeCalendarUnit fromDate:_date].weekday;
if (currentWeekDay == dayUnit)
return [self dd_previousWeek];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
if (currentWeekDay > dayUnit)
dateComponents.day = -(currentWeekDay - dayUnit);
else
dateComponents.day = -currentWeekDay - (7 - dayUnit);
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (instancetype)dd_nextDayOfDayName:(DDDayUnit)dayUnit {
NSInteger currentWeekDay = [_calendar components:_dateTimeCalendarUnit fromDate:_date].weekday;
if (currentWeekDay == dayUnit)
return [self dd_nextWeek];
NSDateComponents *dateComponents = [[NSDateComponents alloc] init];
if (currentWeekDay < dayUnit)
dateComponents.day = dayUnit - currentWeekDay;
else
dateComponents.day = -currentWeekDay + dayUnit;
_date = [_calendar dateByAddingComponents:dateComponents toDate:_date options:0];
return self;
}
- (BOOL)dd_isCurrentDayName:(DDDayUnit)dayUnit {
return ([_calendar components:_dateTimeCalendarUnit fromDate:_date].weekday == dayUnit);
}
- (BOOL)dd_isCurrentMonthName:(DDMonthUnit)monthUnit {
return ([_calendar components:_dateTimeCalendarUnit fromDate:_date].month == monthUnit);
}
#pragma mark - Set && Get
- (NSInteger)year {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].year;
}
- (void)setYear:(NSInteger)year {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.year = year;
_date = [_calendar dateFromComponents:components];
}
- (NSInteger)month {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].month;
}
- (void)setMonth:(NSInteger)month {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.month = month;
_date = [_calendar dateFromComponents:components];
}
- (NSInteger)week {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].weekday;
}
- (NSInteger)day {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].day;
}
- (void)setDay:(NSInteger)day {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.day = day;
_date = [_calendar dateFromComponents:components];
}
- (NSInteger)hour {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].hour;
}
- (void)setHour:(NSInteger)hour {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.hour = hour;
_date = [_calendar dateFromComponents:components];
}
- (NSInteger)minute {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].minute;
}
- (void)setMinute:(NSInteger)minute {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.minute = minute;
_date = [_calendar dateFromComponents:components];
}
- (NSInteger)second {
return [_calendar components:_dateTimeCalendarUnit fromDate:_date].second;
}
- (void)setSecond:(NSInteger)second {
NSDateComponents *components = [_calendar components:_dateTimeCalendarUnit fromDate:_date];
components.second = second;
_date = [_calendar dateFromComponents:components];
}
@end

View File

@@ -0,0 +1,54 @@
//
// DDTimeUtil.h
// DingDangApp
//
// Created by 触海 on 2023/12/12.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface DDTimeUtil : NSObject
/**
* 根据秒数获取倒计时时间
* @param second 秒
* @return 格式为 01:02:00
*/
+ (NSString *)DD_GetTimeWithSecond:(NSUInteger)second;
+ (NSDate *)DD_GetDateWithCompleteTime:(NSString *)time;
+ (NSDate *)DD_GetDateWithTime:(NSString *)time;
+ (NSDate *)DD_GetDateWithYMD:(NSString *)time;
+ (NSString *)DD_GetDateWithHHMMSS:(NSString *)time;
+ (NSString *)DD_GetDateWithYYMMDD:(NSString *)time;
+ (NSString *)DD_GetDateWithYYMM:(NSString *)time;
+ (NSString *)DD_GetDateWithMMDD:(NSString *)time;
+ (NSDate *)DD_GetDateWithYearMonthDay:(NSString *)time;
+ (NSString *)DD_GetMonthDayContent:(NSDate *)date;
+ (NSString *)DD_GetYYMMWithDate:(NSDate *)date;
+ (NSString *)DD_GetYYMMDDWithDate:(NSDate *)date;
+ (NSString *)DD_GetYYMMDDWithDateFormatter:(NSDate *)date;
+ (NSString *)DD_GetDateWithTotalTimeWith:(NSString *)time;
+ (NSString *)DD_GetNowTimeTimestampMillisecond;
///比较两个时间的差值
+ (NSDateComponents *)DD_CompareTwoDate:(NSDate *)firstDate secondDate:(NSDate *)secondDate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,237 @@
//
// DDTimeUtil.m
// DingDangApp
//
// Created by on 2023/12/12.
//
#import "DDTimeUtil.h"
#import "DDDate.h"
#import "DDUtility.h"
@implementation DDTimeUtil
+ (NSString *)DD_GetTimeWithSecond:(NSUInteger)second {
NSUInteger hours = second / 3600;
NSUInteger minutes = (second % 3600) / 60;
NSUInteger seconds = second % 60;
return [NSString stringWithFormat:@"%@:%@:%@",[self DD_GetConent:hours],
[self DD_GetConent:minutes],[self DD_GetConent:seconds]];
}
+ (NSString *)DD_GetConent:(NSUInteger)count {
if(count >= 10){
return [NSString stringWithFormat:@"%lu",(unsigned long)count];
}
return [NSString stringWithFormat:@"0%lu",(unsigned long)count];
}
+(NSDate *)DD_GetDateWithYMD:(NSString *)time {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy:MM:dd"];
NSDate* date = [dateFormatter dateFromString:time];
return date;
}
+(NSDate *)DD_GetDateWithYearMonthDay:(NSString *)time {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy-MM-dd"];
NSDate* date = [dateFormatter dateFromString:time];
return date;
}
+ (NSDate *)DD_GetDateWithCompleteTime:(NSString *)time {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"yyyy:MM:dd HH:mm:ss"];
NSDate* date = [dateFormatter dateFromString:time];
return date;
}
+ (NSDate *)DD_GetDateWithTime:(NSString *)time {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"HH:mm:ss"];
NSDate* date = [dateFormatter dateFromString:time];
return date;
}
+ (NSString *)DD_GetMonthDayContent:(NSDate *)date {
DDDate *currentDate = [[DDDate alloc] initUsingDate:date];
NSString *month = [self DD_GetContent:currentDate.month];
NSString *day = [self DD_GetContent:currentDate.day];
NSString *content = [NSString stringWithFormat:@"%@-%@",month,day];
return content;
}
+ (NSString *)DD_GetYYMMDDWithDate:(NSDate *)date {
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
formatter.dateFormat = @"yyyy-MM-dd";
NSString *dateStr = [formatter stringFromDate:date];
return dateStr;
}
+ (NSString *)DD_GetYYMMDDWithDateFormatter:(NSDate *)date {
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
formatter.dateFormat = @"yyyy年MM月dd日";
NSString *dateStr = [formatter stringFromDate:date];
return dateStr;
}
+ (NSString *)DD_GetYYMMWithDate:(NSDate *)date {
NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
formatter.dateFormat = @"YYYY年MM月";
NSString *dateStr = [formatter stringFromDate:date];
return dateStr;
}
+ (NSString *)DD_GetDateWithYYMMDD:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"YYYY年MM月dd日"];
//
NSString * times;
if ([self is32bit] && [[DDUtility DD_SystemVersion] floatValue] <= 10.0) {
times = [NSString stringWithFormat:@"%f", ([time doubleValue] + 3600 * 1000 * 8)];
}else{
times = time;
}
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times longLongValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
+ (NSString *)DD_GetDateWithYYMM:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"yyyy年MM月"];
//
NSString * times;
if ([self is32bit] && [[DDUtility DD_SystemVersion] floatValue] <= 10.0) {
times = [NSString stringWithFormat:@"%f", ([time doubleValue] + 3600 * 1000 * 8)];
}else{
times = time;
}
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times doubleValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
+ (NSString *)DD_GetDateWithMMDD:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"MM月dd日"];
//
NSString * times;
if ([self is32bit] && [[DDUtility DD_SystemVersion] floatValue] <= 10.0) {
times = [NSString stringWithFormat:@"%f", ([time doubleValue] + 3600 * 1000 * 8)];
}else{
times = time;
}
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times doubleValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
+ (NSString *)DD_GetDateWithHHMMSS:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"HH:mm:ss"];
//
NSString * times;
if ([self is32bit] && [[DDUtility DD_SystemVersion] floatValue] <= 10.0) {
times = [NSString stringWithFormat:@"%f", ([time doubleValue] + 3600 * 1000 * 8)];
}else{
times = time;
}
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times doubleValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
+ (NSString *)DD_GetDateWithTotalTimeWith:(NSString *)time {
NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
formatter.timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
[formatter setDateFormat:@"yyyy.MM.dd HH:mm:ss"];
//
NSString * times;
if ([self is32bit] && [[DDUtility DD_SystemVersion] floatValue] <= 10.0) {
times = [NSString stringWithFormat:@"%f", ([time doubleValue] + 3600 * 1000 * 8)];
}else{
times = time;
}
NSDate* date = [NSDate dateWithTimeIntervalSince1970:[times doubleValue]/ 1000.0];
NSString* dateString = [formatter stringFromDate:date];
return dateString;
}
+ (NSString *)DD_GetNowTimeTimestampMillisecond {
NSDateFormatter *formatter = [[NSDateFormatter alloc] init] ;
[formatter setDateStyle:NSDateFormatterMediumStyle];
[formatter setTimeStyle:NSDateFormatterShortStyle];
//,hhHH:12,24
[formatter setDateFormat:@"YYYY-MM-dd HH:mm:ss"];
//,
NSTimeZone* timeZone = [NSTimeZone timeZoneWithName:@"Asia/Beijing"];
[formatter setTimeZone:timeZone];
NSDate* dat = [NSDate dateWithTimeIntervalSinceNow:0];
NSTimeInterval a=[dat timeIntervalSince1970]*1000;
NSString * timeSp = [NSString stringWithFormat:@"%.0f", a];
return timeSp;
}
+ (NSDateComponents *)DD_CompareTwoDate:(NSDate *)firstDate secondDate:(NSDate *)secondDate {
//
NSCalendar *calendar = [NSCalendar currentCalendar];
//
NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth
| NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond;
//
NSDateComponents *dateCom = [calendar components:unit fromDate:firstDate toDate:secondDate options:0];
return dateCom;
}
#pragma mark - Private Method
+ (NSString *)DD_GetContent:(NSUInteger)count {
if(count >= 10){
return [NSString stringWithFormat:@"%lu",(unsigned long)count];
}
return [NSString stringWithFormat:@"0%lu",(unsigned long)count];
}
+ (BOOL)is32bit {
#if defined(__LP64__) && __LP64__
return NO;
#else
return YES;
#endif
}
@end

View File

@@ -6,6 +6,9 @@
// //
#import "DDSpriteSheeImagetManager.h" #import "DDSpriteSheeImagetManager.h"
#import "DDSystemTool.h"
#import "DDGCDHelper.h"
@interface DDSpriteSheeImagetManager() @interface DDSpriteSheeImagetManager()
@property (nonatomic,strong) YYSpriteSheetImage *sprite; @property (nonatomic,strong) YYSpriteSheetImage *sprite;
@@ -14,13 +17,123 @@
@property (nonatomic, strong) UIImageView *operationImageView; @property (nonatomic, strong) UIImageView *operationImageView;
@end @end
static NSInteger retryCount = 3;
static CGFloat kDeafultFrameDurations = 0.066;
@implementation DDSpriteSheeImagetManager @implementation DDSpriteSheeImagetManager
#pragma mark - Public Method
/// SpriteSheetImage /// SpriteSheetImage
- (void)dd_loadSpriteSheetImageWithURL:(NSURL *)url - (void)dd_loadSpriteSheetImageWithURL:(NSURL *)url
completionBlock:(void (^)(YYSpriteSheetImage * _Nullable))completionBlock completionBlock:(void (^)(YYSpriteSheetImage * _Nullable))completionBlock
failureBlock:(void (^)(NSError * _Nullable))failureBlock { failureBlock:(void (^)(NSError * _Nullable))failureBlock {
if (!url) return;
__weak typeof(self) weakSelf = self;
[self dd_cacheURL:url];
[self.operationImageView sd_setImageWithURL:url completed:^(UIImage * _Nullable image, NSError * _Nullable error, SDImageCacheType cacheType, NSURL * _Nullable imageURL) {
__strong typeof(self) strongSelf = weakSelf;
if (error) {
if (![self.retryCache objectForKey:[DDSystemTool DD_GetDeviceUUid]]) {
[self.retryCache setObject:@(0) forKey:[DDSystemTool DD_GetDeviceUUid]];
}
NSInteger value = [[self.retryCache objectForKey:[DDSystemTool DD_GetDeviceUUid]] integerValue];
[self.retryCache setObject:@(value) forKey:[DDSystemTool DD_GetDeviceUUid]];
if (value < retryCount) {
[self dd_retryWithKey:[DDSystemTool DD_GetDeviceUUid] complete:^(YYSpriteSheetImage *sprit) {
completionBlock(sprit);
} failure:^(NSError *error) {
failureBlock(error);
}];
}
return;
}
YYSpriteSheetImage *sheetImage = [DDSpriteSheeImagetManager DD_SpriteSheet:image frameDurations:kDeafultFrameDurations];
dd_dispatch_main_sync_safe(^{
if (sheetImage) {
completionBlock(sheetImage);
[self dd_removeCacheWithKey:[DDSystemTool DD_GetDeviceUUid]];
[self.retryCache removeObjectForKey:[DDSystemTool DD_GetDeviceUUid]];
}
});
}];
} }
#pragma mark - Private Method
- (void)dd_cacheURL:(NSURL *)url {
NSString *key = [DDSystemTool DD_GetDeviceUUid];
[self.parserQueue setObject:url forKey:key];
}
- (void)dd_removeCacheWithKey:(NSString *)key {
[self.parserQueue removeObjectForKey:key];
}
- (void)dd_retryWithKey:(NSString *)key
complete:(void(^)(YYSpriteSheetImage *))complete
failure:(void(^)(NSError *))failure {
if(!key) return;
NSURL *url = [self.parserQueue objectForKey:[DDSystemTool DD_GetDeviceUUid]];
[self dd_loadSpriteSheetImageWithURL:url completionBlock:^(YYSpriteSheetImage * _Nullable sprit) {
complete(sprit);
} failureBlock:^(NSError * _Nullable error) {
failure(error);
}];
}
/*** UI frameDurations **/
+ (YYSpriteSheetImage *)DD_SpriteSheet:(UIImage *)image frameDurations:(CGFloat)frameDurations {
NSMutableArray *contentRects = [NSMutableArray array];
NSMutableArray *durations = [NSMutableArray array];
CGFloat imageHeight = image.size.height;
NSInteger spriteCount = image.size.width/imageHeight;
for (int i = 0; i < spriteCount; i++) {
CGRect rect;
rect.size = CGSizeMake(imageHeight, imageHeight);
rect.origin.x = imageHeight * i;
rect.origin.y = 0;
[contentRects addObject:[NSValue valueWithCGRect:rect]];
if (!frameDurations) {
frameDurations = kDeafultFrameDurations;
}
[durations addObject:@(frameDurations)];
}
YYSpriteSheetImage *sheetImage = [[YYSpriteSheetImage alloc] initWithSpriteSheetImage:image contentRects:contentRects frameDurations:durations loopCount:0];
return sheetImage;
}
#pragma mark - Get
- (NSMutableDictionary *)parserQueue {
if (!_parserQueue) {
_parserQueue = [NSMutableDictionary dictionary];
}
return _parserQueue;
}
- (NSMutableDictionary *)retryCache {
if (!_retryCache) {
_retryCache = [NSMutableDictionary dictionary];
}
return _retryCache;
}
- (UIImageView *)operationImageView {
if (!_operationImageView) {
_operationImageView = [[UIImageView alloc] init];
}
return _operationImageView;
}
@end @end

View File

@@ -1,64 +0,0 @@
//
// DDUtility+App.h
// DingDangApp
//
// Created by 触海 on 2023/12/11.
//
#import "DDUtility.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDUtility (App)
/**
* 从YYMobile-Info.plist中读取字段
* @param key 键
* @return 值
*/
+ (id)DD_ValueInPlistForKey:(NSString *)key;
/*** 获取App版本号, 从plist从读取CFBundleShortVersion */
+ (NSString *)DD_AppVersion;
/*** 获取AppBuild号, 从plist中读取CFBundleVersion */
+ (NSString *)DD_AppBuild;
/*** 当前构建出的版本在svn中的版本号 */
+ (NSString *)DD_SvnVersion;
/**
获取appName
@return app的名称
*/
+ (NSString *)DD_AppName;
/**
* 获取bundle id
* @return bundle id
*/
+ (NSString *)DD_AppBundleId;
/*** 获取YYMobileFrameworkRes.bundle的URL */
+ (NSURL *)DD_URLForMobileFrameworkResourceBundle;
/*** 获取YYMobileFrameworkRes.bundle的路径 */
+ (NSString *)DD_PathForMobileFrameworkResourceBundle;
+ (BOOL)DD_AddSkipBackupAttributeToItemAtURL:(NSURL *)fileURL;
/**
* 获取当前的构建类型(DEBUG/RELEASE)
* @return 构建类型
*/
+ (NSString *)DD_BuildType;
/*** 获取平台渠道 */
+ (NSString *)DD_GetAppSource;
/*** 是否来自appstore */
+ (BOOL)DD_IsFromAppStore;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,38 +0,0 @@
//
// DDUtility+Carrier.h
// DingDangApp
//
// Created by 触海 on 2023/12/11.
//
#import "DDUtility.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDUtility (Carrier)
/**
获取设备唯一标识
@return 唯一标识
*/
+ (NSString *)DD_DeviceUniqueIdentification;
/*** 获取运营商 */
+ (CTCarrier *)DD_Carrier;
/*** 获取运营商类型 */
+ (NSInteger)DD_CarrierIdentifier;
/*** 获取运营商名称 */
+ (NSString *)DD_CarrierName;
/**
* 从CTCarrier对象获取网络类型
* @param carrier - CTCarrier对象
* @return CarrierType
*/
+ (NSInteger)DD_IdentifierOfCarrier:(CTCarrier *)carrier;
@end
NS_ASSUME_NONNULL_END

View File

@@ -1,89 +0,0 @@
//
// DDUtility+Device.h
// DingDangApp
//
// Created by 触海 on 2023/12/11.
//
#import "DDUtility.h"
NS_ASSUME_NONNULL_BEGIN
@interface DDUtility (Device)
/*** 获取modelName, 如iPhone5,2 */
+ (NSString *)DD_ModelName;
/**
获取设备类型
@return 设备类型
*/
+ (NSString*)DD_ModelType;
/*** 获取系统版本 */
+ (NSString *)DD_SystemVersion;
/*** 获取当前设备的 IDFVIDFV 在某些情况下会变,不建议将其作为设备标识 */
+ (NSString *)DD_IdentifierForVendor NS_AVAILABLE_IOS(6_0);
/**
* 获取当前的设备标识,会使用海度 SDK 中的 OpenUDID
* @return 海度 SDK 缓存的 OpenUDID
*/
+ (NSString *)DD_DeviceID;
/*** 获取当前网络状态 */
+ (NSInteger)DD_NetworkStatus;
/*** 获取当前IP地址 */
+ (NSString *)DD_IPAddress;
/**
* 获取当前IP地址
* @param preferIPv4 优先取IPv4的地址
*/
+ (NSString *)DD_IPAddress:(BOOL)preferIPv4;
/**
* 检查Camera是否可用, 可用则调用available; 若隐私设置中禁用了本app对相机
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
* @param available 可用
* @param denied 不可用
* @param restriction 受限制
*/
+ (void)DD_CheckCameraAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
/**
* 检查相册是否可用, 可用则调用available; 若隐私设置中禁用了本app对相册
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
* @param available 可用
* @param denied 不可用
* @param restriction 受限制
*/
+ (void)DD_CheckAssetsLibrayAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
/**
检查麦克风权限
@param resultBlock 结果处理block
*/
+ (void)DD_CheckMicPrivacy:(void(^)(BOOL succeed))resultBlock;
+ (NSString *)DD_MACAddresss;
+ (NSString *)DD_IDFA;
/**
* 初始化信令sdkimsdk所用到的appName
* @return app name
*/
+ (NSString *)DD_AppName;
/**
当前设备是否低于, 等于 iPhone6
@return 当前设备是否低于, 等于 iPhone6
*/
+ (BOOL)DD_ISIphone6AndLow;
@end
NS_ASSUME_NONNULL_END

View File

@@ -5,7 +5,7 @@
// Created by on 2023/12/11. // Created by on 2023/12/11.
// //
#import "DDUtility+Device.h" #import "DDUtility.h"
#import <sys/utsname.h> #import <sys/utsname.h>
#import <arpa/inet.h> #import <arpa/inet.h>
#import <net/if.h> #import <net/if.h>

View File

@@ -17,5 +17,170 @@ NS_ASSUME_NONNULL_BEGIN
@end @end
/*==============================*/
/* App Utilities */
/*==============================*/
@interface DDUtility (App)
/**
* 从YYMobile-Info.plist中读取字段
* @param key 键
* @return 值
*/
+ (id)DD_ValueInPlistForKey:(NSString *)key;
/*** 获取App版本号, 从plist从读取CFBundleShortVersion */
+ (NSString *)DD_AppVersion;
/*** 获取AppBuild号, 从plist中读取CFBundleVersion */
+ (NSString *)DD_AppBuild;
/*** 当前构建出的版本在svn中的版本号 */
+ (NSString *)DD_SvnVersion;
/**
获取appName
@return app的名称
*/
+ (NSString *)DD_AppName;
/**
* 获取bundle id
* @return bundle id
*/
+ (NSString *)DD_AppBundleId;
/*** 获取YYMobileFrameworkRes.bundle的URL */
+ (NSURL *)DD_URLForMobileFrameworkResourceBundle;
/*** 获取YYMobileFrameworkRes.bundle的路径 */
+ (NSString *)DD_PathForMobileFrameworkResourceBundle;
+ (BOOL)DD_AddSkipBackupAttributeToItemAtURL:(NSURL *)fileURL;
/**
* 获取当前的构建类型(DEBUG/RELEASE)
* @return 构建类型
*/
+ (NSString *)DD_BuildType;
/*** 获取平台渠道 */
+ (NSString *)DD_GetAppSource;
/*** 是否来自appstore */
+ (BOOL)DD_IsFromAppStore;
@end
/*==============================*/
/* Carrier Utilities */
/*==============================*/
@interface DDUtility (Carrier)
/**
获取设备唯一标识
@return 唯一标识
*/
+ (NSString *)DD_DeviceUniqueIdentification;
/*** 获取运营商 */
+ (CTCarrier *)DD_Carrier;
/*** 获取运营商类型 */
+ (NSInteger)DD_CarrierIdentifier;
/*** 获取运营商名称 */
+ (NSString *)DD_CarrierName;
/**
* 从CTCarrier对象获取网络类型
* @param carrier - CTCarrier对象
* @return CarrierType
*/
+ (NSInteger)DD_IdentifierOfCarrier:(CTCarrier *)carrier;
@end
/*==============================*/
/* Device Utilities */
/*==============================*/
@interface DDUtility (Device)
/*** 获取modelName, 如iPhone5,2 */
+ (NSString *)DD_ModelName;
/**
获取设备类型
@return 设备类型
*/
+ (NSString*)DD_ModelType;
/*** 获取系统版本 */
+ (NSString *)DD_SystemVersion;
/*** 获取当前设备的 IDFVIDFV 在某些情况下会变,不建议将其作为设备标识 */
+ (NSString *)DD_IdentifierForVendor NS_AVAILABLE_IOS(6_0);
/**
* 获取当前的设备标识,会使用海度 SDK 中的 OpenUDID
* @return 海度 SDK 缓存的 OpenUDID
*/
+ (NSString *)DD_DeviceID;
/*** 获取当前网络状态 */
+ (NSInteger)DD_NetworkStatus;
/*** 获取当前IP地址 */
+ (NSString *)DD_IPAddress;
/**
* 获取当前IP地址
* @param preferIPv4 优先取IPv4的地址
*/
+ (NSString *)DD_IPAddress:(BOOL)preferIPv4;
/**
* 检查Camera是否可用, 可用则调用available; 若隐私设置中禁用了本app对相机
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
* @param available 可用
* @param denied 不可用
* @param restriction 受限制
*/
+ (void)DD_CheckCameraAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
/**
* 检查相册是否可用, 可用则调用available; 若隐私设置中禁用了本app对相册
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
* @param available 可用
* @param denied 不可用
* @param restriction 受限制
*/
+ (void)DD_CheckAssetsLibrayAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
/**
检查麦克风权限
@param resultBlock 结果处理block
*/
+ (void)DD_CheckMicPrivacy:(void(^)(BOOL succeed))resultBlock;
+ (NSString *)DD_MACAddresss;
+ (NSString *)DD_IDFA;
/**
* 初始化信令sdkimsdk所用到的appName
* @return app name
*/
+ (NSString *)DD_AppName;
/**
当前设备是否低于, 等于 iPhone6
@return 当前设备是否低于, 等于 iPhone6
*/
+ (BOOL)DD_ISIphone6AndLow;
@end
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END