Files
GiGaMaskTime/GIGA/Config/GIGA.h
T
2018-09-06 21:19:50 +08:00

108 lines
4.5 KiB
C

//
// GIGA.h
// GIGA
//
// Created by lianxiang on 2018/8/13.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#ifndef GIGA_h
#define GIGA_h
#define UD_STADARDUD [NSUserDefaults standardUserDefaults]
#define UD_REMOVE_KEY(__KEY__) \
[[NSUserDefaults standardUserDefaults] removeObjectForKey:__KEY__]; \
UD_SYNC
#define UD_GET_VALUE(__KEY__) [[NSUserDefaults standardUserDefaults] valueForKey:__KEY__];
#define UD_SET_KEY_VALUE(__KEY__, __VALUE__) \
[[NSUserDefaults standardUserDefaults] setValue:(__VALUE__) forKey:(__KEY__)]; \
UD_SYNC
#define UD_SYNC [[NSUserDefaults standardUserDefaults] synchronize];
// MARK: NotificationCenter - Add
#define NC_ADD_TARGET_NAME_OBJECT(__target__, __sel__, __name__, __object__) [[NSNotificationCenter defaultCenter] addObserver:(__target__) selector:(__sel__) name:(__name__) object:(__object__)];
#define NC_POST_NAME_OBJECT(__name__,__object__) [[NSNotificationCenter defaultCenter] postNotificationName:(__name__) object:(__object__)];
#define NC_REMOVE_NAME(__target__,__name__,__object__) [[NSNotificationCenter defaultCenter] removeObserver:(__target__) name:(__name__) object:(__object__)];
// MAKR: Noti Names
#define USER_GUARD_DISSMISS @"userGaurdDissmiss"
#define APP_GUARD_DISSMISS @"APPGaurdDissmiss"
//adView
#define APP_PUSHTO_DETAILVIEW @"appPushToDetailAdView"
//面膜时间结束
#define kLOCALNotifiID_MASKETIMEEND @"GIGALocalNotificationMaskTimeEnd"
#define kUserNoti_MASKEND @"maskTimeEnd"
//app 挂起
#define kLOCALNotifiID_APPTERMINAL @"GIGALocalNotificationAppTerminal"
//注册成功
#define kUserRegistSucccess @"userRegistSuccess"
//微信登陆授权成功
#define kWeiXinAuthrization_Success @"WXAuthSuccess"
#define WXin_APPID @"wx1fa33defa5cbc8dd"
#define WXin_APPSecret @"3c03917b01f74a7f2d8a9bdd64f40697"
#define GIGARGB(R,G,B,A) [UIColor colorWithRed:R/255.0f green:G/255.0f blue:B/255.0f alpha:A]
#define GIGAUIColorFromRGB_A(rgbValue,alphaValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:alphaValue]
#define GIGAUIColorFromRGBA(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF000000) >> 24))/255.0 \
green:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
blue:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
alpha:((float)(rgbValue & 0xFF))/255.0]
#define GIGA_MAIN_BGCOLOR [UIColor colorWithRed:131/255.0f green:10/255.0f blue:10/255.0f alpha:1]
#define SCREEN [UIScreen mainScreen]
#define WIDTH self.view.frame.size.width
#define HEIGHT self.view.frame.size.height
#define KMainW [UIScreen mainScreen].bounds.size.width
#define KMainH [UIScreen mainScreen].bounds.size.height
#define ISIOS8 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0 ? YES : NO)
#define ISIOS9 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 9.0 ? YES : NO)
#define ISIOS10 ([[[UIDevice currentDevice] systemVersion] floatValue] >= 10.0 ? YES : NO)
#define weakify(var) __weak typeof(var) weakSelf = var
#define strongify(var) __strong typeof(var) strongSelf = var
#define textFontWeightSize(X,W) [UIFont systemFontOfSize:X *([UIScreen mainScreen].bounds.size.width / 320.0) weight:W]
#define GIGA_ShowToast(__toast__) [self.view makeToast:(__toast__) duration:1.5 position:CSToastPositionCenter];
#define GIGA_WIndowTost(__toast__) [[UIApplication sharedApplication].keyWindow makeToast:(__toast__) duration:1.5 position:CSToastPositionCenter];
//X
//底部工具栏需要为home indicator留出34pt边距
#define PhoneX_BottomMargin ([UIScreen mainScreen].bounds.size.height == 812.0 ? 34.0 :0.0)
//状态栏高度由20pt变成44pt,导航栏以上变化64->88。
#define PhoneX_TopMargin ([UIScreen mainScreen].bounds.size.height == 812.0 ? 24.0 :0.0)
#define PhoneX_STATUBAR_H ([UIScreen mainScreen].bounds.size.height == 812.0 ? 44.0 :20.0)
#define GIGA_FONTNAME @"PingFangSC-Medium"
#define GIGA_FONTBOLD @"PingFangSC-Semibold"
#define GIGA_TEXTFONTBOLD(font) [UIFont fontWithName:GIGA_FONTBOLD size:font]
#define GIGA_TEXTFONTMEDIUM(font) [UIFont fontWithName:GIGA_FONTNAME size:font]
//国际化
#define GIGALocalComm(key) NSLocalizedStringFromTable(key, @"GIGACommonLocalizabe", nil)
//个人中心
#define GIGALocalUser(key) NSLocalizedStringFromTable(key, @"GIGAUserLocalizable", nil)
//HUD
#define HUD_DISPLAY_DURATION 2
#define HUD_TIMEOUT_DURATION 8
#endif /* GIGA_h */