@@ -11,7 +11,7 @@ import {
11
11
DeviceType ,
12
12
sortDescByApiLevelPredicate
13
13
} from "mobile-devices-controller" ;
14
- import { isRegExp } from "util" ;
14
+ import { isRegExp , isNumber } from "util" ;
15
15
import { NsCapabilities } from "./ns-capabilities" ;
16
16
17
17
export class DeviceManager implements IDeviceManager {
@@ -201,13 +201,14 @@ export class DeviceManager implements IDeviceManager {
201
201
202
202
args . device . apiLevel = sessionInfoDetails . deviceApiLevel ;
203
203
args . device . deviceScreenDensity = sessionInfoDetails . deviceScreenDensity / 100 ;
204
- args . device . config = { "density" : args . device . deviceScreenDensity , "offsetPixels" : + sessionInfoDetails . statBarHeight } ;
204
+ args . device . config = { "density" : args . device . deviceScreenDensity || args . device . config . density , "offsetPixels" : + sessionInfoDetails . statBarHeight || args . device . config . offsetPixels } ;
205
205
} else {
206
206
args . device . apiLevel = sessionInfoDetails . platformVersion ;
207
207
args . device . deviceScreenDensity = sessionInfoDetails . pixelRatio ;
208
- args . device . config = { "density" : sessionInfoDetails . pixelRatio , "offsetPixels" : + sessionInfoDetails . viewportRect . top - + sessionInfoDetails . statBarHeight } ;
208
+ const offsetPixels = + sessionInfoDetails . viewportRect . top - + sessionInfoDetails . statBarHeight ;
209
+ args . device . config = { "density" : sessionInfoDetails . pixelRatio || args . device . config . density , "offsetPixels" : isNumber ( offsetPixels ) ? offsetPixels : args . device . config . offsetPixels } ;
209
210
}
210
-
211
+
211
212
args . device . statBarHeight = sessionInfoDetails . statBarHeight ;
212
213
args . device . viewportRect = DeviceManager . convertViewportRectToIRectangle ( sessionInfoDetails . viewportRect ) ;
213
214
0 commit comments