Environment add device brand and model info

This commit is contained in:
pengfei.zhou
2020-03-14 10:54:13 +08:00
committed by osborn
parent 47cf63ef36
commit 98c7d59a70
5 changed files with 25 additions and 1 deletions

View File

@@ -25,6 +25,7 @@
#import "DoricConstant.h"
#import "DoricUtil.h"
#import "DoricBridgeExtension.h"
#import <sys/utsname.h>
@interface DoricJSEngine ()
@property(nonatomic, strong) NSMutableDictionary *timers;
@@ -39,6 +40,12 @@ - (instancetype)init {
_jsQueue = dispatch_queue_create("doric.jsengine", DISPATCH_QUEUE_SERIAL);
_bridgeExtension = [[DoricBridgeExtension alloc] init];
NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
struct utsname systemInfo;
uname(&systemInfo);
NSString *platform = [NSString stringWithCString:systemInfo.machine encoding:NSASCIIStringEncoding];
if (TARGET_OS_SIMULATOR == 1) {
platform = [NSProcessInfo new].environment[@"SIMULATOR_MODEL_IDENTIFIER"];
}
_innerEnvironmentDictionary = @{
@"platform": @"iOS",
@"platformVersion": [[UIDevice currentDevice] systemVersion],
@@ -47,6 +54,8 @@ - (instancetype)init {
@"screenWidth": @([[UIScreen mainScreen] bounds].size.width),
@"screenHeight": @([[UIScreen mainScreen] bounds].size.height),
@"statusBarHeight": @([[UIApplication sharedApplication] statusBarFrame].size.height),
@"deviceBrand": @"Apple",
@"deviceModel": platform,
};
dispatch_async(_jsQueue, ^() {
self.timers = [[NSMutableDictionary alloc] init];