//
//  PrefixHeader.pch
//  Car
//
//  Created by Javen on 2016/12/23.
//  Copyright © 2016年 上海勾芒信息科技. All rights reserved.
//

#ifndef PrefixHeader_pch
#define PrefixHeader_pch
#import "ToolHeader.h"

//colors

#define kMainOrangeColor [UIColor colorWithRed:0.89 green:0.44 blue:0.23 alpha:1.00]

//主题色
#define kMainColor kMainOrangeColor



#ifdef DEBUG
#define CLog(format, ...)                                                      \
  NSLog((@"[L %d] %s " format), __LINE__, __PRETTY_FUNCTION__, ##__VA_ARGS__)
#else
#define CLog(format, ...)
#endif

#define kFalseHttpTips                                                         \
  if (responseObject) {                                                        \
    [MBProgressHUD j_error:responseObject[@"message"] complete:nil];           \
  }

//获取APP版本
#define APP_VERSION [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"]

//网络请求数据相关
#define kRsMsg(response) response[@"message"]
#define kRsCode(response) response[@"code"]
#define kRsSuccess(response) [kRsCode(response) isEqualToNumber:@0]
#define kShowRsMsg(response) [MBProgressHUD j_error:kRsMsg(response) complete:nil]

//三目运算符
#define kIf(condition,do,else) condition == YES ? do : else

#define kNoNullStr(string) (string != nil && [string lenth] > 0 ? string : @"")
//拼接string和prefix，拼接后的格式为prefixstring
#define kStrPrefix(string,prefix) [NSString stringWithFormat:@"%@%@",prefix,[string length] > 0 ? string : @"暂无"]

#ifdef DEBUG

#define kDebugIndex(indexPath) [MBProgressHUD j_textOnly:[NSString stringWithFormat:@"%lu",indexPath.row + 1]];

#else

#define kDebugIndex(indexPath)

#endif

#define kWindow [UIApplication sharedApplication].keyWindow
#define kBounds [UIScreen mainScreen].bounds
#define kWidth [UIScreen mainScreen].bounds.size.width
#define kHeight [UIScreen mainScreen].bounds.size.height
#define kAutoValue(value) (float)value / 375 * kWidth
#define WS(weakSelf) __weak __typeof(&*self) weakSelf = self
//收起键盘
#define HIDE_KEYBOARD                                                          \
  [[UIApplication sharedApplication].keyWindow endEditing:YES]

// 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.

#endif /* PrefixHeader_pch */
