项目结构跳转

This commit is contained in:
2024-06-07 13:38:31 +08:00
parent db86cc7077
commit 3023c4e856
51 changed files with 5467 additions and 18 deletions

View File

@ -82,7 +82,29 @@
916353392C12B6D400593047 /* SVRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352E72C12B6D400593047 /* SVRadialGradientLayer.m */; };
9163533A2C12B6D400593047 /* HUDManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352EA2C12B6D400593047 /* HUDManager.m */; };
9163533D2C12B6D400593047 /* KxMenu.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352F02C12B6D400593047 /* KxMenu.m */; };
9163533E2C12B6D400593047 /* HtyoNetWorking.m in Sources */ = {isa = PBXBuildFile; fileRef = 916352F32C12B6D400593047 /* HtyoNetWorking.m */; };
9163534B2C12C15300593047 /* HBApiParams.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353422C12C15300593047 /* HBApiParams.m */; };
9163534C2C12C15300593047 /* HBNetWorkingUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353442C12C15300593047 /* HBNetWorkingUtility.m */; };
9163534D2C12C15300593047 /* HBNetWorkingUtilityResult.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353462C12C15300593047 /* HBNetWorkingUtilityResult.m */; };
9163534E2C12C15300593047 /* HBNetWorkingUtility+Services.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353492C12C15300593047 /* HBNetWorkingUtility+Services.m */; };
916353862C12C20B00593047 /* HBColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353502C12C20B00593047 /* HBColor.m */; };
916353872C12C20B00593047 /* HBCommonKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353532C12C20B00593047 /* HBCommonKeys.m */; };
916353882C12C20B00593047 /* HBThirdKeys.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353552C12C20B00593047 /* HBThirdKeys.m */; };
916353892C12C20B00593047 /* HBNavigationController.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353582C12C20B00593047 /* HBNavigationController.m */; };
9163538A2C12C20B00593047 /* HBTabBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163535A2C12C20B00593047 /* HBTabBarController.m */; };
9163538B2C12C20B00593047 /* HBViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163535C2C12C20B00593047 /* HBViewController.m */; };
9163538C2C12C20B00593047 /* HBMultiLanguageController.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353622C12C20B00593047 /* HBMultiLanguageController.m */; };
9163538D2C12C20B00593047 /* HBMultiLanguageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353652C12C20B00593047 /* HBMultiLanguageManager.m */; };
9163538E2C12C20B00593047 /* MultiLanguage.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 916353672C12C20B00593047 /* MultiLanguage.xcstrings */; };
916353932C12C20B00593047 /* HBAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353752C12C20B00593047 /* HBAlertView.m */; };
916353942C12C20B00593047 /* HBCollectionViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353772C12C20B00593047 /* HBCollectionViewCell.m */; };
916353952C12C20B00593047 /* HBRefreshAutoNormalFooter.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353792C12C20B00593047 /* HBRefreshAutoNormalFooter.m */; };
916353962C12C20B00593047 /* HBRefreshNormalHeader.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163537B2C12C20B00593047 /* HBRefreshNormalHeader.m */; };
916353972C12C20B00593047 /* HBTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163537D2C12C20B00593047 /* HBTableView.m */; };
916353982C12C20B00593047 /* HBTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = 9163537F2C12C20B00593047 /* HBTextField.m */; };
916353992C12C20B00593047 /* HBView.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353812C12C20B00593047 /* HBView.m */; };
9163539A2C12C20B00593047 /* RSButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353832C12C20B00593047 /* RSButton.m */; };
916353A22C12C3DC00593047 /* HtyoNetWorking.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353A02C12C3DC00593047 /* HtyoNetWorking.m */; };
916353A82C12C6AF00593047 /* NSNotificationCenter+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 916353A72C12C6AF00593047 /* NSNotificationCenter+Extension.m */; };
C8AC2283D47E2B99FF559E75 /* libPods-HiBit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 141F02EF5C0783797594009A /* libPods-HiBit.a */; };
/* End PBXBuildFile section */
@ -242,8 +264,52 @@
916352EA2C12B6D400593047 /* HUDManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HUDManager.m; sourceTree = "<group>"; };
916352EF2C12B6D400593047 /* KxMenu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KxMenu.h; sourceTree = "<group>"; };
916352F02C12B6D400593047 /* KxMenu.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KxMenu.m; sourceTree = "<group>"; };
916352F22C12B6D400593047 /* HtyoNetWorking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HtyoNetWorking.h; sourceTree = "<group>"; };
916352F32C12B6D400593047 /* HtyoNetWorking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HtyoNetWorking.m; sourceTree = "<group>"; };
916353412C12C15300593047 /* HBApiParams.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBApiParams.h; sourceTree = "<group>"; };
916353422C12C15300593047 /* HBApiParams.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBApiParams.m; sourceTree = "<group>"; };
916353432C12C15300593047 /* HBNetWorkingUtility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBNetWorkingUtility.h; sourceTree = "<group>"; };
916353442C12C15300593047 /* HBNetWorkingUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBNetWorkingUtility.m; sourceTree = "<group>"; };
916353452C12C15300593047 /* HBNetWorkingUtilityResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBNetWorkingUtilityResult.h; sourceTree = "<group>"; };
916353462C12C15300593047 /* HBNetWorkingUtilityResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBNetWorkingUtilityResult.m; sourceTree = "<group>"; };
916353482C12C15300593047 /* HBNetWorkingUtility+Services.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HBNetWorkingUtility+Services.h"; sourceTree = "<group>"; };
916353492C12C15300593047 /* HBNetWorkingUtility+Services.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HBNetWorkingUtility+Services.m"; sourceTree = "<group>"; };
9163534F2C12C20B00593047 /* HBColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBColor.h; sourceTree = "<group>"; };
916353502C12C20B00593047 /* HBColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBColor.m; sourceTree = "<group>"; };
916353522C12C20B00593047 /* HBCommonKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBCommonKeys.h; sourceTree = "<group>"; };
916353532C12C20B00593047 /* HBCommonKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBCommonKeys.m; sourceTree = "<group>"; };
916353542C12C20B00593047 /* HBThirdKeys.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBThirdKeys.h; sourceTree = "<group>"; };
916353552C12C20B00593047 /* HBThirdKeys.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBThirdKeys.m; sourceTree = "<group>"; };
916353572C12C20B00593047 /* HBNavigationController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBNavigationController.h; sourceTree = "<group>"; };
916353582C12C20B00593047 /* HBNavigationController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBNavigationController.m; sourceTree = "<group>"; };
916353592C12C20B00593047 /* HBTabBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTabBarController.h; sourceTree = "<group>"; };
9163535A2C12C20B00593047 /* HBTabBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTabBarController.m; sourceTree = "<group>"; };
9163535B2C12C20B00593047 /* HBViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBViewController.h; sourceTree = "<group>"; };
9163535C2C12C20B00593047 /* HBViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBViewController.m; sourceTree = "<group>"; };
9163535E2C12C20B00593047 /* HBDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBDefines.h; sourceTree = "<group>"; };
916353612C12C20B00593047 /* HBMultiLanguageController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBMultiLanguageController.h; sourceTree = "<group>"; };
916353622C12C20B00593047 /* HBMultiLanguageController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBMultiLanguageController.m; sourceTree = "<group>"; };
916353642C12C20B00593047 /* HBMultiLanguageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBMultiLanguageManager.h; sourceTree = "<group>"; };
916353652C12C20B00593047 /* HBMultiLanguageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBMultiLanguageManager.m; sourceTree = "<group>"; };
916353672C12C20B00593047 /* MultiLanguage.xcstrings */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json.xcstrings; path = MultiLanguage.xcstrings; sourceTree = "<group>"; };
916353742C12C20B00593047 /* HBAlertView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBAlertView.h; sourceTree = "<group>"; };
916353752C12C20B00593047 /* HBAlertView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBAlertView.m; sourceTree = "<group>"; };
916353762C12C20B00593047 /* HBCollectionViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBCollectionViewCell.h; sourceTree = "<group>"; };
916353772C12C20B00593047 /* HBCollectionViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBCollectionViewCell.m; sourceTree = "<group>"; };
916353782C12C20B00593047 /* HBRefreshAutoNormalFooter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBRefreshAutoNormalFooter.h; sourceTree = "<group>"; };
916353792C12C20B00593047 /* HBRefreshAutoNormalFooter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBRefreshAutoNormalFooter.m; sourceTree = "<group>"; };
9163537A2C12C20B00593047 /* HBRefreshNormalHeader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBRefreshNormalHeader.h; sourceTree = "<group>"; };
9163537B2C12C20B00593047 /* HBRefreshNormalHeader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBRefreshNormalHeader.m; sourceTree = "<group>"; };
9163537C2C12C20B00593047 /* HBTableView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTableView.h; sourceTree = "<group>"; };
9163537D2C12C20B00593047 /* HBTableView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTableView.m; sourceTree = "<group>"; };
9163537E2C12C20B00593047 /* HBTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBTextField.h; sourceTree = "<group>"; };
9163537F2C12C20B00593047 /* HBTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBTextField.m; sourceTree = "<group>"; };
916353802C12C20B00593047 /* HBView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HBView.h; sourceTree = "<group>"; };
916353812C12C20B00593047 /* HBView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HBView.m; sourceTree = "<group>"; };
916353822C12C20B00593047 /* RSButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RSButton.h; sourceTree = "<group>"; };
916353832C12C20B00593047 /* RSButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSButton.m; sourceTree = "<group>"; };
9163539F2C12C3DC00593047 /* HtyoNetWorking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HtyoNetWorking.h; sourceTree = "<group>"; };
916353A02C12C3DC00593047 /* HtyoNetWorking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HtyoNetWorking.m; sourceTree = "<group>"; };
916353A62C12C6AF00593047 /* NSNotificationCenter+Extension.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "NSNotificationCenter+Extension.h"; sourceTree = "<group>"; };
916353A72C12C6AF00593047 /* NSNotificationCenter+Extension.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "NSNotificationCenter+Extension.m"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -290,7 +356,7 @@
children = (
9163513B2C12B0A200593047 /* Basics */,
9163513D2C12B11A00593047 /* AppDelegate */,
9163533F2C12C01E00593047 /* Services */,
916353402C12C10100593047 /* Project */,
916352F52C12B6D400593047 /* Utils */,
);
path = HiBit;
@ -505,6 +571,7 @@
9163528B2C12B6D400593047 /* Category */ = {
isa = PBXGroup;
children = (
916353A52C12C69900593047 /* NSNotificationCenter */,
916352482C12B6D400593047 /* Foundation */,
9163524B2C12B6D400593047 /* NSData */,
9163524E2C12B6D400593047 /* NSDate */,
@ -673,23 +740,16 @@
path = KxMenu;
sourceTree = "<group>";
};
916352F42C12B6D400593047 /* HtyoNetWorking */ = {
isa = PBXGroup;
children = (
916352F22C12B6D400593047 /* HtyoNetWorking.h */,
916352F32C12B6D400593047 /* HtyoNetWorking.m */,
);
path = HtyoNetWorking;
sourceTree = "<group>";
};
916352F52C12B6D400593047 /* Utils */ = {
isa = PBXGroup;
children = (
916353A42C12C4D900593047 /* RSButton */,
916353A32C12C4CA00593047 /* HBAlertView */,
916353A12C12C3DC00593047 /* HtyoNetWorking */,
9163528B2C12B6D400593047 /* Category */,
916352912C12B6D400593047 /* GTM+AES */,
916352EE2C12B6D400593047 /* HUD */,
916352F12C12B6D400593047 /* KxMenu */,
916352F42C12B6D400593047 /* HtyoNetWorking */,
);
path = Utils;
sourceTree = "<group>";
@ -697,10 +757,172 @@
9163533F2C12C01E00593047 /* Services */ = {
isa = PBXGroup;
children = (
916353412C12C15300593047 /* HBApiParams.h */,
916353422C12C15300593047 /* HBApiParams.m */,
916353432C12C15300593047 /* HBNetWorkingUtility.h */,
916353442C12C15300593047 /* HBNetWorkingUtility.m */,
916353452C12C15300593047 /* HBNetWorkingUtilityResult.h */,
916353462C12C15300593047 /* HBNetWorkingUtilityResult.m */,
916353482C12C15300593047 /* HBNetWorkingUtility+Services.h */,
916353492C12C15300593047 /* HBNetWorkingUtility+Services.m */,
);
path = Services;
sourceTree = "<group>";
};
916353402C12C10100593047 /* Project */ = {
isa = PBXGroup;
children = (
916353852C12C20B00593047 /* Publics */,
9163533F2C12C01E00593047 /* Services */,
);
path = Project;
sourceTree = "<group>";
};
916353512C12C20B00593047 /* Color */ = {
isa = PBXGroup;
children = (
9163534F2C12C20B00593047 /* HBColor.h */,
916353502C12C20B00593047 /* HBColor.m */,
);
path = Color;
sourceTree = "<group>";
};
916353562C12C20B00593047 /* CommonKeys */ = {
isa = PBXGroup;
children = (
916353522C12C20B00593047 /* HBCommonKeys.h */,
916353532C12C20B00593047 /* HBCommonKeys.m */,
916353542C12C20B00593047 /* HBThirdKeys.h */,
916353552C12C20B00593047 /* HBThirdKeys.m */,
);
path = CommonKeys;
sourceTree = "<group>";
};
9163535D2C12C20B00593047 /* Controllers */ = {
isa = PBXGroup;
children = (
916353572C12C20B00593047 /* HBNavigationController.h */,
916353582C12C20B00593047 /* HBNavigationController.m */,
916353592C12C20B00593047 /* HBTabBarController.h */,
9163535A2C12C20B00593047 /* HBTabBarController.m */,
9163535B2C12C20B00593047 /* HBViewController.h */,
9163535C2C12C20B00593047 /* HBViewController.m */,
);
path = Controllers;
sourceTree = "<group>";
};
9163535F2C12C20B00593047 /* Defines */ = {
isa = PBXGroup;
children = (
9163535E2C12C20B00593047 /* HBDefines.h */,
);
path = Defines;
sourceTree = "<group>";
};
916353632C12C20B00593047 /* Controllers */ = {
isa = PBXGroup;
children = (
916353612C12C20B00593047 /* HBMultiLanguageController.h */,
916353622C12C20B00593047 /* HBMultiLanguageController.m */,
);
path = Controllers;
sourceTree = "<group>";
};
916353662C12C20B00593047 /* Manager */ = {
isa = PBXGroup;
children = (
916353642C12C20B00593047 /* HBMultiLanguageManager.h */,
916353652C12C20B00593047 /* HBMultiLanguageManager.m */,
);
path = Manager;
sourceTree = "<group>";
};
916353682C12C20B00593047 /* Sources */ = {
isa = PBXGroup;
children = (
916353672C12C20B00593047 /* MultiLanguage.xcstrings */,
);
path = Sources;
sourceTree = "<group>";
};
916353692C12C20B00593047 /* MultiLanguage */ = {
isa = PBXGroup;
children = (
916353632C12C20B00593047 /* Controllers */,
916353662C12C20B00593047 /* Manager */,
916353682C12C20B00593047 /* Sources */,
);
path = MultiLanguage;
sourceTree = "<group>";
};
916353842C12C20B00593047 /* Views */ = {
isa = PBXGroup;
children = (
916353762C12C20B00593047 /* HBCollectionViewCell.h */,
916353772C12C20B00593047 /* HBCollectionViewCell.m */,
916353782C12C20B00593047 /* HBRefreshAutoNormalFooter.h */,
916353792C12C20B00593047 /* HBRefreshAutoNormalFooter.m */,
9163537A2C12C20B00593047 /* HBRefreshNormalHeader.h */,
9163537B2C12C20B00593047 /* HBRefreshNormalHeader.m */,
9163537C2C12C20B00593047 /* HBTableView.h */,
9163537D2C12C20B00593047 /* HBTableView.m */,
9163537E2C12C20B00593047 /* HBTextField.h */,
9163537F2C12C20B00593047 /* HBTextField.m */,
916353802C12C20B00593047 /* HBView.h */,
916353812C12C20B00593047 /* HBView.m */,
);
path = Views;
sourceTree = "<group>";
};
916353852C12C20B00593047 /* Publics */ = {
isa = PBXGroup;
children = (
9163535F2C12C20B00593047 /* Defines */,
916353562C12C20B00593047 /* CommonKeys */,
916353692C12C20B00593047 /* MultiLanguage */,
9163535D2C12C20B00593047 /* Controllers */,
916353842C12C20B00593047 /* Views */,
916353512C12C20B00593047 /* Color */,
);
path = Publics;
sourceTree = "<group>";
};
916353A12C12C3DC00593047 /* HtyoNetWorking */ = {
isa = PBXGroup;
children = (
9163539F2C12C3DC00593047 /* HtyoNetWorking.h */,
916353A02C12C3DC00593047 /* HtyoNetWorking.m */,
);
path = HtyoNetWorking;
sourceTree = "<group>";
};
916353A32C12C4CA00593047 /* HBAlertView */ = {
isa = PBXGroup;
children = (
916353742C12C20B00593047 /* HBAlertView.h */,
916353752C12C20B00593047 /* HBAlertView.m */,
);
path = HBAlertView;
sourceTree = "<group>";
};
916353A42C12C4D900593047 /* RSButton */ = {
isa = PBXGroup;
children = (
916353822C12C20B00593047 /* RSButton.h */,
916353832C12C20B00593047 /* RSButton.m */,
);
path = RSButton;
sourceTree = "<group>";
};
916353A52C12C69900593047 /* NSNotificationCenter */ = {
isa = PBXGroup;
children = (
916353A62C12C6AF00593047 /* NSNotificationCenter+Extension.h */,
916353A72C12C6AF00593047 /* NSNotificationCenter+Extension.m */,
);
path = NSNotificationCenter;
sourceTree = "<group>";
};
B36329ED094310C499FEBA2F /* Frameworks */ = {
isa = PBXGroup;
children = (
@ -771,6 +993,7 @@
buildActionMask = 2147483647;
files = (
9163512E2C12AFEA00593047 /* Assets.xcassets in Resources */,
9163538E2C12C20B00593047 /* MultiLanguage.xcstrings in Resources */,
916353372C12B6D400593047 /* SVProgressHUD.bundle in Resources */,
916351312C12AFEA00593047 /* Base in Resources */,
);
@ -842,18 +1065,23 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
916353892C12C20B00593047 /* HBNavigationController.m in Sources */,
916353002C12B6D400593047 /* NSUserDefaults+Extesion.m in Sources */,
916351402C12B12F00593047 /* AppDelegate.m in Sources */,
9163530D2C12B6D400593047 /* UINavigationController+Transparent.m in Sources */,
916352FA2C12B6D400593047 /* NSNumber+Extension.m in Sources */,
9163534D2C12C15300593047 /* HBNetWorkingUtilityResult.m in Sources */,
916353292C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutRapidAnimation.m in Sources */,
916353A22C12C3DC00593047 /* HtyoNetWorking.m in Sources */,
916353232C12B6D400593047 /* DGActivityIndicatorCookieTerminatorAnimation.m in Sources */,
9163530A2C12B6D400593047 /* NSLayoutConstraint+BSIBDesignable.m in Sources */,
9163534C2C12C15300593047 /* HBNetWorkingUtility.m in Sources */,
916353352C12B6D400593047 /* SVIndefiniteAnimatedView.m in Sources */,
916353332C12B6D400593047 /* DGActivityIndicatorView.m in Sources */,
916353152C12B6D400593047 /* DGActivityIndicatorBallClipRotatePulseAnimation.m in Sources */,
916353132C12B6D400593047 /* DGActivityIndicatorBallClipRotateAnimation.m in Sources */,
916353322C12B6D400593047 /* DGActivityIndicatorTwoDotsAnimation.m in Sources */,
916353862C12C20B00593047 /* HBColor.m in Sources */,
9163532B2C12B6D400593047 /* DGActivityIndicatorRotatingSandglassAnimation.m in Sources */,
916351432C12B13700593047 /* SceneDelegate.m in Sources */,
9163530E2C12B6D400593047 /* UIViewController+present.m in Sources */,
@ -861,6 +1089,7 @@
916353262C12B6D400593047 /* DGActivityIndicatorLineScaleAnimation.m in Sources */,
916353272C12B6D400593047 /* DGActivityIndicatorLineScalePartyAnimation.m in Sources */,
916353102C12B6D400593047 /* NSString+AES.m in Sources */,
9163538B2C12C20B00593047 /* HBViewController.m in Sources */,
9163531A2C12B6D400593047 /* DGActivityIndicatorBallRotateAnimation.m in Sources */,
916352F82C12B6D400593047 /* NSDate+Extension.m in Sources */,
916353032C12B6D400593047 /* UIDevice+Extension.m in Sources */,
@ -869,32 +1098,41 @@
9163533A2C12B6D400593047 /* HUDManager.m in Sources */,
916353072C12B6D400593047 /* UIScreen+Extension.m in Sources */,
916353282C12B6D400593047 /* DGActivityIndicatorLineScalePulseOutAnimation.m in Sources */,
9163534B2C12C15300593047 /* HBApiParams.m in Sources */,
9163531C2C12B6D400593047 /* DGActivityIndicatorBallScaleMultipleAnimation.m in Sources */,
9163533E2C12B6D400593047 /* HtyoNetWorking.m in Sources */,
916353042C12B6D400593047 /* UIFont+Category.m in Sources */,
916353092C12B6D400593047 /* UITextField+Category.m in Sources */,
916353972C12C20B00593047 /* HBTableView.m in Sources */,
916353162C12B6D400593047 /* DGActivityIndicatorBallGridBeatAnimation.m in Sources */,
916353122C12B6D400593047 /* DGActivityIndicatorBallBeatAnimation.m in Sources */,
916353202C12B6D400593047 /* DGActivityIndicatorBallTrianglePathAnimation.m in Sources */,
916353982C12C20B00593047 /* HBTextField.m in Sources */,
916352FB2C12B6D400593047 /* NSObject+countDown.m in Sources */,
916352FC2C12B6D400593047 /* NSObject+Swizzled.m in Sources */,
9163538D2C12C20B00593047 /* HBMultiLanguageManager.m in Sources */,
9163531F2C12B6D400593047 /* DGActivityIndicatorBallSpinFadeLoader.m in Sources */,
9163539A2C12C20B00593047 /* RSButton.m in Sources */,
916353302C12B6D400593047 /* DGActivityIndicatorTriplePulseAnimation.m in Sources */,
916353022C12B6D400593047 /* UIControl+Extension.m in Sources */,
9163532D2C12B6D400593047 /* DGActivityIndicatorRotatingTrigonAnimation.m in Sources */,
916353342C12B6D400593047 /* MBProgressHUD.m in Sources */,
916353242C12B6D400593047 /* DGActivityIndicatorDoubleBounceAnimation.m in Sources */,
9163538C2C12C20B00593047 /* HBMultiLanguageController.m in Sources */,
916353192C12B6D400593047 /* DGActivityIndicatorBallPulseSyncAnimation.m in Sources */,
9163532A2C12B6D400593047 /* DGActivityIndicatorNineDotsAnimation.m in Sources */,
9163533D2C12B6D400593047 /* KxMenu.m in Sources */,
916353A82C12C6AF00593047 /* NSNotificationCenter+Extension.m in Sources */,
9163531E2C12B6D400593047 /* DGActivityIndicatorBallScaleRippleMultipleAnimation.m in Sources */,
916353362C12B6D400593047 /* SVProgressAnimatedView.m in Sources */,
916353112C12B6D400593047 /* DGActivityIndicatorAnimation.m in Sources */,
916353222C12B6D400593047 /* DGActivityIndicatorBallZigZagDeflectAnimation.m in Sources */,
9163531B2C12B6D400593047 /* DGActivityIndicatorBallScaleAnimation.m in Sources */,
916353182C12B6D400593047 /* DGActivityIndicatorBallPulseAnimation.m in Sources */,
916353872C12C20B00593047 /* HBCommonKeys.m in Sources */,
916353052C12B6D400593047 /* UIImage+Category.m in Sources */,
916353962C12C20B00593047 /* HBRefreshNormalHeader.m in Sources */,
916353392C12B6D400593047 /* SVRadialGradientLayer.m in Sources */,
916353882C12C20B00593047 /* HBThirdKeys.m in Sources */,
916351342C12AFEA00593047 /* main.m in Sources */,
916353312C12B6D400593047 /* DGActivityIndicatorTripleRingsAnimation.m in Sources */,
916352FE2C12B6D400593047 /* NSString+Extension.m in Sources */,
@ -903,13 +1141,19 @@
916353062C12B6D400593047 /* UIImageView+Extension.m in Sources */,
9163530C2C12B6D400593047 /* UIView+Frame.m in Sources */,
916353382C12B6D400593047 /* SVProgressHUD.m in Sources */,
9163534E2C12C15300593047 /* HBNetWorkingUtility+Services.m in Sources */,
916353142C12B6D400593047 /* DGActivityIndicatorBallClipRotateMultipleAnimation.m in Sources */,
9163538A2C12C20B00593047 /* HBTabBarController.m in Sources */,
916353172C12B6D400593047 /* DGActivityIndicatorBallGridPulseAnimation.m in Sources */,
916352FF2C12B6D400593047 /* NSString+Tools.m in Sources */,
916352F92C12B6D400593047 /* NSDictionary+Extension.m in Sources */,
916353952C12C20B00593047 /* HBRefreshAutoNormalFooter.m in Sources */,
916353942C12C20B00593047 /* HBCollectionViewCell.m in Sources */,
9163530B2C12B6D400593047 /* UIView+Extension.m in Sources */,
916352F62C12B6D400593047 /* FoundationContainer+Log.m in Sources */,
916353082C12B6D400593047 /* UITableView+Extension.m in Sources */,
916353992C12C20B00593047 /* HBView.m in Sources */,
916353932C12C20B00593047 /* HBAlertView.m in Sources */,
916352F72C12B6D400593047 /* NSData+Extension.m in Sources */,
9163532E2C12B6D400593047 /* DGActivityIndicatorThreeDotsAnimation.m in Sources */,
9163532F2C12B6D400593047 /* DGActivityIndicatorTriangleSkewSpinAnimation.m in Sources */,

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array/>
</plist>

View File

@ -11,4 +11,95 @@
// Include any system framework and library headers here that should be included in all compilation units.
// You will also need to set the Prefix Header build setting of one or more of your targets to reference this file.
#import "HBDefines.h"
// 第三方sdk的appkey
#import "HBThirdKeys.h"
// 项目中一些常用的 string
#import "HBCommonKeys.h"
// 多语言管理
#import "HBMultiLanguageManager.h"
// 布局管理
#import <Masonry/Masonry.h>
// 网络图片
#import <SDWebImage/SDWebImage.h>
// FaceBook登录
#import <FBSDKLoginKit/FBSDKLoginKit.h>
// FaceBook分享
#import <FBSDKShareKit/FBSDKShareKit.h>
// Google登录
#import <GoogleSignIn/GoogleSignIn.h>
// Instagram 列表库
#import <IGListKit/IGListKit.h>
// 富文本
#import <YYText/YYText.h>
// 空数据
#import <DZNEmptyDataSet/UIScrollView+EmptyDataSet.h>
// 分页控制器
#import <JXPagingView/JXPagerView.h>
#import <JXPagingView/JXPagerListRefreshView.h>
#import <JXCategoryView/JXCategoryView.h>
// 刷新控件
#import <MJRefresh/MJRefresh.h>
// 数据模型转换
#import <MJExtension/MJExtension.h>
// 模态底部弹出控制器
#import <HWPanModal/HWPanModal.h>
// 吐司
#import <Toast/UIView+Toast.h>
// 密码串
#import <SAMKeychain/SAMKeychain.h>
// 使用Swift TikTokOpenSDKCore TikTokOpenShareSDK
#import "HiBit-Bridging-Header.h"
/// 分类
#import "UIView+Frame.h"
#import "UIView+Extension.h"
#import "NSLayoutConstraint+BSIBDesignable.h"
#import "UIImage+Category.h"
#import "UIFont+Category.h"
#import "UIDevice+Extension.h"
#import "NSString+Tools.h"
#import "NSString+Extension.h"
#import "NSUserDefaults+Extesion.h"
#import "UIImageView+Extension.h"
#import "UITextField+Category.h"
#import "UIScreen+Extension.h"
#import "NSNotificationCenter+Extension.h"
// 自定义控件
#import "HBColor.h"
#import "RSButton.h"
#import "HUDManager.h"
//#import "HBNavigationController.h"
//#import "HBAlertView.h"
//#import "HBTextField.h"
//#import "HBRefreshNormalHeader.h"
//#import "HBRefreshAutoNormalFooter.h"
#import "KxMenu.h"
//#import "GKDYPlayerViewController.h"
//#import "HBWebViewController.h"
// 数据请求
//#import "HBNetWorkingUtility+Services.h"
#endif /* PrefixHeader_pch */

View File

@ -0,0 +1,26 @@
//
// HBColor.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/1.
//
#import <UIKit/UIKit.h>
#import "UIColor+Category.h"
NS_ASSUME_NONNULL_BEGIN
@interface HBColor : UIColor
+ (UIColor *)color_080B16;
+ (UIColor *)color_FF0049;
+ (UIColor *)color_272A30;
+ (UIColor *)color_999999;
+ (UIColor *)color_21242E;
+ (UIColor *)color_1973E9;
+ (UIColor *)color_FF6600;
+ (UIColor *)color_D5D5D5;
+ (UIColor *)color_22242D;
+ (UIColor *)color_FFE8C3;
+ (UIColor *)color_separator;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,53 @@
//
// HBColor.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/1.
//
#import "HBColor.h"
@implementation HBColor
+ (UIColor *)color_080B16{
return [UIColor colorWithHexString:@"#080B16"];
}
+ (UIColor *)color_FF0049{
return [UIColor colorWithHexString:@"#FF0049"];
}
+ (UIColor *)color_272A30 {
return [UIColor colorWithHexString:@"#272A30"];
}
+ (UIColor *)color_999999 {
return [UIColor colorWithHexString:@"#999999"];
}
+ (UIColor *)color_21242E {
return [UIColor colorWithHexString:@"#21242E"];
}
+ (UIColor *)color_1973E9 {
return [UIColor colorWithHexString:@"#1973E9"];
}
+ (UIColor *)color_FF6600 {
return [UIColor colorWithHexString:@"#FF6600"];
}
+ (UIColor *)color_D5D5D5 {
return [UIColor colorWithHexString:@"#D5D5D5"];
}
+ (UIColor *)color_22242D {
return [UIColor colorWithHexString:@"#22242D"];
}
+ (UIColor *)color_FFE8C3 {
return [UIColor colorWithHexString:@"#FFE8C3"];
}
+ (UIColor *)color_separator {
return [UIColor colorWithRed:75.0/255.0 green:77.0/255.0 blue:80.0/255.0 alpha:1.0];
}
@end

View File

@ -0,0 +1,40 @@
//
// HBCommonKeys.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/30.
//
#import <Foundation/Foundation.h>
/// 网络请求地址
extern NSString *const HBBaseUrlString;
/// 保存设备唯一值key
extern NSString *const HBIdentifierForVendorKey;
/// 用来保存用户是不是主动登录成功了,可以用来判断是否登录
extern NSString *const HBCustomerLoginSuccessKey;
/// 保存网络请求的Token
extern NSString *const HBNetWorkingTokenKey;
/// 保存网络请求的Token
extern NSString *const HBCustomerIdKey;
/// 搜索历史key
extern NSString *const HBSearchHistoryKey;
/// 播放界面离开 通知播放器暂停
extern NSString *const HBPlayerPuaseKey;
/// 推送详情使用
extern NSString *const HBNotificationOpenActionIdentifier;
extern NSString *const HBNotificationOpenCategoryIdentifier;
/// 第一次启动存储
extern NSString *const HBNotFirstStartKey;
/// 通知
FOUNDATION_EXPORT NSNotificationName _Nonnull const HBUpdateUserInfoNotification;

View File

@ -0,0 +1,32 @@
//
// HBCommonKeys.m
// QinJiuTV
//
// Created by on 2024/4/30.
//
#import "HBCommonKeys.h"
///
NSString *const HBBaseUrlString = @"https://hongkongapi.peonytv.com";
NSString *const HBIdentifierForVendorKey = @"HBIdentifierForVendorKey";
NSString *const HBNetWorkingTokenKey = @"HBNetWorkingTokenKey";
NSString *const HBCustomerLoginSuccessKey = @"HBCustomerLoginSuccessKey";
NSString *const HBCustomerIdKey = @"HBCustomerIdKey";
NSString *const HBSearchHistoryKey = @"HBSearchHistoryKey";
NSString *const HBPlayerPuaseKey = @"HBPlayerPuaseKey";
NSString *const HBNotificationOpenActionIdentifier = @"HBNotificationOpenActionIdentifier";
NSString *const HBNotificationOpenCategoryIdentifier = @"HBNotificationOpenCategoryIdentifier";
NSString *const HBUpdateUserInfoNotification = @"HBUpdateUserInfoNotification";
NSString *const HBNotFirstStartKey = @"HBNotFirstStartKey";

View File

@ -0,0 +1,20 @@
//
// HBThirdKeys.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/29.
//
#import <Foundation/Foundation.h>
/// appsflyer dev key
extern NSString *const HBAppsFlyerDevKey;
/// appsflyer app id
extern NSString *const HBAppsFlyerAppID;
/// applovin key
extern NSString *const HBAppLovinKey;
/// Panlge app id
extern NSString *const HBPangleID;

View File

@ -0,0 +1,20 @@
//
// HBThirdKeys.m
// QinJiuTV
//
// Created by on 2024/4/29.
//
#import "HBThirdKeys.h"
/// appsflyer dev key
NSString *const HBAppsFlyerDevKey = @"axv4xFtouhau4js4GxqBX9";
/// appsflyer app id
NSString *const HBAppsFlyerAppID = @"8377862";
/// applovin key
NSString *const HBAppLovinKey = @"XW2aulJv9urKD4MIIFT1xcSCuyTHaDZ9qUbDqygnTLS04GkdX7WMHBviGP5vDRWGsk4OJJIyLGRV3mbLqOWx0W";
/// Panlge app id
NSString *const HBPangleID = @"8377862";

View File

@ -0,0 +1,17 @@
//
// HBNavigationController.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/28.
//
#import <UIKit/UIKit.h>
#import <HBDNavigationBar/HBDNavigationController.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBNavigationController : HBDNavigationController
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,42 @@
//
// HBNavigationController.m
// QinJiuTV
//
// Created by on 2024/4/28.
//
#import "HBNavigationController.h"
@interface HBNavigationController ()
@end
@implementation HBNavigationController
- (void)viewDidLoad {
[super viewDidLoad];
// if(@available(iOS 15.0, *)) {
// UINavigationBarAppearance * appearnce = [UINavigationBarAppearance new];
//// [appearnce configureWithDefaultBackground];
// self.navigationBar.standardAppearance = appearnce;
// self.navigationBar.scrollEdgeAppearance = self.navigationBar.standardAppearance;
// }
}
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated {
if (self.viewControllers.count > 0) {
viewController.hidesBottomBarWhenPushed = YES;
NSString * navigation_btn_back = @"publics_navigationBar_back";
UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed: navigation_btn_back
renderingMode:UIImageRenderingModeAlwaysOriginal]
style:UIBarButtonItemStylePlain
target:viewController
action:@selector(backController:)];
viewController.navigationItem.leftBarButtonItem = leftBtn;
}
[super pushViewController:viewController animated:animated];
}
@end

View File

@ -0,0 +1,16 @@
//
// HBTabBarController.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/28.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBTabBarController : UITabBarController
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,97 @@
//
// HBTabBarController.m
// QinJiuTV
//
// Created by on 2024/4/28.
//
#import "HBTabBarController.h"
#import "HBNavigationController.h"
//#import "HBHomeViewController.h"
//#import "HBDiscoverController.h"
//#import "HBVideosController.h"
//#import "HBMineController.h"
//#import "GKDYPlayerViewController.h"
@interface HBTabBarController ()
@end
@implementation HBTabBarController
- (void)viewDidLoad {
[super viewDidLoad];
[self loadTabbar];
[self loadSubControllers];
}
- (void)loadTabbar {
UIColor * tabbarBackgroundColor = UIColor.blackColor;
if (@available (iOS 15.0, *)) {
// iOS 15.0
UITabBarAppearance *appearance = [[UITabBarAppearance alloc] init];
[appearance configureWithOpaqueBackground];
appearance.backgroundColor = tabbarBackgroundColor;
self.tabBar.standardAppearance = appearance;
self.tabBar.scrollEdgeAppearance = self.tabBar.standardAppearance;
} else {
self.tabBar.barTintColor = tabbarBackgroundColor;
}
self.tabBar.tintColor = HBColor.color_FF0049;
self.tabBar.unselectedItemTintColor = HBColor.color_999999;
}
- (void)loadSubControllers {
// HBHomeViewController * homeController = [[HBHomeViewController alloc]init];
//
// [self addChildViewController:homeController
// title:[@"tabbar_home" language]
// image:[UIImage imageNamed:@"tabbar_home_normal" renderingMode:UIImageRenderingModeAlwaysOriginal]
// selectedImage:[UIImage imageNamed:@"tabbar_home_selected" renderingMode:UIImageRenderingModeAlwaysOriginal]];
//
//// HBDiscoverController * discoverController = [[HBDiscoverController alloc]init];
//// GKZFPlayerViewController * discoverController = [[GKZFPlayerViewController alloc]init];
//// discoverController.details = NO;
//
// GKDYPlayerViewController * discoverController = [[GKDYPlayerViewController alloc]init];
//
// [self addChildViewController:discoverController
// title:[@"tabbar_discover" language]
// image:[UIImage imageNamed:@"tabbar_discover_normal" renderingMode:UIImageRenderingModeAlwaysOriginal]
// selectedImage:[UIImage imageNamed:@"tabbar_discover_selected" renderingMode:UIImageRenderingModeAlwaysOriginal]];
//
// HBVideosController * videosController = [[HBVideosController alloc]init];
//
// [self addChildViewController:videosController
// title:[@"tabbar_videos" language]
// image:[UIImage imageNamed:@"tabbar_discover_normal" renderingMode:UIImageRenderingModeAlwaysOriginal]
// selectedImage:[UIImage imageNamed:@"tabbar_discover_selected" renderingMode:UIImageRenderingModeAlwaysOriginal]];
//
// HBMineController * mineController = [[HBMineController alloc]init];
//
//
// [self addChildViewController:mineController
// title:[@"tabbar_mine" language]
// image:[UIImage imageNamed:@"tabbar_mine_normal" renderingMode:UIImageRenderingModeAlwaysOriginal]
// selectedImage:[UIImage imageNamed:@"tabbar_mine_selected" renderingMode:UIImageRenderingModeAlwaysOriginal]];
//
//
}
- (void)addChildViewController:(UIViewController *)childController title:(NSString *)title image:(UIImage *)image selectedImage:(UIImage *)selectedImage {
childController.tabBarItem.title = title;
[childController.tabBarItem setImage:image];
[childController.tabBarItem setSelectedImage:selectedImage];
HBNavigationController * navigationController = [[HBNavigationController alloc]initWithRootViewController:childController];
[self addChildViewController:navigationController];
}
@end

View File

@ -0,0 +1,21 @@
//
// HBViewController.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/28.
//
#import <UIKit/UIKit.h>
#import <HBDNavigationBar/HBDNavigationBar.h>
#import <HBDNavigationBar/HBDNavigationController.h>
#import <HBDNavigationBar/UIViewController+HBD.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBViewController : UIViewController
@property (assign, nonatomic) BOOL presentNavigation;
- (void)backController:(UIButton * _Nullable)sender;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,49 @@
//
// HBViewController.m
// QinJiuTV
//
// Created by on 2024/4/28.
//
#import "HBViewController.h"
@interface HBViewController ()
@end
@implementation HBViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.hbd_barTintColor = HBColor.color_080B16;
self.view.backgroundColor = HBColor.color_080B16;
self.hbd_titleTextAttributes = [NSDictionary dictionaryWithObjectsAndKeys:UIColor.whiteColor,NSForegroundColorAttributeName, nil];
if (self.presentNavigation) {
NSString * navigation_btn_back = @"publics_navigationBar_back";
UIBarButtonItem *leftBtn = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed: navigation_btn_back
renderingMode:UIImageRenderingModeAlwaysOriginal]
style:UIBarButtonItemStylePlain
target:self
action:@selector(backController:)];
self.navigationItem.leftBarButtonItem = leftBtn;
}
}
- (void)backController:(UIButton * _Nullable)sender {
if (self.presentNavigation) {
[self dismissViewControllerAnimated:YES completion:nil];
} else {
[self.navigationController popViewControllerAnimated :YES];
}
}
- (void)dealloc{
NSLog(@"%@ dealloc",self.class);
[[NSNotificationCenter defaultCenter]removeObserver:self];
}
- (void)didReceiveMemoryWarning {
NSLog(@"%@ didReceiveMemoryWarning",self.class);
}
@end

View File

@ -0,0 +1,19 @@
//
// HBDefines.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/6.
//
#ifndef HBDefines_h
#define HBDefines_h
#define HBWeakSelf __weak typeof(self) weakSelf = self;
#define HBScreenSize [[UIScreen mainScreen] bounds].size
#define HBStatusBarHeight [UIApplication sharedApplication].windows.firstObject.windowScene.statusBarManager.statusBarFrame.size.height
#define HBNavBarHeiht (HBStatusBarHeight + 44)
#define HBAdapt(floatValue) (floatValue*[[UIScreen mainScreen] bounds].size.width/375.0)
//#define HBDispatchAsyncOnMainQueue(x) __weak typeof(self) weakSelf = self; dispatch_async(dispatch_get_main_queue(), ^{ typeof(weakSelf) self = weakSelf; {x}});
#endif /* HBDefaults_h */

View File

@ -0,0 +1,22 @@
//
// HBMultiLanguageController.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/6.
//
#import "HBViewController.h"
NS_ASSUME_NONNULL_BEGIN
@interface HBMultiLanguageController : HBViewController
@property (strong, nonatomic) NSArray<HBLanguageModel*> * models;
@end
@interface HBMultiLanguageCollectionViewCell : UICollectionViewCell
@property (strong, nonatomic) HBLanguageModel * model;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,246 @@
//
// HBMultiLanguageController.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/6.
//
#import "HBMultiLanguageController.h"
@interface HBMultiLanguageController ()<UICollectionViewDelegate,UICollectionViewDataSource>
@property (weak, nonatomic) RSButton * sysButton;
@property (weak, nonatomic) UICollectionView * collectionView;
@property (strong, nonatomic) NSString * abbr;
@end
@implementation HBMultiLanguageController
-(NSArray<HBLanguageModel *> *)models {
if (!_models) {
_models = [HBMultiLanguageManager languages];
}
return _models;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self loadNavigationBar];
[self loadSubViews];
}
- (void)loadNavigationBar {
self.navigationItem.title = [@"mine_title_language" language];
}
-(void)loadSubViews {
UIButton * doneButton = [[UIButton alloc]init];
[doneButton acs_radiusWithRadius:21.0 corner:UIRectCornerAllCorners];
doneButton.layer.masksToBounds = YES;
[doneButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[doneButton setTitle:[@"common_button_ok" language] forState:UIControlStateNormal];
[doneButton setBackgroundImage:[UIImage imageNamed:@"publics_gradient"] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(doneAction) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:doneButton];
UIView * sysView = [[UIView alloc]init];
[sysView acs_radiusWithRadius:10.0 corner:UIRectCornerAllCorners];
sysView.backgroundColor = HBColor.color_FF0049;
[sysView addTapGestureRecognizerWithTarget:self action:@selector(systemAction)];
[self.view addSubview:sysView];
RSButton * sysButton = [[RSButton alloc]initWithType:RSButtonTypeAbove];
sysButton.selected = [HBMultiLanguageManager isSystem];
sysButton.margin = 4.0;
sysButton.insets = UIEdgeInsetsMake(0, 4.0, 0, 4.0);
[sysButton setTitleFont:[UIFont systemFontOfSize:12.0 weight:UIFontWeightSemibold]];
[sysButton setTitle:[@"language_text_system" language] forState:UIControlStateNormal];
[sysButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[sysButton setImage:[UIImage imageNamed:@"language_select_normal"] forState:UIControlStateNormal];
[sysButton setImage:[UIImage imageNamed:@"language_select_selected"] forState:UIControlStateSelected];
[sysButton addTarget:self action:@selector(systemAction) forControlEvents:UIControlEventTouchUpInside];
[sysView addSubview:sysButton];
self.sysButton = sysButton;
UILabel * sysDetailTextLabel = [[UILabel alloc]init];
sysDetailTextLabel.text = [@"language_text_system_tip" language];
sysDetailTextLabel.font = [UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular];
sysDetailTextLabel.textColor = UIColor.whiteColor;
sysDetailTextLabel.numberOfLines = 0;
[sysView addSubview:sysDetailTextLabel];
CGFloat width = (self.view.width - 42.0) * 0.5;
UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc]init];
flowLayout.scrollDirection = UICollectionViewScrollDirectionVertical;
flowLayout.minimumLineSpacing = 10.0;
flowLayout.itemSize = CGSizeMake(width, width);
UICollectionView * collectionView = [[UICollectionView alloc]initWithFrame:CGRectZero collectionViewLayout:flowLayout];
collectionView.backgroundColor = HBColor.color_080B16;
[collectionView registerClass:HBMultiLanguageCollectionViewCell.class forCellWithReuseIdentifier:@"HBMultiLanguageCollectionViewCell"];
collectionView.delegate = self;
collectionView.dataSource = self;
[self.view addSubview:collectionView];
self.collectionView = collectionView;
[sysView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.offset(16.0);
make.right.offset(-16.0);
make.height.offset(71.0);
}];
[sysButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.centerY.equalTo(sysView);
make.width.offset(80.0);
}];
[sysDetailTextLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(sysButton.mas_right);
make.top.offset(10.0);
make.right.offset(-12.0);
make.bottom.offset(-10.0);
}];
[doneButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(16.0);
make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-20.0);
make.right.offset(-16.0);
make.height.offset(42.0);
}];
[collectionView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(16.0);
make.right.offset(-16.0);
make.top.equalTo(sysView.mas_bottom).offset(20.0);
make.bottom.equalTo(doneButton.mas_top).offset(-20.0);
}];
}
#pragma mark UICollectionViewDelegate
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
self.sysButton.selected = NO;
self.abbr = self.models[indexPath.row].abbr;
}
#pragma mark UICollectionViewDataSource
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
return self.models.count;
}
- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
HBMultiLanguageCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"HBMultiLanguageCollectionViewCell" forIndexPath:indexPath];
cell.model = self.models[indexPath.row];
if (cell.model.selected) {
[collectionView selectItemAtIndexPath:indexPath animated:YES scrollPosition:UICollectionViewScrollPositionNone];
}
return cell;
}
#pragma mark Action
- (void)systemAction {
if (!self.sysButton.selected) { //
self.abbr = @"--"; // @"--"
self.sysButton.selected = YES;
[self.collectionView deselectItemAtIndexPath:self.collectionView.indexPathsForSelectedItems.firstObject animated:YES];
}
}
- (void)doneAction {
[HBMultiLanguageManager saveCurrentLanguageAbbr:self.abbr];
}
@end
@interface HBMultiLanguageCollectionViewCell()
@property (weak, nonatomic) UIButton * button;
@property (weak, nonatomic) UIImageView * imageView;
@property (weak, nonatomic) UILabel * titleLabel;
@property (weak, nonatomic) UILabel * subTitleLabel;
@end
@implementation HBMultiLanguageCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
self.layer.borderWidth = 1.0;
self.layer.borderColor = HBColor.color_272A30.CGColor;
self.backgroundColor = HBColor.color_272A30;
[self acs_radiusWithRadius:10.0 corner:UIRectCornerAllCorners];
[self loadSubViews];
}
return self;
}
- (void)loadSubViews {
UIButton * button = [[UIButton alloc]init];
[button setImage:[UIImage imageNamed:@"publics_select_button_normal"] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"publics_select_button_selected"] forState:UIControlStateSelected];
[self addSubview:button];
self.button = button;
UIImageView * imageView = [[UIImageView alloc] init];
imageView.hidden = YES;
imageView.image = [UIImage imageNamed:@"language_country_zh"];
[self addSubview:imageView];
self.imageView = imageView;
UILabel * titleLabel = [[UILabel alloc]init];
titleLabel.text = @"中文";
titleLabel.textColor = UIColor.whiteColor;
titleLabel.font = [UIFont systemFontOfSize:14.0 weight:UIFontWeightRegular];
[self addSubview:titleLabel];
self.titleLabel = titleLabel;
UILabel * subTitleLabel = [[UILabel alloc]init];
subTitleLabel.numberOfLines = 0;
subTitleLabel.text = @"选择语言后,您的系统将会切换成中文";
subTitleLabel.textAlignment = NSTextAlignmentCenter;
subTitleLabel.textColor = UIColor.whiteColor;
subTitleLabel.font = [UIFont systemFontOfSize:14.0 weight:UIFontWeightRegular];
[self addSubview:subTitleLabel];
self.subTitleLabel = subTitleLabel;
[button mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.offset(8.0);
}];
[subTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.offset(8.0);
make.right.offset(-8.0);
make.bottom.offset(-18.0);
make.top.equalTo(titleLabel.mas_bottom).offset(6.0);
}];
[imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.offset(25.0);
make.centerX.equalTo(self);
}];
[titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self);
make.top.equalTo(imageView.mas_bottom).offset(6.0);
}];
}
-(void)setModel:(HBLanguageModel *)model{
_model = model;
self.imageView.image = [UIImage imageNamed:model.imageNamed];
self.titleLabel.text = model.title;
self.subTitleLabel.text = model.subTitle;
}
-(void)setSelected:(BOOL)selected {
self.button.selected = selected;
if (selected) {
self.layer.borderColor = HBColor.color_FF0049.CGColor;
self.backgroundColor = [HBColor.color_FF0049 alpha:0.2];
} else {
self.layer.borderColor = HBColor.color_272A30.CGColor;
self.backgroundColor = HBColor.color_272A30;
}
}
@end

View File

@ -0,0 +1,74 @@
//
// HBMultiLanguageManager.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/6.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/*
--
zh-Hans
en English
zh-Hans-HK
ko
*/
/// 多语言 userdefine key
extern NSString *const HBMultiLanguageKey;
/// 多语言 查询系统首选语言 key
extern NSString *const HBLocaleLanguageKey;
/// 多语言发发现切换使用通知的key
extern NSString *const HBNotificationMultiLanguageChangeKey;
@interface HBLanguageModel : NSObject
/// 语言展示的标题
@property (copy, nonatomic) NSString * title;
/// 语言文件名 或 英文简写
@property (copy, nonatomic) NSString * abbr;
/// 国旗名
@property (copy, nonatomic) NSString * imageNamed;
/// 描述
@property (copy, nonatomic) NSString * subTitle;
/// 当前选中
@property (assign, nonatomic) BOOL selected;
+ (HBLanguageModel *) newWithTitle:(NSString *) title subTitle:(NSString *)subTitle abbr:(NSString *) abbr imageNamed:(NSString *)imageNamed;
@end
@interface HBMultiLanguageManager : NSObject
/// 获取当前使用的语言设置
/// 只给外部使用
+ (NSString *)abbr;
+ (BOOL)isSystem;
/// 保存当前选的语言
+ (void)saveCurrentLanguageAbbr:(NSString *)language;
/// 获取当前可以展示的语言列表
+ (NSArray<HBLanguageModel *> *)languages;
@end
@interface NSString (language)
- (NSString *)language;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,168 @@
//
// HBMultiLanguageManager.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/6.
//
#import "HBMultiLanguageManager.h"
/// userdefine key
NSString *const HBMultiLanguageKey = @"HB_language";
NSString *const HBLocaleLanguageKey = @"AppleLanguages";
NSString *const HBNotificationMultiLanguageChangeKey = @"HB_language_change_key";
@implementation HBLanguageModel
+ (HBLanguageModel *) newWithTitle:(NSString *) title subTitle:(NSString *)subTitle abbr:(NSString *) abbr imageNamed:(NSString *)imageNamed{
HBLanguageModel * model = [[HBLanguageModel alloc]init];
model.title = title;
model.abbr = abbr;
model.imageNamed = imageNamed;
model.subTitle = subTitle;
return model;
}
-(BOOL)selected{
return [self.abbr isEqualToString:[NSUserDefaults stringForKey:HBMultiLanguageKey]];
}
@end
@implementation HBMultiLanguageManager
+ (NSString *)abbr{
NSString * abbr = [self currentlanguageAbbr];
if ([abbr isEqualToString:@"--"]) {
NSString * localAbbr = [NSUserDefaults arrayForKey:HBLocaleLanguageKey].firstObject;
NSString *countryCode = [NSString stringWithFormat:@"-%@", [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]];
if (localAbbr) {
localAbbr = [localAbbr stringByReplacingOccurrencesOfString:countryCode withString:@""];
}
return localAbbr;
}
return abbr;
}
+ (BOOL)isSystem {
NSString * abbr = [self currentlanguageAbbr];
return [abbr isEqualToString:@"--"];
}
+ (NSString *)currentlanguageAbbr{
NSString * abbr = [NSUserDefaults stringForKey:HBMultiLanguageKey];
if (!abbr) {
abbr = @"--";
[self saveCurrentLanguageAbbr:abbr];
}
return abbr;
}
+ (void)saveCurrentLanguageAbbr:(NSString *)abbr {
NSString * oldAbbr = [NSUserDefaults stringForKey:HBMultiLanguageKey];
if ([oldAbbr isEqualToString:abbr]) return;
// [NSUserDefaults setObject:abbr forKey:HBLocaleLanguageKey];
[NSUserDefaults setObject:abbr forKey:HBMultiLanguageKey];
[NSUserDefaults synchronize];
[[NSNotificationCenter defaultCenter]postNotificationName:HBNotificationMultiLanguageChangeKey object:nil];
}
+(NSArray<HBLanguageModel *> *)languages{
return @[
[HBLanguageModel newWithTitle:@"中文" subTitle:@"选择语言后,您的系统将会切换成中文" abbr:@"zh" imageNamed:@"language_country_zh"],
[HBLanguageModel newWithTitle:@"English" subTitle:@"After selecting the language, your system will switch to English" abbr:@"en" imageNamed:@"language_country_en"],
[HBLanguageModel newWithTitle:@"Tiếng Việt" subTitle:@"Sau khi chọn ngôn ngữ, hệ thống của bạn sẽ chuyển sang tiếng việt" abbr:@"vi" imageNamed:@"language_country_vi"],
[HBLanguageModel newWithTitle:@"한국어" subTitle:@"언어를 선택하면 시스템이 한국어로 전환됩니다" abbr:@"ko" imageNamed:@"language_country_ko"],
[HBLanguageModel newWithTitle:@"日本語" subTitle:@"言語をせんたく選択すると、システムはにっぽん日本ご語にきりかわり切り替わります" abbr:@"ja" imageNamed:@"language_country_ja"]
];
}
@end
@implementation NSString (language)
- (NSString *)language {
return NSLocalizedStringFromTable(self, @"MultiLanguage",nil);
}
//- (NSString *)language {
//
// NSString * abbr = [HBMultiLanguageManager currentlanguageAbbr];
//
// NSString * localAbbr = [NSUserDefaults arrayForKey:HBLocaleLanguageKey].firstObject;
//
// NSString *countryCode = [NSString stringWithFormat:@"-%@", [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]];
// if (localAbbr) {
// localAbbr = [localAbbr stringByReplacingOccurrencesOfString:countryCode withString:@""];
// }
//
// if ([abbr isEqualToString:@"--"]) {
// return [self bundleWithAbbr:localAbbr];
// } else {
// return [self bundleWithAbbr:abbr];
// }
//}
//
//- (NSBundle *) bundleWithAbbr:(NSString *) abbr {
// return [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:abbr ofType:@"lproj"]];
//}
//
//- (NSString *)languageWithBundle:(NSBundle *) bundle {
// if (bundle) {
// return NSLocalizedStringFromTableInBundle(self, @"MultiLanguage", bundle, ni);
// } else {
// return NSLocalizedStringFromTable(self, @"MultiLanguage",nil);
// }
//}
@end
@interface HBBundle : NSBundle
@end
@implementation HBBundle
- (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName {
if ([HBBundle bundle]) {
return [[HBBundle bundle] localizedStringForKey:key value:value table:tableName];
} else {
return [super localizedStringForKey:key value:value table:tableName];
}
}
+ (NSBundle *)bundle {
NSString * abbr = [HBMultiLanguageManager currentlanguageAbbr];
NSString * localAbbr = [NSUserDefaults arrayForKey:HBLocaleLanguageKey].firstObject;
NSString *countryCode = [NSString stringWithFormat:@"-%@", [[NSLocale currentLocale] objectForKey:NSLocaleCountryCode]];
if (localAbbr) {
localAbbr = [localAbbr stringByReplacingOccurrencesOfString:countryCode withString:@""];
}
if ([abbr isEqualToString:@"--"]) {
return [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:localAbbr ofType:@"lproj"]];
} else {
return [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:abbr ofType:@"lproj"]];;
}
}
@end
@implementation NSBundle (Language)
+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
// KVO[NSBundle mainBundle]isa使CLBundle
// 便使method_swizzlingmainBundle
object_setClass([NSBundle mainBundle], [HBBundle class]);
});
}
@end

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,16 @@
//
// HBCollectionViewCell.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/15.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBCollectionViewCell : UICollectionViewCell
@property (weak, nonatomic) UIViewController * controller;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// HBCollectionViewCell.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/15.
//
#import "HBCollectionViewCell.h"
@implementation HBCollectionViewCell
@end

View File

@ -0,0 +1,16 @@
//
// HBRefreshAutoNormalFooter.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/6.
//
#import "MJRefreshAutoNormalFooter.h"
NS_ASSUME_NONNULL_BEGIN
@interface HBRefreshAutoNormalFooter : MJRefreshAutoNormalFooter
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,19 @@
//
// HBRefreshAutoNormalFooter.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/6.
//
#import "HBRefreshAutoNormalFooter.h"
@implementation HBRefreshAutoNormalFooter
-(void)prepare{
[super prepare];
[self setTitle:[@"refresh_auto_footer_idle_text" language] forState:MJRefreshStateIdle];
[self setTitle:[@"refresh_auto_footer_refreshing_rext" language] forState:MJRefreshStateRefreshing];
[self setTitle:[@"refresh_auto_footer_no_more_data_text" language] forState:MJRefreshStateNoMoreData];
}
@end

View File

@ -0,0 +1,16 @@
//
// HBRefreshNormalHeader.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/6.
//
#import "MJRefreshNormalHeader.h"
NS_ASSUME_NONNULL_BEGIN
@interface HBRefreshNormalHeader : MJRefreshNormalHeader
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,64 @@
//
// HBRefreshNormalHeader.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/6/6.
//
#import "HBRefreshNormalHeader.h"
@implementation HBRefreshNormalHeader
-(void)prepare{
[super prepare];
[self setTitle:[@"refresh_header_idle_text" language] forState:MJRefreshStateIdle];
[self setTitle:[@"refresh_header_pulling_text" language] forState:MJRefreshStatePulling];
[self setTitle:[@"refresh_Header_refreshing_text" language] forState:MJRefreshStateRefreshing];
}
- (void)setLastUpdatedTimeKey:(NSString *)lastUpdatedTimeKey {
[super setLastUpdatedTimeKey:lastUpdatedTimeKey];
// label
if (self.lastUpdatedTimeLabel.hidden) return;
NSDate *lastUpdatedTime = [[NSUserDefaults standardUserDefaults] objectForKey:lastUpdatedTimeKey];
// block
if (self.lastUpdatedTimeText) {
self.lastUpdatedTimeLabel.text = self.lastUpdatedTimeText(lastUpdatedTime);
return;
}
if (lastUpdatedTime) {
// 1.
NSCalendar *calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian];
NSUInteger unitFlags = NSCalendarUnitYear| NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute;
NSDateComponents *cmp1 = [calendar components:unitFlags fromDate:lastUpdatedTime];
NSDateComponents *cmp2 = [calendar components:unitFlags fromDate:[NSDate date]];
// 2.
NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
BOOL isToday = NO;
if ([cmp1 day] == [cmp2 day]) { //
formatter.dateFormat = @" HH:mm";
isToday = YES;
} else if ([cmp1 year] == [cmp2 year]) { //
formatter.dateFormat = @"MM-dd HH:mm";
} else {
formatter.dateFormat = @"yyyy-MM-dd HH:mm";
}
NSString *time = [formatter stringFromDate:lastUpdatedTime];
// 3.
self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@%@",
[@"refresh_header_last_time_text" language],
isToday ? [@"refresh_header_date_today_text" language] : @"",
time];
} else {
self.lastUpdatedTimeLabel.text = [NSString stringWithFormat:@"%@%@",
[@"refresh_header_last_time_text" language],
[@"refresh_header_none_last_date_text" language]];
}
}
@end

View File

@ -0,0 +1,16 @@
//
// HBTableView.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/15.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBTableView : UITableView
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,12 @@
//
// HBTableView.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/15.
//
#import "HBTableView.h"
@implementation HBTableView
@end

View File

@ -0,0 +1,16 @@
//
// HBTextField.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/21.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBTextField : UITextField
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,21 @@
//
// HBTextField.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/21.
//
#import "HBTextField.h"
@implementation HBTextField
- (CGSize)intrinsicContentSize {
return UILayoutFittingExpandedSize; //
}
-(CGRect)leftViewRectForBounds:(CGRect)bounds {
return CGRectMake(0, 0, 32, 32);
}
@end

View File

@ -0,0 +1,16 @@
//
// HBView.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/13.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,13 @@
//
// HBView.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/13.
//
#import "HBView.h"
@implementation HBView
@end

View File

@ -0,0 +1,35 @@
//
// HBApiParams.h
// FlyChat1
//
// Created by Liv on 2022/3/6.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface HBApiParams : NSObject
/**
client:
clientVer:apppch5
cont:
timestamp:
clientTypeios android h5 web;
apiVer1
key:使sha1()hex值获取
使key=value结构拼接key即可
apiVer=1&clientType=web&clientVer=1&cont=&timestamp=1572760249513&key=CA84D1343B96BAA8137C943ED1860E522CACB238
md5加密转hex获得sign的值如下
:A6218946715FF5272527BFEADE70D022
***/
+ (NSDictionary *)fetchPostParams:(id)info encryption:(BOOL)encryption;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,321 @@
//
// HBApiParams.m
// FlyChat1
//
// Created by Liv on 2022/3/6.
//
#import "HBApiParams.h"
#import <sys/utsname.h>
#import <mach/mach.h>
#import "CommonCrypto/CommonDigest.h"
#import "NSString+AES.h"
@implementation HBApiParams
/**
client:
clientVer:apppch5
cont:
timestamp:
clientTypeios android h5 web;
apiVer1
key:使sha1()hex
使key=valuekey
apiVer=1&clientType=web&clientVer=1&cont=&timestamp=1572760249513&key=CA84D1343B96BAA8137C943ED1860E522CACB238
md5hexsign
:A6218946715FF5272527BFEADE70D022
***/
+ (NSDictionary *)fetchPostParams:(id)info encryption:(BOOL)encryption{
NSMutableDictionary * tempInfo = [NSMutableDictionary dictionary];
[tempInfo addEntriesFromDictionary:@{@"client":[self fetchClient]}];
[tempInfo addEntriesFromDictionary:@{@"clientVer":@"1"}];
[tempInfo addEntriesFromDictionary:@{@"apiVer":[self fetchApiVer]}];
[tempInfo addEntriesFromDictionary:@{@"clientType":[self fetchClientType]}];
[tempInfo addEntriesFromDictionary:@{@"timestamp":[self fetchTimestamp]}];
[tempInfo addEntriesFromDictionary:@{@"param":@"param"}];
if (info) {
NSError *error;
NSString * infoJson = @"{}";
NSData * jsonData = [NSJSONSerialization dataWithJSONObject:info options:0 error:&error];
if (jsonData) {
infoJson = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding];
}
if (encryption) {
infoJson = [infoJson aci_encryptWithAES];
[tempInfo addEntriesFromDictionary:@{@"cont":infoJson}];
} else {
[tempInfo setValue:info forKey:@"cont"];
}
} else {
[tempInfo addEntriesFromDictionary:@{@"cont":@""}];
}
[tempInfo addEntriesFromDictionary:@{@"sign":[self fetchMD5Sha1Sign:tempInfo]}];
if ([tempInfo[@"cont"] isKindOfClass:[NSString class]] && [tempInfo[@"cont"] isEqualToString:@""]) {
[tempInfo removeObjectForKey:@"cont"];
}
return tempInfo;
}
+ (NSDictionary *)fetchClient{
NSDictionary * clientDic = @{@"deviceId": [self fetchCurrentDeviceModel],
@"osType":@"iOS",
@"deviceType":@"ios",
@"osVersion":@"1.0",
@"appVersion":[self fetchAppVersion]};
return clientDic;
}
+ (NSString *)fetchCurrentDeviceModel{
struct utsname systemInfo;
uname(&systemInfo);
NSString *deviceModel = [NSString stringWithCString:systemInfo.machine
encoding:NSASCIIStringEncoding];
if ([deviceModel isEqualToString:@"iPhone3,1"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,2"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone3,3"]) return @"iPhone 4";
if ([deviceModel isEqualToString:@"iPhone4,1"]) return @"iPhone 4S";
if ([deviceModel isEqualToString:@"iPhone5,1"]) return @"iPhone 5";
if ([deviceModel isEqualToString:@"iPhone5,2"]) return @"iPhone 5 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone5,3"]) return @"iPhone 5c (GSM)";
if ([deviceModel isEqualToString:@"iPhone5,4"]) return @"iPhone 5c (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone6,1"]) return @"iPhone 5s (GSM)";
if ([deviceModel isEqualToString:@"iPhone6,2"]) return @"iPhone 5s (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPhone7,1"]) return @"iPhone 6 Plus";
if ([deviceModel isEqualToString:@"iPhone7,2"]) return @"iPhone 6";
if ([deviceModel isEqualToString:@"iPhone8,1"]) return @"iPhone 6s";
if ([deviceModel isEqualToString:@"iPhone8,2"]) return @"iPhone 6s Plus";
if ([deviceModel isEqualToString:@"iPhone8,4"]) return @"iPhone SE";
// 使FeliCa
if ([deviceModel isEqualToString:@"iPhone9,1"]) return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,2"]) return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone9,3"]) return @"iPhone 7";
if ([deviceModel isEqualToString:@"iPhone9,4"]) return @"iPhone 7 Plus";
if ([deviceModel isEqualToString:@"iPhone10,1"]) return @"iPhone_8";
if ([deviceModel isEqualToString:@"iPhone10,4"]) return @"iPhone_8";
if ([deviceModel isEqualToString:@"iPhone10,2"]) return @"iPhone_8_Plus";
if ([deviceModel isEqualToString:@"iPhone10,5"]) return @"iPhone_8_Plus";
if ([deviceModel isEqualToString:@"iPhone10,3"]) return @"iPhone X";
if ([deviceModel isEqualToString:@"iPhone10,6"]) return @"iPhone X";
if ([deviceModel isEqualToString:@"iPhone11,8"]) return @"iPhone XR";
if ([deviceModel isEqualToString:@"iPhone11,2"]) return @"iPhone XS";
if ([deviceModel isEqualToString:@"iPhone11,6"]) return @"iPhone XS Max";
if ([deviceModel isEqualToString:@"iPhone11,4"]) return @"iPhone XS Max";
if ([deviceModel isEqualToString:@"iPhone12,1"]) return @"iPhone 11";
if ([deviceModel isEqualToString:@"iPhone12,3"]) return @"iPhone 11 Pro";
if ([deviceModel isEqualToString:@"iPhone12,5"]) return @"iPhone 11 Pro Max";
if ([deviceModel isEqualToString:@"iPhone12,8"]) return @"iPhone SE2";
if ([deviceModel isEqualToString:@"iPhone13,1"]) return @"iPhone 12 mini";
if ([deviceModel isEqualToString:@"iPhone13,2"]) return @"iPhone 12";
if ([deviceModel isEqualToString:@"iPhone13,3"]) return @"iPhone 12 Pro";
if ([deviceModel isEqualToString:@"iPhone13,4"]) return @"iPhone 12 Pro Max";
if ([deviceModel isEqualToString:@"iPhone14,1"]) return @"iPhone 13 mini";
if ([deviceModel isEqualToString:@"iPhone14,2"]) return @"iPhone 13";
if ([deviceModel isEqualToString:@"iPhone14,3"]) return @"iPhone 13 Pro";
if ([deviceModel isEqualToString:@"iPhone14,4"]) return @"iPhone 13 Pro Max";
if ([deviceModel isEqualToString:@"iPod1,1"]) return @"iPod Touch 1G";
if ([deviceModel isEqualToString:@"iPod2,1"]) return @"iPod Touch 2G";
if ([deviceModel isEqualToString:@"iPod3,1"]) return @"iPod Touch 3G";
if ([deviceModel isEqualToString:@"iPod4,1"]) return @"iPod Touch 4G";
if ([deviceModel isEqualToString:@"iPod5,1"]) return @"iPod Touch (5 Gen)";
if ([deviceModel isEqualToString:@"iPad1,1"]) return @"iPad";
if ([deviceModel isEqualToString:@"iPad1,2"]) return @"iPad 3G";
if ([deviceModel isEqualToString:@"iPad2,1"]) return @"iPad 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,2"]) return @"iPad 2";
if ([deviceModel isEqualToString:@"iPad2,3"]) return @"iPad 2 (CDMA)";
if ([deviceModel isEqualToString:@"iPad2,4"]) return @"iPad 2";
if ([deviceModel isEqualToString:@"iPad2,5"]) return @"iPad Mini (WiFi)";
if ([deviceModel isEqualToString:@"iPad2,6"]) return @"iPad Mini";
if ([deviceModel isEqualToString:@"iPad2,7"]) return @"iPad Mini (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad3,1"]) return @"iPad 3 (WiFi)";
if ([deviceModel isEqualToString:@"iPad3,2"]) return @"iPad 3 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad3,3"]) return @"iPad 3";
if ([deviceModel isEqualToString:@"iPad3,4"]) return @"iPad 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad3,5"]) return @"iPad 4";
if ([deviceModel isEqualToString:@"iPad3,6"]) return @"iPad 4 (GSM+CDMA)";
if ([deviceModel isEqualToString:@"iPad4,1"]) return @"iPad Air (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,2"]) return @"iPad Air (Cellular)";
if ([deviceModel isEqualToString:@"iPad4,4"]) return @"iPad Mini 2 (WiFi)";
if ([deviceModel isEqualToString:@"iPad4,5"]) return @"iPad Mini 2 (Cellular)";
if ([deviceModel isEqualToString:@"iPad4,6"]) return @"iPad Mini 2";
if ([deviceModel isEqualToString:@"iPad4,7"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad4,8"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad4,9"]) return @"iPad Mini 3";
if ([deviceModel isEqualToString:@"iPad5,1"]) return @"iPad Mini 4 (WiFi)";
if ([deviceModel isEqualToString:@"iPad5,2"]) return @"iPad Mini 4 (LTE)";
if ([deviceModel isEqualToString:@"iPad5,3"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"iPad5,4"]) return @"iPad Air 2";
if ([deviceModel isEqualToString:@"iPad6,3"]) return @"iPad Pro 9.7";
if ([deviceModel isEqualToString:@"iPad6,4"]) return @"iPad Pro 9.7";
if ([deviceModel isEqualToString:@"iPad6,7"]) return @"iPad Pro 12.9";
if ([deviceModel isEqualToString:@"iPad6,8"]) return @"iPad Pro 12.9";
if ([deviceModel isEqualToString:@"AppleTV2,1"]) return @"Apple TV 2";
if ([deviceModel isEqualToString:@"AppleTV3,1"]) return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV3,2"]) return @"Apple TV 3";
if ([deviceModel isEqualToString:@"AppleTV5,3"]) return @"Apple TV 4";
if ([deviceModel isEqualToString:@"i386"]) return @"Simulator";
if ([deviceModel isEqualToString:@"x86_64"]) return @"Simulator";
return deviceModel;
}
+ (NSString *)fetchTimestamp{
NSDate *date = [NSDate dateWithTimeIntervalSinceNow:0]; // 0
NSTimeInterval time = [date timeIntervalSince1970]*1000;// *1000 (13),(10)
return [NSString stringWithFormat:@"%.0f", time];
}
+ (NSString *)fetchAppVersion {
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
return app_Version;
}
+ (NSString *)fetchApiVer{
NSString * apiVer = @"1";
return apiVer;
}
+ (NSString *)fetchClientType{
NSString * clientType = @"iOS";
return clientType;
}
+ (NSString *)fetchMD5Sha1Sign:(NSDictionary *)info {
NSString * signStr = [self fetchSignStr:info];
NSString * key = [[self sha1WithString:[self fetchClientType]] uppercaseString];
signStr = [signStr stringByAppendingFormat:@"&key=%@",key];
NSString * signComp = [ [self MD5String:signStr] uppercaseString] ;
return signComp;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ (NSString *)MD5String:(NSString *)signStr {
const char *cstr = [signStr UTF8String];
unsigned char result[16];
CC_MD5(cstr, (CC_LONG)strlen(cstr), result);
return [NSString stringWithFormat:
@"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x",
result[0], result[1], result[2], result[3],
result[4], result[5], result[6], result[7],
result[8], result[9], result[10], result[11],
result[12], result[13], result[14], result[15]
];
}
#pragma clang diagnostic pop
+ (NSString *)sha1WithString:(NSString *)string {
NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
return [self sha1WithData:data];
}
+ (NSString *)sha1WithData:(NSData *)data {
unsigned char *digest = NULL;
// Malloc a buffer to hold hash.
digest = malloc(CC_SHA1_DIGEST_LENGTH * sizeof(unsigned char));
memset(digest, 0x0, CC_SHA1_DIGEST_LENGTH);
CC_SHA1(data.bytes, (CC_LONG)data.length, digest);
NSString *result = [self sha1WithDigest:digest];
if (digest) {
free(digest);
}
return result;
}
+ (NSString *)sha1WithDigest:(const unsigned char *)digest {
if (!digest) {
return nil;
}
NSMutableString *result = [NSMutableString stringWithCapacity:CC_SHA1_DIGEST_LENGTH * sizeof(unsigned char)];
for (int i = 0; i < CC_SHA1_DIGEST_LENGTH; i++) {
[result appendFormat:@"%02x",digest[i]];
}
return result;
}
+ (NSString *)fetchSignStr:(NSDictionary *)info {
NSString * signStr = @"";
NSArray*sortedKeys=[[info allKeys]sortedArrayUsingSelector:@selector(compare:)];
for(NSString * key in sortedKeys){
if ([key isEqualToString:@"client"]) {
continue;
}
id value = [info objectForKey:key] ;
if ([key isEqualToString:@"cont"] && [value isKindOfClass:[NSString class]] && [value length] == 0) {
continue;
}
NSString * valueStr = @"";
if ([value isKindOfClass:[NSArray class]] ) {
valueStr = [self stringWithArray:value];
valueStr = [valueStr stringByAppendingString:@"}"];
}else if ([value isKindOfClass:[NSDictionary class]]){
valueStr = [NSString stringWithFormat:@"%@}",[self stringWithDict:value]];
}else if ([value isKindOfClass:[NSString class]]){
valueStr = value;
}
NSString * tempKeyV = [NSString stringWithFormat:@"%@=%@&",key,valueStr];
signStr = [signStr stringByAppendingFormat:@"%@",tempKeyV];
}
if (signStr.length >0) {
signStr = [signStr substringToIndex:signStr.length-1];
}
return signStr;
}
+ (NSString*)stringWithArray:(NSArray*)array {
NSString*str =@"[";
for(id obj in array) {
if([obj isKindOfClass:[NSDictionary class]]) {
str = [self stringWithDict:obj];
str = [str stringByAppendingFormat:@"}"];
}else if([obj isKindOfClass:[NSArray class]]) {
str = [self stringWithArray:obj];
str = [str stringByAppendingFormat:@"]"];
}
if([str length] !=1) {
str = [str stringByAppendingString:@","];
}
}
return str;
}
+ (NSString*)stringWithDict:(NSDictionary*)dict{
NSArray*keys = [dict allKeys];
NSArray*sortedArray = [keys sortedArrayUsingComparator:^NSComparisonResult(id obj1,id obj2) {
return[obj1 compare:obj2 options:NSNumericSearch];
}];
NSString*str =@"{";
for(NSString*categoryId in sortedArray) {
id value = [dict objectForKey:categoryId];
if([value isKindOfClass:[NSDictionary class]]) {
value = [self stringWithDict:value];
value = [NSString stringWithFormat:@"%@}",value];
}
if([str length] !=1) {
str = [str stringByAppendingString:@","];
}
str = [str stringByAppendingFormat:@"\"%@\":\"%@\"",categoryId,value];
}
return str;
}
@end

View File

@ -0,0 +1,135 @@
//
// HBNetWorkingUtility+Services.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/28.
//
#import "HBNetWorkingUtility.h"
NS_ASSUME_NONNULL_BEGIN
/// 公共接口
@interface HBNetWorkingUtility (Commom)
/// 用设备信息 注册token
/// NSUserDefaults HBNetWorkingTokenKey 保存了 token
/// NSUserDefaults HBCustomerIdKey 保存了 用户id
+ (void)commom_deviceRegister;
/// 获取首页滚动
/// - Parameter complateBlock:
+ (void)commom_fetchBannersWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 短剧搜索
/// - Parameters:
/// - key: 搜索的关键字
/// - complateBlock:
+ (void)common_searchVideosWithKey:(NSString *) key complateBlock:(HBResponseComplateBlock)complateBlock;
@end
/// 首页接口
@interface HBNetWorkingUtility (home)
+ (void)home_fetchCategoriesWithComplateBlock:(HBResponseComplateBlock)complateBlock;
@end
/// 用户相关接口
@interface HBNetWorkingUtility (Customer)
/// 第三方登录接口
/// - Parameters:
/// - params: @{@"email" : @"dsfasfasf",
/// @"third_id" : @"sdl342034023424",
/// @"platform" : @"google",
/// @"family_name" : @"wu",
/// @"giving_name" : @"colin",
/// @"avator" : @"http://"}
/// - complateBlock:
+ (void)customer_thirdLoginWithParams:(NSDictionary *) params complateBlock:(HBResponseComplateBlock)complateBlock;
/// 退出登录
/// - Parameter complateBlock:
+ (void)customer_logoutWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 注销账户
/// - Parameter complateBlock:
+ (void)customer_signoutWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 获取用户信息
/// - Parameter complateBlock:
+ (void)customer_fetchUserInfoWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 获取用户的收藏列表
/// - Parameter complateBlock:
+ (void)customer_fetchFavoriteListWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 用户收藏短视频
/// - Parameters:
/// - vId: 短视频ID
/// - complateBlock:
+ (void)customer_favoriteWithVideoId:(NSInteger )vId complateBlock:(HBResponseComplateBlock)complateBlock;
/// 用户取消收藏短视频
/// - Parameters:
/// - vId: 短视频ID
/// - complateBlock:
+ (void)customer_unFavoriteWithVideoId:(NSInteger )vId complateBlock:(HBResponseComplateBlock)complateBlock;
@end
/// 视频相关接口
@interface HBNetWorkingUtility (videos)
/// 获取短视频分类
/// - Parameter complateBlock:
+ (void)videos_fetchCategoriesWithComplateBlock:(HBResponseComplateBlock)complateBlock;
/// 根据短视频分类id获取短视频列表
/// - Parameters:
/// - cid: 短视频id
/// - complateBlock:
+ (void)videos_fetchCategoryVideosWithId:(NSInteger)cid complateBlock:(HBResponseComplateBlock)complateBlock;
/// 获取视频详情 和剧集
/// - Parameters:
/// - vId: 短视频id
/// - complateBlock:
+ (void)videos_fetchVideoDetailsWithSid:(NSInteger)vId complateBlock:(HBResponseComplateBlock)complateBlock;
/// 上报用户单前观看记录
/// - Parameters:
/// - sId: 短视频id
/// - vId: 剧集id
/// - complateBlock:
+ (void)videos_uploadPlayHistoryWithSid:(NSInteger)sId vId:(NSInteger)vId complateBlock:(HBResponseComplateBlock)complateBlock;
/// 获取剧场排行
/// - Parameter complateBlock:
+ (void)videos_fetchVisitTopWithComplateBlock:(HBResponseComplateBlock)complateBlock;
@end
/// 推挤页接口
@interface HBNetWorkingUtility (Discover)
/// 推荐页列表
/// - Parameters:
/// - page:
/// - size:
/// - complateBlock:
+ (void)discover_fetchRecommandsWithPage:(NSInteger)page
size:(NSInteger)size
complateBlock:(HBResponseComplateBlock) complateBlock;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,226 @@
//
// HBNetWorkingUtility+Services.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/28.
//
#import "HBNetWorkingUtility+Services.h"
@implementation HBNetWorkingUtility (Commom)
+ (void)commom_deviceRegister {
if([NSUserDefaults boolForKey:HBCustomerLoginSuccessKey]) return;
NSError * error = nil;
NSString * identifierForVendor = [SAMKeychain passwordForService:[UIDevice bundleIdentifier] account:HBIdentifierForVendorKey error:&error];
if ([NSString empty:identifierForVendor] || error) {
identifierForVendor = [UIDevice identifierForVendor];
[SAMKeychain setPassword:identifierForVendor forService:[UIDevice bundleIdentifier] account:HBIdentifierForVendorKey];
}
NSDictionary * headers = @{
@"Authorization": @"",
@"device-id": identifierForVendor,
@"system-type": @"ios",
@"model":[UIDevice model],
@"system-version": [UIDevice systemVersion],
@"brand": @"ios",
@"app-version": [UIDevice appVersion]
};
[HBNetWorkingUtility requestWithHTTPMethod:HTTPMethodPost
api:@"customer/register"
headers:headers
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (result.success) {
[NSUserDefaults setObject:result.data[@"token"] forKey:HBNetWorkingTokenKey];
[NSUserDefaults setObject:result.data[@"customer_id"] forKey:HBCustomerIdKey];
} else {
}
}];
}
+ (void)commom_fetchBannersWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getBanners"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)common_searchVideosWithKey:(NSString *) key complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"videoList"
parameters:@{@"search":key}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
@end
@implementation HBNetWorkingUtility (home)
+ (void)home_fetchCategoriesWithComplateBlock:(HBResponseComplateBlock)complateBlock{
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getHomeCategories"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
@end
@implementation HBNetWorkingUtility (Customer)
+ (void)customer_thirdLoginWithParams:(NSDictionary *) params complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"customer/login"
parameters:params
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)customer_logoutWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"customer/signout"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) {
[NSUserDefaults setObject:result.data[@"token"] forKey:HBNetWorkingTokenKey];
[NSUserDefaults setObject:result.data[@"customer_id"] forKey:HBCustomerIdKey];
complateBlock(result.success,result.data,result.message);
}
}];
}
+ (void)customer_signoutWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"customer/logoff"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (result.success) [HBNetWorkingUtility commom_deviceRegister];
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)customer_fetchUserInfoWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"customer/info"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)customer_favoriteWithVideoId:(NSInteger )vId complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"collect"
parameters:@{@"short_video_id" : @(vId)}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)customer_unFavoriteWithVideoId:(NSInteger )vId complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"cancelCollect"
parameters:@{@"short_video_id" : @(vId)}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)customer_fetchFavoriteListWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"myCollections"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
@end
@implementation HBNetWorkingUtility (videos)
+ (void)videos_fetchCategoriesWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getCategories"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)videos_fetchCategoryVideosWithId:(NSInteger)cid complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"videoList"
parameters:@{@"category_id":@(cid)}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)videos_fetchVideoDetailsWithSid:(NSInteger)sId complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getVideoDetails"
parameters:@{@"short_video_id":@(sId)}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)videos_uploadPlayHistoryWithSid:(NSInteger)sId vId:(NSInteger)vId complateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodPost
api:@"createHistory"
parameters:@{@"short_video_id":@(sId),@"video_id":@(vId)}
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
+ (void)videos_fetchVisitTopWithComplateBlock:(HBResponseComplateBlock)complateBlock {
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getVisitTop"
parameters:nil
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
@end
@implementation HBNetWorkingUtility (Discover)
+ (void)discover_fetchRecommandsWithPage:(NSInteger)page
size:(NSInteger)size
complateBlock:(HBResponseComplateBlock) complateBlock {
NSDictionary * parmes = @{@"page_size":@(size),
@"current_page":@(page)};
[HBNetWorkingUtility tokenRequestWithHTTPMethod:HTTPMethodGet
api:@"getRecommands"
parameters:parmes
response:^(HBNetWorkingUtilityResult * _Nullable result) {
if (complateBlock) complateBlock(result.success,result.data,result.message);
}];
}
@end

View File

@ -0,0 +1,136 @@
//
// HBNetWorkingUtility.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/29.
//
#import <Foundation/Foundation.h>
#import "HtyoNetWorking.h"
#import "HBNetWorkingUtilityResult.h"
NS_ASSUME_NONNULL_BEGIN
typedef void(^HBResponseComplateBlock)(BOOL success, id data, NSString * message);
@interface HBNetWorkingUtility : NSObject
///// POST 请求
///// - Parameters:
///// - api: 这里不能填完整url 只需要填 接口api
///// - parameters:参数
///// - responseBlock: 请求回调
//+ (void)postRequestWithApi:(nonnull NSString *)api
// parameters:(nullable NSDictionary *)parameters
// response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// 数据请求 默认传入了 token
/// - Parameters:
/// - method: 请求方式
/// - api: 这里不能填完整url 只需要填 接口api
/// - authorization: authorization
/// - parameters: 参数
/// - responseBlock: 请求回调
+ (void)tokenRequestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// 数据请求
/// - Parameters:
/// - method: 请求方式
/// - api: 这里不能填完整url 只需要填 接口api
/// - authorization: authorization
/// - parameters: 参数
/// - responseBlock: 请求回调
+ (void)requestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// 数据请求
/// - Parameters:
/// - method: 请求方式
/// - api: 这里不能填完整url 只需要填 接口api
/// - authorization: authorization
/// - parameters: 参数
/// - responseBlock: 请求回调
+ (void)requestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
headers:(nullable NSDictionary *)headers
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// 数据请求
/// - Parameters:
/// - method: 请求方式
/// - urlString: 这里需要填写完整的url
/// - authorization: authorization
/// - parameters: 参数
/// - responseBlock: 请求回调
+ (void)requestWithHTTPMethod:(HTTPMethod)method
urlString:(nonnull NSString *) urlString
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// 数据请求
/// - Parameters:
/// - method: 请求方式
/// - urlString: 这里需要填写完整的url
/// - headers: headers
/// - parameters: 参数
/// - responseBlock: 请求回调
+ (void)requestWithHTTPMethod:(HTTPMethod)method
urlString:(nonnull NSString *)urlString
headers:(nullable NSDictionary *)headers
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// POST 上传文件请求
/// - Parameters:
/// - api: 这里不能填完整url 只需要填 接口api
/// - parameters: 参数
/// - block: 需要上传的文件 在block里 配置
/// - uploadProgress: 上传进度
/// - responseBlock: 请求回调
+ (void)postRequestWithApi:(nonnull NSString *)api
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// POST 上传文件请求
/// - Parameters:
/// - api: 这里不能填完整url 只需要填 接口api
/// - authorization: authorization
/// - parameters: 参数
/// - block: 需要上传的文件 在block里 配置
/// - uploadProgress: 上传进度
/// - responseBlock: 请求回调
+ (void)postRequestWithApi:(nonnull NSString *)api
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
/// POST 上传文件请求
/// - Parameters:
/// - urlString: 这里需要完整的url
/// - authorization: authorization
/// - parameters: 参数
/// - block: 需要上传的文件 在block里 配置
/// - uploadProgress: 上传进度
/// - responseBlock: 请求回调
+ (void)postRequestWitUrlString:(nonnull NSString *)urlString
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,253 @@
//
// HBNetWorkingUtility.m
// QinJiuTV
//
// Created by on 2024/4/29.
//
#import "HBNetWorkingUtility.h"
#import "NSString+Extension.h"
@implementation HBNetWorkingUtility
/// POST
/// - Parameters:
/// - api: url api
/// - parameters:
/// - responseBlock:
+ (void)postRequestWithApi:(nonnull NSString *)api
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock {
[self requestWithHTTPMethod:HTTPMethodPost
api:api
authorization:nil
parameters:parameters
response:responseBlock];
}
+ (void)postRequestWithApi:(nonnull NSString *)api
headers:(nullable NSDictionary *)headers
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock {
[self requestWithHTTPMethod:HTTPMethodPost
api:api
headers:headers
parameters:parameters
response:responseBlock];
}
///
/// - Parameters:
/// - method:
/// - api: url api
/// - authorization: authorization
/// - parameters:
/// - responseBlock:
+ (void)tokenRequestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
NSString * url = [NSString stringWithFormat:@"%@/%@",HBBaseUrlString,api];
NSString * token = [NSUserDefaults stringForKey:HBNetWorkingTokenKey];
BOOL flag = ![NSString empty:token];
[self requestWithHTTPMethod:method
urlString:url
authorization:flag ? token : @""
parameters:parameters
response:responseBlock];
}
///
/// - Parameters:
/// - method:
/// - api: url api
/// - authorization: authorization
/// - parameters:
/// - responseBlock:
+ (void)requestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
NSString * url = [NSString stringWithFormat:@"%@/%@",HBBaseUrlString,api];
[self requestWithHTTPMethod:method
urlString:url
authorization:authorization
parameters:parameters
response:responseBlock];
}
///
/// - Parameters:
/// - method:
/// - api: url api
/// - authorization: authorization
/// - parameters:
/// - responseBlock:
+ (void)requestWithHTTPMethod:(HTTPMethod)method
api:(nonnull NSString *)api
headers:(nullable NSDictionary *)headers
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock {
NSString * url = [NSString stringWithFormat:@"%@/%@",HBBaseUrlString,api];
[self requestWithHTTPMethod:method
urlString:url
headers:headers
parameters:parameters
response:responseBlock];
}
///
/// - Parameters:
/// - method:
/// - urlString: url
/// - authorization: authorization
/// - parameters:
/// - responseBlock:
+ (void)requestWithHTTPMethod:(HTTPMethod)method
urlString:(nonnull NSString *) urlString
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
[self requestWithHTTPMethod:method
urlString:urlString
headers:@{@"Authorization":authorization}
parameters:parameters
response:responseBlock];
}
///
/// - Parameters:
/// - method:
/// - urlString: url
/// - headers: headers
/// - parameters:
/// - responseBlock:
+ (void)requestWithHTTPMethod:(HTTPMethod)method
urlString:(nonnull NSString *)urlString
headers:(nullable NSDictionary *)headers
parameters:(nullable NSDictionary *)parameters
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock {
[HtyoNetWorking requestWithHTTPMethod:method
URLString:urlString
headers:headers
parameters:parameters
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (responseBlock) {
HBNetWorkingUtilityResult * resut = [HBNetWorkingUtilityResult successResult:task response:responseObject];
if (resut.code == 403) {
NSLog(@"newworking toke 失效!");
}
responseBlock(resut);
}
}
failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (responseBlock) {
responseBlock([HBNetWorkingUtilityResult failureResult:task error:error]);
}
}];
}
/// POST
/// - Parameters:
/// - api: url api
/// - parameters:
/// - block: block
/// - uploadProgress:
/// - responseBlock:
+ (void)postRequestWithApi:(nonnull NSString *)api
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
[self postRequestWithApi:api
authorization:nil
parameters:parameters
constructingBodyWithBlock:block
progress:uploadProgress
response:responseBlock];
}
/// POST
/// - Parameters:
/// - api: url api
/// - authorization: authorization
/// - parameters:
/// - block: block
/// - uploadProgress:
/// - responseBlock:
+ (void)postRequestWithApi:(nonnull NSString *)api
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
NSString * url = [NSString stringWithFormat:@"%@/%@",HBBaseUrlString,api];
[self postRequestWitUrlString:url
authorization:authorization
parameters:parameters
constructingBodyWithBlock:block
progress:uploadProgress
response:responseBlock];
}
/// POST
/// - Parameters:
/// - urlString: url
/// - authorization: authorization
/// - parameters:
/// - block: block
/// - uploadProgress:
/// - responseBlock:
+ (void)postRequestWitUrlString:(nonnull NSString *)urlString
authorization:(nullable NSString *)authorization
parameters:(nullable NSDictionary *)parameters
constructingBodyWithBlock:(nullable void (^)(id <AFMultipartFormData> formData))block
progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress
response:(nullable void (^)(HBNetWorkingUtilityResult * _Nullable result))responseBlock{
[HtyoNetWorking postRequestWithURLString:urlString
authorization:authorization
parameters:parameters
constructingBodyWithBlock:block
progress:uploadProgress
success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
if (responseBlock) {
responseBlock([HBNetWorkingUtilityResult successResult:task response:responseObject]);
}
} failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
if (responseBlock) {
responseBlock([HBNetWorkingUtilityResult failureResult:task error:error]);
}
}];
}
@end
/*
+ (void)saveCookieIfHave:(NSURLSessionDataTask *)task {
NSString *cookieString = [[(NSHTTPURLResponse *)task.response allHeaderFields] valueForKey:@"Set-Cookie"];
NSMutableString *finalCookie = [NSMutableString new];
NSArray *cookieStrings = [cookieString componentsSeparatedByString:@","];
for (NSString *temp in cookieStrings) {
NSArray *tempArr = [temp componentsSeparatedByString:@";"];
[finalCookie appendString:[NSString stringWithFormat:@"%@;", tempArr[0]]];
}
if (finalCookie.length > 0) {
// [DEFAULTS setObject:finalCookie forKey:RCDUserCookiesKey];
// [DEFAULTS synchronize];
[[HtyoNetWorking sharedManager].requestSerializer setValue:finalCookie forHTTPHeaderField:@"Cookie"];
}
}
*/

View File

@ -0,0 +1,29 @@
//
// HBNetWorkingUtilityResult.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/29.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 网络请求回调处理类
@interface HBNetWorkingUtilityResult : NSObject
@property (copy, nonatomic) NSString * message;
@property (assign, nonatomic) NSInteger status;
@property (assign, nonatomic) NSInteger httpCode;
@property (assign, nonatomic) NSInteger code;
@property (copy, nonatomic) NSString * url;
@property (assign, nonatomic) BOOL success;
@property (strong, nonatomic) id data;
+ (HBNetWorkingUtilityResult *)successResult:(NSURLSessionDataTask *)task response:(id)responseObject;
+ (HBNetWorkingUtilityResult *)failureResult:(NSURLSessionDataTask *)task error:(NSError *)error;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,54 @@
//
// HBNetWorkingUtilityResult.m
// QinJiuTV
//
// Created by on 2024/4/29.
//
#import "HBNetWorkingUtilityResult.h"
@interface HBNetWorkingUtilityResult()
@property (strong, nonatomic) NSDictionary * allHeaderFields;
@end
@implementation HBNetWorkingUtilityResult
///
/// - Parameters:
/// - task: task
/// - responseObject: data
+ (HBNetWorkingUtilityResult *)successResult:(NSURLSessionDataTask *)task response:(id)responseObject {
HBNetWorkingUtilityResult *result = [[HBNetWorkingUtilityResult alloc] init];
result.allHeaderFields = task.currentRequest.allHTTPHeaderFields;
result.url = task.currentRequest.URL.absoluteString;
result.httpCode = ((NSHTTPURLResponse *)task.response).statusCode;
result.data = responseObject[@"data"];
result.message = responseObject[@"msg"];
result.code = [responseObject[@"code"] intValue];
result.success = (result.code == 200);
NSLog(@"%@",result);
return result;
}
///
/// - Parameters:
/// - task: task
/// - error: error
+ (HBNetWorkingUtilityResult *)failureResult:(NSURLSessionDataTask *)task error:(NSError *)error {
HBNetWorkingUtilityResult *result = [[HBNetWorkingUtilityResult alloc] init];
result.url = task.currentRequest.URL.absoluteString;
result.success = NO;
result.httpCode = ((NSHTTPURLResponse *)task.response).statusCode;
result.message = error.description;
NSLog(@"%@",result);
return result;
}
- (NSString *)description {
return [NSString stringWithFormat:@"-url: %@,\n-headers: %@,\n-success: %d,\n-code: %ld,\n-message: %@,\n-data: %@",self.url,self.allHeaderFields,self.success, (long)self.code, self.message, self.data];
}
@end

View File

@ -0,0 +1,23 @@
//
// NSNotificationCenter+Extension.h
// HiBit
//
// Created by HI_LOSER on 2024/6/7.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface NSNotificationCenter (Extension)
+ (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject;
+ (void)postNotification:(NSNotification *)notification;
+ (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject;
+ (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject userInfo:(nullable NSDictionary *)aUserInfo;
+ (void)removeObserver:(id)observer;
+ (void)removeObserver:(id)observer name:(nullable NSNotificationName)aName object:(nullable id)anObject;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,35 @@
//
// NSNotificationCenter+Extension.m
// HiBit
//
// Created by HI_LOSER on 2024/6/7.
//
#import "NSNotificationCenter+Extension.h"
@implementation NSNotificationCenter (Extension)
+ (void)addObserver:(id)observer selector:(SEL)aSelector name:(nullable NSNotificationName)aName object:(nullable id)anObject{
[[NSNotificationCenter defaultCenter] addObserver:observer selector:aSelector name:aName object:anObject];
}
+ (void)postNotification:(NSNotification *)notification {
[[NSNotificationCenter defaultCenter] postNotification:notification];
}
+ (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject{
[[NSNotificationCenter defaultCenter] postNotificationName:aName object:anObject];
}
+ (void)postNotificationName:(NSNotificationName)aName object:(nullable id)anObject userInfo:(nullable NSDictionary *)aUserInfo{
[[NSNotificationCenter defaultCenter] postNotificationName:aName object:anObject userInfo:aUserInfo];
}
+ (void)removeObserver:(id)observer {
[[NSNotificationCenter defaultCenter] removeObserver:observer];
}
+ (void)removeObserver:(id)observer name:(nullable NSNotificationName)aName object:(nullable id)anObject {
[[NSNotificationCenter defaultCenter] removeObserver:observer name:aName object:anObject];
}
@end

View File

@ -16,6 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
+ (BOOL)boolForKey:(NSString *)key;
+ (NSArray *)arrayForKey:(NSString *)key;
+ (void)removeObjectForKey:(NSString *)defaultName;
+ (NSString *)stringForKey:(NSString *)key;

View File

@ -22,10 +22,12 @@
[[NSUserDefaults standardUserDefaults] removeObjectForKey:defaultName];
}
+ (BOOL)boolForKey:(NSString *)key {
return [[NSUserDefaults standardUserDefaults]boolForKey:key];
}
+ (NSArray *)arrayForKey:(NSString *)key {
return [[NSUserDefaults standardUserDefaults]arrayForKey:key];
}
+ (NSString *)stringForKey:(NSString *)key {
return [[NSUserDefaults standardUserDefaults]stringForKey:key];

View File

@ -0,0 +1,45 @@
//
// HBAlertView.h
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/16.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
typedef void (^ButtonBlock)(void);
@interface HBAlertView : UIView
+ (void)showMessage:(NSString *)message
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
leftBlock:(ButtonBlock)cancel
rightBlock:(ButtonBlock)confirm;
+ (void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
describeTitle:(NSString *)describeTitle
confirmTitle:(NSString *)confirmTitle
confirm:(ButtonBlock)confirm;
+ (void)showAlertWithMessage:(NSString *)Message
highlightText:(NSString *)highlightText
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
cancel:(ButtonBlock)cancel
confirm:(ButtonBlock)confirm;
+ (void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
highlightText:(NSString *)highlightText
describeTitle:(NSString *)describeTitle
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
cancel:(ButtonBlock)cancel
confirm:(ButtonBlock)confirm;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,306 @@
//
// HBAlertView.m
// QinJiuTV
//
// Created by HI_LOSER on 2024/5/16.
//
#import "HBAlertView.h"
#import <Masonry/Masonry.h>
typedef enum : NSUInteger {
ClassRoomAlertViewCancel,
ClassRoomAlertViewConfirm,
} ClassRoomAlertViewActionTag;
#define AWidth 320
#define AHeight 134
@interface HBAlertView ()
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *messageLabel;
@property (nonatomic, strong) UILabel *infoLabel;
@property (nonatomic, strong) UIButton *cancelButton;
@property (nonatomic, strong) UIButton *downgradeButton;
@property (nonatomic, strong) UIView *verticalLine;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *message;
@property (nonatomic, strong) NSString *info;
@property (nonatomic, strong) NSString *highlightText;
@property (nonatomic, strong) NSString *leftTitle;
@property (nonatomic, strong) NSString *rightTitle;
@property (nonatomic, copy) ButtonBlock cancel;
@property (nonatomic, copy) ButtonBlock confirm;
@end
@implementation HBAlertView
+ (void)showMessage:(NSString *)message
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
leftBlock:(ButtonBlock)cancel
rightBlock:(ButtonBlock)confirm {
[self showAlertWithTitle:@""
message:message
highlightText:@""
describeTitle:@""
leftTitle:leftTitle
rightTitle:rightTitle
cancel:cancel
confirm:confirm];
}
+ (void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
describeTitle:(NSString *)describeTitle
confirmTitle:(NSString *)confirmTitle
confirm:(ButtonBlock)confirm {
[self showAlertWithTitle:title
message:message
highlightText:@""
describeTitle:describeTitle
leftTitle:@""
rightTitle:confirmTitle
cancel:nil
confirm:confirm];
}
+ (void)showAlertWithMessage:(NSString *)Message
highlightText:(NSString *)highlightText
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
cancel:(ButtonBlock)cancel
confirm:(ButtonBlock)confirm {
[self showAlertWithTitle:@""
message:Message
highlightText:highlightText
describeTitle:@""
leftTitle:leftTitle
rightTitle:rightTitle
cancel:cancel
confirm:confirm];
}
+ (void)showAlertWithTitle:(NSString *)title
message:(NSString *)message
highlightText:(NSString *)highlightText
describeTitle:(NSString *)describeTitle
leftTitle:(NSString *)leftTitle
rightTitle:(NSString *)rightTitle
cancel:(ButtonBlock)cancel
confirm:(ButtonBlock)confirm {
HBAlertView *alertView = [[HBAlertView alloc] initWithFrame:[UIScreen mainScreen].bounds];
alertView.title = title;
alertView.message = message;
alertView.info = describeTitle;
alertView.highlightText = highlightText;
alertView.leftTitle = leftTitle;
alertView.rightTitle = rightTitle;
alertView.cancel = cancel;
alertView.confirm = confirm;
[alertView addSubviews];
[alertView showAlertView];
}
- (void)acs_radiusWithView:(UIView *)view radius:(CGFloat)radius corner:(UIRectCorner)corner {
if (@available(iOS 11.0, *)) {
view.layer.cornerRadius = radius;
view.layer.maskedCorners = (CACornerMask)corner;
} else {
UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:corner cornerRadii:CGSizeMake(radius, radius)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = self.bounds;
maskLayer.path = path.CGPath;
view.layer.mask = maskLayer;
}
if ([self isKindOfClass:[UIImageView class]] || [self isKindOfClass:[UIButton class]]){
self.layer.masksToBounds = YES;
}
}
- (void)showAlertView {
[[UIApplication sharedApplication].windows.firstObject addSubview:self];
}
- (void)dismissAlertView {
[self removeFromSuperview];
}
- (void)addSubviews {
CGRect rect = CGRectMake(([UIScreen mainScreen].bounds.size.width - AWidth) / 2,
([UIScreen mainScreen].bounds.size.height - AHeight) / 2, AWidth, AHeight);
UIView *contentView = [[UIView alloc] initWithFrame:rect];
contentView.backgroundColor = [UIColor colorWithRed:40.0/255 green:42.0/255.0 blue:47.0/255.0 alpha:1.0];
contentView.layer.cornerRadius = 8;
contentView.layer.masksToBounds = YES;
[self addSubview:contentView];
[contentView addSubview:self.titleLabel];
[contentView addSubview:self.messageLabel];
[contentView addSubview:self.infoLabel];
[contentView addSubview:self.cancelButton];
[contentView addSubview:self.downgradeButton];
[self acs_radiusWithView:self.cancelButton radius:6.0 corner:UIRectCornerAllCorners];
[self acs_radiusWithView:self.downgradeButton radius:6.0 corner:UIRectCornerAllCorners];
if (self.title.length > 0) {
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(contentView.mas_top).offset(15);
make.left.equalTo(contentView.mas_left).offset(13);
make.right.equalTo(contentView.mas_right).offset(-13);
make.height.offset(20);
}];
} else {
self.titleLabel.hidden = YES;
[self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.width.height.left.offset(0);
}];
}
[self.messageLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.titleLabel.mas_bottom).offset(20);
make.left.equalTo(contentView.mas_left).offset(13);
make.right.equalTo(contentView.mas_right).offset(-13);
}];
if (self.info.length > 0) {
[self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.messageLabel.mas_bottom).offset(10);
make.left.equalTo(contentView.mas_left).offset(13);
make.right.equalTo(contentView.mas_right).offset(-13);
}];
} else {
self.infoLabel.hidden = YES;
[self.infoLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.messageLabel.mas_bottom).offset(10);
make.width.height.left.offset(0);
}];
}
if (self.leftTitle.length > 0) {
[self.cancelButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(contentView).offset(40.0);
make.bottom.equalTo(contentView.mas_bottom).offset(-20.0);
make.height.equalTo(@28.0);
make.width.equalTo(@90.0);
}];
[self.downgradeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.right.equalTo(contentView).offset(-40.0);
make.bottom.equalTo(contentView.mas_bottom).offset(-20.0);
make.height.equalTo(@28.0);
make.width.equalTo(@90.0);
}];
} else {
[self.downgradeButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(contentView);
make.bottom.equalTo(contentView.mas_bottom).offset(0);
make.height.equalTo(@28.0);
make.width.equalTo(@90.0);
}];
}
[contentView updateConstraintsIfNeeded];
[contentView layoutIfNeeded];
rect.size.height = CGRectGetMaxY(self.infoLabel.frame) + 44 + 10;
rect.origin.y = ([UIScreen mainScreen].bounds.size.height - rect.size.height) / 2;
contentView.frame = rect;
}
- (void)buttonAction:(UIButton *)button {
if (button.tag == ClassRoomAlertViewCancel) {
if (self.cancel) {
self.cancel();
}
} else {
if (self.confirm) {
self.confirm();
}
}
[self dismissAlertView];
}
- (UILabel *)titleLabel {
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.font = [UIFont boldSystemFontOfSize:18];
_titleLabel.textAlignment = NSTextAlignmentCenter;
_titleLabel.text = self.title;
_titleLabel.numberOfLines = 1;
_titleLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
_titleLabel.textColor = UIColor.whiteColor;
}
return _titleLabel;
}
- (UILabel *)messageLabel {
if (!_messageLabel) {
_messageLabel = [[UILabel alloc] init];
_messageLabel.font = [UIFont systemFontOfSize:14.0 weight:UIFontWeightRegular];
_messageLabel.textAlignment = NSTextAlignmentCenter;
_messageLabel.text = self.message;
_messageLabel.numberOfLines = 0;
_messageLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
_messageLabel.textColor = UIColor.whiteColor;
if (self.highlightText.length > 0) {
NSRange range = [self.message rangeOfString:self.highlightText];
if (range.location != NSNotFound) {
NSMutableAttributedString *attributedString =
[[NSMutableAttributedString alloc] initWithString:self.message];
[attributedString addAttribute:NSForegroundColorAttributeName
value:[UIColor colorWithRed:234.0/255.0 green:51.0/255.0 blue:79.0/255.0 alpha:1.0]
range:range]; //0x3a91f3
_messageLabel.attributedText = attributedString;
}
}
}
return _messageLabel;
}
- (UILabel *)infoLabel {
if (!_infoLabel) {
_infoLabel = [[UILabel alloc] init];
_infoLabel.font = [UIFont systemFontOfSize:12.0];
_infoLabel.textAlignment = NSTextAlignmentCenter;
_infoLabel.text = self.info;
_infoLabel.numberOfLines = 0;
_infoLabel.lineBreakMode = NSLineBreakByTruncatingMiddle;
_infoLabel.textColor = UIColor.grayColor;
}
return _infoLabel;
}
- (UIButton *)cancelButton {
if (!_cancelButton) {
_cancelButton = [[UIButton alloc] init];
_cancelButton.backgroundColor = [UIColor colorWithRed:62.0/255.0 green:64.0/255.0 blue:69.0/255.0 alpha:1.0];
[_cancelButton.titleLabel setFont:[UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular]];
[_cancelButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[_cancelButton setTitle:self.leftTitle forState:UIControlStateNormal];
_cancelButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
_cancelButton.tag = ClassRoomAlertViewCancel;
[_cancelButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _cancelButton;
}
- (UIButton *)downgradeButton {
if (!_downgradeButton) {
_downgradeButton = [[UIButton alloc] init];
_downgradeButton.backgroundColor = [UIColor colorWithRed:234.0/255.0 green:51.0/255.0 blue:79.0/255.0 alpha:1.0];
[_downgradeButton.titleLabel setFont:[UIFont systemFontOfSize:12.0 weight:UIFontWeightRegular]];
[_downgradeButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
[_downgradeButton setTitle:self.rightTitle forState:UIControlStateNormal];
_downgradeButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
_downgradeButton.tag = ClassRoomAlertViewConfirm;
[_downgradeButton addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
}
return _downgradeButton;
}
@end

View File

@ -1,5 +1,5 @@
//
// QJNetWorking.h
// HBNetWorking.h
// QinJiuTV
//
// Created by 秦九 on 2024/4/29.

View File

@ -1,5 +1,5 @@
//
// QJNetWorking.m
// HBNetWorking.m
// QinJiuTV
//
// Created by on 2024/4/29.

View File

@ -0,0 +1,42 @@
//
// RSButton.h
// Serendipity
//
// Created by HI_LOSER on 2022/10/18.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
FOUNDATION_EXPORT NSString * RSButtonStringFromControlState(UIControlState status);
typedef enum : NSUInteger {
RSButtonTypeAbove = 0, // 图片在文字上面
RSButtonTypeBelow, // 图片在文字下面
RSButtonTypeLeft, // 图片在文字左面
RSButtonTypeRight, // 图片在文字右面
RSButtonTypeOnlyImage, // 只有图片
RSButtonTypeOnlyTitle, // 只有文字
} RSButtonType;
@interface RSButton : UIControl
@property (strong, nonatomic, readonly) UILabel * titleLabel;
@property (strong, nonatomic, readonly) UIImageView * imageView;
@property (strong, nonatomic, readonly) UIImageView * backgroundImageView;
@property (assign, nonatomic) UIEdgeInsets insets;
@property (assign, nonatomic) CGFloat margin;
- (instancetype)initWithType:(RSButtonType)type;
- (void)setTitle:(NSString *) title forState:(UIControlState) state;
- (void)setTitleColor:(UIColor *) color forState:(UIControlState) state;
- (void)setImage:(UIImage *) image forState:(UIControlState) state;
-(void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state;
- (void)setTitleFont:(UIFont *)titleFont;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,265 @@
//
// RSButton.m
// Serendipity
//
// Created by HI_LOSER on 2022/10/18.
//
#import "RSButton.h"
NSString * RSButtonStringFromControlState(UIControlState status) {
switch (status) {
case UIControlStateNormal:
return @"Normal";
case UIControlStateSelected:
return @"Selected";
case UIControlStateDisabled:
return @"Disabled";
case UIControlStateHighlighted:
return @"Highlighted";
case UIControlStateFocused:
return @"Focused";
case UIControlStateApplication:
return @"Application";
case UIControlStateReserved:
return @"Reserved";
default:
return @"Other";
}
}
@interface RSButton ()
@property (assign, nonatomic) RSButtonType type;
@property (strong, nonatomic) NSMutableDictionary * titleDcit;
@property (strong, nonatomic) NSMutableDictionary * titleColorDcit;
@property (strong, nonatomic) NSMutableDictionary * imageDcit;
@property (strong, nonatomic) NSMutableDictionary * backgroundImageDcit;
@end
@implementation RSButton
-(NSMutableDictionary *)titleColorDcit{
if (_titleColorDcit) return _titleColorDcit;
return _titleColorDcit = [NSMutableDictionary dictionary];
}
-(NSMutableDictionary *)backgroundImageDcit{
if (_backgroundImageDcit) return _backgroundImageDcit;
return _backgroundImageDcit = [NSMutableDictionary dictionary];
}
-(NSMutableDictionary *)imageDcit{
if (_imageDcit) return _imageDcit;
return _imageDcit = [NSMutableDictionary dictionary];
}
-(NSMutableDictionary *)titleDcit{
if (_titleDcit) return _titleDcit;
return _titleDcit = [NSMutableDictionary dictionary];
}
- (instancetype)initWithType:(RSButtonType)type {
self = [super init];
if (self) {
self.insets = UIEdgeInsetsZero;
self.type = type;
self.margin = 10;
[self loadSubViews];
}
return self;
}
- (void)loadSubViews {
UIImageView * backgroundImageView = [[UIImageView alloc]init];
[self addSubview:backgroundImageView];
_backgroundImageView = backgroundImageView;
UIImageView * imageView = [[UIImageView alloc]init];
imageView.contentMode = UIViewContentModeCenter;
[self addSubview:imageView];
_imageView = imageView;
UILabel * titleLabel = [UILabel new];
titleLabel.font = [UIFont boldSystemFontOfSize:13.0];
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.numberOfLines = 0;
[self addSubview:titleLabel];
_titleLabel = titleLabel;
}
- (void)layoutSubviews{
[super layoutSubviews];
CGFloat margin = (_imageView.image && ![self empty: _titleLabel.text]) ? self.margin : 0.0;
// [_backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) {
// make.left.top.right.bottom.equalTo(self);
// }];
if (self.type == RSButtonTypeAbove) {
[_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(self.insets.top);
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
}];
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_imageView.mas_bottom).offset(margin);
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
} else if (self.type == RSButtonTypeBelow) {
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self).offset(self.insets.top);
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
}];
[_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_titleLabel.mas_bottom).offset(margin);
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
} else if (self.type == RSButtonTypeLeft) {
[_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(self.insets.left);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_imageView.mas_right).offset(margin);
make.right.equalTo(self).offset(-self.insets.right);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
} else if (self.type == RSButtonTypeRight) {
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(self.insets.left);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
[_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_titleLabel.mas_right).offset(margin);
make.right.equalTo(self).offset(-self.insets.right);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
} else if (self.type == RSButtonTypeOnlyImage) {
[_imageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
_titleLabel.hidden = YES;
} else if (self.type == RSButtonTypeOnlyTitle) {
_imageView.hidden = YES;
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(self).offset(self.insets.left);
make.right.equalTo(self).offset(-self.insets.right);
make.top.equalTo(self).offset(self.insets.top);
make.bottom.equalTo(self).offset(self.insets.bottom);
}];
}
}
- (void)setTitleFont:(UIFont *)titleFont{
_titleLabel.font = titleFont;
}
- (void)setSelected:(BOOL)selected {
[super setSelected:selected];
[self setSubViewsValue];
}
- (void)setEnabled:(BOOL)enabled{
[super setEnabled:enabled];
[self setSubViewsValue];
}
- (void)setTitle:(NSString *) title forState:(UIControlState) state {
[self.titleDcit setObject:title forKey:RSButtonStringFromControlState(state)];
[self setSubViewsValue];
}
- (void)setTitleColor:(UIColor *) color forState:(UIControlState) state {
[self.titleColorDcit setObject:color forKey:RSButtonStringFromControlState(state)];
[self setSubViewsValue];
}
- (void)setImage:(UIImage *) image forState:(UIControlState) state {
if (image) {
[self.imageDcit setObject:image forKey:RSButtonStringFromControlState(state)];
[self setSubViewsValue];
}
}
-(void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state {
if (image) {
[self.backgroundImageDcit setObject:image forKey:RSButtonStringFromControlState(state)];
[self setSubViewsValue];
}
}
- (void)setSubViewsValue{
UIColor * textColor = self.titleColorDcit[RSButtonStringFromControlState(UIControlStateNormal)];
if (textColor) _titleLabel.textColor = textColor;
_imageView.image = self.imageDcit[RSButtonStringFromControlState(UIControlStateNormal)];
_titleLabel.text = self.titleDcit[RSButtonStringFromControlState(UIControlStateNormal)];
_backgroundImageView.image = self.backgroundImageDcit[RSButtonStringFromControlState(UIControlStateNormal)];
if (!self.enabled) {
UIImage * image = self.imageDcit[RSButtonStringFromControlState(UIControlStateDisabled)];
if (image) _imageView.image = image;
UIColor * color = self.titleColorDcit[RSButtonStringFromControlState(UIControlStateDisabled)];
if (color) _titleLabel.textColor = color;
NSString * text = self.titleDcit[RSButtonStringFromControlState(UIControlStateDisabled)];
if (![self empty:text]) _titleLabel.text = text;
UIImage * backgroundImage = self.backgroundImageDcit[RSButtonStringFromControlState(UIControlStateDisabled)];
if (backgroundImage) _backgroundImageView.image = backgroundImage;
} else if (self.selected) {
UIImage * image = self.imageDcit[RSButtonStringFromControlState(UIControlStateSelected)];
if (image) _imageView.image = image;
UIColor * color = self.titleColorDcit[RSButtonStringFromControlState(UIControlStateSelected)];
if (color) _titleLabel.textColor = color;
NSString * text = self.titleDcit[RSButtonStringFromControlState(UIControlStateSelected)];
if (![self empty:text]) _titleLabel.text = text;
UIImage * backgroundImage = self.backgroundImageDcit[RSButtonStringFromControlState(UIControlStateSelected)];
if (backgroundImage) _backgroundImageView.image = backgroundImage;
}
[self setNeedsLayout];
}
- (BOOL)empty:(NSString *)string{
if (string == nil || [string isKindOfClass:NSNull.class]) return YES;
else return string == nil || string.length == 0 || [string isEqualToString:@"<null>"];
}
@end