PDRToolSystemEx.h
11.5 KB
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
/*
*------------------------------------------------------------------
* pandora/tools/PDRToolSystemEx.h.h
* Description:
* 获取设备信息头文件
* DCloud Confidential Proprietary
* Copyright (c) Department of Research and Development/Beijing/DCloud.
* All Rights Reserved.
*
* Changelog:
* number author modify date modify record
* 0 xty 2013-1-10 创建文件
*------------------------------------------------------------------
*/
#import <CoreGraphics/CoreGraphics.h>
#import <UIKit/UIKit.h>
#import <QuartzCore/QuartzCore.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <CoreText/CoreText.h>
#define PT_IsAtLeastiOSVersion(X) ([[[UIDevice currentDevice] systemVersion] compare:X options:NSNumericSearch] != NSOrderedAscending)
#define PT_IsIPad() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] && ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad))
/*
**@获取系统时间
*/
@interface PTDate : NSObject
+(PTDate*)date;
@property(nonatomic, readonly)NSInteger year;
@property(nonatomic, readonly)SInt8 month;
@property(nonatomic, readonly)SInt8 day;
@property(nonatomic, readonly)SInt8 hour;
@property(nonatomic, readonly)SInt8 minute;
@property(nonatomic, readonly)double sencond;
@property(nonatomic, readonly)double milliseconds;
+(NSDate*)dateWithYear:(NSInteger)year month:(NSInteger)month day:(NSInteger)day;
+(NSDate*)dateWithHour:(NSInteger)hour minute:(NSInteger)minute sencond:(NSInteger)sencond;
@end
/*
**@采集网络的相关信息,域名为plus.device
*/
typedef NS_ENUM(NSInteger, PTNetType) {
PTNetTypeUnknow = 0,
PTNetTypeNone, // none
PTNetTypeEthernet, // none
PTNetTypeWIFI, // wifi
PTNetTypeCell2G, // 2G
PTNetTypeCell3G, // 3G
PTNetTypeCell4G, // 4G
PTNetTypeWWAN // 2g/3g
};
typedef void (^PTNetInfoNetChangeCallback)(PTNetType newNetType, PTNetType oldNetType);
@interface PTNetInfo : NSObject
@property(nonatomic, readonly)PTNetType netType;
+ (instancetype)info;
- (BOOL)startNotifierWithCallback:(SCNetworkReachabilityCallBack)reachabilityCallback;
- (BOOL)startNotifierWithBlock:(PTNetInfoNetChangeCallback)reachabilityCallback;
- (void)stopNotifier;
+ (instancetype)reachabilityForInternetConnection;
@end
/*
**@采集手机硬件的相关信息,域名为plus.device
*/
@interface PTDeviceInfo : NSObject
//国际移动设备身份码
@property(nonatomic, retain)NSString *IMEI;
//国际移动用户识别码
@property(nonatomic, retain)NSString *IMSI;
//设备型号
@property(nonatomic, retain)NSString *model;
//生产厂商
@property(nonatomic, retain)NSString *vendor;
@property(nonatomic, retain)NSString *UUID;
//移动网络国家类型,Mobile Country Code
@property(nonatomic, retain)NSString *mcc;
//"运营商代号,Mobile Country Code"
@property(nonatomic, retain)NSString *mnc;
@property(nonatomic, retain)NSString *mac;
+(PTDeviceInfo*)deviceInfo;
+ (NSString*)openUUID;
+ (NSString*)uniqueAppInstanceIdentifier;
@end
typedef NS_ENUM(NSInteger, PTSystemVersion) {
PTSystemVersion5Series = 0,
PTSystemVersion6Series,
PTSystemVersion7Series,
PTSystemVersion8Series,
PTSystemVersion9Series,
PTSystemVersion10Series,
PTSystemVersion11Series,
PTSystemVersionUnknown
};
typedef NS_ENUM(NSInteger, PTDeviceType) {
PTDeviceTypeiPhoneSimulator,
PTDeviceTypeiPhone3G,
PTDeviceTypeiPhone3GS,
PTDeviceTypeiPhone4,
PTDeviceTypeiPhone4s,
PTDeviceTypeiPhone5,
PTDeviceTypeiPhone5c,
PTDeviceTypeiPhone5s,
PTDeviceTypeiPhone6,
PTDeviceTypeiPhone6Plus,
PTDeviceTypeiPhone6s,
PTDeviceTypeiPhone6sPlus,
PTDeviceTypeiPhone7,
PTDeviceTypeiPhone7Plus,
PTDeviceTypeiPhone8,
PTDeviceTypeiPhone8Plus,
PTDeviceTypeiPhoneX,
PTDeviceTypeiPhoneXR,
PTDeviceTypeiPhoneXS,
PTDeviceTypeiPhoneXSMax,
PTDeviceTypeiPhoneSE,
PTDeviceTypeiPod3G,
PTDeviceTypeiPod4G,
PTDeviceTypeiPod5G,
PTDeviceTypeiPad5,
PTDeviceTypeiPad6,
PTDeviceTypeiPadPro,
PTDeviceTypeiPadAir2,
PTDeviceTypeiPadAir,
PTDeviceTypeNewiPad,
PTDeviceTypeiPad3,
PTDeviceTypeiPad2,
PTDeviceTypeiPad1,
PTDeviceTypeiPadMini4,
PTDeviceTypeiPadMini3,
PTDeviceTypeiPadMini2,
PTDeviceTypeiPadMini1,
PTDeviceTypeiAppleTV,
PTDeviceTypeiUnknown
};
/*
**@采集手机操作系统的相关信息,域名为plus.os
*/
@interface PTDeviceOSInfo : NSObject
//操作系统语言
@property(nonatomic, retain)NSString *language;
//操作系统版本号
@property(nonatomic, retain)NSString *version;
//操作系统名称
@property(nonatomic, retain)NSString *name;
//操作系统提供商
@property(nonatomic, retain)NSString *vendor;
+(NSString*)deviceUtsname;
+ (NSString*)getPreferredLanguage;
+ (PTDeviceOSInfo*)osInfo;
+ (PTSystemVersion)systemVersion;
+ (PTDeviceType)deviceType;
+ (NSString*)deviceTypeInString;
+ (NSString*)cuntryCode;
+ (BOOL)is7Series;
+ (BOOL)is6Series;
+ (BOOL)is5Series;
+ (BOOL)isIpad;
@end
/*
**@采集手机自身屏幕的相关分辨率等信息,域名为plus.screen
*/
@interface PTDeviceScreenInfo : NSObject
//屏幕高度
@property(nonatomic, assign)CGFloat resolutionHeight;
//屏幕宽度
@property(nonatomic, assign)CGFloat resolutionWidth;
//屏幕物理高度
@property(nonatomic, assign)CGFloat height;
//屏幕物理宽度
@property(nonatomic, assign)CGFloat width;
//X方向上的密度
@property(nonatomic, assign)CGFloat dpiX;
//Y方向上的密度
@property(nonatomic, assign)CGFloat dpiY;
@property(nonatomic, assign)CGFloat scale;
+(PTDeviceScreenInfo*)screenInfo;
@end
/*
**@采集手机自身屏幕的相关分辨率等信息,域名为plus.screen
*/
@interface PTDeviceDisplayInfo : NSObject
//应用可用区域
@property (nonatomic, assign)CGRect displayRect;
//应用可用高度
@property(nonatomic, assign)CGFloat resolutionHeight;
//应用可用宽度
@property(nonatomic, assign)CGFloat resolutionWidth;
- (CGRect)displayRect;
+(PTDeviceDisplayInfo*)displayInfo;
+(PTDeviceDisplayInfo*)displayInfoWith:(UIInterfaceOrientation)orientation;
@end
@interface PTDevice : NSObject
{
PTDeviceInfo *_deviceInfo;
PTDeviceOSInfo *_osInfo;
PTDeviceScreenInfo *_screenInfo;
PTDeviceDisplayInfo *_displayInfo;
PTNetInfo *_netInfo;
}
+(PTDevice*)sharedDevice;
-(void)update;
@property(nonatomic, retain)PTDeviceInfo *deviceInfo;
@property(nonatomic, retain)PTDeviceOSInfo *osInfo;
@property(nonatomic, retain)PTDeviceScreenInfo *screenInfo;
@property(nonatomic, retain)PTDeviceDisplayInfo *displayInfo;
/*@property(nonatomic, retain)PTNetInfo *netInfo;*/
+(long long)getAvailableMemorySize;
+(long long)getUseMemorySize;
+ (void)setDeviceInterfaceOrientation:(UIInterfaceOrientation)orientation;
@end
@interface NSString(Measure)
- (BOOL)isAlphaNumeric;
- (int)getMeasure:(CGFloat*)aOutValue withStaff:(CGFloat)aStaff;
@end
@interface UIColor(longColor)
-(NSString*)CSSColor:(BOOL)hasAlpha;
+(UIColor*)colorWithLong:(long)colorValue;
+(UIColor*)colorWithCSS:(NSString*)cssColor;
+(CGFloat)alphWithCSS:(NSString*)cssColor;
@end
@interface CAMediaTimingFunction(Util)
+(CAMediaTimingFunction*)curveEnum2Obj:(UIViewAnimationCurve)curve;
@end
@interface PTGIF :NSObject
@property(nonatomic, retain, readonly)NSArray *frames;
@property(nonatomic, retain, readonly)NSArray *delayTimes;
+ (instancetype)praseGIFData:(NSData *)data;
+ (instancetype)createGifWithFrames:(NSArray *)f withDelayTimes:(NSArray*)delayTimes;
@end
@interface NSDate (DateFormater)
+ (NSDate*)dateFromString:(NSString*)dateStr;
+ (NSString*)stringFrmeDate:(NSDate*)date;
//根据格式把时间转为字符串(默认使用本地所在时区)
- (NSString *)stringWithFormat:(NSString*)fmt;
@end
typedef NS_ENUM(NSInteger, UIImageCheckImageIsPureWhiteOption) {
UIImageCIWTop22 = 0,//从顶部向下偏移22px横线截屏检测渲染是否完成
UIImageCIWBottom22 = 1,//-从底部向上偏移25px横线检测渲染是否完成
UIImageCIWCenter = 2,//-从中间横线检测渲染是否完成
UIImageCIWAuto = 3,//为全屏检测(左、中、右三条竖线)
UIImageCIWFull = 4 // 为全屏检测
};
//导航图标旋转接口
@interface UIImage(Util)
- (UIImage *)adjustOrientation;
- (UIImage*)adjustOrientationToup;
- (UIImage*)imageRotatedByDegrees:(CGFloat)degrees
supportRetina:(BOOL)support
scale:(CGFloat)scale;
+ (UIImage*)screenshot:(UIView*)view clipRect:(CGRect)shotRect;
- (UIImage *)scaleToSize:(UIImage *)img size:(CGSize)size;
+ (BOOL)checkImageIsPureWhite:(UIImage*)image;
+ (NSData*)compressImageData:(NSData*)srcData toMaxSize:(long)maxSize;
+ (UIImage*)dcloud_imageWithContentsOfFile:(NSString *)path;
+ (BOOL)checkImageIsPureWhite:(UIImage*)image option:(UIImageCheckImageIsPureWhiteOption)option;
@end
@interface NSString (WBRequest)
- (NSString*)urlEncode;
- (NSString *)URLDecodeStringEx;
- (NSString *)URLEncodedStringEx;
- (NSString *)URLDecodedStringWithCFStringEncodingEx:(CFStringEncoding)encoding;
- (NSString *)URLEncodedStringWithCFStringEncodingEx:(CFStringEncoding)encoding;
/**
* 判断字符串中是否有中文,如果有则将中文转码
*/
- (NSString *)URLChineseEncode;
- (NSString *)convertToMD5;
- (BOOL)isWebUrlString;
@end
@interface PTTool : NSObject
+ (BOOL)setSkipBackupAttribute:(BOOL)skip toItemAtURL:(NSURL*)URL;
+ (NSDictionary*)merge:(NSDictionary*)merge to:(NSDictionary*)to;
@end
@interface NSData (AES)
- (NSData *)AESEncryptWithKey:(NSString *)key;
- (NSData *)AESEncryptWithKey128:(NSString *)key;
- (NSData *)AESDecryptWithKey:(NSString *)key;
- (NSData *)AESDecryptWithKey128:(NSString *)key;
+ (NSData *)compressData:(NSData*)uncompressedData;
- (NSData *)compressData:(NSData*)uncompressedData;
@end
typedef NS_ENUM(NSInteger, H5CoreToolDirection) {
H5CoreToolDirectionDown,
H5CoreToolDirectionUp,
H5CoreToolDirectionLeft,
H5CoreToolDirectionRight,
H5CoreToolDirectionUnknown
};
extern NSString *kDCCoreToolFontMetaKeyName;
extern NSString *kDCCoreToolFontMetaKeyTraits;
@interface H5CoreTool : NSObject
+ (NSString*)dynamicLoadFont:(NSString*)fontFilePath;
+ (NSString*)dynamicLoadFontUseCache:(NSString*)newPath;
+ (NSDictionary*)dynamicLoadFontMeta:(NSString*)fontFilePath;
+ (NSDictionary*)dynamicLoadFontMetaUseCache:(NSString*)newPath;
+ (H5CoreToolDirection)determineDirection:(CGPoint)translation;
+ (void)getLocationTestAuthentication:(BOOL)testAuthentication withReslutBlock:(void(^)(NSDictionary*, NSError*))block;
@end
@interface H5TextCheck :NSObject
+ (BOOL)isTelephone:(NSString*)value;
+ (BOOL)isEmail:(NSString*)value;
@end
@interface UIFont(H5Tool)
+(CGFloat)piexl2Size:(CGFloat)piexl;
@end
@interface NSArray(DCAdd)
-(BOOL)dc_containsStringCaseInsensitive:(NSString*)testString;
@end
typedef NS_ENUM(NSInteger, PDRCoreAppSSLActive) {
PDRCoreAppSSLActiveAllow = 0,
PDRCoreAppSSLActiveWarning,
PDRCoreAppSSLActiveRefuse
};
@interface NSObject(DCFlgs)
- (void)dc_destoryFlgs;
- (void)dc_mask_set:(int)flg;
- (BOOL)dc_mask_test:(int)flg;
- (void)dc_mask_clear:(int)flg;
- (void)dc_mask2_set:(int)flg;
- (BOOL)dc_mask2_test:(int)flg;
- (void)dc_mask2_clear:(int)flg;
+ (void)dc_mask:(NSUInteger)store clear:(int)flg;
+ (BOOL)dc_mask:(NSUInteger)store test:(int)flg;
+ (void)dc_mask:(NSUInteger)store set:(int)flg;
@end
#ifdef __cplusplus
extern "C" {
#endif
int PT_Parse_GetMeasurement( NSObject* aMeasure, CGFloat aStaff, CGFloat * aOutMeasureValue );
CGSize DCT_CGSizeSwap(CGSize);
CGRect DCT_CGRectEdgeInsets(CGRect, UIEdgeInsets);
CGRect tDCT_CGRectEdgeInsets(CGRect, UIEdgeInsets,CGFloat);
CGRect jDCT_CGRectEdgeInsets(CGRect, CGFloat,CGFloat);
#ifdef __cplusplus
}
#endif