Browse Source

getSysInfo 增加IPU_IMEI选项

liuql6 5 years ago
parent
commit
be9b0a3d42

+ 13 - 4
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.h

14
 全屏截屏
14
 全屏截屏
15
 参数1:0-文件路径,1-base64编码
15
 参数1:0-文件路径,1-base64编码
16
 */
16
 */
17
-(void)fullScreenCapture:(NSArray *)params;
17
- (void)fullScreenCapture:(NSArray *)params;
18
18
/*
19
/*
19
 无状态栏截屏
20
 无状态栏截屏
20
 参数1:0-文件路径,1-base64编码
21
 参数1:0-文件路径,1-base64编码
21
 */
22
 */
22
-(void)noStatusScreenCapture:(NSArray *)params;
23
- (void)noStatusScreenCapture:(NSArray *)params;
24
23
/*
25
/*
24
 手动截屏
26
 手动截屏
25
 参数1:0-文件路径,1-base64编码
27
 参数1:0-文件路径,1-base64编码
26
 */
28
 */
27
-(void)handMovementScreenCapture:(NSArray *)params;
29
- (void)handMovementScreenCapture:(NSArray *)params;
30
28
/*
31
/*
29
 webview长图截屏
32
 webview长图截屏
30
 参数1:0-文件路径,1-base64编码
33
 参数1:0-文件路径,1-base64编码
31
 */
34
 */
32
-(void)webviewScreenCapture:(NSArray *)params;
35
- (void)webviewScreenCapture:(NSArray *)params;
36
37
- (UIImage *)screenFullShot;
38
39
- (UIImage *)screenNoStatusShot;
40
41
- (UIImage *)screenWebviewShot;
33
42
34
@end
43
@end

+ 69 - 87
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.m

8
8
9
#import "IPUScreenCapture.h"
9
#import "IPUScreenCapture.h"
10
10
11
@interface IPUScreenCapture()
11
@interface IPUScreenCapture ()
12
{
12
{
13
    BOOL base64;
13
    BOOL base64;
14
}
14
}
15
15
16
@property(nonatomic,weak)UIView *clipLeftView;
17
@property(nonatomic,weak)UIView *clipRightView;
18
@property(nonatomic,weak)UIView *clipTopView;
19
@property(nonatomic,weak)UIView *clipBottomView;
20
@property(nonatomic,weak)UIView *clipView;
16
@property (nonatomic, weak) UIView *clipLeftView;
17
@property (nonatomic, weak) UIView *clipRightView;
18
@property (nonatomic, weak) UIView *clipTopView;
19
@property (nonatomic, weak) UIView *clipBottomView;
20
@property (nonatomic, weak) UIView *clipView;
21
@property (nonatomic, assign) CGPoint startPoint;
21
@property (nonatomic, assign) CGPoint startPoint;
22
22
23
@end
23
@end
24
24
25
@implementation IPUScreenCapture
25
@implementation IPUScreenCapture
26
26
27
28
29
/*
30
 全屏截屏
31
 参数1:0-文件路径,1-base64编码
32
 */
33
-(void)fullScreenCapture:(NSArray *)params{
34
    if (params.count>0 && params[0]!=[NSNull null]) {
35
        if ([params[0] integerValue]==0) {
27
- (void)fullScreenCapture:(NSArray *)params {
28
    if (params.count && params[0] != [NSNull null]) {
29
        if (![params[0] integerValue]) {
36
            base64 = NO;
30
            base64 = NO;
37
        }else{
31
        } else {
38
            base64 = YES;
32
            base64 = YES;
39
        }
33
        }
40
    }else{
34
    } else {
41
        base64 = NO;
35
        base64 = NO;
42
    }
36
    }
37
    
43
    UIImage *image = [self screenFullShot];
38
    UIImage *image = [self screenFullShot];
44
    NSString* path = [IPUUtility createDirInDocument:@"images" withFileName:nil withPathExtension:@"jpg"];
39
    NSString *path = [IPUUtility createDirInDocument:@"images"
40
                                        withFileName:nil
41
                                   withPathExtension:@"jpg"];
45
    NSData * data = UIImageJPEGRepresentation(image, 1.0);
42
    NSData * data = UIImageJPEGRepresentation(image, 1.0);
46
    [data writeToFile:path atomically:YES];
43
    [data writeToFile:path atomically:YES];
47
    if (base64) {
44
    if (base64) {
48
        [self callback:[self base64EncodingWithData:data]];
45
        [self callback:[self base64EncodingWithData:data]];
49
    }else{
46
    } else {
50
        [self callback:path];
47
        [self callback:path];
51
    }
48
    }
52
}
49
}
53
/*
54
 无状态栏截屏
55
 参数1:0-文件路径,1-base64编码
56
 */
57
-(void)noStatusScreenCapture:(NSArray *)params{
58
    if (params.count>0 && params[0]!=[NSNull null]) {
59
        if ([params[0] integerValue]==0) {
50
51
- (void)noStatusScreenCapture:(NSArray *)params {
52
    if (params.count && params[0] != [NSNull null]) {
53
        if (![params[0] integerValue]) {
60
            base64 = NO;
54
            base64 = NO;
61
        }else{
55
        } else {
62
            base64 = YES;
56
            base64 = YES;
63
        }
57
        }
64
    }else{
58
    } else {
65
        base64 = NO;
59
        base64 = NO;
66
    }
60
    }
67
    UIImage *image = [self screenNoStatusShot];
61
    UIImage *image = [self screenNoStatusShot];
70
    [data writeToFile:path atomically:YES];
64
    [data writeToFile:path atomically:YES];
71
    if (base64) {
65
    if (base64) {
72
        [self callback:[self base64EncodingWithData:data]];
66
        [self callback:[self base64EncodingWithData:data]];
73
    }else{
67
    } else {
74
        [self callback:path];
68
        [self callback:path];
75
    }
69
    }
76
}
70
}
77
/*
78
 手动截屏
79
 参数1:0-文件路径,1-base64编码
80
 */
81
-(void)handMovementScreenCapture:(NSArray *)params{
82
    if (params.count>0 && params[0]!=[NSNull null]) {
83
        if ([params[0] integerValue]==0) {
71
72
- (void)handMovementScreenCapture:(NSArray *)params {
73
    if (params.count > 0 && params[0] != [NSNull null]) {
74
        if ([params[0] integerValue] == 0) {
84
            base64 = NO;
75
            base64 = NO;
85
        }else{
76
        } else {
86
            base64 = YES;
77
            base64 = YES;
87
        }
78
        }
88
    }else{
79
    } else {
89
        base64 = NO;
80
        base64 = NO;
90
    }
81
    }
91
    [self addPanGesture];
82
    [self addPanGesture];
92
}
83
}
93
/*
94
 webview长图截屏
95
 参数1:0-文件路径,1-base64编码
96
 */
97
-(void)webviewScreenCapture:(NSArray *)params{
98
    if (params.count>0 && params[0]!=[NSNull null]) {
99
        if ([params[0] integerValue]==0) {
84
85
- (void)webviewScreenCapture:(NSArray *)params {
86
    if (params.count > 0 && params[0] != [NSNull null]) {
87
        if ([params[0] integerValue] == 0) {
100
            base64 = NO;
88
            base64 = NO;
101
        }else{
89
        } else {
102
            base64 = YES;
90
            base64 = YES;
103
        }
91
        }
104
    }else{
92
    } else {
105
        base64 = NO;
93
        base64 = NO;
106
    }
94
    }
107
    UIImage *image = [self screenWebviewShot];
95
    UIImage *image = [self screenWebviewShot];
108
    NSString* path = [IPUUtility createDirInDocument:@"images" withFileName:nil withPathExtension:@"jpg"];
96
    NSString* path = [IPUUtility createDirInDocument:@"images"
97
                                        withFileName:nil
98
                                   withPathExtension:@"jpg"];
109
    NSData * data = UIImageJPEGRepresentation(image, 1.0);
99
    NSData * data = UIImageJPEGRepresentation(image, 1.0);
110
    [data writeToFile:path atomically:YES];
100
    [data writeToFile:path atomically:YES];
111
    if (base64) {
101
    if (base64) {
112
        [self callback:[self base64EncodingWithData:data]];
102
        [self callback:[self base64EncodingWithData:data]];
113
    }else{
103
    } else {
114
        [self callback:path];
104
        [self callback:path];
115
    }
105
    }
116
}
106
}
107
117
#pragma mark - 内部调用方法
108
#pragma mark - 内部调用方法
118
/*
119
 全屏截图
120
 */
109
121
- (UIImage *)screenFullShot {
110
- (UIImage *)screenFullShot {
122
    UIViewController *vc = [self getViewController];
111
    UIViewController *vc = [self getViewController];
123
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
112
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
126
    UIGraphicsEndImageContext();
115
    UIGraphicsEndImageContext();
127
    return screenShotImage;
116
    return screenShotImage;
128
}
117
}
129
/*
130
 无状态栏截图
131
 */
118
132
- (UIImage *)screenNoStatusShot {
119
- (UIImage *)screenNoStatusShot {
133
    IPUMobileWebView *webview = [self getWebView];
120
    IPUMobileWebView *webview = [self getWebView];
134
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
121
    UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
137
    UIGraphicsEndImageContext();
124
    UIGraphicsEndImageContext();
138
    return screenShotImage;
125
    return screenShotImage;
139
}
126
}
140
/*
141
 *  获取当前加载的网页的截图
142
 *  获取当前WebView的size,然后一屏一屏的截图后,再拼接成一张完整的图片
143
 */
144
- (UIImage *)screenWebviewShot
145
{
127
128
- (UIImage *)screenWebviewShot {
146
    IPUMobileWebView *webview = [self getWebView];
129
    IPUMobileWebView *webview = [self getWebView];
147
    // 1.获取WebView的宽高
130
    // 1.获取WebView的宽高
148
    CGSize boundsSize = webview.bounds.size;
131
    CGSize boundsSize = webview.bounds.size;
193
    UIGraphicsEndImageContext();
176
    UIGraphicsEndImageContext();
194
    return fullImage;
177
    return fullImage;
195
}
178
}
179
196
#pragma mark - base64类型图片数据
180
#pragma mark - base64类型图片数据
197
-(NSString*) base64EncodingWithPath:(NSString*) filePath{
198
    UIImage* image = [UIImage imageWithContentsOfFile:filePath];
181
182
- (NSString *)base64EncodingWithPath:(NSString *)filePath {
183
    UIImage *image = [UIImage imageWithContentsOfFile:filePath];
199
    if (image) {
184
    if (image) {
200
        NSData* data =  UIImageJPEGRepresentation(image, 1.0);
185
        NSData *data =  UIImageJPEGRepresentation(image, 1.0);
201
        NSString *base64 = [data base64EncodedStringWithOptions:0];
186
        NSString *base64 = [data base64EncodedStringWithOptions:0];
202
        return base64;
187
        return base64;
203
    }
188
    }
204
    return nil;
189
    return nil;
205
}
190
}
206
-(NSString*) base64EncodingWithData:(NSData*) data{
191
192
- (NSString *)base64EncodingWithData:(NSData *)data {
207
    if (data) {
193
    if (data) {
208
        NSString *base64 = [data base64EncodedStringWithOptions:0];
194
        NSString *base64 = [data base64EncodedStringWithOptions:0];
209
        return base64;
195
        return base64;
210
    }
196
    }
211
    return nil;
197
    return nil;
212
}
198
}
199
213
#pragma mark - 手动截图(内部调用)
200
#pragma mark - 手动截图(内部调用)
214
/*
215
 手动截图
216
 */
217
-(void)addPanGesture{
201
202
- (void)addPanGesture {
218
    UIViewController *vc = [self getViewController];
203
    UIViewController *vc = [self getViewController];
219
    self.clipLeftView.frame = vc.view.frame;
204
    self.clipLeftView.frame = vc.view.frame;
220
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
205
    UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(pan:)];
221
    [vc.view addGestureRecognizer:pan];
206
    [vc.view addGestureRecognizer:pan];
222
}
207
}
223
- (void)pan:(UIPanGestureRecognizer *)pan
224
{
208
209
- (void)pan:(UIPanGestureRecognizer *)pan {
225
    UIViewController *vc = [self getViewController];
210
    UIViewController *vc = [self getViewController];
226
    CGPoint endPoint = CGPointZero;
211
    CGPoint endPoint = CGPointZero;
227
    if (pan.state == UIGestureRecognizerStateBegan)
228
    {
212
    if (pan.state == UIGestureRecognizerStateBegan) {
229
        /**开始点击时,记录手势的起点**/
213
        /**开始点击时,记录手势的起点**/
230
        self.startPoint = [pan locationInView:vc.view];
214
        self.startPoint = [pan locationInView:vc.view];
231
    }
232
    else if(pan.state == UIGestureRecognizerStateChanged)
233
    {
215
    } else if(pan.state == UIGestureRecognizerStateChanged) {
234
        /**当手势移动时,动态改变终点的值,并计算起点与终点之间的矩形区域**/
216
        /**当手势移动时,动态改变终点的值,并计算起点与终点之间的矩形区域**/
235
        endPoint = [pan locationInView:vc.view];
217
        endPoint = [pan locationInView:vc.view];
236
        //计算矩形区域的宽高
218
        //计算矩形区域的宽高
244
        self.clipRightView.frame = CGRectMake(self.clipView.right, self.startPoint.y, SCREEN_WIDTH-self.clipView.right, self.clipView.height);
226
        self.clipRightView.frame = CGRectMake(self.clipView.right, self.startPoint.y, SCREEN_WIDTH-self.clipView.right, self.clipView.height);
245
        self.clipTopView.frame = CGRectMake(0, 0, SCREEN_WIDTH, self.clipView.top);
227
        self.clipTopView.frame = CGRectMake(0, 0, SCREEN_WIDTH, self.clipView.top);
246
        self.clipBottomView.frame = CGRectMake(0, self.clipView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.clipView.bottom);
228
        self.clipBottomView.frame = CGRectMake(0, self.clipView.bottom, SCREEN_WIDTH, SCREEN_HEIGHT-self.clipView.bottom);
247
    }
248
    else if(pan.state == UIGestureRecognizerStateEnded)
249
    {
229
    } else if(pan.state == UIGestureRecognizerStateEnded) {
250
        UIViewController *vc = [self getViewController];
230
        UIViewController *vc = [self getViewController];
251
        UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
231
        UIGraphicsBeginImageContextWithOptions(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT), NO, 0.0);
252
        [vc.view.layer renderInContext:UIGraphicsGetCurrentContext()];
232
        [vc.view.layer renderInContext:UIGraphicsGetCurrentContext()];
282
        [vc.view removeGestureRecognizer:pan];
262
        [vc.view removeGestureRecognizer:pan];
283
    }
263
    }
284
}
264
}
285
-(UIView *)clipView{
286
    if (_clipView==nil) {
265
266
- (UIView *)clipView {
267
    if (_clipView == nil) {
287
        UIView *view = [[UIView alloc] init];
268
        UIView *view = [[UIView alloc] init];
288
        _clipView = view;
269
        _clipView = view;
289
        UIViewController *vc = [self getViewController];
270
        UIViewController *vc = [self getViewController];
291
    }
272
    }
292
    return _clipView;
273
    return _clipView;
293
}
274
}
294
-(UIView *)clipLeftView{
295
    if (_clipLeftView==nil) {
275
276
- (UIView *)clipLeftView {
277
    if (_clipLeftView == nil) {
296
        UIView *view = [[UIView alloc] init];
278
        UIView *view = [[UIView alloc] init];
297
        _clipLeftView = view;
279
        _clipLeftView = view;
298
        view.backgroundColor = [UIColor blackColor];
280
        view.backgroundColor = [UIColor blackColor];
303
    return _clipLeftView;
285
    return _clipLeftView;
304
}
286
}
305
287
306
-(UIView *)clipRightView{
307
    if (_clipRightView==nil) {
288
- (UIView *)clipRightView {
289
    if (_clipRightView == nil) {
308
        UIView *view = [[UIView alloc] init];
290
        UIView *view = [[UIView alloc] init];
309
        _clipRightView = view;
291
        _clipRightView = view;
310
        view.backgroundColor = [UIColor blackColor];
292
        view.backgroundColor = [UIColor blackColor];
315
    return _clipRightView;
297
    return _clipRightView;
316
}
298
}
317
299
318
-(UIView *)clipTopView{
319
    if (_clipTopView==nil) {
300
- (UIView *)clipTopView {
301
    if (_clipTopView == nil) {
320
        UIView *view = [[UIView alloc] init];
302
        UIView *view = [[UIView alloc] init];
321
        _clipTopView = view;
303
        _clipTopView = view;
322
        view.backgroundColor = [UIColor blackColor];
304
        view.backgroundColor = [UIColor blackColor];

+ 5 - 1
IPUMobileFunc/IPUMobileFunc/Implementation/IPUBasicUtil.m

182
    }
182
    }
183
    
183
    
184
    if ([@"UUID" isEqualToString:key]) {
184
    if ([@"UUID" isEqualToString:key]) {
185
        return [self getUUIDString];
185
        return dev.identifierForVendor.UUIDString;
186
    }
186
    }
187
    
187
    
188
    if ([@"SDKVERSION" isEqualToString:key]) {
188
    if ([@"SDKVERSION" isEqualToString:key]) {
193
        return dev.name;
193
        return dev.name;
194
    }
194
    }
195
    
195
    
196
    if ([@"IPU_IMEI" isEqualToString:key]) {
197
        return [self getUUIDString];
198
    }
199
    
196
    return nil;
200
    return nil;
197
}
201
}
198
202

+ 1 - 1
display-center/Res/config/mobile-config.xml

1
<?xml version="1.0" encoding="utf-8"?>
1
<?xml version="1.0" encoding="utf-8"?>
2
<configs>
2
<configs>
3
    <config name="request_host" value="http://192.168.1.170:8070"/>
3
    <config name="request_host" value="http://www.aiipu.com:8083"/>
4
    <config name="request_path" value="/show"/>
4
    <config name="request_path" value="/show"/>
5
5
6
<!--    <config name="request_host" value="http://192.168.1.170:8070"/>-->
6
<!--    <config name="request_host" value="http://192.168.1.170:8070"/>-->

BIN
display-center/display-center.xcworkspace/xcuserdata/benny.xcuserdatad/UserInterfaceState.xcuserstate


+ 2 - 4
display-center/display-center/Info.plist

207
	<key>UISupportedInterfaceOrientations</key>
207
	<key>UISupportedInterfaceOrientations</key>
208
	<array>
208
	<array>
209
		<string>UIInterfaceOrientationPortrait</string>
209
		<string>UIInterfaceOrientationPortrait</string>
210
		<string>UIInterfaceOrientationLandscapeLeft</string>
211
		<string>UIInterfaceOrientationLandscapeRight</string>
212
	</array>
210
	</array>
213
	<key>UIViewControllerBasedStatusBarAppearance</key>
214
	<true/>
215
	<key>UIUserInterfaceStyle</key>
211
	<key>UIUserInterfaceStyle</key>
216
	<string>Light</string>
212
	<string>Light</string>
213
	<key>UIViewControllerBasedStatusBarAppearance</key>
214
	<true/>
217
</dict>
215
</dict>
218
</plist>
216
</plist>

+ 3 - 4
display-center/display-center/ViewController.m

27
27
28
- (void)viewDidLoad {
28
- (void)viewDidLoad {
29
    [super viewDidLoad];
29
    [super viewDidLoad];
30
    
31
    //    //添加动态插码:
32
    //    [IpuProxy setupProxys];
33
    
30
34
    IpuSuspendButton *button = [IpuSuspendButton sharedButton];
31
    IpuSuspendButton *button = [IpuSuspendButton sharedButton];
35
    self.button = button;
32
    self.button = button;
36
    [[UIApplication sharedApplication].delegate.window addSubview:button];
33
    [[UIApplication sharedApplication].delegate.window addSubview:button];
57
    });
54
    });
58
}
55
}
59
56
57
60
- (void)back {
58
- (void)back {
61
    UIViewController *viewController = [IPUUITool getCurrentViewController];
59
    UIViewController *viewController = [IPUUITool getCurrentViewController];
62
    
60
    
145
    return YES;
143
    return YES;
146
}
144
}
147
145
146
148
@end
147
@end