Sfoglia il codice sorgente

getSysInfo 增加IPU_IMEI选项

liuql6 5 anni fa
parent
commit
be9b0a3d42

+ 13 - 4
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.h

@ -14,21 +14,30 @@
14 14
 全屏截屏
15 15
 参数1:0-文件路径,1-base64编码
16 16
 */
17
-(void)fullScreenCapture:(NSArray *)params;
17
- (void)fullScreenCapture:(NSArray *)params;
18
18 19
/*
19 20
 无状态栏截屏
20 21
 参数1:0-文件路径,1-base64编码
21 22
 */
22
-(void)noStatusScreenCapture:(NSArray *)params;
23
- (void)noStatusScreenCapture:(NSArray *)params;
24
23 25
/*
24 26
 手动截屏
25 27
 参数1:0-文件路径,1-base64编码
26 28
 */
27
-(void)handMovementScreenCapture:(NSArray *)params;
29
- (void)handMovementScreenCapture:(NSArray *)params;
30
28 31
/*
29 32
 webview长图截屏
30 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 43
@end

+ 69 - 87
IPUMobileFunc/IPUMobileFunc/IPUScreenCapture.m

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

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

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

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

@ -1,6 +1,6 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 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 4
    <config name="request_path" value="/show"/>
5 5
6 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,12 +207,10 @@
207 207
	<key>UISupportedInterfaceOrientations</key>
208 208
	<array>
209 209
		<string>UIInterfaceOrientationPortrait</string>
210
		<string>UIInterfaceOrientationLandscapeLeft</string>
211
		<string>UIInterfaceOrientationLandscapeRight</string>
212 210
	</array>
213
	<key>UIViewControllerBasedStatusBarAppearance</key>
214
	<true/>
215 211
	<key>UIUserInterfaceStyle</key>
216 212
	<string>Light</string>
213
	<key>UIViewControllerBasedStatusBarAppearance</key>
214
	<true/>
217 215
</dict>
218 216
</plist>

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

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