MOGlobal.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. //
  2. // MOGlobal.h
  3. // MiMoLive
  4. //
  5. // Created by SuperC on 2023/10/9.
  6. //
  7. #ifndef MOGlobal_h
  8. #define MOGlobal_h
  9. /**
  10. * kAPP_Environment 1为正式环境 2为测试环境
  11. */
  12. #define kAPP_Environment 2
  13. #if kAPP_Environment == 1
  14. #pragma mark - 正式环境配置
  15. #define kNetPath_Base @"https://api.mimolive.co"
  16. #define kNetPath_Web_Base @"https://h5.mimolive.vip"
  17. #define kNetPath_Share_Url_Base @"https://share.mimolive.vip"
  18. #define IMAppKey @"1149240218157628#mimolive"
  19. #define AgoraAppID @"807160febd034c4e9dab52f486b80e3f"
  20. #define AgoraCertifi @"54aadf82c4644937a4b97842c4ef975d"
  21. //声网API - ID
  22. #define AgoraAPIID @"946bed82d830407989ecd8dcddf89610"
  23. //声网API - Secret
  24. #define AgoraAPISecret @"8c6a0f9e7cd243779e216d2404ffc052"
  25. //商品默认ID
  26. #define MODefaultProductID @"com.jiehe.mimo.36"
  27. #define KBuglyKeyId @"2dfcd63fa5"
  28. //Aps 推送证书名字
  29. #define KApsName @"jiehe_prod"
  30. //Tent License Str
  31. #define TentLicense @"https://license.vod-pro.com/license/v2/1328154336_1/v_cube.license"
  32. //Tent Key Str
  33. #define TentKeyStr @"7c089614fbfaa5070a814002290d393f"
  34. //腾讯云天御验证码
  35. #define kTentCaptchaAppIdStr @"189987190"
  36. //腾讯IM APPID
  37. #define KTentIMAppID 80000289
  38. //在使用腾讯IM的情况下, 没使用KTentSDKAppKey
  39. #define KTentSDKAppKey @""
  40. #define kTentPushID 15826
  41. //云上曲率
  42. #define kYunSoundAppId @"81700198"
  43. #define kYunSoundSecretKey @"YWE5M2UyOTAtNmU2MS00N2NjLTk1MmItMGQ3YWYxZmFmZWFm"
  44. #elif kAPP_Environment == 2
  45. #pragma mark - 测试环境配置
  46. //#define kNetPath_Base @"http://8.217.173.156:8080"
  47. //#define kNetPath_Web_Base @"http://8.217.173.156:8802"
  48. //#define kNetPath_Base @"http://api.uat.mimolive.cc"
  49. //#define kNetPath_Web_Base @"http://app-h5.uat.mimolive.cc"
  50. #define kNetPath_Base @"http://api-new.mimolive.cc"
  51. #define kNetPath_Web_Base @"http://h5-new.mimolive.cc"
  52. //#define kNetPath_Web_Base @"http://test.mimolive.cc:8802"
  53. #define kNetPath_Share_Url_Base @"http://8.217.173.156:8808"
  54. //Web 测试本地包地址 - 需要时更换上面的 kNetPath_Web_Base
  55. #define kNetPath_Test_Url @"http://192.168.3.14:1838/#/"
  56. #define IMAppKey @"1148230921209149#demo"
  57. #define AgoraAppID @"d8e48cf84bf14a16830dc8ac625c0100"
  58. #define AgoraCertifi @"537a9f12cc13425eb6103947b9a5754a"
  59. //声网API - ID
  60. #define AgoraAPIID @"946bed82d830407989ecd8dcddf89610"
  61. //声网API - Secret
  62. #define AgoraAPISecret @"8c6a0f9e7cd243779e216d2404ffc052"
  63. //商品默认ID
  64. #define MODefaultProductID @"com.jiehe.mimo.debug.100"
  65. #define KBuglyKeyId @"b31a80a2a0"
  66. //Aps 推送证书名字
  67. #define KApsName @"jiehe123"
  68. //Tent License Str
  69. #define TentLicense @"https://license.vod-pro.com/license/v2/1328154336_1/v_cube.license"
  70. //Tent Key Str
  71. #define TentKeyStr @"7c089614fbfaa5070a814002290d393f"
  72. //腾讯云天御验证码
  73. #define kTentCaptchaAppIdStr @"189987190"
  74. //腾讯IM APPID
  75. #define KTentIMAppID 80000266
  76. //在使用腾讯IM的情况下, 没使用KTentSDKAppKey
  77. #define KTentSDKAppKey @"kh3k2lw25iMRKDEVYiRO1CX7DA880mYQa1bN8qDOswGlQxPyGc3POYTrPPJIKXC5"
  78. #define kTentPushID 15824
  79. //云上曲率
  80. #define kYunSoundAppId @"81700191"
  81. #define kYunSoundSecretKey @"YzQyOGU1ZGQtYWI3Mi00ZDAxLWJjNmYtNTE1YmE0ZDRkN2My"
  82. #endif
  83. //通用标题字体
  84. #define kNormalTitleFontStr @"Gilroy"
  85. //通用内容字体
  86. #define kNormalContentFontStr @"Roboto"
  87. //@"Roboto-Bold"粗体
  88. #define kNormalContentBlodFontStr @"Roboto-Bold"
  89. //类型1 标题字体
  90. #define kTypeOneTitleFontStr @"Source Sans Pro"
  91. //礼物数量 字体
  92. #define kNormalGiftNumFontStre @"ExtensionBoldItalic"
  93. //Poppins
  94. #define kPoppinsRegularFontStr @"Inter-Regular"
  95. #define kPoppinsMediumFontStr @"Inter-Regular_Medium"
  96. #define kPoppinsSemiBoldFontStr @"Inter-Regular_SemiBold"
  97. #define kPoppinsBoldFontStr @"Inter-Regular_Bold"
  98. #define kPoppinsExtraBoldFontStr @"Inter-Regular_ExtraBold"
  99. #define kPoppinsMediumItalicFontStr @"Inter-Regular_Medium-Italic"
  100. #define kPoppinsBoldItalicFontStr @"Inter-Regular_Bold-Italic"
  101. #define kPoppinsLightFontStr @"Inter-Regular_Light"
  102. //Oswald (Oswald-DemiBold)
  103. #define kOswaldFontStr @"Oswald"
  104. //当前token
  105. #define kToken @"mimotoken"
  106. #define kAvatar @"kUserAvatarUrl"
  107. #define kUserId @"kUserId"
  108. #define kUserNo @"kUserNo"
  109. #define kNickName @"kNickName"
  110. #define kUserInfo @"kUserInfo"
  111. #define kGender @"kGender"
  112. #define kImToken @"kImToken"
  113. #define kAgoraId @"kAgoraId"
  114. #define kIsMobile @"kIsMobile"
  115. #define kIsAnchor @"kIsAnchor"
  116. #define kIsHaveGuild @"kIsHaveGuild"
  117. #define kIsCreatFansClub @"kIsCreatFansClub"
  118. #define kCloseJoinFansClub @"kCloseJoinFansClub"
  119. #define kLiveDiscount @"kLiveDiscount"
  120. #define kUserVipType @"kUserVipType"
  121. #define kUserVipExpirTime @"kUserVipExpirTime"
  122. #define kUserConsumeDiamond @"kUserConsumeDiamond"
  123. #define kUserBubble @"kUserBubble"
  124. #define kUserBubbleCode @"kUserBubbleCode"
  125. #define kUserHeaddress @"kUserHeaddress"
  126. #define kUserEnterBar @"kUserEnterBar"
  127. #define kUserLevel @"kUserLevel"
  128. #define kUserHeaddressType @"kUserHeaddressType"
  129. #define kCardFrameCode @"kCardFrameCode"
  130. #define kEnterFloatingCode @"kEnterFloatingCode"
  131. #define kRewardBannerCode @"kRewardBannerCode"
  132. #define kLinkMicFrameCode @"kLinkMicFrameCode"
  133. #define kLiveBarrageCode @"kLiveBarrageCode"
  134. #define kMineUserInfo @"kMineUserInfo"
  135. #define kCountryArrInfo @"kCountryArrInfo"
  136. #define kFirstLaunchInfo @"kFirstLaunchInfo"
  137. #define kQualityNum @"kQualityNum"
  138. #define kRedSysTime @"kRedSysTime"
  139. #define kIsMultiple @"kIsMultiple"
  140. #define kAgentInviteCode @"kAgentInviteCode"
  141. #define kAgentInviteCodeKey @"inviteCode"
  142. #define kAgentJumpRoomId @"kAgentJumpRoomId"
  143. #define kAgentJumpRoomIdKey @"roomId"
  144. #define kTent_ImToken @"kTent_ImToken"
  145. #define kOnlyUseTimIM @"kOnlyUseTimIM"
  146. #define kIsMysterious @"kIsMysterious"
  147. #define kNewUserGiftPack @"kNewUserGiftPack"
  148. #define kAllowViewerLink @"kAllowViewerLink"
  149. //基础过渡色左
  150. #define kBaseColorLeft [MOTools colorWithHexString:@"#FF4DA6" alpha:1.0]
  151. //基础过渡色右
  152. #define kBaseColorRight [MOTools colorWithHexString:@"#4363FF" alpha:1.0]
  153. //按钮基础色
  154. #define kBaseBtnBgColor [MOTools colorWithHexString:@"#0BDDFC" alpha:1.0]
  155. //文字颜色
  156. #define kBaseTextColor_1 [MOTools colorWithHexString:@"#17171A" alpha:1.0]
  157. #define kBaseTextColor_2 [MOTools colorWithHexString:@"#5C5E66" alpha:1.0]
  158. #define kBaseTextColor_3 [MOTools colorWithHexString:@"#878A99" alpha:1.0]
  159. #define kBaseTextColor_4 [MOTools colorWithHexString:@"#DADCE6" alpha:1.0]
  160. #define kBaseTextColor_5 [MOTools colorWithHexString:@"#F3F4FA" alpha:1.0]
  161. #define kBaseTextColor_6 [MOTools colorWithHexString:@"#FFFFFF" alpha:1.0]
  162. //公屏高亮
  163. #define kBaseTextHightlightColor_1 [MOTools colorWithHexString:@"#19FFB2" alpha:1.0]
  164. #define GetToken [[NSUserDefaults standardUserDefaults] objectForKey:kToken]
  165. #define GetImToken [[NSUserDefaults standardUserDefaults] objectForKey:kImToken]
  166. #define GetAvatar [[NSUserDefaults standardUserDefaults] objectForKey:kAvatar]
  167. #define GetUserId [[NSUserDefaults standardUserDefaults] objectForKey:kUserId]
  168. #define GetUserNo [[NSUserDefaults standardUserDefaults] objectForKey:kUserNo]
  169. #define GetNickName [[NSUserDefaults standardUserDefaults] objectForKey:kNickName]
  170. #define GetUserInfo [[MODataCache sharedYYCache] objectForKey:kUserInfo]
  171. #define GetGender [[[NSUserDefaults standardUserDefaults] objectForKey:kGender] integerValue]
  172. #define GetAgoraId [[[NSUserDefaults standardUserDefaults] objectForKey:kAgoraId] integerValue]
  173. #define GetIsHaveMobile [[NSUserDefaults standardUserDefaults] boolForKey:kIsMobile];
  174. #define GetIsAnchor [[NSUserDefaults standardUserDefaults] boolForKey:kIsAnchor];
  175. #define GetIsHaveGuild [[NSUserDefaults standardUserDefaults] boolForKey:kIsHaveGuild];
  176. #define GetIsCreatFansClub [[NSUserDefaults standardUserDefaults] boolForKey:kIsCreatFansClub];
  177. #define GetCloseJoinFansClub [[NSUserDefaults standardUserDefaults] boolForKey:kCloseJoinFansClub];
  178. #define GetLiveDiscount [[NSUserDefaults standardUserDefaults] boolForKey:kLiveDiscount];
  179. #define GetAPPVersion [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
  180. #define GetUserVipType [[[NSUserDefaults standardUserDefaults] objectForKey:kUserVipType] integerValue]
  181. #define GetUserVipExpirTime [[[NSUserDefaults standardUserDefaults] objectForKey:kUserVipExpirTime] integerValue]
  182. #define GetUserConsumeDiamond [[[NSUserDefaults standardUserDefaults] objectForKey:kUserConsumeDiamond] integerValue]
  183. #define GetUserBubble [[NSUserDefaults standardUserDefaults] objectForKey:kUserBubble]
  184. #define GetUserBubbleCode [[[NSUserDefaults standardUserDefaults] objectForKey:kUserBubbleCode] integerValue]
  185. #define GetUserHeaddress [[NSUserDefaults standardUserDefaults] objectForKey:kUserHeaddress]
  186. #define GetUserEnterBar [[[NSUserDefaults standardUserDefaults] objectForKey:kUserEnterBar] integerValue]
  187. #define GetUserLevel [[[NSUserDefaults standardUserDefaults] objectForKey:kUserLevel] integerValue]
  188. #define GetRedSysTime [[[NSUserDefaults standardUserDefaults] objectForKey:kRedSysTime] longLongValue]
  189. #define GetIsMultiple [[NSUserDefaults standardUserDefaults] boolForKey:kIsMultiple];
  190. #define GetUserHeaddressType [[[NSUserDefaults standardUserDefaults] objectForKey:kUserHeaddressType] integerValue]
  191. #define GetTentImToken [[NSUserDefaults standardUserDefaults] objectForKey:kTent_ImToken]
  192. #define GetOnlyUserTimBool [[NSUserDefaults standardUserDefaults] boolForKey:kOnlyUseTimIM]
  193. #define GetIsMysterious [[NSUserDefaults standardUserDefaults] boolForKey:kIsMysterious];
  194. #define GetUserCardFrameCode [[[NSUserDefaults standardUserDefaults] objectForKey:kCardFrameCode] integerValue]
  195. #define GetUserEnterFloatingCode [[[NSUserDefaults standardUserDefaults] objectForKey:kEnterFloatingCode] integerValue]
  196. #define GetUserRewardBannerCode [[[NSUserDefaults standardUserDefaults] objectForKey:kRewardBannerCode] integerValue]
  197. #define GetUserLinkMicFrameCode [[[NSUserDefaults standardUserDefaults] objectForKey:kLinkMicFrameCode] integerValue]
  198. #define GetUserLiveBarrageCode [[[NSUserDefaults standardUserDefaults] objectForKey:kLiveBarrageCode] integerValue]
  199. #define GetIsTest [[NSUserDefaults standardUserDefaults] boolForKey:@"k_MiMo_Test"];
  200. #define kUserGiftSelectTypeNum @"kUserGiftSelectTypeNum"
  201. #define kKeyWindow [UIApplication sharedApplication].keyWindow
  202. #define KIsiPhoneX ((SCREENHEIGHT >= 812)?YES:NO)
  203. //大小
  204. #define SCREENHEIGHT [[UIScreen mainScreen] bounds].size.height
  205. #define SCREENWIDTH [[UIScreen mainScreen] bounds].size.width
  206. //相对宽度
  207. #define kScaleWidth(width) (width / 375.0) * SCREENWIDTH
  208. #define HOME_KEY_HEIGHT (KIsiPhoneX?34:0)//iphoneX的home键高度
  209. #define STATUS_BAR_HEIGHT ([UIApplication sharedApplication].statusBarFrame.size.height)
  210. #define NAV_BAR_HEIGHT (44+STATUS_BAR_HEIGHT)
  211. // 顶部安全区域
  212. #define kTopSafeAreaInset ({ \
  213. CGFloat topInset = 0; \
  214. if (@available(iOS 11.0, *)) { \
  215. UIWindow *window = [UIApplication sharedApplication].windows.firstObject; \
  216. topInset = window.safeAreaInsets.top; \
  217. } else { \
  218. topInset = [UIApplication sharedApplication].statusBarFrame.size.height; \
  219. } \
  220. topInset; \
  221. })
  222. // 底部安全区域
  223. #define kBottomSafeAreaInset ({ \
  224. CGFloat bottomInset = 0; \
  225. if (@available(iOS 11.0, *)) { \
  226. UIWindow *window = [UIApplication sharedApplication].windows.firstObject; \
  227. bottomInset = window.safeAreaInsets.bottom; \
  228. } \
  229. bottomInset; \
  230. })
  231. #define RGBACOLOR(r,g,b,a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)]
  232. #define UIColorFromHex(HexValue) [UIColor colorWithRed:((float)((HexValue & 0xFF0000) >> 16))/255.0 green:((float)((HexValue & 0xFF00) >> 8))/255.0 blue:((float)(HexValue & 0xFF))/255.0 alpha:1.0]
  233. #pragma mark - block相关
  234. #define WEAKSELF typeof(self) __weak weakSelf = self;
  235. #define kTimeBlock(block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 1.5 * NSEC_PER_SEC), dispatch_get_main_queue(), block)
  236. #define kAfterTimeBlock(block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.4 * NSEC_PER_SEC), dispatch_get_main_queue(), block)
  237. #define kSomeTimeBlock(number,block) dispatch_after(dispatch_time(DISPATCH_TIME_NOW, number * NSEC_PER_SEC), dispatch_get_main_queue(), block)
  238. #define kMainThreadBlock(block) dispatch_async(dispatch_get_main_queue(), block);
  239. #define kCode_Success \
  240. (data != nil && ([data[@"code"]integerValue] == 0 || [data[@"code"]integerValue] == 200))\
  241. #define kShowNetError(data) \
  242. NSString *errorString = [MODataManager objectOrNilForKey:@"msg" fromDictionary:data];\
  243. if(errorString.length > 0){\
  244. [MBProgressHUD showTipMessageInWindow:errorString];\
  245. }\
  246. else{\
  247. [MBProgressHUD showTipMessageInWindow:NSLocalString(@"mimo_common_data_error")];\
  248. }\
  249. #pragma mark - NSNotification
  250. #define ReceiveNotification(methodAction,string)\
  251. [[NSNotificationCenter defaultCenter] addObserver:self selector:(methodAction) name:string object:nil];\
  252. #define SendNotification(string)\
  253. [[NSNotificationCenter defaultCenter] postNotificationName:string object:nil];\
  254. #pragma mark - NSNotification + obj
  255. #define SendObjNotification(string,data)\
  256. [[NSNotificationCenter defaultCenter] postNotificationName:string object:data];\
  257. #define NSLocalString(a) (NSLocalizedString(a, nil))
  258. //返回一个保证大于零的值
  259. #define GetParamNotZero(param) ((param != 0) ? param : 1)
  260. #define MOCurrentProductKey @"MOCurrentProductKey"
  261. #define MOCurrentIAProductID [[NSUserDefaults standardUserDefaults] objectForKey:MOCurrentProductKey]
  262. #define VipTimeColor_1 [MOTools colorWithHexString:@"#FFEA5A" alpha:1.0]
  263. #define VipTimeColor_2 [MOTools colorWithHexString:@"#FF3F31" alpha:1.0]
  264. #define VipTimeColor_3 [MOTools colorWithHexString:@"#FC58FF" alpha:1.0]
  265. #define VipTimeColor_4 [MOTools colorWithHexString:@"#4ADFFD" alpha:1.0]
  266. #define VipNameColor_White_4 [MOTools colorWithHexString:@"#282828" alpha:1.0]
  267. #define VipNameColor_4 [MOTools colorWithHexString:@"#BDCED7" alpha:1.0]
  268. #define VipNameColorArr_3 @[[MOTools colorWithHexString:@"#FC94FF" alpha:1.0],[MOTools colorWithHexString:@"#6EB6FF" alpha:1.0]]
  269. #define VipNameColorArr_black_2 @[[MOTools colorWithHexString:@"#FF3AEA" alpha:1.0],[MOTools colorWithHexString:@"#FF3F31" alpha:1.0],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.8]]
  270. #define VipNameColorArr_black_1 @[[MOTools colorWithHexString:@"#FFB515" alpha:1.0],[MOTools colorWithHexString:@"#F7FF11" alpha:1.0],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.8]]
  271. #define VipNameColorArr_white_2 @[[MOTools colorWithHexString:@"#FF3AEA" alpha:1.0],[MOTools colorWithHexString:@"#FF3F31" alpha:1.0],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.8]]
  272. #define VipNameColorArr_white_1 @[[MOTools colorWithHexString:@"#FFB515" alpha:1.0],[MOTools colorWithHexString:@"#F7FF11" alpha:1.0],[MOTools colorWithHexString:@"#FFFFFF" alpha:0.8]]
  273. #endif /* MOGlobal_h */