Files
mier_ios/SweetParty/宏定义/Global.h

436 lines
16 KiB
C
Raw Normal View History

2025-08-11 10:43:19 +08:00
//
// Global.h
// SamaVoice
//
// Created by 申中迪 on 2022/5/7.
//
#import <Masonry.h>
#import <UIImageView+WebCache.h>
#import <SVProgressHUD.h>
#import <MJRefresh.h>
#import <MJExtension.h>
#import <AssetsLibrary/AssetsLibrary.h>
#import <AVFoundation/AVFoundation.h>
#import <CRBoxInputCellProperty.h>
#import <CRLineView.h>
#import <CRBoxInputView.h>
#import <SVGA.h>
#import "SVGAParser+AOESVGAMemory.h"
//#import <RongIMKit/RongIMKit.h>
#import "SPAlertController.h"
#import "UIViewController+AlertViewAndActionSheet.h"
#import "UIView+TapBlock.h"
#import "ViewFrameGeometry.h"
#import "BaseUIStyle.h"
#import "ControlCreator.h"
#import "AppDelegate.h"
#import "NSString+String.h"
#import "NSString+Mobile.h"
#import "ZJUIUtil.h"
#import "UIImage+Additions.h"
#import "JXCategoryView.h"
#import "HttpTool.h"
#import "BJHttpTool.h"
#import "BJUserManager.h"
#import "MLRoomInformationModel.h"
#import "YYText.h"
#import "NODataView.h"
#import "UIView+Frame.h"
#import "UIImage+ImgSize.h"
#import <TZImagePickerController.h>
#import "HGDeviceHelper.h"
#import "UIButton+Gradient.h"
#import "UIButton+Block.h"
#import "GradientLabel.h"
#import "JianBianButton.h"
#import "MBManager.h"
#import <MBProgressHUD.h>
#import "MBProgressHUD+SUP.h"
#import <SDAutoLayout/SDAutoLayout.h>
//返回渐变图片
#import "WHGradientHelper.h"
#import "UIScrollView+MJRefreshEX.h"
#import "UIViewController+CurViewController.h"
#import "SPHomepageVC.h"
#import "HelpPageDefine.h"
#import "AFNetworkRequset.h"
#import "SPLoginVC.h"
#define kAccountFileName @"kAccountFileName"
#define kPersonId @"user_id"
#define AESKey @""
//---------------ybb添加-----------------------
#pragma mark - ybb添加
#define APPH [UIScreen mainScreen].bounds.size.height
#define APPW [UIScreen mainScreen].bounds.size.width
#define yb_iPhoneX \
({BOOL isPhoneX = NO;\
if (@available(iOS 11.0, *)) {\
isPhoneX = [[UIApplication sharedApplication] delegate].window.safeAreaInsets.bottom > 0.0;\
}\
(isPhoneX);})
// 状态栏高度
#define yb_StatusBar_H (yb_iPhoneX ? 44.f : 20.0f)
// 导航栏高度
#define yb_NavigationBar_H (yb_iPhoneX ? 88.f : 64.f)
// tabBar高度
#define yb_TabBar_H (yb_iPhoneX ? (83.f) : 49.f)
// 键盘高度
#define yb_KEYBORD_H (yb_iPhoneX ? 291.f : 226.f)
// 底部高度
#define yb_HomeIndicator_H (yb_iPhoneX ? 34.f : 0.f)
//#define GVUSER [GVUserDefaults standardUserDefaults]
#define TheDelegate ((AppDelegate *)[[UIApplication sharedApplication] delegate])
//白底黑字
#define LightContentStatusBar if (@available(iOS 13.0, *)) {[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent;} else {}
//黑底白字
#define BlackContentStatusBar if (@available(iOS 13.0, *)) {[UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDarkContent;} else {}
#define C_string(s) (s==nil? @"" : s)
#define URL(URL) [NSURL URLWithString:URL]
#define GVUSER [GVUserDefaults standardUserDefaults]
#define LoadNib(name) [[NSBundle mainBundle] loadNibNamed:(name) owner:nil options:nil].firstObject
#define yb_place_img [UIImage imageNamed:@"place_fang"]
#define KEYWINDOW [UIApplication sharedApplication].keyWindow
//单例的声明和实现
// @interface
#define singleton_interface(className) \
+ (className *)shared##className;
// @implementation
#define singleton_implementation(className) \
static className *_instance; \
+ (id)allocWithZone:(NSZone *)zone \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [super allocWithZone:zone]; \
}); \
return _instance; \
} \
+ (className *)shared##className \
{ \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
_instance = [[self alloc] init]; \
}); \
return _instance; \
}
#define RCMicMainThread(block) \
if ([NSThread isMainThread]) { \
block(); \
} else { \
dispatch_async(dispatch_get_main_queue(), block);\
}
#import "RCMicHTTP.h"
#import "NSDictionary+SafeObject.h"
#import "UIView+YBUtil.h"
#import "UIView+EasyTouch.h"
#import "UIViewController+BMNavigationView.h"
#import "UIViewController+PushUtils.h"
#import "UIColor+Category.h"
#import "GVUserDefaults+APP.h"
#import "UIImage+UploadImage.h"
#import "BJPassData.h"
#import "FZYControl.h"
#import "BJSvgaManager.h"
#import "XiamuFooter.h"
#import "XiamuTipView.h"
#import "NSString+BMUtils.h"
#import "XYUUID.h"
#import "NSString+Time.h"
#import <AFNetworking/AFHTTPSessionManager.h>
#import "TXSingleChatVC.h"
#import "RCMicMacro.h"
#import "BJEncryptionTool.h"
#import "BJPicCodeView.h"
#import "NSString+category.h"
//----------------ybb 添加结束-------------
//#define VERSION_HTTPS_SERVER @""//正式
//#define kAppAgoraKitId @""
//#define NIAPPKey @""
#if DEBUG
//#define VERSION_HTTPS_SERVER @"http://xmrc.qixing2.top/"//线上
#define VERSION_HTTPS_SERVER @"http://mr.qixing2.top:621/"//线上
#else
#define VERSION_HTTPS_SERVER @"http://mr.qixing2.top:621/"//线上
#endif
//#define VERSION_HTTPS_SERVER @"http://ceshi.limaoyuyin.cn/"//测试环境
#define Baidu_AK @"KDQ1Zt4Y5odLMiKwhifwxfgdMSBl73NI"
#define SHANYAN_APP_ID @"uLYVG0AA"
#define MOB_Universal_Link @"https://d47789d5b9f1a7466005190c9c76c1b4.share2dlink.com/"
#define WX_APP_ID @"wx7b5c4e89e726a72c"
#define WX_APP_KEY @"afc9860f4c670ac19f9efb0ab94927a3"
#define QQ_APP_ID @"102046191"
#define QQ_APP_KEY @"dT8ZbR4TfdOuBF4e"
//手机号历史记录
#define Login_Phone_History @"Login_Phone_History"
//正常ID图标
#define userID_simgple ImageNamed(@"ID_normal")
//靓号ID图标
#define userID_liang ImageNamed(@"ID_liang")
//app名字
#define app_name @"八角k歌"
//普通宝箱名字
#define kBoxName_putong @"魔幻球"
//高级宝箱名字
#define kBoxName_gaoji @"永恒球"
//通过接口获取宝箱价格
#define jindan_price [[NSUserDefaults standardUserDefaults] objectForKey:@"jindan_price"]
#define zuandan_price [[NSUserDefaults standardUserDefaults] objectForKey:@"zuandan_price"]
//极光相关4
#define JMSSAGE_APPKEY @"97d7e7a07dcd781496d92f5e"
#define kDBMigrateStartNotification @"DBMigrateStartNotification"
#define kDBMigrateFinishNotification @"DBMigrateFinishNotification"
#define kFriendInvitationNotification @"friendInvitationNotification"
#define kJoinGroupApplicationListDetaultKey @"kJoinGroupApplicationListDetaultKey"
#define kJoinGroupApplicationNotification @"kJoinGroupApplicationNotification"
#define CHANNEL @""
#define kOpenBoxWithLoacalNotification @"kOpenBoxWithLoacalNotification"
#ifndef Global_h
#define Global_h
#ifdef DEBUG //处于开发阶段
#define MYLog(...) printf("[%s] %s [第%d行]: %s\n", __TIME__ ,__PRETTY_FUNCTION__ ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#else//处于发布阶段
#define MYLog(...) printf("[%s] %s [第%d行]: %s\n", __TIME__ ,__PRETTY_FUNCTION__ ,__LINE__, [[NSString stringWithFormat:__VA_ARGS__] UTF8String])
#define MYLog(...)
#endif
#define kTagForItemButton 1000
#define VERSION_HTTPS_SERVER_PATH(PATH) [NSString stringWithFormat:@"%@/%@",VERSION_HTTPS_SERVER,PATH]
// applegate
#define APPDELEGATE (AppDelegate *)[UIApplication sharedApplication].delegate
#define ScreenViewWidth [UIScreen mainScreen].bounds.size.width
#define ScreenViewHeight [UIScreen mainScreen].bounds.size.height
#define WEAK_SELF __weak typeof(self) weakSelf=self ;
#define NSStringFormat(format,...) [NSString stringWithFormat:format,##__VA_ARGS__]
// 是否是iPhonePorXM
#define IsIphoneP ((ScreenViewWidth==414)?YES:NO)
#define iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
// 判断是否是iPhone XR
#define iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
// 判断是否是iPhone XS
#define iPhoneXS ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
// 判断是否是iPhone X Max
#define iPhoneXMax ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)
// 状态栏的高
#define ZJStatusBarH (yb_iPhoneX ? 44.f : 20.0f)
// 导航栏的高
#define ZJTopNavH (ZJStatusBarH+44)
// 底部导航TabBar的高
#define TabBar_H (yb_iPhoneX ? (49+34) : 49)
//底部危险区域高度
#define DBottomDangerArea (yb_iPhoneX ? 34 : 0)
#define HOME_INDICATOR_HEIGHT (yb_iPhoneX ? 34.f : 0.f)
// 颜色R,G,B
#define Color(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
// 背景颜色
#define mainBgColor [UIColor colorWithRed:230/255.0 green:230/255.0 blue:230/255.0 alpha:1.0]
// 主颜色
#define mainColor [UIColor whiteColor]
// 副颜色
#define mainViceColor MHColorFromHexString(@"#333333")
//浅灰色
#define mainQianColor MHColorFromHexString(@"#999999")
#define mainShenColor MHColorFromHexString(@"#666666")
//按钮文字主题颜色
//深色
#define mainDeepColor MHColorFromHexString(@"#0DFFB9")
//浅色
#define mainLightColor MHColorFromHexString(@"#9FF6DD")
// 随机颜色
#define RandomColor [UIColor colorWithRed:arc4random_uniform(256)/255.0 green:arc4random_uniform(256)/255.0 blue:arc4random_uniform(256)/255.0 alpha:1.0]
/// 根据hex 获取颜色
#define MHColorFromHexString(__hexString__) ([ZJUIUtil colorWithHexString:__hexString__])
#define MLControlsColor MHColorFromHexString(@"#8C8CFF")
#define MLControlsHuiColor MHColorFromHexString(@"#EEEEEE")
#define MLControlsBaiColor MHColorFromHexString(@"#FFFFFF")
//适配黑色模式
#define ML_DarkColor MHColorFromHexString(@"#FFFFFF")
#define PFR @"Helvetica"
#define Font(x) [UIFont fontWithName:PFR size:x]
#define FontA @"PingFang-SC-Heavy"
#define FontB @"DINOT-CondMedium"
#define Font1(x) [UIFont fontWithName:FontA size:x]
#define Font2(x) [UIFont fontWithName:FontB size:x]
// 设备名称
#define PERIPHERAL_DEVICE_NAME @"未填写"
//默认头像
#define kDefaultUserIcon ImageNamed(@"default_userIcon")
//返回值格式化
#define minStr(str) [NSString stringWithFormat:@"%@",str]
//导航栏白色
#define kStatubar_whiteColor [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleLightContent
#define kStatubar_defaultColor [UIApplication sharedApplication].statusBarStyle = UIStatusBarStyleDefault
/**
*
*
* @param str_Name
*
* @return UIImage对象
*/
#define ImageNamed(str_Name) [UIImage imageNamed:str_Name]
/**
* UIButton起始Tag 19911022
*/
#define BUTTON_TAG(tag) (19911022+tag)
/**
* UILabel起始Tag 19981022
*/
#define LABEL_TAG(tag) (19981022+tag)
/**
* UIImageView起始Tag 19991022
*/
#define IMAGEVIEW_TAG(tag) (19991022+tag)
#define ScreenWidth ([UIScreen mainScreen].bounds.size.width)
#define ScreenHeight ([UIScreen mainScreen].bounds.size.height)
// 十六进制色值 01_06
#define HEXCOLORA(rgbValue,a) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a]
// 通过十六进制获取色值
#define COLOR16(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
/*================================COLOR/FONT===============================*/
#pragma mark - color
/**
*
*
* @param rgbValue
*
* @return UIColor颜色
*/
#define COLOR_HEX_RGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define COLOR(r,g,b,a) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:a]
#define kBlackColor [UIColor blackColor]
#define kDarkGrayColor [UIColor darkGrayColor]
#define kLightGrayColor [UIColor lightGrayColor]
#define kWhiteColor [UIColor whiteColor]
#define kGrayColor [UIColor grayColor]
#define kRedColor [UIColor redColor]
#define kGreenColor [UIColor greenColor]
#define kBlueColor [UIColor blueColor]
#define kCyanColor [UIColor cyanColor]
#define kYellowColor [UIColor yellowColor]
#define kMagentaColor [UIColor magentaColor]
#define kOrangeColor [UIColor orangeColor]
#define kPurpleColor [UIColor purpleColor]
#define kClearColor [UIColor clearColor]
//文字按钮主题色
#define text_MainColor MHColorFromHexString(@"#FF8EB2")
#define COLOR_F42415 COLOR_HEX_RGB(0xF42415) // C1 重要色:用于特别需要强调和突出的文字、按钮和 icon,如页面状态栏与界面相关按钮、icon、提示等
#define COLOR_333333 COLOR_HEX_RGB(0x333333) // C2 重要色:用于重要及文字信息、内容标题信息
#define COLOR_477aac COLOR_HEX_RGB(0x477aac) // C8 重要色:小面积使用,用于重要链接文字颜色
#define COLOR_999999 COLOR_HEX_RGB(0x999999) // C3 一般色:用于辅助、次要的文字信息
#define COLOR_f5f5f5 COLOR_HEX_RGB(0xf5f5f5) // C6 较弱色:用于内容区域底色
#define COLOR_e5e5e5 COLOR_HEX_RGB(0xe5e5e5) // C5 较弱色:用于分割线
#define COLOR_cccccc COLOR_HEX_RGB(0xcccccc) // C7 较弱色:用于特殊说明字体及提示字体
#define COLOR_666666 COLOR_HEX_RGB(0x666666) // C4 较弱色:
#define COLOR_2A9F5D COLOR_HEX_RGB(0x2A9F5D) // C4 绿帽子的颜色
#define COLOR_696969 COLOR_HEX_RGB(0x696969) // C4 较弱色:
#define COLOR_477AAC COLOR_HEX_RGB(0x477AAC) // C4 较弱色:
#define COLOR_FF3F24 COLOR_HEX_RGB(0xFF3F24) // C4 红色偏橘色:
#define FONT_18 [UIFont systemFontOfSize:18.f] // T1 用在导航栏标题
#define FONT_16 [UIFont systemFontOfSize:16.f] // T2 用于筛选标题或戏曲标题
#define FONT_15 [UIFont systemFontOfSize:15.f]
#define FONT_14 [UIFont systemFontOfSize:14.f] // T3 用于小标题
#define FONT_13 [UIFont systemFontOfSize:13.f] // T4 用于辅助性文字(如唱过人数、歌曲大小、时间等)
#define FONT_12 [UIFont systemFontOfSize:12.f]
#define FONT_11 [UIFont systemFontOfSize:11.f] //
#define FONT_10 [UIFont systemFontOfSize:10.f] // T5 用于辅助性文字(如底部导航栏字体大小或需要特殊说明地方)
#define FONT_24 [UIFont systemFontOfSize:(24.f)] // 分数
#define FONT_22 [UIFont systemFontOfSize:(22.f)] // 用于商品价格
#define FONT_20 [UIFont systemFontOfSize:(20.f)] // 用于商品详情原价格
#define FONT_Medium_20 [UIFont fontWithName:@"PingFangSC-Medium" size:RationEnlarge(20.f)] //Medium_20加粗
#define FONT_Medium_18 [UIFont fontWithName:@"PingFangSC-Medium" size:RationEnlarge(18.f)] //Medium_18加粗
#define FONT_Medium_16 [UIFont fontWithName:@"PingFangSC-Medium" size:RationEnlarge(16.f)] //Medium_16加粗
#define FONT_Medium_15 [UIFont fontWithName:@"PingFangSC-Medium" size:RationEnlarge(15.f)] //Medium_15加粗
#define FONT_Medium_14 [UIFont fontWithName:@"PingFangSC-Medium" size:RationEnlarge(14.f)] //Medium_14加粗
#define HEXCOLOR(rgbValue) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:1.0]
#define HEXCOLORA(rgbValue,a) \
[UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16)) / 255.0 \
green:((float)((rgbValue & 0xFF00) >> 8)) / 255.0 \
blue:((float)(rgbValue & 0xFF)) / 255.0 alpha:a]
// 屏幕大小、宽、高
#ifndef SCREEN_BOUNDS
#define SCREEN_BOUNDS [UIScreen mainScreen].bounds
#endif
#ifndef SCREEN_WIDTH
#define SCREEN_WIDTH [UIScreen mainScreen].bounds.size.width
#endif
#ifndef SCREEN_HEIGHT
#define SCREEN_HEIGHT [UIScreen mainScreen].bounds.size.height
#endif
#endif /* Global_h */