提交tool工具下的文件
This commit is contained in:
@@ -701,10 +701,15 @@
|
|||||||
8C2C3EDF2B27C3B8002C3C34 /* DDCountDownHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EDE2B27C3B8002C3C34 /* DDCountDownHelper.m */; };
|
8C2C3EDF2B27C3B8002C3C34 /* DDCountDownHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EDE2B27C3B8002C3C34 /* DDCountDownHelper.m */; };
|
||||||
8C2C3EE32B27CC6E002C3C34 /* DDBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EE22B27CC6E002C3C34 /* DDBase64.m */; };
|
8C2C3EE32B27CC6E002C3C34 /* DDBase64.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EE22B27CC6E002C3C34 /* DDBase64.m */; };
|
||||||
8C2C3EE62B27CC7D002C3C34 /* DDDESEncrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EE52B27CC7D002C3C34 /* DDDESEncrypt.m */; };
|
8C2C3EE62B27CC7D002C3C34 /* DDDESEncrypt.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EE52B27CC7D002C3C34 /* DDDESEncrypt.m */; };
|
||||||
8C2C3EEA2B27D163002C3C34 /* YYReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EE92B27D163002C3C34 /* YYReachability.m */; };
|
|
||||||
8C2C3EEF2B27D1B5002C3C34 /* SSKeychain.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EEE2B27D1B5002C3C34 /* SSKeychain.m */; };
|
|
||||||
8C2C3EF32B27D224002C3C34 /* NSObject+DDExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EF22B27D224002C3C34 /* NSObject+DDExtension.m */; };
|
8C2C3EF32B27D224002C3C34 /* NSObject+DDExtension.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EF22B27D224002C3C34 /* NSObject+DDExtension.m */; };
|
||||||
8C2C3EF92B27D94A002C3C34 /* YYUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3EF82B27D94A002C3C34 /* YYUtility.m */; };
|
8C2C3F0E2B27E5D8002C3C34 /* DDReachability.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F0D2B27E5D8002C3C34 /* DDReachability.m */; };
|
||||||
|
8C2C3F132B27ED3C002C3C34 /* DDUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F122B27ED3C002C3C34 /* DDUtility.m */; };
|
||||||
|
8C2C3F162B27ED7C002C3C34 /* DDUtility+App.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */; };
|
||||||
|
8C2C3F192B27F10D002C3C34 /* DDUtility+Device.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */; };
|
||||||
|
8C2C3F1C2B27FE43002C3C34 /* DDUtility+Carrier.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */; };
|
||||||
|
8C2C3F202B2801AC002C3C34 /* DDStatisticsService.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */; };
|
||||||
|
8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */; };
|
||||||
|
8C2C3F272B2803CA002C3C34 /* DDSpriteSheeImagetManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.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 */; };
|
||||||
@@ -1998,15 +2003,25 @@
|
|||||||
8C2C3EE22B27CC6E002C3C34 /* DDBase64.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDBase64.m; sourceTree = "<group>"; };
|
8C2C3EE22B27CC6E002C3C34 /* DDBase64.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDBase64.m; sourceTree = "<group>"; };
|
||||||
8C2C3EE42B27CC7D002C3C34 /* DDDESEncrypt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDDESEncrypt.h; sourceTree = "<group>"; };
|
8C2C3EE42B27CC7D002C3C34 /* DDDESEncrypt.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDDESEncrypt.h; sourceTree = "<group>"; };
|
||||||
8C2C3EE52B27CC7D002C3C34 /* DDDESEncrypt.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDDESEncrypt.m; sourceTree = "<group>"; };
|
8C2C3EE52B27CC7D002C3C34 /* DDDESEncrypt.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDDESEncrypt.m; sourceTree = "<group>"; };
|
||||||
8C2C3EE82B27D163002C3C34 /* YYReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YYReachability.h; sourceTree = "<group>"; };
|
|
||||||
8C2C3EE92B27D163002C3C34 /* YYReachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YYReachability.m; sourceTree = "<group>"; };
|
|
||||||
8C2C3EED2B27D1B5002C3C34 /* SSKeychain.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SSKeychain.h; sourceTree = "<group>"; };
|
|
||||||
8C2C3EEE2B27D1B5002C3C34 /* SSKeychain.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SSKeychain.m; sourceTree = "<group>"; };
|
|
||||||
8C2C3EF12B27D224002C3C34 /* NSObject+DDExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+DDExtension.h"; sourceTree = "<group>"; };
|
8C2C3EF12B27D224002C3C34 /* NSObject+DDExtension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSObject+DDExtension.h"; sourceTree = "<group>"; };
|
||||||
8C2C3EF22B27D224002C3C34 /* NSObject+DDExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DDExtension.m"; sourceTree = "<group>"; };
|
8C2C3EF22B27D224002C3C34 /* NSObject+DDExtension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSObject+DDExtension.m"; sourceTree = "<group>"; };
|
||||||
8C2C3EF62B27D8CB002C3C34 /* CarrierIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CarrierIdentifier.h; sourceTree = "<group>"; };
|
8C2C3F0C2B27E5D8002C3C34 /* DDReachability.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDReachability.h; sourceTree = "<group>"; };
|
||||||
8C2C3EF72B27D94A002C3C34 /* YYUtility.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = YYUtility.h; sourceTree = "<group>"; };
|
8C2C3F0D2B27E5D8002C3C34 /* DDReachability.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDReachability.m; sourceTree = "<group>"; };
|
||||||
8C2C3EF82B27D94A002C3C34 /* YYUtility.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = YYUtility.m; 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>"; };
|
||||||
|
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>"; };
|
||||||
|
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>"; };
|
||||||
|
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>"; };
|
||||||
|
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>"; };
|
||||||
|
8C2C3F212B2801D8002C3C34 /* DDStatisticsServiceHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DDStatisticsServiceHelper.h; 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>"; };
|
||||||
|
8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DDSpriteSheeImagetManager.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>"; };
|
||||||
@@ -5076,34 +5091,15 @@
|
|||||||
path = DDSecurity;
|
path = DDSecurity;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
8C2C3EE72B27D13A002C3C34 /* YYReachability */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
8C2C3EE82B27D163002C3C34 /* YYReachability.h */,
|
|
||||||
8C2C3EE92B27D163002C3C34 /* YYReachability.m */,
|
|
||||||
);
|
|
||||||
path = YYReachability;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */ = {
|
8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
8C2C3EF42B27D66C002C3C34 /* YYUtility */,
|
8C2C3F0F2B27ECB8002C3C34 /* DDUtility */,
|
||||||
8C2C3EEC2B27D199002C3C34 /* SSKeyChain */,
|
8C2C3F0B2B27E5B3002C3C34 /* DDRechability */,
|
||||||
8C2C3EE72B27D13A002C3C34 /* YYReachability */,
|
|
||||||
);
|
);
|
||||||
path = DDThirdTool;
|
path = DDThirdTool;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
8C2C3EEC2B27D199002C3C34 /* SSKeyChain */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
8C2C3EED2B27D1B5002C3C34 /* SSKeychain.h */,
|
|
||||||
8C2C3EEE2B27D1B5002C3C34 /* SSKeychain.m */,
|
|
||||||
);
|
|
||||||
path = SSKeyChain;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
8C2C3EF02B27D1D7002C3C34 /* NSObject */ = {
|
8C2C3EF02B27D1D7002C3C34 /* NSObject */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -5113,19 +5109,56 @@
|
|||||||
path = NSObject;
|
path = NSObject;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
8C2C3EF42B27D66C002C3C34 /* YYUtility */ = {
|
8C2C3F0B2B27E5B3002C3C34 /* DDRechability */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
8C2C3EF62B27D8CB002C3C34 /* CarrierIdentifier.h */,
|
8C2C3F0C2B27E5D8002C3C34 /* DDReachability.h */,
|
||||||
8C2C3EF72B27D94A002C3C34 /* YYUtility.h */,
|
8C2C3F0D2B27E5D8002C3C34 /* DDReachability.m */,
|
||||||
8C2C3EF82B27D94A002C3C34 /* YYUtility.m */,
|
|
||||||
);
|
);
|
||||||
path = YYUtility;
|
path = DDRechability;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8C2C3F0F2B27ECB8002C3C34 /* DDUtility */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F102B27ECEE002C3C34 /* DDCarrierIdentifier.h */,
|
||||||
|
8C2C3F112B27ED3C002C3C34 /* DDUtility.h */,
|
||||||
|
8C2C3F122B27ED3C002C3C34 /* DDUtility.m */,
|
||||||
|
8C2C3F142B27ED7C002C3C34 /* DDUtility+App.h */,
|
||||||
|
8C2C3F152B27ED7C002C3C34 /* DDUtility+App.m */,
|
||||||
|
8C2C3F172B27F10D002C3C34 /* DDUtility+Device.h */,
|
||||||
|
8C2C3F182B27F10D002C3C34 /* DDUtility+Device.m */,
|
||||||
|
8C2C3F1A2B27FE43002C3C34 /* DDUtility+Carrier.h */,
|
||||||
|
8C2C3F1B2B27FE43002C3C34 /* DDUtility+Carrier.m */,
|
||||||
|
);
|
||||||
|
path = DDUtility;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8C2C3F1D2B280186002C3C34 /* DDStatisticsService */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F1E2B2801AC002C3C34 /* DDStatisticsService.h */,
|
||||||
|
8C2C3F1F2B2801AC002C3C34 /* DDStatisticsService.m */,
|
||||||
|
8C2C3F212B2801D8002C3C34 /* DDStatisticsServiceHelper.h */,
|
||||||
|
8C2C3F222B2801D8002C3C34 /* DDStatisticsServiceHelper.m */,
|
||||||
|
);
|
||||||
|
path = DDStatisticsService;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
8C2C3F242B2803BD002C3C34 /* DDSpriteSheetManager */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
8C2C3F252B2803CA002C3C34 /* DDSpriteSheeImagetManager.h */,
|
||||||
|
8C2C3F262B2803CA002C3C34 /* DDSpriteSheeImagetManager.m */,
|
||||||
|
);
|
||||||
|
path = DDSpriteSheetManager;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
|
8CE493952B23F2B400CA14D5 /* DDBaseTool */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
8C2C3F242B2803BD002C3C34 /* DDSpriteSheetManager */,
|
||||||
|
8C2C3F1D2B280186002C3C34 /* DDStatisticsService */,
|
||||||
8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */,
|
8C2C3EEB2B27D17C002C3C34 /* DDThirdTool */,
|
||||||
8C2C3EE02B27CC5B002C3C34 /* DDSecurity */,
|
8C2C3EE02B27CC5B002C3C34 /* DDSecurity */,
|
||||||
8C2C3EDC2B27C39C002C3C34 /* DDCountDownHelper */,
|
8C2C3EDC2B27C39C002C3C34 /* DDCountDownHelper */,
|
||||||
@@ -5680,6 +5713,7 @@
|
|||||||
188EBFA72A47CF1300060F03 /* DDMCommonModel.m in Sources */,
|
188EBFA72A47CF1300060F03 /* DDMCommonModel.m in Sources */,
|
||||||
1812EC812A54FD2700FF2AC0 /* DDRoomGiftMicItemViewCell.m in Sources */,
|
1812EC812A54FD2700FF2AC0 /* DDRoomGiftMicItemViewCell.m in Sources */,
|
||||||
188EBF982A47CF0C00060F03 /* DDMoreItemViewCell.m in Sources */,
|
188EBF982A47CF0C00060F03 /* DDMoreItemViewCell.m in Sources */,
|
||||||
|
8C2C3F132B27ED3C002C3C34 /* DDUtility.m in Sources */,
|
||||||
188EBF722A47CEA500060F03 /* DDNoticeMCell.m in Sources */,
|
188EBF722A47CEA500060F03 /* DDNoticeMCell.m in Sources */,
|
||||||
1867777B2A4293710096D802 /* CreatRoomNoticeViewCell.m in Sources */,
|
1867777B2A4293710096D802 /* CreatRoomNoticeViewCell.m in Sources */,
|
||||||
188AF5C82A27647D004DD4CF /* RoomPublicScreenCell.m in Sources */,
|
188AF5C82A27647D004DD4CF /* RoomPublicScreenCell.m in Sources */,
|
||||||
@@ -5713,6 +5747,7 @@
|
|||||||
186EBFA02A3FE303005623CC /* DDKuoLieView.m in Sources */,
|
186EBFA02A3FE303005623CC /* DDKuoLieView.m in Sources */,
|
||||||
188583462A42822A00657AEC /* DDMyBlackListTableViewCell.m in Sources */,
|
188583462A42822A00657AEC /* DDMyBlackListTableViewCell.m in Sources */,
|
||||||
18E659CD2A5655790017854A /* DDSearchRoomCell.m in Sources */,
|
18E659CD2A5655790017854A /* DDSearchRoomCell.m in Sources */,
|
||||||
|
8C2C3F232B2801D8002C3C34 /* DDStatisticsServiceHelper.m in Sources */,
|
||||||
18660D572A2193C50032D0C9 /* UIView+SDAutoLayout.m in Sources */,
|
18660D572A2193C50032D0C9 /* UIView+SDAutoLayout.m in Sources */,
|
||||||
1834018B2A49991700B924BF /* RoomLuckGiftDetailView.m in Sources */,
|
1834018B2A49991700B924BF /* RoomLuckGiftDetailView.m in Sources */,
|
||||||
18D786272A2305E700C9875F /* RoomPopTool.m in Sources */,
|
18D786272A2305E700C9875F /* RoomPopTool.m in Sources */,
|
||||||
@@ -5737,6 +5772,7 @@
|
|||||||
188EBF772A47CEA500060F03 /* DDMLiveListVC.m in Sources */,
|
188EBF772A47CEA500060F03 /* DDMLiveListVC.m in Sources */,
|
||||||
2358F57D2B230B4A0038453C /* DDVideoEncodeManage.m in Sources */,
|
2358F57D2B230B4A0038453C /* DDVideoEncodeManage.m in Sources */,
|
||||||
18C833602A25A12A0090BF65 /* DDMyInfoGiftWallCollectionViewCell.m in Sources */,
|
18C833602A25A12A0090BF65 /* DDMyInfoGiftWallCollectionViewCell.m in Sources */,
|
||||||
|
8C2C3F272B2803CA002C3C34 /* DDSpriteSheeImagetManager.m in Sources */,
|
||||||
18660DCD2A21E54B0032D0C9 /* RoomViewController.m in Sources */,
|
18660DCD2A21E54B0032D0C9 /* RoomViewController.m in Sources */,
|
||||||
8C2C3EE62B27CC7D002C3C34 /* DDDESEncrypt.m in Sources */,
|
8C2C3EE62B27CC7D002C3C34 /* DDDESEncrypt.m in Sources */,
|
||||||
188EC0EC2A47CF3200060F03 /* DDMEmoticonCell.m in Sources */,
|
188EC0EC2A47CF3200060F03 /* DDMEmoticonCell.m in Sources */,
|
||||||
@@ -5797,7 +5833,6 @@
|
|||||||
188EC10E2A47CF3200060F03 /* NSDate+HXExtension.m in Sources */,
|
188EC10E2A47CF3200060F03 /* NSDate+HXExtension.m in Sources */,
|
||||||
188EC12A2A47CF3200060F03 /* HXPhotoBottomSelectView.m in Sources */,
|
188EC12A2A47CF3200060F03 /* HXPhotoBottomSelectView.m in Sources */,
|
||||||
186EBFC42A40363A005623CC /* UIViewController+XPSemiModal.m in Sources */,
|
186EBFC42A40363A005623CC /* UIViewController+XPSemiModal.m in Sources */,
|
||||||
8C2C3EEF2B27D1B5002C3C34 /* SSKeychain.m in Sources */,
|
|
||||||
183864482A28A17B005BF235 /* ZLCollectionCell.m in Sources */,
|
183864482A28A17B005BF235 /* ZLCollectionCell.m in Sources */,
|
||||||
18AFFEC02A4BD4E0008F6478 /* DDTopAndBottomView.m in Sources */,
|
18AFFEC02A4BD4E0008F6478 /* DDTopAndBottomView.m in Sources */,
|
||||||
189569AF2A233BCD00DCF149 /* RoomTipView.m in Sources */,
|
189569AF2A233BCD00DCF149 /* RoomTipView.m in Sources */,
|
||||||
@@ -5824,7 +5859,6 @@
|
|||||||
1802B3DB2A541B6B0036DCEF /* DDLoginTextView.m in Sources */,
|
1802B3DB2A541B6B0036DCEF /* DDLoginTextView.m in Sources */,
|
||||||
186A897B2A41B272001DE99E /* DDAuthorStatusTableViewCell.m in Sources */,
|
186A897B2A41B272001DE99E /* DDAuthorStatusTableViewCell.m in Sources */,
|
||||||
186A88E42A415291001DE99E /* DDMyLevelViewController.m in Sources */,
|
186A88E42A415291001DE99E /* DDMyLevelViewController.m in Sources */,
|
||||||
8C2C3EF92B27D94A002C3C34 /* YYUtility.m in Sources */,
|
|
||||||
18C905042A2305A600F7CAFD /* ResourcePickerToolsObject.m in Sources */,
|
18C905042A2305A600F7CAFD /* ResourcePickerToolsObject.m in Sources */,
|
||||||
186A89052A41603C001DE99E /* DDNobleTableViewCell.m in Sources */,
|
186A89052A41603C001DE99E /* DDNobleTableViewCell.m in Sources */,
|
||||||
18E94E802A2740890055E8F0 /* RoomGiftModel.m in Sources */,
|
18E94E802A2740890055E8F0 /* RoomGiftModel.m in Sources */,
|
||||||
@@ -5851,6 +5885,7 @@
|
|||||||
186C9D1F2A2A163100209BB5 /* DDLineView.m in Sources */,
|
186C9D1F2A2A163100209BB5 /* DDLineView.m in Sources */,
|
||||||
1826C5F92A24504500A5AFDB /* DDMyInfoClassView.m in Sources */,
|
1826C5F92A24504500A5AFDB /* DDMyInfoClassView.m in Sources */,
|
||||||
188EBF682A47CEA500060F03 /* DDChatVC+MessageTool.m in Sources */,
|
188EBF682A47CEA500060F03 /* DDChatVC+MessageTool.m in Sources */,
|
||||||
|
8C2C3F0E2B27E5D8002C3C34 /* DDReachability.m in Sources */,
|
||||||
18B00BED2A21D7DC001232DF /* DDAnimateImageView.m in Sources */,
|
18B00BED2A21D7DC001232DF /* DDAnimateImageView.m in Sources */,
|
||||||
186EBFB42A401548005623CC /* DDKuoLieHoriCollectionView.m in Sources */,
|
186EBFB42A401548005623CC /* DDKuoLieHoriCollectionView.m in Sources */,
|
||||||
188EC12C2A47CF3200060F03 /* HXPreviewContentView.m in Sources */,
|
188EC12C2A47CF3200060F03 /* HXPreviewContentView.m in Sources */,
|
||||||
@@ -5862,7 +5897,6 @@
|
|||||||
186A89162A41A1E8001DE99E /* DDRealNameModel.m in Sources */,
|
186A89162A41A1E8001DE99E /* DDRealNameModel.m in Sources */,
|
||||||
186777752A4293460096D802 /* CreatRoomCoverViewCell.m in Sources */,
|
186777752A4293460096D802 /* CreatRoomCoverViewCell.m in Sources */,
|
||||||
1882ADC82A52A3F1009081FE /* DDMsgInputView.m in Sources */,
|
1882ADC82A52A3F1009081FE /* DDMsgInputView.m in Sources */,
|
||||||
8C2C3EEA2B27D163002C3C34 /* YYReachability.m in Sources */,
|
|
||||||
1848C22B2A4D11F00031F734 /* RoomAirPlaneContentView.m in Sources */,
|
1848C22B2A4D11F00031F734 /* RoomAirPlaneContentView.m in Sources */,
|
||||||
1826B9D12A497F730023408A /* WebViewJavascriptBridgeBase.m in Sources */,
|
1826B9D12A497F730023408A /* WebViewJavascriptBridgeBase.m in Sources */,
|
||||||
18660CF82A2193750032D0C9 /* JXTAlertView.m in Sources */,
|
18660CF82A2193750032D0C9 /* JXTAlertView.m in Sources */,
|
||||||
@@ -5911,6 +5945,7 @@
|
|||||||
18A7E68B2A4E7C780078E659 /* DDDecorateVC.m in Sources */,
|
18A7E68B2A4E7C780078E659 /* DDDecorateVC.m in Sources */,
|
||||||
186C9CF12A29DDEB00209BB5 /* DDDynamicPicItemView.m in Sources */,
|
186C9CF12A29DDEB00209BB5 /* DDDynamicPicItemView.m in Sources */,
|
||||||
189391DA2A67E6E000674134 /* BBBackRunningManager.m in Sources */,
|
189391DA2A67E6E000674134 /* BBBackRunningManager.m in Sources */,
|
||||||
|
8C2C3F162B27ED7C002C3C34 /* DDUtility+App.m in Sources */,
|
||||||
18D348252A25F3A40011D61C /* DDMyInfoCommonListViewController.m in Sources */,
|
18D348252A25F3A40011D61C /* DDMyInfoCommonListViewController.m in Sources */,
|
||||||
188EBF6C2A47CEA500060F03 /* DDChatVC.m in Sources */,
|
188EBF6C2A47CEA500060F03 /* DDChatVC.m in Sources */,
|
||||||
188EC14E2A47CF3300060F03 /* HXPhotoEditStickerItemContentView.m in Sources */,
|
188EC14E2A47CF3300060F03 /* HXPhotoEditStickerItemContentView.m in Sources */,
|
||||||
@@ -5949,6 +5984,7 @@
|
|||||||
186A88F92A41589D001DE99E /* DDNobleListModel.m in Sources */,
|
186A88F92A41589D001DE99E /* DDNobleListModel.m in Sources */,
|
||||||
188AF57E2A26FBD7004DD4CF /* DDExchangeCell.m in Sources */,
|
188AF57E2A26FBD7004DD4CF /* DDExchangeCell.m in Sources */,
|
||||||
1848C2282A4D118C0031F734 /* RoomLevelPlaneView.m in Sources */,
|
1848C2282A4D118C0031F734 /* RoomLevelPlaneView.m in Sources */,
|
||||||
|
8C2C3F192B27F10D002C3C34 /* DDUtility+Device.m in Sources */,
|
||||||
188EC0E92A47CF3200060F03 /* DDMDeleteCell.m in Sources */,
|
188EC0E92A47CF3200060F03 /* DDMDeleteCell.m in Sources */,
|
||||||
1894A2D12A58111E0085ADAB /* DDMyRechargeHeaderView.m in Sources */,
|
1894A2D12A58111E0085ADAB /* DDMyRechargeHeaderView.m in Sources */,
|
||||||
188EC1072A47CF3200060F03 /* UIViewController+HXExtension.m in Sources */,
|
188EC1072A47CF3200060F03 /* UIViewController+HXExtension.m in Sources */,
|
||||||
@@ -6044,6 +6080,7 @@
|
|||||||
18A7E6882A4E7C250078E659 /* DDDecoratePVC.m in Sources */,
|
18A7E6882A4E7C250078E659 /* DDDecoratePVC.m in Sources */,
|
||||||
187AE1132A496EAC00B427CB /* RoomConfigModel.m in Sources */,
|
187AE1132A496EAC00B427CB /* RoomConfigModel.m in Sources */,
|
||||||
18660D722A21942F0032D0C9 /* BaseCollectionViewHorizontalLayout.m in Sources */,
|
18660D722A21942F0032D0C9 /* BaseCollectionViewHorizontalLayout.m in Sources */,
|
||||||
|
8C2C3F202B2801AC002C3C34 /* DDStatisticsService.m in Sources */,
|
||||||
183864522A28A17B005BF235 /* ZLShowBigImgViewController.m in Sources */,
|
183864522A28A17B005BF235 /* ZLShowBigImgViewController.m in Sources */,
|
||||||
186EBFC32A40363A005623CC /* XPSemiModalPresentationController.m in Sources */,
|
186EBFC32A40363A005623CC /* XPSemiModalPresentationController.m in Sources */,
|
||||||
1826C6012A24A2FE00A5AFDB /* DDMyInformationViewController.m in Sources */,
|
1826C6012A24A2FE00A5AFDB /* DDMyInformationViewController.m in Sources */,
|
||||||
@@ -6104,6 +6141,7 @@
|
|||||||
18660D442A2193C50032D0C9 /* NSString+Custom.m in Sources */,
|
18660D442A2193C50032D0C9 /* NSString+Custom.m in Sources */,
|
||||||
18660CC42A2191660032D0C9 /* CYLPlusButtonSubclass.m in Sources */,
|
18660CC42A2191660032D0C9 /* CYLPlusButtonSubclass.m in Sources */,
|
||||||
1882ADC22A529C17009081FE /* DDEmojiCollCell.m in Sources */,
|
1882ADC22A529C17009081FE /* DDEmojiCollCell.m in Sources */,
|
||||||
|
8C2C3F1C2B27FE43002C3C34 /* DDUtility+Carrier.m in Sources */,
|
||||||
18C9050B2A233F0600F7CAFD /* DDLunboModel.m in Sources */,
|
18C9050B2A233F0600F7CAFD /* DDLunboModel.m in Sources */,
|
||||||
188EBF672A47CEA500060F03 /* DDChatVC+KeyBoardTool.m in Sources */,
|
188EBF672A47CEA500060F03 /* DDChatVC+KeyBoardTool.m in Sources */,
|
||||||
187AE10D2A4943C400B427CB /* RoomBlackListCell.m in Sources */,
|
187AE10D2A4943C400B427CB /* RoomBlackListCell.m in Sources */,
|
||||||
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// DDSpriteSheetManager.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <YYImage/YYSpriteSheetImage.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDSpriteSheeImagetManager : NSObject
|
||||||
|
|
||||||
|
/// 下载 SpriteSheetImage
|
||||||
|
/// - Parameters:
|
||||||
|
/// - url: url
|
||||||
|
/// - completionBlock: 成功
|
||||||
|
/// - failureBlock: 失败
|
||||||
|
- (void)dd_loadSpriteSheetImageWithURL:(NSURL *_Nullable)url
|
||||||
|
completionBlock:(void ( ^ _Nonnull )(YYSpriteSheetImage * _Nullable sprit))completionBlock
|
||||||
|
failureBlock:(void ( ^ _Nullable)(NSError * _Nullable error))failureBlock;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// DDSpriteSheetManager.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDSpriteSheeImagetManager.h"
|
||||||
|
|
||||||
|
@interface DDSpriteSheeImagetManager()
|
||||||
|
@property (nonatomic,strong) YYSpriteSheetImage *sprite;
|
||||||
|
@property (nonatomic,strong) NSMutableDictionary *parserQueue;
|
||||||
|
@property (nonatomic,strong) NSMutableDictionary *retryCache;
|
||||||
|
@property (nonatomic, strong) UIImageView *operationImageView;
|
||||||
|
@end
|
||||||
|
|
||||||
|
@implementation DDSpriteSheeImagetManager
|
||||||
|
|
||||||
|
/// 下载 SpriteSheetImage
|
||||||
|
- (void)dd_loadSpriteSheetImageWithURL:(NSURL *)url
|
||||||
|
completionBlock:(void (^)(YYSpriteSheetImage * _Nullable))completionBlock
|
||||||
|
failureBlock:(void (^)(NSError * _Nullable))failureBlock {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,37 @@
|
|||||||
|
//
|
||||||
|
// DDStatisticsService.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDStatisticsService : NSObject
|
||||||
|
|
||||||
|
/// 埋点数据 不带参数的
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventDescribe:(NSString *)describe;
|
||||||
|
|
||||||
|
/// 埋点的 代参数的
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
/// @param attributes 参数
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventDescribe:(NSString *)describe eventAttributes:(nullable NSDictionary *)attributes;
|
||||||
|
|
||||||
|
/// 统计时长的 开始
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventStart:(NSString *)describe;
|
||||||
|
|
||||||
|
/// 统计时长 结束
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventEnd:(NSString *)describe;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,59 @@
|
|||||||
|
//
|
||||||
|
// DDStatisticsService.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDStatisticsService.h"
|
||||||
|
#import <UMCommon/UMCommon.h>
|
||||||
|
|
||||||
|
@implementation DDStatisticsService
|
||||||
|
|
||||||
|
/// 埋点数据 不带参数的
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventDescribe:(NSString *)describe {
|
||||||
|
if (event == nil || event.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
[self DD_TrackEvent:event eventDescribe:describe eventAttributes:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 埋点的 代参数的
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
/// @param attributes 参数
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventDescribe:(NSString *)describe eventAttributes:(nullable NSDictionary *)attributes {
|
||||||
|
if (event == nil || event.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (attributes.allKeys.count > 0) {
|
||||||
|
[MobClick event:event attributes:attributes];
|
||||||
|
} else {
|
||||||
|
[MobClick event:event label:describe];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 统计时长的 开始
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventStart:(NSString *)describe {
|
||||||
|
if (event == nil || event.length == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[MobClick beginEvent:event label:describe];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 统计时长 结束
|
||||||
|
/// @param event key
|
||||||
|
/// @param describe 描述
|
||||||
|
+ (void)DD_TrackEvent:(NSString *)event eventEnd:(NSString *)describe {
|
||||||
|
if (event == nil || event.length == 0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
[MobClick endEvent:event label:describe];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,134 @@
|
|||||||
|
//
|
||||||
|
// DDDD_StatisticsServiceHelper.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDStatisticsServiceHelper : NSObject
|
||||||
|
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventAppLaunch;
|
||||||
|
#pragma mark - 登录模块的
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventOneClickLoginSuccess; ///一键登录成功
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventLoginPhoneClick;///手机登录
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventLoginQQClick;///QQ登录
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventLoginWXClick;///wx登录
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventLoginRepariSuccess;///注册个人资料保存成功
|
||||||
|
|
||||||
|
#pragma mark - 贵族
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventVipOpenClick;///开通贵族点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventvipEntranceRoomClick;///贵族房间入口点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventvipEntranceGiftClick;///贵族礼物面板入口点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventvipEntranceFaceClick;///贵族表情面板入口点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventvipEntranceMeClick;///贵族我的页面入口点击
|
||||||
|
|
||||||
|
#pragma mark - 首页个播tab
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRecent_card_show;///最近在看卡片曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRecent_card_click;///最近在看卡片点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventGebo_tab_click;///个播页二级tab分类点击
|
||||||
|
|
||||||
|
#pragma mark - 礼物
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoomNugivePopShow; ///房间礼物赠送弹窗曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoomNugivePopClick; ///房间礼物赠送弹窗关闭
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventNugiftPopShow; ///新人专享礼物弹窗曝光(不统计后续个人中心入口的曝光)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventNugiftPopClick; ///新人专享礼物弹窗充值点击,点击时统计用户所选择的购买档位,(需统计后续个人中心入口的点击)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventnugift_pop_finish_click; ///新人专享礼物充值成功后弹窗(需统计对应充值tab档位)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventNugiftPopCloseClick; ///新人专享礼物弹窗关闭点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventUsercenterNugiftPopShow; ///新人专享礼物入口曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventUsercenterNugiftPopClick; ///新人专享礼物入口点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventPersonalshowTopCardShow; ///个播展示卡片曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventPersonalshowTopCardRoomClick; ///个播展示卡片进入房间点击,点击时统计房间id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventPersonalshowTopCardVoiceClick; ///个播展示卡片播放语音点击
|
||||||
|
|
||||||
|
#pragma mark - 个人中心
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_recharge_card_show; ///个人中心充值卡片曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_recharge_card_click; ///个人中心充值卡片点击(跳转充值页)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_noble_card_show; ///个人中心贵族卡片曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_noble_card_click;///个人中心贵族卡片片点击(跳转贵族页)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_function_show; ///个人中心功能板块曝光,曝光时统计功能的名称
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_function_click; ///个人中心功能板块点击,点击时统计功能的名称
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_quick_entry_show; ///个人中心快捷进房曝光,曝光时统计房间的id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_quick_entrysuccess_click; ///个人中心快捷进房点击成功匹配,点击时统计房间的
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_quick_entry_click; ///个人中心快捷进房点击未匹配成功,点击时统计房间的id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_banner_show; ///个人中心banner模块曝光,曝光时统计banner的id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventusercenter_banner_click; ///个人中心banner模块点击,点击时统计banner的id
|
||||||
|
#pragma mark - 活动任务
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventtask_toast_show; ///任务完成toast曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventtask_toast_click; ///任务完成toast点击(跳转活动页
|
||||||
|
#pragma mark - 房间
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventuser_visit_room; ///用户访问房间(进入时统计房间的ID,该房间的停留时长)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_return_click; ///房间返回按钮点击(右滑返回不统计在内)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_online_list_click; ///房间在线列表点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_collect_icon_click; ///房间收藏按钮点击(统计收藏房间的ID)
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_more_icon_click; ///房间更多按钮点击(统计用户展开面板后的行为:● 举报房间● 收起房间● 退出房间● 分享房间● 为你推荐(统计用户跳转后的房间ID))
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_giftlist_click;///房间榜单点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_ranklist_click; ///房间小时榜点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_mike_show; ///房间麦位曝光,只统计该房间在麦上的用户及ID
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_mike_click; ///房间麦位点击,统计用户展开面板后的行为:● 送礼物● 私聊● 关注TA● @TA● 关闭● 资料卡
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_banner_show; ///房间banner曝光,统计曝光banner的ID
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_banner_click; ///房间banner点击,统计点击banner的ID
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_pop_show; ///房间pop曝光,统计曝光pop的名称,如新人充值、糖果树、航海冒险
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_pop_click; ///房间pop点击,统计点击pop的名称,如新人充值、糖果树、航海冒险
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_chatbox_click; ///房间聊天框点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_music_click; ///房间音乐点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_privateletter_click; ///房间私信点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_noble_click; ///房间贵族点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_gift_click; ///房间送礼点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventroom_more_tool_click; ///房间底部更多工具栏点击,统计用户展开面板后的行为
|
||||||
|
#pragma mark - 收藏房间列表
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_editbutton_show; ///管理按钮曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_editbutton_click; ///管理按钮点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_editbutton_complete_click; ///完成按钮点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_entry; ///我的收藏页面访问,统计用户默认落入的tab分类
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_selectall_click; ///全选按钮点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventcollection_delete_click; ///删除按钮点击
|
||||||
|
///许愿礼物
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_wishlist_pop_show; ///礼物心愿气泡曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_wishlist_pop_click; ///礼物心愿气泡点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_show; ///礼物心愿面板曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_click; ///礼物心愿面板赠送点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_close_click; ///礼物心愿面板关闭点击
|
||||||
|
#pragma mark - 首页搜索
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_allinsearch_entry_click; ///词条点击-统计点击时对应词条的名称
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_allinsearch_entry_room_click; ///统计点击时对应房间的名称
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_search_input_click; ///统计用户输入搜索框并搜索的内容
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_search_intercept_pop_show; ///统计弹窗奖励内容的名称
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_search_intercept_pop_click; ///搜索劫持结果弹窗关闭
|
||||||
|
#pragma mark - 打招呼弹窗
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_show; ///打招呼弹窗曝光-统计弹窗主播的id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_find_click; ///打招呼弹窗去找TA点击-统计进房房间的id
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_voice_click; ///打招呼弹窗播放声音秀点击
|
||||||
|
|
||||||
|
#pragma mark - 主播评级
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_grade_profit_pop_click; ///主播评级入口点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_grade_profit_pop_show; ///主播评级入口曝光
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventRoom_grade_profit_close_click; ///主播评级弹窗关闭点击
|
||||||
|
#pragma mark - ID复制
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventID_mycenter_copyid_click;
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventID_mydata_copyid_click; ///个人资料页ID复制点击
|
||||||
|
UIKIT_EXTERN NSString *const DD_StatisticsServiceEventID_datacard_copyid_click; ///房间资料卡ID复制点击
|
||||||
|
///
|
||||||
|
/// 埋点事件
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventWithKey:(NSString *)eventKey;
|
||||||
|
|
||||||
|
/// 埋点事件带参数
|
||||||
|
/// @param eventKey key
|
||||||
|
/// @param eventAttributes 参数
|
||||||
|
+ (void)DD_TrackEventWithKey:(NSString *)eventKey eventAttributes:(NSDictionary * _Nullable)eventAttributes;
|
||||||
|
|
||||||
|
/// 统计时长 开始
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventStartWithKey:(NSString *)eventKey;
|
||||||
|
|
||||||
|
/// 统计时长 结束
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventEndWithKey:(NSString *)eventKey;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,158 @@
|
|||||||
|
//
|
||||||
|
// DDDD_StatisticsServiceHelper.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDStatisticsServiceHelper.h"
|
||||||
|
#import "DDStatisticsService.h"
|
||||||
|
|
||||||
|
@implementation DDStatisticsServiceHelper
|
||||||
|
NSString *const DD_StatisticsServiceEventAppLaunch = @"app_launch";
|
||||||
|
#pragma mark - 登录模块的
|
||||||
|
NSString *const DD_StatisticsServiceEventOneClickLoginSuccess = @"one_click_login_succeed";
|
||||||
|
NSString *const DD_StatisticsServiceEventLoginPhoneClick = @"login_phone_click";
|
||||||
|
NSString *const DD_StatisticsServiceEventLoginQQClick = @"login_qq_click";///QQ登录
|
||||||
|
NSString *const DD_StatisticsServiceEventLoginWXClick = @"login_wx_click";///wx登录
|
||||||
|
NSString *const DD_StatisticsServiceEventLoginRepariSuccess = @"login_repari_success";///注册个人资料保存成功
|
||||||
|
#pragma mark - 贵族
|
||||||
|
NSString *const DD_StatisticsServiceEventVipOpenClick = @"vip_open_click";///开通贵族点击
|
||||||
|
NSString *const DD_StatisticsServiceEventvipEntranceRoomClick = @"vip_entrance_room_click";///贵族房间入口点击
|
||||||
|
NSString *const DD_StatisticsServiceEventvipEntranceGiftClick = @"vip_entrance_gift_click";///贵族礼物面板入口点击
|
||||||
|
NSString *const DD_StatisticsServiceEventvipEntranceFaceClick = @"vip_entrance_face_click";///贵族表情面板入口点击
|
||||||
|
NSString *const DD_StatisticsServiceEventvipEntranceMeClick = @"vip_entrance_me_click";///贵族我的页面入口点击
|
||||||
|
#pragma mark - 首页直播模块
|
||||||
|
NSString *const DD_StatisticsServiceEventRecent_card_show = @"recent_card_show";///最近在看卡片曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventRecent_card_click = @"recent_card_click";///最近在看卡片点击
|
||||||
|
NSString *const DD_StatisticsServiceEventGebo_tab_click = @"gebo_tab_click";///个播页二级tab分类点击
|
||||||
|
|
||||||
|
#pragma mark - 礼物
|
||||||
|
NSString *const DD_StatisticsServiceEventRoomNugivePopShow = @"room_nugive_pop_show"; ///房间礼物赠送弹窗曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventRoomNugivePopClick = @"room_nugive_pop_click"; ///房间礼物赠送弹窗关闭
|
||||||
|
NSString *const DD_StatisticsServiceEventNugiftPopShow = @"nugift_pop_show"; ///新人专享礼物弹窗曝光(不统计后续个人中心入口的曝光)
|
||||||
|
NSString *const DD_StatisticsServiceEventNugiftPopClick = @"nugift_pop_click"; ///新人专享礼物弹窗充值点击,点击时统计用户所选择的购买档位,(需统计后续个人中心入口的点击)
|
||||||
|
NSString *const DD_StatisticsServiceEventnugift_pop_finish_click = @"nugift_pop_finish_click"; ///新人专享礼物充值成功后弹窗(需统计对应充值tab档位)
|
||||||
|
NSString *const DD_StatisticsServiceEventNugiftPopCloseClick = @"nugift_pop_close_click"; ///新人专享礼物弹窗关闭点击
|
||||||
|
NSString *const DD_StatisticsServiceEventUsercenterNugiftPopShow = @"usercenter_nugift_pop_show"; ///新人专享礼物入口曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventUsercenterNugiftPopClick = @"usercenter_nugift_pop_click"; ///新人专享礼物入口点击
|
||||||
|
NSString *const DD_StatisticsServiceEventPersonalshowTopCardShow = @"personalshow_top_card_show"; ///个播展示卡片曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventPersonalshowTopCardRoomClick = @"personalshow_top_card_room_click"; ///个播展示卡片进入房间点击,点击时统计房间id
|
||||||
|
NSString *const DD_StatisticsServiceEventPersonalshowTopCardVoiceClick = @"personalshow_top_card_voice_click"; ///个播展示卡片播放语音点击
|
||||||
|
|
||||||
|
#pragma mark - 个人中心
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_recharge_card_show = @"usercenter_recharge_card_show"; ///个人中心充值卡片曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_recharge_card_click = @"usercenter_recharge_card_click"; ///个人中心充值卡片点击(跳转充值页)
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_noble_card_show = @"usercenter_noble_card_show"; ///个人中心贵族卡片曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_noble_card_click = @"usercenter_noble_card_click";///个人中心贵族卡片片点击(跳转贵族页)
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_function_show = @"usercenter_function_show"; ///个人中心功能板块曝光,曝光时统计功能的名称
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_function_click = @"usercenter_function_click"; ///个人中心功能板块点击,点击时统计功能的名称
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_quick_entry_show = @"usercenter_quick_entry_show"; ///个人中心快捷进房曝光,曝光时统计房间的id
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_quick_entrysuccess_click = @"usercenter_quick_entrysuccess_click"; ///个人中心快捷进房点击成功匹配,点击时统计房间的id
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_quick_entry_click = @"usercenter_quick_entry_click"; ///个人中心快捷进房点击未匹配成功,点击时统计房间的id
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_banner_show = @"usercenter_banner_show"; ///个人中心banner模块曝光,曝光时统计banner的id
|
||||||
|
NSString *const DD_StatisticsServiceEventusercenter_banner_click = @"usercenter_banner_click"; ///个人中心banner模块点击,点击时统计banner的id
|
||||||
|
#pragma mark - 活动任务
|
||||||
|
NSString *const DD_StatisticsServiceEventtask_toast_show = @"task_toast_show"; ///任务完成toast曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventtask_toast_click = @"task_toast_click"; ///任务完成toast点击(跳转活动页
|
||||||
|
#pragma mark - 房间
|
||||||
|
NSString *const DD_StatisticsServiceEventuser_visit_room = @"user_visit_room"; ///用户访问房间(进入时统计房间的ID,该房间的停留时长)
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_return_click = @"room_return_click"; ///房间返回按钮点击(右滑返回不统计在内)
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_online_list_click = @"room_online_list_click"; ///房间在线列表点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_collect_icon_click = @"room_collect_icon_click"; ///房间收藏按钮点击(统计收藏房间的ID)
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_more_icon_click = @"room_more_icon_click"; ///房间更多按钮点击(统计用户展开面板后的行为:● 举报房间● 收起房间● 退出房间● 分享房间● 为你推荐(统计用户跳转后的房间ID))
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_giftlist_click = @"room_giftlist_click"; ///房间榜单点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_ranklist_click = @"room_ranklist_click"; ///房间小时榜点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_mike_show = @"room_mike_show"; ///房间麦位曝光,只统计该房间在麦上的用户及ID
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_mike_click = @"room_mike_click"; ///房间麦位点击,统计用户展开面板后的行为:● 送礼物● 私聊● 关注TA● @TA● 关闭● 资料卡
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_banner_show = @"room_banner_show"; ///房间banner曝光,统计曝光banner的ID
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_banner_click = @"room_banner_click"; ///房间banner点击,统计点击banner的ID
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_pop_show = @"room_pop_show"; ///房间pop曝光,统计曝光pop的名称,如新人充值、糖果树、航海冒险
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_pop_click = @"room_pop_click"; ///房间pop点击,统计点击pop的名称,如新人充值、糖果树、航海冒险
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_chatbox_click = @"room_chatbox_click"; ///房间聊天框点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_music_click = @"room_music_click"; ///房间音乐点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_privateletter_click = @"room_privateletter_click"; ///房间私信点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_noble_click = @"room_noble_click"; ///房间贵族点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_gift_click = @"room_gift_click"; ///房间送礼点击
|
||||||
|
NSString *const DD_StatisticsServiceEventroom_more_tool_click = @"room_more_tool_click"; ///房间底部更多工具栏点击,统计用户展开面板后的行为
|
||||||
|
#pragma mark - 收藏房间列表
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_editbutton_show = @"collection_editbutton_show"; ///管理按钮曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_editbutton_click = @"collection_editbutton_click"; ///管理按钮点击
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_editbutton_complete_click = @"collection_editbutton_complete_click"; ///完成按钮点击
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_entry = @"collection_entry"; ///我的收藏页面访问,统计用户默认落入的tab分类
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_selectall_click = @"collection_selectall_click"; ///全选按钮点击
|
||||||
|
NSString *const DD_StatisticsServiceEventcollection_delete_click = @"collection_delete_click"; ///删除按钮点击
|
||||||
|
#pragma mark - 心愿礼物
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_wishlist_pop_show = @"wishlist_pop_show"; ///礼物心愿气泡曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_wishlist_pop_click = @"wishlist_pop_click"; ///礼物心愿气泡点击
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_show = @"wishlist_panel_show"; ///礼物心愿面板曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_click = @"wishlist_panel_click"; ///礼物心愿面板赠送点击
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_wishlist_panel_close_click = @"wishlist_panel_close_click"; ///礼物心愿面板关闭点击
|
||||||
|
#pragma mark - 首页搜索
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_allinsearch_entry_click = @"allinsearch_entry_click"; ///词条点击-统计点击时对应词条的名称
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_allinsearch_entry_room_click = @"allinsearch_entry_room_click"; ///统计点击时对应房间的名称
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_search_input_click = @"search_input_click"; ///统计用户输入搜索框并搜索的内容
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_search_intercept_pop_show = @"search_intercept_pop_show"; ///统计弹窗奖励内容的名称
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_search_intercept_pop_click = @"search_intercept_pop_click"; ///搜索劫持结果弹窗关闭
|
||||||
|
#pragma mark - 打招呼弹窗
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_show = @"sayhi_pop_show"; ///打招呼弹窗曝光-统计弹窗主播的id
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_find_click = @"sayhi_pop_find_click"; ///打招呼弹窗去找TA点击-统计进房房间的id
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_sayhi_pop_voice_click = @"sayhi_pop_voice_click"; ///打招呼弹窗播放声音秀点击
|
||||||
|
|
||||||
|
#pragma mark - 主播评级
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_grade_profit_pop_click = @"grade_profit_pop_click"; ///主播评级入口点击
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_grade_profit_pop_show = @"grade_profit_pop_show"; ///主播评级入口曝光
|
||||||
|
NSString *const DD_StatisticsServiceEventRoom_grade_profit_close_click = @"grade_profit_close_click"; ///主播评级弹窗关闭点击
|
||||||
|
|
||||||
|
#pragma mark - ID复制
|
||||||
|
NSString *const DD_StatisticsServiceEventID_mycenter_copyid_click = @"mycenter_copyid_click"; ///个人中心ID复制点击
|
||||||
|
NSString *const DD_StatisticsServiceEventID_mydata_copyid_click = @"mydata_copyid_click"; ///个人资料页ID复制点击
|
||||||
|
NSString *const DD_StatisticsServiceEventID_datacard_copyid_click = @"datacard_copyid_click"; ///房间资料卡ID复制点击
|
||||||
|
|
||||||
|
/// 埋点事件
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventWithKey:(NSString *)eventKey {
|
||||||
|
[self DD_TrackEventWithKey:eventKey eventAttributes:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 埋点事件带参数
|
||||||
|
/// @param eventKey key
|
||||||
|
/// @param eventAttributes 参数
|
||||||
|
+ (void)DD_TrackEventWithKey:(NSString *)eventKey eventAttributes:(NSDictionary * _Nullable)eventAttributes {
|
||||||
|
[DDStatisticsService DD_TrackEvent:eventKey eventDescribe:[self DD_GetTrackEventDescripWithKey:eventKey] eventAttributes:eventAttributes];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// 统计时长 开始
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventStartWithKey:(NSString *)eventKey {
|
||||||
|
[DDStatisticsService DD_TrackEvent:eventKey eventStart:[self DD_GetTrackEventDescripWithKey:eventKey]];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 统计时长 结束
|
||||||
|
/// @param eventKey key
|
||||||
|
+ (void)DD_TrackEventEndWithKey:(NSString *)eventKey {
|
||||||
|
[DDStatisticsService DD_TrackEvent:eventKey eventEnd:[self DD_GetTrackEventDescripWithKey:eventKey]];
|
||||||
|
}
|
||||||
|
|
||||||
|
///埋点 只需要在这个里面 进行相应的配置 即可 key 和descrip
|
||||||
|
+ (NSString *)DD_GetTrackEventDescripWithKey:(NSString *)key {
|
||||||
|
NSDictionary * dic = @{
|
||||||
|
DD_StatisticsServiceEventAppLaunch:@"应用启动",
|
||||||
|
DD_StatisticsServiceEventOneClickLoginSuccess:@"一键登录成功",
|
||||||
|
DD_StatisticsServiceEventLoginPhoneClick:@"手机登录",
|
||||||
|
DD_StatisticsServiceEventLoginQQClick:@"qq登录",
|
||||||
|
DD_StatisticsServiceEventLoginWXClick:@"微信登录",
|
||||||
|
DD_StatisticsServiceEventLoginRepariSuccess:@"注册时候的个人资料保存成功",
|
||||||
|
DD_StatisticsServiceEventVipOpenClick:@"开通贵族点击",
|
||||||
|
DD_StatisticsServiceEventvipEntranceRoomClick:@"贵族房间入口点击",
|
||||||
|
DD_StatisticsServiceEventvipEntranceGiftClick:@"贵族礼物面板入口点击",
|
||||||
|
DD_StatisticsServiceEventvipEntranceFaceClick:@"贵族表情面板入口点击",
|
||||||
|
DD_StatisticsServiceEventvipEntranceMeClick:@"贵族我的页面入口点击"
|
||||||
|
};
|
||||||
|
NSString * decription = [dic objectForKey:DD_StatisticsServiceEventAppLaunch];
|
||||||
|
return decription;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,80 @@
|
|||||||
|
//
|
||||||
|
// DDReachability.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#import <SystemConfiguration/SystemConfiguration.h>
|
||||||
|
|
||||||
|
#import <sys/socket.h>
|
||||||
|
#import <netinet/in.h>
|
||||||
|
#import <netinet6/in6.h>
|
||||||
|
#import <arpa/inet.h>
|
||||||
|
#import <ifaddrs.h>
|
||||||
|
#import <netdb.h>
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
#if OS_OBJECT_USE_OBJC
|
||||||
|
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
|
||||||
|
#else
|
||||||
|
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef NS_ENUM
|
||||||
|
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern NSString *const kDDReachabilityChangedNotification;
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSInteger, DDNetworkStatus) {
|
||||||
|
// Apple NetworkStatus Compatible Names.
|
||||||
|
DDNotReachable = 0,
|
||||||
|
DDReachableViaWiFi = 2,
|
||||||
|
DDReachableViaWWAN = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
@class DDReachability;
|
||||||
|
|
||||||
|
typedef void (^DDNetworkReachable)(DDReachability * reachability);
|
||||||
|
typedef void (^DDNetworkUnreachable)(DDReachability * reachability);
|
||||||
|
|
||||||
|
@interface DDReachability : NSObject
|
||||||
|
|
||||||
|
@property (nonatomic, copy) DDNetworkReachable reachableBlock;
|
||||||
|
@property (nonatomic, copy) DDNetworkUnreachable unreachableBlock;
|
||||||
|
@property (nonatomic, assign) BOOL reachableOnWWAN;
|
||||||
|
|
||||||
|
|
||||||
|
+ (DDReachability*)DD_ReachabilityWithHostname:(NSString*)hostname;
|
||||||
|
+ (DDReachability*)DD_ReachabilityForInternetConnection;
|
||||||
|
+ (DDReachability*)DD_ReachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
|
||||||
|
+ (DDReachability*)DD_ReachabilityForLocalWiFi;
|
||||||
|
|
||||||
|
- (DDReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
|
||||||
|
|
||||||
|
- (BOOL)dd_startNotifier;
|
||||||
|
- (void)dd_stopNotifier;
|
||||||
|
|
||||||
|
- (BOOL)dd_isReachable;
|
||||||
|
- (BOOL)dd_isReachableViaWWAN;
|
||||||
|
- (BOOL)dd_isReachableViaWiFi;
|
||||||
|
|
||||||
|
// WWAN may be available, but not active until a connection has been established.
|
||||||
|
// WiFi may require a connection for VPN on Demand.
|
||||||
|
- (BOOL)dd_isConnectionRequired; // Identical DDG variant.
|
||||||
|
- (BOOL)dd_connectionRequired; // Apple's routine.
|
||||||
|
// Dynamic, on demand connection?
|
||||||
|
- (BOOL)dd_isConnectionOnDemand;
|
||||||
|
// Is user intervention required?
|
||||||
|
- (BOOL)dd_isInterventionRequired;
|
||||||
|
|
||||||
|
- (NetworkStatus)dd_currentReachabilityStatus;
|
||||||
|
- (SCNetworkReachabilityFlags)dd_reachabilityFlags;
|
||||||
|
- (NSString*)dd_currentReachabilityString;
|
||||||
|
- (NSString*)dd_currentReachabilityFlags;
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -1,54 +1,31 @@
|
|||||||
/*
|
//
|
||||||
Copyright (c) 2011, Tony Million.
|
// DDReachability.m
|
||||||
All rights reserved.
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
#import "DDReachability.h"
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
NSString *const kDDReachabilityChangedNotification = @"kDDReachabilityChangedNotification";
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import "YYReachability.h"
|
|
||||||
|
|
||||||
|
|
||||||
NSString *const kYYReachabilityChangedNotification = @"kYYReachabilityChangedNotification";
|
|
||||||
|
|
||||||
@interface YYReachability ()
|
|
||||||
|
|
||||||
|
@interface DDReachability()
|
||||||
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
|
@property (nonatomic, assign) SCNetworkReachabilityRef reachabilityRef;
|
||||||
|
|
||||||
|
|
||||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||||
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
|
@property (nonatomic, assign) dispatch_queue_t reachabilitySerialQueue;
|
||||||
#else
|
#else
|
||||||
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
|
@property (nonatomic, strong) dispatch_queue_t reachabilitySerialQueue;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@property (nonatomic, strong) id reachabilityObject;
|
@property (nonatomic, strong) id reachabilityObject;
|
||||||
|
|
||||||
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags;
|
- (void)dd_reachabilityChanged:(SCNetworkReachabilityFlags)flags;
|
||||||
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
|
- (BOOL)dd_isReachableWithFlags:(SCNetworkReachabilityFlags)flags;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
||||||
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
|
static NSString *reachabilityFlags(SCNetworkReachabilityFlags flags)
|
||||||
{
|
{
|
||||||
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
|
return [NSString stringWithFormat:@"%c%c %c%c%c%c%c%c%c",
|
||||||
@@ -72,21 +49,20 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
{
|
{
|
||||||
#pragma unused (target)
|
#pragma unused (target)
|
||||||
#if __has_feature(objc_arc)
|
#if __has_feature(objc_arc)
|
||||||
YYReachability *reachability = ((__bridge YYReachability*)info);
|
DDReachability *reachability = ((__bridge DDReachability*)info);
|
||||||
#else
|
#else
|
||||||
YYReachability *reachability = ((YYReachability*)info);
|
DDReachability *reachability = ((DDReachability*)info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool,
|
// We probably don't need an autoreleasepool here, as GCD docs state each queue has its own autorelease pool,
|
||||||
// but what the heck eh?
|
// but what the heck eh?
|
||||||
@autoreleasepool
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
[reachability reachabilityChanged:flags];
|
[reachability dd_reachabilityChanged:flags];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@implementation DDReachability
|
||||||
@implementation YYReachability
|
|
||||||
|
|
||||||
@synthesize reachabilityRef;
|
@synthesize reachabilityRef;
|
||||||
@synthesize reachabilitySerialQueue;
|
@synthesize reachabilitySerialQueue;
|
||||||
@@ -98,15 +74,9 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
|
|
||||||
@synthesize reachabilityObject;
|
@synthesize reachabilityObject;
|
||||||
|
|
||||||
#pragma mark - Class Constructor Methods
|
|
||||||
|
|
||||||
+(YYReachability*)reachabilityWithHostName:(NSString*)hostname
|
#pragma mark - Public Class Method
|
||||||
{
|
+ (DDReachability *)DD_ReachabilityWithHostname:(NSString *)hostname {
|
||||||
return [YYReachability reachabilityWithHostname:hostname];
|
|
||||||
}
|
|
||||||
|
|
||||||
+(YYReachability*)reachabilityWithHostname:(NSString*)hostname
|
|
||||||
{
|
|
||||||
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
|
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithName(NULL, [hostname UTF8String]);
|
||||||
if (ref)
|
if (ref)
|
||||||
{
|
{
|
||||||
@@ -123,8 +93,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
+(YYReachability *)reachabilityWithAddress:(const struct sockaddr_in *)hostAddress
|
+ (DDReachability *)DD_ReachabilityWithAddress:(const struct sockaddr_in *)hostAddress {
|
||||||
{
|
|
||||||
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
|
SCNetworkReachabilityRef ref = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr*)hostAddress);
|
||||||
if (ref)
|
if (ref)
|
||||||
{
|
{
|
||||||
@@ -140,85 +109,56 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
+(YYReachability *)reachabilityForInternetConnection
|
+ (DDReachability *)DD_ReachabilityForInternetConnection {
|
||||||
{
|
|
||||||
struct sockaddr_in zeroAddress;
|
struct sockaddr_in zeroAddress;
|
||||||
bzero(&zeroAddress, sizeof(zeroAddress));
|
bzero(&zeroAddress, sizeof(zeroAddress));
|
||||||
zeroAddress.sin_len = sizeof(zeroAddress);
|
zeroAddress.sin_len = sizeof(zeroAddress);
|
||||||
zeroAddress.sin_family = AF_INET;
|
zeroAddress.sin_family = AF_INET;
|
||||||
|
return [self DD_ReachabilityWithAddress:&zeroAddress];
|
||||||
return [self reachabilityWithAddress:&zeroAddress];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+(YYReachability*)reachabilityForLocalWiFi
|
+ (DDReachability *)DD_ReachabilityForLocalWiFi {
|
||||||
{
|
|
||||||
struct sockaddr_in localWifiAddress;
|
struct sockaddr_in localWifiAddress;
|
||||||
bzero(&localWifiAddress, sizeof(localWifiAddress));
|
bzero(&localWifiAddress, sizeof(localWifiAddress));
|
||||||
localWifiAddress.sin_len = sizeof(localWifiAddress);
|
localWifiAddress.sin_len = sizeof(localWifiAddress);
|
||||||
localWifiAddress.sin_family = AF_INET;
|
localWifiAddress.sin_family = AF_INET;
|
||||||
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
|
// IN_LINKLOCALNETNUM is defined in <netinet/in.h> as 169.254.0.0
|
||||||
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
|
localWifiAddress.sin_addr.s_addr = htonl(IN_LINKLOCALNETNUM);
|
||||||
|
return [self DD_ReachabilityWithAddress:&localWifiAddress];
|
||||||
return [self reachabilityWithAddress:&localWifiAddress];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma mark - Public Instance Method
|
||||||
// Initialization methods
|
- (DDReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref {
|
||||||
|
|
||||||
-(YYReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref
|
|
||||||
{
|
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil) {
|
||||||
{
|
|
||||||
self.reachableOnWWAN = YES;
|
self.reachableOnWWAN = YES;
|
||||||
self.reachabilityRef = ref;
|
self.reachabilityRef = ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)dealloc
|
- (void)dealloc {
|
||||||
{
|
[self dd_stopNotifier];
|
||||||
[self stopNotifier];
|
if (self.reachabilityRef) {
|
||||||
|
|
||||||
if(self.reachabilityRef)
|
|
||||||
{
|
|
||||||
CFRelease(self.reachabilityRef);
|
CFRelease(self.reachabilityRef);
|
||||||
self.reachabilityRef = nil;
|
self.reachabilityRef = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.reachableBlock = nil;
|
self.reachableBlock = nil;
|
||||||
self.unreachableBlock = nil;
|
self.unreachableBlock = nil;
|
||||||
|
|
||||||
#if !(__has_feature(objc_arc))
|
#if !(__has_feature(objc_arc))
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Notifier Methods
|
#pragma mark - Notifier Methods
|
||||||
|
- (BOOL)dd_startNotifier {
|
||||||
// Notifier
|
|
||||||
// NOTE: This uses GCD to trigger the blocks - they *WILL NOT* be called on THE MAIN THREAD
|
|
||||||
// - In other words DO NOT DO ANY UI UPDATES IN THE BLOCKS.
|
|
||||||
// INSTEAD USE dispatch_async(dispatch_get_main_queue(), ^{UISTUFF}) (or dispatch_sync if you want)
|
|
||||||
|
|
||||||
-(BOOL)startNotifier
|
|
||||||
{
|
|
||||||
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
|
SCNetworkReachabilityContext context = { 0, NULL, NULL, NULL, NULL };
|
||||||
|
|
||||||
// this should do a retain on ourself, so as long as we're in notifier mode we shouldn't disappear out from under ourselves
|
|
||||||
// woah
|
|
||||||
self.reachabilityObject = self;
|
self.reachabilityObject = self;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// First, we need to create a serial queue.
|
|
||||||
// We allocate this once for the lifetime of the notifier.
|
|
||||||
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
|
self.reachabilitySerialQueue = dispatch_queue_create("com.tonymillion.reachability", NULL);
|
||||||
if(!self.reachabilitySerialQueue)
|
if(!self.reachabilitySerialQueue) {
|
||||||
{
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -228,15 +168,13 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
context.info = (void *)self;
|
context.info = (void *)self;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context))
|
if (!SCNetworkReachabilitySetCallback(self.reachabilityRef, TMReachabilityCallback, &context)) {
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
|
NSLog(@"SCNetworkReachabilitySetCallback() failed: %s", SCErrorString(SCError()));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Clear out the dispatch queue
|
// Clear out the dispatch queue
|
||||||
if(self.reachabilitySerialQueue)
|
if(self.reachabilitySerialQueue) {
|
||||||
{
|
|
||||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||||
dispatch_release(self.reachabilitySerialQueue);
|
dispatch_release(self.reachabilitySerialQueue);
|
||||||
#endif
|
#endif
|
||||||
@@ -249,8 +187,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set it as our reachability queue, which will retain the queue
|
// Set it as our reachability queue, which will retain the queue
|
||||||
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue))
|
if(!SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, self.reachabilitySerialQueue)) {
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
|
NSLog(@"SCNetworkReachabilitySetDispatchQueue() failed: %s", SCErrorString(SCError()));
|
||||||
#endif
|
#endif
|
||||||
@@ -261,8 +198,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
||||||
|
|
||||||
// Then clear out the dispatch queue.
|
// Then clear out the dispatch queue.
|
||||||
if(self.reachabilitySerialQueue)
|
if(self.reachabilitySerialQueue) {
|
||||||
{
|
|
||||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||||
dispatch_release(self.reachabilitySerialQueue);
|
dispatch_release(self.reachabilitySerialQueue);
|
||||||
#endif
|
#endif
|
||||||
@@ -277,16 +213,14 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(void)stopNotifier
|
- (void)dd_stopNotifier {
|
||||||
{
|
|
||||||
// First stop, any callbacks!
|
// First stop, any callbacks!
|
||||||
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
SCNetworkReachabilitySetCallback(self.reachabilityRef, NULL, NULL);
|
||||||
|
|
||||||
// Unregister target from the GCD serial dispatch queue.
|
// Unregister target from the GCD serial dispatch queue.
|
||||||
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
|
SCNetworkReachabilitySetDispatchQueue(self.reachabilityRef, NULL);
|
||||||
|
|
||||||
if(self.reachabilitySerialQueue)
|
if(self.reachabilitySerialQueue) {
|
||||||
{
|
|
||||||
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
#if NEEDS_DISPATCH_RETAIN_RELEASE
|
||||||
dispatch_release(self.reachabilitySerialQueue);
|
dispatch_release(self.reachabilitySerialQueue);
|
||||||
#endif
|
#endif
|
||||||
@@ -298,18 +232,8 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
|
|
||||||
#pragma mark - reachability tests
|
#pragma mark - reachability tests
|
||||||
|
|
||||||
// This is for the case where you flick the airplane mode;
|
|
||||||
// you end up getting something like this:
|
|
||||||
//Reachability: WR ct-----
|
|
||||||
//Reachability: -- -------
|
|
||||||
//Reachability: WR ct-----
|
|
||||||
//Reachability: -- -------
|
|
||||||
// We treat this as 4 UNREACHABLE triggers - really apple should do better than this
|
|
||||||
|
|
||||||
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
|
#define testcase (kSCNetworkReachabilityFlagsConnectionRequired | kSCNetworkReachabilityFlagsTransientConnection)
|
||||||
|
- (BOOL)dd_isReachableWithFlags:(SCNetworkReachabilityFlags)flags {
|
||||||
-(BOOL)isReachableWithFlags:(SCNetworkReachabilityFlags)flags
|
|
||||||
{
|
|
||||||
BOOL connectionUP = YES;
|
BOOL connectionUP = YES;
|
||||||
|
|
||||||
if(!(flags & kSCNetworkReachabilityFlagsReachable))
|
if(!(flags & kSCNetworkReachabilityFlagsReachable))
|
||||||
@@ -319,11 +243,9 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
connectionUP = NO;
|
connectionUP = NO;
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
|
if(flags & kSCNetworkReachabilityFlagsIsWWAN) {
|
||||||
{
|
|
||||||
// We're on 3G.
|
// We're on 3G.
|
||||||
if(!self.reachableOnWWAN)
|
if(!self.reachableOnWWAN) {
|
||||||
{
|
|
||||||
// We don't want to connect when on 3G.
|
// We don't want to connect when on 3G.
|
||||||
connectionUP = NO;
|
connectionUP = NO;
|
||||||
}
|
}
|
||||||
@@ -333,30 +255,25 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return connectionUP;
|
return connectionUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)isReachable
|
- (BOOL)dd_isReachable {
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags;
|
SCNetworkReachabilityFlags flags;
|
||||||
|
|
||||||
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
|
if(!SCNetworkReachabilityGetFlags(self.reachabilityRef, &flags))
|
||||||
return NO;
|
return NO;
|
||||||
|
|
||||||
return [self isReachableWithFlags:flags];
|
return [self dd_isReachableWithFlags:flags];
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)isReachableViaWWAN
|
- (BOOL)dd_isReachableViaWWAN {
|
||||||
{
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
|
|
||||||
SCNetworkReachabilityFlags flags = 0;
|
SCNetworkReachabilityFlags flags = 0;
|
||||||
|
|
||||||
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
// Check we're REACHABLE
|
// Check we're REACHABLE
|
||||||
if(flags & kSCNetworkReachabilityFlagsReachable)
|
if(flags & kSCNetworkReachabilityFlagsReachable) {
|
||||||
{
|
|
||||||
// Now, check we're on WWAN
|
// Now, check we're on WWAN
|
||||||
if(flags & kSCNetworkReachabilityFlagsIsWWAN)
|
if(flags & kSCNetworkReachabilityFlagsIsWWAN) {
|
||||||
{
|
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -366,19 +283,15 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)isReachableViaWiFi
|
- (BOOL)dd_isReachableViaWiFi {
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags = 0;
|
SCNetworkReachabilityFlags flags = 0;
|
||||||
|
|
||||||
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
// Check we're reachable
|
// Check we're reachable
|
||||||
if((flags & kSCNetworkReachabilityFlagsReachable))
|
if((flags & kSCNetworkReachabilityFlagsReachable)) {
|
||||||
{
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
// Check we're NOT on WWAN
|
// Check we're NOT on WWAN
|
||||||
if((flags & kSCNetworkReachabilityFlagsIsWWAN))
|
if((flags & kSCNetworkReachabilityFlagsIsWWAN)) {
|
||||||
{
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -389,33 +302,24 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL)dd_isConnectionRequired {
|
||||||
// WWAN may be available, but not active until a connection has been established.
|
return [self dd_connectionRequired];
|
||||||
// WiFi may require a connection for VPN on Demand.
|
|
||||||
-(BOOL)isConnectionRequired
|
|
||||||
{
|
|
||||||
return [self connectionRequired];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-(BOOL)connectionRequired
|
- (BOOL)dd_connectionRequired {
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags;
|
SCNetworkReachabilityFlags flags;
|
||||||
|
|
||||||
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
|
return (flags & kSCNetworkReachabilityFlagsConnectionRequired);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dynamic, on demand connection?
|
- (BOOL)dd_isConnectionOnDemand {
|
||||||
-(BOOL)isConnectionOnDemand
|
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags;
|
SCNetworkReachabilityFlags flags;
|
||||||
|
|
||||||
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
||||||
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
|
(flags & (kSCNetworkReachabilityFlagsConnectionOnTraffic | kSCNetworkReachabilityFlagsConnectionOnDemand)));
|
||||||
}
|
}
|
||||||
@@ -423,13 +327,10 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is user intervention required?
|
- (BOOL)dd_isInterventionRequired {
|
||||||
-(BOOL)isInterventionRequired
|
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags;
|
SCNetworkReachabilityFlags flags;
|
||||||
|
|
||||||
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if (SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
return ((flags & kSCNetworkReachabilityFlagsConnectionRequired) &&
|
||||||
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
|
(flags & kSCNetworkReachabilityFlagsInterventionRequired));
|
||||||
}
|
}
|
||||||
@@ -437,14 +338,10 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - reachability status stuff
|
#pragma mark - reachability status stuff
|
||||||
|
- (NetworkStatus)dd_currentReachabilityStatus {
|
||||||
-(NetworkStatus)currentReachabilityStatus
|
if([self dd_isReachable]) {
|
||||||
{
|
if([self dd_isReachableViaWiFi])
|
||||||
if([self isReachable])
|
|
||||||
{
|
|
||||||
if([self isReachableViaWiFi])
|
|
||||||
return ReachableViaWiFi;
|
return ReachableViaWiFi;
|
||||||
|
|
||||||
#if TARGET_OS_IPHONE
|
#if TARGET_OS_IPHONE
|
||||||
@@ -455,62 +352,50 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
return NotReachable;
|
return NotReachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(SCNetworkReachabilityFlags)reachabilityFlags
|
- (SCNetworkReachabilityFlags)dd_reachabilityFlags {
|
||||||
{
|
|
||||||
SCNetworkReachabilityFlags flags = 0;
|
SCNetworkReachabilityFlags flags = 0;
|
||||||
|
|
||||||
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags))
|
if(SCNetworkReachabilityGetFlags(reachabilityRef, &flags)) {
|
||||||
{
|
|
||||||
return flags;
|
return flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*)currentReachabilityString
|
- (NSString *)dd_currentReachabilityString {
|
||||||
{
|
NetworkStatus temp = [self dd_currentReachabilityStatus];
|
||||||
NetworkStatus temp = [self currentReachabilityStatus];
|
|
||||||
|
|
||||||
if(temp == reachableOnWWAN)
|
if(temp == reachableOnWWAN) {
|
||||||
{
|
|
||||||
// Updated for the fact that we have CDMA phones now!
|
// Updated for the fact that we have CDMA phones now!
|
||||||
return NSLocalizedString(@"Cellular", @"");
|
return NSLocalizedString(@"Cellular", @"");
|
||||||
}
|
}
|
||||||
if (temp == ReachableViaWiFi)
|
|
||||||
{
|
if (temp == ReachableViaWiFi) {
|
||||||
return NSLocalizedString(@"WiFi", @"");
|
return NSLocalizedString(@"WiFi", @"");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NSLocalizedString(@"No Connection", @"");
|
return NSLocalizedString(@"No Connection", @"");
|
||||||
}
|
}
|
||||||
|
|
||||||
-(NSString*)currentReachabilityFlags
|
- (NSString *)dd_currentReachabilityFlags {
|
||||||
{
|
return reachabilityFlags([self dd_reachabilityFlags]);
|
||||||
return reachabilityFlags([self reachabilityFlags]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - Callback function calls this method
|
#pragma mark - Callback function calls this method
|
||||||
|
- (void)dd_reachabilityChanged:(SCNetworkReachabilityFlags)flags {
|
||||||
-(void)reachabilityChanged:(SCNetworkReachabilityFlags)flags
|
if([self dd_isReachableWithFlags:flags]) {
|
||||||
{
|
if(self.reachableBlock) {
|
||||||
if([self isReachableWithFlags:flags])
|
|
||||||
{
|
|
||||||
if(self.reachableBlock)
|
|
||||||
{
|
|
||||||
self.reachableBlock(self);
|
self.reachableBlock(self);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
if(self.unreachableBlock) {
|
||||||
{
|
|
||||||
if(self.unreachableBlock)
|
|
||||||
{
|
|
||||||
self.unreachableBlock(self);
|
self.unreachableBlock(self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this makes sure the change notification happens on the MAIN THREAD
|
// this makes sure the change notification happens on the MAIN THREAD
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
[[NSNotificationCenter defaultCenter] postNotificationName:kYYReachabilityChangedNotification
|
[[NSNotificationCenter defaultCenter] postNotificationName:kDDReachabilityChangedNotification
|
||||||
object:self];
|
object:self];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -519,9 +404,7 @@ static void TMReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkRea
|
|||||||
|
|
||||||
- (NSString *)description
|
- (NSString *)description
|
||||||
{
|
{
|
||||||
NSString *description = [NSString stringWithFormat:@"<%@: %#x>",
|
return [NSString stringWithFormat:@"<%@: %#x>", NSStringFromClass([self class]), (unsigned int)self];
|
||||||
NSStringFromClass([self class]), (unsigned int) self];
|
|
||||||
return description;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
@@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// DDCarrierIdentifier.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
typedef NS_ENUM(NSUInteger, DDCarrierIdentifier) {
|
||||||
|
DD_CarrierIdentifier_Unknown = 0, // 未知, 网络不可用(未插SIM卡/无信号/飞行模式)
|
||||||
|
DD_CarrierIdentifier_ChinaMobile = 1, // 中国移动
|
||||||
|
DD_CarrierIdentifier_ChinaUnicom = 2, // 中国联通
|
||||||
|
DD_CarrierIdentifier_ChinaTelecom = 3, // 中国电信
|
||||||
|
DD_CarrierIdentifier_Otherwise = 0x0000FFFF, // 其他运营商
|
||||||
|
};
|
||||||
|
|
@@ -0,0 +1,64 @@
|
|||||||
|
//
|
||||||
|
// 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
|
@@ -0,0 +1,140 @@
|
|||||||
|
//
|
||||||
|
// DDUtility+App.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDUtility+App.h"
|
||||||
|
|
||||||
|
static NSString * const kMobileFrameworkResourceBundleName = @"YYMobileFrameworkRes";
|
||||||
|
static NSString *_from = nil;
|
||||||
|
@implementation DDUtility (App)
|
||||||
|
|
||||||
|
#pragma mark - Public Method
|
||||||
|
// 从YYMobile-Info.plist中读取字段
|
||||||
|
+ (id)DD_ValueInPlistForKey:(NSString *)key {
|
||||||
|
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
|
||||||
|
return [infoDictionary objectForKey:key];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取App版本号
|
||||||
|
+ (NSString *)DD_AppVersion {
|
||||||
|
static NSString *appVersion = nil;
|
||||||
|
if (!appVersion) {
|
||||||
|
appVersion = [self DD_ValueInPlistForKey:@"CFBundleShortVersionString"];
|
||||||
|
}
|
||||||
|
return appVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取appName
|
||||||
|
+ (NSString *)DD_AppName {
|
||||||
|
return @"yinmeng";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取AppBuild号
|
||||||
|
+ (NSString *)DD_AppBuild {
|
||||||
|
static NSString *appBuild = nil;
|
||||||
|
if (!appBuild) {
|
||||||
|
appBuild = [self DD_ValueInPlistForKey:(NSString *)kCFBundleVersionKey];
|
||||||
|
}
|
||||||
|
return appBuild;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取bundle id
|
||||||
|
+ (NSString *)DD_AppBundleId {
|
||||||
|
static NSString *appBundleId = nil;
|
||||||
|
if (!appBundleId) {
|
||||||
|
appBundleId = [self DD_ValueInPlistForKey:(NSString *)kCFBundleIdentifierKey];
|
||||||
|
}
|
||||||
|
return appBundleId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 当前构建出的版本在svn中的版本号
|
||||||
|
+ (NSString *)DD_SvnVersion {
|
||||||
|
static NSString *svnVersion = nil;
|
||||||
|
if (!svnVersion) {
|
||||||
|
svnVersion = [self DD_ValueInPlistForKey:@"SvnBuildVersion"];
|
||||||
|
}
|
||||||
|
return svnVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取YYMobileFrameworkRes.bundle的URL
|
||||||
|
+ (NSURL *)DD_URLForMobileFrameworkResourceBundle {
|
||||||
|
return [[NSBundle mainBundle] URLForResource:kMobileFrameworkResourceBundleName
|
||||||
|
withExtension:@"bundle"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取YYMobileFrameworkRes.bundle的路
|
||||||
|
+ (NSString *)DD_PathForMobileFrameworkResourceBundle {
|
||||||
|
return [[NSBundle mainBundle] pathForResource:kMobileFrameworkResourceBundleName
|
||||||
|
ofType:@"bundle"];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前的构建类型(DEBUG/RELEASE)
|
||||||
|
+ (NSString *)DD_BuildType {
|
||||||
|
#ifdef DEBUG
|
||||||
|
return @"DEBUG";
|
||||||
|
#else
|
||||||
|
return @"RELEASE";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)DD_AddSkipBackupAttributeToItemAtURL:(NSURL *)fileURL {
|
||||||
|
if (![[NSFileManager defaultManager] fileExistsAtPath:[fileURL path]]) {
|
||||||
|
NSLog(@"File %@ dosen't exist!", fileURL);
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSError *error = nil;
|
||||||
|
BOOL result = [fileURL setResourceValue:[NSNumber numberWithBool:YES]
|
||||||
|
forKey:NSURLIsExcludedFromBackupKey
|
||||||
|
error:&error];
|
||||||
|
if (!result) {
|
||||||
|
NSLog(@"Error excluding '%@' from backup, error: %@.", fileURL, error);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取平台渠道
|
||||||
|
+ (NSString *)DD_GetAppSource {
|
||||||
|
if (_from == nil) {
|
||||||
|
NSString *path = [[NSBundle mainBundle] pathForResource:@"sourceid.dat" ofType:nil];
|
||||||
|
|
||||||
|
NSError *error;
|
||||||
|
NSString *from = [NSString stringWithContentsOfFile:path encoding:NSUTF8StringEncoding error:&error];
|
||||||
|
|
||||||
|
// 去除换行及空格
|
||||||
|
if (from) {
|
||||||
|
from = [self dd_removeSpaceAndNewline:from];
|
||||||
|
}
|
||||||
|
// 如果读到有值且不为0
|
||||||
|
if (!error
|
||||||
|
&& ![from isEqualToString:@"0"]
|
||||||
|
&& ![from isEqualToString:@""]) {
|
||||||
|
_from = from;
|
||||||
|
} else {
|
||||||
|
_from = @"yinmeng_appstore"; // App Store包
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _from;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)DD_IsFromAppStore {
|
||||||
|
return [[[DDUtility DD_GetAppSource] lowercaseString] isEqualToString:@"appstore"];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
+ (NSString *)dd_removeSpaceAndNewline:(NSString *)str {
|
||||||
|
NSString *temp = [str stringByReplacingOccurrencesOfString:@" " withString:@""];
|
||||||
|
temp = [temp stringByReplacingOccurrencesOfString:@"\r" withString:@""];
|
||||||
|
temp = [temp stringByReplacingOccurrencesOfString:@"\n" withString:@""];
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,38 @@
|
|||||||
|
//
|
||||||
|
// 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
|
@@ -0,0 +1,87 @@
|
|||||||
|
//
|
||||||
|
// DDUtility+Carrier.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDUtility+Carrier.h"
|
||||||
|
#import <CoreTelephony/CTCarrier.h>
|
||||||
|
#import <CoreTelephony/CTTelephonyNetworkInfo.h>
|
||||||
|
#import "DDCarrierIdentifier.h"
|
||||||
|
#import <SSKeychain/SSKeychain.h>
|
||||||
|
|
||||||
|
// MCCs
|
||||||
|
static NSString * const kMobileCountryCode_China = @"460";// 中国
|
||||||
|
// MNCs
|
||||||
|
static NSSet * kMobileNetworkCodes_ChinaMobile; // 移动
|
||||||
|
static NSSet * kMobileNetworkCodes_ChinaUnicom; // 联通
|
||||||
|
static NSSet * kMobileNetworkCodes_ChinaTelecom; // 电信
|
||||||
|
@implementation DDUtility (Carrier)
|
||||||
|
|
||||||
|
#pragma mark - Super Method
|
||||||
|
+ (void)load {
|
||||||
|
if (self == [DDUtility self]) {
|
||||||
|
kMobileNetworkCodes_ChinaMobile = [NSSet setWithObjects:@"00", @"02", @"07", nil]; // 中国移动
|
||||||
|
kMobileNetworkCodes_ChinaUnicom = [NSSet setWithObjects:@"01", @"06", nil]; // 中国联通
|
||||||
|
kMobileNetworkCodes_ChinaTelecom = [NSSet setWithObjects:@"03", @"05", nil]; // 中国电信
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Public Method
|
||||||
|
+ (CTCarrier *)DD_Carrier {
|
||||||
|
return [[CTTelephonyNetworkInfo alloc] init].subscriberCellularProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSString *)DD_CarrierName {
|
||||||
|
return [self DD_Carrier].carrierName;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSInteger)DD_CarrierIdentifier {
|
||||||
|
return [self DD_IdentifierOfCarrier:[self DD_Carrier]];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSInteger)DD_IdentifierOfCarrier:(CTCarrier *)carrier {
|
||||||
|
DDCarrierIdentifier identifier = DD_CarrierIdentifier_Unknown;
|
||||||
|
do {
|
||||||
|
if (carrier.mobileCountryCode == nil || carrier.mobileNetworkCode == nil) {
|
||||||
|
identifier = DD_CarrierIdentifier_Unknown;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (![carrier.mobileCountryCode isEqualToString:kMobileCountryCode_China]) {
|
||||||
|
identifier = DD_CarrierIdentifier_Otherwise;
|
||||||
|
} else {
|
||||||
|
if ([kMobileNetworkCodes_ChinaMobile containsObject:carrier.mobileNetworkCode]) {
|
||||||
|
identifier = DD_CarrierIdentifier_ChinaMobile;
|
||||||
|
break;
|
||||||
|
} else if ([kMobileNetworkCodes_ChinaUnicom containsObject:carrier.mobileNetworkCode]) {
|
||||||
|
identifier = DD_CarrierIdentifier_ChinaUnicom;
|
||||||
|
break;
|
||||||
|
} else if ([kMobileNetworkCodes_ChinaTelecom containsObject:carrier.mobileNetworkCode]) {
|
||||||
|
identifier = DD_CarrierIdentifier_ChinaTelecom;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
} while (0);
|
||||||
|
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
+ (NSString *)DD_DeviceUniqueIdentification {
|
||||||
|
NSString * currentDeviceUUIDStr = [SSKeychain passwordForService:@" " account:@"uuid"];
|
||||||
|
if (currentDeviceUUIDStr == nil || [currentDeviceUUIDStr isEqualToString:@""]) {
|
||||||
|
NSUUID * currentDeviceUUID = [UIDevice currentDevice].identifierForVendor;
|
||||||
|
currentDeviceUUIDStr = currentDeviceUUID.UUIDString;
|
||||||
|
currentDeviceUUIDStr = [currentDeviceUUIDStr stringByReplacingOccurrencesOfString:@"-" withString:@""];
|
||||||
|
currentDeviceUUIDStr = [currentDeviceUUIDStr lowercaseString];
|
||||||
|
[SSKeychain setPassword: currentDeviceUUIDStr forService:@" "account:@"uuid"];
|
||||||
|
}
|
||||||
|
return currentDeviceUUIDStr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
@@ -0,0 +1,89 @@
|
|||||||
|
//
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
/*** 获取当前设备的 IDFV,IDFV 在某些情况下会变,不建议将其作为设备标识 */
|
||||||
|
+ (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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化信令sdk,imsdk所用到的appName
|
||||||
|
* @return app name
|
||||||
|
*/
|
||||||
|
+ (NSString *)DD_AppName;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
当前设备是否低于, 等于 iPhone6
|
||||||
|
@return 当前设备是否低于, 等于 iPhone6
|
||||||
|
*/
|
||||||
|
+ (BOOL)DD_ISIphone6AndLow;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,491 @@
|
|||||||
|
//
|
||||||
|
// DDUtility+Device.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDUtility+Device.h"
|
||||||
|
#import <sys/utsname.h>
|
||||||
|
#import <arpa/inet.h>
|
||||||
|
#import <net/if.h>
|
||||||
|
#import <ifaddrs.h>
|
||||||
|
#import "DDReachability.h"
|
||||||
|
#import <AdSupport/ASIdentifierManager.h>
|
||||||
|
#import <ifaddrs.h>
|
||||||
|
#import <net/if_dl.h>
|
||||||
|
#import <sys/socket.h>
|
||||||
|
#import <SSKeychain.h>
|
||||||
|
#import "DDGCDHelper.h"
|
||||||
|
|
||||||
|
#if !defined(IFT_ETHER)
|
||||||
|
#define IFT_ETHER 0x6
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define kIOSCellular @"pdp_ip0"
|
||||||
|
#define kIOSWifi @"en0"
|
||||||
|
#define kIPAddrV4 @"ipv4"
|
||||||
|
#define kIPAddrV6 @"ipv6"
|
||||||
|
#define kAppName @"yym51ip"
|
||||||
|
|
||||||
|
@implementation DDUtility (Device)
|
||||||
|
|
||||||
|
// 获取modelName
|
||||||
|
+ (NSString *)DD_ModelName {
|
||||||
|
static NSString *modelName = nil;
|
||||||
|
if (!modelName) {
|
||||||
|
struct utsname systemInfo;
|
||||||
|
uname(&systemInfo);
|
||||||
|
modelName = [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
|
||||||
|
}
|
||||||
|
return modelName;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取设备类型
|
||||||
|
+ (NSString *)DD_SystemVersion {
|
||||||
|
// 调用非常频繁,主要在cleanSpecialText中
|
||||||
|
static NSString* _systemVersion = nil;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
_systemVersion = [UIDevice currentDevice].systemVersion;;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (_systemVersion) {
|
||||||
|
return _systemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [UIDevice currentDevice].systemVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前设备的 IDFV
|
||||||
|
+ (NSString *)DD_IdentifierForVendor {
|
||||||
|
static NSString *idfv = nil;
|
||||||
|
if (!idfv) {
|
||||||
|
idfv = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
|
||||||
|
}
|
||||||
|
return idfv;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前的设备标识,会使用海度 SDK 中的 OpenUDID
|
||||||
|
+ (NSString *)DD_DeviceID {
|
||||||
|
NSString *deviceID = @"";
|
||||||
|
if (!deviceID || deviceID.length == 0) {
|
||||||
|
deviceID = [DDUtility DD_IdentifierForVendor];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!deviceID) {
|
||||||
|
deviceID = @"";
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceID;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前网络状态
|
||||||
|
+ (NSInteger)DD_NetworkStatus {
|
||||||
|
return (self.reachability.dd_currentReachabilityStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 检查Camera是否可用, 可用则调用available;
|
||||||
|
// 若隐私设置中禁用了本app对相机的访问, 则调用denied; 否则视为被限制, 调用restriction
|
||||||
|
+ (void)DD_CheckCameraAvailable:(void (^)(void))available denied:(void (^)(void))denied restriction:(void (^)(void))restriction {
|
||||||
|
available = available ? : ^{};
|
||||||
|
denied = denied ? : ^{};
|
||||||
|
restriction = restriction ? : ^{};
|
||||||
|
|
||||||
|
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
|
||||||
|
// iOS7下,需要检查iPhone的隐私和访问限制项
|
||||||
|
AVAuthorizationStatus authStatus = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];
|
||||||
|
switch (authStatus) {
|
||||||
|
case AVAuthorizationStatusAuthorized: {
|
||||||
|
available();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AVAuthorizationStatusDenied: {
|
||||||
|
// [设置->隐私->相机]中禁止了YY访问相机
|
||||||
|
denied();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AVAuthorizationStatusRestricted: {
|
||||||
|
// NOTE: 这个跟[设置-通用-访问限制]似乎没有关系
|
||||||
|
restriction();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case AVAuthorizationStatusNotDetermined: {
|
||||||
|
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
|
||||||
|
dd_dispatch_main_sync_safe(^{
|
||||||
|
granted ? available() : denied();
|
||||||
|
});
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
restriction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查相册是否可用, 可用则调用available;
|
||||||
|
// 若隐私设置中禁用了本app对相册 的访问, 则调用denied; 否则视为被限制, 调用restriction
|
||||||
|
+ (void)DD_CheckAssetsLibrayAvailable:(void (^)(void))available denied:(void (^)(void))denied restriction:(void (^)(void))restriction {
|
||||||
|
available = available ? : ^{};
|
||||||
|
denied = denied ? : ^{};
|
||||||
|
restriction = restriction ? : ^{};
|
||||||
|
|
||||||
|
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] ||
|
||||||
|
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum]) {
|
||||||
|
PHAuthorizationStatus author = [PHPhotoLibrary authorizationStatus];
|
||||||
|
if (author == PHAuthorizationStatusNotDetermined) {
|
||||||
|
|
||||||
|
PHFetchResult<PHAssetCollection *> *collectionArray = [PHAssetCollection fetchAssetCollectionsWithType:PHAssetCollectionTypeAlbum subtype:PHAssetCollectionSubtypeAny options:nil];
|
||||||
|
[collectionArray enumerateObjectsUsingBlock:^(PHAssetCollection * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
|
||||||
|
if (obj == nil) {
|
||||||
|
denied();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*stop) {
|
||||||
|
available();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*stop = TRUE;
|
||||||
|
}];
|
||||||
|
|
||||||
|
} else if (author == PHAuthorizationStatusDenied) {
|
||||||
|
denied();
|
||||||
|
} else if (author == PHAuthorizationStatusRestricted) {
|
||||||
|
restriction();
|
||||||
|
} else if (author == PHAuthorizationStatusAuthorized) {
|
||||||
|
available();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
restriction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 检查麦克风权限
|
||||||
|
+ (void)DD_CheckMicPrivacy:(void (^)(BOOL))resultBlock {
|
||||||
|
[[AVAudioSession sharedInstance] requestRecordPermission:^(BOOL granted) {
|
||||||
|
if (resultBlock) {
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
resultBlock(granted);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前IP地址
|
||||||
|
+ (NSString *)DD_IPAddress {
|
||||||
|
return [self DD_IPAddress:YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前IP地址
|
||||||
|
+ (NSString *)DD_IPAddress:(BOOL)preferIPv4 {
|
||||||
|
NSArray *searchArray = preferIPv4 ?
|
||||||
|
@[ kIOSWifi @"/" kIPAddrV4, kIOSWifi @"/" kIPAddrV6, kIOSCellular @"/" kIPAddrV4, kIOSCellular @"/" kIPAddrV6 ] :
|
||||||
|
@[ kIOSWifi @"/" kIPAddrV6, kIOSWifi @"/" kIPAddrV4, kIOSCellular @"/" kIPAddrV6, kIOSCellular @"/" kIPAddrV4 ] ;
|
||||||
|
|
||||||
|
NSDictionary *addresses = [self DD_GetIPAddresses];
|
||||||
|
|
||||||
|
__block NSString *addr;
|
||||||
|
[searchArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
|
||||||
|
addr = addresses[obj];
|
||||||
|
if (addr) {
|
||||||
|
*stop = YES;
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
return addr ? : @"0.0.0.0";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+ (NSString *)DD_MACAddresss {
|
||||||
|
static NSMutableString *macAddress = nil;
|
||||||
|
|
||||||
|
if ([macAddress length] > 0) {
|
||||||
|
return macAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
do {
|
||||||
|
struct ifaddrs* addrs;
|
||||||
|
if ( getifaddrs( &addrs ) ) break;
|
||||||
|
|
||||||
|
const struct ifaddrs *cursor = addrs;
|
||||||
|
while ( cursor ) {
|
||||||
|
if ( ( cursor->ifa_addr->sa_family == AF_LINK )
|
||||||
|
&& strcmp( "en0", cursor->ifa_name ) == 0
|
||||||
|
&& ( ( ( const struct sockaddr_dl * )cursor->ifa_addr)->sdl_type == IFT_ETHER ) ) {
|
||||||
|
const struct sockaddr_dl *dlAddr = ( const struct sockaddr_dl * )cursor->ifa_addr;
|
||||||
|
const uint8_t *base = ( const uint8_t * )&dlAddr->sdl_data[dlAddr->sdl_nlen];
|
||||||
|
|
||||||
|
macAddress = [[NSMutableString alloc] initWithCapacity:64];
|
||||||
|
|
||||||
|
for ( int i = 0; i < dlAddr->sdl_alen; i++ ) {
|
||||||
|
if (i > 0) {
|
||||||
|
[macAddress appendFormat:@":%02X", base[i]];
|
||||||
|
} else {
|
||||||
|
[macAddress appendFormat:@"%02X", base[i]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cursor = cursor->ifa_next;
|
||||||
|
}
|
||||||
|
freeifaddrs(addrs);
|
||||||
|
} while (NO);
|
||||||
|
|
||||||
|
if (macAddress == nil) {
|
||||||
|
macAddress = [NSMutableString stringWithString:@""];
|
||||||
|
}
|
||||||
|
|
||||||
|
return macAddress;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSString *)DD_IDFA {
|
||||||
|
static NSString *idfa = nil;
|
||||||
|
if (!idfa) {
|
||||||
|
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 6.0) {
|
||||||
|
idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
|
||||||
|
} else {
|
||||||
|
idfa = @"";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return idfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSString *)DD_ModelType {
|
||||||
|
struct utsname systemInfo;
|
||||||
|
|
||||||
|
uname(&systemInfo);
|
||||||
|
|
||||||
|
NSString*platform = [NSString stringWithCString: systemInfo.machine encoding:NSASCIIStringEncoding];
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone1,1"])return@"iPhone 2G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone1,2"])return@"iPhone 3G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone2,1"])return@"iPhone 3GS";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,1"])return@"iPhone 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,2"])return@"iPhone 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,3"])return@"iPhone 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone4,1"])return@"iPhone 4S";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,1"])return@"iPhone 5";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,2"])return@"iPhone 5";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,3"])return@"iPhone 5c";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,4"])return@"iPhone 5c";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone6,1"])return@"iPhone 5s";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone6,2"])return@"iPhone 5s";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone7,1"])return@"iPhone 6 Plus";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone7,2"])return@"iPhone 6";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone8,1"])return@"iPhone 6s";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone8,2"])return@"iPhone 6s Plus";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone8,4"])return@"iPhone SE";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone9,1"])return@"iPhone 7";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone9,2"])return@"iPhone 7 Plus";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,1"])return@"iPhone 8";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,4"])return@"iPhone 8";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,2"])return@"iPhone 8 Plus";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,5"])return@"iPhone 8 Plus";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,3"])return@"iPhone X";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone10,6"])return@"iPhone X";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPod1,1"])return@"iPod Touch 1G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPod2,1"])return@"iPod Touch 2G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPod3,1"])return@"iPod Touch 3G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPod4,1"])return@"iPod Touch 4G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPod5,1"])return@"iPod Touch 5G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad1,1"])return@"iPad 1G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,1"])return@"iPad 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,2"])return@"iPad 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,3"])return@"iPad 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,4"])return@"iPad 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,5"])return@"iPad Mini 1G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,6"])return@"iPad Mini 1G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad2,7"])return@"iPad Mini 1G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,1"])return@"iPad 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,2"])return@"iPad 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,3"])return@"iPad 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,4"])return@"iPad 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,5"])return@"iPad 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad3,6"])return@"iPad 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,1"])return@"iPad Air";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,2"])return@"iPad Air";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,3"])return@"iPad Air";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,4"])return@"iPad Mini 2G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,5"])return@"iPad Mini 2G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,6"])return@"iPad Mini 2G";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,7"])return@"iPad Mini 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,8"])return@"iPad Mini 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad4,9"])return@"iPad Mini 3";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad5,1"])return@"iPad Mini 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad5,2"])return@"iPad Mini 4";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad5,3"])return@"iPad Air 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad5,4"])return@"iPad Air 2";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad6,3"])return@"iPad Pro 9.7";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad6,4"])return@"iPad Pro 9.7";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad6,7"])return@"iPad Pro 12.9";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPad6,8"])return@"iPad Pro 12.9";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"i386"])return@"iPhone Simulator";
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"x86_64"])return@"iPhone Simulator";
|
||||||
|
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (BOOL)DD_ISIphone6AndLow {
|
||||||
|
struct utsname systemInfo;
|
||||||
|
|
||||||
|
uname(&systemInfo);
|
||||||
|
|
||||||
|
NSString*platform = [NSString stringWithCString: systemInfo.machine encoding:NSASCIIStringEncoding];
|
||||||
|
if([platform isEqualToString:@"iPhone1,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone1,2"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone2,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,2"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone3,3"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone4,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,2"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,3"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone5,4"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone6,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone6,2"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone7,1"])return YES;
|
||||||
|
|
||||||
|
if([platform isEqualToString:@"iPhone7,2"])return YES;
|
||||||
|
|
||||||
|
if ([platform isEqualToString:@"iPhone8,1"]) return YES;
|
||||||
|
|
||||||
|
if ([platform isEqualToString:@"iPhone8,3"]) return YES;
|
||||||
|
|
||||||
|
if ([platform isEqualToString:@"iPhone8,4"]) return YES;
|
||||||
|
|
||||||
|
if ([platform isEqualToString:@"iPhone9,1"]) return YES;
|
||||||
|
|
||||||
|
if ([platform isEqualToString:@"iPhone9,3"]) return YES;
|
||||||
|
|
||||||
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#pragma mark - Private Method
|
||||||
|
+ (DDReachability *)reachability {
|
||||||
|
static DDReachability *reachability = nil;
|
||||||
|
static dispatch_once_t onceToken;
|
||||||
|
dispatch_once(&onceToken, ^{
|
||||||
|
reachability = [DDReachability DD_ReachabilityForInternetConnection];
|
||||||
|
});
|
||||||
|
return reachability;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (NSDictionary *)DD_GetIPAddresses {
|
||||||
|
NSMutableDictionary *addresses = [NSMutableDictionary dictionary];
|
||||||
|
struct ifaddrs *interfaces;
|
||||||
|
if (!getifaddrs(&interfaces)) {
|
||||||
|
// Loop through linked list of interfaces
|
||||||
|
struct ifaddrs *interface;
|
||||||
|
for (interface = interfaces; interface; interface = interface->ifa_next) {
|
||||||
|
if (!(interface -> ifa_flags & IFF_UP)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
const struct sockaddr_in *addr = (const struct sockaddr_in *)interface->ifa_addr;
|
||||||
|
char addrBuf[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 2];
|
||||||
|
if (addr && (addr->sin_family == AF_INET || addr->sin_family == AF_INET6)) {
|
||||||
|
NSString *ifaName = [NSString stringWithUTF8String:interface->ifa_name];
|
||||||
|
NSString *ifaType;
|
||||||
|
if (addr->sin_family == AF_INET) {
|
||||||
|
if (inet_ntop(AF_INET, &addr->sin_addr, addrBuf, INET_ADDRSTRLEN)) {
|
||||||
|
ifaType = kIPAddrV4;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)interface->ifa_addr;
|
||||||
|
if (inet_ntop(AF_INET6, &addr6->sin6_addr, addrBuf, INET6_ADDRSTRLEN)) {
|
||||||
|
ifaType = kIPAddrV6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ifaType) {
|
||||||
|
NSString *key = [NSString stringWithFormat:@"%@/%@", ifaName, ifaType];
|
||||||
|
addresses[key] = [NSString stringWithUTF8String:addrBuf];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// free memory
|
||||||
|
freeifaddrs(interfaces);
|
||||||
|
return addresses;
|
||||||
|
}
|
||||||
|
@end
|
@@ -0,0 +1,21 @@
|
|||||||
|
//
|
||||||
|
// DDUtility.h
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@class CTCarrier;
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_BEGIN
|
||||||
|
|
||||||
|
@interface DDUtility : NSObject
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
NS_ASSUME_NONNULL_END
|
@@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// DDUtility.m
|
||||||
|
// DingDangApp
|
||||||
|
//
|
||||||
|
// Created by 触海 on 2023/12/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "DDUtility.h"
|
||||||
|
|
||||||
|
@implementation DDUtility
|
||||||
|
|
||||||
|
@end
|
@@ -1,357 +0,0 @@
|
|||||||
//
|
|
||||||
// SSKeychain.h
|
|
||||||
// SSToolkit
|
|
||||||
//
|
|
||||||
// Created by Sam Soffes on 5/19/10.
|
|
||||||
// Copyright (c) 2009-2011 Sam Soffes. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <Security/Security.h>
|
|
||||||
|
|
||||||
/** Error codes that can be returned in NSError objects. */
|
|
||||||
typedef enum {
|
|
||||||
/** No error. */
|
|
||||||
SSKeychainErrorNone = noErr,
|
|
||||||
|
|
||||||
/** Some of the arguments were invalid. */
|
|
||||||
SSKeychainErrorBadArguments = -1001,
|
|
||||||
|
|
||||||
/** There was no password. */
|
|
||||||
SSKeychainErrorNoPassword = -1002,
|
|
||||||
|
|
||||||
/** One or more parameters passed internally were not valid. */
|
|
||||||
SSKeychainErrorInvalidParameter = errSecParam,
|
|
||||||
|
|
||||||
/** Failed to allocate memory. */
|
|
||||||
SSKeychainErrorFailedToAllocated = errSecAllocate,
|
|
||||||
|
|
||||||
/** No trust results are available. */
|
|
||||||
SSKeychainErrorNotAvailable = errSecNotAvailable,
|
|
||||||
|
|
||||||
/** Authorization/Authentication failed. */
|
|
||||||
SSKeychainErrorAuthorizationFailed = errSecAuthFailed,
|
|
||||||
|
|
||||||
/** The item already exists. */
|
|
||||||
SSKeychainErrorDuplicatedItem = errSecDuplicateItem,
|
|
||||||
|
|
||||||
/** The item cannot be found.*/
|
|
||||||
SSKeychainErrorNotFound = errSecItemNotFound,
|
|
||||||
|
|
||||||
/** Interaction with the Security Server is not allowed. */
|
|
||||||
SSKeychainErrorInteractionNotAllowed = errSecInteractionNotAllowed,
|
|
||||||
|
|
||||||
/** Unable to decode the provided data. */
|
|
||||||
SSKeychainErrorFailedToDecode = errSecDecode
|
|
||||||
} SSKeychainErrorCode;
|
|
||||||
|
|
||||||
extern NSString *const kSSKeychainErrorDomain;
|
|
||||||
|
|
||||||
/** Account name. */
|
|
||||||
extern NSString *const kSSKeychainAccountKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Time the item was created.
|
|
||||||
|
|
||||||
The value will be a string.
|
|
||||||
*/
|
|
||||||
extern NSString *const kSSKeychainCreatedAtKey;
|
|
||||||
|
|
||||||
/** Item class. */
|
|
||||||
extern NSString *const kSSKeychainClassKey;
|
|
||||||
|
|
||||||
/** Item description. */
|
|
||||||
extern NSString *const kSSKeychainDescriptionKey;
|
|
||||||
|
|
||||||
/** Item label. */
|
|
||||||
extern NSString *const kSSKeychainLabelKey;
|
|
||||||
|
|
||||||
/** Time the item was last modified.
|
|
||||||
|
|
||||||
The value will be a string.
|
|
||||||
*/
|
|
||||||
extern NSString *const kSSKeychainLastModifiedKey;
|
|
||||||
|
|
||||||
/** Where the item was created. */
|
|
||||||
extern NSString *const kSSKeychainWhereKey;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Simple wrapper for accessing accounts, getting passwords, setting passwords, and deleting passwords using the system
|
|
||||||
Keychain on Mac OS X and iOS.
|
|
||||||
|
|
||||||
This was originally inspired by EMKeychain and SDKeychain (both of which are now gone). Thanks to the authors.
|
|
||||||
SSKeychain has since switched to a simpler implementation that was abstracted from [SSToolkit](http://sstoolk.it).
|
|
||||||
*/
|
|
||||||
@interface SSKeychain : NSObject
|
|
||||||
|
|
||||||
///-----------------------
|
|
||||||
/// @name Getting Accounts
|
|
||||||
///-----------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns an array containing the Keychain's accounts, or `nil` if the Keychain has no accounts.
|
|
||||||
|
|
||||||
See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
|
|
||||||
dictionaries returned by this method.
|
|
||||||
|
|
||||||
@return An array of dictionaries containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
|
|
||||||
accounts. The order of the objects in the array isn't defined.
|
|
||||||
|
|
||||||
@see allAccounts:
|
|
||||||
*/
|
|
||||||
+ (NSArray *)allAccounts;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns an array containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
|
|
||||||
accounts.
|
|
||||||
|
|
||||||
See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
|
|
||||||
dictionaries returned by this method.
|
|
||||||
|
|
||||||
@param error If accessing the accounts fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return An array of dictionaries containing the Keychain's accounts, or `nil` if the Keychain doesn't have any
|
|
||||||
accounts. The order of the objects in the array isn't defined.
|
|
||||||
|
|
||||||
@see allAccounts
|
|
||||||
*/
|
|
||||||
+ (NSArray *)allAccounts:(NSError **)error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns an array containing the Keychain's accounts for a given service, or `nil` if the Keychain doesn't have any
|
|
||||||
accounts for the given service.
|
|
||||||
|
|
||||||
See the `NSString` constants declared in SSKeychain.h for a list of keys that can be used when accessing the
|
|
||||||
dictionaries returned by this method.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding accounts.
|
|
||||||
|
|
||||||
@return An array of dictionaries containing the Keychain's accountsfor a given `serviceName`, or `nil` if the Keychain
|
|
||||||
doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined.
|
|
||||||
|
|
||||||
@see accountsForService:error:
|
|
||||||
*/
|
|
||||||
+ (NSArray *)accountsForService:(NSString *)serviceName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns an array containing the Keychain's accounts for a given service, or `nil` if the Keychain doesn't have any
|
|
||||||
accounts for the given service.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding accounts.
|
|
||||||
|
|
||||||
@param error If accessing the accounts fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return An array of dictionaries containing the Keychain's accountsfor a given `serviceName`, or `nil` if the Keychain
|
|
||||||
doesn't have any accounts for the given `serviceName`. The order of the objects in the array isn't defined.
|
|
||||||
|
|
||||||
@see accountsForService:
|
|
||||||
*/
|
|
||||||
+ (NSArray *)accountsForService:(NSString *)serviceName error:(NSError **)error;
|
|
||||||
|
|
||||||
|
|
||||||
///------------------------
|
|
||||||
/// @name Getting Passwords
|
|
||||||
///------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't have a
|
|
||||||
password for the given parameters.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to return the corresponding password.
|
|
||||||
|
|
||||||
@return Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't
|
|
||||||
have a password for the given parameters.
|
|
||||||
|
|
||||||
@see passwordForService:account:error:
|
|
||||||
*/
|
|
||||||
+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't have a
|
|
||||||
password for the given parameters.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param error If accessing the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns a string containing the password for a given account and service, or `nil` if the Keychain doesn't
|
|
||||||
have a password for the given parameters.
|
|
||||||
|
|
||||||
@see passwordForService:account:
|
|
||||||
*/
|
|
||||||
+ (NSString *)passwordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the password data for a given account and service, or `nil` if the Keychain doesn't have data
|
|
||||||
for the given parameters.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param error If accessing the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns a the password data for the given account and service, or `nil` if the Keychain doesn't
|
|
||||||
have data for the given parameters.
|
|
||||||
|
|
||||||
@see passwordDataForService:account:error:
|
|
||||||
*/
|
|
||||||
+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Returns the password data for a given account and service, or `nil` if the Keychain doesn't have data
|
|
||||||
for the given parameters.
|
|
||||||
|
|
||||||
@param serviceName The service for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to return the corresponding password.
|
|
||||||
|
|
||||||
@param error If accessing the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns a the password data for the given account and service, or `nil` if the Keychain doesn't
|
|
||||||
have a password for the given parameters.
|
|
||||||
|
|
||||||
@see passwordDataForService:account:
|
|
||||||
*/
|
|
||||||
+ (NSData *)passwordDataForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
|
|
||||||
|
|
||||||
|
|
||||||
///-------------------------
|
|
||||||
/// @name Deleting Passwords
|
|
||||||
///-------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
Deletes a password from the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to delete the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to delete the corresponding password.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see deletePasswordForService:account:error:
|
|
||||||
*/
|
|
||||||
+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Deletes a password from the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to delete the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to delete the corresponding password.
|
|
||||||
|
|
||||||
@param error If deleting the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see deletePasswordForService:account:
|
|
||||||
*/
|
|
||||||
+ (BOOL)deletePasswordForService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
|
|
||||||
|
|
||||||
|
|
||||||
///------------------------
|
|
||||||
/// @name Setting Passwords
|
|
||||||
///------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets a password in the Keychain.
|
|
||||||
|
|
||||||
@param password The password to store in the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to set the corresponding password.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see setPassword:forService:account:error:
|
|
||||||
*/
|
|
||||||
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets a password in the Keychain.
|
|
||||||
|
|
||||||
@param password The password to store in the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param error If setting the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see setPassword:forService:account:
|
|
||||||
*/
|
|
||||||
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets arbirary data in the Keychain.
|
|
||||||
|
|
||||||
@param password The data to store in the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param error If setting the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see setPasswordData:forService:account:error:
|
|
||||||
*/
|
|
||||||
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets arbirary data in the Keychain.
|
|
||||||
|
|
||||||
@param password The data to store in the Keychain.
|
|
||||||
|
|
||||||
@param serviceName The service for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param account The account for which to set the corresponding password.
|
|
||||||
|
|
||||||
@param error If setting the password fails, upon return contains an error that describes the problem.
|
|
||||||
|
|
||||||
@return Returns `YES` on success, or `NO` on failure.
|
|
||||||
|
|
||||||
@see setPasswordData:forService:account:
|
|
||||||
*/
|
|
||||||
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)serviceName account:(NSString *)account error:(NSError **)error;
|
|
||||||
|
|
||||||
|
|
||||||
///--------------------
|
|
||||||
/// @name Configuration
|
|
||||||
///--------------------
|
|
||||||
|
|
||||||
#if __IPHONE_4_0 && TARGET_OS_IPHONE
|
|
||||||
/**
|
|
||||||
Returns the accessibility type for all future passwords saved to the Keychain.
|
|
||||||
|
|
||||||
@return Returns the accessibility type.
|
|
||||||
|
|
||||||
The return value will be `NULL` or one of the "Keychain Item Accessibility Constants" used for determining when a
|
|
||||||
keychain item should be readable.
|
|
||||||
|
|
||||||
@see accessibilityType
|
|
||||||
*/
|
|
||||||
+ (CFTypeRef)accessibilityType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
Sets the accessibility type for all future passwords saved to the Keychain.
|
|
||||||
|
|
||||||
@param accessibilityType One of the "Keychain Item Accessibility Constants" used for determining when a keychain item
|
|
||||||
should be readable.
|
|
||||||
|
|
||||||
If the value is `NULL` (the default), the Keychain default will be used.
|
|
||||||
|
|
||||||
@see accessibilityType
|
|
||||||
*/
|
|
||||||
+ (void)setAccessibilityType:(CFTypeRef)accessibilityType;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@end
|
|
@@ -1,262 +0,0 @@
|
|||||||
//
|
|
||||||
// SSKeychain.m
|
|
||||||
// SSToolkit
|
|
||||||
//
|
|
||||||
// Created by Sam Soffes on 5/19/10.
|
|
||||||
// Copyright (c) 2009-2011 Sam Soffes. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "SSKeychain.h"
|
|
||||||
|
|
||||||
NSString *const kSSKeychainErrorDomain = @"com.samsoffes.sskeychain";
|
|
||||||
|
|
||||||
NSString *const kSSKeychainAccountKey = @"acct";
|
|
||||||
NSString *const kSSKeychainCreatedAtKey = @"cdat";
|
|
||||||
NSString *const kSSKeychainClassKey = @"labl";
|
|
||||||
NSString *const kSSKeychainDescriptionKey = @"desc";
|
|
||||||
NSString *const kSSKeychainLabelKey = @"labl";
|
|
||||||
NSString *const kSSKeychainLastModifiedKey = @"mdat";
|
|
||||||
NSString *const kSSKeychainWhereKey = @"svce";
|
|
||||||
|
|
||||||
#if __IPHONE_4_0 && TARGET_OS_IPHONE
|
|
||||||
CFTypeRef SSKeychainAccessibilityType = NULL;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@interface SSKeychain ()
|
|
||||||
+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation SSKeychain
|
|
||||||
|
|
||||||
#pragma mark - Getting Accounts
|
|
||||||
|
|
||||||
+ (NSArray *)allAccounts {
|
|
||||||
return [self accountsForService:nil error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSArray *)allAccounts:(NSError **)error {
|
|
||||||
return [self accountsForService:nil error:error];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSArray *)accountsForService:(NSString *)service {
|
|
||||||
return [self accountsForService:service error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSArray *)accountsForService:(NSString *)service error:(NSError **)error {
|
|
||||||
OSStatus status = SSKeychainErrorBadArguments;
|
|
||||||
NSMutableDictionary *query = [self _queryForService:service account:nil];
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnAttributes];
|
|
||||||
[query setObject:(__bridge id)kSecMatchLimitAll forKey:(__bridge id)kSecMatchLimit];
|
|
||||||
#else
|
|
||||||
[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnAttributes];
|
|
||||||
[query setObject:(id)kSecMatchLimitAll forKey:(id)kSecMatchLimit];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
CFTypeRef result = NULL;
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
|
|
||||||
#else
|
|
||||||
status = SecItemCopyMatching((CFDictionaryRef)query, &result);
|
|
||||||
#endif
|
|
||||||
if (status != noErr && error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
return (__bridge_transfer NSArray *)result;
|
|
||||||
#else
|
|
||||||
return [(NSArray *)result autorelease];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Getting Passwords
|
|
||||||
|
|
||||||
+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account {
|
|
||||||
return [self passwordForService:service account:account error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSString *)passwordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
|
|
||||||
NSData *data = [self passwordDataForService:service account:account error:error];
|
|
||||||
if (data.length > 0) {
|
|
||||||
NSString *string = [[NSString alloc] initWithData:(NSData *)data encoding:NSUTF8StringEncoding];
|
|
||||||
#if !__has_feature(objc_arc)
|
|
||||||
[string autorelease];
|
|
||||||
#endif
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account {
|
|
||||||
return [self passwordDataForService:service account:account error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (NSData *)passwordDataForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
|
|
||||||
OSStatus status = SSKeychainErrorBadArguments;
|
|
||||||
if (!service || !account) {
|
|
||||||
if (error) {
|
|
||||||
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
|
|
||||||
}
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFTypeRef result = NULL;
|
|
||||||
NSMutableDictionary *query = [self _queryForService:service account:account];
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[query setObject:(__bridge id)kCFBooleanTrue forKey:(__bridge id)kSecReturnData];
|
|
||||||
[query setObject:(__bridge id)kSecMatchLimitOne forKey:(__bridge id)kSecMatchLimit];
|
|
||||||
status = SecItemCopyMatching((__bridge CFDictionaryRef)query, &result);
|
|
||||||
#else
|
|
||||||
[query setObject:(id)kCFBooleanTrue forKey:(id)kSecReturnData];
|
|
||||||
[query setObject:(id)kSecMatchLimitOne forKey:(id)kSecMatchLimit];
|
|
||||||
status = SecItemCopyMatching((CFDictionaryRef)query, &result);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (status != noErr && error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
return (__bridge_transfer NSData *)result;
|
|
||||||
#else
|
|
||||||
return [(NSData *)result autorelease];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Deleting Passwords
|
|
||||||
|
|
||||||
+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account {
|
|
||||||
return [self deletePasswordForService:service account:account error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (BOOL)deletePasswordForService:(NSString *)service account:(NSString *)account error:(NSError **)error {
|
|
||||||
OSStatus status = SSKeychainErrorBadArguments;
|
|
||||||
if (service && account) {
|
|
||||||
NSMutableDictionary *query = [self _queryForService:service account:account];
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
status = SecItemDelete((__bridge CFDictionaryRef)query);
|
|
||||||
#else
|
|
||||||
status = SecItemDelete((CFDictionaryRef)query);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (status != noErr && error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
|
|
||||||
}
|
|
||||||
return (status == noErr);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Setting Passwords
|
|
||||||
|
|
||||||
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account {
|
|
||||||
return [self setPassword:password forService:service account:account error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (BOOL)setPassword:(NSString *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
|
|
||||||
NSData *data = [password dataUsingEncoding:NSUTF8StringEncoding];
|
|
||||||
return [self setPasswordData:data forService:service account:account error:error];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account {
|
|
||||||
return [self setPasswordData:password forService:service account:account error:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (BOOL)setPasswordData:(NSData *)password forService:(NSString *)service account:(NSString *)account error:(NSError **)error {
|
|
||||||
OSStatus status = SSKeychainErrorBadArguments;
|
|
||||||
if (password && service && account) {
|
|
||||||
[self deletePasswordForService:service account:account];
|
|
||||||
NSMutableDictionary *query = [self _queryForService:service account:account];
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[query setObject:password forKey:(__bridge id)kSecValueData];
|
|
||||||
#else
|
|
||||||
[query setObject:password forKey:(id)kSecValueData];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __IPHONE_4_0 && TARGET_OS_IPHONE
|
|
||||||
if (SSKeychainAccessibilityType) {
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[query setObject:(id)[self accessibilityType] forKey:(__bridge id)kSecAttrAccessible];
|
|
||||||
#else
|
|
||||||
[query setObject:(id)[self accessibilityType] forKey:(id)kSecAttrAccessible];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
status = SecItemAdd((__bridge CFDictionaryRef)query, NULL);
|
|
||||||
#else
|
|
||||||
status = SecItemAdd((CFDictionaryRef)query, NULL);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
if (status != noErr && error != NULL) {
|
|
||||||
*error = [NSError errorWithDomain:kSSKeychainErrorDomain code:status userInfo:nil];
|
|
||||||
}
|
|
||||||
return (status == noErr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Configuration
|
|
||||||
|
|
||||||
#if __IPHONE_4_0 && TARGET_OS_IPHONE
|
|
||||||
+ (CFTypeRef)accessibilityType {
|
|
||||||
return SSKeychainAccessibilityType;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
+ (void)setAccessibilityType:(CFTypeRef)accessibilityType {
|
|
||||||
CFRetain(accessibilityType);
|
|
||||||
if (SSKeychainAccessibilityType) {
|
|
||||||
CFRelease(SSKeychainAccessibilityType);
|
|
||||||
}
|
|
||||||
SSKeychainAccessibilityType = accessibilityType;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#pragma mark - Private
|
|
||||||
|
|
||||||
+ (NSMutableDictionary *)_queryForService:(NSString *)service account:(NSString *)account {
|
|
||||||
NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:3];
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[dictionary setObject:(__bridge id)kSecClassGenericPassword forKey:(__bridge id)kSecClass];
|
|
||||||
#else
|
|
||||||
[dictionary setObject:(id)kSecClassGenericPassword forKey:(id)kSecClass];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (service) {
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[dictionary setObject:service forKey:(__bridge id)kSecAttrService];
|
|
||||||
#else
|
|
||||||
[dictionary setObject:service forKey:(id)kSecAttrService];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
if (account) {
|
|
||||||
#if __has_feature(objc_arc)
|
|
||||||
[dictionary setObject:account forKey:(__bridge id)kSecAttrAccount];
|
|
||||||
#else
|
|
||||||
[dictionary setObject:account forKey:(id)kSecAttrAccount];
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
return dictionary;
|
|
||||||
}
|
|
||||||
|
|
||||||
@end
|
|
@@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright (c) 2011, Tony Million.
|
|
||||||
All rights reserved.
|
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
|
||||||
modification, are permitted provided that the following conditions are met:
|
|
||||||
|
|
||||||
1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
list of conditions and the following disclaimer.
|
|
||||||
|
|
||||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
this list of conditions and the following disclaimer in the documentation
|
|
||||||
and/or other materials provided with the distribution.
|
|
||||||
|
|
||||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
||||||
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
#import <SystemConfiguration/SystemConfiguration.h>
|
|
||||||
|
|
||||||
#import <sys/socket.h>
|
|
||||||
#import <netinet/in.h>
|
|
||||||
#import <netinet6/in6.h>
|
|
||||||
#import <arpa/inet.h>
|
|
||||||
#import <ifaddrs.h>
|
|
||||||
#import <netdb.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Does ARC support GCD objects?
|
|
||||||
* It does if the minimum deployment target is iOS 6+ or Mac OS X 8+
|
|
||||||
*
|
|
||||||
* @see http://opensource.apple.com/source/libdispatch/libdispatch-228.18/os/object.h
|
|
||||||
**/
|
|
||||||
#if OS_OBJECT_USE_OBJC
|
|
||||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 0
|
|
||||||
#else
|
|
||||||
#define NEEDS_DISPATCH_RETAIN_RELEASE 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create NS_ENUM macro if it does not exist on the targeted version of iOS or OS X.
|
|
||||||
*
|
|
||||||
* @see http://nshipster.com/ns_enum-ns_options/
|
|
||||||
**/
|
|
||||||
#ifndef NS_ENUM
|
|
||||||
#define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern NSString *const kYYReachabilityChangedNotification;
|
|
||||||
|
|
||||||
typedef NS_ENUM(NSInteger, NetworkStatus) {
|
|
||||||
// Apple NetworkStatus Compatible Names.
|
|
||||||
NotReachable = 0,
|
|
||||||
ReachableViaWiFi = 2,
|
|
||||||
ReachableViaWWAN = 1
|
|
||||||
};
|
|
||||||
|
|
||||||
@class YYReachability;
|
|
||||||
|
|
||||||
typedef void (^NetworkReachable)(YYReachability * reachability);
|
|
||||||
typedef void (^NetworkUnreachable)(YYReachability * reachability);
|
|
||||||
|
|
||||||
@interface YYReachability : NSObject
|
|
||||||
|
|
||||||
@property (nonatomic, copy) NetworkReachable reachableBlock;
|
|
||||||
@property (nonatomic, copy) NetworkUnreachable unreachableBlock;
|
|
||||||
|
|
||||||
|
|
||||||
@property (nonatomic, assign) BOOL reachableOnWWAN;
|
|
||||||
|
|
||||||
+(YYReachability*)reachabilityWithHostname:(NSString*)hostname;
|
|
||||||
+(YYReachability*)reachabilityForInternetConnection;
|
|
||||||
+(YYReachability*)reachabilityWithAddress:(const struct sockaddr_in*)hostAddress;
|
|
||||||
+(YYReachability*)reachabilityForLocalWiFi;
|
|
||||||
|
|
||||||
-(YYReachability *)initWithReachabilityRef:(SCNetworkReachabilityRef)ref;
|
|
||||||
|
|
||||||
-(BOOL)startNotifier;
|
|
||||||
-(void)stopNotifier;
|
|
||||||
|
|
||||||
-(BOOL)isReachable;
|
|
||||||
-(BOOL)isReachableViaWWAN;
|
|
||||||
-(BOOL)isReachableViaWiFi;
|
|
||||||
|
|
||||||
// WWAN may be available, but not active until a connection has been established.
|
|
||||||
// WiFi may require a connection for VPN on Demand.
|
|
||||||
-(BOOL)isConnectionRequired; // Identical DDG variant.
|
|
||||||
-(BOOL)connectionRequired; // Apple's routine.
|
|
||||||
// Dynamic, on demand connection?
|
|
||||||
-(BOOL)isConnectionOnDemand;
|
|
||||||
// Is user intervention required?
|
|
||||||
-(BOOL)isInterventionRequired;
|
|
||||||
|
|
||||||
-(NetworkStatus)currentReachabilityStatus;
|
|
||||||
-(SCNetworkReachabilityFlags)reachabilityFlags;
|
|
||||||
-(NSString*)currentReachabilityString;
|
|
||||||
-(NSString*)currentReachabilityFlags;
|
|
||||||
|
|
||||||
@end
|
|
@@ -1,21 +0,0 @@
|
|||||||
//
|
|
||||||
// CarrierIdentifier.h
|
|
||||||
// YYMobileFramework
|
|
||||||
//
|
|
||||||
// Created by wuwei on 14-5-30.
|
|
||||||
// Copyright (c) 2014年 YY Inc. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
// 运营商类型
|
|
||||||
typedef NS_ENUM(NSUInteger, CarrierIdentifier)
|
|
||||||
{
|
|
||||||
CarrierIdentifier_Unknown = 0, // 未知, 网络不可用(未插SIM卡/无信号/飞行模式)
|
|
||||||
|
|
||||||
CarrierIdentifier_ChinaMobile = 1, // 中国移动
|
|
||||||
CarrierIdentifier_ChinaUnicom = 2, // 中国联通
|
|
||||||
CarrierIdentifier_ChinaTelecom = 3, // 中国电信
|
|
||||||
|
|
||||||
CarrierIdentifier_Otherwise = 0x0000FFFF, // 其他运营商
|
|
||||||
};
|
|
@@ -1,225 +0,0 @@
|
|||||||
//
|
|
||||||
// YYUtility.h
|
|
||||||
// YYMobileFramework
|
|
||||||
//
|
|
||||||
// Created by wuwei on 14/6/11.
|
|
||||||
// Copyright (c) 2014年 YY.inc. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import <Foundation/Foundation.h>
|
|
||||||
|
|
||||||
@class CTCarrier;
|
|
||||||
|
|
||||||
@interface YYUtility : NSObject
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*==============================*/
|
|
||||||
/* App Utilities */
|
|
||||||
/*==============================*/
|
|
||||||
@interface YYUtility (App)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从YYMobile-Info.plist中读取字段
|
|
||||||
*
|
|
||||||
* @param key 键
|
|
||||||
*
|
|
||||||
* @return 值
|
|
||||||
*/
|
|
||||||
+ (id)valueInPlistForKey:(NSString *)key;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取App版本号, 从plist从读取CFBundleShortVersion
|
|
||||||
*/
|
|
||||||
+ (NSString *)appVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取AppBuild号, 从plist中读取CFBundleVersion
|
|
||||||
*/
|
|
||||||
+ (NSString *)appBuild;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 当前构建出的版本在svn中的版本号
|
|
||||||
*/
|
|
||||||
+ (NSString *)svnVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
获取appName
|
|
||||||
|
|
||||||
@return app的名称
|
|
||||||
*/
|
|
||||||
+ (NSString *)appName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取bundle id
|
|
||||||
*
|
|
||||||
* @return bundle id
|
|
||||||
*/
|
|
||||||
+ (NSString *)appBundleId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取YYMobileFrameworkRes.bundle的URL
|
|
||||||
*/
|
|
||||||
+ (NSURL *)URLForMobileFrameworkResourceBundle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取YYMobileFrameworkRes.bundle的路径
|
|
||||||
*/
|
|
||||||
+ (NSString *)pathForMobileFrameworkResourceBundle;
|
|
||||||
|
|
||||||
+ (BOOL)addSkipBackupAttributeToItemAtURL:(NSURL *)fileURL;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前的构建类型(DEBUG/RELEASE)
|
|
||||||
*
|
|
||||||
* @return 构建类型
|
|
||||||
*/
|
|
||||||
+ (NSString *)buildType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取平台渠道
|
|
||||||
*/
|
|
||||||
+ (NSString *)getAppSource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否来自appstore
|
|
||||||
*/
|
|
||||||
+ (BOOL)isFromAppStore;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*==============================*/
|
|
||||||
/* Carrier Utilities */
|
|
||||||
/*==============================*/
|
|
||||||
@interface YYUtility (Carrier)
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
获取设备唯一标识
|
|
||||||
|
|
||||||
@return 唯一标识
|
|
||||||
*/
|
|
||||||
+ (NSString *)deviceUniqueIdentification;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取运营商
|
|
||||||
*/
|
|
||||||
+ (CTCarrier *)carrier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取运营商类型
|
|
||||||
*/
|
|
||||||
+ (NSInteger)carrierIdentifier;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取运营商名称
|
|
||||||
*/
|
|
||||||
+ (NSString *)carrierName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 从CTCarrier对象获取网络类型
|
|
||||||
* @param carrier - CTCarrier对象
|
|
||||||
* @return CarrierType
|
|
||||||
*/
|
|
||||||
+ (NSInteger)identifierOfCarrier:(CTCarrier *)carrier;
|
|
||||||
|
|
||||||
@end
|
|
||||||
|
|
||||||
/*==============================*/
|
|
||||||
/* Device Utilities */
|
|
||||||
/*==============================*/
|
|
||||||
@interface YYUtility (Device)
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取modelName, 如iPhone5,2
|
|
||||||
*/
|
|
||||||
+ (NSString *)modelName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
获取设备类型
|
|
||||||
|
|
||||||
@return 设备类型
|
|
||||||
*/
|
|
||||||
+ (NSString*)modelType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取系统版本
|
|
||||||
*/
|
|
||||||
+ (NSString *)systemVersion;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前设备的 IDFV,IDFV 在某些情况下会变,不建议将其作为设备标识
|
|
||||||
*/
|
|
||||||
+ (NSString *)identifierForVendor NS_AVAILABLE_IOS(6_0);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前的设备标识,会使用海度 SDK 中的 OpenUDID
|
|
||||||
*
|
|
||||||
* @return 海度 SDK 缓存的 OpenUDID
|
|
||||||
*/
|
|
||||||
+ (NSString *)deviceID;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前网络状态
|
|
||||||
*/
|
|
||||||
+ (NSInteger)networkStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前IP地址
|
|
||||||
*/
|
|
||||||
+ (NSString *)ipAddress;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取当前IP地址
|
|
||||||
*
|
|
||||||
* @param preferIPv4 优先取IPv4的地址
|
|
||||||
*/
|
|
||||||
+ (NSString *)ipAddress:(BOOL)preferIPv4;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查Camera是否可用, 可用则调用available; 若隐私设置中禁用了本app对相机
|
|
||||||
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
|
|
||||||
*
|
|
||||||
* @param available 可用
|
|
||||||
* @param denied 不可用
|
|
||||||
* @param restriction 受限制
|
|
||||||
*/
|
|
||||||
+ (void)checkCameraAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查相册是否可用, 可用则调用available; 若隐私设置中禁用了本app对相册
|
|
||||||
* 的访问, 则调用denied; 否则视为被限制, 调用restriction
|
|
||||||
*
|
|
||||||
* @param available 可用
|
|
||||||
* @param denied 不可用
|
|
||||||
* @param restriction 受限制
|
|
||||||
*/
|
|
||||||
+ (void)checkAssetsLibrayAvailable:(void (^)(void))available denied:(void(^)(void))denied restriction:(void(^)(void))restriction;
|
|
||||||
|
|
||||||
/**
|
|
||||||
检查麦克风权限
|
|
||||||
|
|
||||||
@param resultBlock 结果处理block
|
|
||||||
*/
|
|
||||||
+ (void)checkMicPrivacy:(void(^)(BOOL succeed))resultBlock;
|
|
||||||
|
|
||||||
+ (NSString *)macAddresss;
|
|
||||||
+ (NSString *)idfa;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 初始化信令sdk,imsdk所用到的appName
|
|
||||||
*
|
|
||||||
* @return app name
|
|
||||||
*/
|
|
||||||
+ (NSString *)appName;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
当前设备是否低于, 等于 iPhone6
|
|
||||||
|
|
||||||
@return 当前设备是否低于, 等于 iPhone6
|
|
||||||
*/
|
|
||||||
+ (BOOL)isIphone6AndLow;
|
|
||||||
|
|
||||||
@end
|
|
@@ -1,13 +0,0 @@
|
|||||||
//
|
|
||||||
// YYUtility.m
|
|
||||||
// YYMobileFramework
|
|
||||||
//
|
|
||||||
// Created by wuwei on 14-5-30.
|
|
||||||
// Copyright (c) 2014年 YY Inc. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
#import "YYUtility.h"
|
|
||||||
|
|
||||||
@implementation YYUtility
|
|
||||||
|
|
||||||
@end
|
|
Reference in New Issue
Block a user