-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathCoding_iOS-Prefix.pch.example
234 lines (194 loc) · 10.1 KB
/
Coding_iOS-Prefix.pch.example
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
//
// Prefix header
//
// The contents of this file are implicitly included at the beginning of every source file.
//
#import <Availability.h>
#ifndef __IPHONE_3_0
#warning "This project uses features only available in iOS SDK 3.0 and later."
#endif
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreData/CoreData.h>
#import "NSString+Common.h"
#import "NSObject+Common.h"
#import "UIImage+Common.h"
#import "UIButton+Bootstrap.h"
#import "UIColor+expanded.h"
#import "UIButton+Common.h"
#import "UITableView+Common.h"
#import "UIView+Common.h"
#import "UILabel+Common.h"
#import "NSDate+Common.h"
#import "UIBarButtonItem+Common.h"
#import "NSURL+Common.h"
#import "UISearchBar+Common.h"
#import "UITTTAttributedLabel.h"
#import "NSObject+ObjectMap.h"
#import "ImageSizeManager.h"
#import <UMMobClick/MobClick.h>
#import <BlocksKit/BlocksKit+UIKit.h>
#import <ReactiveCocoa/ReactiveCocoa.h>
#import <ReactiveCocoa/RACEXTScope.h>
#import "UIImageView+WebCache.h"
#import <Masonry/Masonry.h>
#import "UIView+SDAutoLayout.h"
#import "UITableView+SDAutoTableViewCellHeight.h"
#import "PHAsset+Common.h"
#import "UINavigationBar+Common.h"
#import "BaseNavigationController.h"
#import "BaseViewController.h"
#endif
#define SD_WEBP
//友盟统计
#define kUmeng_AppKey @""
#define kUmeng_Event_Request_Notification @"Request_Notification"
#define kUmeng_Event_Request_RootList @"Request_RootList"
#define kUmeng_Event_Request_Get @"Request_Get"
#define kUmeng_Event_Request_ActionOfServer @"Request_ActionOfServer"
#define kUmeng_Event_Request_ActionOfLocal @"Request_ActionOfLocal"
//Social Data
#define kSocial_WX_ID @""
#define kSocial_WX_Secret @""
#define kSocial_QQ_ID @""
#define kSocial_QQ_Secret @""
#define kSocial_EN_Key @""
#define kSocial_EN_Secret @""
#define kSocial_Sina_RedirectURL @""
#define kSocial_Sina_OfficailAccount @""
#define kSocial_Sina_ID @""
#define kSocial_Sina_Secret @""
//信鸽推送
#define kXGPush_Id 123456
#define kXGPush_Key @""
//百度定位
#define kBaiduGeotableId @""
#define kBaiduAK @""
#define kBaiduSK @""
//测试地址
#define kBaseUrlStr_Test @"https://coding.net/"
//手机版地址
#define kBaseUrlStr_Phone @"https://m.coding.net/"
//Coding App 的专属链接
#define kCodingAppScheme @"coding-net:"
//appStore地址
#define kAppUrl @"http://itunes.apple.com/app/id923676989"
#define kAppReviewURL @"itms-apps://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=923676989"
//版本号
#define kVersion_Coding [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]
#define kVersionBuild_Coding [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]
//常用变量
#define DebugLog(s, ...) NSLog(@"%s(%d): %@", __FUNCTION__, __LINE__, [NSString stringWithFormat:(s), ##__VA_ARGS__])
#define kTipAlert(_S_, ...) [[[UIAlertView alloc] initWithTitle:@"提示" message:[NSString stringWithFormat:(_S_), ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"知道了" otherButtonTitles:nil] show]
#define kKeyWindow [UIApplication sharedApplication].keyWindow
#define kHigher_iOS_6_1 (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1)
#define kHigher_iOS_6_1_DIS(_X_) ([[NSNumber numberWithBool:kHigher_iOS_6_1] intValue] * _X_)
#define kNotHigher_iOS_6_1_DIS(_X_) (-([[NSNumber numberWithBool:kHigher_iOS_6_1] intValue]-1) * _X_)
#define kDevice_Is_iPhone4 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone5 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6 ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhone6Plus ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhoneX ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1125, 2436), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhoneXR ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(828, 1792), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_iPhoneXMax ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(1242, 2688), [[UIScreen mainScreen] currentMode].size) : NO)
#define kDevice_Is_FullScreen (kDevice_Is_iPhoneX || kDevice_Is_iPhoneXR || kDevice_Is_iPhoneXMax)
#define kDevice_Is_iPad [[UIDevice currentDevice].model isEqualToString:@"iPad"]
#define kDevice_Use_iPhone4_Layout (kDevice_Is_iPhone4 || kDevice_Is_iPad)
#define kSafeArea_Top (kDevice_Is_FullScreen? 44: 20)
#define kSafeArea_Bottom (kDevice_Is_FullScreen? 34: 0)
#define kLine_MinHeight (1.0/ [UIScreen mainScreen].scale)
#define kScreen_Bounds [UIScreen mainScreen].bounds
#define kScreen_Height [UIScreen mainScreen].bounds.size.height
#define kScreen_Width [UIScreen mainScreen].bounds.size.width
#define kPaddingLeftWidth 15.0
#define kLoginPaddingLeftWidth 18.0
#define kMySegmentControl_Height 44.0
#define kMySegmentControlIcon_Height 70.0
#define kBackButtonFontSize 16
#define kNavTitleFontSize 18
#define kBadgeTipStr @"badgeTip"
#define kDefaultLastId [NSNumber numberWithInteger:99999999]
//#define kColorNavBG [UIColor colorWithHexString:@"0xF8F8F8"]
#define kColorNavBG [UIColor colorWithHexString:@"0xFFFFFF" andAlpha:1.0]
#define kColorNavTitle [UIColor colorWithHexString:@"0x323A45"]
#define kColorTableBG [UIColor colorWithHexString:@"0xFFFFFF"]
#define kColorTableSectionBg [UIColor colorWithHexString:@"0xF2F4F6"]
#define kColor222 [UIColor colorWithHexString:@"0x222222"]
#define kColor666 [UIColor colorWithHexString:@"0x666666"]
#define kColor999 [UIColor colorWithHexString:@"0x999999"]
//#define kColorDDD [UIColor colorWithHexString:@"0xDDDDDD"]
//#define kColorCCC [UIColor colorWithHexString:@"0xCCCCCC"]
#define kColorDDD kColorD8DDE4
#define kColorCCC kColorD8DDE4
#define kColorD8DDE4 [UIColor colorWithHexString:@"0xD8DDE4"]
#define kColorBrandGreen [UIColor colorWithHexString:@"0x2EBE76"]
#define kColorBrandBlue [UIColor colorWithHexString:@"0x0060FF"]
#define kColorBrandRed [UIColor colorWithHexString:@"0xF56061"]
#define kColorBrandOrange [UIColor colorWithHexString:@"0xF68435"]
#define kColorLightBlue [UIColor colorWithHexString:@"0x136BFB"]
#define kColorLinkBlue [UIColor colorWithHexString:@"0x2D59A2"]
#pragma mark New Color
#define kColorDark2 [UIColor colorWithHexString:@"0x272C33"]
#define kColorDark3 [UIColor colorWithHexString:@"0x323A45"]
#define kColorDark4 [UIColor colorWithHexString:@"0x425063"]
#define kColorDark7 [UIColor colorWithHexString:@"0x76808E"]
#define kColorDarkA [UIColor colorWithHexString:@"0xA9B3BE"]
#define kColorDarkD [UIColor colorWithHexString:@"0xD8DDE4"]
#define kColorDarkF [UIColor colorWithHexString:@"0xF2F4F6"]
#define kColorWhite [UIColor colorWithHexString:@"0xFFFFFF"]
#define kColorActionGreen [UIColor colorWithHexString:@"0x2EBE76"]
#define kColorActionBlue [UIColor colorWithHexString:@"0x0060FF"]
#define kColorActionRed [UIColor colorWithHexString:@"0xF56061"]
#define kColorActionYellow [UIColor colorWithHexString:@"0xF3C033"]
#define kPlaceholderMonkeyRoundWidth(_width_) [UIImage imageNamed:[NSString stringWithFormat:@"placeholder_monkey_round_%.0f", _width_]]
#define kPlaceholderMonkeyRoundView(_view_) [UIImage imageNamed:[NSString stringWithFormat:@"placeholder_monkey_round_%.0f", CGRectGetWidth(_view_.frame)]]
#define kPlaceholderCodingSquareWidth(_width_) [UIImage imageNamed:[NSString stringWithFormat:@"placeholder_coding_square_%.0f", _width_]]
#define kPlaceholderCodingSquareView(_view_) [UIImage imageNamed:[NSString stringWithFormat:@"placeholder_coding_square_%.0f", CGRectGetWidth(_view_.frame)]]
#define kScaleFrom_iPhone5_Desgin(_X_) (_X_ * (kScreen_Width/320))
#define kUnReadKey_messages @"messages"
#define kUnReadKey_notifications @"notifications"
#define kUnReadKey_project_update_count @"project_update_count"
#define kUnReadKey_notification_AT @"notification_at"
#define kUnReadKey_notification_Comment @"notification_comment"
#define kUnReadKey_notification_System @"notification_system"
//链接颜色
#define kLinkAttributes @{(__bridge NSString *)kCTUnderlineStyleAttributeName : [NSNumber numberWithBool:NO],(NSString *)kCTForegroundColorAttributeName : (__bridge id)kColorBrandGreen.CGColor}
#define kLinkAttributesActive @{(NSString *)kCTUnderlineStyleAttributeName : [NSNumber numberWithBool:NO],(NSString *)kCTForegroundColorAttributeName : (__bridge id)[[UIColor colorWithHexString:@"0x1b9d59"] CGColor]}
#define kTaskPrioritiesDisplay @[@"有空再看", @"正常处理", @"优先处理", @"十万火急"]
///=============================================
/// @name Weak Object
///=============================================
#pragma mark - Weak Object
/**
* @code
* ESWeak(imageView, weakImageView);
* [self testBlock:^(UIImage *image) {
* ESStrong(weakImageView, strongImageView);
* strongImageView.image = image;
* }];
*
* // `ESWeak_(imageView)` will create a var named `weak_imageView`
* ESWeak_(imageView);
* [self testBlock:^(UIImage *image) {
* ESStrong_(imageView);
* _imageView.image = image;
* }];
*
* // weak `self` and strong `self`
* ESWeakSelf;
* [self testBlock:^(UIImage *image) {
* ESStrongSelf;
* _self.image = image;
* }];
* @endcode
*/
#define ESWeak(var, weakVar) __weak __typeof(&*var) weakVar = var
#define ESStrong_DoNotCheckNil(weakVar, _var) __typeof(&*weakVar) _var = weakVar
#define ESStrong(weakVar, _var) ESStrong_DoNotCheckNil(weakVar, _var); if (!_var) return;
#define ESWeak_(var) ESWeak(var, weak_##var);
#define ESStrong_(var) ESStrong(weak_##var, _##var);
/** defines a weak `self` named `__weakSelf` */
#define ESWeakSelf ESWeak(self, __weakSelf);
/** defines a strong `self` named `_self` from `__weakSelf` */
#define ESStrongSelf ESStrong(__weakSelf, _self);